From 84b685af5f1e1cf49c2c2f22ae80a8a0df8472f8 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Wed, 31 Mar 2010 14:57:55 +0000 Subject: Consolidate ifdefs in src/lib/cbmem.c for readability. Signed-off-by: Myles Watson Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5343 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/lib/cbmem.c | 21 ++++++--------------- 1 file 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; -- cgit v1.2.3