| 286 | } |
| 287 | |
| 288 | static int pci_single_show(struct dfs_seq_file *seq, void *data) |
| 289 | { |
| 290 | struct rt_device *dev; |
| 291 | struct rt_pci_driver *pdrv; |
| 292 | struct rt_pci_device *pdev; |
| 293 | |
| 294 | rt_hw_spin_lock(&pci_bus->dev_lock.lock); |
| 295 | |
| 296 | rt_list_for_each_entry(dev, &pci_bus->dev_list, node) |
| 297 | { |
| 298 | pdev = rt_container_of(dev, struct rt_pci_device, parent); |
| 299 | |
| 300 | dfs_seq_printf(seq, "%02x%02x\t%04x%04x\t%x", |
| 301 | pdev->bus->number, |
| 302 | pdev->devfn, |
| 303 | pdev->vendor, |
| 304 | pdev->device, |
| 305 | pdev->irq); |
| 306 | |
| 307 | /* BAR, ROM base */ |
| 308 | for (int bar = 0; bar < RT_PCI_BAR_NR_MAX; ++bar) |
| 309 | { |
| 310 | dfs_seq_printf(seq, "\t%16llx", (rt_uint64_t)pdev->resource[bar].base); |
| 311 | } |
| 312 | dfs_seq_printf(seq, "\t%16llx", (rt_uint64_t)pdev->rom.base); |
| 313 | |
| 314 | /* BAR, ROM size */ |
| 315 | for (int bar = 0; bar < RT_PCI_BAR_NR_MAX; ++bar) |
| 316 | { |
| 317 | dfs_seq_printf(seq, "\t%16llx", (rt_uint64_t)pdev->resource[bar].size); |
| 318 | } |
| 319 | dfs_seq_printf(seq, "\t%16llx", (rt_uint64_t)pdev->rom.size); |
| 320 | |
| 321 | dfs_seq_puts(seq, "\t"); |
| 322 | |
| 323 | /* Driver Name */ |
| 324 | if (dev->drv) |
| 325 | { |
| 326 | pdrv = rt_container_of(dev->drv, struct rt_pci_driver, parent); |
| 327 | |
| 328 | dfs_seq_puts(seq, pdrv->name); |
| 329 | } |
| 330 | |
| 331 | /* End of a seq */ |
| 332 | dfs_seq_puts(seq, "\n"); |
| 333 | } |
| 334 | |
| 335 | rt_hw_spin_unlock(&pci_bus->dev_lock.lock); |
| 336 | |
| 337 | return 0; |
| 338 | } |
| 339 | |
| 340 | static int pci_procfs_init(void) |
| 341 | { |
nothing calls this directly
no test coverage detected