summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2017-06-22 16:50:25 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-07-20 15:54:41 -0400
commit22d6e4636c815eecdcf778c417ef217e32878fba (patch)
tree0e709eee941452f3d5b1b7b43b6257587d97d90d /src/kernel
parent6744879ceba92b2b2a060cff929bfaaf5d26d762 (diff)
downloadtalos-hostboot-22d6e4636c815eecdcf778c417ef217e32878fba.tar.gz
talos-hostboot-22d6e4636c815eecdcf778c417ef217e32878fba.zip
Handle Compatability issues for new BltoHbData location
Change-Id: I9ec35ca8dd513a5e31f69cd899fa5d1e00d41c63 RTC: 175114 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/42442 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@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> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/kernel.C46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/kernel/kernel.C b/src/kernel/kernel.C
index d5952374a..970813ec8 100644
--- a/src/kernel/kernel.C
+++ b/src/kernel/kernel.C
@@ -61,6 +61,43 @@ class Kernel
Kernel() {};
};
+
+/**
+ * @brief Searches multiple locations for the BlToHbData structure.
+ *
+ * @description Due to the possibility of a mismatch between the bootloader and
+ * hostboot, we must check every location of this structure in
+ * history. Searches latest to oldest.
+ *
+ * @return if found, pointer to structure
+ * otherwise nullptr
+ */
+const Bootloader::BlToHbData* getBlToHbData()
+{
+ const Bootloader::BlToHbData* l_resultBltoHbData = nullptr;
+
+ // Order bootloader addr versions from most recent to oldest
+ // Note: Defined here to limit code space in bootloader code
+ static const std::array<uint64_t,2> BlToHbDataAddrs =
+ {
+ BLTOHB_COMM_DATA_ADDR_LATEST,
+ BLTOHB_COMM_DATA_ADDR_V1
+ };
+
+ for (auto addr : BlToHbDataAddrs)
+ {
+ const auto l_bltoHbData =
+ reinterpret_cast<const Bootloader::BlToHbData*>(addr);
+ if(Bootloader::BlToHbDataValid(l_bltoHbData))
+ {
+ l_resultBltoHbData = l_bltoHbData;
+ break;
+ }
+ }
+
+ return l_resultBltoHbData;
+}
+
extern "C"
int main()
{
@@ -75,13 +112,12 @@ 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) )
+ // Get pointer to BL and HB comm data
+ const auto l_pBltoHbData = getBlToHbData();
+ if ( l_pBltoHbData != nullptr )
{
- printk("BL to HB comm valid\n");
+ printk("Valid BlToHbData found at 0x%lX\n", reinterpret_cast<uint64_t>(l_pBltoHbData));
// Initialize Secureboot Data class
g_BlToHbDataManager.initValid(*l_pBltoHbData);
}
OpenPOWER on IntegriCloud