kernel/pci: Implement the PCIOCATTACHED ioctl.
authorSascha Wildner <saw@online.de>
Tue, 14 Feb 2012 22:18:33 +0000 (23:18 +0100)
committerSascha Wildner <saw@online.de>
Thu, 16 Feb 2012 03:38:35 +0000 (04:38 +0100)
This fixes pciconf -a

Taken-from: FreeBSD

sys/bus/pci/pci_user.c

index 53c8aa3..d9ffcea 100644 (file)
@@ -732,6 +732,16 @@ getconfexit:
                        bio->pbi_enabled = (value & PCIM_CMD_PORTEN) != 0;
                error = 0;
                break;
+       case PCIOCATTACHED:
+               error = 0;
+               io = (struct pci_io *)ap->a_data;
+               pcidev = pci_find_dbsf(io->pi_sel.pc_domain, io->pi_sel.pc_bus,
+                                      io->pi_sel.pc_dev, io->pi_sel.pc_func);
+               if (pcidev != NULL)
+                       io->pi_data = device_is_attached(pcidev);
+               else
+                       error = ENODEV;
+               break;
        default:
                error = ENOTTY;
                break;