diff options
author | marcel <marcel@FreeBSD.org> | 2011-02-13 19:26:51 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2011-02-13 19:26:51 +0000 |
commit | 88337282fe7700f1bf01a77892390a206c284c81 (patch) | |
tree | cb66b1eea9e88e96986a50679fcac23277b36f72 | |
parent | f94334062099887d1a819b33400336b0fe2b56d9 (diff) | |
download | FreeBSD-src-88337282fe7700f1bf01a77892390a206c284c81.zip FreeBSD-src-88337282fe7700f1bf01a77892390a206c284c81.tar.gz |
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.
-rw-r--r-- | sys/dev/pci/pci.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index e3b6159..e2e2d55 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -3056,15 +3056,20 @@ pci_resume(device_t dev) static void pci_load_vendor_data(void) { - caddr_t vendordata, info; - - 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'; + caddr_t data; + void *ptr; + size_t sz; + + 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'; + } } } |