ACPI: pci_root: check _CRS, then _BBN for downstream bus number
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Thu, 18 Jun 2009 20:46:47 +0000 (14:46 -0600)
committerLen Brown <len.brown@intel.com>
Sat, 20 Jun 2009 04:01:50 +0000 (00:01 -0400)
commitfbe2b31b4b6dfa790cbc88e00631f3112c4fc54e
tree357bb92c83997b667a7b78b6214d1ec9d39deb29
parent07a2039b8eb0af4ff464efd3dfd95de5c02648c6
ACPI: pci_root: check _CRS, then _BBN for downstream bus number

To find a host bridge's downstream bus number, we currently look at _BBN
first.  If _BBN returns a bus number we've already seen, we conclude that
_BBN was wrong and look for a bus number in _CRS.

However, the spec[1] (figure 5-5 and the example in sec 9.12.1) and an ACPI
FAQ[2] suggest that the OS should use _CRS to discover the bus number
range, and that _BBN is really intended to bootstrap _CRS methods that
reference PCI opregions.

This patch makes us always look at _CRS first.  If _CRS doesn't supply a
bus number, we look at _BBN.  If _BBN doesn't exist, we default to zero.
This makes the behavior consistent regardless of device discovery order.
Previously, if A and B had duplicate _BBNs and we found A first, we'd only
look at B's _CRS, whereas if we found B first, we'd only look at A's _CRS.

I'm told that Windows discovers host bridge bus numbers using _CRS, so
it should be fairly safe to rely on this BIOS functionality.

This patch also removes two misleading messages: we printed the "Wrong _BBN
value, reboot and use option 'pci=noacpi'" message before looking at _CRS,
so we would likely find the bus number in _CRS, the system would work fine,
and the user would be confused.  The "PCI _CRS %d overrides _BBN 0" message
incorrectly assumes _BBN was zero, and it's useless anyway because we
print the segment/bus number a few lines later.

References:
    [1] http://www.acpi.info/DOWNLOADS/ACPIspec30b.pdf
    [2] http://www.acpi.info/acpi_faq.htm _BBN/_CRS discussion
    http://download.microsoft.com/download/9/8/f/98f3fe47-dfc3-4e74-92a3-088782200fe7/TWAR05005_WinHEC05.ppt (slide 17)
    http://bugzilla.kernel.org/show_bug.cgi?id=1662 ASUS PR-DLS
    http://bugzilla.kernel.org/show_bug.cgi?id=1127 ASUS PR-DLSW
    http://bugzilla.kernel.org/show_bug.cgi?id=1741 ASUS PR-DLS533

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
CC: Shaohua Li <shaohua.li@intel.com>
CC: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/pci_root.c