4 #include <device/pci_def.h>
6 #include <device/pnp_def.h>
7 #include <arch/romcc_io.h>
9 #include "pc80/serial.c"
10 #include "arch/i386/lib/console.c"
11 #include "ram/ramtest.c"
12 #include "southbridge/intel/i440bx/i440bx_early_smbus.c"
13 #include "superio/NSC/pc87351/pc87351_early_serial.c"
14 #include "northbridge/intel/i440bx/raminit.h"
15 #include "cpu/x86/mtrr/earlymtrr.c"
16 #include "cpu/x86/bist.h"
18 #define SERIAL_DEV PNP_DEV(0x2e, PC87351_SP1)
22 void udelay(int usecs)
25 for(i = 0; i < usecs; i++)
30 #include "lib/delay.c"
33 static void memreset_setup(void)
38 static void memreset(int controllers, const struct mem_controller *ctrl)
44 static void enable_mainboard_devices(void)
47 /* dev 0 for southbridge */
49 dev = pci_locate_device(PCI_ID(0x1106,0x8231), 0);
51 if (dev == PCI_DEV_INVALID) {
52 die("Southbridge not found!!!\n");
54 pci_write_config8(dev, 0x50, 7);
55 pci_write_config8(dev, 0x51, 0xff);
57 // This early setup switches IDE into compatibility mode before PCI gets
58 // // a chance to assign I/Os
59 // movl $CONFIG_ADDR(0, 0x89, 0x42), %eax
62 // PCI_WRITE_CONFIG_BYTE
65 /* we do this here as in V2, we can not yet do raw operations
68 dev += 0x100; /* ICKY */
70 pci_write_config8(dev, 0x42, 0);
73 static void enable_shadow_ram(void)
75 device_t dev = 0; /* no need to look up 0:0.0 */
76 unsigned char shadowreg;
77 /* dev 0 for southbridge */
78 shadowreg = pci_read_config8(dev, 0x63);
81 pci_write_config8(dev, 0x63, shadowreg);
84 static inline int spd_read_byte(unsigned device, unsigned address)
87 c = smbus_read_byte(device, address);
92 #include "northbridge/intel/i440bx/raminit.c"
93 #include "northbridge/intel/i440bx/debug.c"
94 #include "sdram/generic_sdram.c"
96 static void main(unsigned long bist)
98 static const struct mem_controller cpu[] = {
103 (0xa << 3) | 2, (0xa << 3) | 3,
112 pc87351_enable_serial(SERIAL_DEV, TTYS0_BASE);
116 /* Halt if there was a built in self test failure */
117 report_bist_failure(bist);
120 dump_spd_registers(&cpu[0]);
126 this is way more generic than we need.
127 sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu);
129 sdram_set_registers((const struct mem_controller *) 0);
130 sdram_set_spd_registers((const struct mem_controller *) 0);
131 sdram_enable(0, (const struct mem_controller *) 0);
134 /* Check all of memory */
136 ram_check(0x00000000, msr.lo);
139 static const struct {
140 unsigned long lo, hi;
142 /* Check 16MB of memory @ 0*/
143 { 0x00000000, 0x01000000 },
145 /* Check 16MB of memory @ 2GB */
146 { 0x80000000, 0x81000000 },
150 for(i = 0; i < sizeof(check_addrs)/sizeof(check_addrs[0]); i++) {
151 ram_check(check_addrs[i].lo, check_addrs[i].hi);