summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Veloz <rveloz@us.ibm.com>2017-12-20 12:08:19 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-01-17 16:08:40 -0500
commit6f4abd1ea46f9b8f4fa1d0632276df8ad77d47d4 (patch)
tree807639c207bb98d8ba56d2c757d2e2f81f6ab887
parent4e84db479b0ca31d6f54cf8276e339cf566ae51e (diff)
downloadtalos-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>
-rw-r--r--src/include/runtime/generic_hbrt_fsp_message.H20
-rw-r--r--src/include/runtime/hbrt_utilities.H139
-rw-r--r--src/include/runtime/interface.h4
-rw-r--r--src/include/usr/hwas/common/deconfigGard.H14
-rw-r--r--src/include/usr/hwas/hwasplatreasoncodes.H4
-rw-r--r--src/include/usr/mbox/mbox_queues.H3
-rw-r--r--src/usr/hwas/common/deconfigGard.C39
-rw-r--r--src/usr/hwas/common/hwasCallout.C2
-rw-r--r--src/usr/hwas/hwasPlat.C13
-rw-r--r--src/usr/hwas/hwasPlatDeconfigGard.C170
-rw-r--r--src/usr/hwas/hwasPlatError.C18
-rw-r--r--src/usr/isteps/pm/runtime/test/firmwareRequestTest.H150
12 files changed, 451 insertions, 125 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,
diff --git a/src/usr/hwas/common/deconfigGard.C b/src/usr/hwas/common/deconfigGard.C
index ab87aba12..ed16a805b 100644
--- a/src/usr/hwas/common/deconfigGard.C
+++ b/src/usr/hwas/common/deconfigGard.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -114,7 +114,7 @@ errlHndl_t clearGardByType(const GARD_ErrorType i_type)
return theDeconfigGard().clearGardRecordsByType(i_type);
}
-#endif
+#endif //__HOSTBOOT_RUNTIME
//******************************************************************************
DeconfigGard & theDeconfigGard()
@@ -911,6 +911,7 @@ errlHndl_t DeconfigGard::getGardRecords(
errlHndl_t l_pErr = platGetGardRecords(i_pTarget, o_records);
return l_pErr;
}
+#endif //__HOSTBOOT_RUNTIME
//******************************************************************************
errlHndl_t DeconfigGard::deconfigureTarget(
@@ -1004,6 +1005,7 @@ errlHndl_t DeconfigGard::deconfigureTarget(
return l_pErr;
} // deconfigureTarget
+#ifndef __HOSTBOOT_RUNTIME
//******************************************************************************
void DeconfigGard::registerDeferredDeconfigure(
const Target & i_target,
@@ -1066,7 +1068,7 @@ errlHndl_t DeconfigGard::_getDeconfigureRecords(
HWAS_MUTEX_UNLOCK(iv_mutex);
return NULL;
}
-
+#endif //__HOSTBOOT_RUNTIME
//******************************************************************************
/**
@@ -2041,10 +2043,18 @@ void DeconfigGard::_deconfigureTarget(
// Set flag indicating x/a/o bus endpoint deconfiguration
iv_XAOBusEndpointDeconfigured = true;
}
+
+ // The target has been successfully de-configured,
+ // perform any other post-deconfig operations,
+ // e.g. syncing state with other subsystems
+ // TODO RTC:184521: Allow function platPostDeconfigureTarget
+ // to run once FSP supports it
+ // Remove the #ifdef ... #endif, once FSP is ready for code
+ #ifdef __HOSTBOOT_MODULE
+ platPostDeconfigureTarget(&i_target);
+ #endif
}
}
-
- //HWAS_DBG("Deconfiguring Target %.8X exiting", get_huid(&i_target));
} // _deconfigureTarget
//******************************************************************************
@@ -2052,16 +2062,6 @@ void DeconfigGard::_doDeconfigureActions(Target & i_target)
{
// Placeholder for any necessary deconfigure actions
-#ifdef CONFIG_TPMDD
- if( i_target.getAttr<TARGETING::ATTR_TYPE>()
- == TARGETING::TYPE_TPM)
- {
- HWAS_INF("_doDeconfigureActions: Deconfiguring TPM 0x%08X",
- get_huid(&i_target));
- (void)TRUSTEDBOOT::tpmMarkFailed(&i_target);
- }
-#endif
-
#ifdef CONFIG_BMC_IPMI
// set the BMC status for this target
SENSOR::StatusSensor l_sensor( &i_target );
@@ -2081,6 +2081,7 @@ void DeconfigGard::_doDeconfigureActions(Target & i_target)
}
+#ifndef __HOSTBOOT_RUNTIME
//******************************************************************************
void DeconfigGard::_createDeconfigureRecord(
const Target & i_target,
@@ -2178,6 +2179,8 @@ void DeconfigGard::processDeferredDeconfig()
HWAS_DBG("<processDeferredDeconfig");
} // processDeferredDeconfig
+#endif // __HOSTBOOT_RUNTIME
+
//******************************************************************************
errlHndl_t DeconfigGard::_deconfigureAssocProc(ProcInfoVector &io_procInfo)
@@ -2718,6 +2721,7 @@ errlHndl_t DeconfigGard::_symmetryValidation(ProcInfoVector &io_procInfo)
return l_errlHdl;
}
+#ifndef __HOSTBOOT_RUNTIME
//******************************************************************************
void DeconfigGard::setXAOBusEndpointDeconfigured(bool deconfig)
@@ -2755,6 +2759,7 @@ void DeconfigGard::_clearFCODeconfigure(ConstTargetHandle_t i_nodeTarget)
}
}
//******************************************************************************
+#endif // __HOSTBOOT_RUNTIME
//Note this will not find child DIMMs because they are
//affinity children, not physical
@@ -2788,7 +2793,5 @@ bool DeconfigGard::anyChildFunctional(Target & i_parent)
return retVal;
} //anyChildFunctional
-
-#endif
-} // namespce HWAS
+} // namespace HWAS
diff --git a/src/usr/hwas/common/hwasCallout.C b/src/usr/hwas/common/hwasCallout.C
index bdaaea2f5..588833572 100644
--- a/src/usr/hwas/common/hwasCallout.C
+++ b/src/usr/hwas/common/hwasCallout.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2016 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
diff --git a/src/usr/hwas/hwasPlat.C b/src/usr/hwas/hwasPlat.C
index 91d1ee8f6..b617b827b 100644
--- a/src/usr/hwas/hwasPlat.C
+++ b/src/usr/hwas/hwasPlat.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -182,17 +182,6 @@ errlHndl_t platReadIDEC(const TargetHandle_t &i_target)
} // platReadIDEC
//******************************************************************************
-// platSystemIsAtRuntime function
-// Description: This function will return false always because when Hostboot
-// is running then System cannot be at runtime
-//******************************************************************************
-bool platSystemIsAtRuntime()
-{
- HWAS_INF("HostBoot is running so system is not at runtime.");
- return false;
-}
-
-//******************************************************************************
// platIsMinHwCheckingAllowed function
// Description: This function will return false always because when Hostboot
// is running then System cannot be at runtime
diff --git a/src/usr/hwas/hwasPlatDeconfigGard.C b/src/usr/hwas/hwasPlatDeconfigGard.C
index 6c8aa27d5..a8aa334c5 100644
--- a/src/usr/hwas/hwasPlatDeconfigGard.C
+++ b/src/usr/hwas/hwasPlatDeconfigGard.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2017 */
+/* Contributors Listed Below - COPYRIGHT 2013,2018 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -46,6 +46,16 @@
#include <pnor/pnorif.H>
+#ifdef __HOSTBOOT_RUNTIME
+#include <runtime/interface.h> // g_hostInterfaces
+#include <runtime/hbrt_utilities.H> // createGenericFspMsg
+#include <util/runtime/rt_fwreq_helper.H> // firmware_request_helper
+#endif
+
+#ifdef CONFIG_TPMDD
+#include <../usr/secureboot/trusted/trustedbootUtils.H>
+#endif
+
namespace HWAS
{
@@ -543,4 +553,162 @@ errlHndl_t getGardSectionInfo(PNOR::SectionInfo_t& o_sectionInfo)
return l_errl;
}
+/**
+ * @brief This will perform any post-deconfig operations,
+ * such as syncing state with other subsystems
+ */
+void DeconfigGard::platPostDeconfigureTarget(
+ TARGETING::Target * i_pTarget)
+{
+#ifndef __HOSTBOOT_RUNTIME
+#ifdef CONFIG_TPMDD
+ if( i_pTarget->getAttr<TARGETING::ATTR_TYPE>()
+ == TARGETING::TYPE_TPM)
+ {
+ HWAS_INF("platPostDeconfigureTarget: Deconfiguring TPM 0x%08X",
+ get_huid(i_pTarget));
+ (void)TRUSTEDBOOT::tpmMarkFailed(i_pTarget);
+ }
+#endif // CONFIG_TPMDD
+#endif // #ifndef __HOSTBOOT_RUNTIME
+
+#ifdef __HOSTBOOT_RUNTIME
+ // As part of keeping things in sync when a target is
+ // deconfiged, HBRT will send a message down to FSP to
+ // inform FSP that a target has been deconfiged
+ errlHndl_t l_err = nullptr;
+
+ // Handles to the firmware messages
+ hostInterfaces::hbrt_fw_msg *l_req_fw_msg = nullptr;
+ hostInterfaces::hbrt_fw_msg *l_resp_fw_msg = nullptr;
+
+ do
+ {
+ if ((nullptr == g_hostInterfaces) ||
+ (nullptr == g_hostInterfaces->firmware_request))
+ {
+ HWAS_ERR("Hypervisor firmware_request interface not linked");
+
+ /*@
+ * @errortype
+ * @severity ERRL_SEV_INFORMATIONAL
+ * @moduleid HWAS::MOD_PLAT_DECONFIG_GARD
+ * @reasoncode HWAS::RC_RT_NULL_FIRMWARE_REQUEST_PTR
+ * @userdata1 HUID of target
+ * @userdata2 none
+ * @devdesc Post de-configuration of target failed
+ */
+ l_err= new ErrlEntry(ERRL_SEV_INFORMATIONAL,
+ HWAS::MOD_PLAT_DECONFIG_GARD,
+ HWAS::RC_RT_NULL_FIRMWARE_REQUEST_PTR,
+ get_huid(i_pTarget),
+ 0,
+ true);
+ break;
+ }
+
+ // Create and initialize to zero a few needed variables
+ uint32_t l_fsp_data_size(0);
+ uint64_t l_req_fw_msg_size(0), l_resp_fw_msg_size(0);
+
+ // Create the dynamic firmware messages
+ createGenericFspMsg(sizeof(TargetDeconfigHbrtFspData_t),
+ l_fsp_data_size,
+ l_req_fw_msg_size,
+ l_req_fw_msg,
+ l_resp_fw_msg_size,
+ l_resp_fw_msg);
+
+ // If there was an issue with creating the messages,
+ // Create an Error Log entry and exit
+ if (!l_req_fw_msg || !l_resp_fw_msg)
+ {
+ HWAS_ERR("Unable to allocate firmware request messages");
+
+ /*@
+ * @errortype
+ * @severity ERRL_SEV_INFORMATIONAL
+ * @moduleid HWAS::MOD_PLAT_DECONFIG_GARD
+ * @reasoncode HWAS::RC_RT_NULL_FIRMWARE_MSG_PTR
+ * @userdata1 HUID of target
+ * @userdata2 none
+ * @devdesc Post de-configuration of target failed
+ */
+ l_err= new ErrlEntry(ERRL_SEV_INFORMATIONAL,
+ HWAS::MOD_PLAT_DECONFIG_GARD,
+ HWAS::RC_RT_NULL_FIRMWARE_MSG_PTR,
+ get_huid(i_pTarget),
+ 0,
+ true);
+ break;
+ }
+
+ // Populate the request message with given data
+ l_req_fw_msg->generic_msg.msgq = MBOX::FSP_TARG_DECONFIG_MSGQ;
+ l_req_fw_msg->generic_msg.msgType =
+ GenericFspMboxMessage_t::MSG_DECONFIG_TARGET;
+
+ // Create a useful struct to populate the generic_msg::data field
+ // Setting the HUID in the 1st 4 bytes (32bits) followed by the
+ // HWAS state.
+ TargetDeconfigHbrtFspData_t* l_fspData =
+ reinterpret_cast<TargetDeconfigHbrtFspData_t*>
+ (&(l_req_fw_msg->generic_msg.data));
+ l_fspData->huid = get_huid(i_pTarget);
+ l_fspData->hwasState = i_pTarget->getAttr<ATTR_HWAS_STATE>();
+
+ // Binary trace the request message
+ HWAS_INF_BIN("Sending firmware_request",
+ l_req_fw_msg,
+ l_req_fw_msg_size);
+
+ // Make the firmware_request call
+ // Inform the FSP that this target has been deconfiged
+ l_err = firmware_request_helper(l_req_fw_msg_size,
+ l_req_fw_msg,
+ &l_resp_fw_msg_size,
+ l_resp_fw_msg);
+ } while(0);
+
+ if (l_err)
+ {
+ errlCommit(l_err, HWAS_COMP_ID);
+ }
+
+ // Release the firmware messages and set to NULL
+ delete []l_req_fw_msg;
+ delete []l_resp_fw_msg;
+ l_req_fw_msg = l_resp_fw_msg = nullptr;
+#endif // __HOSTBOOT_RUNTIME
+}
+
+//*****************************************************************************
+bool platSystemIsAtRuntime()
+{
+#ifndef __HOSTBOOT_RUNTIME
+ HWAS_INF("HostBoot is running so system is NOT at runtime.");
+ return false;
+#else
+ HWAS_INF("HostBoot is NOT running so system is at runtime.");
+ return true;
+#endif
+}
+
+//*****************************************************************************
+errlHndl_t hwasError(const uint8_t i_sev,
+ const uint8_t i_modId,
+ const uint16_t i_reasonCode,
+ const uint64_t i_user1,
+ const uint64_t i_user2)
+{
+ errlHndl_t l_pErr;
+
+ l_pErr = new ERRORLOG::ErrlEntry(
+ (ERRORLOG::errlSeverity_t)i_sev, i_modId,
+ i_reasonCode,
+ i_user1, i_user2);
+ l_pErr->collectTrace("HWAS_I");
+ return l_pErr;
+}
+
} // namespace HWAS
diff --git a/src/usr/hwas/hwasPlatError.C b/src/usr/hwas/hwasPlatError.C
index 8c53ccdb6..2ec510e66 100644
--- a/src/usr/hwas/hwasPlatError.C
+++ b/src/usr/hwas/hwasPlatError.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -35,22 +35,6 @@
namespace HWAS
{
-errlHndl_t hwasError(const uint8_t i_sev,
- const uint8_t i_modId,
- const uint16_t i_reasonCode,
- const uint64_t i_user1,
- const uint64_t i_user2)
-{
- errlHndl_t l_pErr;
-
- l_pErr = new ERRORLOG::ErrlEntry(
- (ERRORLOG::errlSeverity_t)i_sev, i_modId,
- i_reasonCode,
- i_user1, i_user2);
- l_pErr->collectTrace("HWAS_I");
- return l_pErr;
-}
-
void hwasErrorAddProcedureCallout(errlHndl_t & io_errl,
const HWAS::epubProcedureID i_procedure,
const HWAS::callOutPriority i_priority)
diff --git a/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H b/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H
index 2e2abe25e..152b9f197 100644
--- a/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H
+++ b/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2017 */
+/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -25,6 +25,7 @@
#include <cxxtest/TestSuite.H>
#include <runtime/interface.h>
+#include <runtime/hbrt_utilities.H>
#include <errl/hberrltypes.H>
#include <string.h>
@@ -183,77 +184,95 @@ class FirmwareRequestTest : public CxxTest::TestSuite
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.generic_msg.initialize();
- if (l_req_fw_msg.generic_msg.magic !=
+ // Handles to the firmware messages
+ hostInterfaces::hbrt_fw_msg *l_req_fw_msg = nullptr;
+ hostInterfaces::hbrt_fw_msg *l_resp_fw_msg = nullptr;
+
+ // Create and initialize to zero a few needed variables
+ uint32_t l_fsp_data_size(0);
+ uint64_t l_req_fw_msg_size(0), l_resp_fw_msg_size(0);
+
+ // Create the dynamic firmware messages
+ createGenericFspMsg(sizeof(HbrtFspData_t),
+ l_fsp_data_size,
+ l_req_fw_msg_size,
+ l_req_fw_msg,
+ l_resp_fw_msg_size,
+ l_resp_fw_msg);
+
+ // Populate the firmware_request request struct with given data
+ l_req_fw_msg->generic_msg.msgq = 0x300;
+ l_req_fw_msg->generic_msg.msgType =
+ GenericFspMboxMessage_t::MSG_DECONFIG_TARGET;
+
+ // Create a useful struct to populate the generic_msg::data field
+ // Setting the PLID and userData
+ HbrtFspData_t* l_fspData =
+ reinterpret_cast<HbrtFspData_t*>
+ (&(l_req_fw_msg->generic_msg.data));
+ l_fspData->plid = 0x600;
+ l_fspData->userData = 0x700;
+
+ if (l_req_fw_msg->generic_msg.magic !=
GenericFspMboxMessage_t::MAGIC_NUMBER)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"magic was not properly initialized");
}
- if (l_req_fw_msg.generic_msg.dataSize !=
- sizeof(l_req_fw_msg.generic_msg))
+ if (l_req_fw_msg->generic_msg.dataSize != l_fsp_data_size)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"dataSize was not properly initialized");
}
- if (l_req_fw_msg.generic_msg.structVer !=
+ if (l_req_fw_msg->generic_msg.structVer !=
GenericFspMboxMessage_t::STRUCT_VERSION_LATEST)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"structVer was not properly initialized");
}
- if (l_req_fw_msg.generic_msg.seqnum != SeqId_t::getCurrentSeqId())
+ if (l_req_fw_msg->generic_msg.seqnum != SeqId_t::getCurrentSeqId())
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"seqnum was not properly initialized");
}
- l_req_fw_msg.io_type = hostInterfaces::HBRT_FW_MSG_HBRT_FSP_REQ;
- l_req_fw_msg.generic_msg.magic = 0x100;
- l_req_fw_msg.generic_msg.dataSize =
- sizeof(l_req_fw_msg.generic_msg);
- l_req_fw_msg.generic_msg.structVer = 0x20;
- l_req_fw_msg.generic_msg.seqnum = 0x300;
- l_req_fw_msg.generic_msg.msgq = 0x400;
- l_req_fw_msg.generic_msg.msgType = 0x500;
- l_req_fw_msg.generic_msg.__req = GenericFspMboxMessage_t::REQUEST;
- l_req_fw_msg.generic_msg.__onlyError =
+ l_req_fw_msg->io_type = hostInterfaces::HBRT_FW_MSG_HBRT_FSP_REQ;
+ l_req_fw_msg->generic_msg.magic = 0x100;
+ l_req_fw_msg->generic_msg.dataSize = l_fsp_data_size;
+ l_req_fw_msg->generic_msg.structVer = 0x20;
+ l_req_fw_msg->generic_msg.seqnum = 0x300;
+ l_req_fw_msg->generic_msg.msgq = 0x400;
+ l_req_fw_msg->generic_msg.msgType = 0x500;
+ l_req_fw_msg->generic_msg.__req = GenericFspMboxMessage_t::REQUEST;
+ l_req_fw_msg->generic_msg.__onlyError =
GenericFspMboxMessage_t::ERROR_ONLY;
- uint32_t l_plid = 0x600;
- uint32_t l_huid = 0x700;
- l_req_fw_msg.generic_msg.data =
- TWO_UINT32_TO_UINT64(l_plid, l_huid);
TRACFCOMP(g_trac_pnor,
"FirmwareRequestTest::testFirmwareRequestHbrtToFsp req: "
"type:%d, magic:0x%.8X, dataSize:%d, structVer:0x%.8X, "
"seqnum:%.8X, msgq:0x%.8X, msgType:0x%.8X, __req:%d, "
"__onlyError:%d, data:0x%.8X, plid:0x%.8X, huid:0x%.8X",
- l_req_fw_msg.io_type,
- l_req_fw_msg.generic_msg.magic,
- l_req_fw_msg.generic_msg.dataSize,
- l_req_fw_msg.generic_msg.structVer,
- l_req_fw_msg.generic_msg.seqnum,
- l_req_fw_msg.generic_msg.msgq,
- l_req_fw_msg.generic_msg.msgType,
- l_req_fw_msg.generic_msg.__req,
- l_req_fw_msg.generic_msg.__onlyError,
- l_req_fw_msg.generic_msg.data,
- l_req_fw_msg.generic_msg.data >> 32,
- 0x0000FFFF & l_req_fw_msg.generic_msg.data);
-
- hostInterfaces::hbrt_fw_msg l_resp_fw_msg;
- uint64_t l_resp_fw_msg_size = sizeof(l_resp_fw_msg);
- memset(&l_resp_fw_msg, 0, l_resp_fw_msg_size);
- 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);
+ l_req_fw_msg->io_type,
+ l_req_fw_msg->generic_msg.magic,
+ l_req_fw_msg->generic_msg.dataSize,
+ l_req_fw_msg->generic_msg.structVer,
+ l_req_fw_msg->generic_msg.seqnum,
+ l_req_fw_msg->generic_msg.msgq,
+ l_req_fw_msg->generic_msg.msgType,
+ l_req_fw_msg->generic_msg.__req,
+ l_req_fw_msg->generic_msg.__onlyError,
+ l_req_fw_msg->generic_msg.data,
+ l_req_fw_msg->generic_msg.data >> 32,
+ 0x0000FFFF & l_req_fw_msg->generic_msg.data);
+
+ 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);
TRACFCOMP(g_trac_pnor,
"FirmwareRequestTest::testFirmwareRequestHbrtToFsp resp: "
@@ -261,18 +280,18 @@ class FirmwareRequestTest : public CxxTest::TestSuite
"seqnum:%.8X, msgq:0x%.8X, msgType:0x%.8X, __req:%d, "
"__onlyError:%d, data:0x%.8X, plid:0x%.8X, huid:0x%.8X, "
"rc=%d",
- l_resp_fw_msg.io_type,
- l_resp_fw_msg.generic_msg.magic,
- l_resp_fw_msg.generic_msg.dataSize,
- l_resp_fw_msg.generic_msg.structVer,
- l_resp_fw_msg.generic_msg.seqnum,
- l_resp_fw_msg.generic_msg.msgq,
- l_resp_fw_msg.generic_msg.msgType,
- l_resp_fw_msg.generic_msg.__req,
- l_resp_fw_msg.generic_msg.__onlyError,
- l_resp_fw_msg.generic_msg.data,
- l_resp_fw_msg.generic_msg.data >> 32,
- 0x0000FFFF & l_resp_fw_msg.generic_msg.data,
+ l_resp_fw_msg->io_type,
+ l_resp_fw_msg->generic_msg.magic,
+ l_resp_fw_msg->generic_msg.dataSize,
+ l_resp_fw_msg->generic_msg.structVer,
+ l_resp_fw_msg->generic_msg.seqnum,
+ l_resp_fw_msg->generic_msg.msgq,
+ l_resp_fw_msg->generic_msg.msgType,
+ l_resp_fw_msg->generic_msg.__req,
+ l_resp_fw_msg->generic_msg.__onlyError,
+ l_resp_fw_msg->generic_msg.data,
+ l_resp_fw_msg->generic_msg.data >> 32,
+ 0x0000FFFF & l_resp_fw_msg->generic_msg.data,
rc);
if (rc != 5)
@@ -282,7 +301,7 @@ class FirmwareRequestTest : public CxxTest::TestSuite
"returned wrong value");
}
- if (l_resp_fw_msg.io_type !=
+ if (l_resp_fw_msg->io_type !=
hostInterfaces::HBRT_FW_MSG_HBRT_FSP_RESP)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
@@ -290,62 +309,65 @@ class FirmwareRequestTest : public CxxTest::TestSuite
"received incorrect msg_type");
}
- if (l_resp_fw_msg.generic_msg.magic != 0x10)
+ if (l_resp_fw_msg->generic_msg.magic != 0x10)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"firmware_request - HBRT to FSP failed - "
"received incorrect magic");
}
- if (l_resp_fw_msg.generic_msg.dataSize != 32)
+ if (l_resp_fw_msg->generic_msg.dataSize != 32)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"firmware_request - HBRT to FSP failed - "
"received incorrect datSize");
}
-
- if (l_resp_fw_msg.generic_msg.structVer != 0x02)
+ if (l_resp_fw_msg->generic_msg.structVer != 0x02)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"firmware_request - HBRT to FSP failed - "
"received incorrect structVer");
}
- if (l_resp_fw_msg.generic_msg.seqnum != 0x30)
+ if (l_resp_fw_msg->generic_msg.seqnum != 0x30)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"firmware_request - HBRT to FSP failed - "
"received incorrect seqnum");
}
- if (l_resp_fw_msg.generic_msg.msgq != 0x40)
+ if (l_resp_fw_msg->generic_msg.msgq != 0x40)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"firware_request - HBRT to FSP failed - "
"received incorrect msgq");
}
- if (l_resp_fw_msg.generic_msg.msgType != 0x50)
+ if (l_resp_fw_msg->generic_msg.msgType != 0x50)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"firware_request - HBRT to FSP failed - "
"received incorrect msgType");
}
- if (l_resp_fw_msg.generic_msg.data >> 32 != 0x60)
+ if (l_resp_fw_msg->generic_msg.data >> 32 != 0x60)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"firware_request - HBRT to FSP failed - "
"received incorrect errPlid");
}
- if ((0x0000FFFF & l_resp_fw_msg.generic_msg.data) != 0x70)
+ if ((0x0000FFFF & l_resp_fw_msg->generic_msg.data) != 0x70)
{
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
"firware_request - HBRT to FSP failed - "
"received incorrect huid");
}
+
+ delete[] l_req_fw_msg;
+ delete[] l_resp_fw_msg;
+ l_req_fw_msg = l_resp_fw_msg = nullptr;
}
TRACFCOMP(g_trac_pnor, EXIT_MRK
"FirmwareRequestTest::testFirmwareRequestHbrtToFsp");
OpenPOWER on IntegriCloud