Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Apr 2011 20:19:51 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r220669 - stable/8/sys/dev/pci
Message-ID:  <201104152019.p3FKJp1i080734@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Apr 15 20:19:50 2011
New Revision: 220669
URL: http://svn.freebsd.org/changeset/base/220669

Log:
  MFC 219865:
  Add pci_find_cap() as an alias for pci_find_extcap() to ease driver
  portability with 9+ where pci_find_extcap() has been renamed to
  pci_find_cap().

Modified:
  stable/8/sys/dev/pci/pci.c
  stable/8/sys/dev/pci/pcivar.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/pci/pci.c
==============================================================================
--- stable/8/sys/dev/pci/pci.c	Fri Apr 15 20:19:18 2011	(r220668)
+++ stable/8/sys/dev/pci/pci.c	Fri Apr 15 20:19:50 2011	(r220669)
@@ -98,7 +98,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
@@ -507,7 +507,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);
 
@@ -535,7 +535,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)
@@ -1612,7 +1612,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;
@@ -1626,7 +1626,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: stable/8/sys/dev/pci/pcivar.h
==============================================================================
--- stable/8/sys/dev/pci/pcivar.h	Fri Apr 15 20:19:18 2011	(r220668)
+++ stable/8/sys/dev/pci/pcivar.h	Fri Apr 15 20:19:50 2011	(r220669)
@@ -400,9 +400,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



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