diff options
| author | Roland Veloz <rveloz@us.ibm.com> | 2017-07-17 20:33:21 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-08-11 16:32:57 -0400 |
| commit | f3423e48a1fec89b8d9f7a0f20977013f2330dd9 (patch) | |
| tree | 1638235944e89551cdde4fb67abe6353a9b12378 /src/usr/isteps/pm/runtime | |
| parent | f872a41a9d1551903f3f1caf94852e92576cd019 (diff) | |
| download | blackbird-hostboot-f3423e48a1fec89b8d9f7a0f20977013f2330dd9.tar.gz blackbird-hostboot-f3423e48a1fec89b8d9f7a0f20977013f2330dd9.zip | |
Changed method firmware_request so it can be used by OPAL
Change-Id: I5ebdc6d61b7891f1c975490820a57259b35a6fdf
RTC:175856
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43283
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: ILYA SMIRNOV <ismirno@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/isteps/pm/runtime')
| -rw-r--r-- | src/usr/isteps/pm/runtime/rt_pm.C | 174 | ||||
| -rw-r--r-- | src/usr/isteps/pm/runtime/test/firmwareRequestTest.H | 94 |
2 files changed, 229 insertions, 39 deletions
diff --git a/src/usr/isteps/pm/runtime/rt_pm.C b/src/usr/isteps/pm/runtime/rt_pm.C index 070512b8d..862e92ce7 100644 --- a/src/usr/isteps/pm/runtime/rt_pm.C +++ b/src/usr/isteps/pm/runtime/rt_pm.C @@ -334,11 +334,12 @@ namespace RTPM } if( g_hostInterfaces == NULL || - g_hostInterfaces->hcode_scom_update == NULL ) + ( g_hostInterfaces->hcode_scom_update == NULL && + g_hostInterfaces->firmware_request == NULL )) { TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"hcode_update: " - "Hypervisor hcode_scom_update interface not linked"); + ERR_MRK"hcode_update: Hypervisor hcode_scom_update" + "/firmware_request interface not linked"); /*@ * @errortype * @moduleid MOD_PM_RT_HCODE_UPDATE @@ -346,15 +347,17 @@ namespace RTPM * @userdata1[0:31] Target HUID * @userdata1[32:63] SCOM restore section * @userdata2 SCOM address - * @devdesc HCODE scom update runtime interface not linked. + * @devdesc HCODE scom update runtime + * interface not linked. */ - l_err= new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL, - MOD_PM_RT_HCODE_UPDATE, - RC_PM_RT_INTERFACE_ERR, - TWO_UINT32_TO_UINT64( + l_err= new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + MOD_PM_RT_HCODE_UPDATE, + RC_PM_RT_INTERFACE_ERR, + TWO_UINT32_TO_UINT64( TARGETING::get_huid(i_target), i_section), - i_rel_scom_addr); + i_rel_scom_addr); break; } @@ -393,37 +396,130 @@ namespace RTPM break; } - rc = g_hostInterfaces->hcode_scom_update(l_chipId, - i_section, - i_operation, - l_scomAddr, - i_scom_data); - - if(rc) + // If hcode_scom_update is not NULL then use that method + // else use firmware_request. hcode_scom_update takes + // precedence over firmware_request + if (g_hostInterfaces->hcode_scom_update != nullptr) { - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"hcode_update: " - "HCODE scom update failed. " - "rc 0x%X target 0x%llX chipId 0x%llX section 0x%X " - "operation 0x%X scomAddr 0x%llX scomData 0x%llX", - rc, get_huid(i_target), l_chipId, i_section, - i_operation, l_scomAddr, i_scom_data); - - // convert rc to error log - /*@ - * @errortype - * @moduleid MOD_PM_RT_HCODE_UPDATE - * @reasoncode RC_PM_RT_HCODE_UPDATE_ERR - * @userdata1 Hypervisor return code - * @userdata2 SCOM address - * @devdesc HCODE SCOM update error - */ - l_err=new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL, - MOD_PM_RT_HCODE_UPDATE, - RC_PM_RT_HCODE_UPDATE_ERR, - rc, - l_scomAddr); - break; + rc = g_hostInterfaces->hcode_scom_update(l_chipId, + i_section, + i_operation, + l_scomAddr, + i_scom_data); + if(rc) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"hcode_update: " + "HCODE scom update failed. " + "rc 0x%X target 0x%llX chipId 0x%llX section 0x%X " + "operation 0x%X scomAddr 0x%llX scomData 0x%llX", + rc, get_huid(i_target), l_chipId, i_section, + i_operation, l_scomAddr, i_scom_data); + + // convert rc to error log + /*@ + * @errortype + * @moduleid MOD_PM_RT_HCODE_UPDATE + * @reasoncode RC_PM_RT_HCODE_UPDATE_ERR + * @userdata1 Hypervisor return code + * @userdata2 SCOM address + * @devdesc HCODE SCOM update error + */ + l_err=new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + MOD_PM_RT_HCODE_UPDATE, + RC_PM_RT_HCODE_UPDATE_ERR, + rc, + l_scomAddr); + break; + } + } + else if (g_hostInterfaces->firmware_request != nullptr) + { + hostInterfaces::hbrt_fw_msg l_req_fw_msg; + l_req_fw_msg.io_type = + hostInterfaces::HBRT_FW_MSG_TYPE_REQ_HCODE_UPDATE; + l_req_fw_msg.req_hcode_update.i_chipId = l_chipId; + l_req_fw_msg.req_hcode_update.i_section = i_section; + l_req_fw_msg.req_hcode_update.i_operation = i_operation; + l_req_fw_msg.req_hcode_update.i_scomAddr = l_scomAddr; + l_req_fw_msg.req_hcode_update.i_scomData = i_scom_data; + + hostInterfaces::hbrt_fw_msg l_resp_fw_msg; + uint64_t l_resp_fw_msg_size = sizeof(l_resp_fw_msg); + rc = g_hostInterfaces->firmware_request(sizeof(l_req_fw_msg), + &l_req_fw_msg, &l_resp_fw_msg_size, &l_resp_fw_msg); + if(rc) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"firmware request: " + "firmware request for hcode scom update failed. " + "rc 0x%X target 0x%llX chipId 0x%llX section 0x%X " + "operation 0x%X scomAddr 0x%llX scomData 0x%llX", + rc, get_huid(i_target), l_chipId, i_section, + i_operation, l_scomAddr, i_scom_data); + + // convert rc to error log + /*@ + * @errortype + * @moduleid MOD_PM_RT_FIRMWARE_REQUEST + * @reasoncode RC_PM_RT_HCODE_UPDATE_ERR + * @userdata1[0:31] Firmware Request return code + * @userdata1[32:63] SCOM address + * @userdata2[0:31] Generic response code - if it exits + * @userdata2[32:63] Firmware Respone type + * @devdesc Firmware Request for + * HCODE SCOM update error + */ + // + // Pack the generic responce code if the response + // is of type "RESP_GENERIC" + // else just send the response type alone + uint64_t l_userData2 = 0; + if (l_resp_fw_msg_size >= + hostInterfaces::HBRT_FW_MSG_BASE_SIZE) + { + // just assign the response type for now + l_userData2 = l_resp_fw_msg.io_type; + + // Pack the response code if it is available + if ((l_resp_fw_msg_size >= + (hostInterfaces::HBRT_FW_MSG_BASE_SIZE + + sizeof(l_resp_fw_msg.resp_generic))) && + hostInterfaces::HBRT_FW_MSG_TYPE_RESP_GENERIC == + l_resp_fw_msg.io_type) + { + l_userData2 = TWO_UINT32_TO_UINT64 + (l_resp_fw_msg.resp_generic.o_status, + l_resp_fw_msg.io_type); + } + } + + l_err=new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + MOD_PM_RT_FIRMWARE_REQUEST, + RC_PM_RT_HCODE_UPDATE_ERR, + TWO_UINT32_TO_UINT64(rc, l_scomAddr), + l_userData2); + + if (l_resp_fw_msg_size > 0) + { + l_err->addFFDC( ISTEP_COMP_ID, + &l_resp_fw_msg, + l_resp_fw_msg_size, + 0, 0, false ); + } + + if (sizeof(l_req_fw_msg) > 0) + { + l_err->addFFDC( ISTEP_COMP_ID, + &l_req_fw_msg, + sizeof(l_req_fw_msg), + 0, 0, false ); + } + + break; + } } // Disable special wakeup diff --git a/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H b/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H new file mode 100644 index 000000000..2ac57ddd5 --- /dev/null +++ b/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H @@ -0,0 +1,94 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/pm/runtime/test/firmwareRequestTest.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#include <cxxtest/TestSuite.H> +#include <runtime/interface.h> + +extern trace_desc_t* g_trac_pnor; + +class FirmwareRequestTest : public CxxTest::TestSuite +{ + public: + /** + * @brief: testFirmwareRequest + * tests that the firmware_request is being accessed properly + */ + void testFirmwareRequest (void) + { + TRACFCOMP(g_trac_pnor, ENTER_MRK + "FirmwareRequestTest::testFirmwareRequest" ); + + if (g_hostInterfaces == NULL || + g_hostInterfaces->firmware_request == NULL) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequest: " + "Hypervisor firmware_request interface not linked"); + } + else + { + hostInterfaces::hbrt_fw_msg l_req_fw_msg; + l_req_fw_msg.io_type = + hostInterfaces::HBRT_FW_MSG_TYPE_REQ_HCODE_UPDATE; + l_req_fw_msg.req_hcode_update.i_chipId = 0; + l_req_fw_msg.req_hcode_update.i_section = 0; + l_req_fw_msg.req_hcode_update.i_operation = 0; + l_req_fw_msg.req_hcode_update.i_scomAddr = 0; + l_req_fw_msg.req_hcode_update.i_scomData = 0; + + + hostInterfaces::hbrt_fw_msg l_resp_fw_msg; + uint64_t l_resp_fw_msg_size = sizeof(l_resp_fw_msg); + int rc = g_hostInterfaces->firmware_request(sizeof(l_resp_fw_msg), + &l_req_fw_msg, &l_resp_fw_msg_size, &l_resp_fw_msg); + + TRACFCOMP(g_trac_pnor, "FirmwareRequestTest::testFirmwareRequest: " + "rc:%d, type:%d, resp:%d", + rc, l_resp_fw_msg.io_type, + l_resp_fw_msg.resp_generic.o_status); + + if (rc != 1) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequest: " + "firware_request failed - returned wrong value"); + } + + if (l_resp_fw_msg.io_type != + hostInterfaces::HBRT_FW_MSG_TYPE_RESP_GENERIC) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequest: " + "firware_request failed - received incorrect msg_type"); + } + + if (l_resp_fw_msg.resp_generic.o_status != 264) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequest: " + "firware_request failed - received incorrect resp"); + } + + TRACFCOMP(g_trac_pnor, EXIT_MRK + "FirmwareRequestTest::testFirmwareRequest"); + } + } +}; |

