Split the two usages of __ROMCC__:
__ROMCC__ now means "Don't use prototypes, since romcc doesn't support them."
__PRE_RAM__ means "Use simpler versions of functions, and no device tree."

There are probably some places where both are tested, but only one is needed.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4921 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/src/arch/i386/include/arch/cpu.h b/src/arch/i386/include/arch/cpu.h
index f49b7cb..d43c847 100644
--- a/src/arch/i386/include/arch/cpu.h
+++ b/src/arch/i386/include/arch/cpu.h
@@ -104,7 +104,7 @@
 #define X86_VENDOR_SIS       10 
 #define X86_VENDOR_UNKNOWN 0xff
 
-#if !defined( __ROMCC__ ) && defined( __GNUC__)
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__) && defined( __GNUC__)
 #include <device/device.h>
 
 
diff --git a/src/arch/i386/include/arch/hlt.h b/src/arch/i386/include/arch/hlt.h
index 3b2acf1..931e933 100644
--- a/src/arch/i386/include/arch/hlt.h
+++ b/src/arch/i386/include/arch/hlt.h
@@ -1,7 +1,7 @@
 #ifndef ARCH_HLT_H
 #define ARCH_HLT_H
 
-#if defined( __ROMCC__) && !defined(__GNUC__)
+#if defined( __ROMCC__) && !defined(__PRE_RAM__) && !defined(__GNUC__)
 static void hlt(void)
 {
 	__builtin_hlt();
diff --git a/src/arch/i386/include/arch/io.h b/src/arch/i386/include/arch/io.h
index 07d0913..59af68c 100644
--- a/src/arch/i386/include/arch/io.h
+++ b/src/arch/i386/include/arch/io.h
@@ -9,7 +9,7 @@
  * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
  * versions of the single-IO instructions (inb_p/inw_p/..).
  */
-#if defined( __ROMCC__ ) && !defined (__GNUC__) 
+#if defined( __ROMCC__ ) && !defined (__GNUC__)
 static inline void outb(uint8_t value, uint16_t port)
 {
 	__builtin_outb(value, port);
diff --git a/src/arch/i386/lib/console_print.c b/src/arch/i386/lib/console_print.c
index ed807e6..661dc41 100644
--- a/src/arch/i386/lib/console_print.c
+++ b/src/arch/i386/lib/console_print.c
@@ -66,7 +66,7 @@
  * set in some auto.c files to trigger the simple device_t version to be used.
  * So __GNUCC__ does the right thing here.
  */
-#if defined (__GNUCC__)
+#if defined (__ROMCC__)
 #define STATIC
 #else
 #define STATIC static
diff --git a/src/cpu/amd/dualcore/dualcore_id.c b/src/cpu/amd/dualcore/dualcore_id.c
index 67beb94..33355cd 100644
--- a/src/cpu/amd/dualcore/dualcore_id.c
+++ b/src/cpu/amd/dualcore/dualcore_id.c
@@ -2,7 +2,7 @@
 
 #include <arch/cpu.h>
 #include <cpu/amd/dualcore.h>
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 #include <cpu/amd/model_fxx_msr.h>
 #endif
 
diff --git a/src/cpu/amd/microcode/microcode.c b/src/cpu/amd/microcode/microcode.c
index 82bb8be..1649b82 100644
--- a/src/cpu/amd/microcode/microcode.c
+++ b/src/cpu/amd/microcode/microcode.c
@@ -17,7 +17,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef __ROMCC__
+#ifndef __PRE_RAM__
 
 #include <stdint.h>
 #include <console/console.h>
diff --git a/src/cpu/amd/model_10xxx/apic_timer.c b/src/cpu/amd/model_10xxx/apic_timer.c
index d1c0538..d961da7 100644
--- a/src/cpu/amd/model_10xxx/apic_timer.c
+++ b/src/cpu/amd/model_10xxx/apic_timer.c
@@ -23,8 +23,8 @@
 #include <cpu/x86/lapic.h>
 
 /* NOTE: We use the APIC TIMER register is to hold flags for AP init during
- * pre-memory init (ROMCC). Don't use init_timer() and  udelay is redirected
- * to udelay_tsc().
+ * pre-memory init (__PRE_RAM__). Don't use init_timer() and  udelay is
+ * redirected to udelay_tsc().
  */
 
 
diff --git a/src/cpu/amd/model_10xxx/update_microcode.c b/src/cpu/amd/model_10xxx/update_microcode.c
index ff38c65..a24b83d 100644
--- a/src/cpu/amd/model_10xxx/update_microcode.c
+++ b/src/cpu/amd/model_10xxx/update_microcode.c
@@ -18,7 +18,7 @@
  */
 
 
-#ifndef __ROMCC__
+#ifndef __PRE_RAM__
 #include <console/console.h>
 #include <device/device.h>
 #include <device/pci.h>
@@ -29,7 +29,7 @@
 
 static const u8 microcode_updates[] __attribute__ ((aligned(16))) = {
 
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 
 /* From the Revision Guide :
  * Equivalent Processor Table for AMD Family 10h Processors
diff --git a/src/cpu/amd/quadcore/quadcore_id.c b/src/cpu/amd/quadcore/quadcore_id.c
index c4eab24..52f5e63 100644
--- a/src/cpu/amd/quadcore/quadcore_id.c
+++ b/src/cpu/amd/quadcore/quadcore_id.c
@@ -20,7 +20,7 @@
 
 #include <arch/cpu.h>
 #include <cpu/amd/quadcore.h>
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 #include <cpu/amd/model_10xxx_msr.h>
 #endif
 
diff --git a/src/cpu/x86/smm/smmrelocate.S b/src/cpu/x86/smm/smmrelocate.S
index 3d1d9d2..fa94b88 100644
--- a/src/cpu/x86/smm/smmrelocate.S
+++ b/src/cpu/x86/smm/smmrelocate.S
@@ -22,7 +22,7 @@
 #include <arch/asm.h>
 
 // Make sure no stage 2 code is included:
-#define __ROMCC__
+#define __PRE_RAM__
 
 // FIXME: Is this piece of code southbridge specific, or 
 // can it be cleaned up so this include is not required?
diff --git a/src/drivers/pci/Makefile.inc b/src/drivers/pci/Makefile.inc
deleted file mode 100644
index 09ac260..0000000
--- a/src/drivers/pci/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-subdirs-y += onboard
diff --git a/src/drivers/pci/onboard/Config.lb b/src/drivers/pci/onboard/Config.lb
deleted file mode 100644
index d249df4..0000000
--- a/src/drivers/pci/onboard/Config.lb
+++ /dev/null
@@ -1,4 +0,0 @@
-config chip.h
-
-object onboard.o
-
diff --git a/src/drivers/pci/onboard/Makefile.inc b/src/drivers/pci/onboard/Makefile.inc
deleted file mode 100644
index 5a16314..0000000
--- a/src/drivers/pci/onboard/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-obj-y += onboard.o
diff --git a/src/drivers/pci/onboard/chip.h b/src/drivers/pci/onboard/chip.h
deleted file mode 100644
index f06f53e..0000000
--- a/src/drivers/pci/onboard/chip.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef PCI_ONBOARD_H
-#define PCI_ONBOARD_H
-
-struct drivers_pci_onboard_config 
-{
-       unsigned long rom_address;
-};
-struct chip_operations;
-extern struct chip_operations drivers_pci_onboard_ops;
-
-#endif 
diff --git a/src/drivers/pci/onboard/onboard.c b/src/drivers/pci/onboard/onboard.c
deleted file mode 100644
index 58e6816..0000000
--- a/src/drivers/pci/onboard/onboard.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2004 Tyan Computer
- *  by yhlu@tyan.com
- */
-
-#include <console/console.h>
-
-#include <device/device.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <device/pci_ops.h>
-#include "chip.h"
-
-/*
- * How to use the onboard device driver for option rom execution:
- *
- * 1. You need to add the driver to your mainboard Config.lb:
- *
- *      chip drivers/pci/onboard
- *	    device pci x.0 on end
- *          register "rom_address" = "0xfff80000"
- *      end
- * 2. Reduce the size of your normal (or fallback) image, by adding the
- *    following lines to your target Config.lb, after romimage "normal"
- *      # 48K for SCSI FW or ATI ROM
- *      option CONFIG_ROM_SIZE = 512*1024-48*1024
- * 3. Create your vgabios.bin, for example using awardeco and put it in the
- *    directory of your target Config.lb. You can also read an option rom from
- *    a running system, but this is unreliable, as some option roms are changed
- *    during execution:
- *      #  dd if=/dev/mem of=atix.rom skip=1536 count=96
- * 4. After you built coreboot.rom, attach the option rom to your coreboot
- *    image:
- *      # cat ../atix.rom ./normal/coreboot.rom ./fallback/coreboot.rom > coreboot.rom
- *
- * Alternatively you can use the following script "nsxv" to build your image
- * Usage:
- * # ./nsxv s2850
- *     
- *     #!/bin/bash
- *     MBVENDOR=tyan
- *     MBMODEL=$1
- *     LBROOT=/home/yhlu/xx/xx
- *     
- *     echo $1
- *     date
- *     
- *     cd "$LBROOT/freebios2/targets"
- *     rm -rf "$MBVENDOR/$MBMODEL/$MBMODEL"
- *     ./buildtarget "$MBVENDOR/$MBMODEL" &> "$LBROOT/x_b.txt"
- *     cd "$MBVENDOR/$MBMODEL/$MBMODEL"
- *     #make clean
- *     eval make &> "$LBROOT/x_m.txt"
- *             if [ $? -eq 0 ]; then
- *                     echo "ok."
- *             else
- *                     echo "FAILED! Log excerpt:"
- *                     tail -n 15 "$LBROOT/x_m.txt"
- *                     exit
- *             fi
- *     cat ../atix.rom ./normal/coreboot.rom ./fallback/coreboot.rom > "$LBROOT/rom/"$MBMODEL"_coreboot.rom"
- *     cp -f "$LBROOT/rom/"$MBMODEL"_coreboot.rom" /home/yhlu/
- *     
- *     date
- *     
- */
-
-static void onboard_enable(device_t dev) 
-{
-	struct drivers_pci_onboard_config *conf;
-        conf = dev->chip_info;
-	dev->rom_address = conf->rom_address;
-}
-
-struct chip_operations drivers_pci_onboard_ops = {
-	CHIP_NAME("Onboard PCI")
-	.enable_dev = onboard_enable,
-};
diff --git a/src/include/assert.h b/src/include/assert.h
index d34d557..4103291 100644
--- a/src/include/assert.h
+++ b/src/include/assert.h
@@ -24,7 +24,7 @@
 // ROMCC doesn't support __FILE__ or __LINE__  :^{
 
 #if CONFIG_DEBUG
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 #define ASSERT(x)	{ if (!(x)) die("ASSERT failure!\r\n"); }
 #else
 #define ASSERT(x)	{ 				\
@@ -39,7 +39,7 @@
 #define ASSERT(x)	{ }
 #endif
 
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 #define BUG()		{ 	die("BUG encountered: system halted\r\n");  }
 #else
 #define BUG()		{ 				\
diff --git a/src/include/cpu/amd/dualcore.h b/src/include/cpu/amd/dualcore.h
index fb53c92..1d33840 100644
--- a/src/include/cpu/amd/dualcore.h
+++ b/src/include/cpu/amd/dualcore.h
@@ -15,7 +15,7 @@
 struct node_core_id get_node_core_id(unsigned int nb_cfg_54);
 #endif
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 struct device;
 unsigned get_apicid_base(unsigned ioapic_num);
 void amd_sibling_init(struct device *cpu);
diff --git a/src/include/cpu/amd/model_fxx_rev.h b/src/include/cpu/amd/model_fxx_rev.h
index a3f3033..c2d59a6 100644
--- a/src/include/cpu/amd/model_fxx_rev.h
+++ b/src/include/cpu/amd/model_fxx_rev.h
@@ -49,7 +49,7 @@
 }
 
 
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 static int is_e0_later_in_bsp(int nodeid)
 {
         uint32_t val;
@@ -96,7 +96,7 @@
         return (cpuid_eax(1) & 0xfff0f) <  0x40f02;
 }
 
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 //AMD_F0_SUPPORT
 static int is_cpu_f0_in_bsp(int nodeid)
 {
diff --git a/src/include/cpu/amd/mtrr.h b/src/include/cpu/amd/mtrr.h
index 2b7017d..d86655d 100644
--- a/src/include/cpu/amd/mtrr.h
+++ b/src/include/cpu/amd/mtrr.h
@@ -31,7 +31,7 @@
 #define TOP_MEM_MASK			0x007fffff
 #define TOP_MEM_MASK_KB			(TOP_MEM_MASK >> 10)
 
-#if !defined( __ROMCC__ ) && !defined (ASSEMBLY)
+#if !defined( __ROMCC__ ) && !defined (ASSEMBLY) && !defined(__PRE_RAM__)
 void amd_setup_mtrrs(void);
 #endif /* __ROMCC__ */
 
diff --git a/src/include/cpu/amd/quadcore.h b/src/include/cpu/amd/quadcore.h
index 54a1c9b..f7b2d09 100644
--- a/src/include/cpu/amd/quadcore.h
+++ b/src/include/cpu/amd/quadcore.h
@@ -34,7 +34,7 @@
 struct node_core_id get_node_core_id(u32 nb_cfg_54);
 #endif
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 struct device;
 u32 get_apicid_base(u32 ioapic_num);
 void amd_sibling_init(struct device *cpu);
diff --git a/src/include/cpu/x86/cache.h b/src/include/cpu/x86/cache.h
index af7d3d5..22bd1e7 100644
--- a/src/include/cpu/x86/cache.h
+++ b/src/include/cpu/x86/cache.h
@@ -41,7 +41,7 @@
 	wbinvd();
 }
 
-#if !defined( __ROMCC__)  && defined (__GNUC__)
+#if !defined( __ROMCC__) && !defined(__PRE_RAM__) && defined (__GNUC__)
 void x86_enable_cache(void);
 #endif /* !__ROMCC__ */
 
diff --git a/src/include/cpu/x86/lapic.h b/src/include/cpu/x86/lapic.h
index 9f21919..2b77177 100644
--- a/src/include/cpu/x86/lapic.h
+++ b/src/include/cpu/x86/lapic.h
@@ -68,7 +68,7 @@
 }
 #endif
 
-#if ! defined (__ROMCC__)
+#if ! defined (__ROMCC__) && !defined(__PRE_RAM__)
 
 #define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
 
@@ -157,6 +157,6 @@
 #endif /* CONFIG_SMP */
 
 
-#endif /* !__ROMCC__ */
+#endif /* !__ROMCC__ && !__PRE_RAM__ */
 
 #endif /* CPU_X86_LAPIC_H */
diff --git a/src/include/cpu/x86/msr.h b/src/include/cpu/x86/msr.h
index c4bc55a..69b4d8e 100644
--- a/src/include/cpu/x86/msr.h
+++ b/src/include/cpu/x86/msr.h
@@ -1,7 +1,7 @@
 #ifndef CPU_X86_MSR_H
 #define CPU_X86_MSR_H
 
-#if defined( __ROMCC__) && !defined (__GNUC__)
+#if defined( __ROMCC__)
 
 typedef __builtin_msr_t msr_t;
 
@@ -43,7 +43,7 @@
 		);
 }
 
