summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/runtime/interface.h30
-rw-r--r--src/runtime/rt_main.C13
-rw-r--r--src/runtime/rt_start.S10
-rw-r--r--src/runtime/rt_vfs.C8
-rw-r--r--src/usr/testcore/rtloader/loader.H15
-rw-r--r--src/usr/vpd/runtime/rt_vpd.C4
6 files changed, 63 insertions, 17 deletions
diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h
index dfe6a93d6..0674ce697 100644
--- a/src/include/runtime/interface.h
+++ b/src/include/runtime/interface.h
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -33,6 +33,9 @@
*
* @note This file must be in C rather than C++.
*/
+/** Current interface version. */
+#define HOSTBOOT_RUNTIME_INTERFACE_VERSION 1
+#ifndef __HOSTBOOT_RUNTIME_INTERFACE_VERSION_ONLY
#include <stdint.h>
@@ -44,6 +47,9 @@
*/
typedef struct hostInterfaces
{
+ /** Interface version. */
+ uint64_t interfaceVersion;
+
/** Put a string to the console. */
void (*puts)(const char*);
/** Critical failure in runtime execution. */
@@ -105,21 +111,32 @@ typedef struct hostInterfaces
*/
int (*lid_unload)(void*);
- /** Get address of VPD image
- * @return physical address of VPD image
- */
- uint64_t (*get_vpd_image_addr)();
+ /** Get the address of a reserved memory region by its devtree name.
+ *
+ * @param[in] Devtree name (ex. "ibm,hbrt-vpd-image")
+ * @return physical address of region (or NULL).
+ **/
+ uint64_t (*get_reserved_mem)(const char*);
+
+ // Reserve some space for future growth.
+ void (*reserved[32])(void);
} hostInterfaces_t;
typedef struct runtimeInterfaces
{
+ /** Interface version. */
+ uint64_t interfaceVersion;
+
/** Execute CxxTests that may be contained in the image.
*
* @param[in] - Pointer to CxxTestStats structure for results reporting.
*/
void (*cxxtestExecute)(void*);
+ // Reserve some space for future growth.
+ void (*reserved[32])(void);
+
} runtimeInterfaces_t;
#ifdef __HOSTBOOT_RUNTIME
@@ -127,4 +144,5 @@ extern hostInterfaces_t* g_hostInterfaces;
runtimeInterfaces_t* getRuntimeInterfaces();
#endif
-#endif
+#endif //__HOSTBOOT_RUNTIME_INTERFACE_VERSION_ONLY
+#endif //__RUNTIME__INTERFACE_H
diff --git a/src/runtime/rt_main.C b/src/runtime/rt_main.C
index 910a0d1d8..038a58e9f 100644
--- a/src/runtime/rt_main.C
+++ b/src/runtime/rt_main.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -78,7 +78,10 @@ runtimeInterfaces_t* _main(hostInterfaces_t* intf, uint64_t base)
i < ALIGN_PAGE_DOWN((uint64_t)&data_load_address);
i += PAGESIZE)
{
- (intf->set_page_execute)(reinterpret_cast<void*>(i));
+ if (NULL != intf->set_page_execute)
+ {
+ (intf->set_page_execute)(reinterpret_cast<void*>(i));
+ }
}
// Tail-recurse to real entry point.
@@ -95,11 +98,15 @@ runtimeInterfaces_t* rt_start(hostInterfaces_t* intf)
// Call C++ constructors.
rt_cppBootstrap();
+ // Initialize runtime interfaces.
+ runtimeInterfaces_t* rtInterfaces = getRuntimeInterfaces();
+ rtInterfaces->interfaceVersion = HOSTBOOT_RUNTIME_INTERFACE_VERSION;
+
// Initialize all modules.
vfs_module_init();
// Return our interface pointer structure.
- return getRuntimeInterfaces();
+ return rtInterfaces;
}
void rt_cppBootstrap()
diff --git a/src/runtime/rt_start.S b/src/runtime/rt_start.S
index cea710b57..a8356fc27 100644
--- a/src/runtime/rt_start.S
+++ b/src/runtime/rt_start.S
@@ -5,7 +5,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2013
+# COPYRIGHT International Business Machines Corp. 2013,2014
#
# p1
#
@@ -22,8 +22,16 @@
# IBM_PROLOG_END_TAG
.include "kernel/ppcconsts.S"
+#define __HOSTBOOT_RUNTIME_INTERFACE_VERSION_ONLY 1
+#include <runtime/interface.h>
+
.section .text.intvects
+.org 0x0;
+hbrt_desired_interface_version:
+ .quad 0x4842525456455253 # 'HBRTVERS' eyecatch.
+ .quad HOSTBOOT_RUNTIME_INTERFACE_VERSION
+
.org 0x100;
_init:
mflr r10 # Save LR
diff --git a/src/runtime/rt_vfs.C b/src/runtime/rt_vfs.C
index 73f381313..5477c8ac6 100644
--- a/src/runtime/rt_vfs.C
+++ b/src/runtime/rt_vfs.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -44,7 +44,11 @@ void vfs_module_init()
i < (uint64_t)module->data;
i += PAGESIZE)
{
- g_hostInterfaces->set_page_execute(reinterpret_cast<void*>(i));
+ if (g_hostInterfaces->set_page_execute)
+ {
+ g_hostInterfaces->set_page_execute(
+ reinterpret_cast<void*>(i));
+ }
}
}
diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H
index 03e8e5f39..c2935d769 100644
--- a/src/usr/testcore/rtloader/loader.H
+++ b/src/usr/testcore/rtloader/loader.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -101,6 +101,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
do
{
hostInterfaces_t* intf = new hostInterfaces_t();
+ intf->interfaceVersion = HOSTBOOT_RUNTIME_INTERFACE_VERSION;
intf->puts = rt_puts;
intf->set_page_execute = rt_setPageExecute;
intf->malloc = malloc;
@@ -113,7 +114,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
intf->scom_write = rt_scom_write;
intf->lid_load = rt_lid_load;
intf->lid_unload = rt_lid_unload;
- intf->get_vpd_image_addr = rt_get_vpd;
+ intf->get_reserved_mem = rt_get_reserved_mem;
// Call init.
runtimeInterfaces_t* rtInterface =
@@ -298,6 +299,14 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
return 0;
}
+ //--------------------------------------------------------------------
+ static uint64_t rt_get_reserved_mem(const char* i_region)
+ {
+ if (0 == strcmp(i_region, "ibm,hbrt-vpd-image"))
+ return rt_get_vpd();
+ else
+ return 0;
+ }
//--------------------------------------------------------------------
static uint64_t rt_get_vpd()
@@ -324,7 +333,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
assert(vptr != NULL,"rt_get_vpd. Could not map VPD memory");
- // Store the address in a class variable so we only
+ // Store the address in a class variable so we only
// need to load vpd once.
cv_vpd_addr = reinterpret_cast<uint64_t>(vptr);
}
diff --git a/src/usr/vpd/runtime/rt_vpd.C b/src/usr/vpd/runtime/rt_vpd.C
index da9f97ff9..6c8e9781a 100644
--- a/src/usr/vpd/runtime/rt_vpd.C
+++ b/src/usr/vpd/runtime/rt_vpd.C
@@ -80,9 +80,9 @@ errlHndl_t getPnorAddr( pnorInformation & i_pnorInfo,
if(
g_hostInterfaces != NULL &&
- g_hostInterfaces->get_vpd_image_addr)
+ g_hostInterfaces->get_reserved_mem)
{
- vpd_addr = g_hostInterfaces->get_vpd_image_addr();
+ vpd_addr = g_hostInterfaces->get_reserved_mem("ibm,hbrt-vpd-image");
if(vpd_addr == 0)
{
TRACFCOMP(g_trac_vpd,ERR_MRK"rt_vpd: Failed to get VPD addr. "
OpenPOWER on IntegriCloud