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
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) {
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';
data = preload_search_by_type("pci_vendor_data");
if (data != NULL) {
ptr = preload_fetch_addr(data);
sz = preload_fetch_size(data);
if (ptr != NULL && sz != 0) {
pci_vendordata = ptr;
pci_vendordata_size = sz;
/* terminate the database */
pci_vendordata[pci_vendordata_size] = '\n';
}
}
}