summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2022-11-12 21:13:45 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2022-11-25 15:01:49 +0000
commit66b5e1b32ddac58b6d4c7679a0ea274041225a24 (patch)
treebb9f21608536b719d7b8dc2aba421dc9f0ce5ddd
parentda1a58a50333d3a9b370a7e18ed4c3b69b17d2ba (diff)
ACPI: Use common code for MADT LAPIC NMIs
Use the broadcast ID to deliver LINT1 as NMI to all CPUs, instead of listing individual LAPIC IDs. Change-Id: Iaf714d8c2aabd16c59c3bcebc4a207406fc85ca9 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69527 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
-rw-r--r--src/acpi/acpi.c18
-rw-r--r--src/include/acpi/acpi.h4
-rw-r--r--src/soc/amd/cezanne/acpi.c8
-rw-r--r--src/soc/amd/glinda/acpi.c8
-rw-r--r--src/soc/amd/mendocino/acpi.c8
-rw-r--r--src/soc/amd/morgana/acpi.c8
-rw-r--r--src/soc/amd/picasso/acpi.c8
-rw-r--r--src/soc/amd/stoneyridge/acpi.c8
-rw-r--r--src/soc/intel/common/block/acpi/acpi.c8
-rw-r--r--src/southbridge/intel/i82801gx/lpc.c11
-rw-r--r--src/southbridge/intel/i82801ix/madt.c11
-rw-r--r--src/southbridge/intel/i82801jx/lpc.c11
-rw-r--r--src/southbridge/intel/ibexpeak/madt.c16
13 files changed, 32 insertions, 95 deletions
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c
index 877c47e883..f6a36f80f0 100644
--- a/src/acpi/acpi.c
+++ b/src/acpi/acpi.c
@@ -240,6 +240,24 @@ int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu,
return lapic_nmi->length;
}
+unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current)
+{
+ const u16 flags = MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH;
+
+ current = acpi_create_madt_lapics(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;
+}
+
void acpi_create_madt(acpi_madt_t *madt)
{
acpi_header_t *header = &(madt->header);
diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h
index fa216aab59..57dbc65160 100644
--- a/src/include/acpi/acpi.h
+++ b/src/include/acpi/acpi.h
@@ -678,7 +678,8 @@ typedef struct acpi_madt_lapic_nmi {
u8 lint; /* Local APIC LINT# */
} __packed acpi_madt_lapic_nmi_t;
-#define ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS 0xff
+#define ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS 0xff
+#define ACPI_MADT_LX2APIC_NMI_ALL_PROCESSORS ((u32)-1)
/* MADT: I/O APIC Structure */
typedef struct acpi_madt_ioapic {
@@ -1333,6 +1334,7 @@ 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);
unsigned long acpi_create_madt_lapics(unsigned long current);
+unsigned long acpi_create_madt_lapics_with_nmis(unsigned long current);
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);
diff --git a/src/soc/amd/cezanne/acpi.c b/src/soc/amd/cezanne/acpi.c
index 189e84e86e..802476ec77 100644
--- a/src/soc/amd/cezanne/acpi.c
+++ b/src/soc/amd/cezanne/acpi.c
@@ -24,7 +24,7 @@
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
@@ -41,12 +41,6 @@ unsigned long acpi_fill_madt(unsigned long current)
MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW);
current = acpi_fill_madt_irqoverride(current);
- /* create all subtables for processors */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
- ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS,
- MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH,
- 1 /* 1: LINT1 connect to NMI */);
-
return current;
}
diff --git a/src/soc/amd/glinda/acpi.c b/src/soc/amd/glinda/acpi.c
index 85430b9f17..0c95494a11 100644
--- a/src/soc/amd/glinda/acpi.c
+++ b/src/soc/amd/glinda/acpi.c
@@ -27,7 +27,7 @@
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
@@ -44,12 +44,6 @@ unsigned long acpi_fill_madt(unsigned long current)
MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW);
current = acpi_fill_madt_irqoverride(current);
- /* create all subtables for processors */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
- ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS,
- MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH,
- 1 /* 1: LINT1 connect to NMI */);
-
return current;
}
diff --git a/src/soc/amd/mendocino/acpi.c b/src/soc/amd/mendocino/acpi.c
index b867930c34..d30fb85cec 100644
--- a/src/soc/amd/mendocino/acpi.c
+++ b/src/soc/amd/mendocino/acpi.c
@@ -26,7 +26,7 @@
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
@@ -43,12 +43,6 @@ unsigned long acpi_fill_madt(unsigned long current)
MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW);
current = acpi_fill_madt_irqoverride(current);
- /* create all subtables for processors */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
- ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS,
- MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH,
- 1 /* 1: LINT1 connect to NMI */);
-
return current;
}
diff --git a/src/soc/amd/morgana/acpi.c b/src/soc/amd/morgana/acpi.c
index 5eb21ffd56..15b64c5a13 100644
--- a/src/soc/amd/morgana/acpi.c
+++ b/src/soc/amd/morgana/acpi.c
@@ -27,7 +27,7 @@
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
@@ -44,12 +44,6 @@ unsigned long acpi_fill_madt(unsigned long current)
MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW);
current = acpi_fill_madt_irqoverride(current);
- /* create all subtables for processors */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
- ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS,
- MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH,
- 1 /* 1: LINT1 connect to NMI */);
-
return current;
}
diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c
index 2af645978a..6d46698847 100644
--- a/src/soc/amd/picasso/acpi.c
+++ b/src/soc/amd/picasso/acpi.c
@@ -31,7 +31,7 @@
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
@@ -49,12 +49,6 @@ unsigned long acpi_fill_madt(unsigned long current)
current = acpi_fill_madt_irqoverride(current);
- /* create all subtables for processors */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
- ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS,
- MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH,
- 1 /* 1: LINT1 connect to NMI */);
-
return current;
}
diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c
index 20221d20ac..cc0194b6bc 100644
--- a/src/soc/amd/stoneyridge/acpi.c
+++ b/src/soc/amd/stoneyridge/acpi.c
@@ -26,7 +26,7 @@
unsigned long acpi_fill_madt(unsigned long current)
{
/* create all subtables for processors */
- current = acpi_create_madt_lapics(current);
+ 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);
@@ -42,12 +42,6 @@ unsigned long acpi_fill_madt(unsigned long current)
MP_BUS_ISA, 9, 9,
MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW);
- /* create all subtables for processors */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current,
- ACPI_MADT_LAPIC_NMI_ALL_PROCESSORS,
- MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH,
- 1 /* 1: LINT1 connect to NMI */);
-
return current;
}
diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c
index c355c944bf..860c868cbe 100644
--- a/src/soc/intel/common/block/acpi/acpi.c
+++ b/src/soc/intel/common/block/acpi/acpi.c
@@ -69,12 +69,6 @@ static unsigned long acpi_madt_irq_overrides(unsigned long current)
current +=
acpi_create_madt_irqoverride((void *)current, 0, sci, sci, flags);
- /* NMI */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current, 0xff, 5, 1);
-
- if (is_x2apic_mode())
- current += acpi_create_madt_lx2apic_nmi((acpi_madt_lx2apic_nmi_t *)current,
- 0xffffffff, 0x5, 1);
return current;
}
@@ -91,7 +85,7 @@ unsigned long acpi_fill_madt(unsigned long current)
size_t ioapic_entries;
/* Local APICs */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */
ioapic_table = soc_get_ioapic_info(&ioapic_entries);
diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c
index 62ff757014..f8a2dac89d 100644
--- a/src/southbridge/intel/i82801gx/lpc.c
+++ b/src/southbridge/intel/i82801gx/lpc.c
@@ -352,20 +352,11 @@ static void lpc_init(struct device *dev)
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
- /* LAPIC_NMI */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 0,
- MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 1, MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
-
/* INT_SRC_OVR */
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
current, 0, 0, 2, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_EDGE);
diff --git a/src/southbridge/intel/i82801ix/madt.c b/src/southbridge/intel/i82801ix/madt.c
index 19d5d8cadb..009c9ea202 100644
--- a/src/southbridge/intel/i82801ix/madt.c
+++ b/src/southbridge/intel/i82801ix/madt.c
@@ -7,20 +7,11 @@
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
- /* LAPIC_NMI */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 0,
- MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 1, MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
-
/* INT_SRC_OVR */
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
current, 0, 0, 2, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_EDGE);
diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c
index 7dfc33ff3f..39b662a1a7 100644
--- a/src/southbridge/intel/i82801jx/lpc.c
+++ b/src/southbridge/intel/i82801jx/lpc.c
@@ -367,20 +367,11 @@ static void lpc_init(struct device *dev)
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
- /* LAPIC_NMI */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 0,
- MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 1, MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
-
/* INT_SRC_OVR */
current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
current, 0, 0, 2, MP_IRQ_POLARITY_HIGH | MP_IRQ_TRIGGER_EDGE);
diff --git a/src/southbridge/intel/ibexpeak/madt.c b/src/southbridge/intel/ibexpeak/madt.c
index a1a28a1b5f..26b163029a 100644
--- a/src/southbridge/intel/ibexpeak/madt.c
+++ b/src/southbridge/intel/ibexpeak/madt.c
@@ -9,7 +9,7 @@
unsigned long acpi_fill_madt(unsigned long current)
{
/* Local APICs */
- current = acpi_create_madt_lapics(current);
+ current = acpi_create_madt_lapics_with_nmis(current);
/* IOAPIC */
current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, IO_APIC_ADDR);
@@ -24,19 +24,5 @@ unsigned long acpi_fill_madt(unsigned long current)
MP_IRQ_POLARITY_HIGH |
MP_IRQ_TRIGGER_LEVEL);
- /* LAPIC_NMI */
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 0,
- MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 1, MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 2, MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
- current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)
- current, 3, MP_IRQ_POLARITY_HIGH |
- MP_IRQ_TRIGGER_EDGE, 0x01);
return current;
}