svn commit: r341455 - in head/sys: dev/pci powerpc/ofw powerpc/powermac

Justin Hibbits jhibbits at FreeBSD.org
Tue Dec 4 04:55:53 UTC 2018


Author: jhibbits
Date: Tue Dec  4 04:55:49 2018
New Revision: 341455
URL: https://svnweb.freebsd.org/changeset/base/341455

Log:
  Sprinkle EARLY_DRIVER_MODULE around the tree
  
  Mark some buses as BUS_PASS_BUS, and some resources as BUS_PASS_RESOURCE.
  This also decouples some resource attachment orderings from being races by
  device tree ordering, instead relying on the bus pass to provide the
  ordering.
  
  This was originally intended to support multipass suspend/resume, but it's
  also needed on PowerMacs when using fdt, as the device tree seems to get
  created in reverse of the OFW tree.
  Reviewed by:	nwhitehorn (long ago)
  Differential Revision:	https://reviews.freebsd.org/D918

Modified:
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_pci.c
  head/sys/powerpc/ofw/ofw_pcib_pci.c
  head/sys/powerpc/ofw/ofw_pcibus.c
  head/sys/powerpc/ofw/openpic_ofw.c
  head/sys/powerpc/powermac/cpcht.c
  head/sys/powerpc/powermac/macgpio.c
  head/sys/powerpc/powermac/macio.c
  head/sys/powerpc/powermac/pmu.c
  head/sys/powerpc/powermac/smu.c
  head/sys/powerpc/powermac/uninorth.c
  head/sys/powerpc/powermac/uninorthpci.c

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/dev/pci/pci.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -214,7 +214,8 @@ static device_method_t pci_methods[] = {
 DEFINE_CLASS_0(pci, pci_driver, pci_methods, sizeof(struct pci_softc));
 
 static devclass_t pci_devclass;
-DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, NULL);
+EARLY_DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, NULL,
+    BUS_PASS_BUS);
 MODULE_VERSION(pci, 1);
 
 static char	*pci_vendordata;

Modified: head/sys/dev/pci/pci_pci.c
==============================================================================
--- head/sys/dev/pci/pci_pci.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/dev/pci/pci_pci.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -131,7 +131,8 @@ static device_method_t pcib_methods[] = {
 static devclass_t pcib_devclass;
 
 DEFINE_CLASS_0(pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc));
-DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, NULL, NULL);
+EARLY_DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, NULL, NULL,
+    BUS_PASS_BUS);
 
 #if defined(NEW_PCIB) || defined(PCI_HP)
 SYSCTL_DECL(_hw_pci);

Modified: head/sys/powerpc/ofw/ofw_pcib_pci.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_pcib_pci.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/ofw/ofw_pcib_pci.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -86,7 +86,8 @@ struct ofw_pcib_softc {
 
 DEFINE_CLASS_1(pcib, ofw_pcib_pci_driver, ofw_pcib_pci_methods,
     sizeof(struct ofw_pcib_softc), pcib_driver);
-DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, pcib_devclass, 0, 0);
+EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, pcib_devclass, 0, 0,
+    BUS_PASS_BUS);
 
 static int
 ofw_pcib_pci_probe(device_t dev)

Modified: head/sys/powerpc/ofw/ofw_pcibus.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_pcibus.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/ofw/ofw_pcibus.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -100,7 +100,8 @@ static devclass_t pci_devclass;
 
 DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods,
     sizeof(struct pci_softc), pci_driver);
-DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0);
+EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_VERSION(ofw_pcibus, 1);
 MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1);
 

Modified: head/sys/powerpc/ofw/openpic_ofw.c
==============================================================================
--- head/sys/powerpc/ofw/openpic_ofw.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/ofw/openpic_ofw.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -95,9 +95,12 @@ static driver_t openpic_ofw_driver = {
 	sizeof(struct openpic_softc),
 };
 
-DRIVER_MODULE(openpic, ofwbus, openpic_ofw_driver, openpic_devclass, 0, 0);
-DRIVER_MODULE(openpic, simplebus, openpic_ofw_driver, openpic_devclass, 0, 0);
-DRIVER_MODULE(openpic, macio, openpic_ofw_driver, openpic_devclass, 0, 0);
+EARLY_DRIVER_MODULE(openpic, ofwbus, openpic_ofw_driver, openpic_devclass,
+    0, 0, BUS_PASS_INTERRUPT);
+EARLY_DRIVER_MODULE(openpic, simplebus, openpic_ofw_driver, openpic_devclass,
+    0, 0, BUS_PASS_INTERRUPT);
+EARLY_DRIVER_MODULE(openpic, macio, openpic_ofw_driver, openpic_devclass, 0, 0,
+    BUS_PASS_INTERRUPT);
 
 static int
 openpic_ofw_probe(device_t dev)

