PERFORCE change 231377 for review

John Baldwin jhb at FreeBSD.org
Tue Jul 23 17:57:48 UTC 2013


http://p4web.freebsd.org/@@231377?ac=10

Change 231377 by jhb at jhb_pippin on 2013/07/23 17:57:07

	qpi(4) has to learn about bus numbers, too.

Affected files ...

.. //depot/projects/pci/sys/x86/include/legacyvar.h#3 edit
.. //depot/projects/pci/sys/x86/pci/pci_bus.c#5 edit
.. //depot/projects/pci/sys/x86/pci/qpi.c#6 edit

Differences ...

==== //depot/projects/pci/sys/x86/include/legacyvar.h#3 (text+ko) ====

@@ -57,6 +57,8 @@
     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_adjust_resource(device_t dev, device_t child, int type,
+    struct resource *r, u_long start, u_long end);
 int	legacy_pcib_release_resource(device_t dev, device_t child, int type,
     int rid, struct resource *r);
 int	legacy_pcib_map_msi(device_t pcib, device_t dev, int irq,

==== //depot/projects/pci/sys/x86/pci/pci_bus.c#5 (text+ko) ====

@@ -608,7 +608,7 @@
 }
 
 #if defined(NEW_PCIB) && defined(PCI_RES_BUS)
-static int
+int
 legacy_pcib_adjust_resource(device_t dev, device_t child, int type,
     struct resource *r, u_long start, u_long end)
 {

==== //depot/projects/pci/sys/x86/pci/qpi.c#6 (text+ko) ====

@@ -45,8 +45,9 @@
 
 #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,22 +238,20 @@
 	}
 }
 
-static uint32_t
-qpi_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func,
-    u_int reg, int bytes)
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+static struct resource *
+qpi_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)
 {
 
-	return (pci_cfgregread(bus, slot, func, reg, bytes));
+	if (type == PCI_RES_BUS)
+		return (pci_domain_alloc_bus(0, child, rid, start, end, count,
+		    flags));
+	return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
+	    count, flags));
 }
+#endif
 
-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)
@@ -293,8 +292,14 @@
 
 	/* Bus interface */
 	DEVMETHOD(bus_read_ivar,	qpi_pcib_read_ivar),
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+	DEVMETHOD(bus_alloc_resource,	qpi_pcib_alloc_resource),
+	DEVMETHOD(bus_adjust_resource,	legacy_pcib_adjust_resource),
+	DEVMETHOD(bus_release_resource,	legacy_pcib_release_resource),
+#else
 	DEVMETHOD(bus_alloc_resource,	bus_generic_alloc_resource),
 	DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
+#endif
 	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
 	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
 	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
@@ -302,8 +307,8 @@
 
 	/* 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_read_config,	legacy_pcib_read_config),
+	DEVMETHOD(pcib_write_config,	legacy_pcib_write_config),
 	DEVMETHOD(pcib_alloc_msi,	qpi_pcib_alloc_msi),
 	DEVMETHOD(pcib_release_msi,	pcib_release_msi),
 	DEVMETHOD(pcib_alloc_msix,	qpi_pcib_alloc_msix),


More information about the p4-projects mailing list