coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
debug.c
Go to the documentation of this file.
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 
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\n", (dev >> 20) & 0xff, (dev >> 15) & 0x1f, (dev >> 12) & 7);
42 
43  for (i = 0; i <= 255; i++) {
44  unsigned char val;
45  val = pci_read_config8(dev, i);
46  if ((i & 0x0f) == 0)
47  printk(BIOS_DEBUG, "%02x:", i);
48  printk(BIOS_DEBUG, " %02x", val);
49  if ((i & 0x0f) == 0x0f)
50  printk(BIOS_DEBUG, "\n");
51  }
52 }
enum fch_io_device device
Definition: fch.c:74
#define printk(level,...)
Definition: stdlib.h:16
#define DIMM_SOCKETS
Definition: raminit.h:7
#define DIMM0
Definition: raminit.h:10
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition: pci_ops.h:46
static int smbus_read_byte(struct device *const dev, u8 addr)
Definition: smbus.h:43
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
void dump_pci_device(unsigned int dev)
Definition: debug.c:38
void dump_spd_registers(void)
Definition: debug.c:9
Definition: device.h:107
u8 val
Definition: sys.c:300