From 6ca7636c8f52560e732cdd5b1c7829cda5aa2bde Mon Sep 17 00:00:00 2001 From: "arch import user (historical)" Date: Wed, 6 Jul 2005 17:17:25 +0000 Subject: Revision: linuxbios@linuxbios.org--devel/freebios--devel--2.0--patch-51 Creator: Yinghai Lu cache_as_ram for AMD and some intel git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1967 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/northbridge/intel/e7501/debug.c | 155 +++++++++++++++++++++++++++++++----- 1 file changed, 133 insertions(+), 22 deletions(-) (limited to 'src/northbridge/intel/e7501/debug.c') diff --git a/src/northbridge/intel/e7501/debug.c b/src/northbridge/intel/e7501/debug.c index 67670f9844..1c02ef7204 100644 --- a/src/northbridge/intel/e7501/debug.c +++ b/src/northbridge/intel/e7501/debug.c @@ -17,7 +17,7 @@ static void print_pci_devices(void) { device_t dev; for(dev = PCI_DEV(0, 0, 0); - dev <= PCI_DEV(0, 0x1f, 0x7); + dev <= PCI_DEV(0xff, 0x1f, 0x7); dev += PCI_DEV(0,0,1)) { uint32_t id; id = pci_read_config32(dev, PCI_VENDOR_ID); @@ -35,28 +35,34 @@ static void dump_pci_device(unsigned dev) { int i; print_debug_pci_dev(dev); - print_debug("\r\n"); - for(i = 0; i <= 255; i++) { + for(i = 0; i < 256; i++) { unsigned char val; if ((i & 0x0f) == 0) { +#if CONFIG_USE_INIT + printk_debug("\r\n%02x:",i); +#else + print_debug("\r\n"); print_debug_hex8(i); print_debug_char(':'); +#endif } val = pci_read_config8(dev, i); +#if CONFIG_USE_INIT + printk_debug(" %02x", val); +#else print_debug_char(' '); print_debug_hex8(val); - if ((i & 0x0f) == 0x0f) { - print_debug("\r\n"); - } +#endif } + print_debug("\r\n"); } static void dump_pci_devices(void) { device_t dev; for(dev = PCI_DEV(0, 0, 0); - dev <= PCI_DEV(0, 0x1f, 0x7); + dev <= PCI_DEV(0xff, 0x1f, 0x7); dev += PCI_DEV(0,0,1)) { uint32_t id; id = pci_read_config32(dev, PCI_VENDOR_ID); @@ -69,6 +75,23 @@ static void dump_pci_devices(void) } } +static void dump_pci_devices_on_bus(unsigned busn) +{ + device_t dev; + for(dev = PCI_DEV(busn, 0, 0); + dev <= PCI_DEV(busn, 0x1f, 0x7); + dev += PCI_DEV(0,0,1)) { + uint32_t id; + id = pci_read_config32(dev, PCI_VENDOR_ID); + if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) || + (((id >> 16) & 0xffff) == 0xffff) || + (((id >> 16) & 0xffff) == 0x0000)) { + continue; + } + dump_pci_device(dev); + } +} + static void dump_spd_registers(const struct mem_controller *ctrl) { int i; @@ -78,87 +101,175 @@ static void dump_spd_registers(const struct mem_controller *ctrl) device = ctrl->channel0[i]; if (device) { int j; +#if CONFIG_USE_INIT + printk_debug("dimm: %02x.0: %02x", i, device); +#else print_debug("dimm: "); print_debug_hex8(i); print_debug(".0: "); print_debug_hex8(device); - for(j = 0; j < 256; j++) { +#endif + for(j = 0; j < 128; j++) { int status; unsigned char byte; if ((j & 0xf) == 0) { +#if CONFIG_USE_INIT + printk_debug("\r\n%02x: ", j); +#else print_debug("\r\n"); print_debug_hex8(j); print_debug(": "); +#endif } status = smbus_read_byte(device, j); if (status < 0) { - print_debug("bad device\r\n"); break; } byte = status & 0xff; +#if CONFIG_USE_INIT + printk_debug("%02x ", byte); +#else print_debug_hex8(byte); print_debug_char(' '); +#endif } print_debug("\r\n"); } -#if 0 device = ctrl->channel1[i]; if (device) { int j; +#if CONFIG_USE_INIT + printk_debug("dimm: %02x.1: %02x", i, device); +#else` print_debug("dimm: "); print_debug_hex8(i); print_debug(".1: "); print_debug_hex8(device); - for(j = 0; j < 256; j++) { +#endif + for(j = 0; j < 128; j++) { int status; unsigned char byte; if ((j & 0xf) == 0) { +#if CONFIG_USE_INIT + printk_debug("\r\n%02x: ", j); +#else print_debug("\r\n"); print_debug_hex8(j); print_debug(": "); +#endif } status = smbus_read_byte(device, j); if (status < 0) { - print_debug("bad device\r\n"); break; } byte = status & 0xff; +#if CONFIG_USE_INIT + printk_debug("%02x ", byte); +#else print_debug_hex8(byte); print_debug_char(' '); +#endif } print_debug("\r\n"); } -#endif } } static void dump_smbus_registers(void) { - int i; + unsigned device; print_debug("\r\n"); - for(i = 1; i < 0x80; i++) { - unsigned device; - device = i; + for(device = 1; device < 0x80; device++) { int j; + if( smbus_read_byte(device, 0) < 0 ) continue; +#if CONFIG_USE_INIT + printk_debug("smbus: %02x", device); +#else print_debug("smbus: "); print_debug_hex8(device); +#endif for(j = 0; j < 256; j++) { int status; unsigned char byte; + status = smbus_read_byte(device, j); + if (status < 0) { + break; + } if ((j & 0xf) == 0) { +#if CONFIG_USE_INIT + printk_debug("\r\n%02x: ",j); +#else print_debug("\r\n"); print_debug_hex8(j); print_debug(": "); - } - status = smbus_read_byte(device, j); - if (status < 0) { - print_debug("bad device\r\n"); - break; +#endif } byte = status & 0xff; +#if CONFIG_USE_INIT + printk_debug("%02x ", byte); +#else print_debug_hex8(byte); print_debug_char(' '); +#endif } print_debug("\r\n"); } } + +static void dump_io_resources(unsigned port) +{ + + int i; +#if CONFIG_USE_INIT + printk_debug("%04x:\r\n", port); +#else + print_debug_hex16(port); + print_debug(":\r\n"); +#endif + for(i=0;i<256;i++) { + uint8_t val; + if ((i & 0x0f) == 0) { +#if CONFIG_USE_INIT + printk_debug("%02x:", i); +#else + print_debug_hex8(i); + print_debug_char(':'); +#endif + } + val = inb(port); +#if CONFIG_USE_INIT + printk_debug(" %02x",val); +#else + print_debug_char(' '); + print_debug_hex8(val); +#endif + if ((i & 0x0f) == 0x0f) { + print_debug("\r\n"); + } + port++; + } +} + +static void dump_mem(unsigned start, unsigned end) +{ + unsigned i; + print_debug("dump_mem:"); + for(i=start;i