blob: ab7c1f8562cddeccc40ae8836f9cbfc3f792a7f7 [file] [log] [blame]
Ronald G. Minnich2bb216a2006-01-27 23:46:30 +00001
2static void print_debug_pci_dev(unsigned dev)
3{
4 print_debug("PCI: ");
5 print_debug_hex8((dev >> 16) & 0xff);
6 print_debug_char(':');
7 print_debug_hex8((dev >> 11) & 0x1f);
8 print_debug_char('.');
9 print_debug_hex8((dev >> 8) & 7);
10}
11
12static void print_pci_devices(void)
13{
14 device_t dev;
15 for(dev = PCI_DEV(0, 0, 0);
16 dev <= PCI_DEV(0, 0x1f, 0x7);
17 dev += PCI_DEV(0,0,1)) {
18 uint32_t id;
19 id = pci_read_config32(dev, PCI_VENDOR_ID);
20 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
21 (((id >> 16) & 0xffff) == 0xffff) ||
22 (((id >> 16) & 0xffff) == 0x0000)) {
23 continue;
24 }
25 print_debug_pci_dev(dev);
Stefan Reinauer64ed2b72010-03-31 14:47:43 +000026 print_debug("\n");
Ronald G. Minnich2bb216a2006-01-27 23:46:30 +000027 }
28}
29
30static void dump_pci_device(unsigned dev)
31{
32 int i;
33 print_debug_pci_dev(dev);
Stefan Reinauer64ed2b72010-03-31 14:47:43 +000034 print_debug("\n");
Ronald G. Minnich2bb216a2006-01-27 23:46:30 +000035
36 for(i = 0; i <= 255; i++) {
37 unsigned char val;
38 if ((i & 0x0f) == 0) {
39 print_debug_hex8(i);
40 print_debug_char(':');
41 }
42 val = pci_read_config8(dev, i);
43 print_debug_char(' ');
44 print_debug_hex8(val);
45 if ((i & 0x0f) == 0x0f) {
Stefan Reinauer64ed2b72010-03-31 14:47:43 +000046 print_debug("\n");
Ronald G. Minnich2bb216a2006-01-27 23:46:30 +000047 }
48 }
49}
50
51static void dump_pci_devices(void)
52{
53 device_t dev;
54 for(dev = PCI_DEV(0, 0, 0);
55 dev <= PCI_DEV(0, 0x1f, 0x7);
56 dev += PCI_DEV(0,0,1)) {
57 uint32_t id;
58 id = pci_read_config32(dev, PCI_VENDOR_ID);
59 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
60 (((id >> 16) & 0xffff) == 0xffff) ||
61 (((id >> 16) & 0xffff) == 0x0000)) {
62 continue;
63 }
64 dump_pci_device(dev);
65 }
66}