[Skiboot] [PATCH v1 2/3] hdata/slca: Function to return the slca root entry

Neelesh Gupta neelegup at linux.vnet.ibm.com
Mon Dec 22 05:30:24 AEDT 2014


Add a new function that returns the slca root entry.

Signed-off-by: Neelesh Gupta <neelegup at linux.vnet.ibm.com>
---
 hdata/hdata.h |    1 +
 hdata/slca.c  |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/hdata/hdata.h b/hdata/hdata.h
index 79cc576..329c4a8 100644
--- a/hdata/hdata.h
+++ b/hdata/hdata.h
@@ -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);
 
diff --git a/hdata/slca.c b/hdata/slca.c
index a709aaa..48303bb 100644
--- a/hdata/slca.c
+++ b/hdata/slca.c
@@ -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;
+}



More information about the Skiboot mailing list