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/kernel | |
parent | b06c8727c809ec10aafe8fad0b929626f9d50987 (diff) | |
download | talos-hostboot-dbc9dc228c879efbd86df3d655990c21df8d9a8f.tar.gz talos-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/kernel')
-rw-r--r-- | src/kernel/basesegment.C | 5 | ||||
-rw-r--r-- | src/kernel/devicesegment.C | 2 | ||||
-rw-r--r-- | src/kernel/heapmgr.C | 2 | ||||
-rw-r--r-- | src/kernel/segmentmgr.C | 3 | ||||
-rw-r--r-- | src/kernel/stacksegment.C | 11 |
5 files changed, 9 insertions, 14 deletions
diff --git a/src/kernel/basesegment.C b/src/kernel/basesegment.C index 2c5b73c19..fc053f856 100644 --- a/src/kernel/basesegment.C +++ b/src/kernel/basesegment.C @@ -31,7 +31,6 @@ #include <kernel/vmmmgr.H> #include <kernel/cpuid.H> -#define SLBE_s 40 BaseSegment::~BaseSegment() { @@ -54,12 +53,12 @@ void BaseSegment::_init() case CORE_POWER7: case CORE_POWER7_PLUS: case CORE_POWER8_VENICE: - iv_physMemSize = VmmManager::EIGHT_MEG; + iv_physMemSize = (8*MEGABYTE); break; case CORE_POWER8_SALERNO: default: - iv_physMemSize = VmmManager::FOUR_MEG; + iv_physMemSize = (4*MEGABYTE); break; } // Base block is L3 cache physical memory size diff --git a/src/kernel/devicesegment.C b/src/kernel/devicesegment.C index f158ab3ec..4af3a75bb 100644 --- a/src/kernel/devicesegment.C +++ b/src/kernel/devicesegment.C @@ -28,8 +28,6 @@ #include <kernel/devicesegment.H> #include <kernel/segmentmgr.H> -#define SLBE_s 40 - #include <kernel/console.H> /** diff --git a/src/kernel/heapmgr.C b/src/kernel/heapmgr.C index 5eddccc3d..7d3757b9f 100644 --- a/src/kernel/heapmgr.C +++ b/src/kernel/heapmgr.C @@ -102,7 +102,7 @@ void HeapManager::newPage() { void* page = PageManager::allocatePage(); chunk_t * c = (chunk_t*)page; - for (int i = 0; i < (PAGESIZE / (1 << (BUCKETS + 3))); i++) + for (uint64_t i = 0; i < (PAGESIZE / (1 << (BUCKETS + 3))); i++) { c->len = BUCKETS-1; push_bucket(c, BUCKETS-1); diff --git a/src/kernel/segmentmgr.C b/src/kernel/segmentmgr.C index c52b4de04..890bd1812 100644 --- a/src/kernel/segmentmgr.C +++ b/src/kernel/segmentmgr.C @@ -121,9 +121,6 @@ uint64_t SegmentManager::_findPhysicalAddress(uint64_t i_vaddr) const void SegmentManager::_updateRefCount( uint64_t i_vaddr, PageTableManager::UsageStats_t i_stats ) { - // This constant should come from page manager. Segment size. - const size_t SLBE_s = 40; - // Get segment ID from effective address. size_t segId = i_vaddr >> SLBE_s; diff --git a/src/kernel/stacksegment.C b/src/kernel/stacksegment.C index 91b16e6a9..592d4dec7 100644 --- a/src/kernel/stacksegment.C +++ b/src/kernel/stacksegment.C @@ -28,6 +28,7 @@ #include <kernel/segmentmgr.H> #include <kernel/block.H> #include <errno.h> +#include <usr/vmmconst.h> void StackSegment::init() { @@ -62,7 +63,7 @@ StackSegment::~StackSegment() bool StackSegment::handlePageFault(task_t* i_task, uint64_t i_addr) { - uint64_t l_addr_8mb = i_addr & ~((EIGHT_MEGABYTE) - 1); + uint64_t l_addr_8mb = i_addr & ~((8*MEGABYTE) - 1); StackBlockNode* l_node = iv_blockList.find(l_addr_8mb); @@ -73,7 +74,7 @@ bool StackSegment::handlePageFault(task_t* i_task, uint64_t i_addr) uint64_t StackSegment::findPhysicalAddress(uint64_t i_vaddr) const { - uint64_t l_addr_8mb = i_vaddr & ~((EIGHT_MEGABYTE) - 1); + uint64_t l_addr_8mb = i_vaddr & ~((8*MEGABYTE) - 1); StackBlockNode* l_node = iv_blockList.find(l_addr_8mb); @@ -91,7 +92,7 @@ void StackSegment::_init() void* StackSegment::_createStack(tid_t i_task) { /* The segment is broken out into 8MB blocks so we need to place the - * stack somewhere within an 8MB range. The constrants are ensuring + * stack somewhere within an 8MB range. The constraints are ensuring * we have adequate protection and that the hashed page table does not * have a large number of collisions. If we were to place all of the * stacks at (8MB - 64k) there would be a large amount of contention on @@ -117,7 +118,7 @@ void* StackSegment::_createStack(tid_t i_task) * space). */ - uint64_t l_addr_8mb = i_task * EIGHT_MEGABYTE + ONE_TERABYTE; + uint64_t l_addr_8mb = i_task * (8*MEGABYTE) + VMM_VADDR_STACK_SEGMENT; // Ensure block doesn't already exist. kassert(NULL == iv_blockList.find(l_addr_8mb)); @@ -149,7 +150,7 @@ void* StackSegment::_createStack(tid_t i_task) void StackSegment::_deleteStack(tid_t i_task) { - uint64_t l_addr_8mb = i_task * EIGHT_MEGABYTE + ONE_TERABYTE; + uint64_t l_addr_8mb = i_task * (8*MEGABYTE) + VMM_VADDR_STACK_SEGMENT; StackBlockNode* l_node = iv_blockList.find(l_addr_8mb); kassert(NULL != l_node); |