[Skiboot] [PATCH v6 8/9] nest abus and xbus units support

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Fri Feb 19 03:45:16 AEDT 2016


Add support for nest abus and xbus units. In general xbus connects
the chips within the dual chip modules(dcm) and abus connects sockets.

Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
 hw/nest.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/hw/nest.c b/hw/nest.c
index 6499677d8069..a948458139aa 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -58,6 +58,22 @@ struct nest_catalog_grps_device dev_grp_map[NEST_DT_DEVICE_MAX];
  */
 struct nest_catalog_page_0 *page0_desc;
 
+static bool is_P8_proc(void)
+{
+	struct proc_chip *chip;
+
+	chip = get_chip(this_cpu()->chip_id);
+	switch(chip->type) {
+	case PROC_CHIP_P8_VENICE:
+	case PROC_CHIP_P8_NAPLES:
+		return true;
+	default:
+		break;
+	}
+
+	return false;
+}
+
 static struct dt_node *
 dt_add_device_node(struct dt_node *ptr, const char *name)
 {
@@ -186,6 +202,34 @@ static int dt_create_nest_powerbus_node(struct dt_node *type,
 	return 0;
 }
 
+static int dt_create_nest_abus_xbus_node(struct dt_node *type,
+			struct nest_catalog_group_data *gptr, char *name)
+{
+	int idx;
+	u32 offset;
+	const char *unit = "MiB", *scale = "7.629e-6";
+
+	for(idx = 0; idx < 3; idx++) {
+		offset = get_chip_event_offset(gptr->event_index[idx],
+								DOMAIN_CHIP);
+		if (strstr(name, "abus"))
+			dt_create_nest_unit_events(type, idx, offset,
+							name, scale, unit);
+		else if (strstr(name, "xbus")) {
+			/*
+			 * Power8 uses xbus[0,1,3] and not xbus2,
+			 * So skipping it.
+			 */
+			if ((idx == 2) && is_P8_proc())
+				idx = 3;
+			dt_create_nest_unit_events(type, idx, offset,
+							name, scale, unit);
+		}
+	}
+
+	return 0;
+}
+
 /*
  * Wrapper function to call corresponding nest unit functions
  * for event dt creation. Not all the chip groups in the catalog are
@@ -210,6 +254,20 @@ static int dt_create_nest_unit(struct dt_node *ima,
 	} else if (strstr(name, "PowerBus_BW")) {
 		if (dt_create_nest_powerbus_node(ima, gptr))
 			goto out;
+	} else if (strstr(name, "A-link_data")) {
+		/*
+		 * since dt_create_nest_abus_xbus_node() is a common function
+		 * for both "xbus" and "abus", append "dev_grp_map[id].name"
+		 */
+		if (dt_create_nest_abus_xbus_node(ima, gptr, dev_grp_map[id].name))
+			goto out;
+	} else if (strstr(name, "X-link_data")) {
+		/*
+		 * since dt_create_nest_abus_xbus_node() is a common function
+		 * for both "xbus" and "abus", append "dev_grp_map[id].name"
+		 */
+		if (dt_create_nest_abus_xbus_node(ima, gptr, dev_grp_map[id].name))
+			goto out;
 	} else
 		free(name);
 
-- 
1.9.1



More information about the Skiboot mailing list