From 167e65d570a7c0361c359ba082e044813e9d2fca Mon Sep 17 00:00:00 2001 From: Madhavan Srinivasan Date: Tue, 12 Sep 2017 17:15:59 +0530 Subject: 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 Signed-off-by: Stewart Smith --- hw/imc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'hw/imc.c') 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); + } } /* -- cgit v1.1