/ src / northbridge / intel / i440bx / debug.c
debug.c
 1  /* SPDX-License-Identifier: GPL-2.0-only */
 2  
 3  #include <console/console.h>
 4  #include <device/pci_ops.h>
 5  #include <device/smbus_host.h>
 6  #include <spd.h>
 7  #include "raminit.h"
 8  
 9  void dump_spd_registers(void)
10  {
11  	int i;
12  	printk(BIOS_DEBUG, "\n");
13  	for (i = 0; i < DIMM_SOCKETS; i++) {
14  		unsigned int device;
15  		device = DIMM0 + i;
16  		if (device) {
17  			int j;
18  			printk(BIOS_DEBUG, "DIMM %d: %02x", i, device);
19  			for (j = 0; j < 256; j++) {
20  				int status;
21  				unsigned char byte;
22  				if ((j & 0xf) == 0) {
23  					printk(BIOS_DEBUG, "\n%02x: ", j);
24  				}
25  				status = smbus_read_byte(device, j);
26  				if (status < 0) {
27  					printk(BIOS_DEBUG, "bad device\n");
28  					break;
29  				}
30  				byte = status & 0xff;
31  				printk(BIOS_DEBUG, "%02x ", byte);
32  			}
33  			printk(BIOS_DEBUG, "\n");
34  		}
35  	}
36  }
37  
38  void dump_pci_device(unsigned int dev)
39  {
40  	int i;
41  	printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x", (dev >> 20) & 0xff, (dev >> 15) & 0x1f,
42  		(dev >> 12) & 7);
43  
44  	for (i = 0; i <= 255; i++) {
45  		if ((i & 0x0f) == 0)
46  			printk(BIOS_DEBUG, "\n%02x:", i);
47  		printk(BIOS_DEBUG, " %02x", pci_read_config8(dev, i));
48  	}
49  	printk(BIOS_DEBUG, "\n");
50  }