2 * generic debug code, used by mainboard specific romstage.c
6 static void print_debug_pci_dev(unsigned dev)
9 print_debug_hex8((dev >> 16) & 0xff);
10 print_debug_char(':');
11 print_debug_hex8((dev >> 11) & 0x1f);
12 print_debug_char('.');
13 print_debug_hex8((dev >> 8) & 7);
16 static inline void print_pci_devices(void)
19 for(dev = PCI_DEV(0, 0, 0);
20 dev <= PCI_DEV(0xff, 0x1f, 0x7);
21 dev += PCI_DEV(0,0,1)) {
23 id = pci_read_config32(dev, PCI_VENDOR_ID);
24 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
25 (((id >> 16) & 0xffff) == 0xffff) ||
26 (((id >> 16) & 0xffff) == 0x0000)) {
29 print_debug_pci_dev(dev);
34 static void dump_pci_device(unsigned dev)
37 print_debug_pci_dev(dev);
39 for(i = 0; i < 256; i++) {
41 if ((i & 0x0f) == 0) {
42 #if CONFIG_USE_PRINTK_IN_CAR
43 printk(BIOS_DEBUG, "\n%02x:",i);
47 print_debug_char(':');
50 val = pci_read_config8(dev, i);
51 #if CONFIG_USE_PRINTK_IN_CAR
52 printk(BIOS_DEBUG, " %02x", val);
54 print_debug_char(' ');
55 print_debug_hex8(val);
61 static inline void dump_pci_devices(void)
64 for(dev = PCI_DEV(0, 0, 0);
65 dev <= PCI_DEV(0xff, 0x1f, 0x7);
66 dev += PCI_DEV(0,0,1)) {
68 id = pci_read_config32(dev, PCI_VENDOR_ID);
69 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
70 (((id >> 16) & 0xffff) == 0xffff) ||
71 (((id >> 16) & 0xffff) == 0x0000)) {
78 static inline void dump_pci_devices_on_bus(unsigned busn)
81 for(dev = PCI_DEV(busn, 0, 0);
82 dev <= PCI_DEV(busn, 0x1f, 0x7);
83 dev += PCI_DEV(0,0,1)) {
85 id = pci_read_config32(dev, PCI_VENDOR_ID);
86 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
87 (((id >> 16) & 0xffff) == 0xffff) ||
88 (((id >> 16) & 0xffff) == 0x0000)) {
95 static inline void dump_spd_registers(const struct mem_controller *ctrl)
99 for(i = 0; i < 4; i++) {
101 device = ctrl->channel0[i];
104 #if CONFIG_USE_PRINTK_IN_CAR
105 printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device);
107 print_debug("dimm: ");
110 print_debug_hex8(device);
112 for(j = 0; j < 128; j++) {
115 if ((j & 0xf) == 0) {
116 #if CONFIG_USE_PRINTK_IN_CAR
117 printk(BIOS_DEBUG, "\n%02x: ", j);
124 status = smbus_read_byte(device, j);
128 byte = status & 0xff;
129 #if CONFIG_USE_PRINTK_IN_CAR
130 printk(BIOS_DEBUG, "%02x ", byte);
132 print_debug_hex8(byte);
133 print_debug_char(' ');
138 device = ctrl->channel1[i];
141 #if CONFIG_USE_PRINTK_IN_CAR
142 printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device);
144 print_debug("dimm: ");
147 print_debug_hex8(device);
149 for(j = 0; j < 128; j++) {
152 if ((j & 0xf) == 0) {
153 #if CONFIG_USE_PRINTK_IN_CAR
154 printk(BIOS_DEBUG, "\n%02x: ", j);
161 status = smbus_read_byte(device, j);
165 byte = status & 0xff;
166 #if CONFIG_USE_PRINTK_IN_CAR
167 printk(BIOS_DEBUG, "%02x ", byte);
169 print_debug_hex8(byte);
170 print_debug_char(' ');
177 static inline void dump_smbus_registers(void)
181 for(device = 1; device < 0x80; device++) {
183 if( smbus_read_byte(device, 0) < 0 ) continue;
184 #if CONFIG_USE_PRINTK_IN_CAR
185 printk(BIOS_DEBUG, "smbus: %02x", device);
187 print_debug("smbus: ");
188 print_debug_hex8(device);
190 for(j = 0; j < 256; j++) {
193 status = smbus_read_byte(device, j);
197 if ((j & 0xf) == 0) {
198 #if CONFIG_USE_PRINTK_IN_CAR
199 printk(BIOS_DEBUG, "\n%02x: ",j);
206 byte = status & 0xff;
207 #if CONFIG_USE_PRINTK_IN_CAR
208 printk(BIOS_DEBUG, "%02x ", byte);
210 print_debug_hex8(byte);
211 print_debug_char(' ');
218 static inline void dump_io_resources(unsigned port)
222 #if CONFIG_USE_PRINTK_IN_CAR
223 printk(BIOS_DEBUG, "%04x:\n", port);
225 print_debug_hex16(port);
230 if ((i & 0x0f) == 0) {
231 #if CONFIG_USE_PRINTK_IN_CAR
232 printk(BIOS_DEBUG, "%02x:", i);
235 print_debug_char(':');
239 #if CONFIG_USE_PRINTK_IN_CAR
240 printk(BIOS_DEBUG, " %02x",val);
242 print_debug_char(' ');
243 print_debug_hex8(val);
245 if ((i & 0x0f) == 0x0f) {
252 static inline void dump_mem(unsigned start, unsigned end)
255 print_debug("dump_mem:");
256 for(i=start;i<end;i++) {
258 #if CONFIG_USE_PRINTK_IN_CAR
259 printk(BIOS_DEBUG, "\n%08x:", i);
262 print_debug_hex32(i);
266 #if CONFIG_USE_PRINTK_IN_CAR
267 printk(BIOS_DEBUG, " %02x", (unsigned char)*((unsigned char *)i));
270 print_debug_hex8((unsigned char)*((unsigned char *)i));