Consolidate ifdefs in src/lib/cbmem.c for readability.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Stefan Reinauer <stepan@coresystems.de>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5343 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Myles Watson 2010-03-31 14:57:55 +00:00
parent 64ed2b7345
commit 84b685af5f
1 changed files with 6 additions and 15 deletions

View File

@ -44,6 +44,9 @@ struct cbmem_entry {
#ifndef __PRE_RAM__ #ifndef __PRE_RAM__
struct cbmem_entry *bss_cbmem_toc; struct cbmem_entry *bss_cbmem_toc;
#define get_cbmem_toc() bss_cbmem_toc
#else
#define get_cbmem_toc() (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE)
#endif #endif
/** /**
@ -99,11 +102,7 @@ void *cbmem_add(u32 id, u64 size)
{ {
struct cbmem_entry *cbmem_toc; struct cbmem_entry *cbmem_toc;
int i; int i;
#ifdef __PRE_RAM__ cbmem_toc = get_cbmem_toc();
cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
#else
cbmem_toc = bss_cbmem_toc;
#endif
if (cbmem_toc == NULL) { if (cbmem_toc == NULL) {
return NULL; return NULL;
@ -155,11 +154,7 @@ void *cbmem_find(u32 id)
{ {
struct cbmem_entry *cbmem_toc; struct cbmem_entry *cbmem_toc;
int i; int i;
#ifdef __PRE_RAM__ cbmem_toc = get_cbmem_toc();
cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
#else
cbmem_toc = bss_cbmem_toc;
#endif
if (cbmem_toc == NULL) if (cbmem_toc == NULL)
return NULL; return NULL;
@ -201,11 +196,7 @@ void cbmem_list(void)
{ {
struct cbmem_entry *cbmem_toc; struct cbmem_entry *cbmem_toc;
int i; int i;
#ifdef __PRE_RAM__ cbmem_toc = get_cbmem_toc();
cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
#else
cbmem_toc = bss_cbmem_toc;
#endif
if (cbmem_toc == NULL) if (cbmem_toc == NULL)
return; return;