freebsd-nq/sys/dev/acpica
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
..
Osd Use the preload_fetch_addr() and preload_fetch_size() convenience 2011-02-13 19:24:04 +00:00
acpi_acad.c Do not hold the ACPI A/C adapter lock when changing the power profile. 2009-09-30 17:07:49 +00:00
acpi_battery.c small cleanup of acpi battery status setting and checking 2010-12-17 16:21:30 +00:00
acpi_button.c Merge ACPICA 20101209. 2010-12-15 23:48:45 +00:00
acpi_cmbat.c small cleanup of acpi battery status setting and checking 2010-12-17 16:21:30 +00:00
acpi_cpu.c Use atomic load & store for TSC frequency. It may be overkill for amd64 but 2011-04-07 23:28:28 +00:00
acpi_dock.c Remove unused assignment. 2010-06-11 19:53:42 +00:00
acpi_ec.c Clarify the previous commit. AcpiFinishGpe() will not clear GPE for us 2011-01-04 17:06:03 +00:00
acpi_hpet.c Small style fixes: 2010-12-16 17:05:28 +00:00
acpi_hpet.h Implement new event timers infrastructure. It provides unified APIs for 2010-06-20 21:33:29 +00:00
acpi_if.m Remove PCI_SET_POWERSTATE method from acpi.c and eradicate all PCI-specific 2010-10-19 19:53:06 +00:00
acpi_isab.c Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
acpi_lid.c Merge ACPICA 20100702. 2010-07-06 20:57:28 +00:00
acpi_package.c Merge ACPICA 20100121. 2010-01-21 21:14:28 +00:00
acpi_pci_link.c Add a forgotten change from the previous commit. 2010-11-05 20:24:26 +00:00
acpi_pci.c Remove bogus check. pcib_get_bus() (like other BUS_ACCESSOR() methods) 2011-01-18 14:58:44 +00:00
acpi_pcib_acpi.c Reimplement how PCI-PCI bridges manage their I/O windows. Previously the 2011-05-03 17:37:24 +00:00
acpi_pcib_pci.c Reimplement how PCI-PCI bridges manage their I/O windows. Previously the 2011-05-03 17:37:24 +00:00
acpi_pcib.c Add a new method to the PCI bridge interface, PCIB_POWER_FOR_SLEEP(). This 2010-08-17 15:44:52 +00:00
acpi_pcibvar.h Add a new method to the PCI bridge interface, PCIB_POWER_FOR_SLEEP(). This 2010-08-17 15:44:52 +00:00
acpi_perf.c Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
acpi_powerres.c Merge ACPICA 20100121. 2010-01-21 21:14:28 +00:00
acpi_quirk.c Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
acpi_quirks
acpi_resource.c Rework r218685. Copy just enough data for the resource type. 2011-02-14 20:05:37 +00:00
acpi_smbat.c small cleanup of acpi battery status setting and checking 2010-12-17 16:21:30 +00:00
acpi_smbus.h
acpi_thermal.c Correctly output the entire array for hw.acpi.thermal._ACx. 2011-04-19 20:44:43 +00:00
acpi_throttle.c Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
acpi_timer.c Do not assume PM timer GAS type is I/O or memory. It may be an unsupported 2011-04-18 23:12:41 +00:00
acpi_video.c Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier. 2011-01-19 00:57:58 +00:00
acpi.c Add event handlers for (ACPI) suspend/resume events. Suspend event handlers 2011-04-14 22:17:39 +00:00
acpiio.h small cleanup of acpi battery status setting and checking 2010-12-17 16:21:30 +00:00
acpivar.h Move a trivial acpi_TimerDelta() to acpivar.h to make it inlineable. 2011-04-04 18:39:04 +00:00