If PCI_MAP_FIXUP is defined, following fixes will be applied:
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 8 Jun 2007 13:52:09 +0000 (13:52 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 8 Jun 2007 13:52:09 +0000 (13:52 +0000)
commitcc9e67cf7340dcee0173ef871e2b6c69adcf6049
tree5704cb4657a6c42b8b7d9e226f27c6c59bb30517
parent20f020b4e2476edf8658b3a60c902e01714b6dd5
If PCI_MAP_FIXUP is defined, following fixes will be applied:
- For PCI/PCI bridge, adjust requested IO port/memory's start/range according
  to bridge's base/limit register value.
- For Host/PCI bridge, if requested IO port/memory's starts from 0 and range
  is ~0,
  o  If the request is for IO port, the start address is set to 0x1000.
  o  If the request is for IO memory, the start address is set to tunable
     hw.pci.host_mem_start, which is 0x80000000 by default.

This unbreaks cardbus bridge support, if PCI_MAP_FIXUP is defined.

My laptop's cardbus bridge is on the PCI bus mastered by a PCI/PCI bridge,
while swildner@'s laptop's cardbus bridge is on the PCI bus mastered by
Host/PCI bridge.

Tested-by: swildner@ and me
Obtained-from: FreeBSD (imp@freebsd.org)

#
# It seems BIOS does not set cardbus bridge's BAR for most of the system,
# so in the original code, the resource_list_alloc() in pci_alloc_resource()
# will return NULL for cardbus bridge's IO memory allocation request; cardbus
# bridge's code actually depends on that to reallocate IO memory using
# hw.cbb.start_memory as start address.
#
# Before this commit, if PCI_MAP_FIXUP is defined, cardbus bridge's invalid
# IO memory request will be delivered to various PCI bridge code, which does
# not validate/fixup the request and returns "successful" result bindly.
#
sys/bus/pci/i386/pcibus.c
sys/bus/pci/pci_pcib.c