aboutsummaryrefslogtreecommitdiff
path: root/include/chip.h
diff options
context:
space:
mode:
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>2017-06-22 17:45:21 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-06-27 18:43:30 +1000
commitf98d59958db19f85154dfa36db8f5c7322148294 (patch)
treeef9adcbe4258b84759771867fcd8530bc6799395 /include/chip.h
parentc3aad53b91d2295dc7950c1d064d63a314f7b98a (diff)
downloadskiboot-f98d59958db19f85154dfa36db8f5c7322148294.zip
skiboot-f98d59958db19f85154dfa36db8f5c7322148294.tar.gz
skiboot-f98d59958db19f85154dfa36db8f5c7322148294.tar.bz2
skiboot: Find the IMC DTB
IMC (In Memory Collection) catalog is a repository of information about the Performance Monitoring Units (PMUs) and their events under the IMC infrastructure. The information include : - The PMU names - Event names - Event description - Event offsets - Event scale - Event unit The catalog is provided as a flattened device tree (dtb). Processors with different PVR values may have different PMU or event names. Hence, for each processor, there can be multiple device tree binaries (dtbs) containing the IMC information. Each of the dtb is compressed and forms a sub-partition inside the PNOR partition "IMA_CATALOG". Here is a link to the commit adding this partition to PNOR : https://github.com/open-power/pnor/commit/c940142c6dc64dd176096dc648f433c889919e84 So, each compressed dtb forms a sub-partition inside the IMC pnor partition and can be accessed/loaded through a sub-partition id which is nothing but the PVR id. Based on the current processor's PVR, the appropriate sub-partion will be loaded. Note however, that the catalog information is in the form of a dtb and the dtb is compressed too. So, the sub-partition loaded must be decompressed first before we can actually use it. It is important to mention here that while a PNOR image built for one processor is specific to only that processor and isn't portable, a single system generation (Processor version) may have multiple revisions and these revisions may have some changes in their IMC PMUs and events, and hence, the need for multiple IMC DTBs. The sub-partition that we obtain from the IMC pnor partition is a compressed device tree binary. We uncompress it using the libxz's functions. After uncompressing it, we link the device tree binary to the system's device tree. The kernel can now access the device tree and get the IMC PMUs and their events' information. Not all the IMC PMUs listed in the device tree may be available. This is indicated by imc availability vector (which is a part of the IMC control block structure). We need to check this vector and make sure to remove the IMC device nodes which are unavailable. Signed-off-by: Hemant Kumar <hemant@linux.vnet.ibm.com> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: use pr_fmt, fix failure path for resource load] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include/chip.h')
-rw-r--r--include/chip.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/chip.h b/include/chip.h
index 17f062b..e25f54d 100644
--- a/include/chip.h
+++ b/include/chip.h
@@ -222,6 +222,17 @@ extern struct proc_chip *get_chip(uint32_t chip_id);
extern void init_chips(void);
+/* helper to get number of chips in the system */
+static inline int nr_chips(void)
+{
+ struct proc_chip *chip;
+ int nr_chips = 0;
+
+ for_each_chip(chip)
+ nr_chips++;
+
+ return nr_chips;
+}
#endif /* __CHIP_H */