#define IOAPIC_EDGE 0
#define IOAPIC_LEVEL 1
-#define SET_DEST(x, y, value) \
- do { if ( x2apic_enabled ) x = value; else y = value; } while(0)
+#define SET_DEST(ent, mode, val) do { \
+ if (x2apic_enabled) \
+ (ent).dest.dest32 = (val); \
+ else \
+ (ent).dest.mode.mode##_dest = (val); \
+} while (0)
static inline void ioapic_register_intr(int irq, unsigned long trigger)
{
disable_8259A_irq(irq_to_desc(irq));
desc = irq_to_desc(irq);
- SET_DEST(entry.dest.dest32, entry.dest.logical.logical_dest,
- cpu_mask_to_apicid(desc->arch.cpu_mask));
+ SET_DEST(entry, logical, cpu_mask_to_apicid(desc->arch.cpu_mask));
spin_lock_irqsave(&ioapic_lock, flags);
__ioapic_write_entry(apic, pin, 0, entry);
set_native_irq_info(irq, TARGET_CPUS);
*/
entry.dest_mode = INT_DEST_MODE;
entry.mask = 0; /* unmask IRQ now */
- SET_DEST(entry.dest.dest32, entry.dest.logical.logical_dest,
- cpu_mask_to_apicid(TARGET_CPUS));
+ SET_DEST(entry, logical, cpu_mask_to_apicid(TARGET_CPUS));
entry.delivery_mode = INT_DELIVERY_MODE;
entry.polarity = 0;
entry.trigger = 0;
entry.dest_mode = 0; /* Physical */
entry.delivery_mode = dest_ExtINT; /* ExtInt */
entry.vector = 0;
- SET_DEST(entry.dest.dest32, entry.dest.physical.physical_dest,
- get_apic_id());
+ SET_DEST(entry, physical, get_apic_id());
/*
* Add it to the IO-APIC irq-routing table:
entry1.dest_mode = 0; /* physical delivery */
entry1.mask = 0; /* unmask IRQ now */
- SET_DEST(entry1.dest.dest32, entry1.dest.physical.physical_dest,
- hard_smp_processor_id());
+ SET_DEST(entry1, physical, hard_smp_processor_id());
entry1.delivery_mode = dest_ExtINT;
entry1.polarity = entry0.polarity;
entry1.trigger = 0;
entry.vector = vector;
cpumask_and(&mask, desc->arch.cpu_mask, TARGET_CPUS);
- SET_DEST(entry.dest.dest32, entry.dest.logical.logical_dest,
- cpu_mask_to_apicid(&mask));
+ SET_DEST(entry, logical, cpu_mask_to_apicid(&mask));
apic_printk(APIC_DEBUG, KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry "
"(%d-%d -> %#x -> IRQ %d Mode:%i Active:%i)\n", ioapic,
/* Set the vector field to the real vector! */
rte.vector = desc->arch.vector;
- SET_DEST(rte.dest.dest32, rte.dest.logical.logical_dest,
- cpu_mask_to_apicid(desc->arch.cpu_mask));
+ SET_DEST(rte, logical, cpu_mask_to_apicid(desc->arch.cpu_mask));
__ioapic_write_entry(apic, pin, 0, rte);