Modified: head/sys/powerpc/powermac/cpcht.c
==============================================================================
--- head/sys/powerpc/powermac/cpcht.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/powermac/cpcht.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -139,7 +139,8 @@ struct cpcht_softc {
 static devclass_t	cpcht_devclass;
 DEFINE_CLASS_1(pcib, cpcht_driver, cpcht_methods, sizeof(struct cpcht_softc),
     ofw_pci_driver);
-DRIVER_MODULE(cpcht, ofwbus, cpcht_driver, cpcht_devclass, 0, 0);
+EARLY_DRIVER_MODULE(cpcht, ofwbus, cpcht_driver, cpcht_devclass, 0, 0,
+    BUS_PASS_BUS);
 
 #define CPCHT_IOPORT_BASE	0xf4000000UL /* Hardwired */
 #define CPCHT_IOPORT_SIZE	0x00400000UL
@@ -545,7 +546,8 @@ static driver_t openpic_cpcht_driver = {
 	sizeof(struct openpic_cpcht_softc),
 };
 
-DRIVER_MODULE(openpic, unin, openpic_cpcht_driver, openpic_devclass, 0, 0);
+EARLY_DRIVER_MODULE(openpic, unin, openpic_cpcht_driver, openpic_devclass,
+    0, 0, BUS_PASS_INTERRUPT);
 
 static int
 openpic_cpcht_probe(device_t dev)

Modified: head/sys/powerpc/powermac/macgpio.c
==============================================================================
--- head/sys/powerpc/powermac/macgpio.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/powermac/macgpio.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -125,7 +125,8 @@ static driver_t macgpio_pci_driver = {
 
 devclass_t macgpio_devclass;
 
-DRIVER_MODULE(macgpio, macio, macgpio_pci_driver, macgpio_devclass, 0, 0);
+EARLY_DRIVER_MODULE(macgpio, macio, macgpio_pci_driver, macgpio_devclass, 0, 0,
+    BUS_PASS_BUS);
 
 struct macgpio_devinfo {
 	struct ofw_bus_devinfo mdi_obdinfo;

Modified: head/sys/powerpc/powermac/macio.c
==============================================================================
--- head/sys/powerpc/powermac/macio.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/powermac/macio.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -135,7 +135,8 @@ static driver_t macio_pci_driver = {
 
 devclass_t macio_devclass;
 
-DRIVER_MODULE(macio, pci, macio_pci_driver, macio_devclass, 0, 0);
+EARLY_DRIVER_MODULE(macio, pci, macio_pci_driver, macio_devclass, 0, 0,
+    BUS_PASS_BUS);
 
 /*
  * PCI ID search table

Modified: head/sys/powerpc/powermac/pmu.c
==============================================================================
--- head/sys/powerpc/powermac/pmu.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/powermac/pmu.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -153,7 +153,8 @@ static driver_t pmu_driver = {
 
 static devclass_t pmu_devclass;
 
-DRIVER_MODULE(pmu, macio, pmu_driver, pmu_devclass, 0, 0);
+EARLY_DRIVER_MODULE(pmu, macio, pmu_driver, pmu_devclass, 0, 0,
+    BUS_PASS_RESOURCE);
 DRIVER_MODULE(adb, pmu, adb_driver, adb_devclass, 0, 0);
 
 static int	pmuextint_probe(device_t);
@@ -175,7 +176,8 @@ static driver_t pmuextint_driver = {
 
 static devclass_t pmuextint_devclass;
 
-DRIVER_MODULE(pmuextint, macgpio, pmuextint_driver, pmuextint_devclass, 0, 0);
+EARLY_DRIVER_MODULE(pmuextint, macgpio, pmuextint_driver, pmuextint_devclass,
+    0, 0, BUS_PASS_RESOURCE);
 
 /* Make sure uhid is loaded, as it turns off some of the ADB emulation */
 MODULE_DEPEND(pmu, usb, 1, 1, 1);

Modified: head/sys/powerpc/powermac/smu.c
==============================================================================
--- head/sys/powerpc/powermac/smu.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/powermac/smu.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -630,7 +630,8 @@ static driver_t doorbell_driver = {
 
 static devclass_t doorbell_devclass;
 
-DRIVER_MODULE(smudoorbell, macgpio, doorbell_driver, doorbell_devclass, 0, 0);
+EARLY_DRIVER_MODULE(smudoorbell, macgpio, doorbell_driver, doorbell_devclass,
+    0, 0, BUS_PASS_SUPPORTDEV);
 
 static int
 doorbell_probe(device_t dev)

Modified: head/sys/powerpc/powermac/uninorth.c
==============================================================================
--- head/sys/powerpc/powermac/uninorth.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/powermac/uninorth.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -146,7 +146,8 @@ static devclass_t	unin_chip_devclass;
  */
 static device_t		unin_chip;
 
-DRIVER_MODULE(unin, ofwbus, unin_chip_driver, unin_chip_devclass, 0, 0);
+EARLY_DRIVER_MODULE(unin, ofwbus, unin_chip_driver, unin_chip_devclass, 0, 0,
+    BUS_PASS_BUS);
 
 /*
  * Add an interrupt to the dev's resource list if present

Modified: head/sys/powerpc/powermac/uninorthpci.c
==============================================================================
--- head/sys/powerpc/powermac/uninorthpci.c	Tue Dec  4 03:51:10 2018	(r341454)
+++ head/sys/powerpc/powermac/uninorthpci.c	Tue Dec  4 04:55:49 2018	(r341455)
@@ -101,7 +101,8 @@ static devclass_t	uninorth_devclass;
 
 DEFINE_CLASS_1(pcib, uninorth_driver, uninorth_methods,
     sizeof(struct uninorth_softc), ofw_pci_driver);
-DRIVER_MODULE(uninorth, ofwbus, uninorth_driver, uninorth_devclass, 0, 0);
+EARLY_DRIVER_MODULE(uninorth, ofwbus, uninorth_driver, uninorth_devclass, 0, 0,
+    BUS_PASS_BUS);
 
 static int
 uninorth_probe(device_t dev)


More information about the svn-src-head mailing list