summaryrefslogtreecommitdiffstats
path: root/src/usr/secureboot/trusted/base
diff options
context:
space:
mode:
authorChris Engel <cjengel@us.ibm.com>2015-09-18 09:17:23 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-06-08 22:45:27 -0400
commitc4119b881e8a6e3746ac4553dee024351d97226f (patch)
treeaa1148f790629526cb2367dff0c5ce162e4b051d /src/usr/secureboot/trusted/base
parent02db181b01ad44a7c18d929f9541336d050dbae2 (diff)
downloadtalos-hostboot-c4119b881e8a6e3746ac4553dee024351d97226f.tar.gz
talos-hostboot-c4119b881e8a6e3746ac4553dee024351d97226f.zip
Trustedboot add TPM and associated i2c master to the devtree
Change-Id: Ic2edee549d23669f046a6e78f0cfae838faaec2d RTC: 125287 ForwardPort: yes Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25470 Reviewed-by: Marshall J. Wilks <mjwilks@us.ibm.com> Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/secureboot/trusted/base')
-rw-r--r--src/usr/secureboot/trusted/base/tpmLogMgr.C56
-rw-r--r--src/usr/secureboot/trusted/base/tpmLogMgr.H35
2 files changed, 90 insertions, 1 deletions
diff --git a/src/usr/secureboot/trusted/base/tpmLogMgr.C b/src/usr/secureboot/trusted/base/tpmLogMgr.C
index 18e677192..d129bbaa1 100644
--- a/src/usr/secureboot/trusted/base/tpmLogMgr.C
+++ b/src/usr/secureboot/trusted/base/tpmLogMgr.C
@@ -38,6 +38,8 @@
#include <string.h>
#include "tpmLogMgr.H"
#ifdef __HOSTBOOT_MODULE
+#include <sys/mm.h>
+#include <util/align.H>
#include <secureboot/trustedboot_reasoncodes.H>
#include "../trustedbootUtils.H"
#include "../trustedboot.H"
@@ -251,7 +253,6 @@ namespace TRUSTEDBOOT
break;
}
-
val->newEventPtr = TCG_PCR_EVENT2_logMarshal(logEvent,
val->newEventPtr);
@@ -490,6 +491,59 @@ namespace TRUSTEDBOOT
#endif
}
+#ifdef __HOSTBOOT_MODULE
+ errlHndl_t TpmLogMgr_getDevtreeInfo(TpmLogMgr* val,
+ uint64_t & io_logAddr,
+ size_t & o_allocationSize,
+ uint64_t & o_xscomAddr,
+ uint32_t & o_i2cMasterOffset)
+ {
+ errlHndl_t err = NULL;
+
+ mutex_lock( &val->logMutex );
+
+ assert(io_logAddr != 0, "Invalid starting log address");
+ assert(val->eventLogInMem == NULL,
+ "getDevtreeInfo can only be called once");
+
+ io_logAddr -= ALIGN_PAGE(TPMLOG_DEVTREE_SIZE);
+ // Align to 64KB for Opal
+ io_logAddr = ALIGN_DOWN_X(io_logAddr,64*KILOBYTE);
+
+ val->inMemlogBaseAddr = io_logAddr;
+ o_allocationSize = TPMLOG_DEVTREE_SIZE;
+ o_xscomAddr = val->devtreeXscomAddr;
+ o_i2cMasterOffset = val->devtreeI2cMasterOffset;
+
+ // Copy image.
+ val->eventLogInMem = (uint8_t*)(mm_block_map(
+ (void*)(io_logAddr),
+ ALIGN_PAGE(TPMLOG_DEVTREE_SIZE)));
+ // Copy log into new location
+ memset(val->eventLogInMem, 0, TPMLOG_DEVTREE_SIZE);
+ memcpy(val->eventLogInMem, val->eventLog, val->logSize);
+ val->newEventPtr = val->eventLogInMem + val->logSize;
+
+ mutex_unlock( &val->logMutex );
+
+ TRACUCOMP( g_trac_trustedboot,
+ "<<getDevtreeInfo() Addr:%lX - %s",
+ io_logAddr,
+ ((TB_SUCCESS == err) ? "No Error" : "With Error") );
+ return err;
+ }
+
+
+ void TpmLogMgr_setTpmDevtreeInfo(TpmLogMgr* val,
+ uint64_t i_xscomAddr,
+ uint32_t i_i2cMasterOffset)
+ {
+ val->devtreeXscomAddr = i_xscomAddr;
+ val->devtreeI2cMasterOffset = i_i2cMasterOffset;
+ }
+
+#endif
+
#ifdef __cplusplus
} // end TRUSTEDBOOT
#endif
diff --git a/src/usr/secureboot/trusted/base/tpmLogMgr.H b/src/usr/secureboot/trusted/base/tpmLogMgr.H
index b7eed6293..b12f5cb15 100644
--- a/src/usr/secureboot/trusted/base/tpmLogMgr.H
+++ b/src/usr/secureboot/trusted/base/tpmLogMgr.H
@@ -81,6 +81,7 @@ namespace TRUSTEDBOOT
enum {
TPMLOG_BUFFER_SIZE = 1024, ///< Size of event log buffer in bytes
+ TPMLOG_DEVTREE_SIZE = 64*1024, ///< Size to allocate for OPAL
};
struct _TpmLogMgr
@@ -90,6 +91,9 @@ namespace TRUSTEDBOOT
uint8_t* newEventPtr; ///< Pointer to location to add new event
uint8_t* eventLogInMem; ///< Event log allocated from memory
#ifdef __HOSTBOOT_MODULE
+ uint64_t inMemlogBaseAddr; ///< Base address of log for dev tree
+ uint64_t devtreeXscomAddr; ///< Devtree Xscom Address
+ uint32_t devtreeI2cMasterOffset; ///< Devtree I2c Master Offset
uint8_t eventLog[TPMLOG_BUFFER_SIZE]; ///< EventLog Buffer
#endif
mutex_t logMutex; ///< Log mutex
@@ -134,6 +138,37 @@ namespace TRUSTEDBOOT
*/
uint32_t TpmLogMgr_getLogSize(TpmLogMgr* val);
+#ifdef __HOSTBOOT_MODULE
+ /**
+ * @brief Retrieve devtree information
+ * @param[in] val TpmLogMgr structure
+ * @param[in/out] io_logAddr TPM Log address
+ * @param[out] o_allocationSize Total memory allocated for log
+ * @param[out] o_xscomAddr Chip Xscom Address
+ * @param[out] o_i2cMasterOffset I2c Master Offset
+ * @return errlHndl_t NULL if successful, otherwise a pointer to the
+ * error log.
+ * Function will allocate a new region in memory to store log
+ * for passing to opal
+ */
+ errlHndl_t TpmLogMgr_getDevtreeInfo(TpmLogMgr* val,
+ uint64_t & io_logAddr,
+ size_t & o_allocationSize,
+ uint64_t & o_xscomAddr,
+ uint32_t & o_i2cMasterOffset);
+
+ /**
+ * @brief Store TPM devtree node information
+ * @param[in] val TpmLogMgr structure
+ * @param[in] i_xscomAddr Chip Xscom Address
+ * @param[in] i_i2cMasterOffset i2c Master Offset
+ */
+ void TpmLogMgr_setTpmDevtreeInfo(TpmLogMgr* val,
+ uint64_t i_xscomAddr,
+ uint32_t i_i2cMasterOffset);
+#endif
+
+
/**
* @brief Calculate the log size in bytes by walking the log
* @param[in] val TpmLogMgr structure
OpenPOWER on IntegriCloud