2 * This file is part of the coreboot project.
4 * Copyright (C) 2008-2010 Joseph Smith <joe@settoplinux.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <device/pci_def.h>
28 #include <device/pnp_def.h>
29 #include <arch/romcc_io.h>
31 #include <arch/llshell.h>
32 #include "pc80/serial.c"
33 #include "pc80/udelay_io.c"
34 #include "arch/i386/lib/console.c"
35 #include "lib/ramtest.c"
36 #include "superio/smsc/smscsuperio/smscsuperio_early_serial.c"
37 #include "northbridge/intel/i82830/raminit.h"
38 #include "northbridge/intel/i82830/memory_initialized.c"
39 #include "southbridge/intel/i82801dx/i82801dx.h"
40 #include "southbridge/intel/i82801dx/i82801dx_reset.c"
41 #include "cpu/x86/mtrr/earlymtrr.c"
42 #include "cpu/x86/bist.h"
43 #include "spd_table.h"
46 #define SERIAL_DEV PNP_DEV(0x2e, SMSCSUPERIO_SP1)
48 #include "southbridge/intel/i82801dx/i82801dx_early_smbus.c"
49 #include "southbridge/intel/i82801dx/i82801dx_tco_timer.c"
52 * The onboard 64MB PC133 memory does not have a SPD EEPROM so the
53 * values have to be set manually, the SO-DIMM socket is located in
54 * socket0 (0x50), and the onboard memory is located in socket1 (0x51).
56 static inline int spd_read_byte(unsigned device, unsigned address)
61 return smbus_read_byte(device, address);
62 } else if (device == 0x51) {
63 for (i = 0; i < ARRAY_SIZE(spd_table); i++) {
64 if (spd_table[i].address == address)
65 return spd_table[i].data;
67 return 0xFF; /* Return 0xFF when address is not found. */
69 return 0xFF; /* Return 0xFF on any failures. */
73 #include "northbridge/intel/i82830/raminit.c"
76 * Setup mainboard specific registers pre raminit.
78 static void mb_early_setup(void)
80 /* - Hub Interface to PCI Bridge Registers - */
81 /* 12-Clock Retry Enable */
82 pci_write_config16(PCI_DEV(0, 0x1e, 0), 0x50, 0x1402);
83 /* Master Latency Timer Count */
84 pci_write_config8(PCI_DEV(0, 0x1e, 0), 0x1b, 0x20);
85 /* I/O Address Base */
86 pci_write_config8(PCI_DEV(0, 0x1e, 0), 0x1c, 0xf0);
88 /* - LPC Interface Bridge Registers - */
89 /* Delayed Transaction Enable */
90 pci_write_config32(PCI_DEV(0, 0x1f, 0), 0xd0, 0x00000002);
91 /* Disable the TCO Timer system reboot feature */
92 pci_write_config8(PCI_DEV(0, 0x1f, 0), 0xd4, 0x02);
93 /* CPU Frequency Strap */
94 pci_write_config8(PCI_DEV(0, 0x1f, 0), 0xd5, 0x02);
95 /* ACPI base address and enable Resource Indicator */
96 pci_write_config32(PCI_DEV(0, 0x1f, 0), PMBASE, (PMBASE_ADDR | 1));
97 /* Enable the SMBUS */
99 /* ACPI base address and disable Resource Indicator */
100 pci_write_config32(PCI_DEV(0, 0x1f, 0), PMBASE, (PMBASE_ADDR));
102 pci_write_config8(PCI_DEV(0, 0x1f, 0), ACPI_CNTL, 0x10);
105 static void main(unsigned long bist)
109 if (memory_initialized()) {
114 /* Set southbridge and superio gpios */
117 smscsuperio_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
121 /* Halt if there was a built in self test failure. */
122 report_bist_failure(bist);
124 /* disable TCO timers */
125 i82801dx_halt_tco_timer();
127 /* Setup mainboard specific registers */
130 /* Initialize memory */
137 /* ram_check(0, 640 * 1024); */
138 /* ram_check(64512 * 1024, 65536 * 1024); */