| 213 | } |
| 214 | |
| 215 | static int |
| 216 | pci_scan_one(int dev_pci_fd, struct pci_conf *conf) |
| 217 | { |
| 218 | struct rte_pci_device_internal *pdev; |
| 219 | struct rte_pci_device *dev; |
| 220 | struct pci_bar_io bar; |
| 221 | unsigned i, max; |
| 222 | |
| 223 | pdev = malloc(sizeof(*pdev)); |
| 224 | if (pdev == NULL) { |
| 225 | RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci device\n"); |
| 226 | return -1; |
| 227 | } |
| 228 | |
| 229 | memset(pdev, 0, sizeof(*pdev)); |
| 230 | dev = &pdev->device; |
| 231 | dev->device.bus = &rte_pci_bus.bus; |
| 232 | |
| 233 | dev->addr.domain = conf->pc_sel.pc_domain; |
| 234 | dev->addr.bus = conf->pc_sel.pc_bus; |
| 235 | dev->addr.devid = conf->pc_sel.pc_dev; |
| 236 | dev->addr.function = conf->pc_sel.pc_func; |
| 237 | |
| 238 | /* get vendor id */ |
| 239 | dev->id.vendor_id = conf->pc_vendor; |
| 240 | |
| 241 | /* get device id */ |
| 242 | dev->id.device_id = conf->pc_device; |
| 243 | |
| 244 | /* get subsystem_vendor id */ |
| 245 | dev->id.subsystem_vendor_id = conf->pc_subvendor; |
| 246 | |
| 247 | /* get subsystem_device id */ |
| 248 | dev->id.subsystem_device_id = conf->pc_subdevice; |
| 249 | |
| 250 | /* get class id */ |
| 251 | dev->id.class_id = (conf->pc_class << 16) | |
| 252 | (conf->pc_subclass << 8) | |
| 253 | (conf->pc_progif); |
| 254 | |
| 255 | /* TODO: get max_vfs */ |
| 256 | dev->max_vfs = 0; |
| 257 | |
| 258 | /* FreeBSD has no NUMA support (yet) */ |
| 259 | dev->device.numa_node = SOCKET_ID_ANY; |
| 260 | |
| 261 | pci_common_set(dev); |
| 262 | |
| 263 | /* FreeBSD has only one pass through driver */ |
| 264 | dev->kdrv = RTE_PCI_KDRV_NIC_UIO; |
| 265 | |
| 266 | /* parse resources */ |
| 267 | switch (conf->pc_hdr & PCIM_HDRTYPE) { |
| 268 | case PCIM_HDRTYPE_NORMAL: |
| 269 | max = PCIR_MAX_BAR_0; |
| 270 | break; |
| 271 | case PCIM_HDRTYPE_BRIDGE: |
| 272 | max = PCIR_MAX_BAR_1; |
no test coverage detected