diff options
author | Roland Veloz <rveloz@us.ibm.com> | 2017-12-20 12:08:19 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-01-17 16:08:40 -0500 |
commit | 6f4abd1ea46f9b8f4fa1d0632276df8ad77d47d4 (patch) | |
tree | 807639c207bb98d8ba56d2c757d2e2f81f6ab887 /src/include | |
parent | 4e84db479b0ca31d6f54cf8276e339cf566ae51e (diff) | |
download | talos-hostboot-6f4abd1ea46f9b8f4fa1d0632276df8ad77d47d4.tar.gz talos-hostboot-6f4abd1ea46f9b8f4fa1d0632276df8ad77d47d4.zip |
Support for any target deconfig at runtime; Utility to create a generic message
I added code to inform FSP whenever a target has been deconfiged.
I also added a handy utility to facilitate in the construction of
a Generic FSP message.
Change-Id: Iad755d4de1bf200ab00ad3f99451512ba8cdabb4
RTC: 183950
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51201
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/runtime/generic_hbrt_fsp_message.H | 20 | ||||
-rw-r--r-- | src/include/runtime/hbrt_utilities.H | 139 | ||||
-rw-r--r-- | src/include/runtime/interface.h | 4 | ||||
-rw-r--r-- | src/include/usr/hwas/common/deconfigGard.H | 14 | ||||
-rw-r--r-- | src/include/usr/hwas/hwasplatreasoncodes.H | 4 | ||||
-rw-r--r-- | src/include/usr/mbox/mbox_queues.H | 3 |
6 files changed, 172 insertions, 12 deletions
diff --git a/src/include/runtime/generic_hbrt_fsp_message.H b/src/include/runtime/generic_hbrt_fsp_message.H index b34a98d26..5c9ca7eb0 100644 --- a/src/include/runtime/generic_hbrt_fsp_message.H +++ b/src/include/runtime/generic_hbrt_fsp_message.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2017 */ +/* Contributors Listed Below - COPYRIGHT 2013,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -25,7 +25,7 @@ #ifndef __RUNTIME__GENERIC_HBRT_FSP_MESSAGE_H #define __RUNTIME__GENERIC_HBRT_FSP_MESSAGE_H -#include <builtins.h> +#include <targeting/common/attributes.H> // TARGETING::HwasState /** @file generic_hbrt_fsp_message.H * @brief A generic structure for passing data @@ -34,8 +34,6 @@ * FSP/HWSV team to send and receive data. */ - - /** * This generates a sequence ID that the GenericFspMboxMessage_t * consumes. @@ -50,6 +48,19 @@ private: static uint16_t SEQ_ID; }; + +/** + * A useful struct to pack/access the HUID and HWAS state + * from the GenericFspMboxMessage_t.data. + * The HUID will be in the first 4 bytes followed by the HWAS state. + */ +struct TargetDeconfigHbrtFspData_t +{ + uint32_t huid; + TARGETING::HwasState hwasState; +} PACKED ; + + /** * A useful struct to access the PLID from GenericFspMboxMessage_t.data * The PLID will be in the first 4 bytes followed by some other data. @@ -107,6 +118,7 @@ struct GenericFspMboxMessage_t MSG_TOD_BACKUP_RESET = 0x0001, MSG_TOD_BACKUP_RESET_INFORM_PHYP = 0x0002, MSG_TOD_TOPOLOGY_DATA = 0x0003, + MSG_DECONFIG_TARGET = 0x0004, MSG_SBE_ERROR = 0x000000E1, MSG_SBE_RECOVERY_SUCCESS = 0x000000E2, MSG_SBE_RECOVERY_FAILED = 0x000000E3, diff --git a/src/include/runtime/hbrt_utilities.H b/src/include/runtime/hbrt_utilities.H new file mode 100644 index 000000000..9f7e69225 --- /dev/null +++ b/src/include/runtime/hbrt_utilities.H @@ -0,0 +1,139 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/runtime/hbrt_utilities.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017,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 */ +#ifndef __RUNTIME__UTILITIES_H +#define __RUNTIME__UTILITIES_H + +#ifndef __HOSTBOOT_RUNTIME_INTERFACE_VERSION_ONLY + +#include "interface.h" + +/** @file hbrt_utilities.H + * @brief A file to put HBRT Interface utilities + * + * This file contains utilities that facilitate + * the usage of the HBRT Interface + */ + +/** + * @brief A handy utility to create the firmware request and response + * messages, for FSP, where the messages must be of equal size. + * + * @par Detailed Description + * This method will take the size of the Generic FSP Message + * payload, the data to populate GenericFspMboxMessage_t::data, + * and calculate the size requirements for both request and + * response messages. + * + * @pre The input payload size is of reasonable length and the + * request/response messages are at most set to nullptr or at + * least do not point to valid objects (they will be assigned + * to newly created data.) + * + * @post The request/response messages point to a valid struct, + * the request/response message size are equal to each other + * and contain the size of the request/response messages + * respectively upon a successful call else all the output + * parameters will either be NULL or 0 based on type. + * + * @note Use this function iff hbrt_fw_msg::io_type is of type + * HBRT_FW_MSG_HBRT_FSP_REQ. + * + * @note Caller is responsible for deleting (use delete []) the + * allocated memory + * + * @param[in] i_fspReqPayloadSize The size of the payload that will + * populate GenericFspMboxMessage_t::data + * @param[out] o_fspMsgSize Return the size of the + * GenericFspMboxMessage_t, adjusted to + * accommodate input payload + * @param[out] o_requestMsgSize The size of the hbrt_fw_msg request msg + * @param[out] o_requestMsg The allocated request message (not NULL) + * @param[out] o_responseMsgSize The size of the hbrt_fw_msg respone msg, + * will be equal to the request msg size + * @param[out] o_responseMsg The allocated response message (not + * NULL), zeroed out + */ +void createGenericFspMsg(uint32_t i_fspReqPayloadSize, + uint32_t &o_fspMsgSize, + uint64_t &o_requestMsgSize, + hostInterfaces::hbrt_fw_msg* &o_requestMsg, + uint64_t &o_responseMsgSize, + hostInterfaces::hbrt_fw_msg* &o_responseMsg) +{ + // Do some quick initialization of the output data + o_fspMsgSize = o_requestMsgSize = o_responseMsgSize = 0; + o_requestMsg = o_responseMsg = nullptr; + + // Calculate the total size of the Generic FSP Message. + o_fspMsgSize = GENERIC_FSP_MBOX_MESSAGE_BASE_SIZE + + i_fspReqPayloadSize; + + // The total Generic FSP Message size must be at a minimum the + // size of the FSP generic message (sizeof(GenericFspMboxMessage_t)) + if (o_fspMsgSize < sizeof(GenericFspMboxMessage_t)) + { + o_fspMsgSize = sizeof(GenericFspMboxMessage_t); + } + + // Calculate the total size of the hbrt_fw_msgs which + // means only adding hostInterfaces::HBRT_FW_MSG_BASE_SIZE to + // the previous calculated Generic FSP Message size. + o_requestMsgSize = o_responseMsgSize = + hostInterfaces::HBRT_FW_MSG_BASE_SIZE + o_fspMsgSize; + + // Create the hbrt_fw_msgs + o_responseMsg = reinterpret_cast<hostInterfaces::hbrt_fw_msg *> + (new uint8_t[o_responseMsgSize]); + o_requestMsg = reinterpret_cast<hostInterfaces::hbrt_fw_msg *> + (new uint8_t[o_requestMsgSize]); + + // If anyone of these two message's memory can't be allocated, then + // delete both messages (in case one did allocate memory), set both + // messages to NULL pointers and set their respective sizes to zero. + if (!o_responseMsg || !o_requestMsg) + { + // OK to delete a NULL pointer if it happens + delete []o_responseMsg; + delete []o_requestMsg; + + // Return output data zeroed out + o_responseMsg = o_requestMsg = nullptr; + o_fspMsgSize = o_requestMsgSize = o_responseMsgSize = 0; + } + else + { + // Initialize/zero out hbrt_fw_msgs + o_requestMsg->generic_msg.initialize(); + memset(o_responseMsg, 0, o_responseMsgSize); + + // We can at least set these parameters based on current usage + o_requestMsg->io_type = hostInterfaces::HBRT_FW_MSG_HBRT_FSP_REQ; + o_requestMsg->generic_msg.dataSize = o_fspMsgSize; + o_requestMsg->generic_msg.__req = GenericFspMboxMessage_t::REQUEST; + } +} // end createGenericFspMsg + +#endif //__HOSTBOOT_RUNTIME_INTERFACE_VERSION_ONLY +#endif // __RUNTIME__UTILITIES_H diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h index b2c7312a4..2fa93a398 100644 --- a/src/include/runtime/interface.h +++ b/src/include/runtime/interface.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2017 */ +/* Contributors Listed Below - COPYRIGHT 2013,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -46,6 +46,8 @@ #include <stdint.h> #include <time.h> #include <limits.h> +#include <stdlib.h> +#include <string.h> #include "generic_hbrt_fsp_message.H" /** Memory error types defined for memory_error() interface. */ diff --git a/src/include/usr/hwas/common/deconfigGard.H b/src/include/usr/hwas/common/deconfigGard.H index 42782883f..b0f4e11aa 100644 --- a/src/include/usr/hwas/common/deconfigGard.H +++ b/src/include/usr/hwas/common/deconfigGard.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -438,10 +438,14 @@ public: errlHndl_t platGetGardRecords(const TARGETING::Target * const i_pTarget, GardRecords_t & o_records); - - - - + /** + * @brief Platform specific function that + * Will perform any post-deconfig operations, + * such as syncing state with other subsystems + * + * @param[in] i_pTarget Pointer to target + */ + void platPostDeconfigureTarget(TARGETING::Target * i_pTarget); protected: diff --git a/src/include/usr/hwas/hwasplatreasoncodes.H b/src/include/usr/hwas/hwasplatreasoncodes.H index df7d7f5e1..cbc28e81c 100644 --- a/src/include/usr/hwas/hwasplatreasoncodes.H +++ b/src/include/usr/hwas/hwasplatreasoncodes.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* Contributors Listed Below - COPYRIGHT 2014,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -50,6 +50,8 @@ namespace HWAS RC_BAD_CHIPID = HWAS_COMP_ID | 0x83, RC_BAD_LX = HWAS_COMP_ID | 0x84, RC_BAD_MCA = HWAS_COMP_ID | 0x85, + RC_RT_NULL_FIRMWARE_REQUEST_PTR = HWAS_COMP_ID | 0x86, + RC_RT_NULL_FIRMWARE_MSG_PTR = HWAS_COMP_ID | 0x87, }; }; diff --git a/src/include/usr/mbox/mbox_queues.H b/src/include/usr/mbox/mbox_queues.H index 1f211eaf8..ec02dada0 100644 --- a/src/include/usr/mbox/mbox_queues.H +++ b/src/include/usr/mbox/mbox_queues.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -75,6 +75,7 @@ namespace MBOX FSP_PRD_SYNC_MSGQ_ID = 0x8000000D, FSP_TOD_MSGQ = 0x8000000E, FSP_SBE_SYNC_MSGQ_ID = 0x8000000F, + FSP_TARG_DECONFIG_MSGQ = 0x80000010, FSP_LID_MSGQ = FSP_ATTR_SYNC_MSGQ, |