aboutsummaryrefslogtreecommitdiff
path: root/hw/imc.c
diff options
context:
space:
mode:
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>2017-09-12 17:15:59 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-12 22:52:08 -0500
commit167e65d570a7c0361c359ba082e044813e9d2fca (patch)
treea43916e8841d08ee1c41de8fddbb92a0a87b6859 /hw/imc.c
parent956083b4e0ec83480d33985dde6df51f7e657b5c (diff)
downloadskiboot-167e65d570a7c0361c359ba082e044813e9d2fca.zip
skiboot-167e65d570a7c0361c359ba082e044813e9d2fca.tar.gz
skiboot-167e65d570a7c0361c359ba082e044813e9d2fca.tar.bz2
skiboot/hw/imc: Add nest_memory region to "exports" node
Exports the In-Memory Collection counter nest memory to the OS. This allows the OS to view the nest counter region directly. This helps in nest microcode debug and to check counter raw value. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/imc.c')
-rw-r--r--hw/imc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/imc.c b/hw/imc.c
index 60fc39d..99293ee 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -402,6 +402,9 @@ static void imc_dt_update_nest_node(struct dt_node *dev)
int i=0, nr_chip = nr_chips();
struct dt_node *node;
const struct dt_property *type;
+ uint32_t offset = 0, size = 0;
+ uint64_t baddr;
+ char namebuf[32];
/* Add the base_addr and chip-id properties for the nest node */
base_addr = malloc(sizeof(uint64_t) * nr_chip);
@@ -417,8 +420,27 @@ static void imc_dt_update_nest_node(struct dt_node *dev)
if (type && is_nest_node(node)) {
dt_add_property(node, "base-addr", base_addr, (i * sizeof(u64)));
dt_add_property(node, "chip-id", chipids, (i * sizeof(u32)));
+ offset = dt_prop_get_u32(node, "offset");
+ size = dt_prop_get_u32(node, "size");
}
}
+
+ /*
+ * Enable only if we have active nest pmus.
+ */
+ if (!size)
+ return;
+
+ node = dt_find_by_name(opal_node, "exports");
+ if (!node)
+ return;
+
+ for_each_chip(chip) {
+ snprintf(namebuf, sizeof(namebuf), "imc_nest_chip_%x", chip->id);
+ baddr = chip->homer_base;
+ baddr += offset;
+ dt_add_property_u64s(node, namebuf, baddr, size);
+ }
}
/*