Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Apr 2015 21:16:33 +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-10@freebsd.org
Subject:   svn commit: r280969 - in stable/10/sys/x86: include pci x86
Message-ID:  <201504012116.t31LGXss009517@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Apr  1 21:16:33 2015
New Revision: 280969
URL: https://svnweb.freebsd.org/changeset/base/280969

Log:
  MFC 260973:
  - Reuse legacy_pcib_(read|write)_config() methods in the QPI pcib driver.
  - Reuse legacy_pcib_alloc_msi{,x}() methods in the QPI and mptable pcib
    drivers.

Modified:
  stable/10/sys/x86/include/legacyvar.h
  stable/10/sys/x86/pci/pci_bus.c
  stable/10/sys/x86/pci/qpi.c
  stable/10/sys/x86/x86/mptable_pci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/x86/include/legacyvar.h
==============================================================================
--- stable/10/sys/x86/include/legacyvar.h	Wed Apr  1 20:36:07 2015	(r280968)
+++ stable/10/sys/x86/include/legacyvar.h	Wed Apr  1 21:16:33 2015	(r280969)
@@ -57,6 +57,9 @@ int	legacy_pcib_write_ivar(device_t dev,
     uintptr_t value);
 struct resource *legacy_pcib_alloc_resource(device_t dev, device_t child,
     int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
+int	legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count,
+    int maxcount, int *irqs);
+int	legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq);
 int	legacy_pcib_map_msi(device_t pcib, device_t dev, int irq,
     uint64_t *addr, uint32_t *data);
 

Modified: stable/10/sys/x86/pci/pci_bus.c
==============================================================================
--- stable/10/sys/x86/pci/pci_bus.c	Wed Apr  1 20:36:07 2015	(r280968)
+++ stable/10/sys/x86/pci/pci_bus.c	Wed Apr  1 21:16:33 2015	(r280969)
@@ -92,7 +92,7 @@ legacy_pcib_route_interrupt(device_t pci
 
 /* Pass MSI requests up to the nexus. */
 
-static int
+int
 legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
     int *irqs)
 {
@@ -103,7 +103,7 @@ legacy_pcib_alloc_msi(device_t pcib, dev
 	    irqs));
 }
 
-static int
+int
 legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq)
 {
 	device_t bus;

Modified: stable/10/sys/x86/pci/qpi.c
==============================================================================
--- stable/10/sys/x86/pci/qpi.c	Wed Apr  1 20:36:07 2015	(r280968)
+++ stable/10/sys/x86/pci/qpi.c	Wed Apr  1 21:16:33 2015	(r280969)
@@ -45,8 +45,9 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/cputypes.h>
 #include <machine/md_var.h>
-#include <machine/pci_cfgreg.h>
-#include <machine/specialreg.h>
+#include <x86/legacyvar.h>
+#include <x86/pci_cfgreg.h>
+#include <x86/specialreg.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
@@ -237,42 +238,6 @@ qpi_pcib_read_ivar(device_t dev, device_
 	}
 }
 
-static uint32_t
-qpi_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func,
-    u_int reg, int bytes)
-{
-
-	return (pci_cfgregread(bus, slot, func, reg, bytes));
-}
-
-static void
-qpi_pcib_write_config(device_t dev, u_int bus, u_int slot, u_int func,
-    u_int reg, uint32_t data, int bytes)
-{
-
-	pci_cfgregwrite(bus, slot, func, reg, data, bytes);
-}
-
-static int
-qpi_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
-    int *irqs)
-{
-	device_t bus;
-
-	bus = device_get_parent(pcib);
-	return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount,
-	    irqs));
-}
-
-static int
-qpi_pcib_alloc_msix(device_t pcib, device_t dev, int *irq)
-{
-	device_t bus;
-
-	bus = device_get_parent(pcib);
-	return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq));
-}
-
 static int
 qpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
     uint32_t *data)
@@ -302,11 +267,11 @@ static device_method_t qpi_pcib_methods[
 
 	/* pcib interface */
 	DEVMETHOD(pcib_maxslots,	pcib_maxslots),
-	DEVMETHOD(pcib_read_config,	qpi_pcib_read_config),
-	DEVMETHOD(pcib_write_config,	qpi_pcib_write_config),
-	DEVMETHOD(pcib_alloc_msi,	qpi_pcib_alloc_msi),
+	DEVMETHOD(pcib_read_config,	legacy_pcib_read_config),
+	DEVMETHOD(pcib_write_config,	legacy_pcib_write_config),
+	DEVMETHOD(pcib_alloc_msi,	legacy_pcib_alloc_msi),
 	DEVMETHOD(pcib_release_msi,	pcib_release_msi),
-	DEVMETHOD(pcib_alloc_msix,	qpi_pcib_alloc_msix),
+	DEVMETHOD(pcib_alloc_msix,	legacy_pcib_alloc_msix),
 	DEVMETHOD(pcib_release_msix,	pcib_release_msix),
 	DEVMETHOD(pcib_map_msi,		qpi_pcib_map_msi),
 

Modified: stable/10/sys/x86/x86/mptable_pci.c
==============================================================================
--- stable/10/sys/x86/x86/mptable_pci.c	Wed Apr  1 20:36:07 2015	(r280968)
+++ stable/10/sys/x86/x86/mptable_pci.c	Wed Apr  1 21:16:33 2015	(r280969)
@@ -73,27 +73,6 @@ mptable_hostb_attach(device_t dev)
 	return (bus_generic_attach(dev));
 }
 
-/* Pass MSI requests up to the nexus. */
-static int
-mptable_hostb_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
-    int *irqs)
-{
-	device_t bus;
-
-	bus = device_get_parent(pcib);
-	return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount,
-	    irqs));
-}
-
-static int
-mptable_hostb_alloc_msix(device_t pcib, device_t dev, int *irq)
-{
-	device_t bus;
-
-	bus = device_get_parent(pcib);
-	return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq));
-}
-
 #ifdef NEW_PCIB
 static int
 mptable_is_isa_range(u_long start, u_long end)
@@ -197,9 +176,9 @@ static device_method_t mptable_hostb_met
 	DEVMETHOD(pcib_read_config,	legacy_pcib_read_config),
 	DEVMETHOD(pcib_write_config,	legacy_pcib_write_config),
 	DEVMETHOD(pcib_route_interrupt,	mptable_pci_route_interrupt),
-	DEVMETHOD(pcib_alloc_msi,	mptable_hostb_alloc_msi),
+	DEVMETHOD(pcib_alloc_msi,	legacy_pcib_alloc_msi),
 	DEVMETHOD(pcib_release_msi,	pcib_release_msi),
-	DEVMETHOD(pcib_alloc_msix,	mptable_hostb_alloc_msix),
+	DEVMETHOD(pcib_alloc_msix,	legacy_pcib_alloc_msix),
 	DEVMETHOD(pcib_release_msix,	pcib_release_msix),
 	DEVMETHOD(pcib_map_msi,		legacy_pcib_map_msi),
 



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