-#endif /* ROMCC__ && !__GNUC__ */
+#endif /* __ROMCC__ */
 
 
 #endif /* CPU_X86_MSR_H */
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 704a9d4..2243fe3 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -32,7 +32,7 @@
 #define MTRRfix4K_F8000_MSR 0x26f
 
 
-#if !defined(__ROMCC__) && !defined (ASSEMBLY)
+#if !defined(__ROMCC__) && !defined (ASSEMBLY) && !defined(__PRE_RAM__)
 
 #include <device/device.h>
 
diff --git a/src/include/cpu/x86/tsc.h b/src/include/cpu/x86/tsc.h
index 455cd23..9370adf 100644
--- a/src/include/cpu/x86/tsc.h
+++ b/src/include/cpu/x86/tsc.h
@@ -17,7 +17,7 @@
 	return res;
 }
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined (__PRE_RAM__)
 static inline unsigned long long rdtscll(void)
 {
 	unsigned long long val;
diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index 63a316f..8742fdfe 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -11,7 +11,7 @@
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 void *malloc(size_t size);
 void free(void *ptr);
 #endif
diff --git a/src/include/string.h b/src/include/string.h
index 1b092a6..9e3c084 100644
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -8,7 +8,7 @@
 void *memmove(void *dest, const void *src, size_t n);
 void *memset(void *s, int c, size_t n);
 int memcmp(const void *s1, const void *s2, size_t n);
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 int sprintf(char * buf, const char *fmt, ...);
 #endif
 
@@ -41,7 +41,7 @@
 	return 0;
 }
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 static inline char *strdup(const char *s)
 {   
 	size_t sz = strlen(s) + 1;
diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c
index 83779a7..023ddea 100644
--- a/src/lib/cbmem.c
+++ b/src/lib/cbmem.c
@@ -45,7 +45,7 @@
 	u64 size;
 } __attribute__((packed));
 
