svn commit: r219865 - head/sys/dev/pci

John Baldwin jhb at FreeBSD.org
Tue Mar 22 12:05:50 UTC 2011


Author: jhb
Date: Tue Mar 22 12:05:49 2011
New Revision: 219865
URL: http://svn.freebsd.org/changeset/base/219865

Log:
  Rename pci_find_extcap() to pci_find_cap().  PCI now uses the term
  "extended capabilities" to refer to the new set of capability structures
  starting at offset 0x100 in config space for PCI-express devices.  For now
  both function names will still work.  I will merge this to older branches
  to ease driver portability, but 9.0 will ship with a new pci_find_extcap()
  function that locates extended capabilities instead.
  
  Reviewed by:	imp
  MFC after:	1 week

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

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Tue Mar 22 10:39:34 2011	(r219864)
+++ head/sys/dev/pci/pci.c	Tue Mar 22 12:05:49 2011	(r219865)
@@ -93,7 +93,7 @@ static char		*pci_describe_device(device
 static int		pci_modevent(module_t mod, int what, void *arg);
 static void		pci_hdrtypedata(device_t pcib, int b, int s, int f,
 			    pcicfgregs *cfg);
-static void		pci_read_extcap(device_t pcib, pcicfgregs *cfg);
+static void		pci_read_cap(device_t pcib, pcicfgregs *cfg);
 static int		pci_read_vpd_reg(device_t pcib, pcicfgregs *cfg,
 			    int reg, uint32_t *data);
 #if 0
@@ -536,7 +536,7 @@ pci_read_device(device_t pcib, int d, in
 		pci_hdrtypedata(pcib, b, s, f, cfg);
 
 		if (REG(PCIR_STATUS, 2) & PCIM_STATUS_CAPPRESENT)
-			pci_read_extcap(pcib, cfg);
+			pci_read_cap(pcib, cfg);
 
 		STAILQ_INSERT_TAIL(devlist_head, devlist_entry, pci_links);
 
@@ -564,7 +564,7 @@ pci_read_device(device_t pcib, int d, in
 }
 
 static void
-pci_read_extcap(device_t pcib, pcicfgregs *cfg)
+pci_read_cap(device_t pcib, pcicfgregs *cfg)
 {
 #define	REG(n, w)	PCIB_READ_CONFIG(pcib, cfg->bus, cfg->slot, cfg->func, n, w)
 #define	WREG(n, v, w)	PCIB_WRITE_CONFIG(pcib, cfg->bus, cfg->slot, cfg->func, n, v, w)
@@ -1665,7 +1665,7 @@ pci_get_max_read_req(device_t dev)
 	int cap;
 	uint16_t val;
 
-	if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) != 0)
+	if (pci_find_cap(dev, PCIY_EXPRESS, &cap) != 0)
 		return (0);
 	val = pci_read_config(dev, cap + PCIR_EXPRESS_DEVICE_CTL, 2);
 	val &= PCIM_EXP_CTL_MAX_READ_REQUEST;
@@ -1679,7 +1679,7 @@ pci_set_max_read_req(device_t dev, int s
 	int cap;
 	uint16_t val;
 
-	if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) != 0)
+	if (pci_find_cap(dev, PCIY_EXPRESS, &cap) != 0)
 		return (0);
 	if (size < 128)
 		size = 128;

Modified: head/sys/dev/pci/pcivar.h
==============================================================================
--- head/sys/dev/pci/pcivar.h	Tue Mar 22 10:39:34 2011	(r219864)
+++ head/sys/dev/pci/pcivar.h	Tue Mar 22 12:05:49 2011	(r219865)
@@ -401,9 +401,15 @@ pci_get_powerstate(device_t dev)
 }
 
 static __inline int
+pci_find_cap(device_t dev, int capability, int *capreg)
+{
+    return (PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg));
+}
+
+static __inline int
 pci_find_extcap(device_t dev, int capability, int *capreg)
 {
-    return PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg);
+    return (PCI_FIND_EXTCAP(device_get_parent(dev), dev, capability, capreg));
 }
 
 static __inline int


More information about the svn-src-all mailing list