| 108 | } |
| 109 | |
| 110 | struct rt_pci_device *rt_pci_scan_single_device(struct rt_pci_bus *bus, rt_uint32_t devfn) |
| 111 | { |
| 112 | rt_err_t err; |
| 113 | struct rt_pci_device *pdev = RT_NULL; |
| 114 | rt_uint16_t vendor = PCI_ANY_ID, device = PCI_ANY_ID; |
| 115 | |
| 116 | if (!bus) |
| 117 | { |
| 118 | goto _end; |
| 119 | } |
| 120 | |
| 121 | err = rt_pci_bus_read_config_u16(bus, devfn, PCIR_VENDOR, &vendor); |
| 122 | rt_pci_bus_read_config_u16(bus, devfn, PCIR_DEVICE, &device); |
| 123 | |
| 124 | if (vendor == (typeof(vendor))PCI_ANY_ID || |
| 125 | vendor == (typeof(vendor))0x0000 || err) |
| 126 | { |
| 127 | goto _end; |
| 128 | } |
| 129 | |
| 130 | if (!(pdev = rt_pci_alloc_device(bus))) |
| 131 | { |
| 132 | goto _end; |
| 133 | } |
| 134 | |
| 135 | pdev->devfn = devfn; |
| 136 | pdev->vendor = vendor; |
| 137 | pdev->device = device; |
| 138 | |
| 139 | rt_dm_dev_set_name(&pdev->parent, "%04x:%02x:%02x.%u", |
| 140 | rt_pci_domain(pdev), pdev->bus->number, |
| 141 | RT_PCI_SLOT(pdev->devfn), RT_PCI_FUNC(pdev->devfn)); |
| 142 | |
| 143 | if (rt_pci_setup_device(pdev)) |
| 144 | { |
| 145 | rt_free(pdev); |
| 146 | pdev = RT_NULL; |
| 147 | |
| 148 | goto _end; |
| 149 | } |
| 150 | |
| 151 | pci_procfs_attach(pdev); |
| 152 | rt_pci_device_register(pdev); |
| 153 | |
| 154 | _end: |
| 155 | return pdev; |
| 156 | } |
| 157 | |
| 158 | static rt_bool_t pci_intx_mask_broken(struct rt_pci_device *pdev) |
| 159 | { |
no test coverage detected