@@ -63,6 +63,8 @@ static void init_chip(struct dt_node *dn)
struct proc_chip *chip;
uint32_t id;
const char *lc = NULL;
+ const char *part_no = NULL;
+ const char *serial_no = NULL;
id = dt_get_chip_id(dn);
assert(id < MAX_CHIPS);
@@ -93,6 +95,17 @@ static void init_chip(struct dt_node *dn)
if (lc)
chip->loc_code = strdup(lc);
+ /* Update part number and serial number for this chip */
+ if (dt_has_node_property(dn, "part-number", NULL))
+ part_no = dt_prop_get(dn, "part-number");
+ if (part_no)
+ chip->part_no = strdup(part_no);
+
+ if (dt_has_node_property(dn, "serial-number", NULL))
+ serial_no = dt_prop_get(dn, "serial-number");
+ if (serial_no)
+ chip->serial_no = strdup(serial_no);
+
prlog(PR_INFO, "CHIP: Initialised chip %d from %s\n", id, dn->name);
chips[id] = chip;
}
@@ -187,6 +187,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;
@@ -233,5 +237,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 */