diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-07-19 05:07:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-20 03:18:17 -0400 |
commit | 3c9cb6de1e5ad37d1558fdb0d9d2bed5a7bac0d9 (patch) | |
tree | f579e0c0a09c6df7fc0fbf6e8008920eec325e2b /arch/x86/kernel | |
parent | 5f1f2b3d9dbaee82cd532f28da459adcbf611499 (diff) |
x86: introduce x86_quirks
introduce x86_quirks array of boot-time quirk methods.
No change in functionality intended.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/e820.c | 9 | ||||
-rw-r--r-- | arch/x86/kernel/mpparse.c | 17 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/visws_quirks.c | 42 |
4 files changed, 31 insertions, 41 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 6c60aeaac15f..9af89078f7bb 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -1299,11 +1299,6 @@ void __init e820_reserve_resources(void) | |||
1299 | } | 1299 | } |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | /* | ||
1303 | * Non-standard memory setup can be specified via this quirk: | ||
1304 | */ | ||
1305 | char * (*arch_memory_setup_quirk)(void); | ||
1306 | |||
1307 | char *__init default_machine_specific_memory_setup(void) | 1302 | char *__init default_machine_specific_memory_setup(void) |
1308 | { | 1303 | { |
1309 | char *who = "BIOS-e820"; | 1304 | char *who = "BIOS-e820"; |
@@ -1344,8 +1339,8 @@ char *__init default_machine_specific_memory_setup(void) | |||
1344 | 1339 | ||
1345 | char *__init __attribute__((weak)) machine_specific_memory_setup(void) | 1340 | char *__init __attribute__((weak)) machine_specific_memory_setup(void) |
1346 | { | 1341 | { |
1347 | if (arch_memory_setup_quirk) { | 1342 | if (x86_quirks->arch_memory_setup) { |
1348 | char *who = arch_memory_setup_quirk(); | 1343 | char *who = x86_quirks->arch_memory_setup(); |
1349 | 1344 | ||
1350 | if (who) | 1345 | if (who) |
1351 | return who; | 1346 | return who; |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 3b25e49380c6..3cbd2df3abe4 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/bios_ebda.h> | 27 | #include <asm/bios_ebda.h> |
28 | #include <asm/e820.h> | 28 | #include <asm/e820.h> |
29 | #include <asm/trampoline.h> | 29 | #include <asm/trampoline.h> |
30 | #include <asm/setup.h> | ||
30 | 31 | ||
31 | #include <mach_apic.h> | 32 | #include <mach_apic.h> |
32 | #ifdef CONFIG_X86_32 | 33 | #ifdef CONFIG_X86_32 |
@@ -726,20 +727,14 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) | |||
726 | static struct intel_mp_floating *mpf_found; | 727 | static struct intel_mp_floating *mpf_found; |
727 | 728 | ||
728 | /* | 729 | /* |
729 | * Machine specific quirk for finding the SMP config before other setup | ||
730 | * activities destroy the table: | ||
731 | */ | ||
732 | int (*mach_get_smp_config_quirk)(unsigned int early); | ||
733 | |||
734 | /* | ||
735 | * Scan the memory blocks for an SMP configuration block. | 730 | * Scan the memory blocks for an SMP configuration block. |
736 | */ | 731 | */ |
737 | static void __init __get_smp_config(unsigned int early) | 732 | static void __init __get_smp_config(unsigned int early) |
738 | { | 733 | { |
739 | struct intel_mp_floating *mpf = mpf_found; | 734 | struct intel_mp_floating *mpf = mpf_found; |
740 | 735 | ||
741 | if (mach_get_smp_config_quirk) { | 736 | if (x86_quirks->mach_get_smp_config) { |
742 | if (mach_get_smp_config_quirk(early)) | 737 | if (x86_quirks->mach_get_smp_config(early)) |
743 | return; | 738 | return; |
744 | } | 739 | } |
745 | if (acpi_lapic && early) | 740 | if (acpi_lapic && early) |
@@ -899,14 +894,12 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
899 | return 0; | 894 | return 0; |
900 | } | 895 | } |
901 | 896 | ||
902 | int (*mach_find_smp_config_quirk)(unsigned int reserve); | ||
903 | |||
904 | static void __init __find_smp_config(unsigned int reserve) | 897 | static void __init __find_smp_config(unsigned int reserve) |
905 | { | 898 | { |
906 | unsigned int address; | 899 | unsigned int address; |
907 | 900 | ||
908 | if (mach_find_smp_config_quirk) { | 901 | if (x86_quirks->mach_find_smp_config) { |
909 | if (mach_find_smp_config_quirk(reserve)) | 902 | if (x86_quirks->mach_find_smp_config(reserve)) |
910 | return; | 903 | return; |
911 | } | 904 | } |
912 | /* | 905 | /* |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 4a2b8acc1d95..bbcc13d0b569 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -574,6 +574,10 @@ static int __init setup_elfcorehdr(char *arg) | |||
574 | early_param("elfcorehdr", setup_elfcorehdr); | 574 | early_param("elfcorehdr", setup_elfcorehdr); |
575 | #endif | 575 | #endif |
576 | 576 | ||
577 | static struct x86_quirks default_x86_quirks __initdata; | ||
578 | |||
579 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; | ||
580 | |||
577 | /* | 581 | /* |
578 | * Determine if we were loaded by an EFI loader. If so, then we have also been | 582 | * Determine if we were loaded by an EFI loader. If so, then we have also been |
579 | * passed the efi memmap, systab, etc., so we should use these data structures | 583 | * passed the efi memmap, systab, etc., so we should use these data structures |
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c index e94bdb6add1d..41e01b145c48 100644 --- a/arch/x86/kernel/visws_quirks.c +++ b/arch/x86/kernel/visws_quirks.c | |||
@@ -73,7 +73,7 @@ int is_visws_box(void) | |||
73 | return visws_board_type >= 0; | 73 | return visws_board_type >= 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | static int __init visws_time_init_quirk(void) | 76 | static int __init visws_time_init(void) |
77 | { | 77 | { |
78 | printk(KERN_INFO "Starting Cobalt Timer system clock\n"); | 78 | printk(KERN_INFO "Starting Cobalt Timer system clock\n"); |
79 | 79 | ||
@@ -93,7 +93,7 @@ static int __init visws_time_init_quirk(void) | |||
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
95 | 95 | ||
96 | static int __init visws_pre_intr_init_quirk(void) | 96 | static int __init visws_pre_intr_init(void) |
97 | { | 97 | { |
98 | init_VISWS_APIC_irqs(); | 98 | init_VISWS_APIC_irqs(); |
99 | 99 | ||
@@ -114,7 +114,7 @@ EXPORT_SYMBOL(sgivwfb_mem_size); | |||
114 | 114 | ||
115 | long long mem_size __initdata = 0; | 115 | long long mem_size __initdata = 0; |
116 | 116 | ||
117 | static char * __init visws_memory_setup_quirk(void) | 117 | static char * __init visws_memory_setup(void) |
118 | { | 118 | { |
119 | long long gfx_mem_size = 8 * MB; | 119 | long long gfx_mem_size = 8 * MB; |
120 | 120 | ||
@@ -176,7 +176,7 @@ static void visws_machine_power_off(void) | |||
176 | outl(PIIX_SPECIAL_STOP, 0xCFC); | 176 | outl(PIIX_SPECIAL_STOP, 0xCFC); |
177 | } | 177 | } |
178 | 178 | ||
179 | static int __init visws_get_smp_config_quirk(unsigned int early) | 179 | static int __init visws_get_smp_config(unsigned int early) |
180 | { | 180 | { |
181 | /* | 181 | /* |
182 | * Prevent MP-table parsing by the generic code: | 182 | * Prevent MP-table parsing by the generic code: |
@@ -192,7 +192,7 @@ extern unsigned int __cpuinitdata maxcpus; | |||
192 | * No problem for Linux. | 192 | * No problem for Linux. |
193 | */ | 193 | */ |
194 | 194 | ||
195 | static void __init MP_processor_info (struct mpc_config_processor *m) | 195 | static void __init MP_processor_info(struct mpc_config_processor *m) |
196 | { | 196 | { |
197 | int ver, logical_apicid; | 197 | int ver, logical_apicid; |
198 | physid_mask_t apic_cpus; | 198 | physid_mask_t apic_cpus; |
@@ -232,7 +232,7 @@ static void __init MP_processor_info (struct mpc_config_processor *m) | |||
232 | apic_version[m->mpc_apicid] = ver; | 232 | apic_version[m->mpc_apicid] = ver; |
233 | } | 233 | } |
234 | 234 | ||
235 | int __init visws_find_smp_config_quirk(unsigned int reserve) | 235 | static int __init visws_find_smp_config(unsigned int reserve) |
236 | { | 236 | { |
237 | struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS); | 237 | struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS); |
238 | unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS)); | 238 | unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS)); |
@@ -258,7 +258,17 @@ int __init visws_find_smp_config_quirk(unsigned int reserve) | |||
258 | return 1; | 258 | return 1; |
259 | } | 259 | } |
260 | 260 | ||
261 | extern int visws_trap_init_quirk(void); | 261 | static int visws_trap_init(void); |
262 | |||
263 | static struct x86_quirks visws_x86_quirks __initdata = { | ||
264 | .arch_time_init = visws_time_init, | ||
265 | .arch_pre_intr_init = visws_pre_intr_init, | ||
266 | .arch_memory_setup = visws_memory_setup, | ||
267 | .arch_intr_init = NULL, | ||
268 | .arch_trap_init = visws_trap_init, | ||
269 | .mach_get_smp_config = visws_get_smp_config, | ||
270 | .mach_find_smp_config = visws_find_smp_config, | ||
271 | }; | ||
262 | 272 | ||
263 | void __init visws_early_detect(void) | 273 | void __init visws_early_detect(void) |
264 | { | 274 | { |
@@ -272,16 +282,10 @@ void __init visws_early_detect(void) | |||
272 | 282 | ||
273 | /* | 283 | /* |
274 | * Install special quirks for timer, interrupt and memory setup: | 284 | * Install special quirks for timer, interrupt and memory setup: |
275 | */ | ||
276 | arch_time_init_quirk = visws_time_init_quirk; | ||
277 | arch_pre_intr_init_quirk = visws_pre_intr_init_quirk; | ||
278 | arch_memory_setup_quirk = visws_memory_setup_quirk; | ||
279 | |||
280 | /* | ||
281 | * Fall back to generic behavior for traps: | 285 | * Fall back to generic behavior for traps: |
286 | * Override generic MP-table parsing: | ||
282 | */ | 287 | */ |
283 | arch_intr_init_quirk = NULL; | 288 | x86_quirks = &visws_x86_quirks; |
284 | arch_trap_init_quirk = visws_trap_init_quirk; | ||
285 | 289 | ||
286 | /* | 290 | /* |
287 | * Install reboot quirks: | 291 | * Install reboot quirks: |
@@ -294,12 +298,6 @@ void __init visws_early_detect(void) | |||
294 | */ | 298 | */ |
295 | no_broadcast = 0; | 299 | no_broadcast = 0; |
296 | 300 | ||
297 | /* | ||
298 | * Override generic MP-table parsing: | ||
299 | */ | ||
300 | mach_get_smp_config_quirk = visws_get_smp_config_quirk; | ||
301 | mach_find_smp_config_quirk = visws_find_smp_config_quirk; | ||
302 | |||
303 | #ifdef CONFIG_X86_IO_APIC | 301 | #ifdef CONFIG_X86_IO_APIC |
304 | /* | 302 | /* |
305 | * Turn off IO-APIC detection and initialization: | 303 | * Turn off IO-APIC detection and initialization: |
@@ -426,7 +424,7 @@ static __init void cobalt_init(void) | |||
426 | co_apic_read(CO_APIC_ID)); | 424 | co_apic_read(CO_APIC_ID)); |
427 | } | 425 | } |
428 | 426 | ||
429 | int __init visws_trap_init_quirk(void) | 427 | static int __init visws_trap_init(void) |
430 | { | 428 | { |
431 | lithium_init(); | 429 | lithium_init(); |
432 | cobalt_init(); | 430 | cobalt_init(); |