diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2021-05-21 09:32:45 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-06-10 17:48:28 +0000 |
commit | 6f77ff7ba50c88100934e30576f1c56f164ac8de (patch) | |
tree | 4c8dda5be4e851156997a2960fb5da676b96cfcc /src/include/cpu | |
parent | 242f1d962f24193499795106466923e1f78a4485 (diff) |
cpu/x86/lapic: Add lapic_send_ipi() helper
Change-Id: I7207a9aadd987b4307ce8b3dd8dbfd47d0a5768e
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/+/55190
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/cpu')
-rw-r--r-- | src/include/cpu/x86/lapic.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/include/cpu/x86/lapic.h b/src/include/cpu/x86/lapic.h index a3d0fcbf89..1db0ff46d1 100644 --- a/src/include/cpu/x86/lapic.h +++ b/src/include/cpu/x86/lapic.h @@ -29,10 +29,15 @@ static inline void xapic_write_atomic(unsigned long reg, uint32_t v) : : "memory", "cc"); } +static __always_inline void xapic_send_ipi(uint32_t icrlow, uint32_t apicid) +{ + xapic_write_atomic(LAPIC_ICR2, SET_LAPIC_DEST_FIELD(apicid)); + xapic_write_atomic(LAPIC_ICR, icrlow); +} + #define lapic_read_around(x) lapic_read(x) #define lapic_write_around(x, y) xapic_write_atomic((x), (y)) - static __always_inline uint32_t x2apic_read(unsigned int reg) { uint32_t value, index; @@ -111,6 +116,14 @@ static __always_inline void lapic_update32(unsigned int reg, uint32_t mask, uint } } +static __always_inline void lapic_send_ipi(uint32_t icrlow, uint32_t apicid) +{ + if (is_x2apic_mode()) + x2apic_send_ipi(icrlow, apicid); + else + xapic_send_ipi(icrlow, apicid); +} + static __always_inline void lapic_wait_icr_idle(void) { do { } while (lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY); |