summaryrefslogtreecommitdiffstats
path: root/src/include/kernel
diff options
context:
space:
mode:
authorMissy Connell <missyc@us.ibm.com>2013-02-28 13:44:52 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-03-26 14:14:33 -0500
commitb2825953b28bea95f4ae46fd268d4e06dcb87455 (patch)
treea8cca939502696d70fe29e68b5fd556dac9eca55 /src/include/kernel
parentb229ae320d4aa5225984699e3c89562df219bf03 (diff)
downloadblackbird-hostboot-b2825953b28bea95f4ae46fd268d4e06dcb87455.tar.gz
blackbird-hostboot-b2825953b28bea95f4ae46fd268d4e06dcb87455.zip
Update Core Scratch Reg 6 with L3 vs Mainstore for FSP to query
RTC:64829 Change-Id: Ic8e7983f6838b79c359c4cee2647b7676493cb1e Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3564 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/kernel')
-rw-r--r--src/include/kernel/memstate.H95
-rw-r--r--src/include/kernel/misc.H23
2 files changed, 117 insertions, 1 deletions
diff --git a/src/include/kernel/memstate.H b/src/include/kernel/memstate.H
new file mode 100644
index 000000000..35d625f09
--- /dev/null
+++ b/src/include/kernel/memstate.H
@@ -0,0 +1,95 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/kernel/misc.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 */
+/** @file misc.H
+ * @brief Misc. Kernel functions and utilities.
+ */
+
+#ifndef __KERNEL_MEMSTATE_H
+#define __KERNEL_MEMSTATE_H
+
+namespace KernelMemState
+{
+ // hb_Mem_Location struct values are defined below.
+ /* Core Scratch 6 (Scom 0x10013289) will be used to indicate the memory
+ state
+
+ Register Bit Definition:
+ - 0:7 - Indicator of memory mode
+ NOTE: having no bits on in this range indicated the memory is not ready.
+ - - 0b00000000 = Hostboot contained in L3
+ - - 0b00000001 = Hostboot expanded to mainstore
+ - 8:31 - Reserved/Unused
+ - 32:63 - Size of active Hostboot memory in MB
+ - - 0 = Hostboot is not ready yet.
+ - - 4 = Hostboot is using half a cache
+ - - 8 = Hostboot is using the full cache
+ - - 32 = Hostboot is using 32 MB of mainstore*/
+
+
+ enum MemLocation
+ {
+ MEM_CONTAINED_NR = 0x0,
+ MEM_CONTAINED_L3 = 0x80,
+ MEM_CONTAINED_MS = 0x40,
+ };
+
+ enum MemSize
+ {
+ NO_MEM = 0x0,
+ HALF_CACHE = 0x00000004,
+ FULL_CACHE = 0x00000008,
+ MS_32MEG = 0x00000020,
+ PRE_SECURE_BOOT = 0x000000FF,
+ };
+
+ struct mem_location
+ {
+
+ union{
+ struct {
+ uint64_t memMode:8; /**< indicator of memory mode HostBoot
+ contained in l3 or mainstore */
+
+ uint64_t reserved:24; /**< reserved */
+ uint64_t memSize:32; /**< Size of the memory */
+ };
+ uint64_t Scratch6Data; /**< Full double word */
+ };
+ };
+
+ /** @fn set
+ *
+ * @brief Sets the Hostboot memory location and size in the scratch
+ * register 6
+ *
+ * This is used to update the core scratch reg 6 with the current
+ * location of hostboot memory and the size it is.
+ *
+ * @param[in] uint16_t - location of the memory (L3 or Mainstore)
+ * @param[in] uint32_t - size of the memory
+ */
+ void setMemScratchReg(MemLocation i_location,MemSize i_size);
+
+};
+
+#endif
diff --git a/src/include/kernel/misc.H b/src/include/kernel/misc.H
index 5a818078e..11677d250 100644
--- a/src/include/kernel/misc.H
+++ b/src/include/kernel/misc.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
/* */
/* p1 */
/* */
@@ -31,6 +31,8 @@
#include <usr/vmmconst.h>
#include <kernel/deferred.H>
#include <kernel/task.H>
+#include <kernel/memstate.H>
+#include <sys/mmio.h>
namespace KernelMisc
{
@@ -111,5 +113,24 @@ namespace KernelMisc
* (This address is not dcbz'd itself)
*/
void populate_cache_lines(uint64_t* i_start, uint64_t* i_end);
+
+ /** @fn set
+ *
+ * @brief Update value of scratch register to specified data.
+ *
+ * This is used to update any core scratch reg defined by the enum
+ * MMIO_SCRATCH_REG with the data passed in.
+ *
+ * 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
+ *
+ * @param[in] uint64_t - scratch_addr
+ * @param[in] uint64_t - Data
+ */
+ void updateScratchReg(MMIO_Scratch_Register scratch_addr, uint64_t data);
+
+
};
#endif
OpenPOWER on IntegriCloud