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/testcore | |
parent | f872a41a9d1551903f3f1caf94852e92576cd019 (diff) | |
download | talos-hostboot-f3423e48a1fec89b8d9f7a0f20977013f2330dd9.tar.gz talos-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/testcore')
-rw-r--r-- | src/usr/testcore/rtloader/loader.H | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H index ac454e9f1..58979745d 100644 --- a/src/usr/testcore/rtloader/loader.H +++ b/src/usr/testcore/rtloader/loader.H @@ -46,6 +46,7 @@ #include <config.h> #include <util/utilrsvdmem.H> #include <sys/misc.h> +#include <errno.h> trace_desc_t* g_trac_hbrt = NULL; @@ -145,6 +146,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite intf->ipmi_msg= rt_ipmi_msg; intf->clock_gettime = clock_gettime; intf->hcode_scom_update = rt_hcode_update; + intf->firmware_request = rt_firmware_request; // Call init. runtimeInterfaces_t* rtInterface = @@ -702,6 +704,73 @@ class RuntimeLoaderTest : public CxxTest::TestSuite return 0; } + //-------------------------------------------------------------------- + static int rt_firmware_request(uint64_t i_reqLen, void *i_req, + uint64_t* o_respLen, void *o_resp ) + { + int retVal = 0; + do + { + if (i_req == nullptr || + o_respLen == nullptr || + o_resp == nullptr) + { + retVal = -EINVAL; + break; + } + + hostInterfaces::hbrt_fw_msg* l_req_fw_msg = + (hostInterfaces::hbrt_fw_msg*) i_req; + hostInterfaces::hbrt_fw_msg* l_resp_fw_msg = + (hostInterfaces::hbrt_fw_msg*) o_resp; + + if (i_reqLen < (hostInterfaces::HBRT_FW_MSG_BASE_SIZE + + sizeof(l_req_fw_msg->req_hcode_update))) + { + retVal = -EINVAL; + break; + } + + if (*o_respLen < (hostInterfaces::HBRT_FW_MSG_BASE_SIZE + + sizeof(l_resp_fw_msg->resp_generic))) + { + retVal = -EINVAL; + break; + } + + if (hostInterfaces::HBRT_FW_MSG_TYPE_REQ_HCODE_UPDATE + == l_req_fw_msg->io_type) + { + TRACFCOMP(g_trac_hbrt, ENTER_MRK + "rt_firmware_request for HCODE SCOM update: " + "type:%d, chipId:0x%X, section:%d, " + "operation:%d, scomAddr:0x%X scomData:0x%X", + l_req_fw_msg->io_type, + l_req_fw_msg->req_hcode_update.i_chipId, + l_req_fw_msg->req_hcode_update.i_section, + l_req_fw_msg->req_hcode_update.i_operation, + l_req_fw_msg->req_hcode_update.i_scomAddr, + l_req_fw_msg->req_hcode_update.i_scomData); + } + else + { + TRACFCOMP(g_trac_hbrt, ENTER_MRK + "rt_firmware_request an unrecognized request: " + "type:%d", l_req_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 = 264; + + TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_firmware_request"); + retVal = 1; // just return 1 for testing + + } while (0) ; + return retVal; + } + static uint64_t cv_hb_data_addr; static uint64_t cv_comm_addr; static uint64_t cv_comm_phys_addr; |