[Skiboot] [PATCH v2 04/10] opal: Get chip part-number and serial-number.
Mahesh Salgaonkar
mahesh at linux.ibm.com
Wed Oct 7 23:09:14 AEDT 2020
From: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
Get chip part-number and serial-number and store it under proc_chip for
quick reference while sending error log that needs proc chip FRU details.
Signed-off-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
---
Change in v2:
- Use dt_prop_get_def().
---
core/chip.c | 4 ++++
include/chip.h | 28 ++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/core/chip.c b/core/chip.c
index f1269d3f9..d1ee59d58 100644
--- a/core/chip.c
+++ b/core/chip.c
@@ -113,6 +113,10 @@ static void init_chip(struct dt_node *dn)
if (lc)
chip->loc_code = strdup(lc);
+ /* Update part number and serial number for this chip */
+ chip->part_no = dt_prop_get_def(dn, "part-number", NULL);
+ chip->serial_no = dt_prop_get_def(dn, "serial-number", NULL);
+
prlog(PR_INFO, "CHIP: Initialised chip %d from %s\n", id, dn->name);
chips[id] = chip;
}
diff --git a/include/chip.h b/include/chip.h
index 4deb96182..53b4a41b7 100644
--- a/include/chip.h
+++ b/include/chip.h
@@ -220,6 +220,10 @@ struct proc_chip {
/* location code of this chip */
const uint8_t *loc_code;
+ /* part-number and serial number for this chip */
+ const uint8_t *part_no;
+ const uint8_t *serial_no;
+
/* Used by hw/sbe-p9.c */
struct p9_sbe *sbe;
@@ -276,5 +280,29 @@ static inline const char *chip_loc_code(uint32_t chip_id)
return chip->loc_code;
}
+/* helper to get part number of a chip */
+static inline const char *chip_part_number(uint32_t chip_id)
+{
+ struct proc_chip *chip;
+
+ chip = get_chip(chip_id);
+ if (!chip)
+ return NULL;
+
+ return chip->part_no;
+}
+
+/* helper to get serial number of a chip */
+static inline const char *chip_serial_number(uint32_t chip_id)
+{
+ struct proc_chip *chip;
+
+ chip = get_chip(chip_id);
+ if (!chip)
+ return NULL;
+
+ return chip->serial_no;
+}
+
#endif /* __CHIP_H */
More information about the Skiboot
mailing list