Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2011 19:26:51 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218662 - head/sys/dev/pci
Message-ID:  <201102131926.p1DJQpnF049388@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Sun Feb 13 19:26:51 2011
New Revision: 218662
URL: http://svn.freebsd.org/changeset/base/218662

Log:
  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.

Modified:
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Sun Feb 13 19:25:48 2011	(r218661)
+++ head/sys/dev/pci/pci.c	Sun Feb 13 19:26:51 2011	(r218662)
@@ -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';
+		}
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102131926.p1DJQpnF049388>