aboutsummaryrefslogtreecommitdiff
path: root/hw/imc.c
diff options
context:
space:
mode:
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>2017-09-11 14:05:39 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-12 22:52:08 -0500
commit956083b4e0ec83480d33985dde6df51f7e657b5c (patch)
treec5b75fc4d46d4dd24bb82a5a2ad1fcef18782dad /hw/imc.c
parent8782c0da7243fb6c608e6a00fd90957423832481 (diff)
downloadskiboot-956083b4e0ec83480d33985dde6df51f7e657b5c.zip
skiboot-956083b4e0ec83480d33985dde6df51f7e657b5c.tar.gz
skiboot-956083b4e0ec83480d33985dde6df51f7e657b5c.tar.bz2
skiboot/skiboot.tcl: Add imc device nodes to skiboot.tcl
Add In-Memory Collection counter dummy nodes to the skiboot.tcl to aid code testing in mambo for both OPAL and Kernel side enablement. 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.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/hw/imc.c b/hw/imc.c
index ccf3973..60fc39d 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -310,9 +310,14 @@ static void disable_unavailable_units(struct dt_node *dev)
cb = get_imc_cb(this_cpu()->chip_id);
if (cb)
avl_vec = be64_to_cpu(cb->imc_chip_avl_vector);
- else
+ else {
avl_vec = 0; /* Remove only nest imc device nodes */
+ /* Incase of mambo, just fake it */
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)
+ avl_vec = (0xffULL) << 56;
+ }
+
for (i = 0; i < MAX_NEST_UNITS; i++) {
if (!(PPC_BITMASK(i, i) & avl_vec)) {
/* Check if the device node exists */
@@ -365,6 +370,9 @@ void imc_catalog_preload(void)
int ret = OPAL_SUCCESS;
compress_buf_size = MAX_COMPRESSED_IMC_DTB_SIZE;
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)
+ return;
+
/* Enable only for power 9 */
if (proc_gen != proc_gen_p9)
return;
@@ -421,11 +429,20 @@ static void imc_dt_update_nest_node(struct dt_node *dev)
*/
void imc_init(void)
{
- void *decompress_buf;
+ void *decompress_buf = NULL;
uint32_t pvr = (mfspr(SPR_PVR) & ~(0xf000));
struct dt_node *dev;
int ret;
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS) {
+ dev = dt_find_compatible_node(dt_root, NULL,
+ "ibm,opal-in-memory-counters");
+ if (!dev)
+ return;
+
+ goto imc_mambo;
+ }
+
/* Enable only for power 9 */
if (proc_gen != proc_gen_p9)
return;
@@ -481,6 +498,7 @@ void imc_init(void)
goto err;
}
+imc_mambo:
/* Check and remove unsupported imc device types */
check_imc_device_type(dev);
@@ -496,6 +514,9 @@ void imc_init(void)
/* Update the base_addr and chip-id for nest nodes */
imc_dt_update_nest_node(dev);
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)
+ return;
+
/*
* If the dt_attach_root() fails, "imc-counters" node will not be
* seen in the device-tree and hence OS should not make any
@@ -541,6 +562,9 @@ static int64_t opal_imc_counters_init(uint32_t type, uint64_t addr, uint64_t cpu
phys_core_id = cpu_get_core_index(c);
port_id = phys_core_id % 4;
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)
+ return OPAL_SUCCESS;
+
/*
* Core IMC hardware mandate initing of three scoms
* to enbale or disable of the Core IMC engine.
@@ -605,6 +629,9 @@ static int64_t opal_imc_counters_start(uint32_t type, uint64_t cpu_pir)
/* Set the run command */
op = NEST_IMC_ENABLE;
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)
+ return OPAL_SUCCESS;
+
/* Write the command to the control block now */
cb->imc_chip_command = cpu_to_be64(op);
@@ -617,6 +644,9 @@ static int64_t opal_imc_counters_start(uint32_t type, uint64_t cpu_pir)
phys_core_id = cpu_get_core_index(c);
port_id = phys_core_id % 4;
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)
+ return OPAL_SUCCESS;
+
/*
* Enables the core imc engine by appropriately setting
* bits 4-9 of the HTM_MODE scom port. No initialization
@@ -659,6 +689,9 @@ static int64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir)
/* Set the run command */
op = NEST_IMC_DISABLE;
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)
+ return OPAL_SUCCESS;
+
/* Write the command to the control block */
cb->imc_chip_command = cpu_to_be64(op);
@@ -672,6 +705,9 @@ static int64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir)
phys_core_id = cpu_get_core_index(c);
port_id = phys_core_id % 4;
+ if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)
+ return OPAL_SUCCESS;
+
/*
* Disables the core imc engine by clearing
* bits 4-9 of the HTM_MODE scom port.