-#ifndef __ROMCC__
+#ifndef __PRE_RAM__
 struct cbmem_entry *bss_cbmem_toc;
 #endif
 
@@ -64,7 +64,7 @@
 	struct cbmem_entry *cbmem_toc;
 	cbmem_toc = (struct cbmem_entry *)(unsigned long)baseaddr;
 
-#ifndef __ROMCC__
+#ifndef __PRE_RAM__
 	bss_cbmem_toc = cbmem_toc;
 #endif
 	
@@ -91,7 +91,7 @@
 	cbmem_toc = (struct cbmem_entry *)(unsigned long)baseaddr;
 
 	debug("Re-Initializing CBMEM area to 0x%lx\n", (unsigned long)baseaddr);
-#ifndef __ROMCC__
+#ifndef __PRE_RAM__
 	bss_cbmem_toc = cbmem_toc;
 #endif
 
@@ -102,7 +102,7 @@
 {
 	struct cbmem_entry *cbmem_toc;
 	int i;
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 	 cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
 #else
 	 cbmem_toc = bss_cbmem_toc;
@@ -158,7 +158,7 @@
 {
 	struct cbmem_entry *cbmem_toc;
 	int i;
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 	 cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
 #else
 	 cbmem_toc = bss_cbmem_toc;
@@ -175,7 +175,7 @@
 	return (void *)NULL;
 }
 
-#ifndef __ROMCC__
+#ifndef __PRE_RAM__
 #if CONFIG_HAVE_ACPI_RESUME
 extern u8 acpi_slp_type;
 #endif
@@ -199,12 +199,12 @@
 	cbmem_arch_init();
 }
 
