[Skiboot] [PATCH 06/16] hw: Create xscom_read_cfam_chipid()

Michael Neuling mikey at neuling.org
Fri Feb 20 11:37:49 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 2acd5a0..d8af989 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -431,10 +431,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)
@@ -442,16 +442,26 @@ static void xscom_init_chip_info(struct proc_chip *chip)
 	if (chip_quirk(QUIRK_NO_F000F))
 		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