[Skiboot] [PATCH 17/22] FSP/LEDS: Modify handling of SPCN based LED commands

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Feb 5 19:41:47 AEDT 2015


From: Anshuman Khandual <khandual at linux.vnet.ibm.com>

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 at linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hw/fsp/fsp-leds.c |   29 +++++++++++++++++++----------
 hw/fsp/fsp-leds.h |    8 ++++++++
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index 335a967..7c8bc8b 100644
--- a/hw/fsp/fsp-leds.c
+++ b/hw/fsp/fsp-leds.c
@@ -277,13 +277,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");
+			}
 		}
 	}
 
@@ -472,7 +477,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_cmplt' 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;
@@ -489,6 +495,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);
@@ -919,12 +926,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;
 };
 



More information about the Skiboot mailing list