-#ifndef __ROMCC__
+#ifndef __PRE_RAM__
 void cbmem_list(void)
 {
 	struct cbmem_entry *cbmem_toc;
 	int i;
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 	 cbmem_toc = (struct cbmem_entry *)(get_top_of_ram() - HIGH_MEMORY_SIZE);
 #else
 	 cbmem_toc = bss_cbmem_toc;
diff --git a/src/lib/usbdebug_direct.c b/src/lib/usbdebug_direct.c
index 48875dc..1fd1113 100644
--- a/src/lib/usbdebug_direct.c
+++ b/src/lib/usbdebug_direct.c
@@ -19,7 +19,7 @@
 /*
  *	2006.12.10 yhlu moved it to corbeoot and use struct instead
  */
-#ifndef __ROMCC__
+#if !defined(__ROMCC__)
 #include <console/console.h>
 #else
 #if CONFIG_USE_PRINTK_IN_CAR==0
diff --git a/src/mainboard/amd/dbm690t/cache_as_ram_auto.c b/src/mainboard/amd/dbm690t/cache_as_ram_auto.c
index b058b44..c83759b 100644
--- a/src/mainboard/amd/dbm690t/cache_as_ram_auto.c
+++ b/src/mainboard/amd/dbm690t/cache_as_ram_auto.c
@@ -18,7 +18,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define K8_SET_FIDVID 1
diff --git a/src/mainboard/amd/pistachio/cache_as_ram_auto.c b/src/mainboard/amd/pistachio/cache_as_ram_auto.c
index 4615901..2e5c4a0 100644
--- a/src/mainboard/amd/pistachio/cache_as_ram_auto.c
+++ b/src/mainboard/amd/pistachio/cache_as_ram_auto.c
@@ -18,7 +18,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define K8_SET_FIDVID 1
diff --git a/src/mainboard/amd/serengeti_cheetah/apc_auto.c b/src/mainboard/amd/serengeti_cheetah/apc_auto.c
index a855c2f..6abebff 100644
--- a/src/mainboard/amd/serengeti_cheetah/apc_auto.c
+++ b/src/mainboard/amd/serengeti_cheetah/apc_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/amd/serengeti_cheetah/cache_as_ram_auto.c b/src/mainboard/amd/serengeti_cheetah/cache_as_ram_auto.c
index a3e2b16..2626f80 100644
--- a/src/mainboard/amd/serengeti_cheetah/cache_as_ram_auto.c
+++ b/src/mainboard/amd/serengeti_cheetah/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/amd/serengeti_cheetah_fam10/apc_auto.c b/src/mainboard/amd/serengeti_cheetah_fam10/apc_auto.c
index ea7e2a6..a62811a 100644
--- a/src/mainboard/amd/serengeti_cheetah_fam10/apc_auto.c
+++ b/src/mainboard/amd/serengeti_cheetah_fam10/apc_auto.c
@@ -18,7 +18,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/amd/serengeti_cheetah_fam10/cache_as_ram_auto.c b/src/mainboard/amd/serengeti_cheetah_fam10/cache_as_ram_auto.c
index abb2891..0b136ec 100644
--- a/src/mainboard/amd/serengeti_cheetah_fam10/cache_as_ram_auto.c
+++ b/src/mainboard/amd/serengeti_cheetah_fam10/cache_as_ram_auto.c
@@ -19,7 +19,7 @@
 
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define SYSTEM_TYPE 0	/* SERVER */
 //#define SYSTEM_TYPE 1	/* DESKTOP */
diff --git a/src/mainboard/arima/hdama/cache_as_ram_auto.c b/src/mainboard/arima/hdama/cache_as_ram_auto.c
index 4bbd428..19c4c6b 100644
--- a/src/mainboard/arima/hdama/cache_as_ram_auto.c
+++ b/src/mainboard/arima/hdama/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #include <stdint.h>
 #include <device/pci_def.h>
diff --git a/src/mainboard/asus/a8n_e/cache_as_ram_auto.c b/src/mainboard/asus/a8n_e/cache_as_ram_auto.c
index 021a226..8e0ba29 100644
--- a/src/mainboard/asus/a8n_e/cache_as_ram_auto.c
+++ b/src/mainboard/asus/a8n_e/cache_as_ram_auto.c
@@ -22,7 +22,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 /* Used by it8712f_enable_serial(). */
 #define SERIAL_DEV PNP_DEV(0x2e, IT8712F_SP1)
diff --git a/src/mainboard/asus/a8v-e_se/cache_as_ram_auto.c b/src/mainboard/asus/a8v-e_se/cache_as_ram_auto.c
index 6f54ecf..4ec3aee 100644
--- a/src/mainboard/asus/a8v-e_se/cache_as_ram_auto.c
+++ b/src/mainboard/asus/a8v-e_se/cache_as_ram_auto.c
@@ -23,7 +23,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/asus/m2v-mx_se/cache_as_ram_auto.c b/src/mainboard/asus/m2v-mx_se/cache_as_ram_auto.c
index 5a7f74b..13101b0 100644
--- a/src/mainboard/asus/m2v-mx_se/cache_as_ram_auto.c
+++ b/src/mainboard/asus/m2v-mx_se/cache_as_ram_auto.c
@@ -23,7 +23,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/broadcom/blast/cache_as_ram_auto.c b/src/mainboard/broadcom/blast/cache_as_ram_auto.c
index 3b94d3f..6169841 100644
--- a/src/mainboard/broadcom/blast/cache_as_ram_auto.c
+++ b/src/mainboard/broadcom/blast/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define QRANK_DIMM_SUPPORT 1
 
diff --git a/src/mainboard/dell/s1850/reset.c b/src/mainboard/dell/s1850/reset.c
index 28a019a..293ad72 100644
--- a/src/mainboard/dell/s1850/reset.c
+++ b/src/mainboard/dell/s1850/reset.c
@@ -2,7 +2,7 @@
 
 #include <device/pci_def.h>
 #include <device/pci_ids.h>
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 #include <device/pci.h>
 #define PCI_ID(VENDOR_ID, DEVICE_ID) \
 	((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
diff --git a/src/mainboard/gigabyte/ga_2761gxdk/apc_auto.c b/src/mainboard/gigabyte/ga_2761gxdk/apc_auto.c
index 5a94cf7..452084f 100644
--- a/src/mainboard/gigabyte/ga_2761gxdk/apc_auto.c
+++ b/src/mainboard/gigabyte/ga_2761gxdk/apc_auto.c
@@ -22,7 +22,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/gigabyte/ga_2761gxdk/cache_as_ram_auto.c b/src/mainboard/gigabyte/ga_2761gxdk/cache_as_ram_auto.c
index 056cd08..69e06bc 100644
--- a/src/mainboard/gigabyte/ga_2761gxdk/cache_as_ram_auto.c
+++ b/src/mainboard/gigabyte/ga_2761gxdk/cache_as_ram_auto.c
@@ -22,7 +22,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/gigabyte/m57sli/apc_auto.c b/src/mainboard/gigabyte/m57sli/apc_auto.c
index 50ad68e..007dfa9 100644
--- a/src/mainboard/gigabyte/m57sli/apc_auto.c
+++ b/src/mainboard/gigabyte/m57sli/apc_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/gigabyte/m57sli/cache_as_ram_auto.c b/src/mainboard/gigabyte/m57sli/cache_as_ram_auto.c
index 26e5ee9..ecc7827 100644
--- a/src/mainboard/gigabyte/m57sli/cache_as_ram_auto.c
+++ b/src/mainboard/gigabyte/m57sli/cache_as_ram_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/hp/dl145_g3/cache_as_ram_auto.c b/src/mainboard/hp/dl145_g3/cache_as_ram_auto.c
index 0f54f46..525cb3e 100644
--- a/src/mainboard/hp/dl145_g3/cache_as_ram_auto.c
+++ b/src/mainboard/hp/dl145_g3/cache_as_ram_auto.c
@@ -26,7 +26,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/ibm/e325/cache_as_ram_auto.c b/src/mainboard/ibm/e325/cache_as_ram_auto.c
index 1021a60..6621bf1 100644
--- a/src/mainboard/ibm/e325/cache_as_ram_auto.c
+++ b/src/mainboard/ibm/e325/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/ibm/e326/cache_as_ram_auto.c b/src/mainboard/ibm/e326/cache_as_ram_auto.c
index c6794a9..0ec2c52 100644
--- a/src/mainboard/ibm/e326/cache_as_ram_auto.c
+++ b/src/mainboard/ibm/e326/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/intel/d945gclf/auto.c b/src/mainboard/intel/d945gclf/auto.c
index 890caa0..e0c4c52 100644
--- a/src/mainboard/intel/d945gclf/auto.c
+++ b/src/mainboard/intel/d945gclf/auto.c
@@ -17,8 +17,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-// __ROMCC__ means: use "unsigned" for device, not a struct.
-#define __ROMCC__ 
+// __PRE_RAM__ means: use "unsigned" for device, not a struct.
+#define __PRE_RAM__
 
 #include <stdint.h>
 #include <string.h>
@@ -220,10 +220,10 @@
 #include <cbmem.h>
 
 // Now, this needs to be included because it relies on the symbol
-// __ROMCC_ being set during CAR stage (in order to compile the 
+// __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
-// __ROMCC__ to determine whether we're in ram init stage (stage 1)
+// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
 //
 #include "lib/cbmem.c"
 
diff --git a/src/mainboard/intel/eagleheights/auto.c b/src/mainboard/intel/eagleheights/auto.c
index 2dce5bb..47043a9 100644
--- a/src/mainboard/intel/eagleheights/auto.c
+++ b/src/mainboard/intel/eagleheights/auto.c
@@ -20,7 +20,7 @@
  * MA 02110-1301 USA
  */
 
-#define __ROMCC__
+#define __PRE_RAM__
 
 #include <delay.h>
 
diff --git a/src/mainboard/intel/eagleheights/reset.c b/src/mainboard/intel/eagleheights/reset.c
index d35a6dc..09308e4 100644
--- a/src/mainboard/intel/eagleheights/reset.c
+++ b/src/mainboard/intel/eagleheights/reset.c
@@ -22,7 +22,7 @@
 #include <arch/io.h>
 #include <device/pci_def.h>
 #include <device/pci_ids.h>
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ops.h>
diff --git a/src/mainboard/intel/jarrell/reset.c b/src/mainboard/intel/jarrell/reset.c
index b09b708..5364632 100644
--- a/src/mainboard/intel/jarrell/reset.c
+++ b/src/mainboard/intel/jarrell/reset.c
@@ -1,7 +1,7 @@
 #include <arch/io.h>
 #include <device/pci_def.h>
 #include <device/pci_ids.h>
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ops.h>
diff --git a/src/mainboard/intel/xe7501devkit/auto.c b/src/mainboard/intel/xe7501devkit/auto.c
index 8e2c271..7269fa8 100644
--- a/src/mainboard/intel/xe7501devkit/auto.c
+++ b/src/mainboard/intel/xe7501devkit/auto.c
@@ -1,4 +1,5 @@
 #define ASSEMBLY 1
+#define __PRE_RAM__
 
 #include <stdint.h>
 #include <device/pci_def.h>
diff --git a/src/mainboard/iwill/dk8_htx/cache_as_ram_auto.c b/src/mainboard/iwill/dk8_htx/cache_as_ram_auto.c
index 76e56f8..cdfdfc0 100644
--- a/src/mainboard/iwill/dk8_htx/cache_as_ram_auto.c
+++ b/src/mainboard/iwill/dk8_htx/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/iwill/dk8s2/cache_as_ram_auto.c b/src/mainboard/iwill/dk8s2/cache_as_ram_auto.c
index 78b1de9..271ad6c 100644
--- a/src/mainboard/iwill/dk8s2/cache_as_ram_auto.c
+++ b/src/mainboard/iwill/dk8s2/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/iwill/dk8x/cache_as_ram_auto.c b/src/mainboard/iwill/dk8x/cache_as_ram_auto.c
index 78b1de9..271ad6c 100644
--- a/src/mainboard/iwill/dk8x/cache_as_ram_auto.c
+++ b/src/mainboard/iwill/dk8x/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/kontron/986lcd-m/auto.c b/src/mainboard/kontron/986lcd-m/auto.c
index 003fdb3..f830411 100644
--- a/src/mainboard/kontron/986lcd-m/auto.c
+++ b/src/mainboard/kontron/986lcd-m/auto.c
@@ -19,8 +19,8 @@
  * MA 02110-1301 USA
  */
 
-// __ROMCC__ means: use "unsigned" for device, not a struct.
-#define __ROMCC__ 
+// __PRE_RAM__ means: use "unsigned" for device, not a struct.
+#define __PRE_RAM__
 
 #include <stdint.h>
 #include <string.h>
@@ -359,10 +359,10 @@
 #include <cbmem.h>
 
 // Now, this needs to be included because it relies on the symbol
-// __ROMCC_ being set during CAR stage (in order to compile the 
+// __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
-// __ROMCC__ to determine whether we're in ram init stage (stage 1)
+// __PRE_RAM__ to determine whether we're in ram init stage (stage 1)
 //
 #include "lib/cbmem.c"
 
diff --git a/src/mainboard/kontron/kt690/cache_as_ram_auto.c b/src/mainboard/kontron/kt690/cache_as_ram_auto.c
index 68447ba..224f603 100644
--- a/src/mainboard/kontron/kt690/cache_as_ram_auto.c
+++ b/src/mainboard/kontron/kt690/cache_as_ram_auto.c
@@ -19,7 +19,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define K8_SET_FIDVID 1
diff --git a/src/mainboard/msi/ms7135/cache_as_ram_auto.c b/src/mainboard/msi/ms7135/cache_as_ram_auto.c
index 4b5ab60..6616dc1 100644
--- a/src/mainboard/msi/ms7135/cache_as_ram_auto.c
+++ b/src/mainboard/msi/ms7135/cache_as_ram_auto.c
@@ -23,7 +23,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define SERIAL_DEV PNP_DEV(0x4e, W83627HF_SP1)
 
diff --git a/src/mainboard/msi/ms7260/apc_auto.c b/src/mainboard/msi/ms7260/apc_auto.c
index 317f9d2..84ba6c1 100644
--- a/src/mainboard/msi/ms7260/apc_auto.c
+++ b/src/mainboard/msi/ms7260/apc_auto.c
@@ -21,7 +21,7 @@
 
 #define ASSEMBLY 1
 
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/msi/ms7260/cache_as_ram_auto.c b/src/mainboard/msi/ms7260/cache_as_ram_auto.c
index ed84a42..7a8bf13 100644
--- a/src/mainboard/msi/ms7260/cache_as_ram_auto.c
+++ b/src/mainboard/msi/ms7260/cache_as_ram_auto.c
@@ -21,7 +21,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 // #define CACHE_AS_RAM_ADDRESS_DEBUG 1
 // #define DEBUG_SMBUS 1
diff --git a/src/mainboard/msi/ms9185/cache_as_ram_auto.c b/src/mainboard/msi/ms9185/cache_as_ram_auto.c
index 95704b9..2558157 100644
--- a/src/mainboard/msi/ms9185/cache_as_ram_auto.c
+++ b/src/mainboard/msi/ms9185/cache_as_ram_auto.c
@@ -24,7 +24,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/msi/ms9282/cache_as_ram_auto.c b/src/mainboard/msi/ms9282/cache_as_ram_auto.c
index 55f2a33..11c92b8 100644
--- a/src/mainboard/msi/ms9282/cache_as_ram_auto.c
+++ b/src/mainboard/msi/ms9282/cache_as_ram_auto.c
@@ -23,7 +23,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/newisys/khepri/cache_as_ram_auto.c b/src/mainboard/newisys/khepri/cache_as_ram_auto.c
index db76c95..efd2ea3 100644
--- a/src/mainboard/newisys/khepri/cache_as_ram_auto.c
+++ b/src/mainboard/newisys/khepri/cache_as_ram_auto.c
@@ -4,7 +4,7 @@
  * Additional (C) 2007 coresystems GmbH 
  */
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/nvidia/l1_2pvv/apc_auto.c b/src/mainboard/nvidia/l1_2pvv/apc_auto.c
index d7c4e28..1a9121e 100644
--- a/src/mainboard/nvidia/l1_2pvv/apc_auto.c
+++ b/src/mainboard/nvidia/l1_2pvv/apc_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/nvidia/l1_2pvv/cache_as_ram_auto.c b/src/mainboard/nvidia/l1_2pvv/cache_as_ram_auto.c
index 04fa546..ab6941f 100644
--- a/src/mainboard/nvidia/l1_2pvv/cache_as_ram_auto.c
+++ b/src/mainboard/nvidia/l1_2pvv/cache_as_ram_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/sunw/ultra40/cache_as_ram_auto.c b/src/mainboard/sunw/ultra40/cache_as_ram_auto.c
index 468e049..9a3f948 100644
--- a/src/mainboard/sunw/ultra40/cache_as_ram_auto.c
+++ b/src/mainboard/sunw/ultra40/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 
 #define K8_ALLOCATE_IO_RANGE 1
diff --git a/src/mainboard/supermicro/h8dme/apc_auto.c b/src/mainboard/supermicro/h8dme/apc_auto.c
index b501cfc..bb62593 100644
--- a/src/mainboard/supermicro/h8dme/apc_auto.c
+++ b/src/mainboard/supermicro/h8dme/apc_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/supermicro/h8dme/cache_as_ram_auto.c b/src/mainboard/supermicro/h8dme/cache_as_ram_auto.c
index 151b2d0..72d5809 100644
--- a/src/mainboard/supermicro/h8dme/cache_as_ram_auto.c
+++ b/src/mainboard/supermicro/h8dme/cache_as_ram_auto.c
@@ -17,7 +17,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/supermicro/h8dmr/apc_auto.c b/src/mainboard/supermicro/h8dmr/apc_auto.c
index b501cfc..bb62593 100644
--- a/src/mainboard/supermicro/h8dmr/apc_auto.c
+++ b/src/mainboard/supermicro/h8dmr/apc_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/supermicro/h8dmr/cache_as_ram_auto.c b/src/mainboard/supermicro/h8dmr/cache_as_ram_auto.c
index 672f551..9c67527 100644
--- a/src/mainboard/supermicro/h8dmr/cache_as_ram_auto.c
+++ b/src/mainboard/supermicro/h8dmr/cache_as_ram_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/supermicro/h8dmr_fam10/apc_auto.c b/src/mainboard/supermicro/h8dmr_fam10/apc_auto.c
index f55b80f..647637d 100644
--- a/src/mainboard/supermicro/h8dmr_fam10/apc_auto.c
+++ b/src/mainboard/supermicro/h8dmr_fam10/apc_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/supermicro/h8dmr_fam10/cache_as_ram_auto.c b/src/mainboard/supermicro/h8dmr_fam10/cache_as_ram_auto.c
index 02615bb..4ebc47f 100644
--- a/src/mainboard/supermicro/h8dmr_fam10/cache_as_ram_auto.c
+++ b/src/mainboard/supermicro/h8dmr_fam10/cache_as_ram_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/supermicro/x6dai_g/reset.c b/src/mainboard/supermicro/x6dai_g/reset.c
index f57d7a5..e168e37 100644
--- a/src/mainboard/supermicro/x6dai_g/reset.c
+++ b/src/mainboard/supermicro/x6dai_g/reset.c
@@ -1,7 +1,7 @@
 #include <arch/io.h>
 #include <device/pci_def.h>
 #include <device/pci_ids.h>
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ops.h>
diff --git a/src/mainboard/supermicro/x6dhe_g/reset.c b/src/mainboard/supermicro/x6dhe_g/reset.c
index b09b708..5364632 100644
--- a/src/mainboard/supermicro/x6dhe_g/reset.c
+++ b/src/mainboard/supermicro/x6dhe_g/reset.c
@@ -1,7 +1,7 @@
 #include <arch/io.h>
 #include <device/pci_def.h>
 #include <device/pci_ids.h>
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ops.h>
diff --git a/src/mainboard/supermicro/x6dhe_g2/reset.c b/src/mainboard/supermicro/x6dhe_g2/reset.c
index b09b708..5364632 100644
--- a/src/mainboard/supermicro/x6dhe_g2/reset.c
+++ b/src/mainboard/supermicro/x6dhe_g2/reset.c
@@ -1,7 +1,7 @@
 #include <arch/io.h>
 #include <device/pci_def.h>
 #include <device/pci_ids.h>
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ops.h>
diff --git a/src/mainboard/supermicro/x6dhr_ig/reset.c b/src/mainboard/supermicro/x6dhr_ig/reset.c
index b09b708..5364632 100644
--- a/src/mainboard/supermicro/x6dhr_ig/reset.c
+++ b/src/mainboard/supermicro/x6dhr_ig/reset.c
@@ -1,7 +1,7 @@
 #include <arch/io.h>
 #include <device/pci_def.h>
 #include <device/pci_ids.h>
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ops.h>
diff --git a/src/mainboard/supermicro/x6dhr_ig2/reset.c b/src/mainboard/supermicro/x6dhr_ig2/reset.c
index b09b708..5364632 100644
--- a/src/mainboard/supermicro/x6dhr_ig2/reset.c
+++ b/src/mainboard/supermicro/x6dhr_ig2/reset.c
@@ -1,7 +1,7 @@
 #include <arch/io.h>
 #include <device/pci_def.h>
 #include <device/pci_ids.h>
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ops.h>
diff --git a/src/mainboard/technexion/tim5690/cache_as_ram_auto.c b/src/mainboard/technexion/tim5690/cache_as_ram_auto.c
index ce2d6b3..7e4e100 100644
--- a/src/mainboard/technexion/tim5690/cache_as_ram_auto.c
+++ b/src/mainboard/technexion/tim5690/cache_as_ram_auto.c
@@ -18,7 +18,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define K8_SET_FIDVID 1
diff --git a/src/mainboard/technexion/tim8690/cache_as_ram_auto.c b/src/mainboard/technexion/tim8690/cache_as_ram_auto.c
index 2640707..ff86ba3 100644
--- a/src/mainboard/technexion/tim8690/cache_as_ram_auto.c
+++ b/src/mainboard/technexion/tim8690/cache_as_ram_auto.c
@@ -18,7 +18,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define K8_SET_FIDVID 1
diff --git a/src/mainboard/tyan/s2735/cache_as_ram_auto.c b/src/mainboard/tyan/s2735/cache_as_ram_auto.c
index 8656d3d..99a38a9 100644
--- a/src/mainboard/tyan/s2735/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2735/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/tyan/s2850/cache_as_ram_auto.c b/src/mainboard/tyan/s2850/cache_as_ram_auto.c
index 871e2ba..352fead 100644
--- a/src/mainboard/tyan/s2850/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2850/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/tyan/s2875/cache_as_ram_auto.c b/src/mainboard/tyan/s2875/cache_as_ram_auto.c
index 56fbdae..50b12f1 100644
--- a/src/mainboard/tyan/s2875/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2875/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/tyan/s2880/cache_as_ram_auto.c b/src/mainboard/tyan/s2880/cache_as_ram_auto.c
index db520eb..c97f3b7 100644
--- a/src/mainboard/tyan/s2880/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2880/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/tyan/s2881/cache_as_ram_auto.c b/src/mainboard/tyan/s2881/cache_as_ram_auto.c
index 69000f1..9d5edcb 100644
--- a/src/mainboard/tyan/s2881/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2881/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define QRANK_DIMM_SUPPORT 1
 
diff --git a/src/mainboard/tyan/s2882/cache_as_ram_auto.c b/src/mainboard/tyan/s2882/cache_as_ram_auto.c
index 1fd98ff..cdea693 100644
--- a/src/mainboard/tyan/s2882/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2882/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/tyan/s2885/cache_as_ram_auto.c b/src/mainboard/tyan/s2885/cache_as_ram_auto.c
index edea2b9..d561e03 100644
--- a/src/mainboard/tyan/s2885/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2885/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/tyan/s2891/cache_as_ram_auto.c b/src/mainboard/tyan/s2891/cache_as_ram_auto.c
index 93b640a..9ace5e3 100644
--- a/src/mainboard/tyan/s2891/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2891/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 //used by raminit
 #define QRANK_DIMM_SUPPORT 1
diff --git a/src/mainboard/tyan/s2892/cache_as_ram_auto.c b/src/mainboard/tyan/s2892/cache_as_ram_auto.c
index ffe1103..e94017e 100644
--- a/src/mainboard/tyan/s2892/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2892/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define QRANK_DIMM_SUPPORT 1
 
diff --git a/src/mainboard/tyan/s2895/cache_as_ram_auto.c b/src/mainboard/tyan/s2895/cache_as_ram_auto.c
index 77bd04d..78ddd1c 100644
--- a/src/mainboard/tyan/s2895/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2895/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define K8_ALLOCATE_IO_RANGE 1
 
diff --git a/src/mainboard/tyan/s2895/failover.c b/src/mainboard/tyan/s2895/failover.c
index cb70a2e..25f488d 100644
--- a/src/mainboard/tyan/s2895/failover.c
+++ b/src/mainboard/tyan/s2895/failover.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/tyan/s2912/apc_auto.c b/src/mainboard/tyan/s2912/apc_auto.c
index 880d06a..3e98a5c 100644
--- a/src/mainboard/tyan/s2912/apc_auto.c
+++ b/src/mainboard/tyan/s2912/apc_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/tyan/s2912/cache_as_ram_auto.c b/src/mainboard/tyan/s2912/cache_as_ram_auto.c
index 8fb6473..ce46630 100644
--- a/src/mainboard/tyan/s2912/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2912/cache_as_ram_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/tyan/s2912_fam10/apc_auto.c b/src/mainboard/tyan/s2912_fam10/apc_auto.c
index 880d06a..3e98a5c 100644
--- a/src/mainboard/tyan/s2912_fam10/apc_auto.c
+++ b/src/mainboard/tyan/s2912_fam10/apc_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
diff --git a/src/mainboard/tyan/s2912_fam10/cache_as_ram_auto.c b/src/mainboard/tyan/s2912_fam10/cache_as_ram_auto.c
index f085a69..1216c29 100644
--- a/src/mainboard/tyan/s2912_fam10/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s2912_fam10/cache_as_ram_auto.c
@@ -20,7 +20,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 
 #define RAMINIT_SYSINFO 1
 
diff --git a/src/mainboard/tyan/s4880/cache_as_ram_auto.c b/src/mainboard/tyan/s4880/cache_as_ram_auto.c
index 61085a8..9f38ec1 100644
--- a/src/mainboard/tyan/s4880/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s4880/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/tyan/s4882/cache_as_ram_auto.c b/src/mainboard/tyan/s4882/cache_as_ram_auto.c
index 88637b6..1c8d3b4 100644
--- a/src/mainboard/tyan/s4882/cache_as_ram_auto.c
+++ b/src/mainboard/tyan/s4882/cache_as_ram_auto.c
@@ -1,5 +1,5 @@
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
  
 #include <stdint.h>
 #include <string.h>
diff --git a/src/mainboard/via/epia-m700/cache_as_ram_auto.c b/src/mainboard/via/epia-m700/cache_as_ram_auto.c
index 9c6036a..45e8118 100644
--- a/src/mainboard/via/epia-m700/cache_as_ram_auto.c
+++ b/src/mainboard/via/epia-m700/cache_as_ram_auto.c
@@ -23,7 +23,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
 
diff --git a/src/northbridge/amd/amdfam10/amdfam10.h b/src/northbridge/amd/amdfam10/amdfam10.h
index 4cca443..8260371 100644
--- a/src/northbridge/amd/amdfam10/amdfam10.h
+++ b/src/northbridge/amd/amdfam10/amdfam10.h
@@ -956,7 +956,7 @@
 
 #include "amdfam10_nums.h"
 
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 #if NODE_NUMS==64
 	 #define NODE_PCI(x, fn) ((x<32)?(PCI_DEV(CONFIG_CBB,(CONFIG_CDB+x),fn)):(PCI_DEV((CONFIG_CBB-1),(CONFIG_CDB+x-32),fn)))
 #else
@@ -1086,7 +1086,7 @@
 
 #if CONFIG_AMDMCT == 0
 
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 static void soft_reset(void);
 #endif
 static void wait_all_core0_mem_trained(struct sys_info *sysinfo)
@@ -1131,7 +1131,7 @@
 	}
 
 	for(i=0; i<sysinfo->nodes; i++) {
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 		print_debug("mem_trained["); print_debug_hex8(i); print_debug("]="); print_debug_hex8(sysinfo->mem_trained[i]); print_debug("\n");
 #else
 		printk_debug("mem_trained[%02x]=%02x\n", i, sysinfo->mem_trained[i]);
@@ -1148,7 +1148,7 @@
 		}
 	}
 	if(needs_reset) {
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 		print_debug("mem trained failed\n");
 		soft_reset();
 #else
diff --git a/src/northbridge/amd/amdfam10/amdfam10_conf.c b/src/northbridge/amd/amdfam10/amdfam10_conf.c
index cd958c5..b52beda 100644
--- a/src/northbridge/amd/amdfam10/amdfam10_conf.c
+++ b/src/northbridge/amd/amdfam10/amdfam10_conf.c
@@ -17,7 +17,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 typedef struct sys_info sys_info_conf_t;
 #else
 typedef struct amdfam10_sysconf_t sys_info_conf_t;
@@ -32,7 +32,7 @@
 {
 	device_t dev;
 	struct dram_base_mask_t d;
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = PCI_DEV(CONFIG_CBB, CONFIG_CDB, 1);
 #else
 	dev = __f1_dev[0];
@@ -88,7 +88,7 @@
 #endif
 
 	for(i=0;i<nodes;i++) {
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 		dev = NODE_PCI(i, 1);
 #else
 		dev = __f1_dev[i];
@@ -108,7 +108,7 @@
 #endif
 	}
 
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(nodeid, 1);
 #else
 	dev = __f1_dev[nodeid];
@@ -122,7 +122,7 @@
 static void set_DctSelBaseAddr(u32 i, u32 sel_m)
 {
 	device_t dev;
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(i, 2);
 #else
 		dev = __f2_dev[i];
@@ -139,7 +139,7 @@
 static u32 get_DctSelBaseAddr(u32 i)
 {
 	device_t dev;
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(i, 2);
 #else
 		dev = __f2_dev[i];
@@ -156,7 +156,7 @@
 static void set_DctSelHiEn(u32 i, u32 val)
 {
 	device_t dev;
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(i, 2);
 #else
 		dev = __f2_dev[i];
@@ -172,7 +172,7 @@
 static u32 get_DctSelHiEn(u32 i)
 {
 	device_t dev;
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(i, 2);
 #else
 	dev = __f2_dev[i];
@@ -187,7 +187,7 @@
 static void set_DctSelBaseOffset(u32 i, u32 sel_off_m)
 {
 	device_t dev;
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(i, 2);
 #else
 	dev = __f2_dev[i];
@@ -203,7 +203,7 @@
 static u32 get_DctSelBaseOffset(u32 i)
 {
 	device_t dev;
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(i, 2);
 #else
 	dev = __f2_dev[i];
@@ -264,7 +264,7 @@
 	d = get_dram_base_mask(i);
 	d.mask += (carry_over>>9);
 	set_dram_base_mask(i,d, nodes);
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(i, 1);
 #else
 	dev = __f1_dev[i];
@@ -330,7 +330,7 @@
 	index_max = busn_max>>2; dest_max = busn_max - (index_max<<2);
 
 	// three case: index_min==index_max, index_min+1=index_max; index_min+1<index_max
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(nodeid, 1);
 #else
 	dev = __f1_dev[nodeid];
@@ -393,7 +393,7 @@
 #endif
 		tempreg = 3 | ((nodeid&0xf)<<4) | ((nodeid & 0x30)<<(12-4))|(linkn<<8)|((busn_min & 0xff)<<16)|((busn_max&0xff)<<24);
 		for(i=0; i<nodes; i++) {
-		#if defined(__ROMCC__)
+		#if defined(__PRE_RAM__)
 			dev = NODE_PCI(i, 1);
 		#else
 			dev = __f1_dev[i];
@@ -433,7 +433,7 @@
 	if(ht_c_index<4) {
 #endif
 		for(i=0; i<nodes; i++) {
-		#if defined(__ROMCC__)
+		#if defined(__PRE_RAM__)
 			dev = NODE_PCI(i, 1);
 		#else
 			dev = __f1_dev[i];
@@ -480,7 +480,7 @@
 }
 #endif
 
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 static void set_ht_c_io_addr_reg(u32 nodeid, u32 linkn, u32 ht_c_index,
 					u32 io_min, u32 io_max, u32 nodes)
 {
@@ -494,7 +494,7 @@
 		/* io range allocation */
 		tempreg = (nodeid&0xf) | ((nodeid & 0x30)<<(8-4)) | (linkn<<4) |  ((io_max&0xf0)<<(12-4)); //limit
 		for(i=0; i<nodes; i++) {
-		#if defined(__ROMCC__)
+		#if defined(__PRE_RAM__)
 			dev = NODE_PCI(i, 1);
 		#else
 			dev = __f1_dev[i];
@@ -503,7 +503,7 @@
 		}
 		tempreg = 3 /*| ( 3<<4)*/ | ((io_min&0xf0)<<(12-4));	     //base :ISA and VGA ?
 		for(i=0; i<nodes; i++){
-		#if defined(__ROMCC__)
+		#if defined(__PRE_RAM__)
 			dev = NODE_PCI(i, 1);
 		#else
 			dev = __f1_dev[i];
@@ -546,7 +546,7 @@
 #endif
 		 /* io range allocation */
 		for(i=0; i<nodes; i++) {
-		#if defined(__ROMCC__)
+		#if defined(__PRE_RAM__)
 			dev = NODE_PCI(i, 1);
 		#else
 			dev = __f1_dev[i];
@@ -584,7 +584,7 @@
 	for(ht_c_index=1;ht_c_index<4; ht_c_index++) {
 		u32 i;
 		for(i=0; i<nodes; i++) {
-		#if defined(__ROMCC__)
+		#if defined(__PRE_RAM__)
 			dev = NODE_PCI(i, 1);
 		#else
 			dev = __f1_dev[i];
@@ -664,7 +664,7 @@
 	u32 dword;
 	device_t dev;
 
-#if defined(__ROMCC__)
+#if defined(__PRE_RAM__)
 	dev = NODE_PCI(node, 0);
 #else
 	dev = __f0_dev[node];
@@ -677,7 +677,7 @@
 #endif
 }
 
-#if !defined(__ROMCC__)
+#if !defined(__PRE_RAM__)
 static u32 get_io_addr_index(u32 nodeid, u32 linkn)
 {
 	u32 index;
diff --git a/src/northbridge/amd/amdk8/amdk8_f.h b/src/northbridge/amd/amdk8/amdk8_f.h
index 68f9655..7010e80 100644
--- a/src/northbridge/amd/amdk8/amdk8_f.h
+++ b/src/northbridge/amd/amdk8/amdk8_f.h
@@ -518,7 +518,7 @@
 	uint32_t sbbusn;
 } __attribute__((packed));
 
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 static void soft_reset(void);
 #else
 void hard_reset(void);
@@ -562,7 +562,7 @@
 	}
 
 	for(i=0; i<sysinfo->nodes; i++) {
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 		print_debug("mem_trained["); print_debug_hex8(i); print_debug("]="); print_debug_hex8(sysinfo->mem_trained[i]); print_debug("\r\n");
 #else
 		printk_debug("mem_trained[%02x]=%02x\n", i, sysinfo->mem_trained[i]); 
@@ -579,7 +579,7 @@
 		}
 	}
 	if(needs_reset) {
-#ifdef __ROMCC__
+#ifdef __PRE_RAM__
 		print_debug("mem trained failed\r\n");
 		soft_reset();
 #else
diff --git a/src/northbridge/via/cn700/cn700.h b/src/northbridge/via/cn700/cn700.h
index a98af45..400aaf3 100644
--- a/src/northbridge/via/cn700/cn700.h
+++ b/src/northbridge/via/cn700/cn700.h
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef __ROMCC__
+#if !defined (__ROMCC__) && !defined (__PRE_RAM__)
 static void cn700_noop()
 {
 }
diff --git a/src/northbridge/via/vx800/examples/cache_as_ram_auto.c b/src/northbridge/via/vx800/examples/cache_as_ram_auto.c
index 30204432..fa8962b 100644
--- a/src/northbridge/via/vx800/examples/cache_as_ram_auto.c
+++ b/src/northbridge/via/vx800/examples/cache_as_ram_auto.c
@@ -19,7 +19,7 @@
  */
 
 #define ASSEMBLY 1
-#define __ROMCC__
+#define __PRE_RAM__
 #define RAMINIT_SYSINFO 1
 #define CACHE_AS_RAM_ADDRESS_DEBUG 0
 
diff --git a/src/southbridge/amd/cs5530/cs5530.h b/src/southbridge/amd/cs5530/cs5530.h
index 107b6f2..283b64de 100644
--- a/src/southbridge/amd/cs5530/cs5530.h
+++ b/src/southbridge/amd/cs5530/cs5530.h
@@ -21,7 +21,7 @@
 #ifndef SOUTHBRIDGE_AMD_CS5530_CS5530_H
 #define SOUTHBRIDGE_AMD_CS5530_CS5530_H
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 #include "chip.h"
 void cs5530_enable(device_t dev);
 #endif
diff --git a/src/southbridge/intel/i82371eb/i82371eb.h b/src/southbridge/intel/i82371eb/i82371eb.h
index 00c19e0..f105571 100644
--- a/src/southbridge/intel/i82371eb/i82371eb.h
+++ b/src/southbridge/intel/i82371eb/i82371eb.h
@@ -21,7 +21,7 @@
 #ifndef SOUTHBRIDGE_INTEL_I82371EB_I82371EB_H
 #define SOUTHBRIDGE_INTEL_I82371EB_I82371EB_H
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 #include "chip.h"
 void i82371eb_enable(device_t dev);
 void i82371eb_hard_reset(void);
diff --git a/src/southbridge/intel/i82801ca/i82801ca.h b/src/southbridge/intel/i82801ca/i82801ca.h
index 59056f2..a761056 100644
--- a/src/southbridge/intel/i82801ca/i82801ca.h
+++ b/src/southbridge/intel/i82801ca/i82801ca.h
@@ -1,7 +1,7 @@
 #ifndef I82801CA_H
 #define I82801CA_H
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 #include "chip.h"
 extern void i82801ca_enable(device_t dev);
 #endif
diff --git a/src/southbridge/intel/i82801gx/i82801gx.h b/src/southbridge/intel/i82801gx/i82801gx.h
index 9b54fc6..5c29c9e 100644
--- a/src/southbridge/intel/i82801gx/i82801gx.h
+++ b/src/southbridge/intel/i82801gx/i82801gx.h
@@ -41,7 +41,7 @@
 /* __ROMCC__ is set by auto.c to make sure
  * none of the stage2 data structures are included.
  */
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 #include "chip.h"
 extern void i82801gx_enable(device_t dev);
 #endif
diff --git a/src/southbridge/intel/i82801xx/i82801xx.h b/src/southbridge/intel/i82801xx/i82801xx.h
index 27ce21c..d90cc32 100644
--- a/src/southbridge/intel/i82801xx/i82801xx.h
+++ b/src/southbridge/intel/i82801xx/i82801xx.h
@@ -21,7 +21,7 @@
 #ifndef SOUTHBRIDGE_INTEL_I82801XX_I82801XX_H
 #define SOUTHBRIDGE_INTEL_I82801XX_I82801XX_H
 
-#ifndef __ROMCC__
+#if !defined( __ROMCC__ ) && !defined(__PRE_RAM__)
 #include "chip.h"
 extern void i82801xx_enable(device_t dev);
 #endif