[PATCH] x86,pci: dmi check for mackpro 2.2 mmconf

Linux Kernel Mailing List, post #231,661
Author:
Date:
Subject:
 Yinghai Lu
 2008-07-18 09:41:09
 [PATCH] x86,pci: dmi check for mackpro 2.2 mmconf
change the mconf bus range from [0,0xff] to to [0, 0x3f]
to match range [0xf0000000, 0xf4000000) in e820 tables.

Signed-off-by: Yinghai Lu <[email protected]>
Tested-by: Jack Howarth <[email protected]>

---
arch/x86/pci/mmconfig-shared.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

Index: linux-2.6/arch/x86/pci/mmconfig-shared.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/mmconfig-shared.c
+++ linux-2.6/arch/x86/pci/mmconfig-shared.c
@@ -374,6 +374,40 @@ reject:

static int __initdata known_bridge;

+static int __devinit check_mmconf(const struct dmi_system_id *d)
+{
+ typeof(pci_mmcfg_config[0]) *cfg;
+
+ if ((pci_mmcfg_config_num != 1) ||
+ (pci_mmcfg_config == NULL) ||
+ (pci_mmcfg_config[0].address == 0))
+ return 1;
+
+ cfg = &pci_mmcfg_config[0];
+
+ if (cfg->start_bus_number == 0 && cfg->end_bus_number > 0x3f)
+ cfg->end_bus_number = 0x3f;
+
+ return 0;
+}
+
+static struct dmi_system_id __devinitdata mmconf_dmi_table[] = {
+ {
+ .callback = check_mmconf,
+ .ident = "Apple",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Apple"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2"),
+ },
+ },
+ {}
+};
+
+void __init check_mmconf_dmi(void)
+{
+ dmi_check_system(mmconf_dmi_table);
+}
+
static void __init __pci_mmcfg_init(int early)
{
/* MMCONFIG disabled */
@@ -395,6 +429,7 @@ static void __init __pci_mmcfg_init(int

if (!known_bridge) {
acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
+ check_mmconf_dmi();
pci_mmcfg_reject_broken(early);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Author:
Date:
Subject:
 Jack Howarth
 2008-07-18 12:50:11
 Re: [PATCH] x86,pci: dmi check for mackpro 2.2 mmconf
YH,
Just filed a radar bug report with Apple as ID 6086072 entitled
"BIOS in MacBook Pro 1.5.1 update is buggy - reports too many buses".
Pointed them to the thread here and the messages with the patch,
the earlydump and 'lspci --vvxxxx' logs.
Jack


On Fri, Jul 18, 2008 at 09:41:09AM -0700, Yinghai Lu wrote:
>
> change the mconf bus range from [0,0xff] to to [0, 0x3f]
> to match range [0xf0000000, 0xf4000000) in e820 tables.
>
> Signed-off-by: Yinghai Lu <[email protected]>
> Tested-by: Jack Howarth <[email protected]>
>
> ---
> arch/x86/pci/mmconfig-shared.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> Index: linux-2.6/arch/x86/pci/mmconfig-shared.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/pci/mmconfig-shared.c
> +++ linux-2.6/arch/x86/pci/mmconfig-shared.c
> @@ -374,6 +374,40 @@ reject:
>
> static int __initdata known_bridge;
>
> +static int __devinit check_mmconf(const struct dmi_system_id *d)
> +{
> + typeof(pci_mmcfg_config[0]) *cfg;
> +
> + if ((pci_mmcfg_config_num != 1) ||
> + (pci_mmcfg_config == NULL) ||
> + (pci_mmcfg_config[0].address == 0))
> + return 1;
> +
> + cfg = &pci_mmcfg_config[0];
> +
> + if (cfg->start_bus_number == 0 && cfg->end_bus_number > 0x3f)
> + cfg->end_bus_number = 0x3f;
> +
> + return 0;
> +}
> +
> +static struct dmi_system_id __devinitdata mmconf_dmi_table[] = {
> + {
> + .callback = check_mmconf,
> + .ident = "Apple",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "Apple"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2"),
> + },
> + },
> + {}
> +};
> +
> +void __init check_mmconf_dmi(void)
> +{
> + dmi_check_system(mmconf_dmi_table);
> +}
> +
> static void __init __pci_mmcfg_init(int early)
> {
> /* MMCONFIG disabled */
> @@ -395,6 +429,7 @@ static void __init __pci_mmcfg_init(int
>
> if (!known_bridge) {
> acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
> + check_mmconf_dmi();
> pci_mmcfg_reject_broken(early);
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Author:
Date:
Subject:
 H. Peter Anvin
 2008-07-18 10:44:36
 Re: [PATCH] x86,pci: dmi check for mackpro 2.2 mmconf
Yinghai Lu wrote:
> change the mconf bus range from [0,0xff] to to [0, 0x3f]
> to match range [0xf0000000, 0xf4000000) in e820 tables.
>
> Signed-off-by: Yinghai Lu <[email protected]>
> Tested-by: Jack Howarth <[email protected]>

Why is this hard-coded instead of discovered dynamically?

-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Author:
Date:
Subject:
 Yinghai Lu
 2008-07-18 10:47:19
 Re: [PATCH] x86,pci: dmi check for mackpro 2.2 mmconf
On Fri, Jul 18, 2008 at 10:44 AM, H. Peter Anvin <[email protected]> wrote:
> Yinghai Lu wrote:
>>
>> change the mconf bus range from [0,0xff] to to [0, 0x3f]
>> to match range [0xf0000000, 0xf4000000) in e820 tables.
>>
>> Signed-off-by: Yinghai Lu <[email protected]>
>> Tested-by: Jack Howarth <[email protected]>
>
> Why is this hard-coded instead of discovered dynamically?

you mean according to the range reserved in e820 to find out bus range
that should be used for mmconf?

YH
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Author:
Date:
Subject:
 H. Peter Anvin
 2008-07-18 10:49:45
 Re: [PATCH] x86,pci: dmi check for mackpro 2.2 mmconf
Yinghai Lu wrote:
> On Fri, Jul 18, 2008 at 10:44 AM, H. Peter Anvin <[email protected]> wrote:
>> Yinghai Lu wrote:
>>> change the mconf bus range from [0,0xff] to to [0, 0x3f]
>>> to match range [0xf0000000, 0xf4000000) in e820 tables.
>>>
>>> Signed-off-by: Yinghai Lu <[email protected]>
>>> Tested-by: Jack Howarth <[email protected]>
>> Why is this hard-coded instead of discovered dynamically?
>
> you mean according to the range reserved in e820 to find out bus range
> that should be used for mmconf?

That would make sense, since you're truncating the mmconf range based on
some arbitrary limit. Even better would be to query the hardware
register which is responsible for the truncation.

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