diff options
| author | Stephen Cprek <smcprek@us.ibm.com> | 2017-01-27 12:05:45 -0600 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-03-10 13:44:11 -0500 |
| commit | 6f2f153d6b5132a5604ce068be8ac8cf4cb7b14e (patch) | |
| tree | 7d1fb2ddbfdf9b83e235534a6f31600effcc1a32 /src/kernel/kernel.C | |
| parent | 41cfdf72da59cc35815c34698ae201b777ecae7c (diff) | |
| download | blackbird-hostboot-6f2f153d6b5132a5604ce068be8ac8cf4cb7b14e.tar.gz blackbird-hostboot-6f2f153d6b5132a5604ce068be8ac8cf4cb7b14e.zip | |
Relocate ROM code after HBBL has been verified
Create Bootloader to hostboot data manager to control how
the shared data is accessed and modified.
Change-Id: I54cb543ed289810ab6afb07d333313f5662bce0e
RTC: 166848
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35617
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/kernel/kernel.C')
| -rw-r--r-- | src/kernel/kernel.C | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/kernel/kernel.C b/src/kernel/kernel.C index 8ae092458..f470723ce 100644 --- a/src/kernel/kernel.C +++ b/src/kernel/kernel.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2014 */ +/* Contributors Listed Below - COPYRIGHT 2010,2017 */ +/* [+] 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. */ @@ -35,6 +37,9 @@ #include <sys/vfs.h> #include <kernel/deferred.H> #include <kernel/misc.H> +#include <util/align.H> +#include <securerom/sha512.H> +#include <kernel/bltohbdatamgr.H> #include <stdlib.h> @@ -64,6 +69,54 @@ int main() Kernel& kernel = Singleton<Kernel>::instance(); kernel.cppBootstrap(); + + // Get pointer to BL and HB comm data + const auto l_pBltoHbData = reinterpret_cast<const Bootloader::BlToHbData*>( + BLTOHB_COMM_DATA_ADDR); + + if ( Bootloader::BlToHbDataValid(l_pBltoHbData) ) + { + printk("Valid BL to HB communication data\n"); + + // Make copy of structure so to not modify original pointers + auto l_blToHbDataCopy = *l_pBltoHbData; + + // Get destination location that will be preserved by the pagemgr + auto l_pBltoHbDataStart = reinterpret_cast<uint8_t *>( + VmmManager::BLTOHB_DATA_START); + // Copy in SecureRom + memcpy(l_pBltoHbDataStart, + l_blToHbDataCopy.secureRom, + l_blToHbDataCopy.secureRomSize); + // Change pointer to new location and increment + l_blToHbDataCopy.secureRom = l_pBltoHbDataStart; + l_pBltoHbDataStart += l_blToHbDataCopy.secureRomSize; + + // Copy in HW keys' Hash + memcpy(l_pBltoHbDataStart, + l_blToHbDataCopy.hwKeysHash, + l_blToHbDataCopy.hwKeysHashSize); + // Change pointer to new location and increment + l_blToHbDataCopy.hwKeysHash = l_pBltoHbDataStart; + l_pBltoHbDataStart += l_blToHbDataCopy.hwKeysHashSize; + + // Copy in HBB header + memcpy(l_pBltoHbDataStart, + l_blToHbDataCopy.hbbHeader, + l_blToHbDataCopy.hbbHeaderSize); + // Change pointer to new location + l_blToHbDataCopy.hbbHeader = l_pBltoHbDataStart; + + // Initialize Secureboot Data class + g_BlToHbDataManager.initValid(l_blToHbDataCopy); + } + else + { + printk("Invalid BL to HB communication data\n"); + // Force invalidation of securebootdata + g_BlToHbDataManager.initInvalid(); + } + kernel.memBootstrap(); kernel.cpuBootstrap(); |

