Ronald G. Minnich | 2bb216a | 2006-01-27 23:46:30 +0000 | [diff] [blame] | 1 | |
| 2 | static 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 | |
| 12 | static 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 Reinauer | 64ed2b7 | 2010-03-31 14:47:43 +0000 | [diff] [blame] | 26 | print_debug("\n"); |
Ronald G. Minnich | 2bb216a | 2006-01-27 23:46:30 +0000 | [diff] [blame] | 27 | } |
| 28 | } |
| 29 | |
| 30 | static void dump_pci_device(unsigned dev) |
| 31 | { |
| 32 | int i; |
| 33 | print_debug_pci_dev(dev); |
Stefan Reinauer | 64ed2b7 | 2010-03-31 14:47:43 +0000 | [diff] [blame] | 34 | print_debug("\n"); |
Ronald G. Minnich | 2bb216a | 2006-01-27 23:46:30 +0000 | [diff] [blame] | 35 | |
| 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 Reinauer | 64ed2b7 | 2010-03-31 14:47:43 +0000 | [diff] [blame] | 46 | print_debug("\n"); |
Ronald G. Minnich | 2bb216a | 2006-01-27 23:46:30 +0000 | [diff] [blame] | 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | static 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 | } |