summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-05-21 09:32:45 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2021-06-10 17:49:16 +0000
commita4ceba4ae57d03db1e779794d29b9e0b93c39377 (patch)
treea8ec94cca94ba1149c75ab3afc695e1fe879edb5 /src/include
parent6f77ff7ba50c88100934e30576f1c56f164ac8de (diff)
cpu/x86/lapic: Add lapic_busy() helper
Change-Id: Ife127d6dc8241cccb9d52236a9152da707f0e261 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55191 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/cpu/x86/lapic.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/include/cpu/x86/lapic.h b/src/include/cpu/x86/lapic.h
index 1db0ff46d1..4647877ae9 100644
--- a/src/include/cpu/x86/lapic.h
+++ b/src/include/cpu/x86/lapic.h
@@ -35,6 +35,11 @@ static __always_inline void xapic_send_ipi(uint32_t icrlow, uint32_t apicid)
xapic_write_atomic(LAPIC_ICR, icrlow);
}
+static __always_inline int xapic_busy(void)
+{
+ return xapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY;
+}
+
#define lapic_read_around(x) lapic_read(x)
#define lapic_write_around(x, y) xapic_write_atomic((x), (y))
@@ -124,9 +129,12 @@ static __always_inline void lapic_send_ipi(uint32_t icrlow, uint32_t apicid)
xapic_send_ipi(icrlow, apicid);
}
-static __always_inline void lapic_wait_icr_idle(void)
+static __always_inline int lapic_busy(void)
{
- do { } while (lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY);
+ if (is_x2apic_mode())
+ return 0;
+ else
+ return xapic_busy();
}
static __always_inline unsigned int initial_lapicid(void)