[Skiboot] [PATCH 05/10] hw: Create xscom_read_cfam_chipid()

Michael Neuling mikey at neuling.org
Thu Feb 12 12:57:54 AEDT 2015


Create xscom_read_cfam_chipid() to read the cfam chipid().

We'll need to use this in a few places, so avoid replicating the code.

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 hw/xscom.c      | 22 ++++++++++++++++------
 include/xscom.h |  2 ++
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/hw/xscom.c b/hw/xscom.c
index 33c04b1..bc9fff4 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -433,10 +433,10 @@ int xscom_writeme(uint64_t pcb_addr, uint64_t val)
 	return xscom_write(this_cpu()->chip_id, pcb_addr, val);
 }
 
-static void xscom_init_chip_info(struct proc_chip *chip)
+int64_t xscom_read_cfam_chipid(uint32_t partid, uint32_t *chip_id)
 {
 	uint64_t val;
-	int64_t rc = 0;
+	int64_t rc = OPAL_SUCCESS;
 
 	/* Mambo chip model lacks the f000f register, just make
 	 * something up (Murano DD2.1)
@@ -444,16 +444,26 @@ static void xscom_init_chip_info(struct proc_chip *chip)
 	if (is_mambo_chip)
 		val = 0x221EF04980000000;
 	else
-		rc = xscom_read(chip->id, 0xf000f, &val);
+		rc = xscom_read(partid, 0xf000f, &val);
+
+	/* Extract CFAM id */
+	*chip_id = (uint32_t)(val >> 44);
+
+	return rc;
+}
+
+static void xscom_init_chip_info(struct proc_chip *chip)
+{
+	uint32_t val;
+	int64_t rc;
+
+	rc = xscom_read_cfam_chipid(chip->id, &val);
 	if (rc) {
 		prerror("XSCOM: Error %lld reading 0xf000f register\n", rc);
 		/* We leave chip type to UNKNOWN */
 		return;
 	}
 
-	/* Extract CFAM id */
-	val >>= 44;
-
 	/* Identify chip */
 	switch(val & 0xff) {
 	case 0xf9:
diff --git a/include/xscom.h b/include/xscom.h
index 5eed85f..b1ecaf5 100644
--- a/include/xscom.h
+++ b/include/xscom.h
@@ -173,4 +173,6 @@ extern void xscom_init(void);
 /* Mark XSCOM lock as being in console path */
 extern void xscom_used_by_console(void);
 
+extern int64_t xscom_read_cfam_chipid(uint32_t partid, uint32_t *chip_id);
+
 #endif /* __XSCOM_H */
-- 
2.1.0



More information about the Skiboot mailing list