aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAnshuman Khandual <khandual@linux.vnet.ibm.com>2015-03-08 16:13:35 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-03-20 02:34:29 +1100
commitc2bdc55a1226ccdff9e3528ac3c0be23e921d88c (patch)
tree6434c4cc9e8c235c9ed5508d45e403d405df8e68 /hw
parent21fcbab73392de9f764d8b7abbcc8ea20b394d4c (diff)
downloadskiboot-c2bdc55a1226ccdff9e3528ac3c0be23e921d88c.zip
skiboot-c2bdc55a1226ccdff9e3528ac3c0be23e921d88c.tar.gz
skiboot-c2bdc55a1226ccdff9e3528ac3c0be23e921d88c.tar.bz2
FSP/LEDS: Modify handling of SPCN based LED commands
OPAL queues up asynchronous SPCN command to change the state of any given LED with a function call back. After receiving the call back, it sends acknowledgement message to the FSP for the previous command. But in case of OPAL interface initiated LED state changes, no ack message needs to be sent to the FSP, instead we might want to enable some flags for OPAL indicating the success of the previous LED request thus making the OPAL interface ready for subsequent commands from the host. This creates a need to distinguish between SPCN based LED commands generated because of FSP async interface compared to that of OPAL interface. This patch achieves the classification and other needfull changes in this regard. These changes will be necessary and used by OPAL interface in subsequent patches in this series. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/fsp/fsp-leds.c29
-rw-r--r--hw/fsp/fsp-leds.h8
2 files changed, 27 insertions, 10 deletions
diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index f3da941..506e031 100644
--- a/hw/fsp/fsp-leds.c
+++ b/hw/fsp/fsp-leds.c
@@ -269,13 +269,18 @@ static void fsp_spcn_set_led_completion(struct fsp_msg *msg)
update_led_list(spcn_cmd->loc_code, spcn_cmd->ckpt_status);
}
- smsg = fsp_mkmsg(cmd, 0);
- if (!smsg) {
- prerror(PREFIX "Failed to allocate FSP_RSP_SET_LED_STATE\n");
- } else {
- if (fsp_queue_msg(smsg, fsp_freemsg)) {
- fsp_freemsg(smsg);
- prerror(PREFIX "Failed to queue FSP_RSP_SET_LED_STATE\n");
+ /* FSP initiated SPCN command */
+ if (spcn_cmd->cmd_src == SPCN_SRC_FSP) {
+ smsg = fsp_mkmsg(cmd, 0);
+ if (!smsg) {
+ prerror(PREFIX
+ "Failed to allocate FSP_RSP_SET_LED_STATE\n");
+ } else {
+ if (fsp_queue_msg(smsg, fsp_freemsg)) {
+ fsp_freemsg(smsg);
+ prerror(PREFIX "Failed to queue "
+ "FSP_RSP_SET_LED_STATE\n");
+ }
}
}
@@ -463,7 +468,8 @@ static int process_led_state_change(void)
* list and keeps the chain execution going. At last when there are no elements
* in the command queue it sets 'spcn_cmd_complete' as true again.
*/
-static int queue_led_state_change(char *loc_code, u8 command, u8 state)
+static int queue_led_state_change(char *loc_code, u8 command,
+ u8 state, int cmd_src)
{
struct led_set_cmd *cmd;
int rc = 0;
@@ -480,6 +486,7 @@ static int queue_led_state_change(char *loc_code, u8 command, u8 state)
strncpy(cmd->loc_code, loc_code, strlen(loc_code));
cmd->command = command;
cmd->state = state;
+ cmd->cmd_src = cmd_src;
/* Add to the queue */
lock(&spcn_cmd_lock);
@@ -910,12 +917,14 @@ static void fsp_set_led_state(struct fsp_msg *msg)
if (!strcmp(led->loc_code, req.loc_code))
continue;
- queue_led_state_change(led->loc_code, command, state);
+ queue_led_state_change(led->loc_code,
+ command, state, SPCN_SRC_FSP);
}
break;
case SET_IND_SINGLE_LOC_CODE:
/* Set led state for single descendent led */
- queue_led_state_change(req.loc_code, command, state);
+ queue_led_state_change(req.loc_code,
+ command, state, SPCN_SRC_FSP);
break;
default:
resp = fsp_mkmsg(FSP_RSP_SET_LED_STATE |
diff --git a/hw/fsp/fsp-leds.h b/hw/fsp/fsp-leds.h
index de750ad..98b0f01 100644
--- a/hw/fsp/fsp-leds.h
+++ b/hw/fsp/fsp-leds.h
@@ -40,6 +40,13 @@
#define FSP_LED_EXCL_FAULT 1UL << 0
#define FSP_LED_EXCL_IDENTIFY 1UL << 1
+/* LED update message source */
+enum spcn_cmd_src {
+ SPCN_SRC_FSP = 0,
+ SPCN_SRC_OPAL = 1,
+ SPCN_SRC_MAX = 2
+};
+
/* SPCN set LED */
struct spcn_led_data {
u8 lc_len;
@@ -113,6 +120,7 @@ struct led_set_cmd {
u8 command;
u8 state;
u16 ckpt_status; /* Checkpointed status */
+ enum spcn_cmd_src cmd_src; /* OPAL or FSP based */
struct list_node link;
};