Attention is currently required from: Jason Glenesk, Raul Rangel, Marshall Dawson, Alexander Couzens, Evgeny Zinoviev, Patrick Rudolph, Felix Held. Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/55194 )
Change subject: cpu/x86/lapic: Replace LOCAL_APIC_ADDR references ......................................................................
cpu/x86/lapic: Replace LOCAL_APIC_ADDR references
Note that there are assumptions about LAPIC MMIO location in both AMD and Intel sources in coreboot proper.
Change-Id: I2c668f5f9b93d170351c00d77d003c230900e0b4 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/cpu.c M src/arch/x86/include/arch/smp/mpspec.h M src/arch/x86/mpspec.c M src/cpu/x86/lapic/lapic.c M src/cpu/x86/smm/smmhandler.S M src/include/cpu/x86/lapic_def.h M src/mainboard/apple/macbook21/mptable.c M src/mainboard/asus/a88xm-e/mptable.c M src/mainboard/asus/p2b/variants/p2b-d/mptable.c M src/mainboard/asus/p2b/variants/p2b-ds/mptable.c M src/mainboard/emulation/qemu-i440fx/northbridge.c M src/mainboard/getac/p470/mptable.c M src/mainboard/ibase/mb899/mptable.c M src/mainboard/intel/d945gclf/mptable.c M src/mainboard/kontron/986lcd-m/mptable.c M src/mainboard/lenovo/t60/mptable.c M src/mainboard/lenovo/x60/mptable.c M src/mainboard/roda/rk886ex/mptable.c M src/soc/amd/cezanne/data_fabric.c M src/soc/amd/picasso/data_fabric.c M src/soc/amd/stoneyridge/northbridge.c 21 files changed, 29 insertions(+), 30 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/55194/1
diff --git a/src/arch/x86/cpu.c b/src/arch/x86/cpu.c index 07bd7b5..c929e5e 100644 --- a/src/arch/x86/cpu.c +++ b/src/arch/x86/cpu.c @@ -340,8 +340,3 @@ } return -1; } - -uintptr_t cpu_get_lapic_addr(void) -{ - return LOCAL_APIC_ADDR; -} diff --git a/src/arch/x86/include/arch/smp/mpspec.h b/src/arch/x86/include/arch/smp/mpspec.h index 25c23e6..198d7df 100644 --- a/src/arch/x86/include/arch/smp/mpspec.h +++ b/src/arch/x86/include/arch/smp/mpspec.h @@ -224,7 +224,7 @@ */ } __packed;
-void mptable_init(struct mp_config_table *mc, u32 lapic_addr); +void mptable_init(struct mp_config_table *mc); void *smp_next_mpc_entry(struct mp_config_table *mc); void *smp_next_mpe_entry(struct mp_config_table *mc);
diff --git a/src/arch/x86/mpspec.c b/src/arch/x86/mpspec.c index 15c3c0e..fa29e80 100644 --- a/src/arch/x86/mpspec.c +++ b/src/arch/x86/mpspec.c @@ -6,13 +6,15 @@ #include <arch/smp/mpspec.h> #include <string.h> #include <arch/cpu.h> +#include <cpu/cpu.h> #include <cpu/x86/lapic.h> #include <drivers/generic/ioapic/chip.h>
/* Initialize the specified "mc" struct with initial values. */ -void mptable_init(struct mp_config_table *mc, u32 lapic_addr) +void mptable_init(struct mp_config_table *mc) { int i; + u32 lapic_addr = cpu_get_lapic_addr();
memset(mc, 0, sizeof(*mc));
@@ -533,7 +535,7 @@ v = smp_write_floating_table(addr, 0); mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/cpu/x86/lapic/lapic.c b/src/cpu/x86/lapic/lapic.c index 468a5dc..3c0273e 100644 --- a/src/cpu/x86/lapic/lapic.c +++ b/src/cpu/x86/lapic/lapic.c @@ -1,9 +1,15 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <cpu/cpu.h> #include <cpu/x86/lapic.h> #include <console/console.h> #include <stdint.h>
+uintptr_t cpu_get_lapic_addr(void) +{ + return LAPIC_DEFAULT_BASE; +} + void lapic_virtual_wire_mode_init(void) { /* this is so interrupts work. This is very limited scope -- diff --git a/src/cpu/x86/smm/smmhandler.S b/src/cpu/x86/smm/smmhandler.S index 4cbfbfd..3750e52 100644 --- a/src/cpu/x86/smm/smmhandler.S +++ b/src/cpu/x86/smm/smmhandler.S @@ -126,8 +126,9 @@ movw %ax, %fs movw %ax, %gs
+ /* FIXME: Incompatible with X2APIC_SUPPORT. */ /* Get this CPU's LAPIC ID */ - movl $(LOCAL_APIC_ADDR | LAPIC_ID), %esi + movl $(LAPIC_DEFAULT_BASE | LAPIC_ID), %esi movl (%esi), %ecx shr $24, %ecx
diff --git a/src/include/cpu/x86/lapic_def.h b/src/include/cpu/x86/lapic_def.h index d5e863a..84a3413 100644 --- a/src/include/cpu/x86/lapic_def.h +++ b/src/include/cpu/x86/lapic_def.h @@ -9,12 +9,7 @@ (LAPIC_BASE_MSR_X2APIC_MODE | LAPIC_BASE_MSR_ENABLE) #define LAPIC_BASE_MSR_ADDR_MASK 0xFFFFF000
-#ifndef LOCAL_APIC_ADDR -#define LOCAL_APIC_ADDR 0xfee00000 -#endif -#ifndef LAPIC_DEFAULT_BASE -#define LAPIC_DEFAULT_BASE LOCAL_APIC_ADDR -#endif +#define LAPIC_DEFAULT_BASE 0xfee00000
#define LAPIC_ID 0x020 #define LAPIC_LVR 0x030 diff --git a/src/mainboard/apple/macbook21/mptable.c b/src/mainboard/apple/macbook21/mptable.c index 67827e2..22c58af 100644 --- a/src/mainboard/apple/macbook21/mptable.c +++ b/src/mainboard/apple/macbook21/mptable.c @@ -11,7 +11,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/asus/a88xm-e/mptable.c b/src/mainboard/asus/a88xm-e/mptable.c index b9e743c..1027391 100644 --- a/src/mainboard/asus/a88xm-e/mptable.c +++ b/src/mainboard/asus/a88xm-e/mptable.c @@ -39,7 +39,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc); memcpy(mc->mpc_oem, "AMD ", 8);
smp_write_processors(mc); diff --git a/src/mainboard/asus/p2b/variants/p2b-d/mptable.c b/src/mainboard/asus/p2b/variants/p2b-d/mptable.c index 590c889..98525bb 100644 --- a/src/mainboard/asus/p2b/variants/p2b-d/mptable.c +++ b/src/mainboard/asus/p2b/variants/p2b-d/mptable.c @@ -10,7 +10,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/asus/p2b/variants/p2b-ds/mptable.c b/src/mainboard/asus/p2b/variants/p2b-ds/mptable.c index b8787c8..f2d3a85 100644 --- a/src/mainboard/asus/p2b/variants/p2b-ds/mptable.c +++ b/src/mainboard/asus/p2b/variants/p2b-ds/mptable.c @@ -10,7 +10,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c index fcff7bc..8579b8f 100644 --- a/src/mainboard/emulation/qemu-i440fx/northbridge.c +++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c @@ -155,7 +155,7 @@ /* Reserve space for the LAPIC. There's one in every processor, but * the space only needs to be reserved once, so we do it here. */ res = new_resource(dev, 3); - res->base = LOCAL_APIC_ADDR; + res->base = cpu_get_lapic_addr(); res->size = 0x10000UL; res->limit = 0xffffffffUL; res->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED | diff --git a/src/mainboard/getac/p470/mptable.c b/src/mainboard/getac/p470/mptable.c index 603f1ba..1d259fa 100644 --- a/src/mainboard/getac/p470/mptable.c +++ b/src/mainboard/getac/p470/mptable.c @@ -11,7 +11,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/ibase/mb899/mptable.c b/src/mainboard/ibase/mb899/mptable.c index 7c632f5..bfd29ae 100644 --- a/src/mainboard/ibase/mb899/mptable.c +++ b/src/mainboard/ibase/mb899/mptable.c @@ -14,7 +14,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/intel/d945gclf/mptable.c b/src/mainboard/intel/d945gclf/mptable.c index 1b6a1b1..30b41dc 100644 --- a/src/mainboard/intel/d945gclf/mptable.c +++ b/src/mainboard/intel/d945gclf/mptable.c @@ -11,7 +11,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/kontron/986lcd-m/mptable.c b/src/mainboard/kontron/986lcd-m/mptable.c index 0c4ec67..54faae5 100644 --- a/src/mainboard/kontron/986lcd-m/mptable.c +++ b/src/mainboard/kontron/986lcd-m/mptable.c @@ -13,7 +13,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/lenovo/t60/mptable.c b/src/mainboard/lenovo/t60/mptable.c index 2dc3a1a..fbc239f 100644 --- a/src/mainboard/lenovo/t60/mptable.c +++ b/src/mainboard/lenovo/t60/mptable.c @@ -11,7 +11,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/lenovo/x60/mptable.c b/src/mainboard/lenovo/x60/mptable.c index 9e2cff1..9efb240 100644 --- a/src/mainboard/lenovo/x60/mptable.c +++ b/src/mainboard/lenovo/x60/mptable.c @@ -11,7 +11,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/mainboard/roda/rk886ex/mptable.c b/src/mainboard/roda/rk886ex/mptable.c index 0ec750c..125a050 100644 --- a/src/mainboard/roda/rk886ex/mptable.c +++ b/src/mainboard/roda/rk886ex/mptable.c @@ -11,7 +11,7 @@
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
- mptable_init(mc, LOCAL_APIC_ADDR); + mptable_init(mc);
smp_write_processors(mc);
diff --git a/src/soc/amd/cezanne/data_fabric.c b/src/soc/amd/cezanne/data_fabric.c index d603c8a..1a0f9cb 100644 --- a/src/soc/amd/cezanne/data_fabric.c +++ b/src/soc/amd/cezanne/data_fabric.c @@ -37,7 +37,7 @@ int reg; uint32_t base, limit, ctrl; const uint32_t np_bot = HPET_BASE_ADDRESS >> D18F0_MMIO_SHIFT; - const uint32_t np_top = (LOCAL_APIC_ADDR - 1) >> D18F0_MMIO_SHIFT; + const uint32_t np_top = (LAPIC_DEFAULT_BASE - 1) >> D18F0_MMIO_SHIFT;
data_fabric_print_mmio_conf();
diff --git a/src/soc/amd/picasso/data_fabric.c b/src/soc/amd/picasso/data_fabric.c index 700cb84..b5949f0 100644 --- a/src/soc/amd/picasso/data_fabric.c +++ b/src/soc/amd/picasso/data_fabric.c @@ -37,7 +37,7 @@ int reg; uint32_t base, limit, ctrl; const uint32_t np_bot = HPET_BASE_ADDRESS >> D18F0_MMIO_SHIFT; - const uint32_t np_top = (LOCAL_APIC_ADDR - 1) >> D18F0_MMIO_SHIFT; + const uint32_t np_top = (LAPIC_DEFAULT_BASE - 1) >> D18F0_MMIO_SHIFT;
data_fabric_print_mmio_conf();
diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c index eb59cdc..0df9d97 100644 --- a/src/soc/amd/stoneyridge/northbridge.c +++ b/src/soc/amd/stoneyridge/northbridge.c @@ -362,7 +362,7 @@
/* Non-posted: range(HPET-LAPIC) or 0xfed00000 through 0xfee00000-1 */ base = (HPET_BASE_ADDRESS >> 8) | MMIO_WE | MMIO_RE; - limit = (ALIGN_DOWN(LOCAL_APIC_ADDR - 1, 64 * KiB) >> 8) | MMIO_NP; + limit = (ALIGN_DOWN(LAPIC_DEFAULT_BASE - 1, 64 * KiB) >> 8) | MMIO_NP; pci_write_config32(SOC_ADDR_DEV, NB_MMIO_LIMIT_LO(0), limit); pci_write_config32(SOC_ADDR_DEV, NB_MMIO_BASE_LO(0), base);