[Skiboot] [PATCH] FSP/LEDS: Add support to handle SAI state request from service processor

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Jul 2 18:32:10 AEST 2015


Ideally service processor shouldn't request OPAL for SAI state...as this
LED is controlled by service processor itself.

But of some reason its asking OPAL to provide state. Hence handle this
request until FSP team fixes it.

Sample log without this patch:
  [77884350335,3] FSPLED: Could not find the location code LC=U8246.L2C.060377A
  [77942662287,8] FSPLED: FSP_CMD_GET_LED_LIST command received

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hw/fsp/fsp-leds.c | 55 ++++++++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 25 deletions(-)

diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index 52d6c90..2f478d6 100644
--- a/hw/fsp/fsp-leds.c
+++ b/hw/fsp/fsp-leds.c
@@ -952,45 +952,50 @@ static void fsp_free_led_list_buf(struct fsp_msg *msg)
 
 static void fsp_ret_led_state(char *loc_code)
 {
-	struct fsp_led_data *led, *next;
+	bool found = false;
 	u8 ind_state = 0;
+	u32 cmd = FSP_RSP_GET_LED_STATE;
+	struct fsp_led_data *led, *next;
 	struct fsp_msg *msg;
 
-	list_for_each_safe(&cec_ledq, led, next, link) {
-		if (strcmp(loc_code, led->loc_code))
-			continue;
+	if (is_sai_loc_code(loc_code)) {
+		if (sai_data.state & OPAL_SLOT_LED_STATE_ON)
+			ind_state = FSP_IND_FAULT_ACTV;
+		found = true;
+	} else {
+		list_for_each_safe(&cec_ledq, led, next, link) {
+			if (strcmp(loc_code, led->loc_code))
+				continue;
 
-		/* Found the location code */
-		if (led->status & SPCN_LED_IDENTIFY_MASK)
-			ind_state |= FSP_IND_IDENTIFY_ACTV;
-		if (led->status & SPCN_LED_FAULT_MASK)
-			ind_state |= FSP_IND_FAULT_ACTV;
-		msg = fsp_mkmsg(FSP_RSP_GET_LED_STATE, 1, ind_state);
-		if (!msg) {
-			prerror("Couldn't alloc FSP_RSP_GET_LED_STATE\n");
-			return;
-		}
-		if (fsp_queue_msg(msg, fsp_freemsg)) {
-			fsp_freemsg(msg);
-			prerror("Couldn't queue FSP_RSP_GET_LED_STATE\n");
+			/* Found the location code */
+			if (led->status & SPCN_LED_IDENTIFY_MASK)
+				ind_state |= FSP_IND_IDENTIFY_ACTV;
+			if (led->status & SPCN_LED_FAULT_MASK)
+				ind_state |= FSP_IND_FAULT_ACTV;
+
+			found = true;
+			break;
 		}
-		return;
 	}
 
 	/* Location code not found */
-	log_simple_error(&e_info(OPAL_RC_LED_LC),
-			 "Could not find the location code LC=%s\n", loc_code);
+	if (!found) {
+		log_simple_error(&e_info(OPAL_RC_LED_LC),
+				 "Could not find the location code LC=%s\n",
+				 loc_code);
+		cmd |= FSP_STATUS_INVALID_LC;
+		ind_state = 0xff;
+	}
 
-	msg = fsp_mkmsg(FSP_RSP_GET_LED_STATE | FSP_STATUS_INVALID_LC, 1, 0xff);
+	msg = fsp_mkmsg(cmd, 1, ind_state);
 	if (!msg) {
-		prerror("Failed to alloc FSP_RSP_GET_LED_STATE "
-			"| FSP_STATUS_INVALID_LC\n");
+		prerror("Couldn't alloc FSP_RSP_GET_LED_STATE\n");
 		return;
 	}
+
 	if (fsp_queue_msg(msg, fsp_freemsg)) {
 		fsp_freemsg(msg);
-		prerror("Failed to queue FSP_RSP_GET_LED_STATE "
-			"| FSP_STATUS_INVALID_LC\n");
+		prerror("Couldn't queue FSP_RSP_GET_LED_STATE\n");
 	}
 }
 
-- 
2.1.0



More information about the Skiboot mailing list