summaryrefslogtreecommitdiffstats
path: root/hw/fsp
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2015-04-06 14:03:31 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-05-07 17:42:34 +1000
commit49a931a528acc3cd5d568c0fc296bb50ed32fb54 (patch)
treefdec8c131a1c152aeaddea9fbc0f9ea9893beab2 /hw/fsp
parent3288c187c2b3e82ff78f54cd6887dc2f95d7bbe9 (diff)
downloadblackbird-skiboot-49a931a528acc3cd5d568c0fc296bb50ed32fb54.tar.gz
blackbird-skiboot-49a931a528acc3cd5d568c0fc296bb50ed32fb54.zip
FSP/LED: Handle SA indicator update notification
FSP sends SA indicator update notification via sys param update. Use that info to update cached indicator state. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/fsp')
-rw-r--r--hw/fsp/fsp-leds.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index 83d4b382..d1381db3 100644
--- a/hw/fsp/fsp-leds.c
+++ b/hw/fsp/fsp-leds.c
@@ -27,6 +27,8 @@
#include <opal.h>
#include <opal-msg.h>
#include <fsp-leds.h>
+#include <fsp-sysparam.h>
+
/* LED prefix */
#define PREFIX "FSPLED: "
@@ -330,6 +332,31 @@ static void fsp_get_sai(void)
}
}
+static bool sai_update_notification(struct fsp_msg *msg)
+{
+ uint32_t *state = &msg->data.words[2];
+ uint32_t param_id = msg->data.words[0];
+ int len = msg->data.words[1] & 0xffff;
+
+ if (param_id != SYS_PARAM_REAL_SAI && param_id != SYS_PARAM_PLAT_SAI)
+ return false;
+
+ if ( len != 4)
+ return false;
+
+ if (*state != LED_STATE_ON && *state != LED_STATE_OFF)
+ return false;
+
+ /* Update SAI state */
+ lock(&sai_lock);
+ sai_data.state = *state;
+ unlock(&sai_lock);
+
+ prlog(PR_TRACE, PREFIX
+ "SAI updated. New SAI state = 0x%x\n", *state);
+ return true;
+}
+
/*
* Update both the local LED lists to reflect upon led state changes
@@ -1899,6 +1926,9 @@ void fsp_led_init(void)
fsp_register_client(&fsp_indicator_client, FSP_MCLASS_INDICATOR);
prlog(PR_TRACE, PREFIX "FSP async command client registered\n");
+ /* Register for SAI update notification */
+ sysparam_add_update_notifier(sai_update_notification);
+
opal_register(OPAL_LEDS_GET_INDICATOR, fsp_opal_leds_get_ind, 4);
opal_register(OPAL_LEDS_SET_INDICATOR, fsp_opal_leds_set_ind, 5);
prlog(PR_TRACE, PREFIX "LED OPAL interface registered\n");
OpenPOWER on IntegriCloud