[Skiboot] [PATCH 12/12] FSP/LED: Handle SA indicator update notification
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Mon Apr 6 17:07:32 AEST 2015
FSP sends SA indicator update notification via sys param update.
Use that info to update cached indicator state.
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
Changes in v2:
- Using real SAI state, instead of virtual platform SAI
---
hw/fsp/fsp-leds.c | 30 ++++++++++++++++++++++++++++++
include/fsp-sysparam.h | 3 +++
2 files changed, 33 insertions(+)
diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index 83d4b38..d1381db 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");
diff --git a/include/fsp-sysparam.h b/include/fsp-sysparam.h
index 731a372..cccd979 100644
--- a/include/fsp-sysparam.h
+++ b/include/fsp-sysparam.h
@@ -24,6 +24,9 @@
#define SYS_PARAM_HMC_MANAGED 0xf0000003
#define SYS_PARAM_FLASH_POLICY 0xf0000012
#define SYS_PARAM_NEED_HMC 0xf0000016
+#define SYS_PARAM_REAL_SAI 0xf0000019
+#define SYS_PARAM_PARTITION_SAI 0xf000001A
+#define SYS_PARAM_PLAT_SAI 0xf000001B
#define SYS_PARAM_FW_LICENSE 0xf000001d
#define SYS_PARAM_WWPN 0xf0000023
#define SYS_PARAM_DEF_BOOT_DEV 0xf0000024
More information about the Skiboot
mailing list