diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c index 8c913523f638..077f6be17f51 100644 --- a/sys/dev/acpica/acpi_pci.c +++ b/sys/dev/acpica/acpi_pci.c @@ -226,10 +226,8 @@ acpi_pci_attach(device_t dev) * these devices. */ pci_add_children(dev, busno, sizeof(struct acpi_pci_devinfo)); - (void) AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, acpi_pci_save_handle, dev, NULL); - pci_load_vendor_data(); return (bus_generic_attach(dev)); } diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 5e63bc95fab9..93eff9411579 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -76,6 +76,7 @@ static int pci_add_map(device_t pcib, int b, int s, int f, int reg, static void pci_add_resources(device_t pcib, device_t dev); static int pci_probe(device_t dev); static int pci_attach(device_t dev); +static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); static char *pci_describe_device(device_t dev); @@ -840,28 +841,21 @@ pci_attach(device_t dev) pci_add_children(dev, busno, sizeof(struct pci_devinfo)); - pci_load_vendor_data(); return (bus_generic_attach(dev)); } -void +static void pci_load_vendor_data(void) { caddr_t vendordata, info; - static int once; - if (!once) { - make_dev(&pcicdev, 0, UID_ROOT, GID_WHEEL, 0644, "pci"); - if ((vendordata = preload_search_by_type("pci_vendor_data")) - != NULL) { - info = preload_search_info(vendordata, MODINFO_ADDR); - pci_vendordata = *(char **)info; - info = preload_search_info(vendordata, MODINFO_SIZE); - pci_vendordata_size = *(size_t *)info; - /* terminate the database */ - pci_vendordata[pci_vendordata_size] = '\n'; - } - once++; + if ((vendordata = preload_search_by_type("pci_vendor_data")) != NULL) { + info = preload_search_info(vendordata, MODINFO_ADDR); + pci_vendordata = *(char **)info; + info = preload_search_info(vendordata, MODINFO_SIZE); + pci_vendordata_size = *(size_t *)info; + /* terminate the database */ + pci_vendordata[pci_vendordata_size] = '\n'; } } @@ -1396,13 +1390,19 @@ pci_write_config_method(device_t dev, device_t child, int reg, static int pci_modevent(module_t mod, int what, void *arg) { + static dev_t pci_cdev; + switch (what) { case MOD_LOAD: STAILQ_INIT(&pci_devq); pci_generation = 0; + pci_cdev = make_dev(&pcicdev, 0, UID_ROOT, GID_WHEEL, 0644, + "pci"); + pci_load_vendor_data(); break; case MOD_UNLOAD: + destroy_dev(pci_cdev); break; } diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h index c82e3f5a8652..1b14bc840696 100644 --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -68,6 +68,5 @@ struct pci_devinfo *pci_read_device(device_t pcib, int b, int s, int f, size_t size); void pci_print_verbose(struct pci_devinfo *dinfo); int pci_freecfg(struct pci_devinfo *dinfo); -void pci_load_vendor_data(void); #endif /* _PCI_PRIVATE_H_ */