From 5ab52ddc3dc289267b603c0a348c461d336aeaf5 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Mon, 5 Jan 2015 13:01:01 -0800 Subject: southbridge: 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 southbridge code to use printk() on all non-ROMCC boards. Change-Id: I312406257e66bbdc3940e206b5256460559a2c98 Signed-off-by: Stefan Reinauer Reviewed-on: http://review.coreboot.org/8110 Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- src/southbridge/via/k8t890/bridge.c | 2 +- src/southbridge/via/k8t890/ctrl.c | 8 ++++---- src/southbridge/via/k8t890/dram.c | 2 +- src/southbridge/via/k8t890/early_car.c | 25 +++++++++++-------------- src/southbridge/via/k8t890/error.c | 6 +++--- src/southbridge/via/k8t890/host.c | 2 +- src/southbridge/via/k8t890/host_ctrl.c | 2 +- src/southbridge/via/vt8237r/ctrl.c | 4 ++-- src/southbridge/via/vt8237r/early_smbus.c | 26 +++++++++++++------------- src/southbridge/via/vt8237r/vt8237r.c | 10 +++------- src/southbridge/via/vt8237r/vt8237r.h | 4 ++-- 11 files changed, 42 insertions(+), 49 deletions(-) (limited to 'src/southbridge/via') diff --git a/src/southbridge/via/k8t890/bridge.c b/src/southbridge/via/k8t890/bridge.c index 2da31f4be7..fdf5b9d746 100644 --- a/src/southbridge/via/k8t890/bridge.c +++ b/src/southbridge/via/k8t890/bridge.c @@ -26,7 +26,7 @@ static void bridge_enable(struct device *dev) { u8 tmp; - print_debug("B188 device dump\n"); + printk(BIOS_DEBUG, "B188 device dump\n"); /* VIA recommends this, sorry no known info. */ diff --git a/src/southbridge/via/k8t890/ctrl.c b/src/southbridge/via/k8t890/ctrl.c index a918f01640..782c547dfb 100644 --- a/src/southbridge/via/k8t890/ctrl.c +++ b/src/southbridge/via/k8t890/ctrl.c @@ -152,7 +152,7 @@ static void vt8237r_vlink_init(struct device *dev) static void ctrl_init(struct device *dev) { - print_debug("K8x8xx: Initializing V-Link to VT8237R sb: "); + printk(BIOS_DEBUG, "K8x8xx: Initializing V-Link to VT8237R sb: "); /* TODO: Fix some ordering issue for V-link set Rx77[6] and PCI1_Rx4F[0] should to 1 */ @@ -172,11 +172,11 @@ static void ctrl_init(struct device *dev) vt8237r_vlink_init(dev); k8x8xx_vt8237r_cfg(dev, devsb); } else { - print_debug("VT8237R LPC not found !\n"); + printk(BIOS_DEBUG, "VT8237R LPC not found !\n"); return; } - print_debug(" Done\n"); - print_debug(" VIA_X_7 device dump:\n"); + printk(BIOS_DEBUG, " Done\n"); + printk(BIOS_DEBUG, " VIA_X_7 device dump:\n"); dump_south(dev); } diff --git a/src/southbridge/via/k8t890/dram.c b/src/southbridge/via/k8t890/dram.c index 07a34b73fb..04184b76a3 100644 --- a/src/southbridge/via/k8t890/dram.c +++ b/src/southbridge/via/k8t890/dram.c @@ -66,7 +66,7 @@ static void dram_enable(struct device *dev) /* The Address Next to the Last Valid DRAM Address */ pci_write_config16(dev, 0x88, reg | mregs.shadow_mem_ctrl); - print_debug(" VIA_X_3 device dump:\n"); + printk(BIOS_DEBUG, " VIA_X_3 device dump:\n"); dump_south(dev); } diff --git a/src/southbridge/via/k8t890/early_car.c b/src/southbridge/via/k8t890/early_car.c index d7049ae3ba..7eba967a73 100644 --- a/src/southbridge/via/k8t890/early_car.c +++ b/src/southbridge/via/k8t890/early_car.c @@ -80,23 +80,23 @@ u8 k8t890_early_setup_ht(void) } #if CONFIG_SOUTHBRIDGE_VIA_SUBTYPE_K8M800 - print_debug("K8M800 found at LDT "); + printk(BIOS_DEBUG, "K8M800 found at LDT "); #elif CONFIG_SOUTHBRIDGE_VIA_SUBTYPE_K8T800 - print_debug("K8T800 found at LDT "); + printk(BIOS_DEBUG, "K8T800 found at LDT "); #elif CONFIG_SOUTHBRIDGE_VIA_SUBTYPE_K8T800_OLD - print_debug("K8T800_OLD found at LDT "); + printk(BIOS_DEBUG, "K8T800_OLD found at LDT "); pci_write_config8(PCI_DEV(0, 0x0, 0), 0x64, 0x00); pci_write_config8(PCI_DEV(0, 0x0, 0), 0xdd, 0x50); #elif CONFIG_SOUTHBRIDGE_VIA_SUBTYPE_K8T800PRO - print_debug("K8T800 Pro found at LDT "); + printk(BIOS_DEBUG, "K8T800 Pro found at LDT "); #elif CONFIG_SOUTHBRIDGE_VIA_SUBTYPE_K8M890 - print_debug("K8M890 found at LDT "); + printk(BIOS_DEBUG, "K8M890 found at LDT "); /* K8M890 fix HT delay */ pci_write_config8(PCI_DEV(0, 0x0, 2), 0xab, 0x22); #elif CONFIG_SOUTHBRIDGE_VIA_SUBTYPE_K8T890 - print_debug("K8T890 found at LDT "); + printk(BIOS_DEBUG, "K8T890 found at LDT "); #endif - print_debug_hex8(ldtnr); + printk(BIOS_DEBUG, "%02x", ldtnr); /* get the maximum widths for both sides */ cldtwidth_in = pci_read_config8(PCI_DEV(0, 0x18, 0), ldtreg[ldtnr]) & 0x7; @@ -105,8 +105,7 @@ u8 k8t890_early_setup_ht(void) vldtwidth_out = (pci_read_config8(PCI_DEV(0, 0x0, 0), K8X8XX_HT_CFG_BASE + 0x6) >> 4) & 0x7; width = MIN(MIN(MIN(cldtwidth_out, cldtwidth_in), vldtwidth_out), vldtwidth_in); - print_debug(" Agreed on width: "); - print_debug_hex8(width); + printk(BIOS_DEBUG, " Agreed on width: %02x", width); awidth = pci_read_config8(PCI_DEV(0, 0x0, 0), K8X8XX_HT_CFG_BASE + 0x7); @@ -117,12 +116,10 @@ u8 k8t890_early_setup_ht(void) /* Get programmed HT freq at base 0x89 */ cldtfreq = pci_read_config8(PCI_DEV(0, 0x18, 0), ldtreg[ldtnr] + 3) & 0xf; - print_debug(" CPU programmed to HT freq: "); - print_debug_hex8(cldtfreq); + printk(BIOS_DEBUG, " CPU programmed to HT freq: %02x", cldtfreq); - print_debug(" VIA HT caps: "); vldtcaps = pci_read_config16(PCI_DEV(0, 0, 0), K8X8XX_HT_CFG_BASE + 0xe); - print_debug_hex16(vldtcaps); + printk(BIOS_DEBUG, " VIA HT caps: %04x", vldtcaps); if (!(vldtcaps & (1 << cldtfreq ))) { die("Chipset does not support desired HT frequency\n"); @@ -130,7 +127,7 @@ u8 k8t890_early_setup_ht(void) afreq = pci_read_config8(PCI_DEV(0, 0x0, 0), K8X8XX_HT_CFG_BASE + 0xd); pci_write_config8(PCI_DEV(0, 0x0, 0), K8X8XX_HT_CFG_BASE + 0xd, cldtfreq); - print_debug("\n"); + printk(BIOS_DEBUG, "\n"); /* no reset needed */ if ((width == awidth) && (afreq == cldtfreq)) { diff --git a/src/southbridge/via/k8t890/error.c b/src/southbridge/via/k8t890/error.c index 087028895d..2c1b5b681e 100644 --- a/src/southbridge/via/k8t890/error.c +++ b/src/southbridge/via/k8t890/error.c @@ -26,7 +26,7 @@ static void error_enable(struct device *dev) { - print_debug(" K8x8xx: Enabling NB error reporting: "); + printk(BIOS_DEBUG, " K8x8xx: Enabling NB error reporting: "); /* * bit0 - Enable V-link parity error reporting in 0x50 bit0 (RWC) * bit6 - Parity Error/SERR# Report Through V-Link to SB @@ -34,10 +34,10 @@ static void error_enable(struct device *dev) */ pci_write_config8(dev, 0x58, 0x81); - print_debug("Done\n"); + printk(BIOS_DEBUG, "Done\n"); /* TODO: enable AGP errors reporting on K8M890 */ - print_debug(" VIA_X_1 device dump:\n"); + printk(BIOS_DEBUG, " VIA_X_1 device dump:\n"); dump_south(dev); } diff --git a/src/southbridge/via/k8t890/host.c b/src/southbridge/via/k8t890/host.c index aa1b748339..878ee9a6f9 100644 --- a/src/southbridge/via/k8t890/host.c +++ b/src/southbridge/via/k8t890/host.c @@ -60,7 +60,7 @@ static void host_enable(struct device *dev) /* Multiple function control */ pci_write_config8(dev, K8T890_MULTIPLE_FN_EN, 0x01); - print_debug(" VIA_X_0 device dump:\n"); + printk(BIOS_DEBUG, " VIA_X_0 device dump:\n"); dump_south(dev); } diff --git a/src/southbridge/via/k8t890/host_ctrl.c b/src/southbridge/via/k8t890/host_ctrl.c index 74351bc3d0..2f4bca7cf1 100644 --- a/src/southbridge/via/k8t890/host_ctrl.c +++ b/src/southbridge/via/k8t890/host_ctrl.c @@ -84,7 +84,7 @@ static void host_ctrl_enable_k8t8xx(struct device *dev) writeback(dev, 0xc4, 0x50); writeback(dev, 0xc5, 0x50); - print_debug(" VIA_X_2 device dump:\n"); + printk(BIOS_DEBUG, " VIA_X_2 device dump:\n"); dump_south(dev); } diff --git a/src/southbridge/via/vt8237r/ctrl.c b/src/southbridge/via/vt8237r/ctrl.c index 3d856a8228..f951afa719 100644 --- a/src/southbridge/via/vt8237r/ctrl.c +++ b/src/southbridge/via/vt8237r/ctrl.c @@ -130,7 +130,7 @@ static void vt8237s_vlink_init(struct device *dev) /* No pairing NB was found. */ if (!devfun7) { - print_debug("vt8237s_vlink_init: No pairing NB was found.\n"); + printk(BIOS_DEBUG, "vt8237s_vlink_init: No pairing NB was found.\n"); return; } @@ -205,7 +205,7 @@ static void vt8237a_vlink_init(struct device *dev) /* No pairing NB was found. */ if (!devfun7) { - print_debug("vt8237a_vlink_init: No pairing NB was found.\n"); + printk(BIOS_DEBUG, "vt8237a_vlink_init: No pairing NB was found.\n"); return; } diff --git a/src/southbridge/via/vt8237r/early_smbus.c b/src/southbridge/via/vt8237r/early_smbus.c index 747dc5ca77..bb06322849 100644 --- a/src/southbridge/via/vt8237r/early_smbus.c +++ b/src/southbridge/via/vt8237r/early_smbus.c @@ -42,17 +42,17 @@ static void smbus_print_error(u8 host_status, int loops) return; if (loops >= SMBUS_TIMEOUT) - print_err("SMBus timeout\n"); + printk(BIOS_ERR, "SMBus timeout\n"); if (host_status & (1 << 4)) - print_err("Interrupt/SMI# was Failed Bus Transaction\n"); + printk(BIOS_ERR, "Interrupt/SMI# was Failed Bus Transaction\n"); if (host_status & (1 << 3)) - print_err("Bus error\n"); + printk(BIOS_ERR, "Bus error\n"); if (host_status & (1 << 2)) - print_err("Device error\n"); + printk(BIOS_ERR, "Device error\n"); if (host_status & (1 << 1)) - print_debug("Interrupt/SMI# completed successfully\n"); + printk(BIOS_DEBUG, "Interrupt/SMI# completed successfully\n"); if (host_status & (1 << 0)) - print_err("Host busy\n"); + printk(BIOS_ERR, "Host busy\n"); } /** @@ -229,7 +229,7 @@ void smbus_fixup(const struct mem_controller *ctrl) ram_slots = ARRAY_SIZE(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; } @@ -253,7 +253,7 @@ void smbus_fixup(const struct mem_controller *ctrl) } 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"); } @@ -336,7 +336,7 @@ int acpi_is_wakeup_early(void) device_t dev; u16 tmp; - print_debug("IN TEST WAKEUP\n"); + printk(BIOS_DEBUG, "IN TEST WAKEUP\n"); /* Power management controller */ dev = get_vt8237_lpc(); @@ -351,7 +351,7 @@ int acpi_is_wakeup_early(void) tmp = inw(VT8237R_ACPI_IO_BASE + 0x04); - print_debug_hex8(tmp); + printk(BIOS_DEBUG, "%02x", tmp); return ((tmp & (7 << 10)) >> 10) == 1 ? 3 : 0 ; } #endif @@ -426,7 +426,7 @@ int vt8237_early_network_init(struct vt8237_network_rom *rom) dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233_7), 0); if (dev == PCI_DEV_INVALID) { - print_err("Network is disabled, please enable\n"); + printk(BIOS_ERR, "Network is disabled, please enable\n"); return 0; } @@ -441,7 +441,7 @@ int vt8237_early_network_init(struct vt8237_network_rom *rom) return 0; if (rom == NULL) { - print_err("No config data specified, using default MAC!\n"); + printk(BIOS_ERR, "No config data specified, using default MAC!\n"); n.mac_address[0] = 0x0; n.mac_address[1] = 0x0; n.mac_address[2] = 0xde; @@ -503,7 +503,7 @@ int vt8237_early_network_init(struct vt8237_network_rom *rom) } if (loops >= LAN_TIMEOUT) { - print_err("Timeout - LAN controller didn't accept config\n"); + printk(BIOS_ERR, "Timeout - LAN controller didn't accept config\n"); return 0; } diff --git a/src/southbridge/via/vt8237r/vt8237r.c b/src/southbridge/via/vt8237r/vt8237r.c index 5f2449a615..d392512f09 100644 --- a/src/southbridge/via/vt8237r/vt8237r.c +++ b/src/southbridge/via/vt8237r/vt8237r.c @@ -37,13 +37,9 @@ void writeback(struct device *dev, u16 where, u8 what) pci_write_config8(dev, where, what); regval = pci_read_config8(dev, where); - if (regval != what) { - print_debug("Writeback to "); - print_debug_hex8(where); - print_debug(" failed "); - print_debug_hex8(regval); - print_debug("\n"); - } + if (regval != what) + printk(BIOS_DEBUG, "Writeback to %02x failed %02x\n", + where, regval); } #else void writeback(struct device *dev, u16 where, u8 what) diff --git a/src/southbridge/via/vt8237r/vt8237r.h b/src/southbridge/via/vt8237r/vt8237r.h index ee5cc820cc..8c7ae45e9b 100644 --- a/src/southbridge/via/vt8237r/vt8237r.h +++ b/src/southbridge/via/vt8237r/vt8237r.h @@ -94,8 +94,8 @@ #define CLOCK_SLAVE_ADDRESS 0x69 #if CONFIG_DEBUG_SMBUS -#define PRINT_DEBUG(x) print_debug(x) -#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x) +#define PRINT_DEBUG(x) printk(BIOS_DEBUG, x) +#define PRINT_DEBUG_HEX16(x) printk(BIOS_DEBUG, "%04x", x) #else #define PRINT_DEBUG(x) #define PRINT_DEBUG_HEX16(x) -- cgit v1.2.3