summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2013-03-26 11:23:47 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-06-14 09:09:09 -0500
commite89e72d2f8a2efe86acad95ed0769aa7a8fe64ae (patch)
tree5541b72a698f58757ab2fe36b1a264fff6bcb3a2 /src/include
parent92255af10842c672550a586d342c67ac1c7e11ca (diff)
downloadblackbird-hostboot-e89e72d2f8a2efe86acad95ed0769aa7a8fe64ae.tar.gz
blackbird-hostboot-e89e72d2f8a2efe86acad95ed0769aa7a8fe64ae.zip
Secureboot memory layout support.
* Start kernel in 1/4 cache mode per Secureboot. * Copy Secureboot header for base image for later use. * Blind-purge bottom half of cache. * Add bottom of cache into memory maps for 1/2 cache mode. RTC: 64762 Change-Id: I1b45f30a2d45c9709d4fd486cfe0ca2ce86b051c Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3773 Reviewed-by: Michael Baiocchi <baiocchi@us.ibm.com> Tested-by: Jenkins Server Reviewed-by: ADAM R. MUHLE <armuhle@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/kernel/misc.H11
-rw-r--r--src/include/kernel/pagemgr.H6
-rw-r--r--src/include/kernel/vmmmgr.H22
-rw-r--r--src/include/sys/mm.h1
-rw-r--r--src/include/usr/hbotcompid.H8
-rw-r--r--src/include/usr/secureboot/secure_reasoncodes.H43
-rw-r--r--src/include/usr/secureboot/service.H41
-rw-r--r--src/include/util/align.H51
8 files changed, 148 insertions, 35 deletions
diff --git a/src/include/kernel/misc.H b/src/include/kernel/misc.H
index f0fe0ffd0..544df7c88 100644
--- a/src/include/kernel/misc.H
+++ b/src/include/kernel/misc.H
@@ -121,6 +121,15 @@ namespace KernelMisc
};
+ /** @fn expand_half_cache
+ *
+ * @brief Expands the image footprint from a quarter-cache (top 512k of
+ * each cache column) to a half-cache (full 1mb of each column).
+ *
+ * @return 0 or -errno
+ */
+ int expand_half_cache();
+
/** @fn expand_full_cache
*
* @brief Expands the image footprint from a half-cache to full-cache
@@ -155,7 +164,7 @@ namespace KernelMisc
* NOTE: This function is a wrapper function for writeScratchReg that
* takes care of modifying the scratch register address value depending
* on the getCPUType. The writeScratchReg takes the scratch address
- * passed in and puts that date in that register using assembly code
+ * passed in and puts that data in that register using assembly code
*
* @param[in] uint64_t - scratch_addr
* @param[in] uint64_t - Data
diff --git a/src/include/kernel/pagemgr.H b/src/include/kernel/pagemgr.H
index 65da0de66..b05e0b237 100644
--- a/src/include/kernel/pagemgr.H
+++ b/src/include/kernel/pagemgr.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2010,2012 */
+/* COPYRIGHT International Business Machines Corp. 2010,2013 */
/* */
/* p1 */
/* */
@@ -176,8 +176,7 @@ class PageManager
enum
{
- MEMLEN = VmmManager::FIRST_RESERVED_PAGE,
- RESERVED_PAGES = 4,
+ KERNEL_HEAP_RESERVED_PAGES = 4,
LOWMEM_NORM_LIMIT = 16,
LOWMEM_CRIT_LIMIT = 5,
@@ -192,6 +191,7 @@ class PageManager
~PageManager() {};
private:
+ void _initialize();
void* _allocatePage(size_t,bool); //!< see allocatePage()
void _freePage(void*, size_t); //!< see freePage()
diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H
index b740d03e1..dae3c387d 100644
--- a/src/include/kernel/vmmmgr.H
+++ b/src/include/kernel/vmmmgr.H
@@ -42,18 +42,22 @@ class VmmManager
{
INITIAL_MEM_SIZE = 4*MEGABYTE,
- // put the Page Table at the end of our memory space
- PTSIZE = (1 << 18),
- HTABORG_OFFSET = (INITIAL_MEM_SIZE - PTSIZE),
+ // Place the page table at the top side of the cache, 256k in size.
+ INITIAL_PT_OFFSET = INITIAL_MEM_SIZE - 1*MEGABYTE,
+ PTSIZE = 256*KILOBYTE,
+ HTABORG_OFFSET = INITIAL_PT_OFFSET,
- // Put the DMA Pages just under the Page Table
+ // Put the DMA Pages just after the Page Table
MBOX_DMA_PAGES = 64, // must be <= 64
MBOX_DMA_PAGESIZE = (1 * KILOBYTE),
- MBOX_DMA_ADDR = (HTABORG_OFFSET
- - (MBOX_DMA_PAGES * MBOX_DMA_PAGESIZE)),
-
- /** The base image and heap must be below this address. */
- FIRST_RESERVED_PAGE = MBOX_DMA_ADDR,
+ MBOX_DMA_ADDR = INITIAL_PT_OFFSET + PTSIZE,
+ MBOX_DMA_SIZE = MBOX_DMA_PAGES * MBOX_DMA_PAGESIZE,
+
+ /** We need to reserve a hole in heap memory for the page table,
+ * etc. Use these constants to define the hole. */
+ FIRST_RESERVED_PAGE = INITIAL_PT_OFFSET,
+ END_RESERVED_PAGE = INITIAL_PT_OFFSET +
+ PTSIZE + MBOX_DMA_SIZE,
// Tells processor to ignore HRMOR
FORCE_PHYS_ADDR = 0x8000000000000000,
diff --git a/src/include/sys/mm.h b/src/include/sys/mm.h
index 959c2fa57..38272c684 100644
--- a/src/include/sys/mm.h
+++ b/src/include/sys/mm.h
@@ -99,6 +99,7 @@ int mm_set_permission(void* va, uint64_t size, uint64_t access_type);
enum MM_EXTEND_SIZE
{
+ MM_EXTEND_POST_SECUREBOOT, //< Extend memory to include bottom of cache.
MM_EXTEND_FULL_CACHE, //< Extend memory to include full cache (8mb).
MM_EXTEND_REAL_MEMORY, //< Extend memory into real mainstore.
};
diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H
index ce725012d..382cbd685 100644
--- a/src/include/usr/hbotcompid.H
+++ b/src/include/usr/hbotcompid.H
@@ -275,6 +275,14 @@ const compId_t VPD_COMP_ID = 0x1D00;
const char VPD_COMP_NAME[] = "vpd";
//@}
+/** @name SECURE
+ * Secureboot Support component
+ */
+//@{
+const compId_t SECURE_COMP_ID = 0x1E00;
+const char SECURE_COMP_NAME[] = "secure";
+//@}
+
/** @name HSVC
* Host Services component
diff --git a/src/include/usr/secureboot/secure_reasoncodes.H b/src/include/usr/secureboot/secure_reasoncodes.H
new file mode 100644
index 000000000..eac9dfda9
--- /dev/null
+++ b/src/include/usr/secureboot/secure_reasoncodes.H
@@ -0,0 +1,43 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/secureboot/secure_reasoncodes.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2013 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __SECUREBOOT_REASONCODES_H
+#define __SECUREBOOT_REASONCODES_H
+
+#include <hbotcompid.H>
+
+namespace SECUREBOOT
+{
+ enum SECUREModuleId
+ {
+ MOD_SECURE_INVALID = 0x00,
+ MOD_SECURE_BLINDPURGE = 0x01,
+ };
+
+ enum SECUREReasonCode
+ {
+ RC_PURGEOP_PENDING = SECURE_COMP_ID | 0x01,
+ RC_PURGEOP_FAIL_COMPLETE = SECURE_COMP_ID | 0x02,
+ };
+}
+
+#endif
diff --git a/src/include/usr/secureboot/service.H b/src/include/usr/secureboot/service.H
new file mode 100644
index 000000000..a83d5d510
--- /dev/null
+++ b/src/include/usr/secureboot/service.H
@@ -0,0 +1,41 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/secureboot/service.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2013 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __SECUREBOOT_SERVICE_H
+#define __SECUREBOOT_SERVICE_H
+
+namespace SECUREBOOT
+{
+ /** @brief Perform initialization of Secureboot for the Base image.
+ *
+ * - Copy secure header from original location.
+ * - Perform blind-purge of bottom-half of cache.
+ * - Add bottom-half of cache to available memory.
+ */
+ void* initializeBase(void* unused);
+
+ /** @brief Determines if Secureboot is enabled.
+ */
+ bool enabled();
+}
+
+#endif
diff --git a/src/include/util/align.H b/src/include/util/align.H
index 8ba0e06b9..f951b7ce9 100644
--- a/src/include/util/align.H
+++ b/src/include/util/align.H
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/util/align.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/util/align.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __UTIL_ALIGN_H
#define __UTIL_ALIGN_H
@@ -43,4 +43,11 @@
// Return a number <= input that is aligned on a page boundary
#define ALIGN_PAGE_DOWN(u) ((u) - (u)%PAGESIZE)
+// Return a number >= input that is aligned up to the next MB boundary
+#define ALIGN_MEGABYTE(u) (((u) + (MEGABYTE-1)) & ~(MEGABYTE-1))
+
+// Return a number <= input that is aligned on a MB boundary
+#define ALIGN_MEGABYTE_DOWN(u) ((u) - (u)%MEGABYTE)
+
+
#endif
OpenPOWER on IntegriCloud