[PATCH] Make x86 Host-PCI bridge drivers honor decoded ranges

John Baldwin jhb at FreeBSD.org
Sun Jul 10 00:04:08 UTC 2011


This patch adds a new API (pcib_host_res_*) that Host-PCI bridge drivers can 
use to restrict allocations for child devices to a known subset of address 
ranges that the bridge decodes.  Originally I tried to allocate the full 
ranges and use rmans just as we now do for PCI-PCI bridge windows.  However, 
this broke due to the fact that all of our ACPI LPC/ISA devices attach at the 
"wrong" place in the tree (they aren't behind the host-PCI bridges) and a 
typical ACPI BIOS will allocate the full I/O port range to the host-PCI 
bridge.  We could perhaps fix this later if we relocate all the ACPI devices 
that are actually ISA devices down onto an ACPI-aware ISA bus (i.e. an ISA bus 
that uses ACPI to enumerate devices).  Anyway, I punted on that for now.  
Instead, the current API works by using a resource_list to keep track of all 
the valid address ranges.  When an allocation request is made, it simply tries 
all the address ranges in turn.  I still made it honor hw.pci.host_mem_start 
since the ACPI BIOSes I have seen will optionally include option ROM space 
below 1MB if any ROMs are active, but we don't want to allocate that space for 
a wildcard BAR operation.

I've changed the ACPI and MPTable Host-PCI bridge drivers to use this helper 
API.  For ACPI we claim that bridges decode any "producer" address ranges in 
the bridges _CRS.  For the MPTable I had to add logic to walk the extended 
MPTable entries and use those extended entries to find the list of decoded 
ranges.  I'd like to get this into 9.0 and would appreciate folks testing it out.

http://www.FreeBSD.org/~jhb/patches/pci_host_res.patch

-- 
John Baldwin



More information about the freebsd-current mailing list