x86, io-apic: use predefined names instead of numeric constants

This patch replaces some hard-coded numbers with predefined names.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Cyrill Gorcunov 2008-06-07 19:53:57 +04:00 committed by Ingo Molnar
parent d3f020d2f9
commit 46b3b4ef1e
2 changed files with 13 additions and 10 deletions

View File

@ -261,25 +261,27 @@ static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, unsign
/* mask = 1 */ /* mask = 1 */
static void __mask_IO_APIC_irq (unsigned int irq) static void __mask_IO_APIC_irq (unsigned int irq)
{ {
__modify_IO_APIC_irq(irq, 0x00010000, 0); __modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED, 0);
} }
/* mask = 0 */ /* mask = 0 */
static void __unmask_IO_APIC_irq (unsigned int irq) static void __unmask_IO_APIC_irq (unsigned int irq)
{ {
__modify_IO_APIC_irq(irq, 0, 0x00010000); __modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_MASKED);
} }
/* mask = 1, trigger = 0 */ /* mask = 1, trigger = 0 */
static void __mask_and_edge_IO_APIC_irq (unsigned int irq) static void __mask_and_edge_IO_APIC_irq (unsigned int irq)
{ {
__modify_IO_APIC_irq(irq, 0x00010000, 0x00008000); __modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED,
IO_APIC_REDIR_LEVEL_TRIGGER);
} }
/* mask = 0, trigger = 1 */ /* mask = 0, trigger = 1 */
static void __unmask_and_level_IO_APIC_irq (unsigned int irq) static void __unmask_and_level_IO_APIC_irq (unsigned int irq)
{ {
__modify_IO_APIC_irq(irq, 0x00008000, 0x00010000); __modify_IO_APIC_irq(irq, IO_APIC_REDIR_LEVEL_TRIGGER,
IO_APIC_REDIR_MASKED);
} }
static void mask_IO_APIC_irq (unsigned int irq) static void mask_IO_APIC_irq (unsigned int irq)

View File

@ -183,7 +183,7 @@ static bool io_apic_level_ack_pending(unsigned int irq)
break; break;
reg = io_apic_read(entry->apic, 0x10 + pin*2); reg = io_apic_read(entry->apic, 0x10 + pin*2);
/* Is the remote IRR bit set? */ /* Is the remote IRR bit set? */
if ((reg >> 14) & 1) { if (reg & IO_APIC_REDIR_REMOTE_IRR) {
spin_unlock_irqrestore(&ioapic_lock, flags); spin_unlock_irqrestore(&ioapic_lock, flags);
return true; return true;
} }
@ -298,7 +298,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
break; break;
io_apic_write(apic, 0x11 + pin*2, dest); io_apic_write(apic, 0x11 + pin*2, dest);
reg = io_apic_read(apic, 0x10 + pin*2); reg = io_apic_read(apic, 0x10 + pin*2);
reg &= ~0x000000ff; reg &= ~IO_APIC_REDIR_VECTOR_MASK;
reg |= vector; reg |= vector;
io_apic_modify(apic, reg); io_apic_modify(apic, reg);
if (!entry->next) if (!entry->next)
@ -366,10 +366,11 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)
static void name##_IO_APIC_irq (unsigned int irq) \ static void name##_IO_APIC_irq (unsigned int irq) \
__DO_ACTION(R, ACTION, FINAL) __DO_ACTION(R, ACTION, FINAL)
DO_ACTION( __mask, 0, |= 0x00010000, io_apic_sync(entry->apic) ) /* mask = 1 */
/* mask = 1 */ DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, io_apic_sync(entry->apic))
DO_ACTION( __unmask, 0, &= 0xfffeffff, )
/* mask = 0 */ /* mask = 0 */
DO_ACTION(__unmask, 0, &= ~IO_APIC_REDIR_MASKED, )
static void mask_IO_APIC_irq (unsigned int irq) static void mask_IO_APIC_irq (unsigned int irq)
{ {