From a4ceba4ae57d03db1e779794d29b9e0b93c39377 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Fri, 21 May 2021 09:32:45 +0200 Subject: cpu/x86/lapic: Add lapic_busy() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ife127d6dc8241cccb9d52236a9152da707f0e261 Signed-off-by: Arthur Heymans Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/55191 Reviewed-by: Angel Pons Reviewed-by: Wonkyu Kim Tested-by: build bot (Jenkins) --- src/cpu/x86/lapic/lapic_cpu_init.c | 10 +++++----- src/cpu/x86/mp_init.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/cpu') diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c index 6369d2e30286..e8709217740c 100644 --- a/src/cpu/x86/lapic/lapic_cpu_init.c +++ b/src/cpu/x86/lapic/lapic_cpu_init.c @@ -110,7 +110,7 @@ static int lapic_start_cpu(unsigned long apicid) do { printk(BIOS_SPEW, "+"); udelay(100); - send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY; + send_status = lapic_busy(); } while (send_status && (timeout++ < 1000)); if (timeout >= 1000) { printk(BIOS_ERR, "CPU %ld: First APIC write timed out. " @@ -136,7 +136,7 @@ static int lapic_start_cpu(unsigned long apicid) do { printk(BIOS_SPEW, "+"); udelay(100); - send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY; + send_status = lapic_busy(); } while (send_status && (timeout++ < 1000)); if (timeout >= 1000) { printk(BIOS_ERR, "CPU %ld: Second APIC write timed out. " @@ -177,7 +177,7 @@ static int lapic_start_cpu(unsigned long apicid) do { printk(BIOS_SPEW, "+"); udelay(100); - send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY; + send_status = lapic_busy(); } while (send_status && (timeout++ < 1000)); /* @@ -330,7 +330,7 @@ void stop_this_cpu(void) do { dprintk(BIOS_SPEW, "+"); udelay(100); - send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY; + send_status = lapic_busy(); } while (send_status && (timeout++ < 1000)); if (timeout >= 1000) @@ -349,7 +349,7 @@ void stop_this_cpu(void) do { dprintk(BIOS_SPEW, "+"); udelay(100); - send_status = lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY; + send_status = lapic_busy(); } while (send_status && (timeout++ < 1000)); if (timeout >= 1000) diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index 87ddb0d4c064..ad45ee96f963 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -403,7 +403,7 @@ static int apic_wait_timeout(int total_delay, int delay_step) int total = 0; int timeout = 0; - while (lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY) { + while (lapic_busy()) { udelay(delay_step); total += delay_step; if (total >= total_delay) { @@ -457,7 +457,7 @@ static int start_aps(struct bus *cpu_bus, int ap_count, atomic_t *num_aps) return 0; } - if ((lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY)) { + if (lapic_busy()) { printk(BIOS_DEBUG, "Waiting for ICR not to be busy..."); if (apic_wait_timeout(1000 /* 1 ms */, 50)) { printk(BIOS_ERR, "timed out. Aborting.\n"); @@ -472,7 +472,7 @@ static int start_aps(struct bus *cpu_bus, int ap_count, atomic_t *num_aps) mdelay(10); /* Send 1st SIPI */ - if ((lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY)) { + if (lapic_busy()) { printk(BIOS_DEBUG, "Waiting for ICR not to be busy..."); if (apic_wait_timeout(1000 /* 1 ms */, 50)) { printk(BIOS_ERR, "timed out. Aborting.\n"); @@ -497,7 +497,7 @@ static int start_aps(struct bus *cpu_bus, int ap_count, atomic_t *num_aps) return 0; /* Send 2nd SIPI */ - if ((lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY)) { + if (lapic_busy()) { printk(BIOS_DEBUG, "Waiting for ICR not to be busy..."); if (apic_wait_timeout(1000 /* 1 ms */, 50)) { printk(BIOS_ERR, "timed out. Aborting.\n"); @@ -676,7 +676,7 @@ void smm_initiate_relocation_parallel(void) return; } - if ((lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY)) { + if (lapic_busy()) { printk(BIOS_DEBUG, "Waiting for ICR not to be busy..."); if (apic_wait_timeout(1000 /* 1 ms */, 50)) { printk(BIOS_DEBUG, "timed out. Aborting.\n"); -- cgit v1.2.3