Attention is currently required from: Lance Zhao, Jason Glenesk, Raul Rangel, Matt DeVillier, Tim Wawrzynczak, Fred Reitberger, Felix Held.
Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69529 )
Change subject: [WIP] ACPI MADT: Use common IOAPIC IRQ override entries ......................................................................
[WIP] ACPI MADT: Use common IOAPIC IRQ override entries
This commit adds couple variants of statically defined IOAPIC overrides, in their current state. Some of these are likely incorrect.
The commit changes the order items appear in MADT table.
Change-Id: I8bc51d91d0071eb03c50d57ef77d8c9b3d89d4b6 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/acpi/acpi.c A src/arch/x86/ioapic_cfg.c M src/mainboard/aopen/dxplplusu/acpi_tables.c M src/mainboard/emulation/qemu-i440fx/acpi_tables.c M src/northbridge/amd/pi/00730F01/acpi_tables.c M src/soc/amd/cezanne/acpi.c M src/soc/amd/common/block/acpi/tables.c M src/soc/amd/common/block/include/amdblocks/acpi.h M src/soc/amd/glinda/acpi.c M src/soc/amd/mendocino/acpi.c M src/soc/amd/morgana/acpi.c M src/soc/amd/picasso/acpi.c M src/soc/amd/stoneyridge/acpi.c M src/southbridge/intel/common/madt.c M src/southbridge/intel/i82801gx/lpc.c M src/southbridge/intel/i82801ix/madt.c M src/southbridge/intel/i82801jx/lpc.c M src/southbridge/intel/ibexpeak/madt.c 18 files changed, 96 insertions(+), 152 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/69529/1
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 1bc3a04..d869fbf 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -213,6 +213,23 @@ return irqoverride->length; }
+unsigned long acpi_create_madt_ioapic_gsi0(unsigned long current, const overrides) +{ + unsigned int i; + uint8_t irq, flags; + + current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDRESS); + + for (i = 0; i < entries; ++i) { + irq = irq_override[i].irq; + flags = irq_override[i].flags; + current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 0, + irq, irq, flags); + } + + return current; +} + int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu, u16 flags, u8 lint) { diff --git a/src/arch/x86/ioapic_cfg.c b/src/arch/x86/ioapic_cfg.c new file mode 100644 index 0000000..745746c --- /dev/null +++ b/src/arch/x86/ioapic_cfg.c @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#define ACPI_SCI_IRQ 9 + +/* PIT is connected to legacy IRQ 0, but IOAPIC GSI 2 */ +#define PIT_TE_PH \ + { MP_BUS_ISA, 0, 2, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH } + +#define PIT_TD_PD \ + { MP_BUS_ISA, 0, 2, MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT } + +/* Possibly EISA by mistake. */ +#define PIT_TD_PD_EISA \ + { MP_BUS_EISA, 0, 2, MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT } + +/* IRQ9 differs from ISA standard - ours is active high, level-triggered */ +#define SCI_TL_PH \ + { MP_BUS_ISA, ACPI_SCI_IRQ, ACPI_SCI_IRQ, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH } + +#define SCI_TL_PL \ + { MP_BUS_ISA, ACPI_SCI_IRQ, ACPI_SCI_IRQ, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW } + +static const _irq_overrides_00 = { PIT_TE_PH, SCI_TL_PH, }; +static const _irq_overrides_01 = { PIT_TD_PD_EISA, SCI_TL_PH, }; +static const _irq_overrides_02 = { PIT_TD_PD, SCI_TL_PH, }; +static const _irq_overrides_03 = { PIT_TD_PD, SCI_TL_PL, }; + +#define DECLARE_IRQ_OVERRIDE_ARRAY(x) \ + const x = { \ + .num_entries = ARRAY_SIZE(_ ## x), \ + .irq_override = _ ## x, \ + } + +DECLARE_IRQ_OVERRIDE_ARRAY(irq_overrides_00); +DECLARE_IRQ_OVERRIDE_ARRAY(irq_overrides_01); +DECLARE_IRQ_OVERRIDE_ARRAY(irq_overrides_02); + +void fill_pit_override(*override) +{ + const pit_default_override = PIT_TD_PD; + *override = pit_default_override; +} + +extern const irq_overrides_00; +extern const irq_overrides_01; +extern const irq_overrides_02; + +void fill_pit_override(*override); diff --git a/src/mainboard/aopen/dxplplusu/acpi_tables.c b/src/mainboard/aopen/dxplplusu/acpi_tables.c index 13ddb3e..ab3e35d 100644 --- a/src/mainboard/aopen/dxplplusu/acpi_tables.c +++ b/src/mainboard/aopen/dxplplusu/acpi_tables.c @@ -11,7 +11,7 @@ current = acpi_create_madt_lapics_with_nmis(current);
/* Southbridge IOAPIC */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, 0xfec00000); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_01);
bdev = pcidev_on_root(2, 0); /* P64H2 Bus B IOAPIC */ @@ -30,11 +30,5 @@ current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, res->base); }
- /* Map ISA IRQ 0 to IRQ 2 */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 1, 0, 2, 0); - - /* IRQ9 differs from ISA standard - ours is active high, level-triggered */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 0, 9, 9, 0xD); - return current; } diff --git a/src/mainboard/emulation/qemu-i440fx/acpi_tables.c b/src/mainboard/emulation/qemu-i440fx/acpi_tables.c index e6262d1..f279703 100644 --- a/src/mainboard/emulation/qemu-i440fx/acpi_tables.c +++ b/src/mainboard/emulation/qemu-i440fx/acpi_tables.c @@ -14,13 +14,7 @@ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); - - /* INT_SRC_OVR */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 0, 2, 0); - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_02);
return current; } diff --git a/src/northbridge/amd/pi/00730F01/acpi_tables.c b/src/northbridge/amd/pi/00730F01/acpi_tables.c index 26636ea..f8677a6 100644 --- a/src/northbridge/amd/pi/00730F01/acpi_tables.c +++ b/src/northbridge/amd/pi/00730F01/acpi_tables.c @@ -8,20 +8,11 @@ /* create all subtables for processors */ current = acpi_create_madt_lapics_with_nmis(current);
- /* Write SB800 IOAPIC, only one */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); + /* Write IOAPIC, only one */ + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_03);
/* TODO: Remove the hardcode */ current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, 0xFEC20000);
- current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 0, 2, 0); - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 9, 9, 0xF); - /* 0: mean bus 0--->ISA */ - /* 0: PIC 0 */ - /* 2: APIC 2 */ - /* 5 mean: 0101 --> Edge-triggered, Active high */ - return current; } diff --git a/src/soc/amd/cezanne/acpi.c b/src/soc/amd/cezanne/acpi.c index 802476e..2341943 100644 --- a/src/soc/amd/cezanne/acpi.c +++ b/src/soc/amd/cezanne/acpi.c @@ -26,21 +26,11 @@ /* create all subtables for processors */ current = acpi_create_madt_lapics_with_nmis(current);
- current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_03);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, GNB_IO_APIC_ADDR);
- /* PIT is connected to legacy IRQ 0, but IOAPIC GSI 2 */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, 0, 2, - MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT); - /* SCI IRQ type override */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, ACPI_SCI_IRQ, ACPI_SCI_IRQ, - MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); - current = acpi_fill_madt_irqoverride(current); - return current; }
diff --git a/src/soc/amd/common/block/acpi/tables.c b/src/soc/amd/common/block/acpi/tables.c index ec484a9..fa32777 100644 --- a/src/soc/amd/common/block/acpi/tables.c +++ b/src/soc/amd/common/block/acpi/tables.c @@ -17,27 +17,6 @@ return acpi_write_hpet(device, current, rsdp); }
-unsigned long acpi_fill_madt_irqoverride(unsigned long current) -{ - const struct soc_amd_common_config *cfg = soc_get_common_config(); - unsigned int i; - uint8_t irq; - uint8_t flags; - - for (i = 0; i < ARRAY_SIZE(cfg->irq_override); ++i) { - irq = cfg->irq_override[i].irq; - flags = cfg->irq_override[i].flags; - - if (!flags) - continue; - - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 0, - irq, irq, flags); - } - - return current; -} - /* Used by _SB.PCI0._CRS */ void acpi_fill_root_complex_tom(const struct device *device) { diff --git a/src/soc/amd/common/block/include/amdblocks/acpi.h b/src/soc/amd/common/block/include/amdblocks/acpi.h index 3dd8418..bd3fead 100644 --- a/src/soc/amd/common/block/include/amdblocks/acpi.h +++ b/src/soc/amd/common/block/include/amdblocks/acpi.h @@ -55,7 +55,6 @@ unsigned long southbridge_write_acpi_tables(const struct device *device, unsigned long current, struct acpi_rsdp *rsdp);
-unsigned long acpi_fill_madt_irqoverride(unsigned long current); void acpi_fill_root_complex_tom(const struct device *device);
uintptr_t add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *rsdp, diff --git a/src/soc/amd/glinda/acpi.c b/src/soc/amd/glinda/acpi.c index 0c95494..121b42f 100644 --- a/src/soc/amd/glinda/acpi.c +++ b/src/soc/amd/glinda/acpi.c @@ -29,21 +29,11 @@ /* create all subtables for processors */ current = acpi_create_madt_lapics_with_nmis(current);
- current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_03);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, GNB_IO_APIC_ADDR);
- /* PIT is connected to legacy IRQ 0, but IOAPIC GSI 2 */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, 0, 2, - MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT); - /* SCI IRQ type override */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, ACPI_SCI_IRQ, ACPI_SCI_IRQ, - MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); - current = acpi_fill_madt_irqoverride(current); - return current; }
diff --git a/src/soc/amd/mendocino/acpi.c b/src/soc/amd/mendocino/acpi.c index d30fb85..2432d9d 100644 --- a/src/soc/amd/mendocino/acpi.c +++ b/src/soc/amd/mendocino/acpi.c @@ -28,21 +28,11 @@ /* create all subtables for processors */ current = acpi_create_madt_lapics_with_nmis(current);
- current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_03);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, GNB_IO_APIC_ADDR);
- /* PIT is connected to legacy IRQ 0, but IOAPIC GSI 2 */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, 0, 2, - MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT); - /* SCI IRQ type override */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, ACPI_SCI_IRQ, ACPI_SCI_IRQ, - MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); - current = acpi_fill_madt_irqoverride(current); - return current; }
diff --git a/src/soc/amd/morgana/acpi.c b/src/soc/amd/morgana/acpi.c index 15b64c5..662146a 100644 --- a/src/soc/amd/morgana/acpi.c +++ b/src/soc/amd/morgana/acpi.c @@ -29,21 +29,11 @@ /* create all subtables for processors */ current = acpi_create_madt_lapics_with_nmis(current);
- current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_03);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, GNB_IO_APIC_ADDR);
- /* PIT is connected to legacy IRQ 0, but IOAPIC GSI 2 */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, 0, 2, - MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT); - /* SCI IRQ type override */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, ACPI_SCI_IRQ, ACPI_SCI_IRQ, - MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); - current = acpi_fill_madt_irqoverride(current); - return current; }
diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c index 6d46698..ec3475f 100644 --- a/src/soc/amd/picasso/acpi.c +++ b/src/soc/amd/picasso/acpi.c @@ -33,22 +33,11 @@ /* create all subtables for processors */ current = acpi_create_madt_lapics_with_nmis(current);
- current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_03);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, GNB_IO_APIC_ADDR);
- /* PIT is connected to legacy IRQ 0, but IOAPIC GSI 2 */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, 0, 2, - MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT); - /* SCI IRQ type override */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, 9, 9, - MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); - - current = acpi_fill_madt_irqoverride(current); - return current; }
diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c index cc0194b..f56ab0a 100644 --- a/src/soc/amd/stoneyridge/acpi.c +++ b/src/soc/amd/stoneyridge/acpi.c @@ -29,19 +29,10 @@ current = acpi_create_madt_lapics_with_nmis(current);
/* Write Kern IOAPIC, only one */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_03);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC2_ADDR);
- /* PIT is connected to legacy IRQ 0, but IOAPIC GSI 2 */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, 0, 2, - MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT); - /* SCI IRQ type override */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, - MP_BUS_ISA, 9, 9, - MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); - return current; }
diff --git a/src/southbridge/intel/common/madt.c b/src/southbridge/intel/common/madt.c index b85e110..90876aa 100644 --- a/src/southbridge/intel/common/madt.c +++ b/src/southbridge/intel/common/madt.c @@ -10,13 +10,7 @@ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); - - /* INT_SRC_OVR */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 0, 2, 0); - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH); + current = acpi_create_madt_ioapic_default_gsi0(current);
return current; } diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c index 362e5cf..0dfaec8 100644 --- a/src/southbridge/intel/i82801gx/lpc.c +++ b/src/southbridge/intel/i82801gx/lpc.c @@ -355,13 +355,7 @@ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); - - /* INT_SRC_OVR */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 0, 2, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_EDGE); - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 9, 9, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_LEVEL); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_00);
return current; } diff --git a/src/southbridge/intel/i82801ix/madt.c b/src/southbridge/intel/i82801ix/madt.c index 009c9ea..d1f7640 100644 --- a/src/southbridge/intel/i82801ix/madt.c +++ b/src/southbridge/intel/i82801ix/madt.c @@ -10,13 +10,7 @@ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); - - /* INT_SRC_OVR */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 0, 2, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_EDGE); - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 9, 9, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_LEVEL); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_00);
return current; } diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c index 39b662a..a1eb0a0 100644 --- a/src/southbridge/intel/i82801jx/lpc.c +++ b/src/southbridge/intel/i82801jx/lpc.c @@ -370,13 +370,7 @@ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); - - /* INT_SRC_OVR */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 0, 2, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_EDGE); - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 9, 9, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_LEVEL); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_00);
return current; } diff --git a/src/southbridge/intel/ibexpeak/madt.c b/src/southbridge/intel/ibexpeak/madt.c index 26b1630..1cb40dd 100644 --- a/src/southbridge/intel/ibexpeak/madt.c +++ b/src/southbridge/intel/ibexpeak/madt.c @@ -12,17 +12,7 @@ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */ - current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR); - - /* INT_SRC_OVR */ - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 0, 2, - MP_IRQ_POLARITY_DEFAULT | - MP_IRQ_TRIGGER_DEFAULT); - current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) - current, 0, 9, 9, - MP_IRQ_POLARITY_HIGH | - MP_IRQ_TRIGGER_LEVEL); + current = acpi_create_madt_ioapic_gsi0(current, &irq_overrides_02);
return current; }