diff options
author | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2015-07-02 14:02:10 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-07-17 11:53:54 +1000 |
commit | 8150b63914fd4929e874bc4614da08be56c69512 (patch) | |
tree | 593d1b15c0f2f641ea4f0f819c8cb33d8e6c8e7f | |
parent | be8b9c13742ffa4b7c395a1e86b398b01e7bbb79 (diff) | |
download | skiboot-8150b63914fd4929e874bc4614da08be56c69512.zip skiboot-8150b63914fd4929e874bc4614da08be56c69512.tar.gz skiboot-8150b63914fd4929e874bc4614da08be56c69512.tar.bz2 |
FSP/LEDS: Add support to handle SAI state request from service processor
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@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hw/fsp/fsp-leds.c | 55 |
1 files 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"); } } |