@@ -43,6 +43,7 @@ extern const struct slca_entry *slca_get_entry(uint16_t slca_index);
extern const char *slca_get_vpd_name(uint16_t slca_index);
extern const char *slca_get_loc_code_index(uint16_t slca_index);
extern void slca_vpd_add_loc_code(struct dt_node *node, uint16_t slca_index);
+extern const struct slca_entry *slca_get_root_entry(uint16_t slca_index);
extern bool hservices_from_hdat(const void *fdt, size_t size);
@@ -87,3 +87,19 @@ void slca_vpd_add_loc_code(struct dt_node *node, uint16_t slca_index)
strncpy(loc_code, fru_loc_code, LOC_CODE_SIZE);
dt_add_property(node, "ibm,loc-code", loc_code, strlen(loc_code) + 1);
}
+
+const struct slca_entry *slca_get_root_entry(uint16_t slca_index)
+{
+ const struct slca_entry *s_entry;
+
+ s_entry = slca_get_entry(slca_index);
+ if (!s_entry) {
+ printf("SLCA: Entry %d bad idata\n", slca_index);
+ return NULL;
+ }
+
+ while (s_entry->parent_index)
+ s_entry = slca_get_entry(s_entry->parent_index);
+
+ return s_entry;
+}
Add a new function that returns the slca root entry. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> --- hdata/hdata.h | 1 + hdata/slca.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)