diff options
| author | Dan Crowell <dcrowell@us.ibm.com> | 2011-09-12 10:22:02 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2011-09-14 13:28:46 -0500 |
| commit | dbc9dc228c879efbd86df3d655990c21df8d9a8f (patch) | |
| tree | d756babb6c4a876906718a214c969e31c03d1e9a /src/include | |
| parent | b06c8727c809ec10aafe8fad0b929626f9d50987 (diff) | |
| download | blackbird-hostboot-dbc9dc228c879efbd86df3d655990c21df8d9a8f.tar.gz blackbird-hostboot-dbc9dc228c879efbd86df3d655990c21df8d9a8f.zip | |
Centralizing a few of the memory-related constants to avoid some
redundancies and also to have a single place to update the memory
map if needed.
See Task 3507.
Change-Id: I8f2d632983abe6d6798784e975cd93057018594b
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/330
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/kernel/devicesegment.H | 3 | ||||
| -rw-r--r-- | src/include/kernel/ptmgr.H | 3 | ||||
| -rw-r--r-- | src/include/kernel/segmentmgr.H | 3 | ||||
| -rw-r--r-- | src/include/kernel/stacksegment.H | 10 | ||||
| -rw-r--r-- | src/include/kernel/vmmmgr.H | 6 | ||||
| -rw-r--r-- | src/include/limits.h | 7 | ||||
| -rw-r--r-- | src/include/sys/mmio.h | 3 | ||||
| -rw-r--r-- | src/include/usr/vmmconst.h | 70 |
8 files changed, 85 insertions, 20 deletions
diff --git a/src/include/kernel/devicesegment.H b/src/include/kernel/devicesegment.H index e3e2d9723..89180b4eb 100644 --- a/src/include/kernel/devicesegment.H +++ b/src/include/kernel/devicesegment.H @@ -25,6 +25,7 @@ #include <kernel/segment.H> #include <sys/mmio.h> +#include <usr/vmmconst.h> /** * @class DeviceSegment @@ -36,7 +37,7 @@ class DeviceSegment : public Segment /** * @brief Constructor (Device segment at 2TB) */ - DeviceSegment() : Segment(0x020000000000ull) {}; + DeviceSegment() : Segment(VMM_VADDR_DEVICE_SEGMENT) {}; /** * @brief Destructor diff --git a/src/include/kernel/ptmgr.H b/src/include/kernel/ptmgr.H index c7505bc1f..8eca3f213 100644 --- a/src/include/kernel/ptmgr.H +++ b/src/include/kernel/ptmgr.H @@ -231,9 +231,6 @@ class PageTableManager PTE_ACCESS_BITS = 0x800000000000007B, /**< pp0 + WIMG + pp1_2 */ PTEG_SIZE_BYTES = (sizeof(PageTableEntry)*8), /**< Size of PTE Group in bytes */ - SLBE_b = 12, /**< Page Size in bits per SLBE */ - SLBE_s = 40, /**< Segment Size in bits per SLBE */ - }; /** diff --git a/src/include/kernel/segmentmgr.H b/src/include/kernel/segmentmgr.H index 563497047..a8f4e002d 100644 --- a/src/include/kernel/segmentmgr.H +++ b/src/include/kernel/segmentmgr.H @@ -30,6 +30,7 @@ #include <kernel/task.H> #include <builtins.h> #include <kernel/ptmgr.H> +#include <usr/vmmconst.h> // Forward declaration. class Segment; @@ -135,7 +136,7 @@ class SegmentManager ALWAYS_INLINE inline size_t getSegmentIdFromAddress(uint64_t i_addr) const { - return i_addr >> 40; // SLBE_s = 40 Should come from page manager? + return i_addr >> SLBE_s; } /** Array of segment objects to associated segment IDs. */ diff --git a/src/include/kernel/stacksegment.H b/src/include/kernel/stacksegment.H index 8b60ec3c7..ec76c194e 100644 --- a/src/include/kernel/stacksegment.H +++ b/src/include/kernel/stacksegment.H @@ -30,6 +30,7 @@ #include <kernel/types.h> #include <kernel/segment.H> #include <util/locked/list.H> +#include <usr/vmmconst.h> // Forward declaration. class Block; @@ -60,18 +61,11 @@ struct StackBlockNode class StackSegment : public Segment { protected: - enum - { - EIGHT_MEGABYTE = 8 * 1024 * 1024ul, - ONE_TERABYTE = 1024 * 1024 * 1024 * 1024ul, - }; - - /** * @brief Constructor. * Initialize attributes and set base addresss of segment to 1 TB. */ - StackSegment() : Segment(ONE_TERABYTE) {}; + StackSegment() : Segment(VMM_VADDR_STACK_SEGMENT) {}; /** * @brief Destructor diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H index ff8702f53..2d0d0297d 100644 --- a/src/include/kernel/vmmmgr.H +++ b/src/include/kernel/vmmmgr.H @@ -39,11 +39,7 @@ class VmmManager */ enum VMM_CONSTS { - ONE_MEG = 1 * 1024 * 1024, - FOUR_MEG = 4 * ONE_MEG, - EIGHT_MEG = 8 * ONE_MEG, - - FULL_MEM_SIZE = FOUR_MEG, + FULL_MEM_SIZE = 4*MEGABYTE, // put the Page Table at the end of our memory space PTSIZE = (1 << 18), diff --git a/src/include/limits.h b/src/include/limits.h index 6bfbf1751..3a5227d03 100644 --- a/src/include/limits.h +++ b/src/include/limits.h @@ -23,7 +23,12 @@ #ifndef __LIMITS_H #define __LIMITS_H -#define PAGESIZE 4096 +#define KILOBYTE (1024ul) /**< 1 KB */ +#define MEGABYTE (1024 * 1024ul) /**< 1 MB */ +#define GIGABYTE (MEGABYTE * 1024ul) /**< 1 GB */ +#define TERABYTE (GIGABYTE * 1024ul) /**< 1 TB */ + +#define PAGESIZE (4*KILOBYTE) /**< 4 KB */ #define PAGE_SIZE PAGESIZE #endif diff --git a/src/include/sys/mmio.h b/src/include/sys/mmio.h index 148ceda30..59254b976 100644 --- a/src/include/sys/mmio.h +++ b/src/include/sys/mmio.h @@ -25,6 +25,7 @@ #include <stdint.h> #include <sys/sync.h> +#include <limits.h> #ifdef __cplusplus extern "C" @@ -37,7 +38,7 @@ extern "C" */ enum SEG_DATA_SIZES { - THIRTYTWO_GB = 0x800000000, + THIRTYTWO_GB = (32*GIGABYTE), }; /** diff --git a/src/include/usr/vmmconst.h b/src/include/usr/vmmconst.h new file mode 100644 index 000000000..984bef1db --- /dev/null +++ b/src/include/usr/vmmconst.h @@ -0,0 +1,70 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/vmmconst.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 +#ifndef _VMMCONST_H +#define _VMMCONST_H + +/** + * This file contains any hardcoded memory addresses used by the + * Virtual Memory Subsystem + */ + +#include <limits.h> + +/** + * Segments + */ + +/** Stack Segment is at 1 TB */ +#define VMM_VADDR_STACK_SEGMENT (1 * TERABYTE) + +/** Device Segment is at 2 TB */ +#define VMM_VADDR_DEVICE_SEGMENT (2 * TERABYTE) + + +/** + * Resource Providers + */ + +/** Extended Image is at 1GB */ +#define VMM_VADDR_VFS_EXT_MODULE (1 * GIGABYTE) +// Note : vfs.h hardcodes this value due to external compile issues + +/** PNOR Resource Provider is at 2GB */ +#define VMM_VADDR_PNOR_RP (2 * GIGABYTE) + +/** Attribute Resource Provider */ +//TBD + + +/** + * Other Constants + */ + +/** Segment Size in bits per SLBE */ +#define SLBE_s 40 + +/** Page Size in bits per SLBE */ +#define SLBE_b 12 + + +#endif /* _VMMCONST_H */ |

