ACPI: Add helper for MADT LAPIC NMIs
This avoids some code duplication related to X2APIC mode. Change-Id: I2cb8676efc1aba1b154fd04c49e53b2530239b4c Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/74311 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sridhar Siricilla <sridhar.siricilla@intel.com> Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com>
This commit is contained in:
parent
899c713e3e
commit
9ac1fb729f
|
@ -213,7 +213,7 @@ int acpi_create_madt_irqoverride(acpi_madt_irqoverride_t *irqoverride,
|
||||||
return irqoverride->length;
|
return irqoverride->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu,
|
static int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu,
|
||||||
u16 flags, u8 lint)
|
u16 flags, u8 lint)
|
||||||
{
|
{
|
||||||
lapic_nmi->type = LOCAL_APIC_NMI; /* Local APIC NMI structure */
|
lapic_nmi->type = LOCAL_APIC_NMI; /* Local APIC NMI structure */
|
||||||
|
@ -225,7 +225,7 @@ int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu,
|
||||||
return lapic_nmi->length;
|
return lapic_nmi->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu,
|
static int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu,
|
||||||
u16 flags, u8 lint)
|
u16 flags, u8 lint)
|
||||||
{
|
{
|
||||||
lapic_nmi->type = LOCAL_X2APIC_NMI; /* Local APIC NMI structure */
|
lapic_nmi->type = LOCAL_X2APIC_NMI; /* Local APIC NMI structure */
|
||||||
|
@ -240,12 +240,10 @@ int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu,
|
||||||
return lapic_nmi->length;
|
return lapic_nmi->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current)
|
unsigned long acpi_create_madt_lapic_nmis(unsigned long current)
|
||||||
{
|
{
|
||||||
const u16 flags = MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH;
|
const u16 flags = MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH;
|
||||||
|
|
||||||
current = acpi_create_madt_lapics(current);
|
|
||||||
|
|
||||||
/* 1: LINT1 connect to NMI */
|
/* 1: LINT1 connect to NMI */
|
||||||
/* create all subtables for processors */
|
/* create all subtables for processors */
|
||||||
current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
|
current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
|
||||||
|
@ -258,6 +256,13 @@ unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current)
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current)
|
||||||
|
{
|
||||||
|
current = acpi_create_madt_lapics(current);
|
||||||
|
current = acpi_create_madt_lapic_nmis(current);
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
void acpi_create_madt(acpi_madt_t *madt)
|
void acpi_create_madt(acpi_madt_t *madt)
|
||||||
{
|
{
|
||||||
acpi_header_t *header = &(madt->header);
|
acpi_header_t *header = &(madt->header);
|
||||||
|
|
|
@ -1340,14 +1340,15 @@ int acpi_create_madt_ioapic(acpi_madt_ioapic_t *ioapic, u8 id, u32 addr,
|
||||||
int acpi_create_madt_ioapic_from_hw(acpi_madt_ioapic_t *ioapic, u32 addr);
|
int acpi_create_madt_ioapic_from_hw(acpi_madt_ioapic_t *ioapic, u32 addr);
|
||||||
int acpi_create_madt_irqoverride(acpi_madt_irqoverride_t *irqoverride,
|
int acpi_create_madt_irqoverride(acpi_madt_irqoverride_t *irqoverride,
|
||||||
u8 bus, u8 source, u32 gsirq, u16 flags);
|
u8 bus, u8 source, u32 gsirq, u16 flags);
|
||||||
int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu,
|
|
||||||
u16 flags, u8 lint);
|
|
||||||
void acpi_create_madt(acpi_madt_t *madt);
|
void acpi_create_madt(acpi_madt_t *madt);
|
||||||
|
|
||||||
unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current);
|
unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current);
|
||||||
|
|
||||||
|
unsigned long acpi_create_madt_lapic_nmis(unsigned long current);
|
||||||
|
|
||||||
int acpi_create_madt_lx2apic(acpi_madt_lx2apic_t *lapic, u32 cpu, u32 apic);
|
int acpi_create_madt_lx2apic(acpi_madt_lx2apic_t *lapic, u32 cpu, u32 apic);
|
||||||
int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu,
|
|
||||||
u16 flags, u8 lint);
|
|
||||||
int acpi_create_srat_lapic(acpi_srat_lapic_t *lapic, u8 node, u8 apic);
|
int acpi_create_srat_lapic(acpi_srat_lapic_t *lapic, u8 node, u8 apic);
|
||||||
int acpi_create_srat_x2apic(acpi_srat_x2apic_t *x2apic, u32 node, u32 apic);
|
int acpi_create_srat_x2apic(acpi_srat_x2apic_t *x2apic, u32 node, u32 apic);
|
||||||
int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek,
|
int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek,
|
||||||
|
|
|
@ -95,19 +95,8 @@ static unsigned long acpi_create_madt_lapics_hybrid(unsigned long current)
|
||||||
|
|
||||||
unsigned long acpi_create_madt_lapics_with_nmis_hybrid(unsigned long current)
|
unsigned long acpi_create_madt_lapics_with_nmis_hybrid(unsigned long current)
|
||||||
{
|
{
|
||||||
const u16 flags = MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH;
|
|
||||||
|
|
||||||
current = acpi_create_madt_lapics_hybrid(current);
|
current = acpi_create_madt_lapics_hybrid(current);
|
||||||
|
current = acpi_create_madt_lapic_nmis(current);
|
||||||
/* 1: LINT1 connect to NMI */
|
|
||||||
/* create all subtables for processors */
|
|
||||||
current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
|
|
||||||
ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS, flags, 1);
|
|
||||||
|
|
||||||
if (!CONFIG(XAPIC_ONLY))
|
|
||||||
current += acpi_create_madt_lx2apic_nmi((acpi_madt_lx2apic_nmi_t *)current,
|
|
||||||
ACPI_MADT_LX2APIC_NMI_ALL_PROCESSORS, flags, 1);
|
|
||||||
|
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue