From 34e4e8a29c90fa5f6a5ddbe704efcc0beecafa83 Mon Sep 17 00:00:00 2001 From: spashabk-in Date: Tue, 6 Mar 2018 04:36:02 -0600 Subject: Restructure capabilites structure Separate common parts from interface specific features Change-Id: I06f81b891a47ca503c08af77ff55193ac81bc1d1 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/55096 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: RAJA DAS Reviewed-by: Sachin Gupta --- src/sbefw/app/common/sbecmdgeneric.C | 21 ++++++++++++++++++++- src/sbefw/app/common/sbecmdgeneric.H | 9 +++++++++ src/sbefw/app/power/sbecmdgeneric.C | 20 ++------------------ src/sbefw/core/sbeSpMsg.H | 4 ++-- src/sbefw/core/sbe_sp_intf.H | 3 +++ src/test/testcases/testGetCapabilities.py | 4 +++- 6 files changed, 39 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/sbefw/app/common/sbecmdgeneric.C b/src/sbefw/app/common/sbecmdgeneric.C index 1d78705c..813df873 100644 --- a/src/sbefw/app/common/sbecmdgeneric.C +++ b/src/sbefw/app/common/sbecmdgeneric.C @@ -49,6 +49,24 @@ using namespace fapi2; #ifdef __SBEFW_SEEPROM__ + +static const uint32_t SBE_CAPABILITES_LEN_FIFO = + sizeof(sbeCapabilityRespMsg_t) - + (sizeof(uint32_t) * + (SBE_MAX_CAPABILITIES - CAPABILITIES_LAST_INDEX_FIFO - 1)); + +sbeCapabilityRespMsg::sbeCapabilityRespMsg() : capability{} +{ + verMajor= SBE_FW_MAJOR_VERSION; + verMinor = SBE_FW_MINOR_VERSION; + fwCommitId = SBE_COMMIT_ID; + // Get xip header + P9XipHeader *hdr = getXipHdr(); + for(uint32_t idx=0; idxiv_buildTag); idx++) + { + buildTag[idx] = hdr->iv_buildTag[idx]; + } +} // Functions //---------------------------------------------------------------------------- uint32_t sbeGetCapabilities (uint8_t *i_pArg) @@ -59,6 +77,7 @@ uint32_t sbeGetCapabilities (uint8_t *i_pArg) sbeRespGenHdr_t respHdr; respHdr.init(); sbeCapabilityRespMsg_t capMsg; + updateFifoCapabilities(capMsg.capability); do { @@ -73,7 +92,7 @@ uint32_t sbeGetCapabilities (uint8_t *i_pArg) break; } - len = sizeof(capMsg)/sizeof(uint32_t); + len = SBE_CAPABILITES_LEN_FIFO / sizeof(uint32_t); rc = sbeDownFifoEnq_mult ( len, ( uint32_t *) &capMsg); if (rc) { diff --git a/src/sbefw/app/common/sbecmdgeneric.H b/src/sbefw/app/common/sbecmdgeneric.H index c387d654..471304c9 100644 --- a/src/sbefw/app/common/sbecmdgeneric.H +++ b/src/sbefw/app/common/sbecmdgeneric.H @@ -91,6 +91,15 @@ typedef struct stashMsg uint64_t addr; }stashMsg_t; +/** + * @brief Update Fifo capabilities + * + * @param[in] capability Pointer to capcbility array + * + * @return void + */ +void updateFifoCapabilities(uint32_t * capability); + /** * @brief retrieve SBE FFDC on request from FSP. (0xA801) * diff --git a/src/sbefw/app/power/sbecmdgeneric.C b/src/sbefw/app/power/sbecmdgeneric.C index 3f4294d0..6f6afa91 100644 --- a/src/sbefw/app/power/sbecmdgeneric.C +++ b/src/sbefw/app/power/sbecmdgeneric.C @@ -49,25 +49,9 @@ using namespace fapi2; #ifdef __SBEFW_SEEPROM__ -// Forward declaration -sbeCapabilityRespMsg::sbeCapabilityRespMsg() -{ - verMajor= SBE_FW_MAJOR_VERSION; - verMinor = SBE_FW_MINOR_VERSION; - fwCommitId = SBE_COMMIT_ID; - // Get hbbl section - P9XipHeader *hdr = getXipHdr(); - for(uint32_t idx=0; idxiv_buildTag); idx++) - { - buildTag[idx] = hdr->iv_buildTag[idx]; - } - // We can remove this for llop once all capabilities - // are supported - for(uint32_t idx = 0; idx < SBE_MAX_CAPABILITIES; idx++ ) - { - capability[idx] = 0; - } +void updateFifoCapabilities(uint32_t * capability) +{ // @TODO via RTC : 160602 // Update Capability flags based on lastes spec. capability[IPL_CAPABILITY_START_IDX] = diff --git a/src/sbefw/core/sbeSpMsg.H b/src/sbefw/core/sbeSpMsg.H index c989949a..e2499234 100644 --- a/src/sbefw/core/sbeSpMsg.H +++ b/src/sbefw/core/sbeSpMsg.H @@ -503,8 +503,8 @@ typedef struct uint32_t len; // Length of Data in Bytes }sbeOccSramAccessReqMsgHdr_t; -// Maximum number of capabilities -static const uint32_t SBE_MAX_CAPABILITIES = 18; +// Maximum number of capabilities - max of FIFO and PSU capabilities +static const uint32_t SBE_MAX_CAPABILITIES = 20; /** * @brief structure for SBE Get Capabilities chipop (0xA802) contents. diff --git a/src/sbefw/core/sbe_sp_intf.H b/src/sbefw/core/sbe_sp_intf.H index 76895ae3..ae4876e9 100644 --- a/src/sbefw/core/sbe_sp_intf.H +++ b/src/sbefw/core/sbe_sp_intf.H @@ -251,6 +251,9 @@ enum ARRAY_CAPABILITY_START_IDX = GENERIC_CAPABILTITY_START_IDX + 12, INSTRUCTION_CTRL_CAPABILITY_START_IDX = GENERIC_CAPABILTITY_START_IDX + 14, GENERIC_CHIPOP_CAPABILITY_START_IDX = GENERIC_CAPABILTITY_START_IDX + 16, + + // Keep in sync with the spec + CAPABILITIES_LAST_INDEX_FIFO = 19, }; /** * @brief capabilities enum values. diff --git a/src/test/testcases/testGetCapabilities.py b/src/test/testcases/testGetCapabilities.py index 3cc21027..cffff709 100755 --- a/src/test/testcases/testGetCapabilities.py +++ b/src/test/testcases/testGetCapabilities.py @@ -5,7 +5,7 @@ # # OpenPOWER sbe Project # -# Contributors Listed Below - COPYRIGHT 2015,2017 +# Contributors Listed Below - COPYRIGHT 2015,2018 # [+] International Business Machines Corp. # # @@ -50,6 +50,8 @@ EXPDATA2 = [0xa4,0x0,0x0,0x0f, #GetMemPba/PutMemPba/GetSramOcc/PutSramOcc EXPDATA3 = [0xa8,0x0,0x0,0x13, #getcapability/getSbeFFDC/quiesce 0x0,0x0,0x0,0x0, + 0, 0, 0, 0, #MPIPL related + 0, 0, 0, 0, 0xc0,0xde,0xa8,0x02, 0x0,0x0,0x0,0x0, 0x00,0x0,0x0,0x3]; -- cgit v1.2.1