From 2a1cc4f4045ddfb247a7be1a18593a9836db8412 Mon Sep 17 00:00:00 2001 From: Roland Veloz Date: Wed, 23 Aug 2017 10:29:57 -0500 Subject: Updated VPD from HBRT on FSP systems Created a generic message type that is used as a mailbox message that is passed from HBRT to FSP. The new generic message type is used to make a VPD write call. Change-Id: I21240d19909f786d525e2a98878000af4aea6e9f RTC:171488 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45048 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: William G. Hoffa Reviewed-by: Daniel M. Crowell --- .../isteps/pm/runtime/test/firmwareRequestTest.H | 91 +++++++++++ src/usr/testcore/rtloader/loader.H | 65 ++++++-- src/usr/vpd/ipvpd.C | 6 - src/usr/vpd/runtime/rt_vpd.C | 171 +++++++++++++++++---- src/usr/vpd/test/mvpdtest.H | 16 +- 5 files changed, 286 insertions(+), 63 deletions(-) (limited to 'src/usr') diff --git a/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H b/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H index 73ae4b0a2..231197ec3 100644 --- a/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H +++ b/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H @@ -162,4 +162,95 @@ class FirmwareRequestTest : public CxxTest::TestSuite "FirmwareRequestTest::testFirmwareRequestErrLogToFsp"); } // end testFirmwareRequestErrLogToFsp + + /** + * @brief: testFirmwareRequestHbrtToFsp + * test the firmware_request's HBRT to FSP call + */ + void testFirmwareRequestHbrtToFsp (void) + { + TRACFCOMP(g_trac_pnor, ENTER_MRK + "FirmwareRequestTest::testFirmwareRequestHbrtToFsp"); + + if (g_hostInterfaces == NULL || + g_hostInterfaces->firmware_request == NULL) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: " + "Hypervisor firmware_request interface not linked"); + } + else + { + // Test HBRT to FSP + // populate the firmware_request structure with arbitrary data + hostInterfaces::hbrt_fw_msg l_req_fw_msg; + l_req_fw_msg.io_type = hostInterfaces::HBRT_FW_MSG_HBRT_FSP; + l_req_fw_msg.generic_message.msgq = 0x300; + l_req_fw_msg.generic_message.msgType = 0x400; + l_req_fw_msg.generic_message.data = 0xDEADBEEF; + + TRACFCOMP(g_trac_pnor, + "FirmwareRequestTest::testFirmwareRequestHbrtToFsp req: " + "type:%d, msgq:0x%.8X, msgType:0x%.8X, data:0x%.8X", + l_req_fw_msg.io_type, + l_req_fw_msg.generic_message.msgq, + l_req_fw_msg.generic_message.msgType, + l_req_fw_msg.generic_message.data); + + hostInterfaces::hbrt_fw_msg l_resp_fw_msg; + uint64_t l_resp_fw_msg_size = sizeof(l_resp_fw_msg); + size_t rc = g_hostInterfaces->firmware_request( + sizeof(l_req_fw_msg), &l_req_fw_msg, + &l_resp_fw_msg_size, &l_resp_fw_msg); + + TRACFCOMP(g_trac_pnor, + "FirmwareRequestTest::testFirmwareRequestHbrtToFsp resp: " + "type:0x%.8X, msgq:0x%.8X, msgType:0x%.8X," + " errPlid:0x%X, rc=%d", + l_resp_fw_msg.io_type, + l_resp_fw_msg.generic_message_resp.msgq, + l_resp_fw_msg.generic_message_resp.msgType, + l_resp_fw_msg.generic_message_resp.errPlid, + rc); + + if (rc != 0) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: " + "firmware_request - HBRT to FSP failed - " + "returned wrong value"); + } + + if (l_resp_fw_msg.io_type != + hostInterfaces::HBRT_FW_MSG_HBRT_FSP_RESP) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: " + "firmware_request - HBRT to FSP failed - " + "received incorrect msg_type"); + } + + if (l_resp_fw_msg.generic_message_resp.msgq != 0x800) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: " + "firware_request - HBRT to FSP failed - " + "received incorrect msgq"); + } + + if (l_resp_fw_msg.generic_message_resp.msgType != 0x900) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: " + "firware_request - HBRT to FSP failed - " + "received incorrect msgType"); + } + + if (l_resp_fw_msg.generic_message_resp.errPlid != 0xA00) + { + TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: " + "firware_request - HBRT to FSP failed - " + "received incorrect errPlid"); + } + } + TRACFCOMP(g_trac_pnor, EXIT_MRK + "FirmwareRequestTest::testFirmwareRequestHbrtToFsp"); + + } // end testFirmwareRequestHbrtToFsp + }; // end class FirmwareRequestTest diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H index 97efc782f..60056c633 100644 --- a/src/usr/testcore/rtloader/loader.H +++ b/src/usr/testcore/rtloader/loader.H @@ -724,7 +724,6 @@ class RuntimeLoaderTest : public CxxTest::TestSuite hostInterfaces::hbrt_fw_msg* l_resp_fw_msg = (hostInterfaces::hbrt_fw_msg*) o_resp; - if (*o_respLen < (hostInterfaces::HBRT_FW_MSG_BASE_SIZE + sizeof(l_resp_fw_msg->resp_generic))) { @@ -742,7 +741,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite break; } - TRACFCOMP(g_trac_hbrt, ENTER_MRK + TRACFCOMP(g_trac_hbrt, "rt_firmware_request for HCODE SCOM update: " "type:%d, chipId:0x%X, section:%d, " "operation:%d, scomAddr:0x%X scomData:0x%X", @@ -753,14 +752,13 @@ class RuntimeLoaderTest : public CxxTest::TestSuite l_req_fw_msg->req_hcode_update.i_scomAddr, l_req_fw_msg->req_hcode_update.i_scomData); - l_resp_fw_msg->io_type = - hostInterfaces::HBRT_FW_MSG_TYPE_RESP_GENERIC; + l_resp_fw_msg->io_type = + hostInterfaces::HBRT_FW_MSG_TYPE_RESP_GENERIC; - // dummy return value for testing - l_resp_fw_msg->resp_generic.o_status = 264; + // dummy return value for testing + l_resp_fw_msg->resp_generic.o_status = 264; - TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_firmware_request"); - retVal = 1; // just return 1 for testing + retVal = 1; // just return 1 for testing } else if (hostInterfaces::HBRT_FW_MSG_TYPE_ERROR_LOG == l_req_fw_msg->io_type) @@ -781,7 +779,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite } - TRACFCOMP(g_trac_hbrt, ENTER_MRK + TRACFCOMP(g_trac_hbrt, "rt_firmware_request for error log: " "type:%d, plid:0x%08x, size:%d, data:0x%02x", l_req_fw_msg->io_type, @@ -789,22 +787,59 @@ class RuntimeLoaderTest : public CxxTest::TestSuite l_req_fw_msg->error_log.i_errlSize, l_req_fw_msg->error_log.i_data); - l_resp_fw_msg->io_type = + l_resp_fw_msg->io_type = hostInterfaces::HBRT_FW_MSG_TYPE_RESP_GENERIC; - // dummy return value for testing - l_resp_fw_msg->resp_generic.o_status = 20; + // dummy return value for testing + l_resp_fw_msg->resp_generic.o_status = 20; + + retVal = 0; // just return 0 for testing + } + else if (hostInterfaces::HBRT_FW_MSG_HBRT_FSP + == l_req_fw_msg->io_type) + { + if (i_reqLen < (hostInterfaces::HBRT_FW_MSG_BASE_SIZE + + sizeof(l_req_fw_msg->generic_message))) + { + retVal = -EINVAL; + break; + } - TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_firmware_request"); - retVal = 0; // just return 0 for testing + TRACFCOMP(g_trac_hbrt, + "rt_firmware_request for VPD Write Msg: " + "type:0x%.8X, msgq:0x%.8X, VPD type:0x%.8X, data:0x%X", + l_req_fw_msg->io_type, + l_req_fw_msg->generic_message.msgq, + l_req_fw_msg->generic_message.msgType, + l_req_fw_msg->generic_message.data); + + l_resp_fw_msg->io_type = + hostInterfaces::HBRT_FW_MSG_HBRT_FSP_RESP; + + // random testing data + l_resp_fw_msg->generic_message_resp.msgq = 0x800; + l_resp_fw_msg->generic_message_resp.msgType = 0x900; + l_resp_fw_msg->generic_message_resp.errPlid = 0xA00; + retVal = 0; + + TRACFCOMP(g_trac_hbrt, + "rt_firmware_request for VPD Write Msg response: " + "type:0x%.8X, msgq:0x%.8X, msgType:0x%.8X," + " errPlid:0x%X, retVal=%d", + l_resp_fw_msg->io_type, + l_resp_fw_msg->generic_message_resp.msgq, + l_resp_fw_msg->generic_message_resp.msgType, + l_resp_fw_msg->generic_message_resp.errPlid, + retVal); } else { - TRACFCOMP(g_trac_hbrt, ENTER_MRK + TRACFCOMP(g_trac_hbrt, "rt_firmware_request an unrecognized request: " "type:%d", l_req_fw_msg->io_type); } } while (0) ; + return retVal; } diff --git a/src/usr/vpd/ipvpd.C b/src/usr/vpd/ipvpd.C index 4cd1449c9..53a1ae552 100644 --- a/src/usr/vpd/ipvpd.C +++ b/src/usr/vpd/ipvpd.C @@ -2063,12 +2063,6 @@ errlHndl_t IpVpdFacade::writeKeyword ( const char * i_keywordName, break; } - // If we are writing both we don't have an FSP, skip the mbox msg - if ( iv_configInfo.vpdWriteHW ) - { - break; - } - VPD::VpdWriteMsg_t msgdata; // Quick double-check that our constants agree with the values diff --git a/src/usr/vpd/runtime/rt_vpd.C b/src/usr/vpd/runtime/rt_vpd.C index 2d07a4fb8..7d7b03e2d 100644 --- a/src/usr/vpd/runtime/rt_vpd.C +++ b/src/usr/vpd/runtime/rt_vpd.C @@ -33,6 +33,7 @@ #include #include #include +#include #include "vpd.H" #include "mvpd.H" #include "cvpd.H" @@ -387,8 +388,7 @@ errlHndl_t writePNOR ( uint64_t i_byteAddr, } // ------------------------------------------------------------------ -// sendMboxWriteMsg - not supported at runtime -// Treat the same way HB does if mbox is not available +// sendMboxWriteMsg // ------------------------------------------------------------------ errlHndl_t sendMboxWriteMsg ( size_t i_numBytes, void * i_data, @@ -396,7 +396,8 @@ errlHndl_t sendMboxWriteMsg ( size_t i_numBytes, VPD_MSG_TYPE i_type, VpdWriteMsg_t& i_record ) { - errlHndl_t err = NULL; + errlHndl_t l_err = nullptr; + TRACFCOMP( g_trac_vpd, INFO_MRK "sendMboxWriteMsg: Send msg to FSP to write VPD type %.8X, " "record %d, offset 0x%X", @@ -404,31 +405,147 @@ errlHndl_t sendMboxWriteMsg ( size_t i_numBytes, i_record.rec_num, i_record.offset ); - // mimic the behavior of hostboot when mbox is not available. - TRACFCOMP( g_trac_vpd, ERR_MRK - "No SP Base Services available at runtime."); - - /*@ - * @errortype - * @reasoncode VPD::VPD_MBOX_NOT_SUPPORTED_RT - * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid VPD::VPD_SEND_MBOX_WRITE_MESSAGE - * @userdata1 VPD message type - * @userdata2 0 - * @devdesc MBOX send not supported in HBRT - */ - err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - VPD::VPD_SEND_MBOX_WRITE_MESSAGE, - VPD::VPD_MBOX_NOT_SUPPORTED_RT, - i_type, - 0); - - err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, - HWAS::SRCI_PRIORITY_HIGH); - - err->collectTrace( "VPD", 256); + do + { + if ((nullptr == g_hostInterfaces) || + (nullptr == g_hostInterfaces->firmware_request)) + { + /*@ + * @errortype + * @severity ERRORLOG::ERRL_SEV_INFORMATIONAL + * @moduleid VPD::VPD_SEND_MBOX_WRITE_MESSAGE + * @reasoncode VPD::VPD_RT_NULL_FIRMWARE_REQUEST_PTR + * @userdata1 HUID of target + * @userdata2 VPD message type + * @devdesc MBOX send not supported in HBRT + */ + l_err= new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL, + VPD::VPD_SEND_MBOX_WRITE_MESSAGE, + VPD::VPD_RT_NULL_FIRMWARE_REQUEST_PTR, + TARGETING::get_huid(i_target), + i_type); + break; + } + + // Get an accurate size of memory actually needed to transport the data + size_t l_req_fw_msg_size = hostInterfaces::HBRT_FW_MSG_BASE_SIZE + + sizeof(hostInterfaces::hbrt_fw_msg::generic_message) + + i_numBytes; + + //create the firmware_request structure to carry the vpd write msg data + hostInterfaces::hbrt_fw_msg *l_req_fw_msg = + (hostInterfaces::hbrt_fw_msg *)malloc(l_req_fw_msg_size) ; + memset(l_req_fw_msg, 0, l_req_fw_msg_size); + + // populate the firmware_request structure with given data + l_req_fw_msg->io_type = hostInterfaces::HBRT_FW_MSG_HBRT_FSP; + l_req_fw_msg->generic_message.msgq = MBOX::FSP_VPD_MSGQ; + l_req_fw_msg->generic_message.msgType = i_type; + memcpy(&l_req_fw_msg->generic_message.data, i_data, i_numBytes); + + // set up the response struct + hostInterfaces::hbrt_fw_msg l_resp_fw_msg; + uint64_t l_resp_fw_msg_size = sizeof(l_resp_fw_msg); + + // make the firmware request + size_t rc = g_hostInterfaces->firmware_request(l_req_fw_msg_size, + l_req_fw_msg, + &l_resp_fw_msg_size, + &l_resp_fw_msg); + uint64_t l_userData1(0), l_userData2(0); + + // Capture the err log id if any + // The return code (rc) may return OK, but there still may be an issue + // with the HWSV code on the FSP. + if ((l_resp_fw_msg_size >= (hostInterfaces::HBRT_FW_MSG_BASE_SIZE + + sizeof(l_resp_fw_msg.generic_message_resp))) && + (hostInterfaces::HBRT_FW_MSG_HBRT_FSP_RESP + == l_resp_fw_msg.io_type) && + (0 != l_resp_fw_msg.generic_message_resp.errPlid) ) + { + l_userData2 = l_resp_fw_msg.generic_message_resp.errPlid; + } - return err; + // gather up the error data and create an err log out of it + if (rc || l_userData2) + { + TRACFCOMP(g_trac_vpd, + ERR_MRK"firmware request: " + "firmware request for FSP VPD write message rc 0x%X, " + "target 0x%llX, VPD type %.8X, record %d, offset 0x%X", + rc, get_huid(i_target), i_type, i_record.rec_num, + i_record.offset ); + + /*@ + * @errortype + * @moduleid VPD::VPD_RT_FIRMWARE_REQUEST + * @reasoncode VPD::VPD_RT_WRITE_MSG_ERR + * @userdata1[0:31] Firmware Request return code (if any) + * @userdata1[32:63] HUID of target + * @userdata2 HWSV error log id (if any) + * @devdesc Firmware Request for + * VPD Write Msg error + */ + + // Capture the return code (rc), if any + // this will indicate an issue with actually sending the msg + if (rc) + { + l_userData1 = TWO_UINT32_TO_UINT64(rc, + TARGETING::get_huid(i_target)); + } + else + { + l_userData1 = TARGETING::get_huid(i_target); + } + + l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_PREDICTIVE, + VPD::VPD_RT_FIRMWARE_REQUEST, + VPD::VPD_RT_WRITE_MSG_ERR, + l_userData1, + l_userData2); + + if (l_resp_fw_msg_size > 0) + { + l_err->addFFDC( MBOX_COMP_ID, + &l_resp_fw_msg, + l_resp_fw_msg_size, + 0, 0, false ); + } + + if (sizeof(l_req_fw_msg) > 0) + { + l_err->addFFDC( MBOX_COMP_ID, + &l_req_fw_msg, + sizeof(l_req_fw_msg), + 0, 0, false ); + } + + l_err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_HIGH); + + if (l_userData2) + { + l_err->plid(l_userData2); + } + + l_err->collectTrace( "VPD", 256); + } // end (rc || l_userData2) + + // release the memory created + free(l_req_fw_msg); + } + while (0); + + if (l_err) + { + // @fixme-RTC:180490 - Temporarily commit until FSP code is implemented + // Just commit the log for now until FSP code is implemented + l_err->setSev(ERRORLOG::ERRL_SEV_INFORMATIONAL); + errlCommit( l_err, VPD_COMP_ID ); + } + + return l_err; } diff --git a/src/usr/vpd/test/mvpdtest.H b/src/usr/vpd/test/mvpdtest.H index 36dffe093..95941b076 100755 --- a/src/usr/vpd/test/mvpdtest.H +++ b/src/usr/vpd/test/mvpdtest.H @@ -549,7 +549,7 @@ class MVPDTest: public CxxTest::TestSuite testData, theSize, DEVICE_MVPD_ADDRESS(MVPD::VWML,MVPD::pdI) ); -#ifndef __HOSTBOOT_RUNTIME + if( err ) { fails++; @@ -611,20 +611,6 @@ class MVPDTest: public CxxTest::TestSuite VPD_COMP_ID ); continue; } -#else - if(!err) - { - fails++; - TRACFCOMP( g_trac_vpd, ERR_MRK - "testMvpdWrite() at runtime did not fail"); - TS_FAIL( "testMvpdWrite() - VPD write did not fail at runtime"); - } - else - { - delete err; - } -#endif - } while( 0 ); if( NULL != testData ) -- cgit v1.2.1