summaryrefslogtreecommitdiffstats
path: root/src/include/bootloader
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2017-02-01 16:54:10 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-03-08 17:45:41 -0500
commit24754646d5045981326ce26a878c16c6973e2ac8 (patch)
treed6183d001b906b5336741310d208502997fb5a32 /src/include/bootloader
parent51438e2ecc2bf5b70aab0c0a996a43b24cc30aaa (diff)
downloadtalos-hostboot-24754646d5045981326ce26a878c16c6973e2ac8.tar.gz
talos-hostboot-24754646d5045981326ce26a878c16c6973e2ac8.zip
Check if securerom is valid and fill in bl to hb struct
The bootloader to hostboot structure is data that is filled in by the bootloader and used by hostboot code. This is used for things like getting the securerom code, hwkeyshash, and hbb header Change-Id: I04a228b0f1d5a6f6d0b02bf87f3564f6ef95e7a3 RTC: 166848 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35762 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/bootloader')
-rw-r--r--src/include/bootloader/bootloaderif.H78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/include/bootloader/bootloaderif.H b/src/include/bootloader/bootloaderif.H
index beffe7c0f..47b011542 100644
--- a/src/include/bootloader/bootloaderif.H
+++ b/src/include/bootloader/bootloaderif.H
@@ -25,6 +25,10 @@
#ifndef __BOOT_LOADERIF_H
#define __BOOT_LOADERIF_H
+#include <arch/ppc.H>
+#include <securerom/ROM.H>
+
+namespace Bootloader{
// Max size of HBBL without ECC. Must match PNOR layout for eyeCatch HBBL
// Must be aligned CACHELINE_SIZE of 128 bytes
#define MAX_HBBL_SIZE (20 * KILOBYTE)
@@ -32,4 +36,78 @@
// Size of exception vector reserved space at start of the HBBL section
#define HBBL_EXCEPTION_VECTOR_SIZE (12 * KILOBYTE)
+// The Bootloader to Hostboot communication area exists after the working HBB
+#ifdef BOOTLOADER
+#define BLTOHB_COMM_DATA_ADDR (getHRMOR() - ( 2*MEGABYTE) + 512*KILOBYTE)
+#else
+#define BLTOHB_COMM_DATA_ADDR (getHRMOR() + 512*KILOBYTE)
+#endif
+
+// Expected BlToHbData eye catch
+const uint64_t BLTOHB_EYECATCHER = 0x23626C746F686200; // #BLTOHB\0
+
+// Used for version checking as the BlToHbData structure changes
+enum BlToHbDataVersion
+{
+ // [release:4][version:4]
+ BLTOHB_INIT = 0x0000000900000001
+};
+
+
+/** @struct BlToHbData
+ * @brief Shared data between bootloader and Hostboot.
+ *
+ * A shared structure of information that the bootloader has that hostboot
+ * does not. The Bootloader fills in this structure and places in the agreed
+ * on location with hostboot. Hostboot's kernel reads this structure out and
+ * saves it off before the pagemgr clears the cachelines.
+ *
+ */
+struct BlToHbData
+{
+ BlToHbData() : eyeCatch(0), version(BLTOHB_INIT),
+ branchtableOffset(0), secureRom(nullptr),
+ secureRomSize(0), hwKeysHash(nullptr),
+ hwKeysHashSize(0), hbbHeader(nullptr),
+ hbbHeaderSize(0), totalSize(0) {}
+
+ // Simple way to tell if data is valid
+ uint64_t eyeCatch;
+ // Track version in case there are compatibility issues
+ uint64_t version;
+ // Offset to branchtable from start of secureROM
+ uint64_t branchtableOffset;
+ // pointer to start of secureROM code
+ const void* secureRom;
+ // size of entire secureROM
+ size_t secureRomSize;
+ // pointer to the hw keys hash used for verification
+ const void* hwKeysHash;
+ // size of key
+ size_t hwKeysHashSize;
+ // pointer to the saved off Hostboot base header for TPM extension
+ const void* hbbHeader;
+ // size of Hostboot base header
+ size_t hbbHeaderSize;
+ // Total size of data preserved by the Kernel
+ size_t totalSize;
+} __attribute__((packed));
+
+/**
+ * @brief Checks if Bootloader to hostboot data is valid by checking the
+ * eyeCatch and version
+ *
+ * @param[in] BlToHbData* Pointer to BlToHbdata. Must not be NULL
+ *
+ * @return bool true if valid; false otherwise
+ */
+inline bool BlToHbDataValid (const BlToHbData * i_blToHbData)
+{
+ // Ensure Version and EyeCatch are valid
+ return (i_blToHbData->eyeCatch == BLTOHB_EYECATCHER) &&
+ (i_blToHbData->version >= BLTOHB_INIT);
+}
+
+} // end namespace bootloader
+
#endif \ No newline at end of file
OpenPOWER on IntegriCloud