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>
This commit is contained in:
parent
242f1d962f
commit
6f77ff7ba5
3 changed files with 26 additions and 40 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue