[PATCH 2/3] x86: Allow early PCI quirks to trigger on bus 1

From: Matthew Garrett
Date: Wed May 23 2012 - 14:09:48 EST


The early PCI quirks code currently only scans bus 0. Extend it to bus 1
in order to allow us to add a quirk for broken Apple firmware, and make
sure that the vendor-generic chipset quirks are only run on bus 0.

Signed-off-by: Matthew Garrett <mjg@xxxxxxxxxx>
---
arch/x86/kernel/early-quirks.c | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 3755ef4..dcf4bcf 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -48,6 +48,10 @@ static void __init fix_hypertransport_config(int num, int slot, int func)
static void __init via_bugs(int num, int slot, int func)
{
#ifdef CONFIG_GART_IOMMU
+ /* Only match on the root bus */
+ if (num > 0)
+ return;
+
if ((max_pfn > MAX_DMA32_PFN || force_iommu) &&
!gart_iommu_aperture_allowed) {
printk(KERN_INFO
@@ -72,6 +76,10 @@ static void __init nvidia_bugs(int num, int slot, int func)
{
#ifdef CONFIG_ACPI
#ifdef CONFIG_X86_IO_APIC
+ /* Only match on the root bus */
+ if (num > 0)
+ return;
+
/*
* All timer overrides on Nvidia are
* wrong unless HPET is enabled.
@@ -205,10 +213,7 @@ struct chipset {
};

/*
- * Only works for devices on the root bus. If you add any devices
- * not on bus 0 readd another loop level in early_quirks(). But
- * be careful because at least the Nvidia quirk here relies on
- * only matching on bus 0.
+ * Only works for devices on the root bus and bus 1.
*/
static struct chipset early_qrk[] __initdata = {
{ PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
@@ -276,17 +281,19 @@ static int __init check_dev_quirk(int num, int slot, int func)

void __init early_quirks(void)
{
- int slot, func;
+ int bus, slot, func;

if (!early_pci_allowed())
return;

/* Poor man's PCI discovery */
- /* Only scan the root bus */
- for (slot = 0; slot < 32; slot++)
- for (func = 0; func < 8; func++) {
- /* Only probe function 0 on single fn devices */
- if (check_dev_quirk(0, slot, func))
- break;
- }
+ /* Apple Broadcom quirk is on bus 1 */
+ for (bus = 0; bus < 2; bus++) {
+ for (slot = 0; slot < 32; slot++)
+ for (func = 0; func < 8; func++) {
+ /* Only probe function 0 on single fn devices */
+ if (check_dev_quirk(bus, slot, func))
+ break;
+ }
+ }
}
--
1.7.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/