summaryrefslogtreecommitdiffstats
path: root/hdata/slca.c
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2015-04-06 14:02:10 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-05-07 17:42:34 +1000
commit13168bbbbb1f41f63c9a53f6772868ba02726d5b (patch)
tree4f333a315d3437dbb0634def80b24d4a80a6b892 /hdata/slca.c
parentf30f196e5c03fc6ffef0f240c74e08e44ceb66b5 (diff)
downloadtalos-skiboot-13168bbbbb1f41f63c9a53f6772868ba02726d5b.tar.gz
talos-skiboot-13168bbbbb1f41f63c9a53f6772868ba02726d5b.zip
FSP/hdata: Populate System Attention Indicator location code
On FSP based machine, FSP controls System Attention Indicator. This indicator detail (location code) is passed to OPAL via HDAT. OPAL can get/set this indicator via normal MBOX command. This patch takes care of parsing SLCA entry and populating device tree with SAI location code. Device Tree: We create '/ibm,opal/led' node which contains all location code LED information. 'led-types' property under each node tells LED type. For SAI indicator 'led-types' property will be 'attention'. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata/slca.c')
-rw-r--r--hdata/slca.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/hdata/slca.c b/hdata/slca.c
index aaa5fc65..3130d5b9 100644
--- a/hdata/slca.c
+++ b/hdata/slca.c
@@ -16,6 +16,9 @@
#include <device.h>
+#include <include/opal-internal.h>
+#include <fsp-leds.h>
+
#include "spira.h"
#include "hdata.h"
@@ -89,3 +92,79 @@ void slca_vpd_add_loc_code(struct dt_node *node, uint16_t slca_index)
strncpy(loc_code, fru_loc_code, LOC_CODE_SIZE - 1);
dt_add_property(node, "ibm,loc-code", loc_code, strlen(loc_code) + 1);
}
+
+/*
+ * Get System Attention Indicator SLCA entry
+ */
+static const struct slca_entry *slca_get_sai_entry(void)
+{
+ int count;
+ unsigned int i;
+ struct HDIF_common_hdr *slca_hdr;
+
+ slca_hdr = get_hdif(&spira.ntuples.slca, SLCA_HDIF_SIG);
+ if (!slca_hdr) {
+ prerror("SLCA Invalid\n");
+ return NULL;
+ }
+
+ count = HDIF_get_iarray_size(slca_hdr, SLCA_IDATA_ARRAY);
+ if (count < 0) {
+ prerror("SLCA: Can't find SLCA array size!\n");
+ return NULL;
+ }
+
+ for (i = 0; i < count; i++) {
+ const struct slca_entry *s_entry;
+ unsigned int entry_sz;
+
+ s_entry = HDIF_get_iarray_item(slca_hdr, SLCA_IDATA_ARRAY,
+ i, &entry_sz);
+ if (s_entry &&
+ VPD_ID(s_entry->fru_id[0],
+ s_entry->fru_id[1]) == SLCA_SAI_INDICATOR_ID) {
+ prlog(PR_TRACE, "SLCA: SAI index: 0x%x\n",
+ s_entry->my_index);
+ prlog(PR_TRACE, "SLCA: SAI location code: %s\n",
+ s_entry->loc_code);
+ return s_entry;
+ }
+ }
+
+ return NULL;
+}
+
+/*
+ * SLCA structure contains System Attention Indicator location
+ * code (FRU ID = SA). Add this information to device tree
+ * (under '/ibm,opal/led').
+ */
+void slca_dt_add_sai_node(void)
+{
+ const struct slca_entry *s_entry;
+ struct dt_node *led_node, *sai_node;
+
+ s_entry = slca_get_sai_entry();
+ if (!s_entry)
+ return;
+
+ /* Create /ibm,opal node, if its not created already */
+ if (!opal_node)
+ return;
+
+ /* Crete LED parent node */
+ led_node = dt_find_by_path(opal_node, DT_PROPERTY_LED_NODE);
+ if (!led_node)
+ return;
+
+ if (s_entry->loc_code_len == 0 ||
+ s_entry->loc_code_len > LOC_CODE_SIZE)
+ return;
+
+ /* Create SAI node */
+ sai_node = dt_new(led_node, s_entry->loc_code);
+ assert(sai_node);
+
+ dt_add_property_string(sai_node,
+ DT_PROPERTY_LED_TYPES, LED_TYPE_ATTENTION);
+}
OpenPOWER on IntegriCloud