diff options
author | Peter Wemm <peter@FreeBSD.org> | 1999-05-18 20:48:43 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 1999-05-18 20:48:43 +0000 |
commit | 8dc26439da0d68c4035e407368d5e775b266deb2 (patch) | |
tree | a047a34bf46dbd9d11c085a6fa41879eeb300911 | |
parent | 5334b9c3cf61f734881ff6e96d87371a97b677ac (diff) | |
download | src-8dc26439da0d68c4035e407368d5e775b266deb2.tar.gz src-8dc26439da0d68c4035e407368d5e775b266deb2.zip |
Move pcibus (host -> pci bus) probe/attach routines from nexus
to pcibus.c. pci_cfgopen() becomes static and there are no more
bus #ifdef's in nexus.c.
Notes
Notes:
svn path=/head/; revision=47307
-rw-r--r-- | sys/amd64/amd64/legacy.c | 58 | ||||
-rw-r--r-- | sys/amd64/amd64/nexus.c | 58 | ||||
-rw-r--r-- | sys/amd64/pci/pci_bus.c | 50 | ||||
-rw-r--r-- | sys/amd64/pci/pci_cfgreg.c | 50 | ||||
-rw-r--r-- | sys/dev/pci/pcivar.h | 3 | ||||
-rw-r--r-- | sys/i386/i386/legacy.c | 58 | ||||
-rw-r--r-- | sys/i386/i386/nexus.c | 58 | ||||
-rw-r--r-- | sys/i386/isa/pcibus.c | 50 | ||||
-rw-r--r-- | sys/i386/pci/pci_bus.c | 50 | ||||
-rw-r--r-- | sys/i386/pci/pci_cfgreg.c | 50 | ||||
-rw-r--r-- | sys/i386/pci/pci_pir.c | 50 | ||||
-rw-r--r-- | sys/pci/pcivar.h | 3 |
12 files changed, 300 insertions, 238 deletions
diff --git a/sys/amd64/amd64/legacy.c b/sys/amd64/amd64/legacy.c index a10df59eb2ac..8551f362ab04 100644 --- a/sys/amd64/amd64/legacy.c +++ b/sys/amd64/amd64/legacy.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.8 1999/05/08 21:59:22 dfr Exp $ + * $Id: nexus.c,v 1.9 1999/05/10 17:56:20 dfr Exp $ */ /* @@ -71,11 +71,6 @@ #include <i386/isa/icu.h> #include <i386/isa/intr_machdep.h> -#include "pci.h" -#if NPCI > 0 -#include <pci/pcivar.h> -#endif - static struct rman irq_rman, drq_rman, port_rman, mem_rman; static int nexus_probe(device_t); @@ -197,14 +192,9 @@ nexus_probe(device_t dev) if (child == 0) panic("nexus_probe apm"); -#if NPCI > 0 - /* pci_cfgopen() should come out of here so it could be loadable */ - if (pci_cfgopen() != 0) { - child = device_add_child(dev, "pcib", 0, 0); - if (child == 0) - panic("nexus_probe pcib"); - } -#endif + child = device_add_child(dev, "pcib", 0, 0); + if (child == 0) + panic("nexus_probe pcib"); child = device_add_child(dev, "eisa", 0, 0); if (child == 0) @@ -382,43 +372,3 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) { return (inthand_remove(ih)); } - -static devclass_t pcib_devclass; - -static int -nexus_pcib_probe(device_t dev) -{ - device_set_desc(dev, "PCI host bus adapter"); - - device_add_child(dev, "pci", 0, 0); - - return 0; -} - -static device_method_t nexus_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, nexus_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static driver_t nexus_pcib_driver = { - "pcib", - nexus_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/amd64/amd64/nexus.c b/sys/amd64/amd64/nexus.c index a10df59eb2ac..8551f362ab04 100644 --- a/sys/amd64/amd64/nexus.c +++ b/sys/amd64/amd64/nexus.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.8 1999/05/08 21:59:22 dfr Exp $ + * $Id: nexus.c,v 1.9 1999/05/10 17:56:20 dfr Exp $ */ /* @@ -71,11 +71,6 @@ #include <i386/isa/icu.h> #include <i386/isa/intr_machdep.h> -#include "pci.h" -#if NPCI > 0 -#include <pci/pcivar.h> -#endif - static struct rman irq_rman, drq_rman, port_rman, mem_rman; static int nexus_probe(device_t); @@ -197,14 +192,9 @@ nexus_probe(device_t dev) if (child == 0) panic("nexus_probe apm"); -#if NPCI > 0 - /* pci_cfgopen() should come out of here so it could be loadable */ - if (pci_cfgopen() != 0) { - child = device_add_child(dev, "pcib", 0, 0); - if (child == 0) - panic("nexus_probe pcib"); - } -#endif + child = device_add_child(dev, "pcib", 0, 0); + if (child == 0) + panic("nexus_probe pcib"); child = device_add_child(dev, "eisa", 0, 0); if (child == 0) @@ -382,43 +372,3 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) { return (inthand_remove(ih)); } - -static devclass_t pcib_devclass; - -static int -nexus_pcib_probe(device_t dev) -{ - device_set_desc(dev, "PCI host bus adapter"); - - device_add_child(dev, "pci", 0, 0); - - return 0; -} - -static device_method_t nexus_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, nexus_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static driver_t nexus_pcib_driver = { - "pcib", - nexus_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/amd64/pci/pci_bus.c b/sys/amd64/pci/pci_bus.c index 40f3b6b00839..14ed5258089c 100644 --- a/sys/amd64/pci/pci_bus.c +++ b/sys/amd64/pci/pci_bus.c @@ -23,12 +23,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.40 1997/07/20 14:10:08 bde Exp $ + * $Id: pcibus.c,v 1.41 1997/12/20 09:04:25 se Exp $ * */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/systm.h> +#include <sys/bus.h> +#include <sys/kernel.h> #include <pci/pcivar.h> #include <i386/isa/pcibus.h> @@ -184,7 +186,7 @@ pci_cfgcheck(int maxdev) return (0); } -int +static int pci_cfgopen(void) { unsigned long mode1res,oldval1; @@ -263,3 +265,45 @@ pci_cfgopen(void) devmax = 0; return (cfgmech); } + +static devclass_t pcib_devclass; + +static int +nexus_pcib_probe(device_t dev) +{ + if (pci_cfgopen() != 0) { + device_set_desc(dev, "PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + return 0; + } + return ENXIO; +} + +static device_method_t nexus_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nexus_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t nexus_pcib_driver = { + "pcib", + nexus_pcib_methods, + 1, +}; + +DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c index 40f3b6b00839..14ed5258089c 100644 --- a/sys/amd64/pci/pci_cfgreg.c +++ b/sys/amd64/pci/pci_cfgreg.c @@ -23,12 +23,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.40 1997/07/20 14:10:08 bde Exp $ + * $Id: pcibus.c,v 1.41 1997/12/20 09:04:25 se Exp $ * */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/systm.h> +#include <sys/bus.h> +#include <sys/kernel.h> #include <pci/pcivar.h> #include <i386/isa/pcibus.h> @@ -184,7 +186,7 @@ pci_cfgcheck(int maxdev) return (0); } -int +static int pci_cfgopen(void) { unsigned long mode1res,oldval1; @@ -263,3 +265,45 @@ pci_cfgopen(void) devmax = 0; return (cfgmech); } + +static devclass_t pcib_devclass; + +static int +nexus_pcib_probe(device_t dev) +{ + if (pci_cfgopen() != 0) { + device_set_desc(dev, "PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + return 0; + } + return ENXIO; +} + +static device_method_t nexus_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nexus_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t nexus_pcib_driver = { + "pcib", + nexus_pcib_methods, + 1, +}; + +DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index 12c1bab2aa46..432551bac82a 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcivar.h,v 1.30 1999/05/09 20:25:01 peter Exp $ + * $Id: pcivar.h,v 1.31 1999/05/11 07:55:32 peter Exp $ * */ @@ -177,7 +177,6 @@ const char *ide_pci_match(struct device *dev); /* low level PCI config register functions provided by pcibus.c */ -int pci_cfgopen (void); int pci_cfgread (pcicfgregs *cfg, int reg, int bytes); void pci_cfgwrite (pcicfgregs *cfg, int reg, int data, int bytes); #ifdef __alpha__ diff --git a/sys/i386/i386/legacy.c b/sys/i386/i386/legacy.c index a10df59eb2ac..8551f362ab04 100644 --- a/sys/i386/i386/legacy.c +++ b/sys/i386/i386/legacy.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.8 1999/05/08 21:59:22 dfr Exp $ + * $Id: nexus.c,v 1.9 1999/05/10 17:56:20 dfr Exp $ */ /* @@ -71,11 +71,6 @@ #include <i386/isa/icu.h> #include <i386/isa/intr_machdep.h> -#include "pci.h" -#if NPCI > 0 -#include <pci/pcivar.h> -#endif - static struct rman irq_rman, drq_rman, port_rman, mem_rman; static int nexus_probe(device_t); @@ -197,14 +192,9 @@ nexus_probe(device_t dev) if (child == 0) panic("nexus_probe apm"); -#if NPCI > 0 - /* pci_cfgopen() should come out of here so it could be loadable */ - if (pci_cfgopen() != 0) { - child = device_add_child(dev, "pcib", 0, 0); - if (child == 0) - panic("nexus_probe pcib"); - } -#endif + child = device_add_child(dev, "pcib", 0, 0); + if (child == 0) + panic("nexus_probe pcib"); child = device_add_child(dev, "eisa", 0, 0); if (child == 0) @@ -382,43 +372,3 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) { return (inthand_remove(ih)); } - -static devclass_t pcib_devclass; - -static int -nexus_pcib_probe(device_t dev) -{ - device_set_desc(dev, "PCI host bus adapter"); - - device_add_child(dev, "pci", 0, 0); - - return 0; -} - -static device_method_t nexus_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, nexus_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static driver_t nexus_pcib_driver = { - "pcib", - nexus_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/i386/i386/nexus.c b/sys/i386/i386/nexus.c index a10df59eb2ac..8551f362ab04 100644 --- a/sys/i386/i386/nexus.c +++ b/sys/i386/i386/nexus.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.8 1999/05/08 21:59:22 dfr Exp $ + * $Id: nexus.c,v 1.9 1999/05/10 17:56:20 dfr Exp $ */ /* @@ -71,11 +71,6 @@ #include <i386/isa/icu.h> #include <i386/isa/intr_machdep.h> -#include "pci.h" -#if NPCI > 0 -#include <pci/pcivar.h> -#endif - static struct rman irq_rman, drq_rman, port_rman, mem_rman; static int nexus_probe(device_t); @@ -197,14 +192,9 @@ nexus_probe(device_t dev) if (child == 0) panic("nexus_probe apm"); -#if NPCI > 0 - /* pci_cfgopen() should come out of here so it could be loadable */ - if (pci_cfgopen() != 0) { - child = device_add_child(dev, "pcib", 0, 0); - if (child == 0) - panic("nexus_probe pcib"); - } -#endif + child = device_add_child(dev, "pcib", 0, 0); + if (child == 0) + panic("nexus_probe pcib"); child = device_add_child(dev, "eisa", 0, 0); if (child == 0) @@ -382,43 +372,3 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) { return (inthand_remove(ih)); } - -static devclass_t pcib_devclass; - -static int -nexus_pcib_probe(device_t dev) -{ - device_set_desc(dev, "PCI host bus adapter"); - - device_add_child(dev, "pci", 0, 0); - - return 0; -} - -static device_method_t nexus_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, nexus_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static driver_t nexus_pcib_driver = { - "pcib", - nexus_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/i386/isa/pcibus.c b/sys/i386/isa/pcibus.c index 40f3b6b00839..14ed5258089c 100644 --- a/sys/i386/isa/pcibus.c +++ b/sys/i386/isa/pcibus.c @@ -23,12 +23,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.40 1997/07/20 14:10:08 bde Exp $ + * $Id: pcibus.c,v 1.41 1997/12/20 09:04:25 se Exp $ * */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/systm.h> +#include <sys/bus.h> +#include <sys/kernel.h> #include <pci/pcivar.h> #include <i386/isa/pcibus.h> @@ -184,7 +186,7 @@ pci_cfgcheck(int maxdev) return (0); } -int +static int pci_cfgopen(void) { unsigned long mode1res,oldval1; @@ -263,3 +265,45 @@ pci_cfgopen(void) devmax = 0; return (cfgmech); } + +static devclass_t pcib_devclass; + +static int +nexus_pcib_probe(device_t dev) +{ + if (pci_cfgopen() != 0) { + device_set_desc(dev, "PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + return 0; + } + return ENXIO; +} + +static device_method_t nexus_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nexus_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t nexus_pcib_driver = { + "pcib", + nexus_pcib_methods, + 1, +}; + +DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/i386/pci/pci_bus.c b/sys/i386/pci/pci_bus.c index 40f3b6b00839..14ed5258089c 100644 --- a/sys/i386/pci/pci_bus.c +++ b/sys/i386/pci/pci_bus.c @@ -23,12 +23,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.40 1997/07/20 14:10:08 bde Exp $ + * $Id: pcibus.c,v 1.41 1997/12/20 09:04:25 se Exp $ * */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/systm.h> +#include <sys/bus.h> +#include <sys/kernel.h> #include <pci/pcivar.h> #include <i386/isa/pcibus.h> @@ -184,7 +186,7 @@ pci_cfgcheck(int maxdev) return (0); } -int +static int pci_cfgopen(void) { unsigned long mode1res,oldval1; @@ -263,3 +265,45 @@ pci_cfgopen(void) devmax = 0; return (cfgmech); } + +static devclass_t pcib_devclass; + +static int +nexus_pcib_probe(device_t dev) +{ + if (pci_cfgopen() != 0) { + device_set_desc(dev, "PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + return 0; + } + return ENXIO; +} + +static device_method_t nexus_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nexus_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t nexus_pcib_driver = { + "pcib", + nexus_pcib_methods, + 1, +}; + +DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index 40f3b6b00839..14ed5258089c 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -23,12 +23,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.40 1997/07/20 14:10:08 bde Exp $ + * $Id: pcibus.c,v 1.41 1997/12/20 09:04:25 se Exp $ * */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/systm.h> +#include <sys/bus.h> +#include <sys/kernel.h> #include <pci/pcivar.h> #include <i386/isa/pcibus.h> @@ -184,7 +186,7 @@ pci_cfgcheck(int maxdev) return (0); } -int +static int pci_cfgopen(void) { unsigned long mode1res,oldval1; @@ -263,3 +265,45 @@ pci_cfgopen(void) devmax = 0; return (cfgmech); } + +static devclass_t pcib_devclass; + +static int +nexus_pcib_probe(device_t dev) +{ + if (pci_cfgopen() != 0) { + device_set_desc(dev, "PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + return 0; + } + return ENXIO; +} + +static device_method_t nexus_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nexus_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t nexus_pcib_driver = { + "pcib", + nexus_pcib_methods, + 1, +}; + +DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c index 40f3b6b00839..14ed5258089c 100644 --- a/sys/i386/pci/pci_pir.c +++ b/sys/i386/pci/pci_pir.c @@ -23,12 +23,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.40 1997/07/20 14:10:08 bde Exp $ + * $Id: pcibus.c,v 1.41 1997/12/20 09:04:25 se Exp $ * */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/systm.h> +#include <sys/bus.h> +#include <sys/kernel.h> #include <pci/pcivar.h> #include <i386/isa/pcibus.h> @@ -184,7 +186,7 @@ pci_cfgcheck(int maxdev) return (0); } -int +static int pci_cfgopen(void) { unsigned long mode1res,oldval1; @@ -263,3 +265,45 @@ pci_cfgopen(void) devmax = 0; return (cfgmech); } + +static devclass_t pcib_devclass; + +static int +nexus_pcib_probe(device_t dev) +{ + if (pci_cfgopen() != 0) { + device_set_desc(dev, "PCI host bus adapter"); + + device_add_child(dev, "pci", 0, 0); + return 0; + } + return ENXIO; +} + +static device_method_t nexus_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, nexus_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t nexus_pcib_driver = { + "pcib", + nexus_pcib_methods, + 1, +}; + +DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/pci/pcivar.h b/sys/pci/pcivar.h index 12c1bab2aa46..432551bac82a 100644 --- a/sys/pci/pcivar.h +++ b/sys/pci/pcivar.h @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcivar.h,v 1.30 1999/05/09 20:25:01 peter Exp $ + * $Id: pcivar.h,v 1.31 1999/05/11 07:55:32 peter Exp $ * */ @@ -177,7 +177,6 @@ const char *ide_pci_match(struct device *dev); /* low level PCI config register functions provided by pcibus.c */ -int pci_cfgopen (void); int pci_cfgread (pcicfgregs *cfg, int reg, int bytes); void pci_cfgwrite (pcicfgregs *cfg, int reg, int data, int bytes); #ifdef __alpha__ |