aboutsummaryrefslogtreecommitdiff
path: root/src/northbridge/intel/i82810
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coreboot.org>2010-12-27 11:34:57 +0000
committerStefan Reinauer <stepan@openbios.org>2010-12-27 11:34:57 +0000
commit3c0bfaf7da0f93d6887c0a99b85a43cffbcbf6e2 (patch)
treea2f502e313bf2fd72aea77d514594509191094cf /src/northbridge/intel/i82810
parentacda2fc9acaa02b97efec9b82835306ef85ac90c (diff)
Fix most CONFIG_DEBUG_RAM_SETUP issues.
The intel/xe7501devkit is still broken, I think the (romcc) image is too big to fit in the bootblock if CONFIG_DEBUG_RAM_SETUP is enabled. It would make sense to convert all CPU_INTEL_SOCKET_MPGA604 to CAR, but I have no hardware to test. Signed-off-by: Stefan Reinauer <stepan@coreboot.org> Acked-by: Stefan Reinauer <stepan@coreboot.org> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6215 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/northbridge/intel/i82810')
-rw-r--r--src/northbridge/intel/i82810/debug.c40
-rw-r--r--src/northbridge/intel/i82810/raminit.c65
-rw-r--r--src/northbridge/intel/i82810/raminit.h4
3 files changed, 58 insertions, 51 deletions
diff --git a/src/northbridge/intel/i82810/debug.c b/src/northbridge/intel/i82810/debug.c
index 16a908993a..88adc24ab1 100644
--- a/src/northbridge/intel/i82810/debug.c
+++ b/src/northbridge/intel/i82810/debug.c
@@ -1,8 +1,13 @@
+#include <console/console.h>
+#include <arch/io.h>
+#include <arch/romcc_io.h>
+#include <spd.h>
+#include "i82810.h"
#include "raminit.h"
+#if CONFIG_DEBUG_RAM_SETUP
void dump_spd_registers(void)
{
-#if CONFIG_DEBUG_RAM_SETUP
int i;
print_debug("\n");
for(i = 0; i < DIMM_SOCKETS; i++) {
@@ -34,5 +39,36 @@ void dump_spd_registers(void)
print_debug("\n");
}
}
-#endif
}
+
+static void print_debug_pci_dev(unsigned dev)
+{
+ print_debug("PCI: ");
+ print_debug_hex8((dev >> 16) & 0xff);
+ print_debug_char(':');
+ print_debug_hex8((dev >> 11) & 0x1f);
+ print_debug_char('.');
+ print_debug_hex8((dev >> 8) & 7);
+}
+
+void dump_pci_device(unsigned dev)
+{
+ int i;
+ print_debug_pci_dev(dev);
+ print_debug("\n");
+
+ for (i = 0; i <= 255; i++) {
+ unsigned char val;
+ if ((i & 0x0f) == 0) {
+ print_debug_hex8(i);
+ print_debug_char(':');
+ }
+ val = pci_read_config8(dev, i);
+ print_debug_char(' ');
+ print_debug_hex8(val);
+ if ((i & 0x0f) == 0x0f) {
+ print_debug("\n");
+ }
+ }
+}
+#endif
diff --git a/src/northbridge/intel/i82810/raminit.c b/src/northbridge/intel/i82810/raminit.c
index df2916e835..39507eb992 100644
--- a/src/northbridge/intel/i82810/raminit.c
+++ b/src/northbridge/intel/i82810/raminit.c
@@ -35,17 +35,12 @@ Macros and definitions.
-----------------------------------------------------------------------------*/
/* Debugging macros. */
-#define HAVE_ENOUGH_REGISTERS 0 /* Don't have enough registers to compile all
- * debugging code with ROMCC
- */
#if CONFIG_DEBUG_RAM_SETUP
-#define PRINT_DEBUG(x) print_debug(x)
-#define PRINT_DEBUG_HEX8(x) print_debug_hex8(x)
-#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x)
-#define PRINT_DEBUG_HEX32(x) print_debug_hex32(x)
-// no dump_pci_device in src/northbridge/intel/i82810/
-// #define DUMPNORTH() dump_pci_device(PCI_DEV(0, 0, 0))
-#define DUMPNORTH()
+#define PRINT_DEBUG(x...) printk(BIOS_DEBUG, x)
+#define PRINT_DEBUG_HEX8(x) printk(BIOS_DEBUG, "%02x", x)
+#define PRINT_DEBUG_HEX16(x) printk(BIOS_DEBUG, "%04x", x)
+#define PRINT_DEBUG_HEX32(x) printk(BIOS_DEBUG, "%08x", x)
+#define DUMPNORTH() dump_pci_device(PCI_DEV(0, 0, 0))
#else
#define PRINT_DEBUG(x)
#define PRINT_DEBUG_HEX8(x)
@@ -209,27 +204,14 @@ static void do_ram_command(u8 command)
dimm_size = translate_i82810_to_mb[drp];
if (dimm_size) {
addr = (dimm_start * 1024 * 1024) + addr_offset;
-#if HAVE_ENOUGH_REGISTERS
- PRINT_DEBUG(" Sending RAM command 0x");
- PRINT_DEBUG_HEX8(reg8);
- PRINT_DEBUG(" to 0x");
- PRINT_DEBUG_HEX32(addr);
- PRINT_DEBUG("\n");
-#endif
-
+ PRINT_DEBUG(" Sending RAM command 0x%02x to 0x%08x\n", reg8, addr);
read32(addr);
}
dimm_bank = translate_i82810_to_bank[drp];
if (dimm_bank) {
addr = ((dimm_start + dimm_bank) * 1024 * 1024) + addr_offset;
-#if HAVE_ENOUGH_REGISTERS
- PRINT_DEBUG(" Sending RAM command 0x");
- PRINT_DEBUG_HEX8(reg8);
- PRINT_DEBUG(" to 0x");
- PRINT_DEBUG_HEX32(addr);
- PRINT_DEBUG("\n");
-#endif
+ PRINT_DEBUG(" Sending RAM command 0x%02x to 0x%08x\n", reg8, addr);
read32(addr);
}
@@ -256,16 +238,11 @@ static void spd_set_dram_size(void)
for (i = 0; i < DIMM_SOCKETS; i++) {
/* First check if a DIMM is actually present. */
if (smbus_read_byte(DIMM0 + i, 2) == 4) {
- print_debug("Found DIMM in slot ");
- print_debug_hex8(i);
- print_debug("\n");
+ printk(BIOS_DEBUG, "Found DIMM in slot %d\n", i);
dimm_size = smbus_read_byte(DIMM0 + i, 31);
- /* WISHLIST: would be nice to display it as decimal? */
- print_debug("DIMM is 0x");
- print_debug_hex8(dimm_size * 4);
- print_debug("MB\n");
+ printk(BIOS_DEBUG, "DIMM is %dMB\n", dimm_size * 4);
/* The i810 can't handle DIMMs larger than 128MB per
* side. This will fail if the DIMM uses a
@@ -274,10 +251,10 @@ static void spd_set_dram_size(void)
* Note: the factory BIOS just dies if it spots this :D
*/
if (dimm_size > 32) {
- print_err("DIMM row sizes larger than 128MB not"
+ printk(BIOS_ERR, "DIMM row sizes larger than 128MB not"
"supported on i810\n");
- print_err
- ("Attempting to treat as 128MB DIMM\n");
+ printk
+ (BIOS_ERR, "Attempting to treat as 128MB DIMM\n");
dimm_size = 32;
}
@@ -287,21 +264,17 @@ static void spd_set_dram_size(void)
*/
dimm_size = translate_spd_to_i82810[dimm_size];
- print_debug("After translation, dimm_size is 0x");
- print_debug_hex8(dimm_size);
- print_debug("\n");
+ printk(BIOS_DEBUG, "After translation, dimm_size is %d\n", dimm_size);
/* If the DIMM is dual-sided, the DRP value is +2 */
/* TODO: Figure out asymetrical configurations. */
if ((smbus_read_byte(DIMM0 + i, 127) | 0xf) ==
0xff) {
- print_debug("DIMM is dual-sided\n");
+ printk(BIOS_DEBUG, "DIMM is dual-sided\n");
dimm_size += 2;
}
} else {
- print_debug("No DIMM found in slot ");
- print_debug_hex8(i);
- print_debug("\n");
+ printk(BIOS_DEBUG, "No DIMM found in slot %d\n", i);
/* If there's no DIMM in the slot, set value to 0. */
dimm_size = 0x00;
@@ -311,9 +284,7 @@ static void spd_set_dram_size(void)
drp |= dimm_size << (i * 4);
}
- print_debug("DRP calculated to 0x");
- print_debug_hex8(drp);
- print_debug("\n");
+ printk(BIOS_DEBUG, "DRP calculated to 0x%02x\n", drp);
pci_write_config8(PCI_DEV(0, 0, 0), DRP, drp);
}
@@ -414,9 +385,7 @@ static void set_dram_buffer_strength(void)
if (!d0.size && d1.size)
buff_sc |= 1 << 15;
- print_debug("BUFF_SC calculated to 0x");
- print_debug_hex16(buff_sc);
- print_debug("\n");
+ printk(BIOS_DEBUG, "BUFF_SC calculated to 0x%04x\n", buff_sc);
pci_write_config16(PCI_DEV(0, 0, 0), BUFF_SC, buff_sc);
}
diff --git a/src/northbridge/intel/i82810/raminit.h b/src/northbridge/intel/i82810/raminit.h
index 186589a759..5279effce3 100644
--- a/src/northbridge/intel/i82810/raminit.h
+++ b/src/northbridge/intel/i82810/raminit.h
@@ -28,6 +28,8 @@
void sdram_set_registers(void);
void sdram_set_spd_registers(void);
void sdram_enable(void);
-void dump_spd_registers(void);
+/* Debug */
+void dump_spd_registers(void);
+void dump_pci_device(unsigned dev);
#endif