| 105 | } |
| 106 | |
| 107 | static int pci_platform_scan(void) |
| 108 | { |
| 109 | struct pci_access *pacc; |
| 110 | struct pci_dev *dev; |
| 111 | char namebuf[1024]; |
| 112 | const char *name; |
| 113 | |
| 114 | pacc = pci_alloc(); |
| 115 | pacc->method = PCI_ACCESS_I386_TYPE1; |
| 116 | |
| 117 | pci_init(pacc); |
| 118 | pci_scan_bus(pacc); |
| 119 | |
| 120 | for (dev=pacc->devices; dev; dev=dev->next) { |
| 121 | pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | |
| 122 | PCI_FILL_SIZES | PCI_FILL_CLASS); |
| 123 | name = pci_lookup_name(pacc, namebuf, sizeof(namebuf), |
| 124 | PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id); |
| 125 | if (name == NULL) |
| 126 | name = "<unknown>"; |
| 127 | if (dev->vendor_id != PCI_VENDOR_ID_INTEL) |
| 128 | continue; |
| 129 | |
| 130 | if (PCI_DEV_NO_ME(dev->device_id)) { |
| 131 | printf(CGRN "Good news, you have a `%s` so you have " |
| 132 | "no ME present at all, continuing...\n\n" |
| 133 | RESET, name); |
| 134 | break; |
| 135 | } else if (PCI_DEV_HAS_ME_DISABLE(dev->device_id)) { |
| 136 | printf(CGRN "Good news, you have a `%s` so ME is " |
| 137 | "present but can be disabled, continuing...\n\n" |
| 138 | RESET, name); |
| 139 | break; |
| 140 | } else if (PCI_DEV_HAS_ME_DIFFICULT(dev->device_id)) { |
| 141 | printf(CRED "Bad news, you have a `%s` so you have ME " |
| 142 | "hardware on board and you can't control or " |
| 143 | "disable it, continuing...\n\n" RESET, name); |
| 144 | break; |
| 145 | } else if (PCI_DEV_CAN_DISABLE_ME_IF_PRESENT(dev->device_id)) { |
| 146 | printf(CYEL "Not sure if ME hardware is present " |
| 147 | "because you have a `%s`, but it is possible to " |
| 148 | "disable it if you do, continuing...\n\n" RESET, |
| 149 | name); |
| 150 | break; |
| 151 | } else if (PCI_DEV_ME_NOT_SURE(dev->device_id)) { |
| 152 | printf(CYEL "Found `%s`. Not sure whether you have ME " |
| 153 | "hardware, exiting\n\n" RESET, name); |
| 154 | pci_cleanup(pacc); |
| 155 | return 1; |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | if (dev != NULL && |
| 160 | !PCI_DEV_HAS_ME_DISABLE(dev->device_id) && |
| 161 | !PCI_DEV_HAS_ME_DIFFICULT(dev->device_id) && |
| 162 | !PCI_DEV_CAN_DISABLE_ME_IF_PRESENT(dev->device_id) && |
| 163 | !PCI_DEV_ME_NOT_SURE(dev->device_id)) { |
| 164 | printf(CCYN "ME is not present on your board or unknown\n\n" |
no test coverage detected