aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r--arch/i386/kernel/apm.c36
-rw-r--r--arch/i386/kernel/efi.c4
-rw-r--r--arch/i386/kernel/nmi.c3
-rw-r--r--arch/i386/kernel/setup.c10
-rw-r--r--arch/i386/kernel/smpboot.c5
-rw-r--r--arch/i386/kernel/srat.c7
-rw-r--r--arch/i386/kernel/traps.c2
7 files changed, 38 insertions, 29 deletions
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index ff9ce4b5eaa8..b42f2d914af3 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -225,6 +225,7 @@
225#include <linux/smp_lock.h> 225#include <linux/smp_lock.h>
226#include <linux/dmi.h> 226#include <linux/dmi.h>
227#include <linux/suspend.h> 227#include <linux/suspend.h>
228#include <linux/kthread.h>
228 229
229#include <asm/system.h> 230#include <asm/system.h>
230#include <asm/uaccess.h> 231#include <asm/uaccess.h>
@@ -402,8 +403,6 @@ static int realmode_power_off = 1;
402#else 403#else
403static int realmode_power_off; 404static int realmode_power_off;
404#endif 405#endif
405static int exit_kapmd __read_mostly;
406static int kapmd_running __read_mostly;
407#ifdef CONFIG_APM_ALLOW_INTS 406#ifdef CONFIG_APM_ALLOW_INTS
408static int allow_ints = 1; 407static int allow_ints = 1;
409#else 408#else
@@ -419,6 +418,8 @@ static const struct desc_struct bad_bios_desc = { 0, 0x00409200 };
419 418
420static const char driver_version[] = "1.16ac"; /* no spaces */ 419static const char driver_version[] = "1.16ac"; /* no spaces */
421 420
421static struct task_struct *kapmd_task;
422
422/* 423/*
423 * APM event names taken from the APM 1.2 specification. These are 424 * APM event names taken from the APM 1.2 specification. These are
424 * the message codes that the BIOS uses to tell us about events 425 * the message codes that the BIOS uses to tell us about events
@@ -1423,7 +1424,7 @@ static void apm_mainloop(void)
1423 set_current_state(TASK_INTERRUPTIBLE); 1424 set_current_state(TASK_INTERRUPTIBLE);
1424 for (;;) { 1425 for (;;) {
1425 schedule_timeout(APM_CHECK_TIMEOUT); 1426 schedule_timeout(APM_CHECK_TIMEOUT);
1426 if (exit_kapmd) 1427 if (kthread_should_stop())
1427 break; 1428 break;
1428 /* 1429 /*
1429 * Ok, check all events, check for idle (and mark us sleeping 1430 * Ok, check all events, check for idle (and mark us sleeping
@@ -1706,12 +1707,6 @@ static int apm(void *unused)
1706 char * power_stat; 1707 char * power_stat;
1707 char * bat_stat; 1708 char * bat_stat;
1708 1709
1709 kapmd_running = 1;
1710
1711 daemonize("kapmd");
1712
1713 current->flags |= PF_NOFREEZE;
1714
1715#ifdef CONFIG_SMP 1710#ifdef CONFIG_SMP
1716 /* 2002/08/01 - WT 1711 /* 2002/08/01 - WT
1717 * This is to avoid random crashes at boot time during initialization 1712 * This is to avoid random crashes at boot time during initialization
@@ -1821,7 +1816,6 @@ static int apm(void *unused)
1821 console_blank_hook = NULL; 1816 console_blank_hook = NULL;
1822#endif 1817#endif
1823 } 1818 }
1824 kapmd_running = 0;
1825 1819
1826 return 0; 1820 return 0;
1827} 1821}
@@ -2220,7 +2214,7 @@ static int __init apm_init(void)
2220{ 2214{
2221 struct proc_dir_entry *apm_proc; 2215 struct proc_dir_entry *apm_proc;
2222 struct desc_struct *gdt; 2216 struct desc_struct *gdt;
2223 int ret; 2217 int err;
2224 2218
2225 dmi_check_system(apm_dmi_table); 2219 dmi_check_system(apm_dmi_table);
2226 2220
@@ -2329,12 +2323,17 @@ static int __init apm_init(void)
2329 if (apm_proc) 2323 if (apm_proc)
2330 apm_proc->owner = THIS_MODULE; 2324 apm_proc->owner = THIS_MODULE;
2331 2325
2332 ret = kernel_thread(apm, NULL, CLONE_KERNEL | SIGCHLD); 2326 kapmd_task = kthread_create(apm, NULL, "kapmd");
2333 if (ret < 0) { 2327 if (IS_ERR(kapmd_task)) {
2334 printk(KERN_ERR "apm: disabled - Unable to start kernel thread.\n"); 2328 printk(KERN_ERR "apm: disabled - Unable to start kernel "
2329 "thread.\n");
2330 err = PTR_ERR(kapmd_task);
2331 kapmd_task = NULL;
2335 remove_proc_entry("apm", NULL); 2332 remove_proc_entry("apm", NULL);
2336 return -ENOMEM; 2333 return err;
2337 } 2334 }
2335 kapmd_task->flags |= PF_NOFREEZE;
2336 wake_up_process(kapmd_task);
2338 2337
2339 if (num_online_cpus() > 1 && !smp ) { 2338 if (num_online_cpus() > 1 && !smp ) {
2340 printk(KERN_NOTICE 2339 printk(KERN_NOTICE
@@ -2384,9 +2383,10 @@ static void __exit apm_exit(void)
2384 remove_proc_entry("apm", NULL); 2383 remove_proc_entry("apm", NULL);
2385 if (power_off) 2384 if (power_off)
2386 pm_power_off = NULL; 2385 pm_power_off = NULL;
2387 exit_kapmd = 1; 2386 if (kapmd_task) {
2388 while (kapmd_running) 2387 kthread_stop(kapmd_task);
2389 schedule(); 2388 kapmd_task = NULL;
2389 }
2390#ifdef CONFIG_PM_LEGACY 2390#ifdef CONFIG_PM_LEGACY
2391 pm_active = 0; 2391 pm_active = 0;
2392#endif 2392#endif
diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c
index fe158042110b..f9436989473c 100644
--- a/arch/i386/kernel/efi.c
+++ b/arch/i386/kernel/efi.c
@@ -65,7 +65,7 @@ static unsigned long efi_rt_eflags;
65static DEFINE_SPINLOCK(efi_rt_lock); 65static DEFINE_SPINLOCK(efi_rt_lock);
66static pgd_t efi_bak_pg_dir_pointer[2]; 66static pgd_t efi_bak_pg_dir_pointer[2];
67 67
68static void efi_call_phys_prelog(void) 68static void efi_call_phys_prelog(void) __acquires(efi_rt_lock)
69{ 69{
70 unsigned long cr4; 70 unsigned long cr4;
71 unsigned long temp; 71 unsigned long temp;
@@ -109,7 +109,7 @@ static void efi_call_phys_prelog(void)
109 load_gdt(cpu_gdt_descr); 109 load_gdt(cpu_gdt_descr);
110} 110}
111 111
112static void efi_call_phys_epilog(void) 112static void efi_call_phys_epilog(void) __releases(efi_rt_lock)
113{ 113{
114 unsigned long cr4; 114 unsigned long cr4;
115 struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, 0); 115 struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, 0);
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index dbda706fdd14..0fc4997fb143 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -31,6 +31,9 @@
31 31
32#include "mach_traps.h" 32#include "mach_traps.h"
33 33
34int unknown_nmi_panic;
35int nmi_watchdog_enabled;
36
34/* perfctr_nmi_owner tracks the ownership of the perfctr registers: 37/* perfctr_nmi_owner tracks the ownership of the perfctr registers:
35 * evtsel_nmi_owner tracks the ownership of the event selection 38 * evtsel_nmi_owner tracks the ownership of the event selection
36 * - different performance counters/ event selection may be reserved for 39 * - different performance counters/ event selection may be reserved for
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 814cdebf7377..000cf03751fe 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -209,9 +209,6 @@ static struct resource adapter_rom_resources[] = { {
209 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM 209 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
210} }; 210} };
211 211
212#define ADAPTER_ROM_RESOURCES \
213 (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0])
214
215static struct resource video_rom_resource = { 212static struct resource video_rom_resource = {
216 .name = "Video ROM", 213 .name = "Video ROM",
217 .start = 0xc0000, 214 .start = 0xc0000,
@@ -273,9 +270,6 @@ static struct resource standard_io_resources[] = { {
273 .flags = IORESOURCE_BUSY | IORESOURCE_IO 270 .flags = IORESOURCE_BUSY | IORESOURCE_IO
274} }; 271} };
275 272
276#define STANDARD_IO_RESOURCES \
277 (sizeof standard_io_resources / sizeof standard_io_resources[0])
278
279#define romsignature(x) (*(unsigned short *)(x) == 0xaa55) 273#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
280 274
281static int __init romchecksum(unsigned char *rom, unsigned long length) 275static int __init romchecksum(unsigned char *rom, unsigned long length)
@@ -332,7 +326,7 @@ static void __init probe_roms(void)
332 } 326 }
333 327
334 /* check for adapter roms on 2k boundaries */ 328 /* check for adapter roms on 2k boundaries */
335 for (i = 0; i < ADAPTER_ROM_RESOURCES && start < upper; start += 2048) { 329 for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) {
336 rom = isa_bus_to_virt(start); 330 rom = isa_bus_to_virt(start);
337 if (!romsignature(rom)) 331 if (!romsignature(rom))
338 continue; 332 continue;
@@ -1272,7 +1266,7 @@ static int __init request_standard_resources(void)
1272 request_resource(&iomem_resource, &video_ram_resource); 1266 request_resource(&iomem_resource, &video_ram_resource);
1273 1267
1274 /* request I/O space for devices used on all i[345]86 PCs */ 1268 /* request I/O space for devices used on all i[345]86 PCs */
1275 for (i = 0; i < STANDARD_IO_RESOURCES; i++) 1269 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
1276 request_resource(&ioport_resource, &standard_io_resources[i]); 1270 request_resource(&ioport_resource, &standard_io_resources[i]);
1277 return 0; 1271 return 0;
1278} 1272}
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 020d873b7d21..82b26d5ce476 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -102,6 +102,8 @@ u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
102 { [0 ... NR_CPUS-1] = 0xff }; 102 { [0 ... NR_CPUS-1] = 0xff };
103EXPORT_SYMBOL(x86_cpu_to_apicid); 103EXPORT_SYMBOL(x86_cpu_to_apicid);
104 104
105u8 apicid_2_node[MAX_APICID];
106
105/* 107/*
106 * Trampoline 80x86 program as an array. 108 * Trampoline 80x86 program as an array.
107 */ 109 */
@@ -645,7 +647,7 @@ static void map_cpu_to_logical_apicid(void)
645{ 647{
646 int cpu = smp_processor_id(); 648 int cpu = smp_processor_id();
647 int apicid = logical_smp_processor_id(); 649 int apicid = logical_smp_processor_id();
648 int node = apicid_to_node(apicid); 650 int node = apicid_to_node(hard_smp_processor_id());
649 651
650 if (!node_online(node)) 652 if (!node_online(node))
651 node = first_online_node; 653 node = first_online_node;
@@ -954,6 +956,7 @@ static int __devinit do_boot_cpu(int apicid, int cpu)
954 956
955 irq_ctx_init(cpu); 957 irq_ctx_init(cpu);
956 958
959 x86_cpu_to_apicid[cpu] = apicid;
957 /* 960 /*
958 * This grunge runs the startup process for 961 * This grunge runs the startup process for
959 * the targeted processor. 962 * the targeted processor.
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c
index 32413122c4c2..f7e735c077c3 100644
--- a/arch/i386/kernel/srat.c
+++ b/arch/i386/kernel/srat.c
@@ -30,6 +30,7 @@
30#include <linux/nodemask.h> 30#include <linux/nodemask.h>
31#include <asm/srat.h> 31#include <asm/srat.h>
32#include <asm/topology.h> 32#include <asm/topology.h>
33#include <asm/smp.h>
33 34
34/* 35/*
35 * proximity macros and definitions 36 * proximity macros and definitions
@@ -54,6 +55,7 @@ struct node_memory_chunk_s {
54static struct node_memory_chunk_s node_memory_chunk[MAXCHUNKS]; 55static struct node_memory_chunk_s node_memory_chunk[MAXCHUNKS];
55 56
56static int num_memory_chunks; /* total number of memory chunks */ 57static int num_memory_chunks; /* total number of memory chunks */
58static u8 __initdata apicid_to_pxm[MAX_APICID];
57 59
58extern void * boot_ioremap(unsigned long, unsigned long); 60extern void * boot_ioremap(unsigned long, unsigned long);
59 61
@@ -69,6 +71,8 @@ static void __init parse_cpu_affinity_structure(char *p)
69 /* mark this node as "seen" in node bitmap */ 71 /* mark this node as "seen" in node bitmap */
70 BMAP_SET(pxm_bitmap, cpu_affinity->proximity_domain); 72 BMAP_SET(pxm_bitmap, cpu_affinity->proximity_domain);
71 73
74 apicid_to_pxm[cpu_affinity->apic_id] = cpu_affinity->proximity_domain;
75
72 printk("CPU 0x%02X in proximity domain 0x%02X\n", 76 printk("CPU 0x%02X in proximity domain 0x%02X\n",
73 cpu_affinity->apic_id, cpu_affinity->proximity_domain); 77 cpu_affinity->apic_id, cpu_affinity->proximity_domain);
74} 78}
@@ -235,6 +239,9 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
235 printk("Number of logical nodes in system = %d\n", num_online_nodes()); 239 printk("Number of logical nodes in system = %d\n", num_online_nodes());
236 printk("Number of memory chunks in system = %d\n", num_memory_chunks); 240 printk("Number of memory chunks in system = %d\n", num_memory_chunks);
237 241
242 for (i = 0; i < MAX_APICID; i++)
243 apicid_2_node[i] = pxm_to_node(apicid_to_pxm[i]);
244
238 for (j = 0; j < num_memory_chunks; j++){ 245 for (j = 0; j < num_memory_chunks; j++){
239 struct node_memory_chunk_s * chunk = &node_memory_chunk[j]; 246 struct node_memory_chunk_s * chunk = &node_memory_chunk[j];
240 printk("chunk %d nid %d start_pfn %08lx end_pfn %08lx\n", 247 printk("chunk %d nid %d start_pfn %08lx end_pfn %08lx\n",
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index a13037fe0ee3..6820b8d643c7 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -57,6 +57,8 @@
57 57
58#include "mach_traps.h" 58#include "mach_traps.h"
59 59
60int panic_on_unrecovered_nmi;
61
60asmlinkage int system_call(void); 62asmlinkage int system_call(void);
61 63
62struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, 64struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },