1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/pci.h>
4 #include <device/pci_ids.h>
5 #include <device/pci_ops.h>
6 #include <cpu/x86/msr.h>
9 static void print_pci_regs(struct device *dev)
15 byte = pci_read_config8(dev, i);
17 if((i & 0xf)==0) printk_debug("\n%02x:",i);
18 printk_debug(" %02x",byte);
23 static void print_mem(void)
26 unsigned int start = 0xfffff000;
27 for(i=start;i<0xffffffff;i++) {
28 if((i & 0xf)==0) printk_debug("\n %08x:",i);
29 printk_debug(" %02x",(unsigned char)*((unsigned char *)i));
31 printk_debug(" %02x\n",(unsigned char)*((unsigned char *)i));
34 static void print_pci_regs_all(void)
40 for(j=0;j<=0x1f;j++) {
42 dev = dev_find_slot(i, PCI_DEVFN(j, k));
49 printk_debug("\n%02x:%02x:%02x aka %s",i,j,k, dev_path(dev));
57 static void print_msr()
61 unsigned eax, ebx, ecx, edx;
63 printk_debug("calling cpuid 0x%08x\n", index);
66 : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
69 printk_debug("cpuid[%08x]: %08x %08x %08x %08x\n",
70 index, eax, ebx, ecx, edx);
73 printk_debug("Reading msr: 0x%08x\n", index);
75 printk_debug("msr[0x%08x]: 0x%08x%08x\n",
76 index, msr.hi, msr.hi);
81 static void debug_init(device_t dev)
84 switch(dev->path.u.pnp.device) {
87 parent = dev->bus->dev;
88 printk_debug("DEBUG: %s", dev_path(parent));
89 if(parent->chip_ops && parent->chip_ops->name) {
90 printk_debug(": %s\n", parent->chip_ops->name);
109 static void debug_noop(device_t dummy)
113 static struct device_operations debug_operations = {
114 .read_resources = debug_noop,
115 .set_resources = debug_noop,
116 .enable_resources = debug_noop,
120 static void enable_dev(struct device *dev)
122 dev->ops = &debug_operations;
125 struct chip_operations drivers_generic_debug_ops = {
126 CHIP_NAME("Debug device")
127 .enable_dev = enable_dev,