freebsd-skq/sys/sparc64/pci
John Baldwin 83c41143ca Reimplement how PCI-PCI bridges manage their I/O windows. Previously the
driver would verify that requests for child devices were confined to any
existing I/O windows, but the driver relied on the firmware to initialize
the windows and would never grow the windows for new requests.  Now the
driver actively manages the I/O windows.

This is implemented by allocating a bus resource for each I/O window from
the parent PCI bus and suballocating that resource to child devices.  The
suballocations are managed by creating an rman for each I/O window.  The
suballocated resources are mapped by passing the bus_activate_resource()
call up to the parent PCI bus.  Windows are grown when needed by using
bus_adjust_resource() to adjust the resource allocated from the parent PCI
bus.  If the adjust request succeeds, the window is adjusted and the
suballocation request for the child device is retried.

When growing a window, the rman_first_free_region() and
rman_last_free_region() routines are used to determine if the front or
end of the existing I/O window is free.  From using that, the smallest
ranges that need to be added to either the front or back of the window
are computed.  The driver will first try to grow the window in whichever
direction requires the smallest growth first followed by the other
direction if that fails.

Subtractive bridges will first attempt to satisfy requests for child
resources from I/O windows (including attempts to grow the windows).  If
that fails, the request is passed up to the parent PCI bus directly
however.

The PCI-PCI bridge driver will try to use firmware-assigned ranges for
child BARs first and only allocate a "fresh" range if that specific range
cannot be accommodated in the I/O window.  This allows systems where the
firmware assigns resources during boot but later wipes the I/O windows
(some ACPI BIOSen are known to do this) to "rediscover" the original I/O
window ranges.

The ACPI Host-PCI bridge driver has been adjusted to correctly honor
hw.acpi.host_mem_start and the I/O port equivalent when a PCI-PCI bridge
makes a wildcard request for an I/O window range.

The new PCI-PCI bridge driver is only enabled if the NEW_PCIB kernel option
is enabled.  This is a transition aide to allow platforms that do not
yet support bus_activate_resource() and bus_adjust_resource() in their
Host-PCI bridge drivers (and possibly other drivers as needed) to use the
old driver for now.  Once all platforms support the new driver, the
kernel option and old driver will be removed.

PR:		kern/143874 kern/149306
Tested by:	mav
2011-05-03 17:37:24 +00:00
..
apb.c Reimplement how PCI-PCI bridges manage their I/O windows. Previously the 2011-05-03 17:37:24 +00:00
fire.c - Make a panic message better reflect the actual problem. 2011-03-19 20:36:05 +00:00
firereg.h Add a driver for the `Fire' JBus to PCIe bridges found in at least 2009-12-27 16:55:44 +00:00
firevar.h Add a driver for the `Fire' JBus to PCIe bridges found in at least 2009-12-27 16:55:44 +00:00
ofw_pci_if.m - Merge the *_SET macros from fire(4) which generally print out the 2011-03-26 16:49:12 +00:00
ofw_pci.h - Merge the *_SET macros from fire(4) which generally print out the 2011-03-26 16:49:12 +00:00
ofw_pcib_subr.c Provide for multiple, cascaded PICs on PowerPC systems, and extend the 2010-06-18 14:06:27 +00:00
ofw_pcib_subr.h On sparc64 machines with multiple host-PCI-bridges these bridges 2008-04-17 12:38:00 +00:00
ofw_pcib.c Reimplement how PCI-PCI bridges manage their I/O windows. Previously the 2011-05-03 17:37:24 +00:00
ofw_pcibus.c - Merge the *_SET macros from fire(4) which generally print out the 2011-03-26 16:49:12 +00:00
psycho.c Allocate memory for a DMA method table only in case we need to override 2011-03-29 19:48:03 +00:00
psychoreg.h Sync licenses and the corresponding RCS IDs with NetBSD, mainly switching 2011-03-12 14:33:32 +00:00
psychovar.h Allocate memory for a DMA method table only in case we need to override 2011-03-29 19:48:03 +00:00
sbbc.c Fix typos - remove duplicate "the". 2011-02-21 09:01:34 +00:00
schizo.c - Merge the *_SET macros from fire(4) which generally print out the 2011-03-26 16:49:12 +00:00
schizoreg.h - Merge the *_SET macros from fire(4) which generally print out the 2011-03-26 16:49:12 +00:00
schizovar.h - Merge the *_SET macros from fire(4) which generally print out the 2011-03-26 16:49:12 +00:00