From 65b72ab55d7dff1f13cdf495d345e04e634b97ac Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Mon, 5 Jan 2015 12:59:54 -0800 Subject: northbridge: Drop print_ implementation from non-romcc boards Because we had no stack on romcc boards, we had a separate, not as powerful clone of printk: print_*. Back in the day, like more than half a decade ago, we migrated a lot of boards to printk, but we never cleaned up the existing code to be consistent. instead, we worked around the problem with a very messy console.h (nowadays the mess is hidden in romstage_console.c and early_print.h) This patch cleans up the northbridge code to use printk() on all non-ROMCC boards. Change-Id: I4a36cd965c58aae65d74ce1e697dc0d0f58f47a1 Signed-off-by: Stefan Reinauer Reviewed-on: http://review.coreboot.org/7856 Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- src/northbridge/via/vx800/early_smbus.c | 50 +++++++++++++-------------------- src/northbridge/via/vx800/raminit.c | 8 +++--- 2 files changed, 24 insertions(+), 34 deletions(-) (limited to 'src/northbridge/via/vx800') diff --git a/src/northbridge/via/vx800/early_smbus.c b/src/northbridge/via/vx800/early_smbus.c index f9b13eb88c..da2a55947e 100644 --- a/src/northbridge/via/vx800/early_smbus.c +++ b/src/northbridge/via/vx800/early_smbus.c @@ -50,42 +50,38 @@ #define SMBUS_DELAY() outb(0x80, 0x80) #if CONFIG_DEBUG_SMBUS -#define PRINT_DEBUG(x) print_debug(x) -#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x) +#define DEBUG(x...) printk(BIOS_DEBUG, x) #else -#define PRINT_DEBUG(x) -#define PRINT_DEBUG_HEX16(x) +#define DEBUG(x...) while (0) { } #endif /* Internal functions */ static void smbus_print_error(unsigned char host_status_register, int loops) { -// print_err("some i2c error\n"); +// printk(BIOS_ERR, "some i2c error\n"); /* Check if there actually was an error */ if (host_status_register == 0x00 || host_status_register == 0x40 || host_status_register == 0x42) return; - print_err("smbus_error: "); - print_err_hex8(host_status_register); - print_err("\n"); + printk(BIOS_ERR, "smbus_error: %02x\n", host_status_register); if (loops >= SMBUS_TIMEOUT) { - print_err("SMBus Timout\n"); + printk(BIOS_ERR, "SMBus Timout\n"); } if (host_status_register & (1 << 4)) { - print_err("Interrup/SMI# was Failed Bus Transaction\n"); + printk(BIOS_ERR, "Interrup/SMI# was Failed Bus Transaction\n"); } if (host_status_register & (1 << 3)) { - print_err("Bus Error\n"); + printk(BIOS_ERR, "Bus Error\n"); } if (host_status_register & (1 << 2)) { - print_err("Device Error\n"); + printk(BIOS_ERR, "Device Error\n"); } if (host_status_register & (1 << 1)) { /* This isn't a real error... */ - print_debug("Interrupt/SMI# was Successful Completion\n"); + printk(BIOS_DEBUG, "Interrupt/SMI# was Successful Completion\n"); } if (host_status_register & (1 << 0)) { - print_err("Host Busy\n"); + printk(BIOS_ERR, "Host Busy\n"); } } @@ -185,11 +181,11 @@ void smbus_fixup(const struct mem_controller *mem_ctrl) ram_slots = ARRAY_SIZE(mem_ctrl->channel0); if (!ram_slots) { - print_err("smbus_fixup() thinks there are no RAM slots!\n"); + printk(BIOS_ERR, "smbus_fixup() thinks there are no RAM slots!\n"); return; } - PRINT_DEBUG("Waiting for SMBus to warm up"); + DEBUG("Waiting for SMBus to warm up"); /* * Bad SPD data should be either 0 or 0xff, but YMMV. So we look for @@ -207,13 +203,13 @@ void smbus_fixup(const struct mem_controller *mem_ctrl) result = get_spd_data(mem_ctrl->channel0[current_slot], SPD_MEMORY_TYPE); current_slot++; - PRINT_DEBUG("."); + DEBUG("."); } if (i >= SMBUS_TIMEOUT) - print_err("SMBus timed out while warming up\n"); + printk(BIOS_ERR, "SMBus timed out while warming up\n"); else - PRINT_DEBUG("Done\n"); + DEBUG("Done\n"); } /* Debugging Function */ @@ -224,9 +220,7 @@ static void dump_spd_data(void) unsigned int val; for (dimm = 0; dimm < 8; dimm++) { - print_debug("SPD Data for DIMM "); - print_debug_hex8(dimm); - print_debug("\n"); + printk(BIOS_DEBUG, "SPD Data for DIMM %02x\n", dimm); val = get_spd_data(dimm, 0); if (val == 0xff) { @@ -234,16 +228,12 @@ static void dump_spd_data(void) } else if (val == 0x80) { regs = 128; } else { - print_debug("No DIMM present\n"); + printk(BIOS_DEBUG, "No DIMM present\n"); regs = 0; } - for (offset = 0; offset < regs; offset++) { - print_debug(" Offset "); - print_debug_hex8(offset); - print_debug(" = 0x"); - print_debug_hex8(get_spd_data(dimm, offset)); - print_debug("\n"); - } + for (offset = 0; offset < regs; offset++) + printk(BIOS_DEBUG, " Offset %02x = 0x%02x\n", + offset, get_spd_data(dimm, offset)); } } #else diff --git a/src/northbridge/via/vx800/raminit.c b/src/northbridge/via/vx800/raminit.c index 6d58f785d3..a7a5757fd2 100644 --- a/src/northbridge/via/vx800/raminit.c +++ b/src/northbridge/via/vx800/raminit.c @@ -29,10 +29,10 @@ #endif #if CONFIG_DEBUG_RAM_SETUP -#define PRINT_DEBUG_MEM(x) print_debug(x) -#define PRINT_DEBUG_MEM_HEX8(x) print_debug_hex8(x) -#define PRINT_DEBUG_MEM_HEX16(x) print_debug_hex16(x) -#define PRINT_DEBUG_MEM_HEX32(x) print_debug_hex32(x) +#define PRINT_DEBUG_MEM(x) printk(BIOS_DEBUG, x) +#define PRINT_DEBUG_MEM_HEX8(x) printk(BIOS_DEBUG, "%02x", x) +#define PRINT_DEBUG_MEM_HEX16(x) printk(BIOS_DEBUG, "%04x", x) +#define PRINT_DEBUG_MEM_HEX32(x) printk(BIOS_DEBUG, "%08x", x) #define DUMPNORTH() dump_pci_device(PCI_DEV(0, 0, 0)) #else #define PRINT_DEBUG_MEM(x) -- cgit v1.2.3