diff --git a/arch/x86_64/src/intel64/intel64_cpu.c b/arch/x86_64/src/intel64/intel64_cpu.c index ae59f1611f85d..243179d3898cc 100644 --- a/arch/x86_64/src/intel64/intel64_cpu.c +++ b/arch/x86_64/src/intel64/intel64_cpu.c @@ -311,7 +311,9 @@ uint8_t x86_64_cpu_to_loapic(uint8_t cpu) void x86_64_cpu_ready_set(uint8_t cpu) { - spin_lock(&g_ap_boot); + irqstate_t flags; + + flags = spin_lock_irqsave(&g_ap_boot); if (!g_cpu_priv[cpu].ready) { @@ -319,7 +321,7 @@ void x86_64_cpu_ready_set(uint8_t cpu) g_cpu_count++; } - spin_unlock(&g_ap_boot); + spin_unlock_irqrestore(&g_ap_boot, flags); } /**************************************************************************** @@ -333,11 +335,12 @@ void x86_64_cpu_ready_set(uint8_t cpu) bool x86_64_cpu_ready_get(uint8_t cpu) { struct intel64_cpu_s *priv = &g_cpu_priv[cpu]; + irqstate_t flags; bool ready; - spin_lock(&g_ap_boot); + flags = spin_lock_irqsave(&g_ap_boot); ready = priv->ready; - spin_unlock(&g_ap_boot); + spin_unlock_irqrestore(&g_ap_boot, flags); return ready; } @@ -352,11 +355,12 @@ bool x86_64_cpu_ready_get(uint8_t cpu) uint8_t x86_64_cpu_count_get(void) { + irqstate_t flags; uint8_t count; - spin_lock(&g_ap_boot); + flags = spin_lock_irqsave(&g_ap_boot); count = g_cpu_count; - spin_unlock(&g_ap_boot); + spin_unlock_irqrestore(&g_ap_boot, flags); return count; } diff --git a/arch/x86_64/src/intel64/intel64_irq.c b/arch/x86_64/src/intel64/intel64_irq.c index 64f1167041881..46d61488b3098 100644 --- a/arch/x86_64/src/intel64/intel64_irq.c +++ b/arch/x86_64/src/intel64/intel64_irq.c @@ -75,7 +75,7 @@ static inline void up_idtinit(void); static struct idt_entry_s g_idt_entries[NR_IRQS]; static struct intel64_irq_priv_s g_irq_priv[NR_IRQS]; -static spinlock_t g_irq_spin; +static spinlock_t g_irq_spinlock; /**************************************************************************** * Private Functions @@ -482,7 +482,7 @@ void up_irqinitialize(void) void up_disable_irq(int irq) { #ifndef CONFIG_ARCH_INTEL64_DISABLE_INT_INIT - irqstate_t flags = spin_lock_irqsave(&g_irq_spin); + irqstate_t flags = spin_lock_irqsave(&g_irq_spinlock); if (irq > IRQ255) { @@ -508,7 +508,7 @@ void up_disable_irq(int irq) } } - spin_unlock_irqrestore(&g_irq_spin, flags); + spin_unlock_irqrestore(&g_irq_spinlock, flags); #endif } @@ -523,7 +523,7 @@ void up_disable_irq(int irq) void up_enable_irq(int irq) { #ifndef CONFIG_ARCH_INTEL64_DISABLE_INT_INIT - irqstate_t flags = spin_lock_irqsave(&g_irq_spin); + irqstate_t flags = spin_lock_irqsave(&g_irq_spinlock); # ifndef CONFIG_IRQCHAIN /* Check if IRQ is free if we don't support IRQ chains */ @@ -553,7 +553,7 @@ void up_enable_irq(int irq) CPU_SET(up_cpu_index(), &g_irq_priv[irq].busy); - spin_unlock_irqrestore(&g_irq_spin, flags); + spin_unlock_irqrestore(&g_irq_spinlock, flags); #endif }