diff options
author | Roland Veloz <rveloz@us.ibm.com> | 2018-03-27 11:17:43 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-06-01 23:56:31 -0400 |
commit | c6916a42d34bdd1c9502056740ec3a819c082099 (patch) | |
tree | 9876a2d6e6a72d66b6733a68dcb308f18db493a8 | |
parent | 6bb10d4941533e21d5b01c634d7f2fcaed83364c (diff) | |
download | talos-hostboot-c6916a42d34bdd1c9502056740ec3a819c082099.tar.gz talos-hostboot-c6916a42d34bdd1c9502056740ec3a819c082099.zip |
Add support for getting SBE Capabilites; extract SBE Version, Commit ID and Tags
Structure sbeCapabilities_t was added to the sbe_utils.H, a common file that
can be shared among other files that need the sbeCapabilities_t struct.
The psuCommand structure was updated, in file sbe_psudd.H, to facilitate the
PSU call to get SBE Capabilities. Also structs fifoGetCapabilitiesResponse/
fifoGetCapabilitiesRequest were added to file sbe_fifodd to facilitate
the FIFO call to get SBE Capabilities.
Attributes SBE_COMMIT_ID, SBE_VERSION_INFO and SBE_RELEASE_TAGS were added to
the target '<id>chip-processor</id>'. These attributes are the ultimate
receiver of the SBE capabilities' version, commit id and release tags info.
New file sbe_capabilities.C contains the call to getPsuSbeCapabilities and
getFifoSbeCapabilities which ultimately perform the call to do the PSU chip
operation, FIFO chip operation and update the attributes above. In step 6,
host_discover_targets, and in step 8,
call_proc_check_slave_sbe_seeprom_complete, is where the calls to
getPsuSbeCapabilities and getFifoSbeCapabilities are made respectively.
The file FipS_SBE_Interface_Specification_v1.3a.pdf (FIFO), file
Host_SBE_Interface_Specification_v0.9d.pdf and looking at
HW code were used to guide the coding of this.
Change-Id: I32ccdeab7bf0a478298b199d42d74650a3f393f6
RTC:181139
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/56317
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>
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r-- | src/include/usr/sbeio/sbe_psudd.H | 65 | ||||
-rw-r--r-- | src/include/usr/sbeio/sbe_utils.H | 31 | ||||
-rw-r--r-- | src/include/usr/sbeio/sbeioif.H | 20 | ||||
-rw-r--r-- | src/include/usr/sbeio/sbeioreasoncodes.H | 1 | ||||
-rw-r--r-- | src/usr/isteps/istep06/host_discover_targets.C | 20 | ||||
-rw-r--r-- | src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C | 12 | ||||
-rw-r--r-- | src/usr/isteps/istep08/makefile | 1 | ||||
-rw-r--r-- | src/usr/sbeio/makefile | 1 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_fifodd.H | 46 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_getCapabilities.C | 366 | ||||
-rwxr-xr-x | src/usr/targeting/common/xmltohb/attribute_types.xml | 49 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/target_types.xml | 9 |
12 files changed, 611 insertions, 10 deletions
diff --git a/src/include/usr/sbeio/sbe_psudd.H b/src/include/usr/sbeio/sbe_psudd.H index 76603859f..aee071949 100644 --- a/src/include/usr/sbeio/sbe_psudd.H +++ b/src/include/usr/sbeio/sbe_psudd.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -55,6 +55,11 @@ class SbePsu public: /** + * @brief The alignment boundary for sending an SBE Capabilities message + */ + static constexpr uint32_t SBE_CAPABILITIES_ALIGNMENT_SIZE_IN_BYTES = 128; + + /** * @brief get the instance of this class * * @return the (one and only) instance of SbePsu @@ -102,6 +107,7 @@ class SbePsu //BYTE 7 options enum psuGenericMessageCommands { + SBE_PSU_MSG_GET_CAPABILITIES = 0x02, SBE_PSU_READ_SEEPROM = 0x03, SBE_PSU_SET_FFDC_ADDRESS = 0x04, SBE_PSU_GENERIC_MSG_QUIESCE = 0x05, @@ -227,6 +233,25 @@ class SbePsu * 0x4 - Reg 2 is non-reserved (read or write this reg) * 0x8 - Reg 3 is non-reserved (read or write this reg) */ + enum psuGetCapabilitiesNonReservedMsgs + { + SBE_GET_CAPABILITIES_REQ_USED_REGS = 0x07, // Use Reg 0 ... Reg 2 (0x1 + 0x2 + 0x4) + SBE_GET_CAPABILITIES_RSP_USED_REGS = 0x07, // Use Reg 0 ... Reg 2 (0x1 + 0x2 + 0x4) + }; + + /** + * @brief non reserved word enums + * + * Shows which of the request and response msg registers are + * not reserved. Reserved registers do not need to be written + * or read. + * + * This is a 4 bit field: + * 0x1 - Reg 0 is non-reserved (read or write this reg) + * 0x2 - Reg 1 is non-reserved (read or write this reg) + * 0x4 - Reg 2 is non-reserved (read or write this reg) + * 0x8 - Reg 3 is non-reserved (read or write this reg) + */ enum psuReadSeepromMsgs { SBE_READ_SEEPROM_REQ_USED_REGS = 0x07, @@ -407,6 +432,19 @@ class SbePsu uint64_t cd7_stashKeyAddr_MbxReg3Reserved; //Mbx Reg 3 } PACKED; + // Complies with document Host_SBE_Interface_Specification_v0.9e.pdf + struct // getSbeCapabilities + { + uint16_t cd7_getSbeCapabilities_Reserved; //Mbx Reg 0 + uint16_t cd7_getSbeCapabilities_ControlFlags; //Mbx Reg 0 + uint16_t cd7_getSbeCapabilities_SeqID; //Mbx Reg 0 + uint8_t cd7_getSbeCapabilities_CommandClass; //Mbx Reg 0: 0xD7 (SBE_PSU_GENERIC_MESSAGE) + uint8_t cd7_getSbeCapabilities_Command; //Mbx Reg 0: 0x02 (SBE_PSU_MSG_GET_CAPABILITIES) + uint64_t cd7_getSbeCapabilities_CapabilitiesSize; //Mbx Reg 1 + uint64_t cd7_getSbeCapabilities_CapabilitiesAddr; //Mbx Reg 2 + uint64_t cd7_getSbeCapabilities_MbxReg3Reserved; //Mbx Reg 3 + } PACKED; + struct //setUnsecureMemoryRegion { uint16_t cd6_memRegion_Reserved; //Mbx Reg 0 @@ -475,7 +513,7 @@ class SbePsu { } - }; + }; // end union psuCommand /** * @brief Struct for PSU response message format @@ -526,6 +564,27 @@ class SbePsu uint32_t indirect_reserved; uint32_t indirect_size; //Size in dbl words for Indirect data } PACKED; + + // Complies with document Host_SBE_Interface_Specification_v0.9e.pdf + struct // fields for the SBE Capabilities response + { + // mbxReg 4 + uint16_t sbe_primaryStatus; + uint16_t sbe_secondaryStatus; + uint16_t sbe_seqID; + uint8_t sbe_commandClass; // 0xD7 (SBE_PSU_GENERIC_MESSAGE) + uint8_t sbe_command; // 0x02 (SBE_PSU_MSG_GET_CAPABILITIES) + // mbxReg 5 + uint32_t sbe_reserved1; + uint32_t sbe_capabilities_size; // Size of Capabilities data returned in bytes + // mbxReg 6 + uint16_t sbe_major_version; + uint16_t sbe_minor_version; + uint32_t sbe_commit_id; + // mbxReg 7 + uint64_t sbe_reserved2; + } PACKED; + psuResponse() : primaryStatus (0xffff), //invalid status secondaryStatus (0xffff), //invalid status @@ -541,7 +600,7 @@ class SbePsu { } - }; + }; // end struct psuResponse /** * @brief timeout values diff --git a/src/include/usr/sbeio/sbe_utils.H b/src/include/usr/sbeio/sbe_utils.H index 848586e62..8f1f77688 100644 --- a/src/include/usr/sbeio/sbe_utils.H +++ b/src/include/usr/sbeio/sbe_utils.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017 */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -34,6 +34,32 @@ namespace SBEIO { + /** + * @brief Struct for the SBE Capabilities + * + * Complies with document Host_SBE_Interface_Specification_v0.9e.pdf + */ + static constexpr uint8_t SBE_RELEASE_TAG_MAX_CHARS = 20; + static constexpr uint8_t SBE_MAX_CAPABILITIES = 20; + + struct sbeCapabilities_t + { + uint16_t majorVersion; + uint16_t minorVersion; + uint32_t commitId; + char releaseTag[SBE_RELEASE_TAG_MAX_CHARS]; // AKA build tag + uint32_t capabilities[SBE_MAX_CAPABILITIES]; + + sbeCapabilities_t() : + majorVersion(0) + , minorVersion(0) + , commitId(0) + , releaseTag{ 0 } + , capabilities{ 0 } + { + } + } PACKED; // end struct sbeCapabilities_t + enum SBE_TARGET_TYPES { SBE_TARGET_TYPE_PROC = 0x00, @@ -53,7 +79,6 @@ namespace SBEIO /// @param[in] i_hbTarget includes the HB target type /// @return: ChipletID for i_hbTarget target uint8_t getChipletIDForSBE(TARGETING::Target * i_hbTarget); - } -#endif // __SBE_UTILS_H
\ No newline at end of file +#endif // __SBE_UTILS_H diff --git a/src/include/usr/sbeio/sbeioif.H b/src/include/usr/sbeio/sbeioif.H index 3e68599f3..0f879de92 100644 --- a/src/include/usr/sbeio/sbeioif.H +++ b/src/include/usr/sbeio/sbeioif.H @@ -96,6 +96,26 @@ namespace SBEIO */ errlHndl_t sendPsuQuiesceSbe(TARGETING::Target * i_target); + /** + * @brief Get the capabilities of the SBE via PSU + * + * @param[in] i_target Target with SBE to get capabilities from + * + * @return errlHndl_t Error log handle on failure. + * + */ + errlHndl_t getPsuSbeCapabilities(TARGETING::TargetHandle_t i_target); + + /** + * @brief Get the capabilities of the SBE via FIFO + * + * @param[in] i_target Target with SBE to get capabilities from + * + * @return errlHndl_t Error log handle on failure. + * + */ + errlHndl_t getFifoSbeCapabilities(TARGETING::TargetHandle_t i_target); + /** * @brief Sends a PSU chipOp to stash away a key,addr pair on the SBE * diff --git a/src/include/usr/sbeio/sbeioreasoncodes.H b/src/include/usr/sbeio/sbeioreasoncodes.H index a17b2576a..ff82aca13 100644 --- a/src/include/usr/sbeio/sbeioreasoncodes.H +++ b/src/include/usr/sbeio/sbeioreasoncodes.H @@ -127,6 +127,7 @@ enum sbeioReasonCode SBEIO_EXCEED_MAX_SIDE_SWITCHES = SBEIO_COMP_ID | 0x5C, SBEIO_EXCEED_MAX_SIDE_BOOTS = SBEIO_COMP_ID | 0x5D, SBEIO_SLAVE_FAILED_TO_BOOT = SBEIO_COMP_ID | 0x5E, + SBEIO_RECEIVED_UNEXPECTED_MSG = SBEIO_COMP_ID | 0x5F, // SBE Vital Attention error codes SBEIO_SBE_RC_VALUE_INFO = SBEIO_COMP_ID | 0x60, diff --git a/src/usr/isteps/istep06/host_discover_targets.C b/src/usr/isteps/istep06/host_discover_targets.C index a5447e72b..6b656b5c9 100644 --- a/src/usr/isteps/istep06/host_discover_targets.C +++ b/src/usr/isteps/istep06/host_discover_targets.C @@ -57,8 +57,8 @@ #include <fapi2/target.H> //SBE interfacing -#include <sbeio/sbeioif.H> -#include <sys/misc.h> +#include <sbeio/sbeioif.H> +#include <sys/misc.h> #include <p9_query_core_access_state.H> #include <p9_setup_sbe_config.H> @@ -467,7 +467,7 @@ void* host_discover_targets( void *io_pArgs ) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "host_discover_targets entry" ); - errlHndl_t l_err = nullptr; + errlHndl_t l_err(nullptr); ISTEP_ERROR::IStepError l_stepError; // Check whether we're in MPIPL mode @@ -586,6 +586,20 @@ void* host_discover_targets( void *io_pArgs ) SENSOR::updateBMCSensorStatus(); #endif + + // Retrieve the master processor chip + TARGETING::TargetHandle_t l_pMasterProcChip(nullptr); + TARGETING::targetService().masterProcChipTargetHandle(l_pMasterProcChip); + if (l_pMasterProcChip) + { + // Make the PSU call to get and apply the SBE Capabilities + l_err = SBEIO::getPsuSbeCapabilities(l_pMasterProcChip); + if (l_err) + { + // Commit Error + errlCommit (l_err, ISTEP_COMP_ID); + } + } // end if (l_pMasterProcChip) TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "host_discover_targets exit" ); diff --git a/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C b/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C index 8dcab75c6..0e3e97f32 100644 --- a/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C +++ b/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C @@ -65,6 +65,7 @@ #include <p9_get_sbe_msg_register.H> #include <p9_getecid.H> #include <sbeio/sbe_retry_handler.H> +#include <sbeio/sbeioif.H> using namespace ISTEP; using namespace ISTEP_ERROR; @@ -82,7 +83,7 @@ namespace ISTEP_08 //****************************************************************************** void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs ) { - errlHndl_t l_errl = NULL; + errlHndl_t l_errl(nullptr); IStepError l_stepError; TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, @@ -151,6 +152,15 @@ void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs ) // Set attribute indicating that SBE is started l_cpu_target->setAttr<ATTR_SBE_IS_STARTED>(1); + // Make the FIFO call to get and apply the SBE Capabilities + l_errl = SBEIO::getFifoSbeCapabilities(l_cpu_target); + + if (l_errl) + { + // Commit Error + errlCommit (l_errl, ISTEP_COMP_ID); + } + // Switch to using SBE SCOM ScomSwitches l_switches = l_cpu_target->getAttr<ATTR_SCOM_SWITCHES>(); diff --git a/src/usr/isteps/istep08/makefile b/src/usr/isteps/istep08/makefile index 24858aeaf..225e07735 100644 --- a/src/usr/isteps/istep08/makefile +++ b/src/usr/isteps/istep08/makefile @@ -40,6 +40,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/utils/ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/utils/imageProcs/ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs/ EXTRAINCDIR += ${ROOTPATH}/src/usr/isteps/ +EXTRAINCDIR += ${ROOTPATH}/src/usr/sbeio/ EXTRAINCDIR += ${PROCEDURES_PATH}/hwp/pm/include/registers OBJS += call_host_slave_sbe_config.o diff --git a/src/usr/sbeio/makefile b/src/usr/sbeio/makefile index fccde6aa4..7885d6670 100644 --- a/src/usr/sbeio/makefile +++ b/src/usr/sbeio/makefile @@ -48,6 +48,7 @@ OBJS += sbe_getSBEFFDC.o OBJS += sbe_memRegionMgr.o OBJS += sbe_fifo_buffer.o OBJS += sbe_ffdc_package_parser.o +OBJS += sbe_getCapabilities.o # sbeio's sub directories SUBDIRS += test.d diff --git a/src/usr/sbeio/sbe_fifodd.H b/src/usr/sbeio/sbe_fifodd.H index e336ea08d..8f7478218 100644 --- a/src/usr/sbeio/sbe_fifodd.H +++ b/src/usr/sbeio/sbe_fifodd.H @@ -38,6 +38,7 @@ #include <errl/errlentry.H> #include <util/singleton.H> #include <error_info_defs.H> +#include <sbeio/sbe_utils.H> namespace SBEIO { @@ -119,6 +120,7 @@ class SbeFifo enum fifoGenericMessage { SBE_FIFO_CMD_GET_SBE_FFDC = 0x01, + SBE_FIFO_CMD_GET_CAPABILITIES = 0x02, }; /** @@ -271,6 +273,27 @@ class SbeFifo } PACKED; /** + * @brief Struct for FIFO Get Capabilities Request + * + * Complies with document FipS_SBE_Interface_Specification_v1.5b-1.pdf + */ + struct fifoGetCapabilitiesRequest + { + uint32_t wordCnt; // 0x02 (The number of 32 bits in msg) + uint16_t reserved; + uint8_t commandClass; // 0xA8 (SBE_FIFO_CLASS_GENERIC_MESSAGE) + uint8_t command; // 0x02 (SBE_FIFO_CMD_GET_CAPABILITIES) + fifoGetCapabilitiesRequest() : + wordCnt(2) + , reserved(0) + , commandClass(SBE_FIFO_CLASS_GENERIC_MESSAGE) + , command(SBE_FIFO_CMD_GET_CAPABILITIES) + { + } + } PACKED; + + + /** * @brief enums for FIFO Magic values */ enum fifoMagic @@ -385,6 +408,29 @@ class SbeFifo fifoContinueMpiplResponse() {} } PACKED; + + /** + * @brief Struct for FIFO Get Capabilities response + * + * The actual number of returned words varies based on whether there was + * an error. + * + * Complies with document FipS_SBE_Interface_Specification_v1.5b-1.pdf + */ + struct fifoGetCapabilitiesResponse + { + SBEIO::sbeCapabilities_t capabilities; + statusHeader status; + struct fapi2::ffdc_struct ffdc; // ffdc data + uint32_t status_distance; // distance to status + fifoGetCapabilitiesResponse() : + capabilities() + , status{ 0 } + , status_distance(0) + { + } + } PACKED; + /** * @Brief perform SBE FIFO chip-op * diff --git a/src/usr/sbeio/sbe_getCapabilities.C b/src/usr/sbeio/sbe_getCapabilities.C new file mode 100644 index 000000000..4a0d7d90a --- /dev/null +++ b/src/usr/sbeio/sbe_getCapabilities.C @@ -0,0 +1,366 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/sbeio/sbe_getCapabilities.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] 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 */ +/** +* @file sbe_getCapabilities.C +* @brief Get the capabilities from the SBE +*/ + +#include <errl/errlmanager.H> // errlHndl_t +#include <sbeio/sbe_psudd.H> // SbeFifo::psuCommand +#include "sbe_fifodd.H" // SbeFifo::fifoGetCapabilitiesRequest +#include <sbeio/sbe_utils.H> // sbeCapabilities_t +#include <sbeio/sbeioreasoncodes.H> // SBEIO_PSU, SBEIO_FIFO, +#include <targeting/common/commontargeting.H> // get_huid +#include <util/align.H> // ALIGN_X +#include <sys/mm.h> // mm_virt_to_phys + +extern trace_desc_t* g_trac_sbeio; + +namespace SBEIO +{ +using namespace TARGETING; +using namespace ERRORLOG; + + /** + * @brief Apply the SBE capabilities to the given target + * + * @param[in] i_target Target to apply the SBE capabilities on + * + * @param[in] i_capabilities The SBE capabilities themselves + * + */ +void applySbeCapabilities(TargetHandle_t i_target, + sbeCapabilities_t &i_capabilities) +{ + // Get the SBE Version from the SBE Capabilities and set the + // attribute associated with SBE Version + ATTR_SBE_VERSION_INFO_type l_sbeVersionInfo = + TWO_UINT16_TO_UINT32(i_capabilities.majorVersion, + i_capabilities.minorVersion); + i_target->setAttr<ATTR_SBE_VERSION_INFO>(l_sbeVersionInfo); + TRACFCOMP(g_trac_sbeio,"applySbeCapabilities: " + "Retrieved SBE Version: 0x%X", l_sbeVersionInfo); + + // Get the SBE Commit ID from the SBE Capabilities and set the + // attribute associated with SBE Commit ID + ATTR_SBE_COMMIT_ID_type l_sbeCommitId = i_capabilities.commitId; + i_target->setAttr<ATTR_SBE_COMMIT_ID>(l_sbeCommitId); + TRACFCOMP(g_trac_sbeio,"applySbeCapabilities: " + "Retrieved SBE Commit ID: 0x%X", l_sbeCommitId); + + // Get the SBE Release Tag from the SBE Capabilities and set the + // attribute associated with SBE Release Tag + ATTR_SBE_RELEASE_TAG_type l_sbeReleaseTagString = {0}; + + // Make sure the sizes are compatible. + static_assert(SBE_RELEASE_TAG_MAX_CHARS <= ATTR_SBE_RELEASE_TAG_max_chars, + "Copy error - size of source is greater than size of destination."); + + // Copy the release tags over into a more compatible type and set + // the SBE Release Tags attribute + strncpy(l_sbeReleaseTagString, + i_capabilities.releaseTag, + SBE_RELEASE_TAG_MAX_CHARS); + i_target->setAttr<ATTR_SBE_RELEASE_TAG>(l_sbeReleaseTagString); + TRACFCOMP(g_trac_sbeio,"applySbeCapabilities: " + "Retrieved SBE Release Tag: %s", l_sbeReleaseTagString); +} + +/** + * getPsuSbeCapabilities + */ +errlHndl_t getPsuSbeCapabilities(TargetHandle_t i_target) +{ + errlHndl_t l_errl(nullptr); + + TRACDCOMP(g_trac_sbeio, ENTER_MRK "getPsuSbeCapabilities"); + + // Cache the SBE Capabilities' size for future uses + size_t l_sbeCapabilitiesSize = sizeof(sbeCapabilities_t); + + // Set up the buffer which the SBE will copy the capabilities info to + // Create buffer with enough size to be properly aligned + uint8_t * l_sbeCapabilitiesReadBuffer = static_cast<uint8_t*>( + malloc(l_sbeCapabilitiesSize + + (SbePsu::SBE_CAPABILITIES_ALIGNMENT_SIZE_IN_BYTES - 1)) ); + + // Align the buffer + uint64_t l_sbeCapabilitiesReadBufferAligned = + ALIGN_X(reinterpret_cast<uint64_t>(l_sbeCapabilitiesReadBuffer), + SbePsu::SBE_CAPABILITIES_ALIGNMENT_SIZE_IN_BYTES); + + // Clear buffer up to the size of the capabilities + memset(reinterpret_cast<uint8_t*>(l_sbeCapabilitiesReadBufferAligned), + 0, l_sbeCapabilitiesSize ); + + // Create a PSU request message and initialize it + SbePsu::psuCommand l_psuCommand( + SbePsu::SBE_REQUIRE_RESPONSE | + SbePsu::SBE_REQUIRE_ACK, //control flags + SbePsu::SBE_PSU_GENERIC_MESSAGE, //command class + SbePsu::SBE_PSU_MSG_GET_CAPABILITIES); //command + l_psuCommand.cd7_getSbeCapabilities_CapabilitiesSize = + ALIGN_X(l_sbeCapabilitiesSize, + SbePsu::SBE_CAPABILITIES_ALIGNMENT_SIZE_IN_BYTES); + l_psuCommand.cd7_getSbeCapabilities_CapabilitiesAddr = + mm_virt_to_phys( + reinterpret_cast<void*>(l_sbeCapabilitiesReadBufferAligned)); + + // Create a PSU response message + SbePsu::psuResponse l_psuResponse; + + do + { + // Make the call to perform the PSU Chip Operation + l_errl = SbePsu::getTheInstance().performPsuChipOp( + i_target, + &l_psuCommand, + &l_psuResponse, + SbePsu::MAX_PSU_SHORT_TIMEOUT_NS, + SbePsu::SBE_GET_CAPABILITIES_REQ_USED_REGS, + SbePsu::SBE_GET_CAPABILITIES_RSP_USED_REGS); + + // Before continuing, make sure this request is honored + if (SBE_PRI_INVALID_COMMAND == l_psuResponse.primaryStatus && + SBE_SEC_COMMAND_NOT_SUPPORTED == l_psuResponse.secondaryStatus) + { + TRACFCOMP(g_trac_sbeio, "getPsuSbeCapabilities: SBE firmware does " + "not support PSU get capabilities request"); + + // Do not pass back any errors + delete l_errl; + l_errl = nullptr; + break; + } + + + if (l_errl) + { + TRACFCOMP(g_trac_sbeio, + "getPsuSbeCapabilities: " + "Call to performPsuChipOp failed, error returned"); + + TRACDBIN(g_trac_sbeio, + "getPsuSbeCapabilities: capabilities data", + reinterpret_cast<uint8_t*>(l_sbeCapabilitiesReadBufferAligned), + l_sbeCapabilitiesSize); + + break; + } + + // Sanity check - are HW and HB communications in sync? + if ((SbePsu::SBE_PSU_GENERIC_MESSAGE != + l_psuResponse.sbe_commandClass) || + (SbePsu::SBE_PSU_MSG_GET_CAPABILITIES != + l_psuResponse.sbe_command)) + { + TRACFCOMP(g_trac_sbeio, + "Call to performPsuChipOp returned an unexpected " + "message type; " + "command class returned:0x%X, " + "expected command class:0x%X, " + "command returned:0x%X, " + "expected command:0x%X", + l_psuResponse.sbe_commandClass, + SbePsu::SBE_PSU_GENERIC_MESSAGE, + l_psuResponse.sbe_command, + SbePsu::SBE_PSU_MSG_GET_CAPABILITIES); + + /*@ + * @errortype + * @moduleid SBEIO_PSU + * @reasoncode SBEIO_RECEIVED_UNEXPECTED_MSG + * @userdata1 Target HUID + * @userdata2[0:15] Requested command class + * @userdata2[16:31] Requested command + * @userdata2[32:47] Returned command class + * @userdata2[48:63] Returned command + * @devdesc Call to PSU Chip Op returned an + * unexpected message type. + */ + l_errl = new ErrlEntry( + ERRL_SEV_INFORMATIONAL, + SBEIO_PSU, + SBEIO_RECEIVED_UNEXPECTED_MSG, + get_huid(i_target), + TWO_UINT32_TO_UINT64( + TWO_UINT16_TO_UINT32(SbePsu::SBE_PSU_GENERIC_MESSAGE, + SbePsu::SBE_PSU_MSG_GET_CAPABILITIES), + TWO_UINT16_TO_UINT32(l_psuResponse.sbe_commandClass, + l_psuResponse.sbe_command) )); + + l_errl->collectTrace(SBEIO_COMP_NAME, 256); + + break; + } + + // Check for any difference in sizes (expected vs returned) + // This may happen but it is not a show stopper, just note it + if (l_psuResponse.sbe_capabilities_size != l_sbeCapabilitiesSize) + { + TRACFCOMP(g_trac_sbeio, "getPsuSbeCapabilities:" + "Call to performPsuChipOp returned an unexpected size: " + "capabilities size returned:%d, " + "expected capabilities size:%d, ", + l_psuResponse.sbe_capabilities_size, + l_sbeCapabilitiesSize); + } + + // Create an SBE Capabilities structure to make it easy to pull data; + // clear memory before use + sbeCapabilities_t l_sbeCapabilities; + memset(&l_sbeCapabilities, 0, sizeof(sbeCapabilities_t)); + + // If the returned size is greater than or equal to the needed size, + // then copy all of the SBE capabilities + if (l_psuResponse.sbe_capabilities_size >= l_sbeCapabilitiesSize) + { + memcpy (&l_sbeCapabilities, + reinterpret_cast<void*>(l_sbeCapabilitiesReadBufferAligned), + l_sbeCapabilitiesSize); + } + // If the returned size is less than the needed size and is not zero + // then copy what was given + else if (l_psuResponse.sbe_capabilities_size) + { + memcpy (&l_sbeCapabilities, + reinterpret_cast<void*>(l_sbeCapabilitiesReadBufferAligned), + l_psuResponse.sbe_capabilities_size); + } + + // If data returned, retrieve it + if (l_psuResponse.sbe_capabilities_size) + { + applySbeCapabilities(i_target, l_sbeCapabilities); + } + } while (0); + + // Free the buffer + if (l_sbeCapabilitiesReadBuffer) + { + free(l_sbeCapabilitiesReadBuffer); + l_sbeCapabilitiesReadBuffer = nullptr; + } + + TRACFCOMP(g_trac_sbeio, EXIT_MRK "getPsuSbeCapabilities"); + + return l_errl; +}; + + +/** + * getFifoSbeCapabilities + */ +errlHndl_t getFifoSbeCapabilities(TargetHandle_t i_target) +{ + errlHndl_t l_errl(nullptr); + + TRACDCOMP(g_trac_sbeio, ENTER_MRK "getFifoSbeCapabilities"); + + do + { + // Get the needed structures to make the FIFO call + // Create a FIFO request message. Default ctor initializes correctly + SbeFifo::fifoGetCapabilitiesRequest l_fifoRequest; + + // Create a FIFO response message. No need to iniitilaize + SbeFifo::fifoGetCapabilitiesResponse l_fifoResponse; + + // Make the call to perform the FIFO Chip Operation + l_errl = SbeFifo::getTheInstance().performFifoChipOp( + i_target, + reinterpret_cast<uint32_t *>(&l_fifoRequest), + reinterpret_cast<uint32_t *>(&l_fifoResponse), + sizeof(l_fifoResponse)); + + if (l_errl) + { + TRACFCOMP(g_trac_sbeio, + "Call to performFifoChipOp failed, error returned"); + break; + } + + // Sanity check - are HW and HB communications in sync? + if ((SbeFifo::FIFO_STATUS_MAGIC != l_fifoResponse.status.magic) || + (SbeFifo::SBE_FIFO_CLASS_GENERIC_MESSAGE != + l_fifoResponse.status.commandClass) || + (SbeFifo::SBE_FIFO_CMD_GET_CAPABILITIES != + l_fifoResponse.status.command)) + { + TRACFCOMP(g_trac_sbeio, + "Call to performFifoChipOp returned an unexpected " + "message type; " + "magic code returned:0x%X, " + "expected magic code:0x%X, " + "command class returned:0x%X, " + "expected command class:0x%X, " + "command returned:0x%X, " + "expected command:0x%X", + l_fifoResponse.status.magic, + SbeFifo::FIFO_STATUS_MAGIC, + l_fifoResponse.status.commandClass, + SbeFifo::SBE_FIFO_CLASS_GENERIC_MESSAGE, + l_fifoResponse.status.command, + SbeFifo::SBE_FIFO_CMD_GET_CAPABILITIES); + + /*@ + * @errortype + * @moduleid SBEIO_FIFO + * @reasoncode SBEIO_RECEIVED_UNEXPECTED_MSG + * @userdata1 Target HUID + * @userdata2[0:15] Requested command class + * @userdata2[16:31] Requested command + * @userdata2[32:47] Returned command class + * @userdata2[48:63] Returned command + * @devdesc Call to FIFO Chip Op returned an + * unexpected message type. + */ + l_errl = new ErrlEntry( + ERRL_SEV_INFORMATIONAL, + SBEIO_FIFO, + SBEIO_RECEIVED_UNEXPECTED_MSG, + get_huid(i_target), + TWO_UINT32_TO_UINT64( + TWO_UINT16_TO_UINT32(SbeFifo::SBE_FIFO_CLASS_GENERIC_MESSAGE, + SbeFifo::SBE_FIFO_CMD_GET_CAPABILITIES), + TWO_UINT16_TO_UINT32(l_fifoResponse.status.commandClass, + l_fifoResponse.status.command) )); + + l_errl->collectTrace(SBEIO_COMP_NAME, 256); + + break; + } + + applySbeCapabilities(i_target, l_fifoResponse.capabilities); + } + while(0); + + TRACDCOMP(g_trac_sbeio, EXIT_MRK "getFifoSbeCapabilities"); + + return l_errl; +}; + +} //end namespace SBEIO + diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index c5b1661b5..d72cee29e 100755 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -6364,6 +6364,55 @@ </attribute> <attribute> + <id>SBE_COMMIT_ID</id> + <description> + A hexadecimal value of the commit ID associated + with the SBE. + </description> + <simpleType> + <uint32_t> + </uint32_t> + </simpleType> + <persistency>volatile-zeroed</persistency> + <readable/> + <writeable/> +</attribute> + +<attribute> + <id>SBE_VERSION_INFO</id> + <description> + A hexadecimal value of the major and minor + version of the SBE. The major info is in the + first 16 bits followed by the minor. + 0:15: Major Version + 16:31: Minor Version + </description> + <simpleType> + <uint32_t> + </uint32_t> + </simpleType> + <persistency>volatile-zeroed</persistency> + <readable/> + <writeable/> +</attribute> + +<attribute> + <id>SBE_RELEASE_TAG</id> + <description> + An ascii value of the SBE release tag + </description> + <simpleType> + <string> + <default></default> + <sizeInclNull>21</sizeInclNull> + </string> + </simpleType> + <persistency>volatile-zeroed</persistency> + <readable/> + <writeable/> +</attribute> + +<attribute> <id>PROC_PCIE_REFCLOCK_ENABLE</id> <description>PCIE refclock enable valid mask PCIE refclock enable valid mask diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index 106126ac6..07a3a7d32 100644 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -279,6 +279,15 @@ <attribute> <id>LOCATION_CODE</id> </attribute> + <attribute> + <id>SBE_COMMIT_ID</id> + </attribute> + <attribute> + <id>SBE_VERSION_INFO</id> + </attribute> + <attribute> + <id>SBE_RELEASE_TAG</id> + </attribute> </targetType> <targetType> |