Add another parameter to BUS_ADD_CHILD to allow children to inherit
authorMatthew Dillon <dillon@dragonflybsd.org>
Sun, 30 Oct 2005 04:41:15 +0000 (04:41 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sun, 30 Oct 2005 04:41:15 +0000 (04:41 +0000)
commit2581072f98a08d61a3d4cb17d94870d3e4872753
tree186fabbcd7f42cd2a51599aabde7b0850e0ef06d
parentedf5636b266bf75859048a948c129b9eadd70e1e
Add another parameter to BUS_ADD_CHILD to allow children to inherit
code from grandparents.

Formalize and document the IDENTIFY mechanism and actually use it properly
to add PCI busses rather then the severe hacks that existed before.

Instead of attaching PCI busses (pcib) directly to nexus, create a pass-through
bus layer under nexus called 'legacypci' and attach the PCI busses to that.
Use the new BUS_ADD_CHILD and IVARS recursion capability to still allow
the pcib's under legacypci to get nexus generated IVARS.

NOTE ON IVARS:  These can be utterly confusing because a BUS device may
manage and control the IVARS attached to its children.  In addition, if the
BUS method for the device accessing the IVARs does not properly match up
with or recurse to the device that actually created the ivars, mass
confusion can result.  I have attempted to document the issue but XXX it
needs some sanity check code.

Add a 'pcib_owner' global that is used to determine which of the several
possible PCI mainbus subsystems actually own the PCI mainbus.  This is not
yet tied into ACPI but will be soon.  No longer add legacy "pcib" busses
if it is detected that another subsystem controls the mainbus.  Before
the busses were added but then simply not scanned later on, creating
confusing pcibX designations.  Now the busses aren't added... legacypci
stops cold if it doesn't own the PCI mainbus.  Get rid of the twisted
checks for "pci" devices that used to handle this job.

Document many aspects of the PCI code and redo some of the APIs slightly
to make them more obvious.  In particular, document the odd fact that
pci_*() accessor function actually operate on a pci function code based
sub-device of the "pci" driver and call device_get_parent() to get to the
pci" driver layer.  This sub layer really needs its own formal designation.

Change "pciX" attachments to "pcibY" busses.  Use the secondary bus id
for 'X' and require it to be unique.  Also reorder "pcibY" attachments
so the physical bus number tends to (but is not guarenteed to be) the
same 'Y' in pcibY.

Change IVARS access for bridges.  Require that the device representing the
"pcib" device be passed to pcib_get/set_*() routines instead of children
of said device.

Add a function devclass_find_unit() to shortcut the more complex operation
of locating the devclass by name and then getting the device relative to
the devclass.

Add numerous bus_generic_*() BUS methods which now recurse through the
parent instead of terminate with an error.
25 files changed:
sys/bus/firewire/firewire.c
sys/bus/firewire/fwohci_pci.c
sys/bus/isa/isa_common.c
sys/bus/isa/isahint.c
sys/bus/isa/pnp.c
sys/bus/pci/i386/pcibus.c
sys/bus/pci/pci.c
sys/bus/pci/pci_pcib.c
sys/bus/pci/pcivar.h
sys/bus/ppbus/ppbconf.c
sys/dev/acpica5/acpi.c
sys/dev/acpica5/acpi_ec.c
sys/dev/acpica5/acpi_pci.c
sys/dev/acpica5/acpi_timer.c
sys/dev/misc/orm/orm.c
sys/dev/netif/ep/if_ep_isa.c
sys/dev/netif/ex/if_ex_isa.c
sys/dev/sound/isa/es1888.c
sys/i386/i386/nexus.c
sys/i386/i386/pnpbios.c
sys/kern/bus_if.m
sys/kern/subr_bus.c
sys/platform/pc32/i386/nexus.c
sys/platform/pc32/i386/pnpbios.c
sys/sys/bus.h