summaryrefslogtreecommitdiffstats
path: root/src/include/usr/util
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2017-09-27 16:22:04 -0500
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-11-01 16:17:58 -0400
commit89c19d7e3a5b6f2781636ca5373672f38d8f0a13 (patch)
tree009a08dbf556fcb21259ada013bc9d211d4a460d /src/include/usr/util
parent141c67de2310692873ff1c3f977a1c6e5d4300ca (diff)
downloadtalos-hostboot-89c19d7e3a5b6f2781636ca5373672f38d8f0a13.tar.gz
talos-hostboot-89c19d7e3a5b6f2781636ca5373672f38d8f0a13.zip
Process Components in Master Container Lid
Change-Id: I31523494f462c88addb51973f605b2ed72674e97 RTC: 125304 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46840 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@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: Michael Baiocchi <mbaiocch@us.ibm.com> Reviewed-by: Marshall J. Wilks <mjwilks@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/include/usr/util')
-rw-r--r--src/include/usr/util/util_reasoncodes.H6
-rw-r--r--src/include/usr/util/utillidmgr.H2
-rw-r--r--src/include/usr/util/utilmclmgr.H110
3 files changed, 113 insertions, 5 deletions
diff --git a/src/include/usr/util/util_reasoncodes.H b/src/include/usr/util/util_reasoncodes.H
index f90784c77..77fd1e628 100644
--- a/src/include/usr/util/util_reasoncodes.H
+++ b/src/include/usr/util/util_reasoncodes.H
@@ -49,7 +49,8 @@ namespace Util
UTIL_TCE_UNMAP_PSIHB = 0x0F, // UtilTceMgr::unmapPsiHostBridge
UTIL_MCL_INIT_MEM = 0x10, // MasterContainerLidMgr::initMem
UTIL_MCL_REL_MEM = 0x11, // MasterContainerLidMgr::releaseMem
-
+ UTIL_MCL_PROCESS_COMP = 0x12, // MasterContainerLidMgr::processComponent
+ UTIL_MCL_VERIFY_EXT = 0x13, // MasterContainerLidMgr::verifyExtend
};
enum ReasonCode
@@ -77,7 +78,8 @@ namespace Util
UTIL_TCE_BLOCK_UNMAP_FAIL = UTIL_COMP_ID | 0x15,
UTIL_MM_BLOCK_MAP_FAILED = UTIL_COMP_ID | 0x16,
UTIL_MM_BLOCK_UNMAP_FAILED = UTIL_COMP_ID | 0x17,
-
+ UTIL_MCL_SIZE_MISMATCH = UTIL_COMP_ID | 0x18,
+ UTIL_MCL_COMPID_MISMATCH = UTIL_COMP_ID | 0x19,
};
};
diff --git a/src/include/usr/util/utillidmgr.H b/src/include/usr/util/utillidmgr.H
index 725e51671..c2ac2d9a0 100644
--- a/src/include/usr/util/utillidmgr.H
+++ b/src/include/usr/util/utillidmgr.H
@@ -50,7 +50,7 @@ enum LidId
TEST_LIDID = 0x00000111,
OCC_LIDID = 0x81e00430,
OCC_CONTAINER_LIDID = 0x80d0000b,
- MCL_LIDID = 0x80D00020,
+ MCL_LIDID = 0x80d00020,
// TODO RTC 172767 Make utillidmgr LIDID structure attribute driven
WOF_LIDID = 0x81e00440,
WOF_CONTAINER_LIDID = 0x80d00015,
diff --git a/src/include/usr/util/utilmclmgr.H b/src/include/usr/util/utilmclmgr.H
index 58a73bae4..f33d4001f 100644
--- a/src/include/usr/util/utilmclmgr.H
+++ b/src/include/usr/util/utilmclmgr.H
@@ -40,7 +40,11 @@ namespace MCL
// Component ID(name) within MCL
typedef std::array<uint8_t,16> ComponentID;
-// Defines to simplify syntax when checking for the MCL and POWERVM comp ids
+// Component ID in string form
+// NOTE: ComponentID in the MCL does not include NULL terminator so include room
+typedef char CompIdString[17];
+
+// Constants to simplify checking for the MCL and POWERVM comp ids
extern const ComponentID g_MclCompId;
extern const ComponentID g_PowervmCompId;
@@ -194,8 +198,46 @@ struct CompInfo
void print() const;
};
+// Comparator to ensure PHYP is always the first component to be processed
+struct CompOrderCompare {
+ bool operator() (const ComponentID& lhs, const ComponentID& rhs) const
+ {
+ if((lhs == g_PowervmCompId))
+ {
+ return true;
+ }
+ else if ((rhs == g_PowervmCompId))
+ {
+ return false;
+ }
+
+ return lhs<rhs;
+ }
+};
+
// Structure for Comp Info cache
-typedef std::map<ComponentID, CompInfo> CompInfoMap;
+typedef std::map<ComponentID, CompInfo, CompOrderCompare> CompInfoMap;
+
+/**
+ * @brief Convert Component ID to a char*
+ * Helpful for trace
+ *
+ * @param[in] i_compId - Component ID to convert
+ * @param[out] o_compIdStr - Component ID String
+ *
+ * @return N/A
+ */
+void compIdToString(const ComponentID i_compId, CompIdString o_compIdStr);
+
+/**
+ * @brief Convert/truncate Component ID to a uint64_t
+ * Helpful for FFDC
+ *
+ * @param[in] i_compId - Component ID to convert
+ *
+ * @return uint64_t - truncated Component ID
+ */
+uint64_t compIdToInt(const ComponentID i_compId);
// @brief Class to manager the Master Container Lid provided by the FSP
class MasterContainerLidMgr
@@ -214,6 +256,12 @@ class MasterContainerLidMgr
*/
~MasterContainerLidMgr();
+ /**
+ * @brief Process each component in the MCL.
+ * See: processComponent for more info
+ */
+ errlHndl_t processComponents();
+
protected:
/**
@@ -280,6 +328,52 @@ class MasterContainerLidMgr
*/
void printCompInfoCache();
+ /**
+ * @brief Process single component in the MCL.
+ * Loads, verifies, tpm extends lids and loads into hb resv memory
+ *
+ * @param[in] i_compId - Component Id
+ * @param[in] io_compInfo - Component info of component to process
+ *
+ * @return Error handle if error
+ */
+ errlHndl_t processComponent(const ComponentID& i_compId,
+ CompInfo& io_compInfo);
+
+ /**
+ * @brief Load all lids associated with a Component into contiguous memory
+ * NOTE: updates the lid sizes in CompInfo
+ *
+ * @param[in] io_compInfo - Component info of component to verify
+ * @param[out] o_totalSize - Size of all lids reported by the FSP
+ *
+ * @return Error handle if error
+ */
+ errlHndl_t loadLids(CompInfo& io_compInfo, size_t& o_totalSize);
+
+ /**
+ * @brief Verify and Extend Component
+ *
+ * @param[in] i_compId - Component Id
+ * @param[in] io_compInfo - Component info of component to verify
+ *
+ * @return Error handle if error
+ * Note: Will not return on Secure Verification Error
+ */
+ errlHndl_t verifyExtend(const ComponentID& i_compId,
+ CompInfo& io_compInfo);
+
+ /**
+ * @brief TPM extend information for secure components
+ *
+ * @param[in] i_compId - Component Id
+ * @param[in] i_conHdr - Container header with information to extend
+ *
+ * @return Error handle if error
+ */
+ errlHndl_t tpmExtend(const ComponentID& i_compId,
+ const SECUREBOOT::ContainerHeader& i_conHdr) const;
+
// Physical addresses reserved for the MCL itself
uint64_t iv_mclAddr;
@@ -292,15 +386,27 @@ class MasterContainerLidMgr
// Maximum size of memory for temp MCL mgr workspace
size_t iv_tmpSize;
+ // Maximum size based on MCL or temp components
+ size_t iv_maxSize;
+
// Pointer to MCL virtual address space
void* iv_pMclVaddr;
// Pointer to MCL temp virtual address space
void* iv_pTempVaddr;
+ // Pointer to either MCL or TMP virtual address spaces
+ void* iv_pVaddr;
+
// Cache Components and their corresponding lids
CompInfoMap iv_compInfoCache;
+ // Indicates that Master Container Lid has a header
+ bool iv_hasHeader;
+
+ // Cache current comp id string for easy tracing
+ CompIdString iv_curCompIdStr;
+
// Allow test cases to call custom constructors and have direct access
friend class ::MasterContainerLidMgrTest;
};
OpenPOWER on IntegriCloud