@@ -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;
}
@@ -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 */