Compile cbmem.c instead of including it in romstage,
authorRudolf Marek <r.marek@assembler.cz>
Mon, 13 Dec 2010 20:02:23 +0000 (20:02 +0000)
committerRudolf Marek <r.marek@assembler.cz>
Mon, 13 Dec 2010 20:02:23 +0000 (20:02 +0000)
and do that only if resume is done.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Acked-by: Patrick Georgi <patrick@georgi-clan.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6174 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/include/cbmem.h
src/lib/Makefile.inc
src/lib/cbmem.c
src/mainboard/asus/m2v-mx_se/romstage.c
src/mainboard/asus/m2v/romstage.c
src/mainboard/getac/p470/romstage.c
src/mainboard/ibase/mb899/romstage.c
src/mainboard/intel/d945gclf/romstage.c
src/mainboard/kontron/986lcd-m/romstage.c
src/mainboard/roda/rk886ex/romstage.c

index 5fd2e78aff7cb00015ee8b1bffc4bdb8bb280e91..d9ec93c60cbbb2a6faad870f3cbd74479da0c0a6 100644 (file)
@@ -49,8 +49,9 @@ void *cbmem_find(u32 id);
 void cbmem_list(void);
 void cbmem_arch_init(void);
 
+extern struct cbmem_entry *get_cbmem_toc(void);
+
 #ifndef __PRE_RAM__
-struct cbmem_entry *get_cbmem_toc(void);
 void set_cbmem_toc(struct cbmem_entry *);
 #endif
 #endif
index ed52ea940cfe867fe6889160e729b9ff6d8634d3..d5e76ade1d0160fa58c699450bd95301782d463b 100644 (file)
@@ -15,6 +15,7 @@ ramstage-y += lzma.c
 ramstage-y += gcc.c
 ramstage-y += cbmem.c
 
+romstage-$(CONFIG_HAVE_ACPI_RESUME) += cbmem.c
 romstage-y += uart8250.c
 romstage-y += memset.c
 romstage-y += memcpy.c
index c758240d648d307ea401d64e4cc266f449d975b0..5417ab8c49f4f893674e0b5c5d75f624dfdb4a04 100644 (file)
@@ -48,6 +48,13 @@ void __attribute__((weak)) set_cbmem_toc(struct cbmem_entry * x)
 {
        /* do nothing, this should be called by chipset to save TOC in NVRAM */
 }
+#else
+
+struct cbmem_entry *__attribute__((weak)) get_cbmem_toc(void)
+{
+       printk(BIOS_WARNING, "WARNING: you need to define get_cbmem_toc() for your chipset\n");
+       return NULL;
+}
 
 #endif
 
index 4a147229e738908b1bf620f75c5f4b40a021ffba..476f8860f49a3191c99f7e8d1c920274feb11c2b 100644 (file)
@@ -74,15 +74,6 @@ static inline int spd_read_byte(unsigned device, unsigned address)
 
 #define SB_VFSMAF 0
 
-
-// Now, this needs to be included because it relies on the symbol
-// __PRE_RAM__ being set during CAR stage (in order to compile the
-// BSS free versions of the functions). Either rewrite the code
-// to be always BSS free, or invent a flag that's better suited than
-// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
-//
-#include "lib/cbmem.c"
-
 /* this function might fail on some K8 CPUs with errata #181 */
 static void ldtstop_sb(void)
 {
index 3945f34f1f0e26c6a08e5a93581ac218af8c3040..7c224632e146e6c19ab000eac2b7d8a9b3831a51 100644 (file)
@@ -73,15 +73,6 @@ static inline int spd_read_byte(unsigned device, unsigned address)
 #include "cpu/amd/dualcore/dualcore.c"
 #include "cpu/amd/car/post_cache_as_ram.c"
 #include "cpu/amd/model_fxx/init_cpus.c"
-
-// Now, this needs to be included because it relies on the symbol
-// __PRE_RAM__ being set during CAR stage (in order to compile the
-// BSS free versions of the functions). Either rewrite the code
-// to be always BSS free, or invent a flag that's better suited than
-// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
-//
-#include "lib/cbmem.c"
-
 #include "cpu/amd/model_fxx/fidvid.c"
 #include "northbridge/amd/amdk8/resourcemap.c"
 
index affc36a542ccf07b1c234c2a0d1f4590004702c3..ac71a6b25676bd9961b9eee8868f190d43a9bf9f 100644 (file)
@@ -262,14 +262,6 @@ static void early_ich7_init(void)
 
 #include <cbmem.h>
 
-// Now, this needs to be included because it relies on the symbol
-// __PRE_RAM_ being set during CAR stage (in order to compile the 
-// BSS free versions of the functions). Either rewrite the code
-// to be always BSS free, or invent a flag that's better suited than
-// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
-//
-#include "lib/cbmem.c"
-
 void main(unsigned long bist)
 {
        u32 reg32;
index 15a735e9fa753f1a74cb53fba91c408982590cec..d3a029961acf7b4d25670c11215f6936239b958d 100644 (file)
@@ -225,14 +225,6 @@ static void early_ich7_init(void)
 
 #include <cbmem.h>
 
-// Now, this needs to be included because it relies on the symbol
-// __PRE_RAM__ being set during CAR stage (in order to compile the
-// BSS free versions of the functions). Either rewrite the code
-// to be always BSS free, or invent a flag that's better suited than
-// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
-//
-#include "lib/cbmem.c"
-
 void main(unsigned long bist)
 {
        u32 reg32;
index e47f08c3c28cf035b2aa9e724c6ab2390af69bf2..f7056737dc462b7181c670a490d461456afb463d 100644 (file)
@@ -186,14 +186,6 @@ static void early_ich7_init(void)
 
 #include <cbmem.h>
 
-// Now, this needs to be included because it relies on the symbol
-// __PRE_RAM__ being set during CAR stage (in order to compile the
-// BSS free versions of the functions). Either rewrite the code
-// to be always BSS free, or invent a flag that's better suited than
-// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
-//
-#include "lib/cbmem.c"
-
 void main(unsigned long bist)
 {
        u32 reg32;
index 0b93259ba2851ed1d3d84df2858bef4910cb1d4d..5d773ce6366263d33b34b444269385cd1a923b6e 100644 (file)
@@ -314,14 +314,6 @@ static void early_ich7_init(void)
 
 #include <cbmem.h>
 
-// Now, this needs to be included because it relies on the symbol
-// __PRE_RAM__ being set during CAR stage (in order to compile the
-// BSS free versions of the functions). Either rewrite the code
-// to be always BSS free, or invent a flag that's better suited than
-// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
-//
-#include "lib/cbmem.c"
-
 void main(unsigned long bist)
 {
        u32 reg32;
index 85d163baf8347026f7d90f315c145068befc4b98..80afe80745a1d3fcea0d0d1561ba3b466ead0be5 100644 (file)
@@ -235,14 +235,6 @@ static void init_artec_dongle(void)
 
 #include <cbmem.h>
 
-// Now, this needs to be included because it relies on the symbol
-// __PRE_RAM__ being set during CAR stage (in order to compile the
-// BSS free versions of the functions). Either rewrite the code
-// to be always BSS free, or invent a flag that's better suited than
-// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
-//
-#include "lib/cbmem.c"
-
 void main(unsigned long bist)
 {
        u32 reg32;