summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyles Watson <mylesgw@gmail.com>2010-03-31 14:57:55 +0000
committerMyles Watson <mylesgw@gmail.com>2010-03-31 14:57:55 +0000
commit84b685af5f1e1cf49c2c2f22ae80a8a0df8472f8 (patch)
treeaef907c1e39366bc5b16c1d11e885218c776cda2
parent64ed2b73451de4b655b3fdda0ff42825a165c317 (diff)
downloadcoreboot-84b685af5f1e1cf49c2c2f22ae80a8a0df8472f8.tar.xz
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
-rw-r--r--src/lib/cbmem.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c
index c57018231a..9e8aff3e67 100644
--- a/src/lib/cbmem.c
+++ b/src/lib/cbmem.c
@@ -44,6 +44,9 @@ struct cbmem_entry {
#ifndef __PRE_RAM__
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
/**
@@ -99,11 +102,7 @@ void *cbmem_add(u32 id, u64 size)
{
struct cbmem_entry *cbmem_toc;
int i;
-#ifdef __PRE_RAM__
- cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
-#else
- cbmem_toc = bss_cbmem_toc;
-#endif
+ cbmem_toc = get_cbmem_toc();
if (cbmem_toc == NULL) {
return NULL;
@@ -155,11 +154,7 @@ void *cbmem_find(u32 id)
{
struct cbmem_entry *cbmem_toc;
int i;
-#ifdef __PRE_RAM__
- cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
-#else
- cbmem_toc = bss_cbmem_toc;
-#endif
+ cbmem_toc = get_cbmem_toc();
if (cbmem_toc == NULL)
return NULL;
@@ -201,11 +196,7 @@ void cbmem_list(void)
{
struct cbmem_entry *cbmem_toc;
int i;
-#ifdef __PRE_RAM__
- cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
-#else
- cbmem_toc = bss_cbmem_toc;
-#endif
+ cbmem_toc = get_cbmem_toc();
if (cbmem_toc == NULL)
return;