Commit 8e6dafd6 authored by Ingo Molnar's avatar Ingo Molnar

x86: refactor x86_quirks support

Impact: cleanup

Make x86_quirks support more transparent. The highlevel
methods are now named:

  extern void x86_quirk_pre_intr_init(void);
  extern void x86_quirk_intr_init(void);

  extern void x86_quirk_trap_init(void);

  extern void x86_quirk_pre_time_init(void);
  extern void x86_quirk_time_init(void);

This makes it clear that if some platform extension has to
do something here that it is considered ... weird, and is
discouraged.

Also remove arch_hooks.h and move it into setup.h (and other
header files where appropriate).
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent d85a881d
#ifndef _ASM_X86_ARCH_HOOKS_H
#define _ASM_X86_ARCH_HOOKS_H
#include <linux/interrupt.h>
/*
* linux/include/asm/arch_hooks.h
*
* define the architecture specific hooks
*/
/* these aren't arch hooks, they are generic routines
* that can be used by the hooks */
extern void init_ISA_irqs(void);
extern irqreturn_t timer_interrupt(int irq, void *dev_id);
/* these are the defined hooks */
extern void pre_intr_init_hook(void);
extern void intr_init_hook(void);
extern void trap_init_hook(void);
extern void pre_time_init_hook(void);
extern void time_init_hook(void);
#endif /* _ASM_X86_ARCH_HOOKS_H */
...@@ -60,4 +60,8 @@ extern struct irq_chip i8259A_chip; ...@@ -60,4 +60,8 @@ extern struct irq_chip i8259A_chip;
extern void mask_8259A(void); extern void mask_8259A(void);
extern void unmask_8259A(void); extern void unmask_8259A(void);
#ifdef CONFIG_X86_32
extern void init_ISA_irqs(void);
#endif
#endif /* _ASM_X86_I8259_H */ #endif /* _ASM_X86_I8259_H */
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
struct mpc_cpu; struct mpc_cpu;
struct mpc_bus; struct mpc_bus;
struct mpc_oemtable; struct mpc_oemtable;
struct x86_quirks { struct x86_quirks {
int (*arch_pre_time_init)(void); int (*arch_pre_time_init)(void);
int (*arch_time_init)(void); int (*arch_time_init)(void);
...@@ -33,6 +34,14 @@ struct x86_quirks { ...@@ -33,6 +34,14 @@ struct x86_quirks {
int (*update_apic)(void); int (*update_apic)(void);
}; };
extern void x86_quirk_pre_intr_init(void);
extern void x86_quirk_intr_init(void);
extern void x86_quirk_trap_init(void);
extern void x86_quirk_pre_time_init(void);
extern void x86_quirk_time_init(void);
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#ifdef __i386__ #ifdef __i386__
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/interrupt.h>
#define TICK_SIZE (tick_nsec / 1000) #define TICK_SIZE (tick_nsec / 1000)
...@@ -12,6 +13,7 @@ unsigned long native_calibrate_tsc(void); ...@@ -12,6 +13,7 @@ unsigned long native_calibrate_tsc(void);
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
extern int timer_ack; extern int timer_ack;
extern int recalibrate_cpu_khz(void); extern int recalibrate_cpu_khz(void);
extern irqreturn_t timer_interrupt(int irq, void *dev_id);
#endif /* CONFIG_X86_32 */ #endif /* CONFIG_X86_32 */
extern int no_timer_check; extern int no_timer_check;
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/arch_hooks.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <asm/mpspec.h> #include <asm/mpspec.h>
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/acpi.h> #include <asm/acpi.h>
#include <asm/arch_hooks.h>
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/setup.h> #include <asm/setup.h>
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/arch_hooks.h>
#include <asm/i8259.h> #include <asm/i8259.h>
/* /*
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/arch_hooks.h> #include <asm/setup.h>
#include <asm/i8259.h> #include <asm/i8259.h>
#include <asm/traps.h> #include <asm/traps.h>
...@@ -127,8 +127,8 @@ void __init native_init_IRQ(void) ...@@ -127,8 +127,8 @@ void __init native_init_IRQ(void)
{ {
int i; int i;
/* all the set up before the call gates are initialised */ /* Execute any quirks before the call gates are initialised: */
pre_intr_init_hook(); x86_quirk_pre_intr_init();
/* /*
* Cover the whole vector space, no vector can escape * Cover the whole vector space, no vector can escape
...@@ -188,10 +188,11 @@ void __init native_init_IRQ(void) ...@@ -188,10 +188,11 @@ void __init native_init_IRQ(void)
if (!acpi_ioapic) if (!acpi_ioapic)
setup_irq(2, &irq2); setup_irq(2, &irq2);
/* setup after call gates are initialised (usually add in /*
* the architecture specific gates) * Call quirks after call gates are initialised (usually add in
* the architecture specific gates):
*/ */
intr_init_hook(); x86_quirk_intr_init();
/* /*
* External FPU? Set up irq13 if so, for * External FPU? Set up irq13 if so, for
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/kvm_para.h> #include <linux/kvm_para.h>
#include <asm/pvclock.h> #include <asm/pvclock.h>
#include <asm/arch_hooks.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <linux/percpu.h> #include <linux/percpu.h>
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/arch_hooks.h>
static unsigned char which_scsi; static unsigned char which_scsi;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <asm/paravirt.h> #include <asm/paravirt.h>
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/arch_hooks.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
......
...@@ -74,8 +74,9 @@ ...@@ -74,8 +74,9 @@
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/mpspec.h> #include <asm/mpspec.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/arch_hooks.h>
#include <asm/efi.h> #include <asm/efi.h>
#include <asm/timer.h>
#include <asm/i8259.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/dmi.h> #include <asm/dmi.h>
#include <asm/io_apic.h> #include <asm/io_apic.h>
...@@ -987,7 +988,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -987,7 +988,7 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
/** /**
* pre_intr_init_hook - initialisation prior to setting up interrupt vectors * x86_quirk_pre_intr_init - initialisation prior to setting up interrupt vectors
* *
* Description: * Description:
* Perform any necessary interrupt initialisation prior to setting up * Perform any necessary interrupt initialisation prior to setting up
...@@ -995,7 +996,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -995,7 +996,7 @@ void __init setup_arch(char **cmdline_p)
* interrupts should be initialised here if the machine emulates a PC * interrupts should be initialised here if the machine emulates a PC
* in any way. * in any way.
**/ **/
void __init pre_intr_init_hook(void) void __init x86_quirk_pre_intr_init(void)
{ {
if (x86_quirks->arch_pre_intr_init) { if (x86_quirks->arch_pre_intr_init) {
if (x86_quirks->arch_pre_intr_init()) if (x86_quirks->arch_pre_intr_init())
...@@ -1005,7 +1006,7 @@ void __init pre_intr_init_hook(void) ...@@ -1005,7 +1006,7 @@ void __init pre_intr_init_hook(void)
} }
/** /**
* intr_init_hook - post gate setup interrupt initialisation * x86_quirk_intr_init - post gate setup interrupt initialisation
* *
* Description: * Description:
* Fill in any interrupts that may have been left out by the general * Fill in any interrupts that may have been left out by the general
...@@ -1013,7 +1014,7 @@ void __init pre_intr_init_hook(void) ...@@ -1013,7 +1014,7 @@ void __init pre_intr_init_hook(void)
* than the devices on the I/O bus (like APIC interrupts in intel MP * than the devices on the I/O bus (like APIC interrupts in intel MP
* systems) are started here. * systems) are started here.
**/ **/
void __init intr_init_hook(void) void __init x86_quirk_intr_init(void)
{ {
if (x86_quirks->arch_intr_init) { if (x86_quirks->arch_intr_init) {
if (x86_quirks->arch_intr_init()) if (x86_quirks->arch_intr_init())
...@@ -1022,13 +1023,13 @@ void __init intr_init_hook(void) ...@@ -1022,13 +1023,13 @@ void __init intr_init_hook(void)
} }
/** /**
* trap_init_hook - initialise system specific traps * x86_quirk_trap_init - initialise system specific traps
* *
* Description: * Description:
* Called as the final act of trap_init(). Used in VISWS to initialise * Called as the final act of trap_init(). Used in VISWS to initialise
* the various board specific APIC traps. * the various board specific APIC traps.
**/ **/
void __init trap_init_hook(void) void __init x86_quirk_trap_init(void)
{ {
if (x86_quirks->arch_trap_init) { if (x86_quirks->arch_trap_init) {
if (x86_quirks->arch_trap_init()) if (x86_quirks->arch_trap_init())
...@@ -1044,23 +1045,23 @@ static struct irqaction irq0 = { ...@@ -1044,23 +1045,23 @@ static struct irqaction irq0 = {
}; };
/** /**
* pre_time_init_hook - do any specific initialisations before. * x86_quirk_pre_time_init - do any specific initialisations before.
* *
**/ **/
void __init pre_time_init_hook(void) void __init x86_quirk_pre_time_init(void)
{ {
if (x86_quirks->arch_pre_time_init) if (x86_quirks->arch_pre_time_init)
x86_quirks->arch_pre_time_init(); x86_quirks->arch_pre_time_init();
} }
/** /**
* time_init_hook - do any specific initialisations for the system timer. * x86_quirk_time_init - do any specific initialisations for the system timer.
* *
* Description: * Description:
* Must plug the system timer interrupt source at HZ into the IRQ listed * Must plug the system timer interrupt source at HZ into the IRQ listed
* in irq_vectors.h:TIMER_IRQ * in irq_vectors.h:TIMER_IRQ
**/ **/
void __init time_init_hook(void) void __init x86_quirk_time_init(void)
{ {
if (x86_quirks->arch_time_init) { if (x86_quirks->arch_time_init) {
/* /*
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <linux/time.h> #include <linux/time.h>
#include <linux/mca.h> #include <linux/mca.h>
#include <asm/arch_hooks.h> #include <asm/setup.h>
#include <asm/hpet.h> #include <asm/hpet.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/timer.h> #include <asm/timer.h>
...@@ -118,7 +118,7 @@ void __init hpet_time_init(void) ...@@ -118,7 +118,7 @@ void __init hpet_time_init(void)
{ {
if (!hpet_enable()) if (!hpet_enable())
setup_pit_timer(); setup_pit_timer();
time_init_hook(); x86_quirk_time_init();
} }
/* /*
...@@ -131,7 +131,7 @@ void __init hpet_time_init(void) ...@@ -131,7 +131,7 @@ void __init hpet_time_init(void)
*/ */
void __init time_init(void) void __init time_init(void)
{ {
pre_time_init_hook(); x86_quirk_pre_time_init();
tsc_init(); tsc_init();
late_time_init = choose_time_init(); late_time_init = choose_time_init();
} }
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
#include <asm/proto.h> #include <asm/proto.h>
#else #else
#include <asm/processor-flags.h> #include <asm/processor-flags.h>
#include <asm/arch_hooks.h> #include <asm/setup.h>
#include <asm/traps.h> #include <asm/traps.h>
#include "cpu/mcheck/mce.h" #include "cpu/mcheck/mce.h"
...@@ -1026,6 +1026,6 @@ void __init trap_init(void) ...@@ -1026,6 +1026,6 @@ void __init trap_init(void)
cpu_init(); cpu_init();
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
trap_init_hook(); x86_quirk_trap_init();
#endif #endif
} }
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <asm/visws/cobalt.h> #include <asm/visws/cobalt.h>
#include <asm/visws/piix4.h> #include <asm/visws/piix4.h>
#include <asm/arch_hooks.h>
#include <asm/io_apic.h> #include <asm/io_apic.h>
#include <asm/fixmap.h> #include <asm/fixmap.h>
#include <asm/reboot.h> #include <asm/reboot.h>
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <asm/vmi.h> #include <asm/vmi.h>
#include <asm/vmi_time.h> #include <asm/vmi_time.h>
#include <asm/arch_hooks.h>
#include <asm/apicdef.h> #include <asm/apicdef.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/timer.h> #include <asm/timer.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment