[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-merge] io_apic.c, part 2
This does something slightly more intelligent, but nothing magic. BTW, both halves are completely untested ;-) M. diff -aurpN -X /home/fletch/.diff.exclude xen-io_apic1/arch/i386/kernel/io_apic.c xen-io_apic.c/arch/i386/kernel/io_apic.c --- xen-io_apic1/arch/i386/kernel/io_apic.c 2005-08-08 08:39:01.000000000 -0700 +++ xen-io_apic.c/arch/i386/kernel/io_apic.c 2005-08-07 17:07:32.000000000 -0700 @@ -1139,7 +1139,7 @@ static inline int IO_APIC_irq_trigger(in } /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ -u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 }; +u8 irq_vector[NR_IRQ_VECTORS] = DEFINE_IRQ_VECTOR; int assign_irq_vector(int irq) { @@ -1148,17 +1148,8 @@ int assign_irq_vector(int irq) BUG_ON(irq >= NR_IRQ_VECTORS); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) return IO_APIC_VECTOR(irq); -next: - current_vector += 8; - if (current_vector == SYSCALL_VECTOR) - goto next; - - if (current_vector >= FIRST_SYSTEM_VECTOR) { - offset++; - if (!(offset%8)) - return -ENOSPC; - current_vector = FIRST_DEVICE_VECTOR + offset; - } + + __assign_irq_vector(¤t_vector); vector_irq[current_vector] = irq; if (irq != AUTO_ASSIGN) @@ -1255,7 +1246,7 @@ static void __init setup_IO_APIC_irqs(vo else add_pin_to_irq(irq, apic, pin); - if (!apic && !IO_APIC_IRQ(irq)) + if (skip_setup_IO_APIC_irq(apic, irq)) continue; if (IO_APIC_IRQ(irq)) { @@ -2074,7 +2065,7 @@ static inline void init_IO_APIC_traps(vo make_8259A_irq(irq); else /* Strange. Oh, well.. */ - irq_desc[irq].handler = &no_irq_type; + set_no_irq_handler(irq); } } } diff -aurpN -X /home/fletch/.diff.exclude xen-io_apic1/include/asm-i386/mach-default/mach_io_apic.h xen-io_apic.c/include/asm-i386/mach-default/mach_io_apic.h --- xen-io_apic1/include/asm-i386/mach-default/mach_io_apic.h 1969-12-31 16:00:00.000000000 -0800 +++ xen-io_apic.c/include/asm-i386/mach-default/mach_io_apic.h 2005-08-07 17:19:08.000000000 -0700 @@ -0,0 +1,33 @@ +#ifndef __ASM_MACH_IO_APIC_H +#define __ASM_MACH_IO_APIC_H + +#define DEFINE_IRQ_VECTOR { FIRST_DEVICE_VECTOR , 0 } + +static inline void __assign_irq_vector(static int *current_vector) +{ + static int offset = 0; + +next: + *current_vector += 8; + if (*current_vector == SYSCALL_VECTOR) + goto next; + + if (*current_vector >= FIRST_SYSTEM_VECTOR) { + offset++; + if (!(offset%8)) + return -ENOSPC; + *current_vector = FIRST_DEVICE_VECTOR + offset; + } +} + + +static inline skip_setup_IO_APIC_irq(int apic, int irq) +{ + return ((apic == 0) && !IO_APIC_IRQ(irq)); +} + +static inline int void set_no_irq_handler (int irq) +{ + irq_desc[irq].handler = &no_irq_type; +} + diff -aurpN -X /home/fletch/.diff.exclude xen-io_apic1/include/asm-i386/mach-xen/mach_io_apic.h xen-io_apic.c/include/asm-i386/mach-xen/mach_io_apic.h --- xen-io_apic1/include/asm-i386/mach-xen/mach_io_apic.h 1969-12-31 16:00:00.000000000 -0800 +++ xen-io_apic.c/include/asm-i386/mach-xen/mach_io_apic.h 2005-08-07 17:15:40.000000000 -0700 @@ -0,0 +1,63 @@ +#ifndef __ASM_MACH_IO_APIC_H +#define __ASM_MACH_IO_APIC_H + +#include <xen-public/xen.h> +#include <xen-public/physdev.h> + +/* Fake i8259 */ +#define make_8259A_irq(_irq) (io_apic_irqs &= ~(1UL<<(_irq))) +#define disable_8259A_irq(_irq) ((void)0) +#define i8259A_irq_pending(_irq) (0) + +unsigned long io_apic_irqs; + +static inline unsigned int xen_io_apic_read(unsigned int apic, unsigned int reg) +{ + physdev_op_t op; + int ret; + + op.cmd = PHYSDEVOP_APIC_READ; + op.u.apic_op.apic = mp_ioapics[apic].mpc_apicid; + op.u.apic_op.offset = reg; + ret = HYPERVISOR_physdev_op(&op); + if (ret) + return ret; + return op.u.apic_op.value; +} + +static inline void xen_io_apic_write(unsigned int apic, unsigned int reg, unsigned int value) +{ + physdev_op_t op; + + op.cmd = PHYSDEVOP_APIC_WRITE; + op.u.apic_op.apic = mp_ioapics[apic].mpc_apicid; + op.u.apic_op.offset = reg; + op.u.apic_op.value = value; + HYPERVISOR_physdev_op(&op); +} + +#define io_apic_read(a,r) xen_io_apic_read(a,r) +#define io_apic_write(a,r,v) xen_io_apic_write(a,r,v) + +#define DEFINE_IRQ_VECTOR { 0 } + +static inline int __assign_irq_vector(static int *current_vector) +{ + physdev_op_t op; + + op.cmd = PHYSDEVOP_ASSIGN_VECTOR; + op.u.irq_op.irq = irq; + if (HYPERVISOR_physdev_op(&op)) + return -ENOSPC; + *current_vector = op.u.irq_op.vector; +} + +static inline skip_setup_IO_APIC_irq(int apic, int irq) +{ + return (!IO_APIC_IRQ(irq)); +} + +static inline int void set_no_irq_handler (int irq) +{ +} + _______________________________________________ Xen-merge mailing list Xen-merge@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-merge
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |