Use the preload_fetch_addr() and preload_fetch_size() convenience

functions to obtain the address and size of the PCI vendor data.

Sponsored by: Juniper Networks.
This commit is contained in:
Marcel Moolenaar 2011-02-13 19:26:51 +00:00
parent 01f7b6dad3
commit bba39e1034

View File

@ -3056,15 +3056,20 @@ pci_resume(device_t dev)
static void static void
pci_load_vendor_data(void) pci_load_vendor_data(void)
{ {
caddr_t vendordata, info; caddr_t data;
void *ptr;
size_t sz;
if ((vendordata = preload_search_by_type("pci_vendor_data")) != NULL) { data = preload_search_by_type("pci_vendor_data");
info = preload_search_info(vendordata, MODINFO_ADDR); if (data != NULL) {
pci_vendordata = *(char **)info; ptr = preload_fetch_addr(data);
info = preload_search_info(vendordata, MODINFO_SIZE); sz = preload_fetch_size(data);
pci_vendordata_size = *(size_t *)info; if (ptr != NULL && sz != 0) {
/* terminate the database */ pci_vendordata = ptr;
pci_vendordata[pci_vendordata_size] = '\n'; pci_vendordata_size = sz;
/* terminate the database */
pci_vendordata[pci_vendordata_size] = '\n';
}
} }
} }