This just shoves some ifdef wrappers around whole functions to
either not define them, or provide a no-op function instead.
The alternative to this is to split the file, but I tried that,
and it made an unholy mess. Plus it's much nicer for maintainance
to keep the alternative definitions right next to each other, if
it's this trivial.
diff -aurpN -X /home/fletch/.diff.exclude virgin/arch/i386/kernel/apic.c
xen-io_apic1/arch/i386/kernel/apic.c
--- virgin/arch/i386/kernel/apic.c 2005-08-07 09:15:22.000000000 -0700
+++ xen-io_apic1/arch/i386/kernel/apic.c 2005-08-08 08:39:01.000000000
-0700
@@ -212,6 +212,9 @@ void __init connect_bsp_APIC(void)
enable_apic_mode();
}
+#ifdef CONFIG_XEN
+void disconnect_bsp_APIC(int virt_wire_setup) {}
+#else /* !CONFIG_XEN */
void disconnect_bsp_APIC(int virt_wire_setup)
{
if (pic_mode) {
@@ -263,6 +266,7 @@ void disconnect_bsp_APIC(int virt_wire_s
apic_write_around(APIC_LVT1, value);
}
}
+#endif /* !CONFIG_XEN */
void disable_local_APIC(void)
{
@@ -341,6 +345,9 @@ int __init verify_local_APIC(void)
return 1;
}
+#ifdef CONFIG_XEN
+void __init sync_Arb_IDs(void) {}
+#else /* !CONFIG_XEN */
void __init sync_Arb_IDs(void)
{
/* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 */
@@ -356,6 +363,7 @@ void __init sync_Arb_IDs(void)
apic_write_around(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG
| APIC_DM_INIT);
}
+#endif /* !CONFIG_XEN */
extern void __error_in_apic_c (void);
diff -aurpN -X /home/fletch/.diff.exclude virgin/arch/i386/kernel/io_apic.c
xen-io_apic1/arch/i386/kernel/io_apic.c
--- virgin/arch/i386/kernel/io_apic.c 2005-08-07 09:15:22.000000000 -0700
+++ xen-io_apic1/arch/i386/kernel/io_apic.c 2005-08-08 08:39:01.000000000
-0700
@@ -108,6 +108,7 @@ static void add_pin_to_irq(unsigned int
entry->pin = pin;
}
+#ifndef CONFIG_XEN
/*
* Reroute an IRQ to a different pin.
*/
@@ -212,7 +213,11 @@ static void clear_IO_APIC_pin(unsigned i
io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry) + 1));
spin_unlock_irqrestore(&ioapic_lock, flags);
}
+#endif /* !CONFIG_XEN */
+#ifdef CONFIG_XEN
+#define clear_IO_APIC() ((void)0)
+#else /* !CONFIG_XEN */
static void clear_IO_APIC (void)
{
int apic, pin;
@@ -221,7 +226,9 @@ static void clear_IO_APIC (void)
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
clear_IO_APIC_pin(apic, pin);
}
+#else /* !CONFIG_XEN */
+#ifndef /* CONFIG_XEN */
static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
{
unsigned long flags;
@@ -244,6 +251,7 @@ static void set_ioapic_affinity_irq(unsi
}
spin_unlock_irqrestore(&ioapic_lock, flags);
}
+#endif /* !CONFIG_XEN */
#if defined(CONFIG_IRQBALANCE)
# include <asm/processor.h> /* kernel_thread() */
@@ -662,7 +670,7 @@ late_initcall(balanced_irq_init);
static inline void move_irq(int irq) { }
#endif /* CONFIG_IRQBALANCE */
-#ifndef CONFIG_SMP
+#if !defined(CONFIG_SMP) && !defined(CONFIG_XEN)
void fastcall send_IPI_self(int vector)
{
unsigned int cfg;
@@ -677,7 +685,7 @@ void fastcall send_IPI_self(int vector)
*/
apic_write_around(APIC_ICR, cfg);
}
-#endif /* !CONFIG_SMP */
+#endif /* !CONFIG_SMP && !CONFIG_XEN */
/*
@@ -745,6 +753,7 @@ static int find_irq_entry(int apic, int
return -1;
}
+#ifndef CONFIG_XEN
/*
* Find the pin to which IRQ[irq] (ISA) is connected
*/
@@ -767,6 +776,7 @@ static int find_isa_irq_pin(int irq, int
}
return -1;
}
+#endif /* !CONFIG_XEN */
/*
* Find a specific PCI IRQ entry.
@@ -815,6 +825,7 @@ int IO_APIC_get_PCI_irq_vector(int bus,
}
EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
+#ifndef CONFIG_XEN
/*
* This function currently is only a helper for the i386 smp boot process
where
* we need to reprogram the ioredtbls to cater for the cpus which have come
online
@@ -838,6 +849,7 @@ void __init setup_ioapic_dest(void)
}
}
+#endif /* !CONFIG_XEN */
/*
* EISA Edge/Level control register, ELCR
@@ -1155,13 +1167,20 @@ next:
return current_vector;
}
+#ifndef CONFIG_XEN
static struct hw_interrupt_type ioapic_level_type;
static struct hw_interrupt_type ioapic_edge_type;
#define IOAPIC_AUTO -1
#define IOAPIC_EDGE 0
#define IOAPIC_LEVEL 1
+#endif /* !CONFIG_XEN */
+#ifdef CONFIG_XEN
+static inline void ioapic_register_intr(int irq, int vector, unsigned long
trigger)
+{
+}
+#else /* !CONFIG_XEN */
static inline void ioapic_register_intr(int irq, int vector, unsigned long
trigger)
{
if (use_pci_vector() && !platform_legacy_irq(irq)) {
@@ -1180,6 +1199,7 @@ static inline void ioapic_register_intr(
set_intr_gate(vector, interrupt[irq]);
}
}
+#endif /* !CONFIG_XEN */
static void __init setup_IO_APIC_irqs(void)
{
@@ -1257,6 +1277,7 @@ static void __init setup_IO_APIC_irqs(vo
apic_printk(APIC_VERBOSE, " not connected.\n");
}
+#ifndef CONFIG_XEN
/*
* Set up the 8259A-master output pin:
*/
@@ -1304,7 +1325,11 @@ static void __init setup_ExtINT_IRQ0_pin
static inline void UNEXPECTED_IO_APIC(void)
{
}
+#endif /* !CONFIG_XEN */
+#ifdef CONFIG_XEN
+void __init print_IO_APIC(void) { }
+#else /* !CONFIG_XEN */
void __init print_IO_APIC(void)
{
int apic, i;
@@ -1453,6 +1478,7 @@ void __init print_IO_APIC(void)
return;
}
+#endif /* !CONFIG_XEN */
#if 0
@@ -1680,7 +1706,9 @@ void disable_IO_APIC(void)
* by Matt Domsch <Matt_Domsch@xxxxxxxx> Tue Dec 21 12:25:05 CST 1999
*/
-#ifndef CONFIG_X86_NUMAQ
+#if defined(CONFIG_XEN) || defined(CONFIG_X86_NUMAQ)
+static void __init setup_ioapic_ids_from_mpc(void) { }
+#else
static void __init setup_ioapic_ids_from_mpc(void)
{
union IO_APIC_reg_00 reg_00;
@@ -1785,10 +1813,9 @@ static void __init setup_ioapic_ids_from
apic_printk(APIC_VERBOSE, " ok.\n");
}
}
-#else
-static void __init setup_ioapic_ids_from_mpc(void) { }
#endif
+#ifndef CONFIG_XEN
/*
* There is a nasty bug in some older SMP boards, their mptable lies
* about the timer IRQ. We do the following to work around the situation:
@@ -2013,6 +2040,7 @@ static struct hw_interrupt_type ioapic_l
.end = end_level_ioapic,
.set_affinity = set_ioapic_affinity,
};
+#endif /* !CONFIG_XEN */
static inline void init_IO_APIC_traps(void)
{
@@ -2051,6 +2079,7 @@ static inline void init_IO_APIC_traps(vo
}
}
+#ifndef CONFIG_XEN
static void enable_lapic_irq (unsigned int irq)
{
unsigned long v;
@@ -2163,7 +2192,11 @@ static inline void unlock_ExtINT_logic(v
io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry0) + 0));
spin_unlock_irqrestore(&ioapic_lock, flags);
}
+#endif /* !CONFIG_XEN */
+#ifdef CONFIG_XEN
+#define check_timer() ((void)0)
+#else /* !CONFIG_XEN */
/*
* This code may look a bit paranoid, but it's supposed to cooperate with
* a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
@@ -2277,6 +2310,7 @@ static inline void check_timer(void)
panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a "
"report. Then try booting with the 'noapic' option");
}
+#else /* !CONFIG_XEN */
/*
*
@@ -2423,6 +2457,12 @@ device_initcall(ioapic_init_sysfs);
#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_XEN
+int __init io_apic_get_unique_id (int ioapic, int apic_id)
+{
+ return apic_id;
+}
+#else /* !CONFIG_XEN */
int __init io_apic_get_unique_id (int ioapic, int apic_id)
{
union IO_APIC_reg_00 reg_00;
@@ -2494,6 +2534,7 @@ int __init io_apic_get_unique_id (int io
return apic_id;
}
+#endif /* !CONFIG_XEN */
int __init io_apic_get_version (int ioapic)
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-i386/hw_irq.h
xen-io_apic1/include/asm-i386/hw_irq.h
--- virgin/include/asm-i386/hw_irq.h 2005-03-31 21:09:43.000000000 -0800
+++ xen-io_apic1/include/asm-i386/hw_irq.h 2005-08-08 08:39:01.000000000
-0700
@@ -66,7 +66,7 @@ extern atomic_t irq_mis_count;
#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
-#if defined(CONFIG_X86_IO_APIC)
+#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_XEN)
static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
{
if (IO_APIC_IRQ(i))
_______________________________________________
Xen-merge mailing list
Xen-merge@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-merge
|