aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2005-09-08 17:27:13 -0400
committerTony Luck <tony.luck@intel.com>2005-09-08 17:27:13 -0400
commit344a076110f4ecb16ea6d286b63be696604982ed (patch)
treedef6e229efdb6ee91b631b6695bf7f9ace8e2719 /arch
parent9b17e7e74e767d8a494a74c3c459aeecd1e08c5f (diff)
parent1b11d78cf87a7014f96e5b7fa2e1233cc8081a00 (diff)
[IA64] Manual merge fix for 3 files
arch/ia64/Kconfig arch/ia64/kernel/acpi.c include/asm-ia64/irq.h Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/alpha/kernel/time.c7
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm/boot/compressed/head-sharpsl.S111
-rw-r--r--arch/arm/configs/omap_h2_1610_defconfig290
-rw-r--r--arch/arm/kernel/time.c7
-rw-r--r--arch/arm/mach-footbridge/Kconfig1
-rw-r--r--arch/arm/mach-iop3xx/iop321-time.c2
-rw-r--r--arch/arm/mach-iop3xx/iop331-time.c2
-rw-r--r--arch/arm/mach-ixp2000/core.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c16
-rw-r--r--arch/arm/mach-omap1/irq.c8
-rw-r--r--arch/arm/mach-pxa/Makefile2
-rw-r--r--arch/arm/mach-pxa/corgi.c55
-rw-r--r--arch/arm/mach-pxa/corgi_lcd.c396
-rw-r--r--arch/arm/mach-s3c2410/Kconfig15
-rw-r--r--arch/arm/mach-s3c2410/Makefile5
-rw-r--r--arch/arm/mach-s3c2410/bast-irq.c77
-rw-r--r--arch/arm/mach-s3c2410/mach-anubis.c270
-rw-r--r--arch/arm/mach-s3c2410/pm-simtec.c2
-rw-r--r--arch/arm/mach-s3c2410/time.c2
-rw-r--r--arch/arm/plat-omap/Kconfig16
-rw-r--r--arch/arm/plat-omap/Makefile4
-rw-r--r--arch/arm/plat-omap/clock.c39
-rw-r--r--arch/arm/plat-omap/common.c7
-rw-r--r--arch/arm/plat-omap/dma.c25
-rw-r--r--arch/arm/plat-omap/dmtimer.c260
-rw-r--r--arch/arm/plat-omap/gpio.c524
-rw-r--r--arch/arm/plat-omap/mcbsp.c9
-rw-r--r--arch/arm/plat-omap/mux.c3
-rw-r--r--arch/arm/plat-omap/ocpi.c1
-rw-r--r--arch/arm/plat-omap/pm.c255
-rw-r--r--arch/arm/plat-omap/sleep.S83
-rw-r--r--arch/arm/plat-omap/sram-fn.S58
-rw-r--r--arch/arm/plat-omap/sram.c116
-rw-r--r--arch/arm/plat-omap/sram.h21
-rw-r--r--arch/arm/plat-omap/usb.c1
-rw-r--r--arch/arm26/Kconfig4
-rw-r--r--arch/arm26/Makefile4
-rw-r--r--arch/arm26/kernel/time.c7
-rw-r--r--arch/cris/arch-v10/kernel/time.c2
-rw-r--r--arch/cris/kernel/time.c5
-rw-r--r--arch/frv/kernel/time.c7
-rw-r--r--arch/h8300/kernel/time.c5
-rw-r--r--arch/i386/Kconfig10
-rw-r--r--arch/i386/boot/setup.S2
-rw-r--r--arch/i386/boot/tools/build.c4
-rw-r--r--arch/i386/defconfig4
-rw-r--r--arch/i386/kernel/Makefile2
-rw-r--r--arch/i386/kernel/acpi/Makefile2
-rw-r--r--arch/i386/kernel/acpi/boot.c557
-rw-r--r--arch/i386/kernel/acpi/earlyquirk.c40
-rw-r--r--arch/i386/kernel/acpi/sleep.c35
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c57
-rw-r--r--arch/i386/kernel/dmi_scan.c231
-rw-r--r--arch/i386/kernel/entry.S13
-rw-r--r--arch/i386/kernel/io_apic.c69
-rw-r--r--arch/i386/kernel/kprobes.c35
-rw-r--r--arch/i386/kernel/mpparse.c14
-rw-r--r--arch/i386/kernel/nmi.c5
-rw-r--r--arch/i386/kernel/setup.c12
-rw-r--r--arch/i386/kernel/time.c13
-rw-r--r--arch/i386/kernel/timers/timer_hpet.c4
-rw-r--r--arch/i386/kernel/traps.c16
-rw-r--r--arch/i386/kernel/vmlinux.lds.S1
-rw-r--r--arch/i386/mach-default/topology.c4
-rw-r--r--arch/i386/mach-es7000/es7000plat.c4
-rw-r--r--arch/i386/mm/discontig.c8
-rw-r--r--arch/i386/mm/fault.c4
-rw-r--r--arch/i386/mm/init.c2
-rw-r--r--arch/i386/oprofile/init.c12
-rw-r--r--arch/i386/oprofile/nmi_int.c4
-rw-r--r--arch/i386/oprofile/nmi_timer_int.c2
-rw-r--r--arch/i386/pci/Makefile2
-rw-r--r--arch/i386/pci/irq.c2
-rw-r--r--arch/ia64/Kconfig36
-rw-r--r--arch/ia64/configs/bigsur_defconfig6
-rw-r--r--arch/ia64/configs/sn2_defconfig7
-rw-r--r--arch/ia64/configs/tiger_defconfig7
-rw-r--r--arch/ia64/configs/zx1_defconfig7
-rw-r--r--arch/ia64/defconfig6
-rw-r--r--arch/ia64/hp/sim/simserial.c2
-rw-r--r--arch/ia64/ia32/ia32_entry.S2
-rw-r--r--arch/ia64/ia32/sys_ia32.c31
-rw-r--r--arch/ia64/kernel/Makefile2
-rw-r--r--arch/ia64/kernel/acpi-ext.c37
-rw-r--r--arch/ia64/kernel/acpi.c326
-rw-r--r--arch/ia64/kernel/domain.c396
-rw-r--r--arch/ia64/kernel/iosapic.c22
-rw-r--r--arch/ia64/kernel/irq.c39
-rw-r--r--arch/ia64/kernel/jprobes.S1
-rw-r--r--arch/ia64/kernel/kprobes.c124
-rw-r--r--arch/ia64/kernel/setup.c4
-rw-r--r--arch/ia64/kernel/topology.c2
-rw-r--r--arch/ia64/kernel/traps.c5
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S1
-rw-r--r--arch/ia64/lib/flush.S1
-rw-r--r--arch/ia64/mm/fault.c3
-rw-r--r--arch/ia64/sn/kernel/io_init.c2
-rw-r--r--arch/ia64/sn/kernel/irq.c2
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c2
-rw-r--r--arch/ia64/sn/kernel/tiocx.c2
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c8
-rw-r--r--arch/m32r/kernel/time.c7
-rw-r--r--arch/m68k/Kconfig5
-rw-r--r--arch/m68k/bvme6000/rtc.c5
-rw-r--r--arch/m68k/kernel/time.c5
-rw-r--r--arch/m68k/mvme16x/rtc.c4
-rw-r--r--arch/m68knommu/kernel/time.c7
-rw-r--r--arch/mips/Kconfig5
-rw-r--r--arch/mips/kernel/linux32.c16
-rw-r--r--arch/mips/kernel/sysirix.c5
-rw-r--r--arch/mips/kernel/time.c7
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c2
-rw-r--r--arch/parisc/Kconfig4
-rw-r--r--arch/parisc/kernel/time.c5
-rw-r--r--arch/ppc/Kconfig4
-rw-r--r--arch/ppc/kernel/head_4xx.S1
-rw-r--r--arch/ppc/kernel/time.c7
-rw-r--r--arch/ppc/syslib/ocp.c2
-rw-r--r--arch/ppc64/Kconfig4
-rw-r--r--arch/ppc64/Makefile2
-rw-r--r--arch/ppc64/kernel/kprobes.c40
-rw-r--r--arch/ppc64/kernel/misc.S6
-rw-r--r--arch/ppc64/kernel/pSeries_reconfig.c2
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c31
-rw-r--r--arch/ppc64/kernel/time.c7
-rw-r--r--arch/ppc64/kernel/traps.c5
-rw-r--r--arch/ppc64/kernel/vmlinux.lds.S1
-rw-r--r--arch/ppc64/mm/fault.c5
-rw-r--r--arch/s390/kernel/time.c5
-rw-r--r--arch/sh/Kconfig4
-rw-r--r--arch/sh/kernel/time.c11
-rw-r--r--arch/sh64/kernel/time.c11
-rw-r--r--arch/sparc/Kconfig4
-rw-r--r--arch/sparc/kernel/pcic.c5
-rw-r--r--arch/sparc/kernel/time.c7
-rw-r--r--arch/sparc64/Kconfig4
-rw-r--r--arch/sparc64/kernel/kprobes.c36
-rw-r--r--arch/sparc64/kernel/sunos_ioctl32.c9
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c24
-rw-r--r--arch/sparc64/kernel/time.c2
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S1
-rw-r--r--arch/sparc64/mm/fault.c8
-rw-r--r--arch/sparc64/mm/init.c3
-rw-r--r--arch/sparc64/mm/ultra.S2
-rw-r--r--arch/um/Makefile-i3862
-rw-r--r--arch/um/include/common-offsets.h1
-rw-r--r--arch/um/include/um_uaccess.h7
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/os-Linux/Makefile3
-rw-r--r--arch/um/os-Linux/elf_aux.c3
-rw-r--r--arch/um/sys-i386/kernel-offsets.c1
-rw-r--r--arch/um/sys-x86_64/kernel-offsets.c1
-rw-r--r--arch/v850/kernel/time.c7
-rw-r--r--arch/x86_64/Kconfig11
-rw-r--r--arch/x86_64/boot/setup.S2
-rw-r--r--arch/x86_64/boot/tools/build.c4
-rw-r--r--arch/x86_64/defconfig4
-rw-r--r--arch/x86_64/ia32/ia32entry.S2
-rw-r--r--arch/x86_64/ia32/sys_ia32.c26
-rw-r--r--arch/x86_64/kernel/Makefile2
-rw-r--r--arch/x86_64/kernel/acpi/Makefile4
-rw-r--r--arch/x86_64/kernel/acpi/sleep.c17
-rw-r--r--arch/x86_64/kernel/e820.c2
-rw-r--r--arch/x86_64/kernel/entry.S12
-rw-r--r--arch/x86_64/kernel/genapic.c6
-rw-r--r--arch/x86_64/kernel/genapic_cluster.c6
-rw-r--r--arch/x86_64/kernel/io_apic.c116
-rw-r--r--arch/x86_64/kernel/kprobes.c41
-rw-r--r--arch/x86_64/kernel/mpparse.c14
-rw-r--r--arch/x86_64/kernel/nmi.c6
-rw-r--r--arch/x86_64/kernel/process.c1
-rw-r--r--arch/x86_64/kernel/setup.c10
-rw-r--r--arch/x86_64/kernel/setup64.c2
-rw-r--r--arch/x86_64/kernel/smpboot.c10
-rw-r--r--arch/x86_64/kernel/time.c8
-rw-r--r--arch/x86_64/kernel/traps.c14
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S1
-rw-r--r--arch/x86_64/mm/fault.c4
-rw-r--r--arch/x86_64/mm/numa.c6
-rw-r--r--arch/x86_64/pci/Makefile2
-rw-r--r--arch/x86_64/pci/Makefile-BUS2
-rw-r--r--arch/xtensa/kernel/time.c7
184 files changed, 3374 insertions, 2311 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 189d5eababa8..786491f9ceb2 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -479,6 +479,9 @@ config EISA
479 depends on ALPHA_GENERIC || ALPHA_JENSEN || ALPHA_ALCOR || ALPHA_MIKASA || ALPHA_SABLE || ALPHA_LYNX || ALPHA_NORITAKE || ALPHA_RAWHIDE 479 depends on ALPHA_GENERIC || ALPHA_JENSEN || ALPHA_ALCOR || ALPHA_MIKASA || ALPHA_SABLE || ALPHA_LYNX || ALPHA_NORITAKE || ALPHA_RAWHIDE
480 default y 480 default y
481 481
482config ARCH_MAY_HAVE_PC_FDC
483 def_bool y
484
482config SMP 485config SMP
483 bool "Symmetric multi-processing support" 486 bool "Symmetric multi-processing support"
484 depends on ALPHA_SABLE || ALPHA_LYNX || ALPHA_RAWHIDE || ALPHA_DP264 || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_GENERIC || ALPHA_SHARK || ALPHA_MARVEL 487 depends on ALPHA_SABLE || ALPHA_LYNX || ALPHA_RAWHIDE || ALPHA_DP264 || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_GENERIC || ALPHA_SHARK || ALPHA_MARVEL
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 8226c5cd788c..67be50b7d80a 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -149,7 +149,7 @@ irqreturn_t timer_interrupt(int irq, void *dev, struct pt_regs * regs)
149 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 149 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
150 * called as close as possible to 500 ms before the new second starts. 150 * called as close as possible to 500 ms before the new second starts.
151 */ 151 */
152 if ((time_status & STA_UNSYNC) == 0 152 if (ntp_synced()
153 && xtime.tv_sec > state.last_rtc_update + 660 153 && xtime.tv_sec > state.last_rtc_update + 660
154 && xtime.tv_nsec >= 500000 - ((unsigned) TICK_SIZE) / 2 154 && xtime.tv_nsec >= 500000 - ((unsigned) TICK_SIZE) / 2
155 && xtime.tv_nsec <= 500000 + ((unsigned) TICK_SIZE) / 2) { 155 && xtime.tv_nsec <= 500000 + ((unsigned) TICK_SIZE) / 2) {
@@ -502,10 +502,7 @@ do_settimeofday(struct timespec *tv)
502 set_normalized_timespec(&xtime, sec, nsec); 502 set_normalized_timespec(&xtime, sec, nsec);
503 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 503 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
504 504
505 time_adjust = 0; /* stop active adjtime() */ 505 ntp_clear();
506 time_status |= STA_UNSYNC;
507 time_maxerror = NTP_PHASE_LIMIT;
508 time_esterror = NTP_PHASE_LIMIT;
509 506
510 write_sequnlock_irq(&xtime_lock); 507 write_sequnlock_irq(&xtime_lock);
511 clock_was_set(); 508 clock_was_set();
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 68dfdba71d74..0f2899b4159d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -64,6 +64,9 @@ config GENERIC_CALIBRATE_DELAY
64config GENERIC_BUST_SPINLOCK 64config GENERIC_BUST_SPINLOCK
65 bool 65 bool
66 66
67config ARCH_MAY_HAVE_PC_FDC
68 bool
69
67config GENERIC_ISA_DMA 70config GENERIC_ISA_DMA
68 bool 71 bool
69 72
@@ -150,6 +153,7 @@ config ARCH_RPC
150 select ARCH_ACORN 153 select ARCH_ACORN
151 select FIQ 154 select FIQ
152 select TIMER_ACORN 155 select TIMER_ACORN
156 select ARCH_MAY_HAVE_PC_FDC
153 help 157 help
154 On the Acorn Risc-PC, Linux can support the internal IDE disk and 158 On the Acorn Risc-PC, Linux can support the internal IDE disk and
155 CD-ROM interface, serial and parallel port, and the floppy drive. 159 CD-ROM interface, serial and parallel port, and the floppy drive.
diff --git a/arch/arm/boot/compressed/head-sharpsl.S b/arch/arm/boot/compressed/head-sharpsl.S
index d6bf8a2b090d..59ad69640d6b 100644
--- a/arch/arm/boot/compressed/head-sharpsl.S
+++ b/arch/arm/boot/compressed/head-sharpsl.S
@@ -7,7 +7,8 @@
7 * so we have to figure out the machine for ourselves... 7 * so we have to figure out the machine for ourselves...
8 * 8 *
9 * Support for Poodle, Corgi (SL-C700), Shepherd (SL-C750) 9 * Support for Poodle, Corgi (SL-C700), Shepherd (SL-C750)
10 * and Husky (SL-C760). 10 * Husky (SL-C760), Tosa (SL-C6000), Spitz (SL-C3000),
11 * Akita (SL-C1000) and Borzoi (SL-C3100).
11 * 12 *
12 */ 13 */
13 14
@@ -23,6 +24,22 @@
23 24
24__SharpSL_start: 25__SharpSL_start:
25 26
27/* Check for TC6393 - if found we have a Tosa */
28 ldr r7, .TOSAID
29 mov r1, #0x10000000 @ Base address of TC6393 chip
30 mov r6, #0x03
31 ldrh r3, [r1, #8] @ Load TC6393XB Revison: This is 0x0003
32 cmp r6, r3
33 beq .SHARPEND @ Success -> tosa
34
35/* Check for pxa270 - if found, branch */
36 mrc p15, 0, r4, c0, c0 @ Get Processor ID
37 and r4, r4, #0xffffff00
38 ldr r3, .PXA270ID
39 cmp r4, r3
40 beq .PXA270
41
42/* Check for w100 - if not found we have a Poodle */
26 ldr r1, .W100ADDR @ Base address of w100 chip + regs offset 43 ldr r1, .W100ADDR @ Base address of w100 chip + regs offset
27 44
28 mov r6, #0x31 @ Load Magic Init value 45 mov r6, #0x31 @ Load Magic Init value
@@ -30,7 +47,7 @@ __SharpSL_start:
30 mov r5, #0x3000 47 mov r5, #0x3000
31.W100LOOP: 48.W100LOOP:
32 subs r5, r5, #1 49 subs r5, r5, #1
33 bne .W100LOOP 50 bne .W100LOOP
34 mov r6, #0x30 @ Load 2nd Magic Init value 51 mov r6, #0x30 @ Load 2nd Magic Init value
35 str r6, [r1, #0x280] @ to SCRATCH_UMSK 52 str r6, [r1, #0x280] @ to SCRATCH_UMSK
36 53
@@ -40,45 +57,52 @@ __SharpSL_start:
40 cmp r6, r3 57 cmp r6, r3
41 bne .SHARPEND @ We have no w100 - Poodle 58 bne .SHARPEND @ We have no w100 - Poodle
42 59
43 mrc p15, 0, r6, c0, c0 @ Get Processor ID 60/* Check for pxa250 - if found we have a Corgi */
44 and r6, r6, #0xffffff00
45 ldr r7, .CORGIID 61 ldr r7, .CORGIID
46 ldr r3, .PXA255ID 62 ldr r3, .PXA255ID
47 cmp r6, r3 63 cmp r4, r3
48 blo .SHARPEND @ We have a PXA250 - Corgi 64 blo .SHARPEND @ We have a PXA250 - Corgi
49 65
50 mov r1, #0x0c000000 @ Base address of NAND chip 66/* Check for 64MiB flash - if found we have a Shepherd */
51 ldrb r3, [r1, #24] @ Load FLASHCTL 67 bl get_flash_ids
52 bic r3, r3, #0x11 @ SET NCE
53 orr r3, r3, #0x0a @ SET CLR + FLWP
54 strb r3, [r1, #24] @ Save to FLASHCTL
55 mov r2, #0x90 @ Command "readid"
56 strb r2, [r1, #20] @ Save to FLASHIO
57 bic r3, r3, #2 @ CLR CLE
58 orr r3, r3, #4 @ SET ALE
59 strb r3, [r1, #24] @ Save to FLASHCTL
60 mov r2, #0 @ Address 0x00
61 strb r2, [r1, #20] @ Save to FLASHIO
62 bic r3, r3, #4 @ CLR ALE
63 strb r3, [r1, #24] @ Save to FLASHCTL
64.SHARP1:
65 ldrb r3, [r1, #24] @ Load FLASHCTL
66 tst r3, #32 @ Is chip ready?
67 beq .SHARP1
68 ldrb r2, [r1, #20] @ NAND Manufacturer ID
69 ldrb r3, [r1, #20] @ NAND Chip ID
70 ldr r7, .SHEPHERDID 68 ldr r7, .SHEPHERDID
71 cmp r3, #0x76 @ 64MiB flash 69 cmp r3, #0x76 @ 64MiB flash
72 beq .SHARPEND @ We have Shepherd 70 beq .SHARPEND @ We have Shepherd
71
72/* Must be a Husky */
73 ldr r7, .HUSKYID @ Must be Husky 73 ldr r7, .HUSKYID @ Must be Husky
74 b .SHARPEND 74 b .SHARPEND
75 75
76.PXA270:
77/* Check for 16MiB flash - if found we have Spitz */
78 bl get_flash_ids
79 ldr r7, .SPITZID
80 cmp r3, #0x73 @ 16MiB flash
81 beq .SHARPEND @ We have Spitz
82
83/* Check for a second SCOOP chip - if found we have Borzoi */
84 ldr r1, .SCOOP2ADDR
85 ldr r7, .BORZOIID
86 mov r6, #0x0140
87 strh r6, [r1]
88 ldrh r6, [r1]
89 cmp r6, #0x0140
90 beq .SHARPEND @ We have Borzoi
91
92/* Must be Akita */
93 ldr r7, .AKITAID
94 b .SHARPEND @ We have Borzoi
95
76.PXA255ID: 96.PXA255ID:
77 .word 0x69052d00 @ PXA255 Processor ID 97 .word 0x69052d00 @ PXA255 Processor ID
98.PXA270ID:
99 .word 0x69054100 @ PXA270 Processor ID
78.W100ID: 100.W100ID:
79 .word 0x57411002 @ w100 Chip ID 101 .word 0x57411002 @ w100 Chip ID
80.W100ADDR: 102.W100ADDR:
81 .word 0x08010000 @ w100 Chip ID Reg Address 103 .word 0x08010000 @ w100 Chip ID Reg Address
104.SCOOP2ADDR:
105 .word 0x08800040
82.POODLEID: 106.POODLEID:
83 .word MACH_TYPE_POODLE 107 .word MACH_TYPE_POODLE
84.CORGIID: 108.CORGIID:
@@ -87,6 +111,41 @@ __SharpSL_start:
87 .word MACH_TYPE_SHEPHERD 111 .word MACH_TYPE_SHEPHERD
88.HUSKYID: 112.HUSKYID:
89 .word MACH_TYPE_HUSKY 113 .word MACH_TYPE_HUSKY
90.SHARPEND: 114.TOSAID:
115 .word MACH_TYPE_TOSA
116.SPITZID:
117 .word MACH_TYPE_SPITZ
118.AKITAID:
119 .word MACH_TYPE_AKITA
120.BORZOIID:
121 .word MACH_TYPE_BORZOI
91 122
123/*
124 * Return: r2 - NAND Manufacturer ID
125 * r3 - NAND Chip ID
126 * Corrupts: r1
127 */
128get_flash_ids:
129 mov r1, #0x0c000000 @ Base address of NAND chip
130 ldrb r3, [r1, #24] @ Load FLASHCTL
131 bic r3, r3, #0x11 @ SET NCE
132 orr r3, r3, #0x0a @ SET CLR + FLWP
133 strb r3, [r1, #24] @ Save to FLASHCTL
134 mov r2, #0x90 @ Command "readid"
135 strb r2, [r1, #20] @ Save to FLASHIO
136 bic r3, r3, #2 @ CLR CLE
137 orr r3, r3, #4 @ SET ALE
138 strb r3, [r1, #24] @ Save to FLASHCTL
139 mov r2, #0 @ Address 0x00
140 strb r2, [r1, #20] @ Save to FLASHIO
141 bic r3, r3, #4 @ CLR ALE
142 strb r3, [r1, #24] @ Save to FLASHCTL
143.fids1:
144 ldrb r3, [r1, #24] @ Load FLASHCTL
145 tst r3, #32 @ Is chip ready?
146 beq .fids1
147 ldrb r2, [r1, #20] @ NAND Manufacturer ID
148 ldrb r3, [r1, #20] @ NAND Chip ID
149 mov pc, lr
92 150
151.SHARPEND:
diff --git a/arch/arm/configs/omap_h2_1610_defconfig b/arch/arm/configs/omap_h2_1610_defconfig
index 24955263b096..4198677cd394 100644
--- a/arch/arm/configs/omap_h2_1610_defconfig
+++ b/arch/arm/configs/omap_h2_1610_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.13-rc2 3# Linux kernel version: 2.6.13
4# Fri Jul 8 04:49:34 2005 4# Mon Sep 5 18:07:12 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -102,9 +102,11 @@ CONFIG_OMAP_MUX_WARNINGS=y
102# CONFIG_OMAP_MPU_TIMER is not set 102# CONFIG_OMAP_MPU_TIMER is not set
103CONFIG_OMAP_32K_TIMER=y 103CONFIG_OMAP_32K_TIMER=y
104CONFIG_OMAP_32K_TIMER_HZ=128 104CONFIG_OMAP_32K_TIMER_HZ=128
105# CONFIG_OMAP_DM_TIMER is not set
105CONFIG_OMAP_LL_DEBUG_UART1=y 106CONFIG_OMAP_LL_DEBUG_UART1=y
106# CONFIG_OMAP_LL_DEBUG_UART2 is not set 107# CONFIG_OMAP_LL_DEBUG_UART2 is not set
107# CONFIG_OMAP_LL_DEBUG_UART3 is not set 108# CONFIG_OMAP_LL_DEBUG_UART3 is not set
109CONFIG_OMAP_SERIAL_WAKE=y
108 110
109# 111#
110# OMAP Core Type 112# OMAP Core Type
@@ -166,7 +168,6 @@ CONFIG_ISA_DMA_API=y
166# 168#
167# Kernel Features 169# Kernel Features
168# 170#
169# CONFIG_SMP is not set
170CONFIG_PREEMPT=y 171CONFIG_PREEMPT=y
171CONFIG_NO_IDLE_HZ=y 172CONFIG_NO_IDLE_HZ=y
172# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 173# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
@@ -230,91 +231,82 @@ CONFIG_PM=y
230# CONFIG_APM is not set 231# CONFIG_APM is not set
231 232
232# 233#
233# Device Drivers 234# Networking
234#
235
236#
237# Generic Driver Options
238#
239CONFIG_STANDALONE=y
240CONFIG_PREVENT_FIRMWARE_BUILD=y
241# CONFIG_FW_LOADER is not set
242
243#
244# Memory Technology Devices (MTD)
245# 235#
246CONFIG_MTD=y 236CONFIG_NET=y
247CONFIG_MTD_DEBUG=y
248CONFIG_MTD_DEBUG_VERBOSE=3
249# CONFIG_MTD_CONCAT is not set
250CONFIG_MTD_PARTITIONS=y
251# CONFIG_MTD_REDBOOT_PARTS is not set
252CONFIG_MTD_CMDLINE_PARTS=y
253# CONFIG_MTD_AFS_PARTS is not set
254 237
255# 238#
256# User Modules And Translation Layers 239# Networking options
257# 240#
258CONFIG_MTD_CHAR=y 241CONFIG_PACKET=y
259CONFIG_MTD_BLOCK=y 242# CONFIG_PACKET_MMAP is not set
260# CONFIG_FTL is not set 243CONFIG_UNIX=y
261# CONFIG_NFTL is not set 244# CONFIG_NET_KEY is not set
262# CONFIG_INFTL is not set 245CONFIG_INET=y
246# CONFIG_IP_MULTICAST is not set
247# CONFIG_IP_ADVANCED_ROUTER is not set
248CONFIG_IP_FIB_HASH=y
249CONFIG_IP_PNP=y
250CONFIG_IP_PNP_DHCP=y
251CONFIG_IP_PNP_BOOTP=y
252# CONFIG_IP_PNP_RARP is not set
253# CONFIG_NET_IPIP is not set
254# CONFIG_NET_IPGRE is not set
255# CONFIG_ARPD is not set
256# CONFIG_SYN_COOKIES is not set
257# CONFIG_INET_AH is not set
258# CONFIG_INET_ESP is not set
259# CONFIG_INET_IPCOMP is not set
260# CONFIG_INET_TUNNEL is not set
261CONFIG_IP_TCPDIAG=y
262# CONFIG_IP_TCPDIAG_IPV6 is not set
263# CONFIG_TCP_CONG_ADVANCED is not set
264CONFIG_TCP_CONG_BIC=y
265# CONFIG_IPV6 is not set
266# CONFIG_NETFILTER is not set
263 267
264# 268#
265# RAM/ROM/Flash chip drivers 269# SCTP Configuration (EXPERIMENTAL)
266# 270#
267CONFIG_MTD_CFI=y 271# CONFIG_IP_SCTP is not set
268# CONFIG_MTD_JEDECPROBE is not set 272# CONFIG_ATM is not set
269CONFIG_MTD_GEN_PROBE=y 273# CONFIG_BRIDGE is not set
270# CONFIG_MTD_CFI_ADV_OPTIONS is not set 274# CONFIG_VLAN_8021Q is not set
271CONFIG_MTD_MAP_BANK_WIDTH_1=y 275# CONFIG_DECNET is not set
272CONFIG_MTD_MAP_BANK_WIDTH_2=y 276# CONFIG_LLC2 is not set
273CONFIG_MTD_MAP_BANK_WIDTH_4=y 277# CONFIG_IPX is not set
274# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set 278# CONFIG_ATALK is not set
275# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set 279# CONFIG_X25 is not set
276# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set 280# CONFIG_LAPB is not set
277CONFIG_MTD_CFI_I1=y 281# CONFIG_NET_DIVERT is not set
278CONFIG_MTD_CFI_I2=y 282# CONFIG_ECONET is not set
279# CONFIG_MTD_CFI_I4 is not set 283# CONFIG_WAN_ROUTER is not set
280# CONFIG_MTD_CFI_I8 is not set 284# CONFIG_NET_SCHED is not set
281CONFIG_MTD_CFI_INTELEXT=y 285# CONFIG_NET_CLS_ROUTE is not set
282# CONFIG_MTD_CFI_AMDSTD is not set
283# CONFIG_MTD_CFI_STAA is not set
284CONFIG_MTD_CFI_UTIL=y
285# CONFIG_MTD_RAM is not set
286# CONFIG_MTD_ROM is not set
287# CONFIG_MTD_ABSENT is not set
288# CONFIG_MTD_XIP is not set
289 286
290# 287#
291# Mapping drivers for chip access 288# Network testing
292# 289#
293# CONFIG_MTD_COMPLEX_MAPPINGS is not set 290# CONFIG_NET_PKTGEN is not set
294# CONFIG_MTD_PHYSMAP is not set 291# CONFIG_HAMRADIO is not set
295# CONFIG_MTD_ARM_INTEGRATOR is not set 292# CONFIG_IRDA is not set
296# CONFIG_MTD_EDB7312 is not set 293# CONFIG_BT is not set
297 294
298# 295#
299# Self-contained MTD device drivers 296# Device Drivers
300# 297#
301# CONFIG_MTD_SLRAM is not set
302# CONFIG_MTD_PHRAM is not set
303# CONFIG_MTD_MTDRAM is not set
304# CONFIG_MTD_BLKMTD is not set
305# CONFIG_MTD_BLOCK2MTD is not set
306 298
307# 299#
308# Disk-On-Chip Device Drivers 300# Generic Driver Options
309# 301#
310# CONFIG_MTD_DOC2000 is not set 302CONFIG_STANDALONE=y
311# CONFIG_MTD_DOC2001 is not set 303CONFIG_PREVENT_FIRMWARE_BUILD=y
312# CONFIG_MTD_DOC2001PLUS is not set 304# CONFIG_FW_LOADER is not set
313 305
314# 306#
315# NAND Flash Device Drivers 307# Memory Technology Devices (MTD)
316# 308#
317# CONFIG_MTD_NAND is not set 309# CONFIG_MTD is not set
318 310
319# 311#
320# Parallel port support 312# Parallel port support
@@ -403,72 +395,8 @@ CONFIG_SCSI_PROC_FS=y
403# 395#
404 396
405# 397#
406# Networking support 398# Network device support
407#
408CONFIG_NET=y
409
410#
411# Networking options
412#
413CONFIG_PACKET=y
414# CONFIG_PACKET_MMAP is not set
415CONFIG_UNIX=y
416# CONFIG_NET_KEY is not set
417CONFIG_INET=y
418# CONFIG_IP_MULTICAST is not set
419# CONFIG_IP_ADVANCED_ROUTER is not set
420CONFIG_IP_FIB_HASH=y
421CONFIG_IP_PNP=y
422CONFIG_IP_PNP_DHCP=y
423CONFIG_IP_PNP_BOOTP=y
424# CONFIG_IP_PNP_RARP is not set
425# CONFIG_NET_IPIP is not set
426# CONFIG_NET_IPGRE is not set
427# CONFIG_ARPD is not set
428# CONFIG_SYN_COOKIES is not set
429# CONFIG_INET_AH is not set
430# CONFIG_INET_ESP is not set
431# CONFIG_INET_IPCOMP is not set
432# CONFIG_INET_TUNNEL is not set
433CONFIG_IP_TCPDIAG=y
434# CONFIG_IP_TCPDIAG_IPV6 is not set
435# CONFIG_TCP_CONG_ADVANCED is not set
436CONFIG_TCP_CONG_BIC=y
437# CONFIG_IPV6 is not set
438# CONFIG_NETFILTER is not set
439
440#
441# SCTP Configuration (EXPERIMENTAL)
442# 399#
443# CONFIG_IP_SCTP is not set
444# CONFIG_ATM is not set
445# CONFIG_BRIDGE is not set
446# CONFIG_VLAN_8021Q is not set
447# CONFIG_DECNET is not set
448# CONFIG_LLC2 is not set
449# CONFIG_IPX is not set
450# CONFIG_ATALK is not set
451# CONFIG_X25 is not set
452# CONFIG_LAPB is not set
453# CONFIG_NET_DIVERT is not set
454# CONFIG_ECONET is not set
455# CONFIG_WAN_ROUTER is not set
456
457#
458# QoS and/or fair queueing
459#
460# CONFIG_NET_SCHED is not set
461# CONFIG_NET_CLS_ROUTE is not set
462
463#
464# Network testing
465#
466# CONFIG_NET_PKTGEN is not set
467# CONFIG_NETPOLL is not set
468# CONFIG_NET_POLL_CONTROLLER is not set
469# CONFIG_HAMRADIO is not set
470# CONFIG_IRDA is not set
471# CONFIG_BT is not set
472CONFIG_NETDEVICES=y 400CONFIG_NETDEVICES=y
473# CONFIG_DUMMY is not set 401# CONFIG_DUMMY is not set
474# CONFIG_BONDING is not set 402# CONFIG_BONDING is not set
@@ -518,6 +446,8 @@ CONFIG_SLIP_COMPRESSED=y
518# CONFIG_SLIP_MODE_SLIP6 is not set 446# CONFIG_SLIP_MODE_SLIP6 is not set
519# CONFIG_SHAPER is not set 447# CONFIG_SHAPER is not set
520# CONFIG_NETCONSOLE is not set 448# CONFIG_NETCONSOLE is not set
449# CONFIG_NETPOLL is not set
450# CONFIG_NET_POLL_CONTROLLER is not set
521 451
522# 452#
523# ISDN subsystem 453# ISDN subsystem
@@ -615,77 +545,15 @@ CONFIG_WATCHDOG_NOWAYOUT=y
615# 545#
616# I2C support 546# I2C support
617# 547#
618CONFIG_I2C=y 548# CONFIG_I2C is not set
619CONFIG_I2C_CHARDEV=y 549# CONFIG_I2C_SENSOR is not set
620 550CONFIG_ISP1301_OMAP=y
621#
622# I2C Algorithms
623#
624# CONFIG_I2C_ALGOBIT is not set
625# CONFIG_I2C_ALGOPCF is not set
626# CONFIG_I2C_ALGOPCA is not set
627
628#
629# I2C Hardware Bus support
630#
631# CONFIG_I2C_ISA is not set
632# CONFIG_I2C_PARPORT_LIGHT is not set
633# CONFIG_I2C_STUB is not set
634# CONFIG_I2C_PCA_ISA is not set
635 551
636# 552#
637# Hardware Sensors Chip support 553# Hardware Monitoring support
638# 554#
639# CONFIG_I2C_SENSOR is not set 555CONFIG_HWMON=y
640# CONFIG_SENSORS_ADM1021 is not set 556# CONFIG_HWMON_DEBUG_CHIP is not set
641# CONFIG_SENSORS_ADM1025 is not set
642# CONFIG_SENSORS_ADM1026 is not set
643# CONFIG_SENSORS_ADM1031 is not set
644# CONFIG_SENSORS_ADM9240 is not set
645# CONFIG_SENSORS_ASB100 is not set
646# CONFIG_SENSORS_ATXP1 is not set
647# CONFIG_SENSORS_DS1621 is not set
648# CONFIG_SENSORS_FSCHER is not set
649# CONFIG_SENSORS_FSCPOS is not set
650# CONFIG_SENSORS_GL518SM is not set
651# CONFIG_SENSORS_GL520SM is not set
652# CONFIG_SENSORS_IT87 is not set
653# CONFIG_SENSORS_LM63 is not set
654# CONFIG_SENSORS_LM75 is not set
655# CONFIG_SENSORS_LM77 is not set
656# CONFIG_SENSORS_LM78 is not set
657# CONFIG_SENSORS_LM80 is not set
658# CONFIG_SENSORS_LM83 is not set
659# CONFIG_SENSORS_LM85 is not set
660# CONFIG_SENSORS_LM87 is not set
661# CONFIG_SENSORS_LM90 is not set
662# CONFIG_SENSORS_LM92 is not set
663# CONFIG_SENSORS_MAX1619 is not set
664# CONFIG_SENSORS_PC87360 is not set
665# CONFIG_SENSORS_SMSC47B397 is not set
666# CONFIG_SENSORS_SMSC47M1 is not set
667# CONFIG_SENSORS_W83781D is not set
668# CONFIG_SENSORS_W83L785TS is not set
669# CONFIG_SENSORS_W83627HF is not set
670# CONFIG_SENSORS_W83627EHF is not set
671
672#
673# Other I2C Chip support
674#
675# CONFIG_SENSORS_DS1337 is not set
676# CONFIG_SENSORS_DS1374 is not set
677# CONFIG_SENSORS_EEPROM is not set
678# CONFIG_SENSORS_PCF8574 is not set
679# CONFIG_SENSORS_PCA9539 is not set
680# CONFIG_SENSORS_PCF8591 is not set
681# CONFIG_SENSORS_RTC8564 is not set
682CONFIG_ISP1301_OMAP=y
683CONFIG_TPS65010=y
684# CONFIG_SENSORS_MAX6875 is not set
685# CONFIG_I2C_DEBUG_CORE is not set
686# CONFIG_I2C_DEBUG_ALGO is not set
687# CONFIG_I2C_DEBUG_BUS is not set
688# CONFIG_I2C_DEBUG_CHIP is not set
689 557
690# 558#
691# Misc devices 559# Misc devices
@@ -756,15 +624,9 @@ CONFIG_SOUND=y
756# Open Sound System 624# Open Sound System
757# 625#
758CONFIG_SOUND_PRIME=y 626CONFIG_SOUND_PRIME=y
759# CONFIG_SOUND_BT878 is not set
760# CONFIG_SOUND_FUSION is not set
761# CONFIG_SOUND_CS4281 is not set
762# CONFIG_SOUND_SONICVIBES is not set
763# CONFIG_SOUND_TRIDENT is not set
764# CONFIG_SOUND_MSNDCLAS is not set 627# CONFIG_SOUND_MSNDCLAS is not set
765# CONFIG_SOUND_MSNDPIN is not set 628# CONFIG_SOUND_MSNDPIN is not set
766# CONFIG_SOUND_OSS is not set 629# CONFIG_SOUND_OSS is not set
767# CONFIG_SOUND_TVMIXER is not set
768# CONFIG_SOUND_AD1980 is not set 630# CONFIG_SOUND_AD1980 is not set
769 631
770# 632#
@@ -810,6 +672,7 @@ CONFIG_EXT2_FS=y
810# CONFIG_JBD is not set 672# CONFIG_JBD is not set
811# CONFIG_REISERFS_FS is not set 673# CONFIG_REISERFS_FS is not set
812# CONFIG_JFS_FS is not set 674# CONFIG_JFS_FS is not set
675# CONFIG_FS_POSIX_ACL is not set
813 676
814# 677#
815# XFS support 678# XFS support
@@ -817,6 +680,7 @@ CONFIG_EXT2_FS=y
817# CONFIG_XFS_FS is not set 680# CONFIG_XFS_FS is not set
818# CONFIG_MINIX_FS is not set 681# CONFIG_MINIX_FS is not set
819CONFIG_ROMFS_FS=y 682CONFIG_ROMFS_FS=y
683CONFIG_INOTIFY=y
820# CONFIG_QUOTA is not set 684# CONFIG_QUOTA is not set
821CONFIG_DNOTIFY=y 685CONFIG_DNOTIFY=y
822# CONFIG_AUTOFS_FS is not set 686# CONFIG_AUTOFS_FS is not set
@@ -857,15 +721,6 @@ CONFIG_RAMFS=y
857# CONFIG_BEFS_FS is not set 721# CONFIG_BEFS_FS is not set
858# CONFIG_BFS_FS is not set 722# CONFIG_BFS_FS is not set
859# CONFIG_EFS_FS is not set 723# CONFIG_EFS_FS is not set
860# CONFIG_JFFS_FS is not set
861CONFIG_JFFS2_FS=y
862CONFIG_JFFS2_FS_DEBUG=2
863# CONFIG_JFFS2_FS_NAND is not set
864# CONFIG_JFFS2_FS_NOR_ECC is not set
865# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
866CONFIG_JFFS2_ZLIB=y
867CONFIG_JFFS2_RTIME=y
868# CONFIG_JFFS2_RUBIN is not set
869CONFIG_CRAMFS=y 724CONFIG_CRAMFS=y
870# CONFIG_VXFS_FS is not set 725# CONFIG_VXFS_FS is not set
871# CONFIG_HPFS_FS is not set 726# CONFIG_HPFS_FS is not set
@@ -1007,4 +862,3 @@ CONFIG_CRYPTO_DES=y
1007CONFIG_CRC32=y 862CONFIG_CRC32=y
1008# CONFIG_LIBCRC32C is not set 863# CONFIG_LIBCRC32C is not set
1009CONFIG_ZLIB_INFLATE=y 864CONFIG_ZLIB_INFLATE=y
1010CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 8880482dcbff..69449a818dcc 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -102,7 +102,7 @@ static unsigned long next_rtc_update;
102 */ 102 */
103static inline void do_set_rtc(void) 103static inline void do_set_rtc(void)
104{ 104{
105 if (time_status & STA_UNSYNC || set_rtc == NULL) 105 if (!ntp_synced() || set_rtc == NULL)
106 return; 106 return;
107 107
108 if (next_rtc_update && 108 if (next_rtc_update &&
@@ -292,10 +292,7 @@ int do_settimeofday(struct timespec *tv)
292 set_normalized_timespec(&xtime, sec, nsec); 292 set_normalized_timespec(&xtime, sec, nsec);
293 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 293 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
294 294
295 time_adjust = 0; /* stop active adjtime() */ 295 ntp_clear();
296 time_status |= STA_UNSYNC;
297 time_maxerror = NTP_PHASE_LIMIT;
298 time_esterror = NTP_PHASE_LIMIT;
299 write_sequnlock_irq(&xtime_lock); 296 write_sequnlock_irq(&xtime_lock);
300 clock_was_set(); 297 clock_was_set();
301 return 0; 298 return 0;
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig
index 324d9edeec38..bdd257921cfb 100644
--- a/arch/arm/mach-footbridge/Kconfig
+++ b/arch/arm/mach-footbridge/Kconfig
@@ -87,6 +87,7 @@ config FOOTBRIDGE_ADDIN
87 87
88# EBSA285 board in either host or addin mode 88# EBSA285 board in either host or addin mode
89config ARCH_EBSA285 89config ARCH_EBSA285
90 select ARCH_MAY_HAVE_PC_FDC
90 bool 91 bool
91 92
92endif 93endif
diff --git a/arch/arm/mach-iop3xx/iop321-time.c b/arch/arm/mach-iop3xx/iop321-time.c
index d53af1669502..0039793b694a 100644
--- a/arch/arm/mach-iop3xx/iop321-time.c
+++ b/arch/arm/mach-iop3xx/iop321-time.c
@@ -60,7 +60,7 @@ static unsigned long iop321_gettimeoffset(void)
60 /* 60 /*
61 * Now convert them to usec. 61 * Now convert them to usec.
62 */ 62 */
63 usec = (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH; 63 usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));
64 64
65 return usec; 65 return usec;
66} 66}
diff --git a/arch/arm/mach-iop3xx/iop331-time.c b/arch/arm/mach-iop3xx/iop331-time.c
index 1a6d9d661e4b..8eddfac7e2b0 100644
--- a/arch/arm/mach-iop3xx/iop331-time.c
+++ b/arch/arm/mach-iop3xx/iop331-time.c
@@ -58,7 +58,7 @@ static unsigned long iop331_gettimeoffset(void)
58 /* 58 /*
59 * Now convert them to usec. 59 * Now convert them to usec.
60 */ 60 */
61 usec = (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH; 61 usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));
62 62
63 return usec; 63 return usec;
64} 64}
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 781d10ae00b7..098c817a7fb8 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -382,7 +382,7 @@ static void ixp2000_GPIO_irq_unmask(unsigned int irq)
382static struct irqchip ixp2000_GPIO_irq_chip = { 382static struct irqchip ixp2000_GPIO_irq_chip = {
383 .ack = ixp2000_GPIO_irq_mask_ack, 383 .ack = ixp2000_GPIO_irq_mask_ack,
384 .mask = ixp2000_GPIO_irq_mask, 384 .mask = ixp2000_GPIO_irq_mask,
385 .unmask = ixp2000_GPIO_irq_unmask 385 .unmask = ixp2000_GPIO_irq_unmask,
386 .set_type = ixp2000_GPIO_irq_type, 386 .set_type = ixp2000_GPIO_irq_type,
387}; 387};
388 388
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 0422e906cc9a..52ad11328e96 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -179,17 +179,17 @@ static void ixp4xx_irq_level_unmask(unsigned int irq)
179} 179}
180 180
181static struct irqchip ixp4xx_irq_level_chip = { 181static struct irqchip ixp4xx_irq_level_chip = {
182 .ack = ixp4xx_irq_mask, 182 .ack = ixp4xx_irq_mask,
183 .mask = ixp4xx_irq_mask, 183 .mask = ixp4xx_irq_mask,
184 .unmask = ixp4xx_irq_level_unmask, 184 .unmask = ixp4xx_irq_level_unmask,
185 .type = ixp4xx_set_irq_type 185 .set_type = ixp4xx_set_irq_type,
186}; 186};
187 187
188static struct irqchip ixp4xx_irq_edge_chip = { 188static struct irqchip ixp4xx_irq_edge_chip = {
189 .ack = ixp4xx_irq_ack, 189 .ack = ixp4xx_irq_ack,
190 .mask = ixp4xx_irq_mask, 190 .mask = ixp4xx_irq_mask,
191 .unmask = ixp4xx_irq_unmask, 191 .unmask = ixp4xx_irq_unmask,
192 .type = ixp4xx_set_irq_type 192 .set_type = ixp4xx_set_irq_type,
193}; 193};
194 194
195static void ixp4xx_config_irq(unsigned irq, enum ixp4xx_irq_type type) 195static void ixp4xx_config_irq(unsigned irq, enum ixp4xx_irq_type type)
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index a11b6d807352..afd5d67e4ae7 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -165,10 +165,10 @@ static struct omap_irq_bank omap1610_irq_banks[] = {
165#endif 165#endif
166 166
167static struct irqchip omap_irq_chip = { 167static struct irqchip omap_irq_chip = {
168 .ack = omap_mask_ack_irq, 168 .ack = omap_mask_ack_irq,
169 .mask = omap_mask_irq, 169 .mask = omap_mask_irq,
170 .unmask = omap_unmask_irq, 170 .unmask = omap_unmask_irq,
171 .wake = omap_wake_irq, 171 .set_wake = omap_wake_irq,
172}; 172};
173 173
174void __init omap_init_irq(void) 174void __init omap_init_irq(void)
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index efc2f657184e..33dae99ec2d8 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_PXA27x) += pxa27x.o
11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
12obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 12obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
13obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 13obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
14obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o ssp.o 14obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o ssp.o
15obj-$(CONFIG_MACH_POODLE) += poodle.o 15obj-$(CONFIG_MACH_POODLE) += poodle.o
16 16
17# Support for blinky lights 17# Support for blinky lights
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 06ea730e8675..29185acdd9e1 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -39,7 +39,6 @@
39 39
40#include <asm/mach/sharpsl_param.h> 40#include <asm/mach/sharpsl_param.h>
41#include <asm/hardware/scoop.h> 41#include <asm/hardware/scoop.h>
42#include <video/w100fb.h>
43 42
44#include "generic.h" 43#include "generic.h"
45 44
@@ -87,7 +86,7 @@ struct platform_device corgiscoop_device = {
87 * also use scoop functions and this makes the power up/down order 86 * also use scoop functions and this makes the power up/down order
88 * work correctly. 87 * work correctly.
89 */ 88 */
90static struct platform_device corgissp_device = { 89struct platform_device corgissp_device = {
91 .name = "corgi-ssp", 90 .name = "corgi-ssp",
92 .dev = { 91 .dev = {
93 .parent = &corgiscoop_device.dev, 92 .parent = &corgiscoop_device.dev,
@@ -97,41 +96,33 @@ static struct platform_device corgissp_device = {
97 96
98 97
99/* 98/*
100 * Corgi w100 Frame Buffer Device 99 * Corgi Backlight Device
101 */ 100 */
102static struct w100fb_mach_info corgi_fb_info = { 101static struct platform_device corgibl_device = {
103 .w100fb_ssp_send = corgi_ssp_lcdtg_send, 102 .name = "corgi-bl",
104 .comadj = -1, 103 .dev = {
105 .phadadj = -1, 104 .parent = &corgifb_device.dev,
106};
107
108static struct resource corgi_fb_resources[] = {
109 [0] = {
110 .start = 0x08000000,
111 .end = 0x08ffffff,
112 .flags = IORESOURCE_MEM,
113 }, 105 },
106 .id = -1,
114}; 107};
115 108
116static struct platform_device corgifb_device = { 109
117 .name = "w100fb", 110/*
111 * Corgi Keyboard Device
112 */
113static struct platform_device corgikbd_device = {
114 .name = "corgi-keyboard",
118 .id = -1, 115 .id = -1,
119 .dev = {
120 .platform_data = &corgi_fb_info,
121 .parent = &corgissp_device.dev,
122 },
123 .num_resources = ARRAY_SIZE(corgi_fb_resources),
124 .resource = corgi_fb_resources,
125}; 116};
126 117
127 118
128/* 119/*
129 * Corgi Backlight Device 120 * Corgi Touch Screen Device
130 */ 121 */
131static struct platform_device corgibl_device = { 122static struct platform_device corgits_device = {
132 .name = "corgi-bl", 123 .name = "corgi-ts",
133 .dev = { 124 .dev = {
134 .parent = &corgifb_device.dev, 125 .parent = &corgissp_device.dev,
135 }, 126 },
136 .id = -1, 127 .id = -1,
137}; 128};
@@ -199,6 +190,11 @@ static void corgi_mci_setpower(struct device *dev, unsigned int vdd)
199 } 190 }
200} 191}
201 192
193static int corgi_mci_get_ro(struct device *dev)
194{
195 return GPLR(CORGI_GPIO_nSD_WP) & GPIO_bit(CORGI_GPIO_nSD_WP);
196}
197
202static void corgi_mci_exit(struct device *dev, void *data) 198static void corgi_mci_exit(struct device *dev, void *data)
203{ 199{
204 free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data); 200 free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data);
@@ -208,11 +204,13 @@ static void corgi_mci_exit(struct device *dev, void *data)
208static struct pxamci_platform_data corgi_mci_platform_data = { 204static struct pxamci_platform_data corgi_mci_platform_data = {
209 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 205 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
210 .init = corgi_mci_init, 206 .init = corgi_mci_init,
207 .get_ro = corgi_mci_get_ro,
211 .setpower = corgi_mci_setpower, 208 .setpower = corgi_mci_setpower,
212 .exit = corgi_mci_exit, 209 .exit = corgi_mci_exit,
213}; 210};
214 211
215 212
213
216/* 214/*
217 * USB Device Controller 215 * USB Device Controller
218 */ 216 */
@@ -238,14 +236,13 @@ static struct platform_device *devices[] __initdata = {
238 &corgiscoop_device, 236 &corgiscoop_device,
239 &corgissp_device, 237 &corgissp_device,
240 &corgifb_device, 238 &corgifb_device,
239 &corgikbd_device,
241 &corgibl_device, 240 &corgibl_device,
241 &corgits_device,
242}; 242};
243 243
244static void __init corgi_init(void) 244static void __init corgi_init(void)
245{ 245{
246 corgi_fb_info.comadj=sharpsl_param.comadj;
247 corgi_fb_info.phadadj=sharpsl_param.phadadj;
248
249 pxa_gpio_mode(CORGI_GPIO_USB_PULLUP | GPIO_OUT); 246 pxa_gpio_mode(CORGI_GPIO_USB_PULLUP | GPIO_OUT);
250 pxa_set_udc_info(&udc_info); 247 pxa_set_udc_info(&udc_info);
251 pxa_set_mci_info(&corgi_mci_platform_data); 248 pxa_set_mci_info(&corgi_mci_platform_data);
diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c
new file mode 100644
index 000000000000..deac29c00290
--- /dev/null
+++ b/arch/arm/mach-pxa/corgi_lcd.c
@@ -0,0 +1,396 @@
1/*
2 * linux/drivers/video/w100fb.c
3 *
4 * Corgi LCD Specific Code for ATI Imageon w100 (Wallaby)
5 *
6 * Copyright (C) 2005 Richard Purdie
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <linux/delay.h>
15#include <linux/kernel.h>
16#include <linux/device.h>
17#include <asm/arch/corgi.h>
18#include <asm/mach/sharpsl_param.h>
19#include <video/w100fb.h>
20
21/* Register Addresses */
22#define RESCTL_ADRS 0x00
23#define PHACTRL_ADRS 0x01
24#define DUTYCTRL_ADRS 0x02
25#define POWERREG0_ADRS 0x03
26#define POWERREG1_ADRS 0x04
27#define GPOR3_ADRS 0x05
28#define PICTRL_ADRS 0x06
29#define POLCTRL_ADRS 0x07
30
31/* Resgister Bit Definitions */
32#define RESCTL_QVGA 0x01
33#define RESCTL_VGA 0x00
34
35#define POWER1_VW_ON 0x01 /* VW Supply FET ON */
36#define POWER1_GVSS_ON 0x02 /* GVSS(-8V) Power Supply ON */
37#define POWER1_VDD_ON 0x04 /* VDD(8V),SVSS(-4V) Power Supply ON */
38
39#define POWER1_VW_OFF 0x00 /* VW Supply FET OFF */
40#define POWER1_GVSS_OFF 0x00 /* GVSS(-8V) Power Supply OFF */
41#define POWER1_VDD_OFF 0x00 /* VDD(8V),SVSS(-4V) Power Supply OFF */
42
43#define POWER0_COM_DCLK 0x01 /* COM Voltage DC Bias DAC Serial Data Clock */
44#define POWER0_COM_DOUT 0x02 /* COM Voltage DC Bias DAC Serial Data Out */
45#define POWER0_DAC_ON 0x04 /* DAC Power Supply ON */
46#define POWER0_COM_ON 0x08 /* COM Powewr Supply ON */
47#define POWER0_VCC5_ON 0x10 /* VCC5 Power Supply ON */
48
49#define POWER0_DAC_OFF 0x00 /* DAC Power Supply OFF */
50#define POWER0_COM_OFF 0x00 /* COM Powewr Supply OFF */
51#define POWER0_VCC5_OFF 0x00 /* VCC5 Power Supply OFF */
52
53#define PICTRL_INIT_STATE 0x01
54#define PICTRL_INIOFF 0x02
55#define PICTRL_POWER_DOWN 0x04
56#define PICTRL_COM_SIGNAL_OFF 0x08
57#define PICTRL_DAC_SIGNAL_OFF 0x10
58
59#define POLCTRL_SYNC_POL_FALL 0x01
60#define POLCTRL_EN_POL_FALL 0x02
61#define POLCTRL_DATA_POL_FALL 0x04
62#define POLCTRL_SYNC_ACT_H 0x08
63#define POLCTRL_EN_ACT_L 0x10
64
65#define POLCTRL_SYNC_POL_RISE 0x00
66#define POLCTRL_EN_POL_RISE 0x00
67#define POLCTRL_DATA_POL_RISE 0x00
68#define POLCTRL_SYNC_ACT_L 0x00
69#define POLCTRL_EN_ACT_H 0x00
70
71#define PHACTRL_PHASE_MANUAL 0x01
72#define DEFAULT_PHAD_QVGA (9)
73#define DEFAULT_COMADJ (125)
74
75/*
76 * This is only a psuedo I2C interface. We can't use the standard kernel
77 * routines as the interface is write only. We just assume the data is acked...
78 */
79static void lcdtg_ssp_i2c_send(u8 data)
80{
81 corgi_ssp_lcdtg_send(POWERREG0_ADRS, data);
82 udelay(10);
83}
84
85static void lcdtg_i2c_send_bit(u8 data)
86{
87 lcdtg_ssp_i2c_send(data);
88 lcdtg_ssp_i2c_send(data | POWER0_COM_DCLK);
89 lcdtg_ssp_i2c_send(data);
90}
91
92static void lcdtg_i2c_send_start(u8 base)
93{
94 lcdtg_ssp_i2c_send(base | POWER0_COM_DCLK | POWER0_COM_DOUT);
95 lcdtg_ssp_i2c_send(base | POWER0_COM_DCLK);
96 lcdtg_ssp_i2c_send(base);
97}
98
99static void lcdtg_i2c_send_stop(u8 base)
100{
101 lcdtg_ssp_i2c_send(base);
102 lcdtg_ssp_i2c_send(base | POWER0_COM_DCLK);
103 lcdtg_ssp_i2c_send(base | POWER0_COM_DCLK | POWER0_COM_DOUT);
104}
105
106static void lcdtg_i2c_send_byte(u8 base, u8 data)
107{
108 int i;
109 for (i = 0; i < 8; i++) {
110 if (data & 0x80)
111 lcdtg_i2c_send_bit(base | POWER0_COM_DOUT);
112 else
113 lcdtg_i2c_send_bit(base);
114 data <<= 1;
115 }
116}
117
118static void lcdtg_i2c_wait_ack(u8 base)
119{
120 lcdtg_i2c_send_bit(base);
121}
122
123static void lcdtg_set_common_voltage(u8 base_data, u8 data)
124{
125 /* Set Common Voltage to M62332FP via I2C */
126 lcdtg_i2c_send_start(base_data);
127 lcdtg_i2c_send_byte(base_data, 0x9c);
128 lcdtg_i2c_wait_ack(base_data);
129 lcdtg_i2c_send_byte(base_data, 0x00);
130 lcdtg_i2c_wait_ack(base_data);
131 lcdtg_i2c_send_byte(base_data, data);
132 lcdtg_i2c_wait_ack(base_data);
133 lcdtg_i2c_send_stop(base_data);
134}
135
136/* Set Phase Adjuct */
137static void lcdtg_set_phadadj(struct w100fb_par *par)
138{
139 int adj;
140 switch(par->xres) {
141 case 480:
142 case 640:
143 /* Setting for VGA */
144 adj = sharpsl_param.phadadj;
145 if (adj < 0) {
146 adj = PHACTRL_PHASE_MANUAL;
147 } else {
148 adj = ((adj & 0x0f) << 1) | PHACTRL_PHASE_MANUAL;
149 }
150 break;
151 case 240:
152 case 320:
153 default:
154 /* Setting for QVGA */
155 adj = (DEFAULT_PHAD_QVGA << 1) | PHACTRL_PHASE_MANUAL;
156 break;
157 }
158
159 corgi_ssp_lcdtg_send(PHACTRL_ADRS, adj);
160}
161
162static int lcd_inited;
163
164static void lcdtg_hw_init(struct w100fb_par *par)
165{
166 if (!lcd_inited) {
167 int comadj;
168
169 /* Initialize Internal Logic & Port */
170 corgi_ssp_lcdtg_send(PICTRL_ADRS, PICTRL_POWER_DOWN | PICTRL_INIOFF | PICTRL_INIT_STATE
171 | PICTRL_COM_SIGNAL_OFF | PICTRL_DAC_SIGNAL_OFF);
172
173 corgi_ssp_lcdtg_send(POWERREG0_ADRS, POWER0_COM_DCLK | POWER0_COM_DOUT | POWER0_DAC_OFF
174 | POWER0_COM_OFF | POWER0_VCC5_OFF);
175
176 corgi_ssp_lcdtg_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_OFF);
177
178 /* VDD(+8V), SVSS(-4V) ON */
179 corgi_ssp_lcdtg_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_ON);
180 mdelay(3);
181
182 /* DAC ON */
183 corgi_ssp_lcdtg_send(POWERREG0_ADRS, POWER0_COM_DCLK | POWER0_COM_DOUT | POWER0_DAC_ON
184 | POWER0_COM_OFF | POWER0_VCC5_OFF);
185
186 /* INIB = H, INI = L */
187 /* PICTL[0] = H , PICTL[1] = PICTL[2] = PICTL[4] = L */
188 corgi_ssp_lcdtg_send(PICTRL_ADRS, PICTRL_INIT_STATE | PICTRL_COM_SIGNAL_OFF);
189
190 /* Set Common Voltage */
191 comadj = sharpsl_param.comadj;
192 if (comadj < 0)
193 comadj = DEFAULT_COMADJ;
194 lcdtg_set_common_voltage((POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_OFF), comadj);
195
196 /* VCC5 ON, DAC ON */
197 corgi_ssp_lcdtg_send(POWERREG0_ADRS, POWER0_COM_DCLK | POWER0_COM_DOUT | POWER0_DAC_ON |
198 POWER0_COM_OFF | POWER0_VCC5_ON);
199
200 /* GVSS(-8V) ON, VDD ON */
201 corgi_ssp_lcdtg_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_ON | POWER1_VDD_ON);
202 mdelay(2);
203
204 /* COM SIGNAL ON (PICTL[3] = L) */
205 corgi_ssp_lcdtg_send(PICTRL_ADRS, PICTRL_INIT_STATE);
206
207 /* COM ON, DAC ON, VCC5_ON */
208 corgi_ssp_lcdtg_send(POWERREG0_ADRS, POWER0_COM_DCLK | POWER0_COM_DOUT | POWER0_DAC_ON
209 | POWER0_COM_ON | POWER0_VCC5_ON);
210
211 /* VW ON, GVSS ON, VDD ON */
212 corgi_ssp_lcdtg_send(POWERREG1_ADRS, POWER1_VW_ON | POWER1_GVSS_ON | POWER1_VDD_ON);
213
214 /* Signals output enable */
215 corgi_ssp_lcdtg_send(PICTRL_ADRS, 0);
216
217 /* Set Phase Adjuct */
218 lcdtg_set_phadadj(par);
219
220 /* Initialize for Input Signals from ATI */
221 corgi_ssp_lcdtg_send(POLCTRL_ADRS, POLCTRL_SYNC_POL_RISE | POLCTRL_EN_POL_RISE
222 | POLCTRL_DATA_POL_RISE | POLCTRL_SYNC_ACT_L | POLCTRL_EN_ACT_H);
223 udelay(1000);
224
225 lcd_inited=1;
226 } else {
227 lcdtg_set_phadadj(par);
228 }
229
230 switch(par->xres) {
231 case 480:
232 case 640:
233 /* Set Lcd Resolution (VGA) */
234 corgi_ssp_lcdtg_send(RESCTL_ADRS, RESCTL_VGA);
235 break;
236 case 240:
237 case 320:
238 default:
239 /* Set Lcd Resolution (QVGA) */
240 corgi_ssp_lcdtg_send(RESCTL_ADRS, RESCTL_QVGA);
241 break;
242 }
243}
244
245static void lcdtg_suspend(struct w100fb_par *par)
246{
247 /* 60Hz x 2 frame = 16.7msec x 2 = 33.4 msec */
248 mdelay(34);
249
250 /* (1)VW OFF */
251 corgi_ssp_lcdtg_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_ON | POWER1_VDD_ON);
252
253 /* (2)COM OFF */
254 corgi_ssp_lcdtg_send(PICTRL_ADRS, PICTRL_COM_SIGNAL_OFF);
255 corgi_ssp_lcdtg_send(POWERREG0_ADRS, POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_ON);
256
257 /* (3)Set Common Voltage Bias 0V */
258 lcdtg_set_common_voltage(POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_ON, 0);
259
260 /* (4)GVSS OFF */
261 corgi_ssp_lcdtg_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_ON);
262
263 /* (5)VCC5 OFF */
264 corgi_ssp_lcdtg_send(POWERREG0_ADRS, POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_OFF);
265
266 /* (6)Set PDWN, INIOFF, DACOFF */
267 corgi_ssp_lcdtg_send(PICTRL_ADRS, PICTRL_INIOFF | PICTRL_DAC_SIGNAL_OFF |
268 PICTRL_POWER_DOWN | PICTRL_COM_SIGNAL_OFF);
269
270 /* (7)DAC OFF */
271 corgi_ssp_lcdtg_send(POWERREG0_ADRS, POWER0_DAC_OFF | POWER0_COM_OFF | POWER0_VCC5_OFF);
272
273 /* (8)VDD OFF */
274 corgi_ssp_lcdtg_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_OFF);
275
276 lcd_inited = 0;
277}
278
279static struct w100_tg_info corgi_lcdtg_info = {
280 .change=lcdtg_hw_init,
281 .suspend=lcdtg_suspend,
282 .resume=lcdtg_hw_init,
283};
284
285/*
286 * Corgi w100 Frame Buffer Device
287 */
288
289static struct w100_mem_info corgi_fb_mem = {
290 .ext_cntl = 0x00040003,
291 .sdram_mode_reg = 0x00650021,
292 .ext_timing_cntl = 0x10002a4a,
293 .io_cntl = 0x7ff87012,
294 .size = 0x1fffff,
295};
296
297static struct w100_gen_regs corgi_fb_regs = {
298 .lcd_format = 0x00000003,
299 .lcdd_cntl1 = 0x01CC0000,
300 .lcdd_cntl2 = 0x0003FFFF,
301 .genlcd_cntl1 = 0x00FFFF0D,
302 .genlcd_cntl2 = 0x003F3003,
303 .genlcd_cntl3 = 0x000102aa,
304};
305
306static struct w100_gpio_regs corgi_fb_gpio = {
307 .init_data1 = 0x000000bf,
308 .init_data2 = 0x00000000,
309 .gpio_dir1 = 0x00000000,
310 .gpio_oe1 = 0x03c0feff,
311 .gpio_dir2 = 0x00000000,
312 .gpio_oe2 = 0x00000000,
313};
314
315static struct w100_mode corgi_fb_modes[] = {
316{
317 .xres = 480,
318 .yres = 640,
319 .left_margin = 0x56,
320 .right_margin = 0x55,
321 .upper_margin = 0x03,
322 .lower_margin = 0x00,
323 .crtc_ss = 0x82360056,
324 .crtc_ls = 0xA0280000,
325 .crtc_gs = 0x80280028,
326 .crtc_vpos_gs = 0x02830002,
327 .crtc_rev = 0x00400008,
328 .crtc_dclk = 0xA0000000,
329 .crtc_gclk = 0x8015010F,
330 .crtc_goe = 0x80100110,
331 .crtc_ps1_active = 0x41060010,
332 .pll_freq = 75,
333 .fast_pll_freq = 100,
334 .sysclk_src = CLK_SRC_PLL,
335 .sysclk_divider = 0,
336 .pixclk_src = CLK_SRC_PLL,
337 .pixclk_divider = 2,
338 .pixclk_divider_rotated = 6,
339},{
340 .xres = 240,
341 .yres = 320,
342 .left_margin = 0x27,
343 .right_margin = 0x2e,
344 .upper_margin = 0x01,
345 .lower_margin = 0x00,
346 .crtc_ss = 0x81170027,
347 .crtc_ls = 0xA0140000,
348 .crtc_gs = 0xC0140014,
349 .crtc_vpos_gs = 0x00010141,
350 .crtc_rev = 0x00400008,
351 .crtc_dclk = 0xA0000000,
352 .crtc_gclk = 0x8015010F,
353 .crtc_goe = 0x80100110,
354 .crtc_ps1_active = 0x41060010,
355 .pll_freq = 0,
356 .fast_pll_freq = 0,
357 .sysclk_src = CLK_SRC_XTAL,
358 .sysclk_divider = 0,
359 .pixclk_src = CLK_SRC_XTAL,
360 .pixclk_divider = 1,
361 .pixclk_divider_rotated = 1,
362},
363
364};
365
366static struct w100fb_mach_info corgi_fb_info = {
367 .tg = &corgi_lcdtg_info,
368 .init_mode = INIT_MODE_ROTATED,
369 .mem = &corgi_fb_mem,
370 .regs = &corgi_fb_regs,
371 .modelist = &corgi_fb_modes[0],
372 .num_modes = 2,
373 .gpio = &corgi_fb_gpio,
374 .xtal_freq = 12500000,
375 .xtal_dbl = 0,
376};
377
378static struct resource corgi_fb_resources[] = {
379 [0] = {
380 .start = 0x08000000,
381 .end = 0x08ffffff,
382 .flags = IORESOURCE_MEM,
383 },
384};
385
386struct platform_device corgifb_device = {
387 .name = "w100fb",
388 .id = -1,
389 .num_resources = ARRAY_SIZE(corgi_fb_resources),
390 .resource = corgi_fb_resources,
391 .dev = {
392 .platform_data = &corgi_fb_info,
393 .parent = &corgissp_device.dev,
394 },
395
396};
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index d4d03d0daaec..06807c6ee68a 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -2,6 +2,13 @@ if ARCH_S3C2410
2 2
3menu "S3C24XX Implementations" 3menu "S3C24XX Implementations"
4 4
5config MACH_ANUBIS
6 bool "Simtec Electronics ANUBIS"
7 select CPU_S3C2440
8 help
9 Say Y gere if you are using the Simtec Electronics ANUBIS
10 development system
11
5config ARCH_BAST 12config ARCH_BAST
6 bool "Simtec Electronics BAST (EB2410ITX)" 13 bool "Simtec Electronics BAST (EB2410ITX)"
7 select CPU_S3C2410 14 select CPU_S3C2410
@@ -11,6 +18,14 @@ config ARCH_BAST
11 18
12 Product page: <http://www.simtec.co.uk/products/EB2410ITX/>. 19 Product page: <http://www.simtec.co.uk/products/EB2410ITX/>.
13 20
21config BAST_PC104_IRQ
22 bool "BAST PC104 IRQ support"
23 depends on ARCH_BAST
24 default y
25 help
26 Say Y here to enable the PC104 IRQ routing on the
27 Simtec BAST (EB2410ITX)
28
14config ARCH_H1940 29config ARCH_H1940
15 bool "IPAQ H1940" 30 bool "IPAQ H1940"
16 select CPU_S3C2410 31 select CPU_S3C2410
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index 55ed7c7e57da..b4f1e051c768 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -26,8 +26,13 @@ obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o
26obj-$(CONFIG_CPU_S3C2440) += s3c2440-irq.o 26obj-$(CONFIG_CPU_S3C2440) += s3c2440-irq.o
27obj-$(CONFIG_CPU_S3C2440) += s3c2440-clock.o 27obj-$(CONFIG_CPU_S3C2440) += s3c2440-clock.o
28 28
29# bast extras
30
31obj-$(CONFIG_BAST_PC104_IRQ) += bast-irq.o
32
29# machine specific support 33# machine specific support
30 34
35obj-$(CONFIG_MACH_ANUBIS) += mach-anubis.o
31obj-$(CONFIG_ARCH_BAST) += mach-bast.o usb-simtec.o 36obj-$(CONFIG_ARCH_BAST) += mach-bast.o usb-simtec.o
32obj-$(CONFIG_ARCH_H1940) += mach-h1940.o 37obj-$(CONFIG_ARCH_H1940) += mach-h1940.o
33obj-$(CONFIG_MACH_N30) += mach-n30.o 38obj-$(CONFIG_MACH_N30) += mach-n30.o
diff --git a/arch/arm/mach-s3c2410/bast-irq.c b/arch/arm/mach-s3c2410/bast-irq.c
index 49914709fa09..fbbeb0553006 100644
--- a/arch/arm/mach-s3c2410/bast-irq.c
+++ b/arch/arm/mach-s3c2410/bast-irq.c
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s3c2410/bast-irq.c 1/* linux/arch/arm/mach-s3c2410/bast-irq.c
2 * 2 *
3 * Copyright (c) 2004 Simtec Electronics 3 * Copyright (c) 2003,2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
5 * 5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/ 6 * http://www.simtec.co.uk/products/EB2410ITX/
@@ -21,7 +21,8 @@
21 * 21 *
22 * Modifications: 22 * Modifications:
23 * 08-Jan-2003 BJD Moved from central IRQ code 23 * 08-Jan-2003 BJD Moved from central IRQ code
24 */ 24 * 21-Aug-2005 BJD Fixed missing code and compile errors
25*/
25 26
26 27
27#include <linux/init.h> 28#include <linux/init.h>
@@ -30,12 +31,19 @@
30#include <linux/ptrace.h> 31#include <linux/ptrace.h>
31#include <linux/sysdev.h> 32#include <linux/sysdev.h>
32 33
34#include <asm/mach-types.h>
35
33#include <asm/hardware.h> 36#include <asm/hardware.h>
34#include <asm/irq.h> 37#include <asm/irq.h>
35#include <asm/io.h> 38#include <asm/io.h>
36 39
37#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
38#include <asm/hardware/s3c2410/irq.h> 41
42#include <asm/arch/regs-irq.h>
43#include <asm/arch/bast-map.h>
44#include <asm/arch/bast-irq.h>
45
46#include "irq.h"
39 47
40#if 0 48#if 0
41#include <asm/debug-ll.h> 49#include <asm/debug-ll.h>
@@ -79,15 +87,15 @@ bast_pc104_mask(unsigned int irqno)
79 temp = __raw_readb(BAST_VA_PC104_IRQMASK); 87 temp = __raw_readb(BAST_VA_PC104_IRQMASK);
80 temp &= ~bast_pc104_irqmasks[irqno]; 88 temp &= ~bast_pc104_irqmasks[irqno];
81 __raw_writeb(temp, BAST_VA_PC104_IRQMASK); 89 __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
82
83 if (temp == 0)
84 bast_extint_mask(IRQ_ISA);
85} 90}
86 91
87static void 92static void
88bast_pc104_ack(unsigned int irqno) 93bast_pc104_maskack(unsigned int irqno)
89{ 94{
90 bast_extint_ack(IRQ_ISA); 95 struct irqdesc *desc = irq_desc + IRQ_ISA;
96
97 bast_pc104_mask(irqno);
98 desc->chip->ack(IRQ_ISA);
91} 99}
92 100
93static void 101static void
@@ -98,14 +106,12 @@ bast_pc104_unmask(unsigned int irqno)
98 temp = __raw_readb(BAST_VA_PC104_IRQMASK); 106 temp = __raw_readb(BAST_VA_PC104_IRQMASK);
99 temp |= bast_pc104_irqmasks[irqno]; 107 temp |= bast_pc104_irqmasks[irqno];
100 __raw_writeb(temp, BAST_VA_PC104_IRQMASK); 108 __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
101
102 bast_extint_unmask(IRQ_ISA);
103} 109}
104 110
105static struct bast_pc104_chip = { 111static struct irqchip bast_pc104_chip = {
106 .mask = bast_pc104_mask, 112 .mask = bast_pc104_mask,
107 .unmask = bast_pc104_unmask, 113 .unmask = bast_pc104_unmask,
108 .ack = bast_pc104_ack 114 .ack = bast_pc104_maskack
109}; 115};
110 116
111static void 117static void
@@ -119,14 +125,49 @@ bast_irq_pc104_demux(unsigned int irq,
119 125
120 stat = __raw_readb(BAST_VA_PC104_IRQREQ) & 0xf; 126 stat = __raw_readb(BAST_VA_PC104_IRQREQ) & 0xf;
121 127
122 for (i = 0; i < 4 && stat != 0; i++) { 128 if (unlikely(stat == 0)) {
123 if (stat & 1) { 129 /* ack if we get an irq with nothing (ie, startup) */
124 irqno = bast_pc104_irqs[i]; 130
125 desc = irq_desc + irqno; 131 desc = irq_desc + IRQ_ISA;
132 desc->chip->ack(IRQ_ISA);
133 } else {
134 /* handle the IRQ */
135
136 for (i = 0; stat != 0; i++, stat >>= 1) {
137 if (stat & 1) {
138 irqno = bast_pc104_irqs[i];
126 139
127 desc_handle_irq(irqno, desc, regs); 140 desc_handle_irq(irqno, irq_desc + irqno, regs);
141 }
128 } 142 }
143 }
144}
129 145
130 stat >>= 1; 146static __init int bast_irq_init(void)
147{
148 unsigned int i;
149
150 if (machine_is_bast()) {
151 printk(KERN_INFO "BAST PC104 IRQ routing, (c) 2005 Simtec Electronics\n");
152
153 /* zap all the IRQs */
154
155 __raw_writeb(0x0, BAST_VA_PC104_IRQMASK);
156
157 set_irq_chained_handler(IRQ_ISA, bast_irq_pc104_demux);
158
159 /* reigster our IRQs */
160
161 for (i = 0; i < 4; i++) {
162 unsigned int irqno = bast_pc104_irqs[i];
163
164 set_irq_chip(irqno, &bast_pc104_chip);
165 set_irq_handler(irqno, do_level_IRQ);
166 set_irq_flags(irqno, IRQF_VALID);
167 }
131 } 168 }
169
170 return 0;
132} 171}
172
173arch_initcall(bast_irq_init);
diff --git a/arch/arm/mach-s3c2410/mach-anubis.c b/arch/arm/mach-s3c2410/mach-anubis.c
new file mode 100644
index 000000000000..f87aa0b669ad
--- /dev/null
+++ b/arch/arm/mach-s3c2410/mach-anubis.c
@@ -0,0 +1,270 @@
1/* linux/arch/arm/mach-s3c2410/mach-anubis.c
2 *
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * Modifications:
14 * 02-May-2005 BJD Copied from mach-bast.c
15*/
16
17#include <linux/kernel.h>
18#include <linux/types.h>
19#include <linux/interrupt.h>
20#include <linux/list.h>
21#include <linux/timer.h>
22#include <linux/init.h>
23#include <linux/device.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
29#include <asm/arch/anubis-map.h>
30#include <asm/arch/anubis-irq.h>
31#include <asm/arch/anubis-cpld.h>
32
33#include <asm/hardware.h>
34#include <asm/io.h>
35#include <asm/irq.h>
36#include <asm/mach-types.h>
37
38#include <asm/arch/regs-serial.h>
39#include <asm/arch/regs-gpio.h>
40#include <asm/arch/regs-mem.h>
41#include <asm/arch/regs-lcd.h>
42#include <asm/arch/nand.h>
43
44#include <linux/mtd/mtd.h>
45#include <linux/mtd/nand.h>
46#include <linux/mtd/nand_ecc.h>
47#include <linux/mtd/partitions.h>
48
49#include "clock.h"
50#include "devs.h"
51#include "cpu.h"
52
53#define COPYRIGHT ", (c) 2005 Simtec Electronics"
54
55static struct map_desc anubis_iodesc[] __initdata = {
56 /* ISA IO areas */
57
58 { (u32)S3C24XX_VA_ISA_BYTE, 0x0, SZ_16M, MT_DEVICE },
59 { (u32)S3C24XX_VA_ISA_WORD, 0x0, SZ_16M, MT_DEVICE },
60
61 /* we could possibly compress the next set down into a set of smaller tables
62 * pagetables, but that would mean using an L2 section, and it still means
63 * we cannot actually feed the same register to an LDR due to 16K spacing
64 */
65
66 /* CPLD control registers */
67
68 { (u32)ANUBIS_VA_CTRL1, ANUBIS_PA_CTRL1, SZ_4K, MT_DEVICE },
69 { (u32)ANUBIS_VA_CTRL2, ANUBIS_PA_CTRL2, SZ_4K, MT_DEVICE },
70
71 /* IDE drives */
72
73 { (u32)ANUBIS_IDEPRI, S3C2410_CS3, SZ_1M, MT_DEVICE },
74 { (u32)ANUBIS_IDEPRIAUX, S3C2410_CS3+(1<<26), SZ_1M, MT_DEVICE },
75
76 { (u32)ANUBIS_IDESEC, S3C2410_CS4, SZ_1M, MT_DEVICE },
77 { (u32)ANUBIS_IDESECAUX, S3C2410_CS4+(1<<26), SZ_1M, MT_DEVICE },
78};
79
80#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
81#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
82#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
83
84static struct s3c24xx_uart_clksrc anubis_serial_clocks[] = {
85 [0] = {
86 .name = "uclk",
87 .divisor = 1,
88 .min_baud = 0,
89 .max_baud = 0,
90 },
91 [1] = {
92 .name = "pclk",
93 .divisor = 1,
94 .min_baud = 0,
95 .max_baud = 0.
96 }
97};
98
99
100static struct s3c2410_uartcfg anubis_uartcfgs[] = {
101 [0] = {
102 .hwport = 0,
103 .flags = 0,
104 .ucon = UCON,
105 .ulcon = ULCON,
106 .ufcon = UFCON,
107 .clocks = anubis_serial_clocks,
108 .clocks_size = ARRAY_SIZE(anubis_serial_clocks)
109 },
110 [1] = {
111 .hwport = 2,
112 .flags = 0,
113 .ucon = UCON,
114 .ulcon = ULCON,
115 .ufcon = UFCON,
116 .clocks = anubis_serial_clocks,
117 .clocks_size = ARRAY_SIZE(anubis_serial_clocks)
118 },
119};
120
121/* NAND Flash on Anubis board */
122
123static int external_map[] = { 2 };
124static int chip0_map[] = { 0 };
125static int chip1_map[] = { 1 };
126
127struct mtd_partition anubis_default_nand_part[] = {
128 [0] = {
129 .name = "Boot Agent",
130 .size = SZ_16K,
131 .offset = 0
132 },
133 [1] = {
134 .name = "/boot",
135 .size = SZ_4M - SZ_16K,
136 .offset = SZ_16K,
137 },
138 [2] = {
139 .name = "user1",
140 .offset = SZ_4M,
141 .size = SZ_32M - SZ_4M,
142 },
143 [3] = {
144 .name = "user2",
145 .offset = SZ_32M,
146 .size = MTDPART_SIZ_FULL,
147 }
148};
149
150/* the Anubis has 3 selectable slots for nand-flash, the two
151 * on-board chip areas, as well as the external slot.
152 *
153 * Note, there is no current hot-plug support for the External
154 * socket.
155*/
156
157static struct s3c2410_nand_set anubis_nand_sets[] = {
158 [1] = {
159 .name = "External",
160 .nr_chips = 1,
161 .nr_map = external_map,
162 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
163 .partitions = anubis_default_nand_part
164 },
165 [0] = {
166 .name = "chip0",
167 .nr_chips = 1,
168 .nr_map = chip0_map,
169 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
170 .partitions = anubis_default_nand_part
171 },
172 [2] = {
173 .name = "chip1",
174 .nr_chips = 1,
175 .nr_map = chip1_map,
176 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
177 .partitions = anubis_default_nand_part
178 },
179};
180
181static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
182{
183 unsigned int tmp;
184
185 slot = set->nr_map[slot] & 3;
186
187 pr_debug("anubis_nand: selecting slot %d (set %p,%p)\n",
188 slot, set, set->nr_map);
189
190 tmp = __raw_readb(ANUBIS_VA_CTRL1);
191 tmp &= ~ANUBIS_CTRL1_NANDSEL;
192 tmp |= slot;
193
194 pr_debug("anubis_nand: ctrl1 now %02x\n", tmp);
195
196 __raw_writeb(tmp, ANUBIS_VA_CTRL1);
197}
198
199static struct s3c2410_platform_nand anubis_nand_info = {
200 .tacls = 25,
201 .twrph0 = 80,
202 .twrph1 = 80,
203 .nr_sets = ARRAY_SIZE(anubis_nand_sets),
204 .sets = anubis_nand_sets,
205 .select_chip = anubis_nand_select,
206};
207
208
209/* Standard Anubis devices */
210
211static struct platform_device *anubis_devices[] __initdata = {
212 &s3c_device_usb,
213 &s3c_device_wdt,
214 &s3c_device_adc,
215 &s3c_device_i2c,
216 &s3c_device_rtc,
217 &s3c_device_nand,
218};
219
220static struct clk *anubis_clocks[] = {
221 &s3c24xx_dclk0,
222 &s3c24xx_dclk1,
223 &s3c24xx_clkout0,
224 &s3c24xx_clkout1,
225 &s3c24xx_uclk,
226};
227
228static struct s3c24xx_board anubis_board __initdata = {
229 .devices = anubis_devices,
230 .devices_count = ARRAY_SIZE(anubis_devices),
231 .clocks = anubis_clocks,
232 .clocks_count = ARRAY_SIZE(anubis_clocks)
233};
234
235void __init anubis_map_io(void)
236{
237 /* initialise the clocks */
238
239 s3c24xx_dclk0.parent = NULL;
240 s3c24xx_dclk0.rate = 12*1000*1000;
241
242 s3c24xx_dclk1.parent = NULL;
243 s3c24xx_dclk1.rate = 24*1000*1000;
244
245 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
246 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
247
248 s3c24xx_uclk.parent = &s3c24xx_clkout1;
249
250 s3c_device_nand.dev.platform_data = &anubis_nand_info;
251
252 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
253 s3c24xx_init_clocks(0);
254 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
255 s3c24xx_set_board(&anubis_board);
256
257 /* ensure that the GPIO is setup */
258 s3c2410_gpio_setpin(S3C2410_GPA0, 1);
259}
260
261MACHINE_START(ANUBIS, "Simtec-Anubis")
262 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
263 .phys_ram = S3C2410_SDRAM_PA,
264 .phys_io = S3C2410_PA_UART,
265 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
266 .boot_params = S3C2410_SDRAM_PA + 0x100,
267 .map_io = anubis_map_io,
268 .init_irq = s3c24xx_init_irq,
269 .timer = &s3c24xx_timer,
270MACHINE_END
diff --git a/arch/arm/mach-s3c2410/pm-simtec.c b/arch/arm/mach-s3c2410/pm-simtec.c
index 2cb798832223..4c7ccef6c207 100644
--- a/arch/arm/mach-s3c2410/pm-simtec.c
+++ b/arch/arm/mach-s3c2410/pm-simtec.c
@@ -48,7 +48,7 @@ static __init int pm_simtec_init(void)
48 48
49 /* check which machine we are running on */ 49 /* check which machine we are running on */
50 50
51 if (!machine_is_bast() && !machine_is_vr1000()) 51 if (!machine_is_bast() && !machine_is_vr1000() && !machine_is_anubis())
52 return 0; 52 return 0;
53 53
54 printk(KERN_INFO "Simtec Board Power Manangement" COPYRIGHT "\n"); 54 printk(KERN_INFO "Simtec Board Power Manangement" COPYRIGHT "\n");
diff --git a/arch/arm/mach-s3c2410/time.c b/arch/arm/mach-s3c2410/time.c
index 765a3a9ae032..c0acfb2ad790 100644
--- a/arch/arm/mach-s3c2410/time.c
+++ b/arch/arm/mach-s3c2410/time.c
@@ -164,7 +164,7 @@ static void s3c2410_timer_setup (void)
164 164
165 /* configure the system for whichever machine is in use */ 165 /* configure the system for whichever machine is in use */
166 166
167 if (machine_is_bast() || machine_is_vr1000()) { 167 if (machine_is_bast() || machine_is_vr1000() || machine_is_anubis()) {
168 /* timer is at 12MHz, scaler is 1 */ 168 /* timer is at 12MHz, scaler is 1 */
169 timer_usec_ticks = timer_mask_usec_ticks(1, 12000000); 169 timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
170 tcnt = 12000000 / HZ; 170 tcnt = 12000000 / HZ;
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 345365852f8c..9693e9b4ffd1 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -91,6 +91,13 @@ config OMAP_32K_TIMER_HZ
91 Kernel internal timer frequency should be a divisor of 32768, 91 Kernel internal timer frequency should be a divisor of 32768,
92 such as 64 or 128. 92 such as 64 or 128.
93 93
94config OMAP_DM_TIMER
95 bool "Use dual-mode timer"
96 default n
97 depends on ARCH_OMAP16XX
98 help
99 Select this option if you want to use OMAP Dual-Mode timers.
100
94choice 101choice
95 prompt "Low-level debug console UART" 102 prompt "Low-level debug console UART"
96 depends on ARCH_OMAP 103 depends on ARCH_OMAP
@@ -107,6 +114,15 @@ config OMAP_LL_DEBUG_UART3
107 114
108endchoice 115endchoice
109 116
117config OMAP_SERIAL_WAKE
118 bool "Enable wake-up events for serial ports"
119 depends OMAP_MUX
120 default y
121 help
122 Select this option if you want to have your system wake up
123 to data on the serial RX line. This allows you to wake the
124 system from serial console.
125
110endmenu 126endmenu
111 127
112endif 128endif
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 531e11af54d4..7e144f9cad1c 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := common.o dma.o clock.o mux.o gpio.o mcbsp.o usb.o 6obj-y := common.o sram.o sram-fn.o clock.o dma.o mux.o gpio.o mcbsp.o usb.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
@@ -15,3 +15,5 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
15obj-$(CONFIG_PM) += pm.o sleep.o 15obj-$(CONFIG_PM) += pm.o sleep.o
16 16
17obj-$(CONFIG_CPU_FREQ) += cpu-omap.o 17obj-$(CONFIG_CPU_FREQ) += cpu-omap.o
18obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
19
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 59d91b3262ba..52a58b2da288 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -21,6 +21,7 @@
21#include <asm/arch/usb.h> 21#include <asm/arch/usb.h>
22 22
23#include "clock.h" 23#include "clock.h"
24#include "sram.h"
24 25
25static LIST_HEAD(clocks); 26static LIST_HEAD(clocks);
26static DECLARE_MUTEX(clocks_sem); 27static DECLARE_MUTEX(clocks_sem);
@@ -141,7 +142,7 @@ static struct clk arm_ck = {
141static struct clk armper_ck = { 142static struct clk armper_ck = {
142 .name = "armper_ck", 143 .name = "armper_ck",
143 .parent = &ck_dpll1, 144 .parent = &ck_dpll1,
144 .flags = CLOCK_IN_OMAP730 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 145 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
145 RATE_CKCTL, 146 RATE_CKCTL,
146 .enable_reg = ARM_IDLECT2, 147 .enable_reg = ARM_IDLECT2,
147 .enable_bit = EN_PERCK, 148 .enable_bit = EN_PERCK,
@@ -385,7 +386,8 @@ static struct clk uart2_ck = {
385 .name = "uart2_ck", 386 .name = "uart2_ck",
386 /* Direct from ULPD, no parent */ 387 /* Direct from ULPD, no parent */
387 .rate = 12000000, 388 .rate = 12000000,
388 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | ENABLE_REG_32BIT, 389 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | ENABLE_REG_32BIT |
390 ALWAYS_ENABLED,
389 .enable_reg = MOD_CONF_CTRL_0, 391 .enable_reg = MOD_CONF_CTRL_0,
390 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */ 392 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */
391 .set_rate = &set_uart_rate, 393 .set_rate = &set_uart_rate,
@@ -443,6 +445,15 @@ static struct clk usb_hhc_ck16xx = {
443 .enable_bit = 8 /* UHOST_EN */, 445 .enable_bit = 8 /* UHOST_EN */,
444}; 446};
445 447
448static struct clk usb_dc_ck = {
449 .name = "usb_dc_ck",
450 /* Direct from ULPD, no parent */
451 .rate = 48000000,
452 .flags = CLOCK_IN_OMAP16XX | RATE_FIXED,
453 .enable_reg = SOFT_REQ_REG,
454 .enable_bit = 4,
455};
456
446static struct clk mclk_1510 = { 457static struct clk mclk_1510 = {
447 .name = "mclk", 458 .name = "mclk",
448 /* Direct from ULPD, no parent. May be enabled by ext hardware. */ 459 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
@@ -552,6 +563,7 @@ static struct clk * onchip_clks[] = {
552 &uart3_16xx, 563 &uart3_16xx,
553 &usb_clko, 564 &usb_clko,
554 &usb_hhc_ck1510, &usb_hhc_ck16xx, 565 &usb_hhc_ck1510, &usb_hhc_ck16xx,
566 &usb_dc_ck,
555 &mclk_1510, &mclk_16xx, 567 &mclk_1510, &mclk_16xx,
556 &bclk_1510, &bclk_16xx, 568 &bclk_1510, &bclk_16xx,
557 &mmc1_ck, 569 &mmc1_ck,
@@ -946,14 +958,13 @@ static int select_table_rate(struct clk * clk, unsigned long rate)
946 if (!ptr->rate) 958 if (!ptr->rate)
947 return -EINVAL; 959 return -EINVAL;
948 960
949 if (!ptr->rate) 961 /*
950 return -EINVAL; 962 * In most cases we should not need to reprogram DPLL.
963 * Reprogramming the DPLL is tricky, it must be done from SRAM.
964 */
965 omap_sram_reprogram_clock(ptr->dpllctl_val, ptr->ckctl_val);
951 966
952 if (unlikely(ck_dpll1.rate == 0)) { 967 ck_dpll1.rate = ptr->pll_rate;
953 omap_writew(ptr->dpllctl_val, DPLL_CTL);
954 ck_dpll1.rate = ptr->pll_rate;
955 }
956 omap_writew(ptr->ckctl_val, ARM_CKCTL);
957 propagate_rate(&ck_dpll1); 968 propagate_rate(&ck_dpll1);
958 return 0; 969 return 0;
959} 970}
@@ -1224,9 +1235,11 @@ int __init clk_init(void)
1224#endif 1235#endif
1225 /* Cache rates for clocks connected to ck_ref (not dpll1) */ 1236 /* Cache rates for clocks connected to ck_ref (not dpll1) */
1226 propagate_rate(&ck_ref); 1237 propagate_rate(&ck_ref);
1227 printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld/%ld MHz\n", 1238 printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
1239 "%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
1228 ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10, 1240 ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
1229 ck_dpll1.rate, arm_ck.rate); 1241 ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
1242 arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
1230 1243
1231#ifdef CONFIG_MACH_OMAP_PERSEUS2 1244#ifdef CONFIG_MACH_OMAP_PERSEUS2
1232 /* Select slicer output as OMAP input clock */ 1245 /* Select slicer output as OMAP input clock */
@@ -1271,7 +1284,9 @@ static int __init omap_late_clk_reset(void)
1271 struct clk *p; 1284 struct clk *p;
1272 __u32 regval32; 1285 __u32 regval32;
1273 1286
1274 omap_writew(0, SOFT_REQ_REG); 1287 /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
1288 regval32 = omap_readw(SOFT_REQ_REG) & (1 << 4);
1289 omap_writew(regval32, SOFT_REQ_REG);
1275 omap_writew(0, SOFT_REQ_REG2); 1290 omap_writew(0, SOFT_REQ_REG2);
1276 1291
1277 list_for_each_entry(p, &clocks, node) { 1292 list_for_each_entry(p, &clocks, node) {
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index ea967a8f6ce5..6cb20aea7f51 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -26,6 +26,7 @@
26#include <asm/hardware/clock.h> 26#include <asm/hardware/clock.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/setup.h>
29 30
30#include <asm/arch/board.h> 31#include <asm/arch/board.h>
31#include <asm/arch/mux.h> 32#include <asm/arch/mux.h>
@@ -35,11 +36,11 @@
35 36
36#define NO_LENGTH_CHECK 0xffffffff 37#define NO_LENGTH_CHECK 0xffffffff
37 38
38extern int omap_bootloader_tag_len; 39unsigned char omap_bootloader_tag[512];
39extern u8 omap_bootloader_tag[]; 40int omap_bootloader_tag_len;
40 41
41struct omap_board_config_kernel *omap_board_config; 42struct omap_board_config_kernel *omap_board_config;
42int omap_board_config_size = 0; 43int omap_board_config_size;
43 44
44static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out) 45static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
45{ 46{
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index c0a5c2fa42bd..da7b65145658 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -425,7 +425,7 @@ static int dma_handle_ch(int ch)
425 dma_chan[ch + 6].saved_csr = csr >> 7; 425 dma_chan[ch + 6].saved_csr = csr >> 7;
426 csr &= 0x7f; 426 csr &= 0x7f;
427 } 427 }
428 if (!csr) 428 if ((csr & 0x3f) == 0)
429 return 0; 429 return 0;
430 if (unlikely(dma_chan[ch].dev_id == -1)) { 430 if (unlikely(dma_chan[ch].dev_id == -1)) {
431 printk(KERN_WARNING "Spurious interrupt from DMA channel %d (CSR %04x)\n", 431 printk(KERN_WARNING "Spurious interrupt from DMA channel %d (CSR %04x)\n",
@@ -890,11 +890,11 @@ void omap_enable_lcd_dma(void)
890 w |= 1 << 8; 890 w |= 1 << 8;
891 omap_writew(w, OMAP1610_DMA_LCD_CTRL); 891 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
892 892
893 lcd_dma.active = 1;
894
893 w = omap_readw(OMAP1610_DMA_LCD_CCR); 895 w = omap_readw(OMAP1610_DMA_LCD_CCR);
894 w |= 1 << 7; 896 w |= 1 << 7;
895 omap_writew(w, OMAP1610_DMA_LCD_CCR); 897 omap_writew(w, OMAP1610_DMA_LCD_CCR);
896
897 lcd_dma.active = 1;
898} 898}
899 899
900void omap_setup_lcd_dma(void) 900void omap_setup_lcd_dma(void)
@@ -965,8 +965,8 @@ void omap_clear_dma(int lch)
965 */ 965 */
966dma_addr_t omap_get_dma_src_pos(int lch) 966dma_addr_t omap_get_dma_src_pos(int lch)
967{ 967{
968 return (dma_addr_t) (OMAP_DMA_CSSA_L(lch) | 968 return (dma_addr_t) (omap_readw(OMAP_DMA_CSSA_L(lch)) |
969 (OMAP_DMA_CSSA_U(lch) << 16)); 969 (omap_readw(OMAP_DMA_CSSA_U(lch)) << 16));
970} 970}
971 971
972/* 972/*
@@ -979,8 +979,18 @@ dma_addr_t omap_get_dma_src_pos(int lch)
979 */ 979 */
980dma_addr_t omap_get_dma_dst_pos(int lch) 980dma_addr_t omap_get_dma_dst_pos(int lch)
981{ 981{
982 return (dma_addr_t) (OMAP_DMA_CDSA_L(lch) | 982 return (dma_addr_t) (omap_readw(OMAP_DMA_CDSA_L(lch)) |
983 (OMAP_DMA_CDSA_U(lch) << 16)); 983 (omap_readw(OMAP_DMA_CDSA_U(lch)) << 16));
984}
985
986/*
987 * Returns current source transfer counting for the given DMA channel.
988 * Can be used to monitor the progress of a transfer inside a block.
989 * It must be called with disabled interrupts.
990 */
991int omap_get_dma_src_addr_counter(int lch)
992{
993 return (dma_addr_t) omap_readw(OMAP_DMA_CSAC(lch));
984} 994}
985 995
986int omap_dma_running(void) 996int omap_dma_running(void)
@@ -1076,6 +1086,7 @@ arch_initcall(omap_init_dma);
1076 1086
1077EXPORT_SYMBOL(omap_get_dma_src_pos); 1087EXPORT_SYMBOL(omap_get_dma_src_pos);
1078EXPORT_SYMBOL(omap_get_dma_dst_pos); 1088EXPORT_SYMBOL(omap_get_dma_dst_pos);
1089EXPORT_SYMBOL(omap_get_dma_src_addr_counter);
1079EXPORT_SYMBOL(omap_clear_dma); 1090EXPORT_SYMBOL(omap_clear_dma);
1080EXPORT_SYMBOL(omap_set_dma_priority); 1091EXPORT_SYMBOL(omap_set_dma_priority);
1081EXPORT_SYMBOL(omap_request_dma); 1092EXPORT_SYMBOL(omap_request_dma);
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
new file mode 100644
index 000000000000..a1468d7326eb
--- /dev/null
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -0,0 +1,260 @@
1/*
2 * linux/arch/arm/plat-omap/dmtimer.c
3 *
4 * OMAP Dual-Mode Timers
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#include <linux/init.h>
29#include <asm/arch/hardware.h>
30#include <asm/arch/dmtimer.h>
31#include <asm/io.h>
32#include <asm/arch/irqs.h>
33#include <linux/spinlock.h>
34#include <linux/list.h>
35
36#define OMAP_TIMER_COUNT 8
37
38#define OMAP_TIMER_ID_REG 0x00
39#define OMAP_TIMER_OCP_CFG_REG 0x10
40#define OMAP_TIMER_SYS_STAT_REG 0x14
41#define OMAP_TIMER_STAT_REG 0x18
42#define OMAP_TIMER_INT_EN_REG 0x1c
43#define OMAP_TIMER_WAKEUP_EN_REG 0x20
44#define OMAP_TIMER_CTRL_REG 0x24
45#define OMAP_TIMER_COUNTER_REG 0x28
46#define OMAP_TIMER_LOAD_REG 0x2c
47#define OMAP_TIMER_TRIGGER_REG 0x30
48#define OMAP_TIMER_WRITE_PEND_REG 0x34
49#define OMAP_TIMER_MATCH_REG 0x38
50#define OMAP_TIMER_CAPTURE_REG 0x3c
51#define OMAP_TIMER_IF_CTRL_REG 0x40
52
53
54static struct dmtimer_info_struct {
55 struct list_head unused_timers;
56 struct list_head reserved_timers;
57} dm_timer_info;
58
59static struct omap_dm_timer dm_timers[] = {
60 { .base=0xfffb1400, .irq=INT_1610_GPTIMER1 },
61 { .base=0xfffb1c00, .irq=INT_1610_GPTIMER2 },
62 { .base=0xfffb2400, .irq=INT_1610_GPTIMER3 },
63 { .base=0xfffb2c00, .irq=INT_1610_GPTIMER4 },
64 { .base=0xfffb3400, .irq=INT_1610_GPTIMER5 },
65 { .base=0xfffb3c00, .irq=INT_1610_GPTIMER6 },
66 { .base=0xfffb4400, .irq=INT_1610_GPTIMER7 },
67 { .base=0xfffb4c00, .irq=INT_1610_GPTIMER8 },
68 { .base=0x0 },
69};
70
71
72static spinlock_t dm_timer_lock;
73
74
75inline void omap_dm_timer_write_reg(struct omap_dm_timer *timer, int reg, u32 value)
76{
77 omap_writel(value, timer->base + reg);
78 while (omap_dm_timer_read_reg(timer, OMAP_TIMER_WRITE_PEND_REG))
79 ;
80}
81
82u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, int reg)
83{
84 return omap_readl(timer->base + reg);
85}
86
87int omap_dm_timers_active(void)
88{
89 struct omap_dm_timer *timer;
90
91 for (timer = &dm_timers[0]; timer->base; ++timer)
92 if (omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG) &
93 OMAP_TIMER_CTRL_ST)
94 return 1;
95
96 return 0;
97}
98
99
100void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
101{
102 int n = (timer - dm_timers) << 1;
103 u32 l;
104
105 l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
106 l |= source << n;
107 omap_writel(l, MOD_CONF_CTRL_1);
108}
109
110
111static void omap_dm_timer_reset(struct omap_dm_timer *timer)
112{
113 /* Reset and set posted mode */
114 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06);
115 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, 0x02);
116
117 omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_ARMXOR);
118}
119
120
121
122struct omap_dm_timer * omap_dm_timer_request(void)
123{
124 struct omap_dm_timer *timer = NULL;
125 unsigned long flags;
126
127 spin_lock_irqsave(&dm_timer_lock, flags);
128 if (!list_empty(&dm_timer_info.unused_timers)) {
129 timer = (struct omap_dm_timer *)
130 dm_timer_info.unused_timers.next;
131 list_move_tail((struct list_head *)timer,
132 &dm_timer_info.reserved_timers);
133 }
134 spin_unlock_irqrestore(&dm_timer_lock, flags);
135
136 return timer;
137}
138
139
140void omap_dm_timer_free(struct omap_dm_timer *timer)
141{
142 unsigned long flags;
143
144 omap_dm_timer_reset(timer);
145
146 spin_lock_irqsave(&dm_timer_lock, flags);
147 list_move_tail((struct list_head *)timer, &dm_timer_info.unused_timers);
148 spin_unlock_irqrestore(&dm_timer_lock, flags);
149}
150
151void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
152 unsigned int value)
153{
154 omap_dm_timer_write_reg(timer, OMAP_TIMER_INT_EN_REG, value);
155}
156
157unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
158{
159 return omap_dm_timer_read_reg(timer, OMAP_TIMER_STAT_REG);
160}
161
162void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
163{
164 omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG, value);
165}
166
167void omap_dm_timer_enable_autoreload(struct omap_dm_timer *timer)
168{
169 u32 l;
170 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
171 l |= OMAP_TIMER_CTRL_AR;
172 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
173}
174
175void omap_dm_timer_trigger(struct omap_dm_timer *timer)
176{
177 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 1);
178}
179
180void omap_dm_timer_set_trigger(struct omap_dm_timer *timer, unsigned int value)
181{
182 u32 l;
183
184 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
185 l |= value & 0x3;
186 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
187}
188
189void omap_dm_timer_start(struct omap_dm_timer *timer)
190{
191 u32 l;
192
193 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
194 l |= OMAP_TIMER_CTRL_ST;
195 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
196}
197
198void omap_dm_timer_stop(struct omap_dm_timer *timer)
199{
200 u32 l;
201
202 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
203 l &= ~0x1;
204 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
205}
206
207unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
208{
209 return omap_dm_timer_read_reg(timer, OMAP_TIMER_COUNTER_REG);
210}
211
212void omap_dm_timer_reset_counter(struct omap_dm_timer *timer)
213{
214 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, 0);
215}
216
217void omap_dm_timer_set_load(struct omap_dm_timer *timer, unsigned int load)
218{
219 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
220}
221
222void omap_dm_timer_set_match(struct omap_dm_timer *timer, unsigned int match)
223{
224 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match);
225}
226
227void omap_dm_timer_enable_compare(struct omap_dm_timer *timer)
228{
229 u32 l;
230
231 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
232 l |= OMAP_TIMER_CTRL_CE;
233 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
234}
235
236
237static inline void __dm_timer_init(void)
238{
239 struct omap_dm_timer *timer;
240
241 spin_lock_init(&dm_timer_lock);
242 INIT_LIST_HEAD(&dm_timer_info.unused_timers);
243 INIT_LIST_HEAD(&dm_timer_info.reserved_timers);
244
245 timer = &dm_timers[0];
246 while (timer->base) {
247 list_add_tail((struct list_head *)timer, &dm_timer_info.unused_timers);
248 omap_dm_timer_reset(timer);
249 timer++;
250 }
251}
252
253static int __init omap_dm_timer_init(void)
254{
255 if (cpu_is_omap16xx())
256 __dm_timer_init();
257 return 0;
258}
259
260arch_initcall(omap_dm_timer_init);
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index aa481ea3d702..55059a24ad41 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Support functions for OMAP GPIO 4 * Support functions for OMAP GPIO
5 * 5 *
6 * Copyright (C) 2003 Nokia Corporation 6 * Copyright (C) 2003-2005 Nokia Corporation
7 * Written by Juha Yrjölä <juha.yrjola@nokia.com> 7 * Written by Juha Yrjölä <juha.yrjola@nokia.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -17,8 +17,11 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/sysdev.h>
21#include <linux/err.h>
20 22
21#include <asm/hardware.h> 23#include <asm/hardware.h>
24#include <asm/hardware/clock.h>
22#include <asm/irq.h> 25#include <asm/irq.h>
23#include <asm/arch/irqs.h> 26#include <asm/arch/irqs.h>
24#include <asm/arch/gpio.h> 27#include <asm/arch/gpio.h>
@@ -29,7 +32,7 @@
29/* 32/*
30 * OMAP1510 GPIO registers 33 * OMAP1510 GPIO registers
31 */ 34 */
32#define OMAP1510_GPIO_BASE 0xfffce000 35#define OMAP1510_GPIO_BASE (void __iomem *)0xfffce000
33#define OMAP1510_GPIO_DATA_INPUT 0x00 36#define OMAP1510_GPIO_DATA_INPUT 0x00
34#define OMAP1510_GPIO_DATA_OUTPUT 0x04 37#define OMAP1510_GPIO_DATA_OUTPUT 0x04
35#define OMAP1510_GPIO_DIR_CONTROL 0x08 38#define OMAP1510_GPIO_DIR_CONTROL 0x08
@@ -43,34 +46,37 @@
43/* 46/*
44 * OMAP1610 specific GPIO registers 47 * OMAP1610 specific GPIO registers
45 */ 48 */
46#define OMAP1610_GPIO1_BASE 0xfffbe400 49#define OMAP1610_GPIO1_BASE (void __iomem *)0xfffbe400
47#define OMAP1610_GPIO2_BASE 0xfffbec00 50#define OMAP1610_GPIO2_BASE (void __iomem *)0xfffbec00
48#define OMAP1610_GPIO3_BASE 0xfffbb400 51#define OMAP1610_GPIO3_BASE (void __iomem *)0xfffbb400
49#define OMAP1610_GPIO4_BASE 0xfffbbc00 52#define OMAP1610_GPIO4_BASE (void __iomem *)0xfffbbc00
50#define OMAP1610_GPIO_REVISION 0x0000 53#define OMAP1610_GPIO_REVISION 0x0000
51#define OMAP1610_GPIO_SYSCONFIG 0x0010 54#define OMAP1610_GPIO_SYSCONFIG 0x0010
52#define OMAP1610_GPIO_SYSSTATUS 0x0014 55#define OMAP1610_GPIO_SYSSTATUS 0x0014
53#define OMAP1610_GPIO_IRQSTATUS1 0x0018 56#define OMAP1610_GPIO_IRQSTATUS1 0x0018
54#define OMAP1610_GPIO_IRQENABLE1 0x001c 57#define OMAP1610_GPIO_IRQENABLE1 0x001c
58#define OMAP1610_GPIO_WAKEUPENABLE 0x0028
55#define OMAP1610_GPIO_DATAIN 0x002c 59#define OMAP1610_GPIO_DATAIN 0x002c
56#define OMAP1610_GPIO_DATAOUT 0x0030 60#define OMAP1610_GPIO_DATAOUT 0x0030
57#define OMAP1610_GPIO_DIRECTION 0x0034 61#define OMAP1610_GPIO_DIRECTION 0x0034
58#define OMAP1610_GPIO_EDGE_CTRL1 0x0038 62#define OMAP1610_GPIO_EDGE_CTRL1 0x0038
59#define OMAP1610_GPIO_EDGE_CTRL2 0x003c 63#define OMAP1610_GPIO_EDGE_CTRL2 0x003c
60#define OMAP1610_GPIO_CLEAR_IRQENABLE1 0x009c 64#define OMAP1610_GPIO_CLEAR_IRQENABLE1 0x009c
65#define OMAP1610_GPIO_CLEAR_WAKEUPENA 0x00a8
61#define OMAP1610_GPIO_CLEAR_DATAOUT 0x00b0 66#define OMAP1610_GPIO_CLEAR_DATAOUT 0x00b0
62#define OMAP1610_GPIO_SET_IRQENABLE1 0x00dc 67#define OMAP1610_GPIO_SET_IRQENABLE1 0x00dc
68#define OMAP1610_GPIO_SET_WAKEUPENA 0x00e8
63#define OMAP1610_GPIO_SET_DATAOUT 0x00f0 69#define OMAP1610_GPIO_SET_DATAOUT 0x00f0
64 70
65/* 71/*
66 * OMAP730 specific GPIO registers 72 * OMAP730 specific GPIO registers
67 */ 73 */
68#define OMAP730_GPIO1_BASE 0xfffbc000 74#define OMAP730_GPIO1_BASE (void __iomem *)0xfffbc000
69#define OMAP730_GPIO2_BASE 0xfffbc800 75#define OMAP730_GPIO2_BASE (void __iomem *)0xfffbc800
70#define OMAP730_GPIO3_BASE 0xfffbd000 76#define OMAP730_GPIO3_BASE (void __iomem *)0xfffbd000
71#define OMAP730_GPIO4_BASE 0xfffbd800 77#define OMAP730_GPIO4_BASE (void __iomem *)0xfffbd800
72#define OMAP730_GPIO5_BASE 0xfffbe000 78#define OMAP730_GPIO5_BASE (void __iomem *)0xfffbe000
73#define OMAP730_GPIO6_BASE 0xfffbe800 79#define OMAP730_GPIO6_BASE (void __iomem *)0xfffbe800
74#define OMAP730_GPIO_DATA_INPUT 0x00 80#define OMAP730_GPIO_DATA_INPUT 0x00
75#define OMAP730_GPIO_DATA_OUTPUT 0x04 81#define OMAP730_GPIO_DATA_OUTPUT 0x04
76#define OMAP730_GPIO_DIR_CONTROL 0x08 82#define OMAP730_GPIO_DIR_CONTROL 0x08
@@ -78,14 +84,43 @@
78#define OMAP730_GPIO_INT_MASK 0x10 84#define OMAP730_GPIO_INT_MASK 0x10
79#define OMAP730_GPIO_INT_STATUS 0x14 85#define OMAP730_GPIO_INT_STATUS 0x14
80 86
87/*
88 * omap24xx specific GPIO registers
89 */
90#define OMAP24XX_GPIO1_BASE (void __iomem *)0x48018000
91#define OMAP24XX_GPIO2_BASE (void __iomem *)0x4801a000
92#define OMAP24XX_GPIO3_BASE (void __iomem *)0x4801c000
93#define OMAP24XX_GPIO4_BASE (void __iomem *)0x4801e000
94#define OMAP24XX_GPIO_REVISION 0x0000
95#define OMAP24XX_GPIO_SYSCONFIG 0x0010
96#define OMAP24XX_GPIO_SYSSTATUS 0x0014
97#define OMAP24XX_GPIO_IRQSTATUS1 0x0018
98#define OMAP24XX_GPIO_IRQENABLE1 0x001c
99#define OMAP24XX_GPIO_CTRL 0x0030
100#define OMAP24XX_GPIO_OE 0x0034
101#define OMAP24XX_GPIO_DATAIN 0x0038
102#define OMAP24XX_GPIO_DATAOUT 0x003c
103#define OMAP24XX_GPIO_LEVELDETECT0 0x0040
104#define OMAP24XX_GPIO_LEVELDETECT1 0x0044
105#define OMAP24XX_GPIO_RISINGDETECT 0x0048
106#define OMAP24XX_GPIO_FALLINGDETECT 0x004c
107#define OMAP24XX_GPIO_CLEARIRQENABLE1 0x0060
108#define OMAP24XX_GPIO_SETIRQENABLE1 0x0064
109#define OMAP24XX_GPIO_CLEARWKUENA 0x0080
110#define OMAP24XX_GPIO_SETWKUENA 0x0084
111#define OMAP24XX_GPIO_CLEARDATAOUT 0x0090
112#define OMAP24XX_GPIO_SETDATAOUT 0x0094
113
81#define OMAP_MPUIO_MASK (~OMAP_MAX_GPIO_LINES & 0xff) 114#define OMAP_MPUIO_MASK (~OMAP_MAX_GPIO_LINES & 0xff)
82 115
83struct gpio_bank { 116struct gpio_bank {
84 u32 base; 117 void __iomem *base;
85 u16 irq; 118 u16 irq;
86 u16 virtual_irq_start; 119 u16 virtual_irq_start;
87 u8 method; 120 int method;
88 u32 reserved_map; 121 u32 reserved_map;
122 u32 suspend_wakeup;
123 u32 saved_wakeup;
89 spinlock_t lock; 124 spinlock_t lock;
90}; 125};
91 126
@@ -93,8 +128,9 @@ struct gpio_bank {
93#define METHOD_GPIO_1510 1 128#define METHOD_GPIO_1510 1
94#define METHOD_GPIO_1610 2 129#define METHOD_GPIO_1610 2
95#define METHOD_GPIO_730 3 130#define METHOD_GPIO_730 3
131#define METHOD_GPIO_24XX 4
96 132
97#if defined(CONFIG_ARCH_OMAP16XX) 133#ifdef CONFIG_ARCH_OMAP16XX
98static struct gpio_bank gpio_bank_1610[5] = { 134static struct gpio_bank gpio_bank_1610[5] = {
99 { OMAP_MPUIO_BASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO}, 135 { OMAP_MPUIO_BASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO},
100 { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 }, 136 { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 },
@@ -123,6 +159,15 @@ static struct gpio_bank gpio_bank_730[7] = {
123}; 159};
124#endif 160#endif
125 161
162#ifdef CONFIG_ARCH_OMAP24XX
163static struct gpio_bank gpio_bank_24xx[4] = {
164 { OMAP24XX_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX },
165 { OMAP24XX_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX },
166 { OMAP24XX_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX },
167 { OMAP24XX_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX },
168};
169#endif
170
126static struct gpio_bank *gpio_bank; 171static struct gpio_bank *gpio_bank;
127static int gpio_bank_count; 172static int gpio_bank_count;
128 173
@@ -149,14 +194,23 @@ static inline struct gpio_bank *get_gpio_bank(int gpio)
149 return &gpio_bank[1 + (gpio >> 5)]; 194 return &gpio_bank[1 + (gpio >> 5)];
150 } 195 }
151#endif 196#endif
197#ifdef CONFIG_ARCH_OMAP24XX
198 if (cpu_is_omap24xx())
199 return &gpio_bank[gpio >> 5];
200#endif
152} 201}
153 202
154static inline int get_gpio_index(int gpio) 203static inline int get_gpio_index(int gpio)
155{ 204{
205#ifdef CONFIG_ARCH_OMAP730
156 if (cpu_is_omap730()) 206 if (cpu_is_omap730())
157 return gpio & 0x1f; 207 return gpio & 0x1f;
158 else 208#endif
159 return gpio & 0x0f; 209#ifdef CONFIG_ARCH_OMAP24XX
210 if (cpu_is_omap24xx())
211 return gpio & 0x1f;
212#endif
213 return gpio & 0x0f;
160} 214}
161 215
162static inline int gpio_valid(int gpio) 216static inline int gpio_valid(int gpio)
@@ -180,6 +234,10 @@ static inline int gpio_valid(int gpio)
180 if (cpu_is_omap730() && gpio < 192) 234 if (cpu_is_omap730() && gpio < 192)
181 return 0; 235 return 0;
182#endif 236#endif
237#ifdef CONFIG_ARCH_OMAP24XX
238 if (cpu_is_omap24xx() && gpio < 128)
239 return 0;
240#endif
183 return -1; 241 return -1;
184} 242}
185 243
@@ -195,7 +253,7 @@ static int check_gpio(int gpio)
195 253
196static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input) 254static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
197{ 255{
198 u32 reg = bank->base; 256 void __iomem *reg = bank->base;
199 u32 l; 257 u32 l;
200 258
201 switch (bank->method) { 259 switch (bank->method) {
@@ -211,6 +269,9 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
211 case METHOD_GPIO_730: 269 case METHOD_GPIO_730:
212 reg += OMAP730_GPIO_DIR_CONTROL; 270 reg += OMAP730_GPIO_DIR_CONTROL;
213 break; 271 break;
272 case METHOD_GPIO_24XX:
273 reg += OMAP24XX_GPIO_OE;
274 break;
214 } 275 }
215 l = __raw_readl(reg); 276 l = __raw_readl(reg);
216 if (is_input) 277 if (is_input)
@@ -234,7 +295,7 @@ void omap_set_gpio_direction(int gpio, int is_input)
234 295
235static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) 296static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
236{ 297{
237 u32 reg = bank->base; 298 void __iomem *reg = bank->base;
238 u32 l = 0; 299 u32 l = 0;
239 300
240 switch (bank->method) { 301 switch (bank->method) {
@@ -269,6 +330,13 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
269 else 330 else
270 l &= ~(1 << gpio); 331 l &= ~(1 << gpio);
271 break; 332 break;
333 case METHOD_GPIO_24XX:
334 if (enable)
335 reg += OMAP24XX_GPIO_SETDATAOUT;
336 else
337 reg += OMAP24XX_GPIO_CLEARDATAOUT;
338 l = 1 << gpio;
339 break;
272 default: 340 default:
273 BUG(); 341 BUG();
274 return; 342 return;
@@ -291,7 +359,7 @@ void omap_set_gpio_dataout(int gpio, int enable)
291int omap_get_gpio_datain(int gpio) 359int omap_get_gpio_datain(int gpio)
292{ 360{
293 struct gpio_bank *bank; 361 struct gpio_bank *bank;
294 u32 reg; 362 void __iomem *reg;
295 363
296 if (check_gpio(gpio) < 0) 364 if (check_gpio(gpio) < 0)
297 return -1; 365 return -1;
@@ -310,109 +378,132 @@ int omap_get_gpio_datain(int gpio)
310 case METHOD_GPIO_730: 378 case METHOD_GPIO_730:
311 reg += OMAP730_GPIO_DATA_INPUT; 379 reg += OMAP730_GPIO_DATA_INPUT;
312 break; 380 break;
381 case METHOD_GPIO_24XX:
382 reg += OMAP24XX_GPIO_DATAIN;
383 break;
313 default: 384 default:
314 BUG(); 385 BUG();
315 return -1; 386 return -1;
316 } 387 }
317 return (__raw_readl(reg) & (1 << get_gpio_index(gpio))) != 0; 388 return (__raw_readl(reg)
389 & (1 << get_gpio_index(gpio))) != 0;
318} 390}
319 391
320static void _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge) 392#define MOD_REG_BIT(reg, bit_mask, set) \
393do { \
394 int l = __raw_readl(base + reg); \
395 if (set) l |= bit_mask; \
396 else l &= ~bit_mask; \
397 __raw_writel(l, base + reg); \
398} while(0)
399
400static inline void set_24xx_gpio_triggering(void __iomem *base, int gpio, int trigger)
321{ 401{
322 u32 reg = bank->base; 402 u32 gpio_bit = 1 << gpio;
323 u32 l; 403
404 MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT0, gpio_bit,
405 trigger & IRQT_LOW);
406 MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT1, gpio_bit,
407 trigger & IRQT_HIGH);
408 MOD_REG_BIT(OMAP24XX_GPIO_RISINGDETECT, gpio_bit,
409 trigger & IRQT_RISING);
410 MOD_REG_BIT(OMAP24XX_GPIO_FALLINGDETECT, gpio_bit,
411 trigger & IRQT_FALLING);
412 /* FIXME: Possibly do 'set_irq_handler(j, do_level_IRQ)' if only level
413 * triggering requested. */
414}
415
416static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
417{
418 void __iomem *reg = bank->base;
419 u32 l = 0;
324 420
325 switch (bank->method) { 421 switch (bank->method) {
326 case METHOD_MPUIO: 422 case METHOD_MPUIO:
327 reg += OMAP_MPUIO_GPIO_INT_EDGE; 423 reg += OMAP_MPUIO_GPIO_INT_EDGE;
328 l = __raw_readl(reg); 424 l = __raw_readl(reg);
329 if (edge == OMAP_GPIO_RISING_EDGE) 425 if (trigger == IRQT_RISING)
330 l |= 1 << gpio; 426 l |= 1 << gpio;
331 else 427 else if (trigger == IRQT_FALLING)
332 l &= ~(1 << gpio); 428 l &= ~(1 << gpio);
333 __raw_writel(l, reg); 429 else
430 goto bad;
334 break; 431 break;
335 case METHOD_GPIO_1510: 432 case METHOD_GPIO_1510:
336 reg += OMAP1510_GPIO_INT_CONTROL; 433 reg += OMAP1510_GPIO_INT_CONTROL;
337 l = __raw_readl(reg); 434 l = __raw_readl(reg);
338 if (edge == OMAP_GPIO_RISING_EDGE) 435 if (trigger == IRQT_RISING)
339 l |= 1 << gpio; 436 l |= 1 << gpio;
340 else 437 else if (trigger == IRQT_FALLING)
341 l &= ~(1 << gpio); 438 l &= ~(1 << gpio);
342 __raw_writel(l, reg); 439 else
440 goto bad;
343 break; 441 break;
344 case METHOD_GPIO_1610: 442 case METHOD_GPIO_1610:
345 edge &= 0x03;
346 if (gpio & 0x08) 443 if (gpio & 0x08)
347 reg += OMAP1610_GPIO_EDGE_CTRL2; 444 reg += OMAP1610_GPIO_EDGE_CTRL2;
348 else 445 else
349 reg += OMAP1610_GPIO_EDGE_CTRL1; 446 reg += OMAP1610_GPIO_EDGE_CTRL1;
350 gpio &= 0x07; 447 gpio &= 0x07;
448 /* We allow only edge triggering, i.e. two lowest bits */
449 if (trigger & ~IRQT_BOTHEDGE)
450 BUG();
451 /* NOTE: knows __IRQT_{FAL,RIS}EDGE match OMAP hardware */
452 trigger &= 0x03;
351 l = __raw_readl(reg); 453 l = __raw_readl(reg);
352 l &= ~(3 << (gpio << 1)); 454 l &= ~(3 << (gpio << 1));
353 l |= edge << (gpio << 1); 455 l |= trigger << (gpio << 1);
354 __raw_writel(l, reg);
355 break; 456 break;
356 case METHOD_GPIO_730: 457 case METHOD_GPIO_730:
357 reg += OMAP730_GPIO_INT_CONTROL; 458 reg += OMAP730_GPIO_INT_CONTROL;
358 l = __raw_readl(reg); 459 l = __raw_readl(reg);
359 if (edge == OMAP_GPIO_RISING_EDGE) 460 if (trigger == IRQT_RISING)
360 l |= 1 << gpio; 461 l |= 1 << gpio;
361 else 462 else if (trigger == IRQT_FALLING)
362 l &= ~(1 << gpio); 463 l &= ~(1 << gpio);
363 __raw_writel(l, reg); 464 else
465 goto bad;
466 break;
467 case METHOD_GPIO_24XX:
468 set_24xx_gpio_triggering(reg, gpio, trigger);
364 break; 469 break;
365 default: 470 default:
366 BUG(); 471 BUG();
367 return; 472 goto bad;
368 } 473 }
474 __raw_writel(l, reg);
475 return 0;
476bad:
477 return -EINVAL;
369} 478}
370 479
371void omap_set_gpio_edge_ctrl(int gpio, int edge) 480static int gpio_irq_type(unsigned irq, unsigned type)
372{ 481{
373 struct gpio_bank *bank; 482 struct gpio_bank *bank;
483 unsigned gpio;
484 int retval;
485
486 if (irq > IH_MPUIO_BASE)
487 gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE);
488 else
489 gpio = irq - IH_GPIO_BASE;
374 490
375 if (check_gpio(gpio) < 0) 491 if (check_gpio(gpio) < 0)
376 return; 492 return -EINVAL;
493
494 if (type & (__IRQT_LOWLVL|__IRQT_HIGHLVL|IRQT_PROBE))
495 return -EINVAL;
496
377 bank = get_gpio_bank(gpio); 497 bank = get_gpio_bank(gpio);
378 spin_lock(&bank->lock); 498 spin_lock(&bank->lock);
379 _set_gpio_edge_ctrl(bank, get_gpio_index(gpio), edge); 499 retval = _set_gpio_triggering(bank, get_gpio_index(gpio), type);
380 spin_unlock(&bank->lock); 500 spin_unlock(&bank->lock);
381} 501 return retval;
382
383
384static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio)
385{
386 u32 reg = bank->base, l;
387
388 switch (bank->method) {
389 case METHOD_MPUIO:
390 l = __raw_readl(reg + OMAP_MPUIO_GPIO_INT_EDGE);
391 return (l & (1 << gpio)) ?
392 OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE;
393 case METHOD_GPIO_1510:
394 l = __raw_readl(reg + OMAP1510_GPIO_INT_CONTROL);
395 return (l & (1 << gpio)) ?
396 OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE;
397 case METHOD_GPIO_1610:
398 if (gpio & 0x08)
399 reg += OMAP1610_GPIO_EDGE_CTRL2;
400 else
401 reg += OMAP1610_GPIO_EDGE_CTRL1;
402 return (__raw_readl(reg) >> ((gpio & 0x07) << 1)) & 0x03;
403 case METHOD_GPIO_730:
404 l = __raw_readl(reg + OMAP730_GPIO_INT_CONTROL);
405 return (l & (1 << gpio)) ?
406 OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE;
407 default:
408 BUG();
409 return -1;
410 }
411} 502}
412 503
413static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask) 504static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
414{ 505{
415 u32 reg = bank->base; 506 void __iomem *reg = bank->base;
416 507
417 switch (bank->method) { 508 switch (bank->method) {
418 case METHOD_MPUIO: 509 case METHOD_MPUIO:
@@ -428,6 +519,9 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
428 case METHOD_GPIO_730: 519 case METHOD_GPIO_730:
429 reg += OMAP730_GPIO_INT_STATUS; 520 reg += OMAP730_GPIO_INT_STATUS;
430 break; 521 break;
522 case METHOD_GPIO_24XX:
523 reg += OMAP24XX_GPIO_IRQSTATUS1;
524 break;
431 default: 525 default:
432 BUG(); 526 BUG();
433 return; 527 return;
@@ -442,7 +536,7 @@ static inline void _clear_gpio_irqstatus(struct gpio_bank *bank, int gpio)
442 536
443static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enable) 537static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enable)
444{ 538{
445 u32 reg = bank->base; 539 void __iomem *reg = bank->base;
446 u32 l; 540 u32 l;
447 541
448 switch (bank->method) { 542 switch (bank->method) {
@@ -477,6 +571,13 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
477 else 571 else
478 l |= gpio_mask; 572 l |= gpio_mask;
479 break; 573 break;
574 case METHOD_GPIO_24XX:
575 if (enable)
576 reg += OMAP24XX_GPIO_SETIRQENABLE1;
577 else
578 reg += OMAP24XX_GPIO_CLEARIRQENABLE1;
579 l = gpio_mask;
580 break;
480 default: 581 default:
481 BUG(); 582 BUG();
482 return; 583 return;
@@ -489,6 +590,50 @@ static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int ena
489 _enable_gpio_irqbank(bank, 1 << get_gpio_index(gpio), enable); 590 _enable_gpio_irqbank(bank, 1 << get_gpio_index(gpio), enable);
490} 591}
491 592
593/*
594 * Note that ENAWAKEUP needs to be enabled in GPIO_SYSCONFIG register.
595 * 1510 does not seem to have a wake-up register. If JTAG is connected
596 * to the target, system will wake up always on GPIO events. While
597 * system is running all registered GPIO interrupts need to have wake-up
598 * enabled. When system is suspended, only selected GPIO interrupts need
599 * to have wake-up enabled.
600 */
601static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
602{
603 switch (bank->method) {
604 case METHOD_GPIO_1610:
605 case METHOD_GPIO_24XX:
606 spin_lock(&bank->lock);
607 if (enable)
608 bank->suspend_wakeup |= (1 << gpio);
609 else
610 bank->suspend_wakeup &= ~(1 << gpio);
611 spin_unlock(&bank->lock);
612 return 0;
613 default:
614 printk(KERN_ERR "Can't enable GPIO wakeup for method %i\n",
615 bank->method);
616 return -EINVAL;
617 }
618}
619
620/* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
621static int gpio_wake_enable(unsigned int irq, unsigned int enable)
622{
623 unsigned int gpio = irq - IH_GPIO_BASE;
624 struct gpio_bank *bank;
625 int retval;
626
627 if (check_gpio(gpio) < 0)
628 return -ENODEV;
629 bank = get_gpio_bank(gpio);
630 spin_lock(&bank->lock);
631 retval = _set_gpio_wakeup(bank, get_gpio_index(gpio), enable);
632 spin_unlock(&bank->lock);
633
634 return retval;
635}
636
492int omap_request_gpio(int gpio) 637int omap_request_gpio(int gpio)
493{ 638{
494 struct gpio_bank *bank; 639 struct gpio_bank *bank;
@@ -505,15 +650,33 @@ int omap_request_gpio(int gpio)
505 return -1; 650 return -1;
506 } 651 }
507 bank->reserved_map |= (1 << get_gpio_index(gpio)); 652 bank->reserved_map |= (1 << get_gpio_index(gpio));
653
654 /* Set trigger to none. You need to enable the trigger after request_irq */
655 _set_gpio_triggering(bank, get_gpio_index(gpio), IRQT_NOEDGE);
656
508#ifdef CONFIG_ARCH_OMAP1510 657#ifdef CONFIG_ARCH_OMAP1510
509 if (bank->method == METHOD_GPIO_1510) { 658 if (bank->method == METHOD_GPIO_1510) {
510 u32 reg; 659 void __iomem *reg;
511 660
512 /* Claim the pin for the ARM */ 661 /* Claim the pin for MPU */
513 reg = bank->base + OMAP1510_GPIO_PIN_CONTROL; 662 reg = bank->base + OMAP1510_GPIO_PIN_CONTROL;
514 __raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg); 663 __raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg);
515 } 664 }
516#endif 665#endif
666#ifdef CONFIG_ARCH_OMAP16XX
667 if (bank->method == METHOD_GPIO_1610) {
668 /* Enable wake-up during idle for dynamic tick */
669 void __iomem *reg = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
670 __raw_writel(1 << get_gpio_index(gpio), reg);
671 }
672#endif
673#ifdef CONFIG_ARCH_OMAP24XX
674 if (bank->method == METHOD_GPIO_24XX) {
675 /* Enable wake-up during idle for dynamic tick */
676 void __iomem *reg = bank->base + OMAP24XX_GPIO_SETWKUENA;
677 __raw_writel(1 << get_gpio_index(gpio), reg);
678 }
679#endif
517 spin_unlock(&bank->lock); 680 spin_unlock(&bank->lock);
518 681
519 return 0; 682 return 0;
@@ -533,6 +696,20 @@ void omap_free_gpio(int gpio)
533 spin_unlock(&bank->lock); 696 spin_unlock(&bank->lock);
534 return; 697 return;
535 } 698 }
699#ifdef CONFIG_ARCH_OMAP16XX
700 if (bank->method == METHOD_GPIO_1610) {
701 /* Disable wake-up during idle for dynamic tick */
702 void __iomem *reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
703 __raw_writel(1 << get_gpio_index(gpio), reg);
704 }
705#endif
706#ifdef CONFIG_ARCH_OMAP24XX
707 if (bank->method == METHOD_GPIO_24XX) {
708 /* Disable wake-up during idle for dynamic tick */
709 void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
710 __raw_writel(1 << get_gpio_index(gpio), reg);
711 }
712#endif
536 bank->reserved_map &= ~(1 << get_gpio_index(gpio)); 713 bank->reserved_map &= ~(1 << get_gpio_index(gpio));
537 _set_gpio_direction(bank, get_gpio_index(gpio), 1); 714 _set_gpio_direction(bank, get_gpio_index(gpio), 1);
538 _set_gpio_irqenable(bank, gpio, 0); 715 _set_gpio_irqenable(bank, gpio, 0);
@@ -552,7 +729,7 @@ void omap_free_gpio(int gpio)
552static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc, 729static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc,
553 struct pt_regs *regs) 730 struct pt_regs *regs)
554{ 731{
555 u32 isr_reg = 0; 732 void __iomem *isr_reg = NULL;
556 u32 isr; 733 u32 isr;
557 unsigned int gpio_irq; 734 unsigned int gpio_irq;
558 struct gpio_bank *bank; 735 struct gpio_bank *bank;
@@ -574,24 +751,30 @@ static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc,
574 if (bank->method == METHOD_GPIO_730) 751 if (bank->method == METHOD_GPIO_730)
575 isr_reg = bank->base + OMAP730_GPIO_INT_STATUS; 752 isr_reg = bank->base + OMAP730_GPIO_INT_STATUS;
576#endif 753#endif
754#ifdef CONFIG_ARCH_OMAP24XX
755 if (bank->method == METHOD_GPIO_24XX)
756 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1;
757#endif
577 758
578 isr = __raw_readl(isr_reg); 759 while(1) {
579 _enable_gpio_irqbank(bank, isr, 0); 760 isr = __raw_readl(isr_reg);
580 _clear_gpio_irqbank(bank, isr); 761 _enable_gpio_irqbank(bank, isr, 0);
581 _enable_gpio_irqbank(bank, isr, 1); 762 _clear_gpio_irqbank(bank, isr);
582 desc->chip->unmask(irq); 763 _enable_gpio_irqbank(bank, isr, 1);
583 764 desc->chip->unmask(irq);
584 if (unlikely(!isr)) 765
585 return; 766 if (!isr)
586 767 break;
587 gpio_irq = bank->virtual_irq_start; 768
588 for (; isr != 0; isr >>= 1, gpio_irq++) { 769 gpio_irq = bank->virtual_irq_start;
589 struct irqdesc *d; 770 for (; isr != 0; isr >>= 1, gpio_irq++) {
590 if (!(isr & 1)) 771 struct irqdesc *d;
591 continue; 772 if (!(isr & 1))
592 d = irq_desc + gpio_irq; 773 continue;
593 desc_handle_irq(gpio_irq, d, regs); 774 d = irq_desc + gpio_irq;
594 } 775 desc_handle_irq(gpio_irq, d, regs);
776 }
777 }
595} 778}
596 779
597static void gpio_ack_irq(unsigned int irq) 780static void gpio_ack_irq(unsigned int irq)
@@ -613,14 +796,10 @@ static void gpio_mask_irq(unsigned int irq)
613static void gpio_unmask_irq(unsigned int irq) 796static void gpio_unmask_irq(unsigned int irq)
614{ 797{
615 unsigned int gpio = irq - IH_GPIO_BASE; 798 unsigned int gpio = irq - IH_GPIO_BASE;
799 unsigned int gpio_idx = get_gpio_index(gpio);
616 struct gpio_bank *bank = get_gpio_bank(gpio); 800 struct gpio_bank *bank = get_gpio_bank(gpio);
617 801
618 if (_get_gpio_edge_ctrl(bank, get_gpio_index(gpio)) == OMAP_GPIO_NO_EDGE) { 802 _set_gpio_irqenable(bank, gpio_idx, 1);
619 printk(KERN_ERR "OMAP GPIO %d: trying to enable GPIO IRQ while no edge is set\n",
620 gpio);
621 _set_gpio_edge_ctrl(bank, get_gpio_index(gpio), OMAP_GPIO_RISING_EDGE);
622 }
623 _set_gpio_irqenable(bank, gpio, 1);
624} 803}
625 804
626static void mpuio_ack_irq(unsigned int irq) 805static void mpuio_ack_irq(unsigned int irq)
@@ -645,9 +824,11 @@ static void mpuio_unmask_irq(unsigned int irq)
645} 824}
646 825
647static struct irqchip gpio_irq_chip = { 826static struct irqchip gpio_irq_chip = {
648 .ack = gpio_ack_irq, 827 .ack = gpio_ack_irq,
649 .mask = gpio_mask_irq, 828 .mask = gpio_mask_irq,
650 .unmask = gpio_unmask_irq, 829 .unmask = gpio_unmask_irq,
830 .set_type = gpio_irq_type,
831 .set_wake = gpio_wake_enable,
651}; 832};
652 833
653static struct irqchip mpuio_irq_chip = { 834static struct irqchip mpuio_irq_chip = {
@@ -657,6 +838,7 @@ static struct irqchip mpuio_irq_chip = {
657}; 838};
658 839
659static int initialized = 0; 840static int initialized = 0;
841static struct clk * gpio_ck = NULL;
660 842
661static int __init _omap_gpio_init(void) 843static int __init _omap_gpio_init(void)
662{ 844{
@@ -665,6 +847,14 @@ static int __init _omap_gpio_init(void)
665 847
666 initialized = 1; 848 initialized = 1;
667 849
850 if (cpu_is_omap1510()) {
851 gpio_ck = clk_get(NULL, "arm_gpio_ck");
852 if (IS_ERR(gpio_ck))
853 printk("Could not get arm_gpio_ck\n");
854 else
855 clk_use(gpio_ck);
856 }
857
668#ifdef CONFIG_ARCH_OMAP1510 858#ifdef CONFIG_ARCH_OMAP1510
669 if (cpu_is_omap1510()) { 859 if (cpu_is_omap1510()) {
670 printk(KERN_INFO "OMAP1510 GPIO hardware\n"); 860 printk(KERN_INFO "OMAP1510 GPIO hardware\n");
@@ -674,7 +864,7 @@ static int __init _omap_gpio_init(void)
674#endif 864#endif
675#if defined(CONFIG_ARCH_OMAP16XX) 865#if defined(CONFIG_ARCH_OMAP16XX)
676 if (cpu_is_omap16xx()) { 866 if (cpu_is_omap16xx()) {
677 int rev; 867 u32 rev;
678 868
679 gpio_bank_count = 5; 869 gpio_bank_count = 5;
680 gpio_bank = gpio_bank_1610; 870 gpio_bank = gpio_bank_1610;
@@ -690,6 +880,17 @@ static int __init _omap_gpio_init(void)
690 gpio_bank = gpio_bank_730; 880 gpio_bank = gpio_bank_730;
691 } 881 }
692#endif 882#endif
883#ifdef CONFIG_ARCH_OMAP24XX
884 if (cpu_is_omap24xx()) {
885 int rev;
886
887 gpio_bank_count = 4;
888 gpio_bank = gpio_bank_24xx;
889 rev = omap_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
890 printk(KERN_INFO "OMAP24xx GPIO hardware version %d.%d\n",
891 (rev >> 4) & 0x0f, rev & 0x0f);
892 }
893#endif
693 for (i = 0; i < gpio_bank_count; i++) { 894 for (i = 0; i < gpio_bank_count; i++) {
694 int j, gpio_count = 16; 895 int j, gpio_count = 16;
695 896
@@ -710,6 +911,7 @@ static int __init _omap_gpio_init(void)
710 if (bank->method == METHOD_GPIO_1610) { 911 if (bank->method == METHOD_GPIO_1610) {
711 __raw_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1); 912 __raw_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1);
712 __raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1); 913 __raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1);
914 __raw_writew(0x0014, bank->base + OMAP1610_GPIO_SYSCONFIG);
713 } 915 }
714#endif 916#endif
715#ifdef CONFIG_ARCH_OMAP730 917#ifdef CONFIG_ARCH_OMAP730
@@ -720,6 +922,14 @@ static int __init _omap_gpio_init(void)
720 gpio_count = 32; /* 730 has 32-bit GPIOs */ 922 gpio_count = 32; /* 730 has 32-bit GPIOs */
721 } 923 }
722#endif 924#endif
925#ifdef CONFIG_ARCH_OMAP24XX
926 if (bank->method == METHOD_GPIO_24XX) {
927 __raw_writel(0x00000000, bank->base + OMAP24XX_GPIO_IRQENABLE1);
928 __raw_writel(0xffffffff, bank->base + OMAP24XX_GPIO_IRQSTATUS1);
929
930 gpio_count = 32;
931 }
932#endif
723 for (j = bank->virtual_irq_start; 933 for (j = bank->virtual_irq_start;
724 j < bank->virtual_irq_start + gpio_count; j++) { 934 j < bank->virtual_irq_start + gpio_count; j++) {
725 if (bank->method == METHOD_MPUIO) 935 if (bank->method == METHOD_MPUIO)
@@ -735,12 +945,97 @@ static int __init _omap_gpio_init(void)
735 945
736 /* Enable system clock for GPIO module. 946 /* Enable system clock for GPIO module.
737 * The CAM_CLK_CTRL *is* really the right place. */ 947 * The CAM_CLK_CTRL *is* really the right place. */
738 if (cpu_is_omap1610() || cpu_is_omap1710()) 948 if (cpu_is_omap16xx())
739 omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, ULPD_CAM_CLK_CTRL); 949 omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, ULPD_CAM_CLK_CTRL);
740 950
741 return 0; 951 return 0;
742} 952}
743 953
954#if defined (CONFIG_ARCH_OMAP16XX) || defined (CONFIG_ARCH_OMAP24XX)
955static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
956{
957 int i;
958
959 if (!cpu_is_omap24xx() && !cpu_is_omap16xx())
960 return 0;
961
962 for (i = 0; i < gpio_bank_count; i++) {
963 struct gpio_bank *bank = &gpio_bank[i];
964 void __iomem *wake_status;
965 void __iomem *wake_clear;
966 void __iomem *wake_set;
967
968 switch (bank->method) {
969 case METHOD_GPIO_1610:
970 wake_status = bank->base + OMAP1610_GPIO_WAKEUPENABLE;
971 wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
972 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
973 break;
974 case METHOD_GPIO_24XX:
975 wake_status = bank->base + OMAP24XX_GPIO_SETWKUENA;
976 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
977 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA;
978 break;
979 default:
980 continue;
981 }
982
983 spin_lock(&bank->lock);
984 bank->saved_wakeup = __raw_readl(wake_status);
985 __raw_writel(0xffffffff, wake_clear);
986 __raw_writel(bank->suspend_wakeup, wake_set);
987 spin_unlock(&bank->lock);
988 }
989
990 return 0;
991}
992
993static int omap_gpio_resume(struct sys_device *dev)
994{
995 int i;
996
997 if (!cpu_is_omap24xx() && !cpu_is_omap16xx())
998 return 0;
999
1000 for (i = 0; i < gpio_bank_count; i++) {
1001 struct gpio_bank *bank = &gpio_bank[i];
1002 void __iomem *wake_clear;
1003 void __iomem *wake_set;
1004
1005 switch (bank->method) {
1006 case METHOD_GPIO_1610:
1007 wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
1008 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
1009 break;
1010 case METHOD_GPIO_24XX:
1011 wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
1012 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
1013 break;
1014 default:
1015 continue;
1016 }
1017
1018 spin_lock(&bank->lock);
1019 __raw_writel(0xffffffff, wake_clear);
1020 __raw_writel(bank->saved_wakeup, wake_set);
1021 spin_unlock(&bank->lock);
1022 }
1023
1024 return 0;
1025}
1026
1027static struct sysdev_class omap_gpio_sysclass = {
1028 set_kset_name("gpio"),
1029 .suspend = omap_gpio_suspend,
1030 .resume = omap_gpio_resume,
1031};
1032
1033static struct sys_device omap_gpio_device = {
1034 .id = 0,
1035 .cls = &omap_gpio_sysclass,
1036};
1037#endif
1038
744/* 1039/*
745 * This may get called early from board specific init 1040 * This may get called early from board specific init
746 */ 1041 */
@@ -752,11 +1047,30 @@ int omap_gpio_init(void)
752 return 0; 1047 return 0;
753} 1048}
754 1049
1050static int __init omap_gpio_sysinit(void)
1051{
1052 int ret = 0;
1053
1054 if (!initialized)
1055 ret = _omap_gpio_init();
1056
1057#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX)
1058 if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
1059 if (ret == 0) {
1060 ret = sysdev_class_register(&omap_gpio_sysclass);
1061 if (ret == 0)
1062 ret = sysdev_register(&omap_gpio_device);
1063 }
1064 }
1065#endif
1066
1067 return ret;
1068}
1069
755EXPORT_SYMBOL(omap_request_gpio); 1070EXPORT_SYMBOL(omap_request_gpio);
756EXPORT_SYMBOL(omap_free_gpio); 1071EXPORT_SYMBOL(omap_free_gpio);
757EXPORT_SYMBOL(omap_set_gpio_direction); 1072EXPORT_SYMBOL(omap_set_gpio_direction);
758EXPORT_SYMBOL(omap_set_gpio_dataout); 1073EXPORT_SYMBOL(omap_set_gpio_dataout);
759EXPORT_SYMBOL(omap_get_gpio_datain); 1074EXPORT_SYMBOL(omap_get_gpio_datain);
760EXPORT_SYMBOL(omap_set_gpio_edge_ctrl);
761 1075
762arch_initcall(omap_gpio_init); 1076arch_initcall(omap_gpio_sysinit);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 43567d5edddb..9c9b7df3faf6 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -27,6 +27,7 @@
27#include <asm/arch/dma.h> 27#include <asm/arch/dma.h>
28#include <asm/arch/mux.h> 28#include <asm/arch/mux.h>
29#include <asm/arch/irqs.h> 29#include <asm/arch/irqs.h>
30#include <asm/arch/dsp_common.h>
30#include <asm/arch/mcbsp.h> 31#include <asm/arch/mcbsp.h>
31 32
32#include <asm/hardware/clock.h> 33#include <asm/hardware/clock.h>
@@ -187,9 +188,6 @@ static int omap_mcbsp_check(unsigned int id)
187 return -1; 188 return -1;
188} 189}
189 190
190#define EN_XORPCK 1
191#define DSP_RSTCT2 0xe1008014
192
193static void omap_mcbsp_dsp_request(void) 191static void omap_mcbsp_dsp_request(void)
194{ 192{
195 if (cpu_is_omap1510() || cpu_is_omap16xx()) { 193 if (cpu_is_omap1510() || cpu_is_omap16xx()) {
@@ -198,6 +196,11 @@ static void omap_mcbsp_dsp_request(void)
198 196
199 /* enable 12MHz clock to mcbsp 1 & 3 */ 197 /* enable 12MHz clock to mcbsp 1 & 3 */
200 clk_use(mcbsp_dspxor_ck); 198 clk_use(mcbsp_dspxor_ck);
199
200 /*
201 * DSP external peripheral reset
202 * FIXME: This should be moved to dsp code
203 */
201 __raw_writew(__raw_readw(DSP_RSTCT2) | 1 | 1 << 1, 204 __raw_writew(__raw_readw(DSP_RSTCT2) | 1 | 1 << 1,
202 DSP_RSTCT2); 205 DSP_RSTCT2);
203 } 206 }
diff --git a/arch/arm/plat-omap/mux.c b/arch/arm/plat-omap/mux.c
index ea7b955b9c81..64482040f89e 100644
--- a/arch/arm/plat-omap/mux.c
+++ b/arch/arm/plat-omap/mux.c
@@ -48,6 +48,9 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
48 pull_orig = 0, pull = 0; 48 pull_orig = 0, pull = 0;
49 unsigned int mask, warn = 0; 49 unsigned int mask, warn = 0;
50 50
51 if (cpu_is_omap7xx())
52 return 0;
53
51 if (reg_cfg > ARRAY_SIZE(reg_cfg_table)) { 54 if (reg_cfg > ARRAY_SIZE(reg_cfg_table)) {
52 printk(KERN_ERR "MUX: reg_cfg %d\n", reg_cfg); 55 printk(KERN_ERR "MUX: reg_cfg %d\n", reg_cfg);
53 return -EINVAL; 56 return -EINVAL;
diff --git a/arch/arm/plat-omap/ocpi.c b/arch/arm/plat-omap/ocpi.c
index 2ede2ee8cae4..1fb16f9edfd5 100644
--- a/arch/arm/plat-omap/ocpi.c
+++ b/arch/arm/plat-omap/ocpi.c
@@ -25,6 +25,7 @@
25 25
26#include <linux/config.h> 26#include <linux/config.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/version.h>
28#include <linux/types.h> 29#include <linux/types.h>
29#include <linux/errno.h> 30#include <linux/errno.h>
30#include <linux/kernel.h> 31#include <linux/kernel.h>
diff --git a/arch/arm/plat-omap/pm.c b/arch/arm/plat-omap/pm.c
index e6536b16c385..e15c6c1ddec9 100644
--- a/arch/arm/plat-omap/pm.c
+++ b/arch/arm/plat-omap/pm.c
@@ -39,24 +39,32 @@
39#include <linux/sched.h> 39#include <linux/sched.h>
40#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
41#include <linux/pm.h> 41#include <linux/pm.h>
42#include <linux/interrupt.h>
42 43
43#include <asm/io.h> 44#include <asm/io.h>
45#include <asm/irq.h>
44#include <asm/mach/time.h> 46#include <asm/mach/time.h>
45#include <asm/mach-types.h> 47#include <asm/mach/irq.h>
46 48
47#include <asm/arch/omap16xx.h> 49#include <asm/mach-types.h>
50#include <asm/arch/irqs.h>
51#include <asm/arch/tc.h>
48#include <asm/arch/pm.h> 52#include <asm/arch/pm.h>
49#include <asm/arch/mux.h> 53#include <asm/arch/mux.h>
50#include <asm/arch/tc.h>
51#include <asm/arch/tps65010.h> 54#include <asm/arch/tps65010.h>
55#include <asm/arch/dsp_common.h>
52 56
53#include "clock.h" 57#include "clock.h"
58#include "sram.h"
54 59
55static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE]; 60static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
56static unsigned short ulpd_sleep_save[ULPD_SLEEP_SAVE_SIZE]; 61static unsigned short ulpd_sleep_save[ULPD_SLEEP_SAVE_SIZE];
57static unsigned int mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_SIZE]; 62static unsigned int mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_SIZE];
58static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE]; 63static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE];
59 64
65static void (*omap_sram_idle)(void) = NULL;
66static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL;
67
60/* 68/*
61 * Let's power down on idle, but only if we are really 69 * Let's power down on idle, but only if we are really
62 * idle, because once we start down the path of 70 * idle, because once we start down the path of
@@ -65,7 +73,6 @@ static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE];
65 */ 73 */
66void omap_pm_idle(void) 74void omap_pm_idle(void)
67{ 75{
68 int (*func_ptr)(void) = 0;
69 unsigned int mask32 = 0; 76 unsigned int mask32 = 0;
70 77
71 /* 78 /*
@@ -84,6 +91,13 @@ void omap_pm_idle(void)
84 mask32 = omap_readl(ARM_SYSST); 91 mask32 = omap_readl(ARM_SYSST);
85 92
86 /* 93 /*
94 * Prevent the ULPD from entering low power state by setting
95 * POWER_CTRL_REG:4 = 0
96 */
97 omap_writew(omap_readw(ULPD_POWER_CTRL) &
98 ~ULPD_DEEP_SLEEP_TRANSITION_EN, ULPD_POWER_CTRL);
99
100 /*
87 * Since an interrupt may set up a timer, we don't want to 101 * Since an interrupt may set up a timer, we don't want to
88 * reprogram the hardware timer with interrupts enabled. 102 * reprogram the hardware timer with interrupts enabled.
89 * Re-enable interrupts only after returning from idle. 103 * Re-enable interrupts only after returning from idle.
@@ -92,18 +106,9 @@ void omap_pm_idle(void)
92 106
93 if ((mask32 & DSP_IDLE) == 0) { 107 if ((mask32 & DSP_IDLE) == 0) {
94 __asm__ volatile ("mcr p15, 0, r0, c7, c0, 4"); 108 __asm__ volatile ("mcr p15, 0, r0, c7, c0, 4");
95 } else { 109 } else
96 110 omap_sram_idle();
97 if (cpu_is_omap1510()) {
98 func_ptr = (void *)(OMAP1510_SRAM_IDLE_SUSPEND);
99 } else if (cpu_is_omap1610() || cpu_is_omap1710()) {
100 func_ptr = (void *)(OMAP1610_SRAM_IDLE_SUSPEND);
101 } else if (cpu_is_omap5912()) {
102 func_ptr = (void *)(OMAP5912_SRAM_IDLE_SUSPEND);
103 }
104 111
105 func_ptr();
106 }
107 local_fiq_enable(); 112 local_fiq_enable();
108 local_irq_enable(); 113 local_irq_enable();
109} 114}
@@ -115,58 +120,55 @@ void omap_pm_idle(void)
115 */ 120 */
116static void omap_pm_wakeup_setup(void) 121static void omap_pm_wakeup_setup(void)
117{ 122{
118 /* 123 u32 level1_wake = OMAP_IRQ_BIT(INT_IH2_IRQ);
119 * Enable ARM XOR clock and release peripheral from reset by 124 u32 level2_wake = OMAP_IRQ_BIT(INT_UART2) | OMAP_IRQ_BIT(INT_KEYBOARD);
120 * writing 1 to PER_EN bit in ARM_RSTCT2, this is required
121 * for UART configuration to use UART2 to wake up.
122 */
123
124 omap_writel(omap_readl(ARM_IDLECT2) | ENABLE_XORCLK, ARM_IDLECT2);
125 omap_writel(omap_readl(ARM_RSTCT2) | PER_EN, ARM_RSTCT2);
126 omap_writew(MODEM_32K_EN, ULPD_CLOCK_CTRL);
127 125
128 /* 126 /*
129 * Turn off all interrupts except L1-2nd level cascade, 127 * Turn off all interrupts except GPIO bank 1, L1-2nd level cascade,
130 * and the L2 wakeup interrupts: keypad and UART2. 128 * and the L2 wakeup interrupts: keypad and UART2. Note that the
129 * drivers must still separately call omap_set_gpio_wakeup() to
130 * wake up to a GPIO interrupt.
131 */ 131 */
132 if (cpu_is_omap1510() || cpu_is_omap16xx())
133 level1_wake |= OMAP_IRQ_BIT(INT_GPIO_BANK1);
134 else if (cpu_is_omap730())
135 level1_wake |= OMAP_IRQ_BIT(INT_730_GPIO_BANK1);
132 136
133 omap_writel(~IRQ_LEVEL2, OMAP_IH1_MIR); 137 omap_writel(~level1_wake, OMAP_IH1_MIR);
134 138
135 if (cpu_is_omap1510()) { 139 if (cpu_is_omap1510())
136 omap_writel(~(IRQ_UART2 | IRQ_KEYBOARD), OMAP_IH2_MIR); 140 omap_writel(~level2_wake, OMAP_IH2_MIR);
137 }
138 141
142 /* INT_1610_WAKE_UP_REQ is needed for GPIO wakeup... */
139 if (cpu_is_omap16xx()) { 143 if (cpu_is_omap16xx()) {
140 omap_writel(~(IRQ_UART2 | IRQ_KEYBOARD), OMAP_IH2_0_MIR); 144 omap_writel(~level2_wake, OMAP_IH2_0_MIR);
141 145 omap_writel(~OMAP_IRQ_BIT(INT_1610_WAKE_UP_REQ), OMAP_IH2_1_MIR);
142 omap_writel(~0x0, OMAP_IH2_1_MIR);
143 omap_writel(~0x0, OMAP_IH2_2_MIR); 146 omap_writel(~0x0, OMAP_IH2_2_MIR);
144 omap_writel(~0x0, OMAP_IH2_3_MIR); 147 omap_writel(~0x0, OMAP_IH2_3_MIR);
145 } 148 }
146 149
147 /* New IRQ agreement */ 150 /* New IRQ agreement, recalculate in cascade order */
151 omap_writel(1, OMAP_IH2_CONTROL);
148 omap_writel(1, OMAP_IH1_CONTROL); 152 omap_writel(1, OMAP_IH1_CONTROL);
149
150 /* external PULL to down, bit 22 = 0 */
151 omap_writel(omap_readl(PULL_DWN_CTRL_2) & ~(1<<22), PULL_DWN_CTRL_2);
152} 153}
153 154
154void omap_pm_suspend(void) 155void omap_pm_suspend(void)
155{ 156{
156 unsigned int mask32 = 0;
157 unsigned long arg0 = 0, arg1 = 0; 157 unsigned long arg0 = 0, arg1 = 0;
158 int (*func_ptr)(unsigned short, unsigned short) = 0;
159 unsigned short save_dsp_idlect2;
160 158
161 printk("PM: OMAP%x is entering deep sleep now ...\n", system_rev); 159 printk("PM: OMAP%x is trying to enter deep sleep...\n", system_rev);
160
161 omap_serial_wake_trigger(1);
162 162
163 if (machine_is_omap_osk()) { 163 if (machine_is_omap_osk()) {
164 /* Stop LED1 (D9) blink */ 164 /* Stop LED1 (D9) blink */
165 tps65010_set_led(LED1, OFF); 165 tps65010_set_led(LED1, OFF);
166 } 166 }
167 167
168 omap_writew(0xffff, ULPD_SOFT_DISABLE_REQ_REG);
169
168 /* 170 /*
169 * Step 1: turn off interrupts 171 * Step 1: turn off interrupts (FIXME: NOTE: already disabled)
170 */ 172 */
171 173
172 local_irq_disable(); 174 local_irq_disable();
@@ -207,6 +209,8 @@ void omap_pm_suspend(void)
207 ARM_SAVE(ARM_CKCTL); 209 ARM_SAVE(ARM_CKCTL);
208 ARM_SAVE(ARM_IDLECT1); 210 ARM_SAVE(ARM_IDLECT1);
209 ARM_SAVE(ARM_IDLECT2); 211 ARM_SAVE(ARM_IDLECT2);
212 if (!(cpu_is_omap1510()))
213 ARM_SAVE(ARM_IDLECT3);
210 ARM_SAVE(ARM_EWUPCT); 214 ARM_SAVE(ARM_EWUPCT);
211 ARM_SAVE(ARM_RSTCT1); 215 ARM_SAVE(ARM_RSTCT1);
212 ARM_SAVE(ARM_RSTCT2); 216 ARM_SAVE(ARM_RSTCT2);
@@ -214,42 +218,12 @@ void omap_pm_suspend(void)
214 ULPD_SAVE(ULPD_CLOCK_CTRL); 218 ULPD_SAVE(ULPD_CLOCK_CTRL);
215 ULPD_SAVE(ULPD_STATUS_REQ); 219 ULPD_SAVE(ULPD_STATUS_REQ);
216 220
217 /* 221 /* (Step 3 removed - we now allow deep sleep by default) */
218 * Step 3: LOW_PWR signal enabling
219 *
220 * Allow the LOW_PWR signal to be visible on MPUIO5 ball.
221 */
222 if (cpu_is_omap1510()) {
223 /* POWER_CTRL_REG = 0x1 (LOW_POWER is available) */
224 omap_writew(omap_readw(ULPD_POWER_CTRL) |
225 OMAP1510_ULPD_LOW_POWER_REQ, ULPD_POWER_CTRL);
226 } else if (cpu_is_omap16xx()) {
227 /* POWER_CTRL_REG = 0x1 (LOW_POWER is available) */
228 omap_writew(omap_readw(ULPD_POWER_CTRL) |
229 OMAP1610_ULPD_LOW_POWER_REQ, ULPD_POWER_CTRL);
230 }
231
232 /* configure LOW_PWR pin */
233 omap_cfg_reg(T20_1610_LOW_PWR);
234 222
235 /* 223 /*
236 * Step 4: OMAP DSP Shutdown 224 * Step 4: OMAP DSP Shutdown
237 */ 225 */
238 226
239 /* Set DSP_RST = 1 and DSP_EN = 0, put DSP block into reset */
240 omap_writel((omap_readl(ARM_RSTCT1) | DSP_RST) & ~DSP_ENABLE,
241 ARM_RSTCT1);
242
243 /* Set DSP boot mode to DSP-IDLE, DSP_BOOT_MODE = 0x2 */
244 omap_writel(DSP_IDLE_MODE, MPUI_DSP_BOOT_CONFIG);
245
246 /* Set EN_DSPCK = 0, stop DSP block clock */
247 omap_writel(omap_readl(ARM_CKCTL) & ~DSP_CLOCK_ENABLE, ARM_CKCTL);
248
249 /* Stop any DSP domain clocks */
250 omap_writel(omap_readl(ARM_IDLECT2) | (1<<EN_APICK), ARM_IDLECT2);
251 save_dsp_idlect2 = __raw_readw(DSP_IDLECT2);
252 __raw_writew(0, DSP_IDLECT2);
253 227
254 /* 228 /*
255 * Step 5: Wakeup Event Setup 229 * Step 5: Wakeup Event Setup
@@ -258,24 +232,9 @@ void omap_pm_suspend(void)
258 omap_pm_wakeup_setup(); 232 omap_pm_wakeup_setup();
259 233
260 /* 234 /*
261 * Step 6a: ARM and Traffic controller shutdown 235 * Step 6: ARM and Traffic controller shutdown
262 *
263 * Step 6 starts here with clock and watchdog disable
264 */ 236 */
265 237
266 /* stop clocks */
267 mask32 = omap_readl(ARM_IDLECT2);
268 mask32 &= ~(1<<EN_WDTCK); /* bit 0 -> 0 (WDT clock) */
269 mask32 |= (1<<EN_XORPCK); /* bit 1 -> 1 (XORPCK clock) */
270 mask32 &= ~(1<<EN_PERCK); /* bit 2 -> 0 (MPUPER_CK clock) */
271 mask32 &= ~(1<<EN_LCDCK); /* bit 3 -> 0 (LCDC clock) */
272 mask32 &= ~(1<<EN_LBCK); /* bit 4 -> 0 (local bus clock) */
273 mask32 |= (1<<EN_APICK); /* bit 6 -> 1 (MPUI clock) */
274 mask32 &= ~(1<<EN_TIMCK); /* bit 7 -> 0 (MPU timer clock) */
275 mask32 &= ~(1<<DMACK_REQ); /* bit 8 -> 0 (DMAC clock) */
276 mask32 &= ~(1<<EN_GPIOCK); /* bit 9 -> 0 (GPIO clock) */
277 omap_writel(mask32, ARM_IDLECT2);
278
279 /* disable ARM watchdog */ 238 /* disable ARM watchdog */
280 omap_writel(0x00F5, OMAP_WDT_TIMER_MODE); 239 omap_writel(0x00F5, OMAP_WDT_TIMER_MODE);
281 omap_writel(0x00A0, OMAP_WDT_TIMER_MODE); 240 omap_writel(0x00A0, OMAP_WDT_TIMER_MODE);
@@ -295,47 +254,24 @@ void omap_pm_suspend(void)
295 arg0 = arm_sleep_save[ARM_SLEEP_SAVE_ARM_IDLECT1]; 254 arg0 = arm_sleep_save[ARM_SLEEP_SAVE_ARM_IDLECT1];
296 arg1 = arm_sleep_save[ARM_SLEEP_SAVE_ARM_IDLECT2]; 255 arg1 = arm_sleep_save[ARM_SLEEP_SAVE_ARM_IDLECT2];
297 256
298 if (cpu_is_omap1510()) {
299 func_ptr = (void *)(OMAP1510_SRAM_API_SUSPEND);
300 } else if (cpu_is_omap1610() || cpu_is_omap1710()) {
301 func_ptr = (void *)(OMAP1610_SRAM_API_SUSPEND);
302 } else if (cpu_is_omap5912()) {
303 func_ptr = (void *)(OMAP5912_SRAM_API_SUSPEND);
304 }
305
306 /* 257 /*
307 * Step 6c: ARM and Traffic controller shutdown 258 * Step 6c: ARM and Traffic controller shutdown
308 * 259 *
309 * Jump to assembly code. The processor will stay there 260 * Jump to assembly code. The processor will stay there
310 * until wake up. 261 * until wake up.
311 */ 262 */
312 263 omap_sram_suspend(arg0, arg1);
313 func_ptr(arg0, arg1);
314 264
315 /* 265 /*
316 * If we are here, processor is woken up! 266 * If we are here, processor is woken up!
317 */ 267 */
318 268
319 if (cpu_is_omap1510()) {
320 /* POWER_CTRL_REG = 0x0 (LOW_POWER is disabled) */
321 omap_writew(omap_readw(ULPD_POWER_CTRL) &
322 ~OMAP1510_ULPD_LOW_POWER_REQ, ULPD_POWER_CTRL);
323 } else if (cpu_is_omap16xx()) {
324 /* POWER_CTRL_REG = 0x0 (LOW_POWER is disabled) */
325 omap_writew(omap_readw(ULPD_POWER_CTRL) &
326 ~OMAP1610_ULPD_LOW_POWER_REQ, ULPD_POWER_CTRL);
327 }
328
329
330 /* Restore DSP clocks */
331 omap_writel(omap_readl(ARM_IDLECT2) | (1<<EN_APICK), ARM_IDLECT2);
332 __raw_writew(save_dsp_idlect2, DSP_IDLECT2);
333 ARM_RESTORE(ARM_IDLECT2);
334
335 /* 269 /*
336 * Restore ARM state, except ARM_IDLECT1/2 which omap_cpu_suspend did 270 * Restore ARM state, except ARM_IDLECT1/2 which omap_cpu_suspend did
337 */ 271 */
338 272
273 if (!(cpu_is_omap1510()))
274 ARM_RESTORE(ARM_IDLECT3);
339 ARM_RESTORE(ARM_CKCTL); 275 ARM_RESTORE(ARM_CKCTL);
340 ARM_RESTORE(ARM_EWUPCT); 276 ARM_RESTORE(ARM_EWUPCT);
341 ARM_RESTORE(ARM_RSTCT1); 277 ARM_RESTORE(ARM_RSTCT1);
@@ -366,6 +302,8 @@ void omap_pm_suspend(void)
366 MPUI1610_RESTORE(OMAP_IH2_3_MIR); 302 MPUI1610_RESTORE(OMAP_IH2_3_MIR);
367 } 303 }
368 304
305 omap_writew(0, ULPD_SOFT_DISABLE_REQ_REG);
306
369 /* 307 /*
370 * Reenable interrupts 308 * Reenable interrupts
371 */ 309 */
@@ -373,6 +311,8 @@ void omap_pm_suspend(void)
373 local_irq_enable(); 311 local_irq_enable();
374 local_fiq_enable(); 312 local_fiq_enable();
375 313
314 omap_serial_wake_trigger(0);
315
376 printk("PM: OMAP%x is re-starting from deep sleep...\n", system_rev); 316 printk("PM: OMAP%x is re-starting from deep sleep...\n", system_rev);
377 317
378 if (machine_is_omap_osk()) { 318 if (machine_is_omap_osk()) {
@@ -401,6 +341,8 @@ static int omap_pm_read_proc(
401 ARM_SAVE(ARM_CKCTL); 341 ARM_SAVE(ARM_CKCTL);
402 ARM_SAVE(ARM_IDLECT1); 342 ARM_SAVE(ARM_IDLECT1);
403 ARM_SAVE(ARM_IDLECT2); 343 ARM_SAVE(ARM_IDLECT2);
344 if (!(cpu_is_omap1510()))
345 ARM_SAVE(ARM_IDLECT3);
404 ARM_SAVE(ARM_EWUPCT); 346 ARM_SAVE(ARM_EWUPCT);
405 ARM_SAVE(ARM_RSTCT1); 347 ARM_SAVE(ARM_RSTCT1);
406 ARM_SAVE(ARM_RSTCT2); 348 ARM_SAVE(ARM_RSTCT2);
@@ -436,6 +378,7 @@ static int omap_pm_read_proc(
436 "ARM_CKCTL_REG: 0x%-8x \n" 378 "ARM_CKCTL_REG: 0x%-8x \n"
437 "ARM_IDLECT1_REG: 0x%-8x \n" 379 "ARM_IDLECT1_REG: 0x%-8x \n"
438 "ARM_IDLECT2_REG: 0x%-8x \n" 380 "ARM_IDLECT2_REG: 0x%-8x \n"
381 "ARM_IDLECT3_REG: 0x%-8x \n"
439 "ARM_EWUPCT_REG: 0x%-8x \n" 382 "ARM_EWUPCT_REG: 0x%-8x \n"
440 "ARM_RSTCT1_REG: 0x%-8x \n" 383 "ARM_RSTCT1_REG: 0x%-8x \n"
441 "ARM_RSTCT2_REG: 0x%-8x \n" 384 "ARM_RSTCT2_REG: 0x%-8x \n"
@@ -449,6 +392,7 @@ static int omap_pm_read_proc(
449 ARM_SHOW(ARM_CKCTL), 392 ARM_SHOW(ARM_CKCTL),
450 ARM_SHOW(ARM_IDLECT1), 393 ARM_SHOW(ARM_IDLECT1),
451 ARM_SHOW(ARM_IDLECT2), 394 ARM_SHOW(ARM_IDLECT2),
395 ARM_SHOW(ARM_IDLECT3),
452 ARM_SHOW(ARM_EWUPCT), 396 ARM_SHOW(ARM_EWUPCT),
453 ARM_SHOW(ARM_RSTCT1), 397 ARM_SHOW(ARM_RSTCT1),
454 ARM_SHOW(ARM_RSTCT2), 398 ARM_SHOW(ARM_RSTCT2),
@@ -507,7 +451,7 @@ static void omap_pm_init_proc(void)
507 451
508 entry = create_proc_read_entry("driver/omap_pm", 452 entry = create_proc_read_entry("driver/omap_pm",
509 S_IWUSR | S_IRUGO, NULL, 453 S_IWUSR | S_IRUGO, NULL,
510 omap_pm_read_proc, 0); 454 omap_pm_read_proc, NULL);
511} 455}
512 456
513#endif /* DEBUG && CONFIG_PROC_FS */ 457#endif /* DEBUG && CONFIG_PROC_FS */
@@ -580,7 +524,21 @@ static int omap_pm_finish(suspend_state_t state)
580} 524}
581 525
582 526
583struct pm_ops omap_pm_ops ={ 527static irqreturn_t omap_wakeup_interrupt(int irq, void * dev,
528 struct pt_regs * regs)
529{
530 return IRQ_HANDLED;
531}
532
533static struct irqaction omap_wakeup_irq = {
534 .name = "peripheral wakeup",
535 .flags = SA_INTERRUPT,
536 .handler = omap_wakeup_interrupt
537};
538
539
540
541static struct pm_ops omap_pm_ops ={
584 .pm_disk_mode = 0, 542 .pm_disk_mode = 0,
585 .prepare = omap_pm_prepare, 543 .prepare = omap_pm_prepare,
586 .enter = omap_pm_enter, 544 .enter = omap_pm_enter,
@@ -590,42 +548,61 @@ struct pm_ops omap_pm_ops ={
590static int __init omap_pm_init(void) 548static int __init omap_pm_init(void)
591{ 549{
592 printk("Power Management for TI OMAP.\n"); 550 printk("Power Management for TI OMAP.\n");
593 pm_idle = omap_pm_idle;
594 /* 551 /*
595 * We copy the assembler sleep/wakeup routines to SRAM. 552 * We copy the assembler sleep/wakeup routines to SRAM.
596 * These routines need to be in SRAM as that's the only 553 * These routines need to be in SRAM as that's the only
597 * memory the MPU can see when it wakes up. 554 * memory the MPU can see when it wakes up.
598 */ 555 */
599
600#ifdef CONFIG_ARCH_OMAP1510
601 if (cpu_is_omap1510()) { 556 if (cpu_is_omap1510()) {
602 memcpy((void *)OMAP1510_SRAM_IDLE_SUSPEND, 557 omap_sram_idle = omap_sram_push(omap1510_idle_loop_suspend,
603 omap1510_idle_loop_suspend, 558 omap1510_idle_loop_suspend_sz);
604 omap1510_idle_loop_suspend_sz); 559 omap_sram_suspend = omap_sram_push(omap1510_cpu_suspend,
605 memcpy((void *)OMAP1510_SRAM_API_SUSPEND, omap1510_cpu_suspend, 560 omap1510_cpu_suspend_sz);
606 omap1510_cpu_suspend_sz); 561 } else if (cpu_is_omap16xx()) {
607 } else 562 omap_sram_idle = omap_sram_push(omap1610_idle_loop_suspend,
608#endif 563 omap1610_idle_loop_suspend_sz);
609 if (cpu_is_omap1610() || cpu_is_omap1710()) { 564 omap_sram_suspend = omap_sram_push(omap1610_cpu_suspend,
610 memcpy((void *)OMAP1610_SRAM_IDLE_SUSPEND, 565 omap1610_cpu_suspend_sz);
611 omap1610_idle_loop_suspend,
612 omap1610_idle_loop_suspend_sz);
613 memcpy((void *)OMAP1610_SRAM_API_SUSPEND, omap1610_cpu_suspend,
614 omap1610_cpu_suspend_sz);
615 } else if (cpu_is_omap5912()) {
616 memcpy((void *)OMAP5912_SRAM_IDLE_SUSPEND,
617 omap1610_idle_loop_suspend,
618 omap1610_idle_loop_suspend_sz);
619 memcpy((void *)OMAP5912_SRAM_API_SUSPEND, omap1610_cpu_suspend,
620 omap1610_cpu_suspend_sz);
621 } 566 }
622 567
568 if (omap_sram_idle == NULL || omap_sram_suspend == NULL) {
569 printk(KERN_ERR "PM not initialized: Missing SRAM support\n");
570 return -ENODEV;
571 }
572
573 pm_idle = omap_pm_idle;
574
575 setup_irq(INT_1610_WAKE_UP_REQ, &omap_wakeup_irq);
576#if 0
577 /* --- BEGIN BOARD-DEPENDENT CODE --- */
578 /* Sleepx mask direction */
579 omap_writew((omap_readw(0xfffb5008) & ~2), 0xfffb5008);
580 /* Unmask sleepx signal */
581 omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
582 /* --- END BOARD-DEPENDENT CODE --- */
583#endif
584
585 /* Program new power ramp-up time
586 * (0 for most boards since we don't lower voltage when in deep sleep)
587 */
588 omap_writew(ULPD_SETUP_ANALOG_CELL_3_VAL, ULPD_SETUP_ANALOG_CELL_3);
589
590 /* Setup ULPD POWER_CTRL_REG - enter deep sleep whenever possible */
591 omap_writew(ULPD_POWER_CTRL_REG_VAL, ULPD_POWER_CTRL);
592
593 /* Configure IDLECT3 */
594 if (cpu_is_omap16xx())
595 omap_writel(OMAP1610_IDLECT3_VAL, OMAP1610_IDLECT3);
596
623 pm_set_ops(&omap_pm_ops); 597 pm_set_ops(&omap_pm_ops);
624 598
625#if defined(DEBUG) && defined(CONFIG_PROC_FS) 599#if defined(DEBUG) && defined(CONFIG_PROC_FS)
626 omap_pm_init_proc(); 600 omap_pm_init_proc();
627#endif 601#endif
628 602
603 /* configure LOW_PWR pin */
604 omap_cfg_reg(T20_1610_LOW_PWR);
605
629 return 0; 606 return 0;
630} 607}
631__initcall(omap_pm_init); 608__initcall(omap_pm_init);
diff --git a/arch/arm/plat-omap/sleep.S b/arch/arm/plat-omap/sleep.S
index 279490ce772b..9f745836f6aa 100644
--- a/arch/arm/plat-omap/sleep.S
+++ b/arch/arm/plat-omap/sleep.S
@@ -66,7 +66,7 @@ ENTRY(omap1510_idle_loop_suspend)
66 @ get ARM_IDLECT2 into r2 66 @ get ARM_IDLECT2 into r2
67 ldrh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 67 ldrh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
68 mov r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff 68 mov r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff
69 orr r5,r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff00 69 orr r5, r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff00
70 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 70 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
71 71
72 @ request ARM idle 72 @ request ARM idle
@@ -76,7 +76,7 @@ ENTRY(omap1510_idle_loop_suspend)
76 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] 76 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
77 77
78 mov r5, #IDLE_WAIT_CYCLES & 0xff 78 mov r5, #IDLE_WAIT_CYCLES & 0xff
79 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00 79 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00
80l_1510: subs r5, r5, #1 80l_1510: subs r5, r5, #1
81 bne l_1510 81 bne l_1510
82/* 82/*
@@ -96,7 +96,7 @@ l_1510: subs r5, r5, #1
96 strh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 96 strh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
97 strh r1, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] 97 strh r1, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
98 98
99 ldmfd sp!, {r0 - r12, pc} @ restore regs and return 99 ldmfd sp!, {r0 - r12, pc} @ restore regs and return
100 100
101ENTRY(omap1510_idle_loop_suspend_sz) 101ENTRY(omap1510_idle_loop_suspend_sz)
102 .word . - omap1510_idle_loop_suspend 102 .word . - omap1510_idle_loop_suspend
@@ -115,8 +115,8 @@ ENTRY(omap1610_idle_loop_suspend)
115 @ turn off clock domains 115 @ turn off clock domains
116 @ get ARM_IDLECT2 into r2 116 @ get ARM_IDLECT2 into r2
117 ldrh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 117 ldrh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
118 mov r5, #OMAP1610_IDLE_CLOCK_DOMAINS & 0xff 118 mov r5, #OMAP1610_IDLECT2_SLEEP_VAL & 0xff
119 orr r5,r5, #OMAP1610_IDLE_CLOCK_DOMAINS & 0xff00 119 orr r5, r5, #OMAP1610_IDLECT2_SLEEP_VAL & 0xff00
120 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 120 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
121 121
122 @ request ARM idle 122 @ request ARM idle
@@ -126,7 +126,7 @@ ENTRY(omap1610_idle_loop_suspend)
126 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] 126 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
127 127
128 mov r5, #IDLE_WAIT_CYCLES & 0xff 128 mov r5, #IDLE_WAIT_CYCLES & 0xff
129 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00 129 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00
130l_1610: subs r5, r5, #1 130l_1610: subs r5, r5, #1
131 bne l_1610 131 bne l_1610
132/* 132/*
@@ -146,7 +146,7 @@ l_1610: subs r5, r5, #1
146 strh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 146 strh r2, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
147 strh r1, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] 147 strh r1, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
148 148
149 ldmfd sp!, {r0 - r12, pc} @ restore regs and return 149 ldmfd sp!, {r0 - r12, pc} @ restore regs and return
150 150
151ENTRY(omap1610_idle_loop_suspend_sz) 151ENTRY(omap1610_idle_loop_suspend_sz)
152 .word . - omap1610_idle_loop_suspend 152 .word . - omap1610_idle_loop_suspend
@@ -208,7 +208,7 @@ ENTRY(omap1510_cpu_suspend)
208 208
209 @ turn off clock domains 209 @ turn off clock domains
210 mov r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff 210 mov r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff
211 orr r5,r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff00 211 orr r5, r5, #OMAP1510_IDLE_CLOCK_DOMAINS & 0xff00
212 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 212 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
213 213
214 @ request ARM idle 214 @ request ARM idle
@@ -217,7 +217,7 @@ ENTRY(omap1510_cpu_suspend)
217 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] 217 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
218 218
219 mov r5, #IDLE_WAIT_CYCLES & 0xff 219 mov r5, #IDLE_WAIT_CYCLES & 0xff
220 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00 220 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00
221l_1510_2: 221l_1510_2:
222 subs r5, r5, #1 222 subs r5, r5, #1
223 bne l_1510_2 223 bne l_1510_2
@@ -237,7 +237,7 @@ l_1510_2:
237 strh r0, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] 237 strh r0, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
238 238
239 @ restore regs and return 239 @ restore regs and return
240 ldmfd sp!, {r0 - r12, pc} 240 ldmfd sp!, {r0 - r12, pc}
241 241
242ENTRY(omap1510_cpu_suspend_sz) 242ENTRY(omap1510_cpu_suspend_sz)
243 .word . - omap1510_cpu_suspend 243 .word . - omap1510_cpu_suspend
@@ -249,21 +249,26 @@ ENTRY(omap1610_cpu_suspend)
249 @ save registers on stack 249 @ save registers on stack
250 stmfd sp!, {r0 - r12, lr} 250 stmfd sp!, {r0 - r12, lr}
251 251
252 @ Drain write cache
253 mov r4, #0
254 mcr p15, 0, r0, c7, c10, 4
255 nop
256
252 @ load base address of Traffic Controller 257 @ load base address of Traffic Controller
253 mov r4, #TCMIF_ASM_BASE & 0xff000000 258 mov r6, #TCMIF_ASM_BASE & 0xff000000
254 orr r4, r4, #TCMIF_ASM_BASE & 0x00ff0000 259 orr r6, r6, #TCMIF_ASM_BASE & 0x00ff0000
255 orr r4, r4, #TCMIF_ASM_BASE & 0x0000ff00 260 orr r6, r6, #TCMIF_ASM_BASE & 0x0000ff00
256 261
257 @ prepare to put SDRAM into self-refresh manually 262 @ prepare to put SDRAM into self-refresh manually
258 ldr r5, [r4, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff] 263 ldr r7, [r6, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff]
259 orr r5, r5, #SELF_REFRESH_MODE & 0xff000000 264 orr r9, r7, #SELF_REFRESH_MODE & 0xff000000
260 orr r5, r5, #SELF_REFRESH_MODE & 0x000000ff 265 orr r9, r9, #SELF_REFRESH_MODE & 0x000000ff
261 str r5, [r4, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff] 266 str r9, [r6, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff]
262 267
263 @ prepare to put EMIFS to Sleep 268 @ prepare to put EMIFS to Sleep
264 ldr r5, [r4, #EMIFS_CONFIG_ASM_OFFSET & 0xff] 269 ldr r8, [r6, #EMIFS_CONFIG_ASM_OFFSET & 0xff]
265 orr r5, r5, #IDLE_EMIFS_REQUEST & 0xff 270 orr r9, r8, #IDLE_EMIFS_REQUEST & 0xff
266 str r5, [r4, #EMIFS_CONFIG_ASM_OFFSET & 0xff] 271 str r9, [r6, #EMIFS_CONFIG_ASM_OFFSET & 0xff]
267 272
268 @ load base address of ARM_IDLECT1 and ARM_IDLECT2 273 @ load base address of ARM_IDLECT1 and ARM_IDLECT2
269 mov r4, #CLKGEN_REG_ASM_BASE & 0xff000000 274 mov r4, #CLKGEN_REG_ASM_BASE & 0xff000000
@@ -271,26 +276,22 @@ ENTRY(omap1610_cpu_suspend)
271 orr r4, r4, #CLKGEN_REG_ASM_BASE & 0x0000ff00 276 orr r4, r4, #CLKGEN_REG_ASM_BASE & 0x0000ff00
272 277
273 @ turn off clock domains 278 @ turn off clock domains
274 mov r5, #OMAP1610_IDLE_CLOCK_DOMAINS & 0xff 279 @ do not disable PERCK (0x04)
275 orr r5,r5, #OMAP1610_IDLE_CLOCK_DOMAINS & 0xff00 280 mov r5, #OMAP1610_IDLECT2_SLEEP_VAL & 0xff
276 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 281 orr r5, r5, #OMAP1610_IDLECT2_SLEEP_VAL & 0xff00
277
278 @ work around errata of OMAP1610/5912. Enable (!) peripheral
279 @ clock to let the chip go into deep sleep
280 ldrh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
281 orr r5,r5, #EN_PERCK_BIT & 0xff
282 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 282 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
283 283
284 @ request ARM idle 284 @ request ARM idle
285 mov r3, #OMAP1610_DEEP_SLEEP_REQUEST & 0xff 285 mov r3, #OMAP1610_IDLECT1_SLEEP_VAL & 0xff
286 orr r3, r3, #OMAP1610_DEEP_SLEEP_REQUEST & 0xff00 286 orr r3, r3, #OMAP1610_IDLECT1_SLEEP_VAL & 0xff00
287 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] 287 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
288 288
289 mov r5, #IDLE_WAIT_CYCLES & 0xff 289 @ disable instruction cache
290 orr r5, r5, #IDLE_WAIT_CYCLES & 0xff00 290 mrc p15, 0, r9, c1, c0, 0
291l_1610_2: 291 bic r2, r9, #0x1000
292 subs r5, r5, #1 292 mcr p15, 0, r2, c1, c0, 0
293 bne l_1610_2 293 nop
294
294/* 295/*
295 * Let's wait for the next wake up event to wake us up. r0 can't be 296 * Let's wait for the next wake up event to wake us up. r0 can't be
296 * used here because r0 holds ARM_IDLECT1 297 * used here because r0 holds ARM_IDLECT1
@@ -301,13 +302,21 @@ l_1610_2:
301 * omap1610_cpu_suspend()'s resume point. 302 * omap1610_cpu_suspend()'s resume point.
302 * 303 *
303 * It will just start executing here, so we'll restore stuff from the 304 * It will just start executing here, so we'll restore stuff from the
304 * stack, reset the ARM_IDLECT1 and ARM_IDLECT2. 305 * stack.
305 */ 306 */
307 @ re-enable Icache
308 mcr p15, 0, r9, c1, c0, 0
309
310 @ reset the ARM_IDLECT1 and ARM_IDLECT2.
306 strh r1, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff] 311 strh r1, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
307 strh r0, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff] 312 strh r0, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
308 313
314 @ Restore EMIFF controls
315 str r7, [r6, #EMIFF_SDRAM_CONFIG_ASM_OFFSET & 0xff]
316 str r8, [r6, #EMIFS_CONFIG_ASM_OFFSET & 0xff]
317
309 @ restore regs and return 318 @ restore regs and return
310 ldmfd sp!, {r0 - r12, pc} 319 ldmfd sp!, {r0 - r12, pc}
311 320
312ENTRY(omap1610_cpu_suspend_sz) 321ENTRY(omap1610_cpu_suspend_sz)
313 .word . - omap1610_cpu_suspend 322 .word . - omap1610_cpu_suspend
diff --git a/arch/arm/plat-omap/sram-fn.S b/arch/arm/plat-omap/sram-fn.S
new file mode 100644
index 000000000000..4bea36964a00
--- /dev/null
+++ b/arch/arm/plat-omap/sram-fn.S
@@ -0,0 +1,58 @@
1/*
2 * linux/arch/arm/plat-omap/sram.S
3 *
4 * Functions that need to be run in internal SRAM
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/config.h>
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14#include <asm/arch/io.h>
15#include <asm/arch/hardware.h>
16
17 .text
18
19/*
20 * Reprograms ULPD and CKCTL.
21 */
22ENTRY(sram_reprogram_clock)
23 stmfd sp!, {r0 - r12, lr} @ save registers on stack
24
25 mov r2, #IO_ADDRESS(DPLL_CTL) & 0xff000000
26 orr r2, r2, #IO_ADDRESS(DPLL_CTL) & 0x00ff0000
27 orr r2, r2, #IO_ADDRESS(DPLL_CTL) & 0x0000ff00
28
29 mov r3, #IO_ADDRESS(ARM_CKCTL) & 0xff000000
30 orr r3, r3, #IO_ADDRESS(ARM_CKCTL) & 0x00ff0000
31 orr r3, r3, #IO_ADDRESS(ARM_CKCTL) & 0x0000ff00
32
33 tst r0, #1 << 4 @ want lock mode?
34 beq newck @ nope
35 bic r0, r0, #1 << 4 @ else clear lock bit
36 strh r0, [r2] @ set dpll into bypass mode
37 orr r0, r0, #1 << 4 @ set lock bit again
38
39newck:
40 strh r1, [r3] @ write new ckctl value
41 strh r0, [r2] @ write new dpll value
42
43 mov r4, #0x0700 @ let the clocks settle
44 orr r4, r4, #0x00ff
45delay: sub r4, r4, #1
46 cmp r4, #0
47 bne delay
48
49lock: ldrh r4, [r2], #0 @ read back dpll value
50 tst r0, #1 << 4 @ want lock mode?
51 beq out @ nope
52 tst r4, #1 << 0 @ dpll rate locked?
53 beq lock @ try again
54
55out:
56 ldmfd sp!, {r0 - r12, pc} @ restore regs and return
57ENTRY(sram_reprogram_clock_sz)
58 .word . - sram_reprogram_clock
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
new file mode 100644
index 000000000000..7719a4062e3a
--- /dev/null
+++ b/arch/arm/plat-omap/sram.c
@@ -0,0 +1,116 @@
1/*
2 * linux/arch/arm/plat-omap/sram.c
3 *
4 * OMAP SRAM detection and management
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 * Written by Tony Lindgren <tony@atomide.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/config.h>
15#include <linux/module.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/mach/map.h>
20#include <asm/io.h>
21#include <asm/cacheflush.h>
22
23#include "sram.h"
24
25#define OMAP1_SRAM_BASE 0xd0000000
26#define OMAP1_SRAM_START 0x20000000
27#define SRAM_BOOTLOADER_SZ 0x80
28
29static unsigned long omap_sram_base;
30static unsigned long omap_sram_size;
31static unsigned long omap_sram_ceil;
32
33/*
34 * The amount of SRAM depends on the core type:
35 * 730 = 200K, 1510 = 512K, 5912 = 256K, 1610 = 16K, 1710 = 16K
36 * Note that we cannot try to test for SRAM here because writes
37 * to secure SRAM will hang the system. Also the SRAM is not
38 * yet mapped at this point.
39 */
40void __init omap_detect_sram(void)
41{
42 omap_sram_base = OMAP1_SRAM_BASE;
43
44 if (cpu_is_omap730())
45 omap_sram_size = 0x32000;
46 else if (cpu_is_omap1510())
47 omap_sram_size = 0x80000;
48 else if (cpu_is_omap1610() || cpu_is_omap1621() || cpu_is_omap1710())
49 omap_sram_size = 0x4000;
50 else if (cpu_is_omap1611())
51 omap_sram_size = 0x3e800;
52 else {
53 printk(KERN_ERR "Could not detect SRAM size\n");
54 omap_sram_size = 0x4000;
55 }
56
57 printk(KERN_INFO "SRAM size: 0x%lx\n", omap_sram_size);
58 omap_sram_ceil = omap_sram_base + omap_sram_size;
59}
60
61static struct map_desc omap_sram_io_desc[] __initdata = {
62 { OMAP1_SRAM_BASE, OMAP1_SRAM_START, 0, MT_DEVICE }
63};
64
65/*
66 * In order to use last 2kB of SRAM on 1611b, we must round the size
67 * up to multiple of PAGE_SIZE. We cannot use ioremap for SRAM, as
68 * clock init needs SRAM early.
69 */
70void __init omap_map_sram(void)
71{
72 if (omap_sram_size == 0)
73 return;
74
75 omap_sram_io_desc[0].length = (omap_sram_size + PAGE_SIZE-1)/PAGE_SIZE;
76 omap_sram_io_desc[0].length *= PAGE_SIZE;
77 iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
78
79 /*
80 * Looks like we need to preserve some bootloader code at the
81 * beginning of SRAM for jumping to flash for reboot to work...
82 */
83 memset((void *)omap_sram_base + SRAM_BOOTLOADER_SZ, 0,
84 omap_sram_size - SRAM_BOOTLOADER_SZ);
85}
86
87static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl) = NULL;
88
89void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
90{
91 if (_omap_sram_reprogram_clock == NULL)
92 panic("Cannot use SRAM");
93
94 return _omap_sram_reprogram_clock(dpllctl, ckctl);
95}
96
97void * omap_sram_push(void * start, unsigned long size)
98{
99 if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
100 printk(KERN_ERR "Not enough space in SRAM\n");
101 return NULL;
102 }
103 omap_sram_ceil -= size;
104 omap_sram_ceil &= ~0x3;
105 memcpy((void *)omap_sram_ceil, start, size);
106
107 return (void *)omap_sram_ceil;
108}
109
110void __init omap_sram_init(void)
111{
112 omap_detect_sram();
113 omap_map_sram();
114 _omap_sram_reprogram_clock = omap_sram_push(sram_reprogram_clock,
115 sram_reprogram_clock_sz);
116}
diff --git a/arch/arm/plat-omap/sram.h b/arch/arm/plat-omap/sram.h
new file mode 100644
index 000000000000..71984efa6ae8
--- /dev/null
+++ b/arch/arm/plat-omap/sram.h
@@ -0,0 +1,21 @@
1/*
2 * linux/arch/arm/plat-omap/sram.h
3 *
4 * Interface for functions that need to be run in internal SRAM
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ARCH_ARM_OMAP_SRAM_H
12#define __ARCH_ARM_OMAP_SRAM_H
13
14extern void * omap_sram_push(void * start, unsigned long size);
15extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
16
17/* Do not use these */
18extern void sram_reprogram_clock(u32 ckctl, u32 dpllctl);
19extern unsigned long sram_reprogram_clock_sz;
20
21#endif
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index 25bc4a8dd763..98f1c76f8660 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -41,6 +41,7 @@
41 41
42/* These routines should handle the standard chip-specific modes 42/* These routines should handle the standard chip-specific modes
43 * for usb0/1/2 ports, covering basic mux and transceiver setup. 43 * for usb0/1/2 ports, covering basic mux and transceiver setup.
44 * Call omap_usb_init() once, from INIT_MACHINE().
44 * 45 *
45 * Some board-*.c files will need to set up additional mux options, 46 * Some board-*.c files will need to set up additional mux options,
46 * like for suspend handling, vbus sensing, GPIOs, and the D+ pullup. 47 * like for suspend handling, vbus sensing, GPIOs, and the D+ pullup.
diff --git a/arch/arm26/Kconfig b/arch/arm26/Kconfig
index 1f0373267306..1f00b3d03a07 100644
--- a/arch/arm26/Kconfig
+++ b/arch/arm26/Kconfig
@@ -55,6 +55,10 @@ config GENERIC_BUST_SPINLOCK
55config GENERIC_ISA_DMA 55config GENERIC_ISA_DMA
56 bool 56 bool
57 57
58config ARCH_MAY_HAVE_PC_FDC
59 bool
60 default y
61
58source "init/Kconfig" 62source "init/Kconfig"
59 63
60 64
diff --git a/arch/arm26/Makefile b/arch/arm26/Makefile
index ada8985530a5..e9cb8ef4f3fb 100644
--- a/arch/arm26/Makefile
+++ b/arch/arm26/Makefile
@@ -17,10 +17,6 @@ ifeq ($(CONFIG_FRAME_POINTER),y)
17CFLAGS +=-fno-omit-frame-pointer -mno-sched-prolog 17CFLAGS +=-fno-omit-frame-pointer -mno-sched-prolog
18endif 18endif
19 19
20ifeq ($(CONFIG_DEBUG_INFO),y)
21CFLAGS +=-g
22endif
23
24CFLAGS_BOOT :=-mapcs-26 -mcpu=arm3 -msoft-float -Uarm 20CFLAGS_BOOT :=-mapcs-26 -mcpu=arm3 -msoft-float -Uarm
25CFLAGS +=-mapcs-26 -mcpu=arm3 -msoft-float -Uarm 21CFLAGS +=-mapcs-26 -mcpu=arm3 -msoft-float -Uarm
26AFLAGS +=-mapcs-26 -mcpu=arm3 -msoft-float 22AFLAGS +=-mapcs-26 -mcpu=arm3 -msoft-float
diff --git a/arch/arm26/kernel/time.c b/arch/arm26/kernel/time.c
index 549a6b2e177e..e66aedd02fad 100644
--- a/arch/arm26/kernel/time.c
+++ b/arch/arm26/kernel/time.c
@@ -114,7 +114,7 @@ static unsigned long next_rtc_update;
114 */ 114 */
115static inline void do_set_rtc(void) 115static inline void do_set_rtc(void)
116{ 116{
117 if (time_status & STA_UNSYNC || set_rtc == NULL) 117 if (!ntp_synced() || set_rtc == NULL)
118 return; 118 return;
119 119
120//FIXME - timespec.tv_sec is a time_t not unsigned long 120//FIXME - timespec.tv_sec is a time_t not unsigned long
@@ -189,10 +189,7 @@ int do_settimeofday(struct timespec *tv)
189 189
190 xtime.tv_sec = tv->tv_sec; 190 xtime.tv_sec = tv->tv_sec;
191 xtime.tv_nsec = tv->tv_nsec; 191 xtime.tv_nsec = tv->tv_nsec;
192 time_adjust = 0; /* stop active adjtime() */ 192 ntp_clear();
193 time_status |= STA_UNSYNC;
194 time_maxerror = NTP_PHASE_LIMIT;
195 time_esterror = NTP_PHASE_LIMIT;
196 write_sequnlock_irq(&xtime_lock); 193 write_sequnlock_irq(&xtime_lock);
197 clock_was_set(); 194 clock_was_set();
198 return 0; 195 return 0;
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 6b7b4e0802e3..dc3dfe9b4a1a 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -240,7 +240,7 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
240 * The division here is not time critical since it will run once in 240 * The division here is not time critical since it will run once in
241 * 11 minutes 241 * 11 minutes
242 */ 242 */
243 if ((time_status & STA_UNSYNC) == 0 && 243 if (ntp_synced() &&
244 xtime.tv_sec > last_rtc_update + 660 && 244 xtime.tv_sec > last_rtc_update + 660 &&
245 (xtime.tv_nsec / 1000) >= 500000 - (tick_nsec / 1000) / 2 && 245 (xtime.tv_nsec / 1000) >= 500000 - (tick_nsec / 1000) / 2 &&
246 (xtime.tv_nsec / 1000) <= 500000 + (tick_nsec / 1000) / 2) { 246 (xtime.tv_nsec / 1000) <= 500000 + (tick_nsec / 1000) / 2) {
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index fa2d4323da25..a2d99b4aedcd 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -114,10 +114,7 @@ int do_settimeofday(struct timespec *tv)
114 set_normalized_timespec(&xtime, sec, nsec); 114 set_normalized_timespec(&xtime, sec, nsec);
115 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 115 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
116 116
117 time_adjust = 0; /* stop active adjtime() */ 117 ntp_clear();
118 time_status |= STA_UNSYNC;
119 time_maxerror = NTP_PHASE_LIMIT;
120 time_esterror = NTP_PHASE_LIMIT;
121 write_sequnlock_irq(&xtime_lock); 118 write_sequnlock_irq(&xtime_lock);
122 clock_was_set(); 119 clock_was_set();
123 return 0; 120 return 0;
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 075db6644694..8d6558b00e44 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -85,7 +85,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
85 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 85 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
86 * called as close as possible to 500 ms before the new second starts. 86 * called as close as possible to 500 ms before the new second starts.
87 */ 87 */
88 if ((time_status & STA_UNSYNC) == 0 && 88 if (ntp_synced() &&
89 xtime.tv_sec > last_rtc_update + 660 && 89 xtime.tv_sec > last_rtc_update + 660 &&
90 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 90 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
91 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2 91 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2
@@ -216,10 +216,7 @@ int do_settimeofday(struct timespec *tv)
216 set_normalized_timespec(&xtime, sec, nsec); 216 set_normalized_timespec(&xtime, sec, nsec);
217 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 217 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
218 218
219 time_adjust = 0; /* stop active adjtime() */ 219 ntp_clear();
220 time_status |= STA_UNSYNC;
221 time_maxerror = NTP_PHASE_LIMIT;
222 time_esterror = NTP_PHASE_LIMIT;
223 write_sequnlock_irq(&xtime_lock); 220 write_sequnlock_irq(&xtime_lock);
224 clock_was_set(); 221 clock_was_set();
225 return 0; 222 return 0;
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
index 8a600218334d..af8c5d2057dd 100644
--- a/arch/h8300/kernel/time.c
+++ b/arch/h8300/kernel/time.c
@@ -116,10 +116,7 @@ int do_settimeofday(struct timespec *tv)
116 116
117 xtime.tv_sec = tv->tv_sec; 117 xtime.tv_sec = tv->tv_sec;
118 xtime.tv_nsec = tv->tv_nsec; 118 xtime.tv_nsec = tv->tv_nsec;
119 time_adjust = 0; /* stop active adjtime() */ 119 ntp_clear();
120 time_status |= STA_UNSYNC;
121 time_maxerror = NTP_PHASE_LIMIT;
122 time_esterror = NTP_PHASE_LIMIT;
123 write_sequnlock_irq(&xtime_lock); 120 write_sequnlock_irq(&xtime_lock);
124 clock_was_set(); 121 clock_was_set();
125 return 0; 122 return 0;
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 3b3b017e1c15..b22f003eaa6d 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -37,6 +37,10 @@ config GENERIC_IOMAP
37 bool 37 bool
38 default y 38 default y
39 39
40config ARCH_MAY_HAVE_PC_FDC
41 bool
42 default y
43
40source "init/Kconfig" 44source "init/Kconfig"
41 45
42menu "Processor type and features" 46menu "Processor type and features"
@@ -1208,7 +1212,6 @@ config PCI_DIRECT
1208config PCI_MMCONFIG 1212config PCI_MMCONFIG
1209 bool 1213 bool
1210 depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) 1214 depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
1211 select ACPI_BOOT
1212 default y 1215 default y
1213 1216
1214source "drivers/pci/pcie/Kconfig" 1217source "drivers/pci/pcie/Kconfig"
@@ -1318,6 +1321,11 @@ config GENERIC_IRQ_PROBE
1318 bool 1321 bool
1319 default y 1322 default y
1320 1323
1324config GENERIC_PENDING_IRQ
1325 bool
1326 depends on GENERIC_HARDIRQS && SMP
1327 default y
1328
1321config X86_SMP 1329config X86_SMP
1322 bool 1330 bool
1323 depends on SMP && !X86_VOYAGER 1331 depends on SMP && !X86_VOYAGER
diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S
index 8cb420f40c58..ca668d9df164 100644
--- a/arch/i386/boot/setup.S
+++ b/arch/i386/boot/setup.S
@@ -82,7 +82,7 @@ start:
82# This is the setup header, and it must start at %cs:2 (old 0x9020:2) 82# This is the setup header, and it must start at %cs:2 (old 0x9020:2)
83 83
84 .ascii "HdrS" # header signature 84 .ascii "HdrS" # header signature
85 .word 0x0203 # header version number (>= 0x0105) 85 .word 0x0204 # header version number (>= 0x0105)
86 # or else old loadlin-1.5 will fail) 86 # or else old loadlin-1.5 will fail)
87realmode_swtch: .word 0, 0 # default_switch, SETUPSEG 87realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
88start_sys_seg: .word SYSSEG 88start_sys_seg: .word SYSSEG
diff --git a/arch/i386/boot/tools/build.c b/arch/i386/boot/tools/build.c
index 6835f6d47c31..05798419a6a9 100644
--- a/arch/i386/boot/tools/build.c
+++ b/arch/i386/boot/tools/build.c
@@ -177,7 +177,9 @@ int main(int argc, char ** argv)
177 die("Output: seek failed"); 177 die("Output: seek failed");
178 buf[0] = (sys_size & 0xff); 178 buf[0] = (sys_size & 0xff);
179 buf[1] = ((sys_size >> 8) & 0xff); 179 buf[1] = ((sys_size >> 8) & 0xff);
180 if (write(1, buf, 2) != 2) 180 buf[2] = ((sys_size >> 16) & 0xff);
181 buf[3] = ((sys_size >> 24) & 0xff);
182 if (write(1, buf, 4) != 4)
181 die("Write of image length failed"); 183 die("Write of image length failed");
182 184
183 return 0; /* Everything is OK */ 185 return 0; /* Everything is OK */
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index ca07b95c06b8..6a431b926019 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -131,8 +131,6 @@ CONFIG_SOFTWARE_SUSPEND=y
131# ACPI (Advanced Configuration and Power Interface) Support 131# ACPI (Advanced Configuration and Power Interface) Support
132# 132#
133CONFIG_ACPI=y 133CONFIG_ACPI=y
134CONFIG_ACPI_BOOT=y
135CONFIG_ACPI_INTERPRETER=y
136CONFIG_ACPI_SLEEP=y 134CONFIG_ACPI_SLEEP=y
137CONFIG_ACPI_SLEEP_PROC_FS=y 135CONFIG_ACPI_SLEEP_PROC_FS=y
138CONFIG_ACPI_AC=y 136CONFIG_ACPI_AC=y
@@ -144,10 +142,8 @@ CONFIG_ACPI_THERMAL=y
144# CONFIG_ACPI_ASUS is not set 142# CONFIG_ACPI_ASUS is not set
145# CONFIG_ACPI_TOSHIBA is not set 143# CONFIG_ACPI_TOSHIBA is not set
146# CONFIG_ACPI_DEBUG is not set 144# CONFIG_ACPI_DEBUG is not set
147CONFIG_ACPI_BUS=y
148CONFIG_ACPI_EC=y 145CONFIG_ACPI_EC=y
149CONFIG_ACPI_POWER=y 146CONFIG_ACPI_POWER=y
150CONFIG_ACPI_PCI=y
151CONFIG_ACPI_SYSTEM=y 147CONFIG_ACPI_SYSTEM=y
152# CONFIG_X86_PM_TIMER is not set 148# CONFIG_X86_PM_TIMER is not set
153 149
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 64682a0edacf..f10de0f2c5e6 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -11,7 +11,7 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
11 11
12obj-y += cpu/ 12obj-y += cpu/
13obj-y += timers/ 13obj-y += timers/
14obj-$(CONFIG_ACPI_BOOT) += acpi/ 14obj-$(CONFIG_ACPI) += acpi/
15obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o 15obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o
16obj-$(CONFIG_MCA) += mca.o 16obj-$(CONFIG_MCA) += mca.o
17obj-$(CONFIG_X86_MSR) += msr.o 17obj-$(CONFIG_X86_MSR) += msr.o
diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile
index 5e291a20c03d..267ca48e1b6c 100644
--- a/arch/i386/kernel/acpi/Makefile
+++ b/arch/i386/kernel/acpi/Makefile
@@ -1,4 +1,4 @@
1obj-$(CONFIG_ACPI_BOOT) := boot.o 1obj-y := boot.o
2obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o 2obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o
3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o 3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
4 4
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 34ee500c26e5..a63351c085c6 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -40,19 +40,25 @@
40 40
41#ifdef CONFIG_X86_64 41#ifdef CONFIG_X86_64
42 42
43static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id) { } 43static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
44{
45}
44extern void __init clustered_apic_check(void); 46extern void __init clustered_apic_check(void);
45static inline int ioapic_setup_disabled(void) { return 0; } 47static inline int ioapic_setup_disabled(void)
48{
49 return 0;
50}
51
46#include <asm/proto.h> 52#include <asm/proto.h>
47 53
48#else /* X86 */ 54#else /* X86 */
49 55
50#ifdef CONFIG_X86_LOCAL_APIC 56#ifdef CONFIG_X86_LOCAL_APIC
51#include <mach_apic.h> 57#include <mach_apic.h>
52#include <mach_mpparse.h> 58#include <mach_mpparse.h>
53#endif /* CONFIG_X86_LOCAL_APIC */ 59#endif /* CONFIG_X86_LOCAL_APIC */
54 60
55#endif /* X86 */ 61#endif /* X86 */
56 62
57#define BAD_MADT_ENTRY(entry, end) ( \ 63#define BAD_MADT_ENTRY(entry, end) ( \
58 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ 64 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
@@ -60,13 +66,8 @@ static inline int ioapic_setup_disabled(void) { return 0; }
60 66
61#define PREFIX "ACPI: " 67#define PREFIX "ACPI: "
62 68
63#ifdef CONFIG_ACPI_PCI
64int acpi_noirq __initdata; /* skip ACPI IRQ initialization */ 69int acpi_noirq __initdata; /* skip ACPI IRQ initialization */
65int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */ 70int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */
66#else
67int acpi_noirq __initdata = 1;
68int acpi_pci_disabled __initdata = 1;
69#endif
70int acpi_ht __initdata = 1; /* enable HT */ 71int acpi_ht __initdata = 1; /* enable HT */
71 72
72int acpi_lapic; 73int acpi_lapic;
@@ -88,7 +89,7 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
88 89
89#define MAX_MADT_ENTRIES 256 90#define MAX_MADT_ENTRIES 256
90u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = 91u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
91 { [0 ... MAX_MADT_ENTRIES-1] = 0xff }; 92 {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
92EXPORT_SYMBOL(x86_acpiid_to_apicid); 93EXPORT_SYMBOL(x86_acpiid_to_apicid);
93 94
94/* -------------------------------------------------------------------------- 95/* --------------------------------------------------------------------------
@@ -99,7 +100,7 @@ EXPORT_SYMBOL(x86_acpiid_to_apicid);
99 * The default interrupt routing model is PIC (8259). This gets 100 * The default interrupt routing model is PIC (8259). This gets
100 * overriden if IOAPICs are enumerated (below). 101 * overriden if IOAPICs are enumerated (below).
101 */ 102 */
102enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; 103enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
103 104
104#ifdef CONFIG_X86_64 105#ifdef CONFIG_X86_64
105 106
@@ -107,7 +108,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
107char *__acpi_map_table(unsigned long phys_addr, unsigned long size) 108char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
108{ 109{
109 if (!phys_addr || !size) 110 if (!phys_addr || !size)
110 return NULL; 111 return NULL;
111 112
112 if (phys_addr < (end_pfn_map << PAGE_SHIFT)) 113 if (phys_addr < (end_pfn_map << PAGE_SHIFT))
113 return __va(phys_addr); 114 return __va(phys_addr);
@@ -134,8 +135,8 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
134 unsigned long base, offset, mapped_size; 135 unsigned long base, offset, mapped_size;
135 int idx; 136 int idx;
136 137
137 if (phys + size < 8*1024*1024) 138 if (phys + size < 8 * 1024 * 1024)
138 return __va(phys); 139 return __va(phys);
139 140
140 offset = phys & (PAGE_SIZE - 1); 141 offset = phys & (PAGE_SIZE - 1);
141 mapped_size = PAGE_SIZE - offset; 142 mapped_size = PAGE_SIZE - offset;
@@ -154,7 +155,7 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
154 mapped_size += PAGE_SIZE; 155 mapped_size += PAGE_SIZE;
155 } 156 }
156 157
157 return ((unsigned char *) base + offset); 158 return ((unsigned char *)base + offset);
158} 159}
159#endif 160#endif
160 161
@@ -172,7 +173,7 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
172 if (!phys_addr || !size) 173 if (!phys_addr || !size)
173 return -EINVAL; 174 return -EINVAL;
174 175
175 mcfg = (struct acpi_table_mcfg *) __acpi_map_table(phys_addr, size); 176 mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size);
176 if (!mcfg) { 177 if (!mcfg) {
177 printk(KERN_WARNING PREFIX "Unable to map MCFG\n"); 178 printk(KERN_WARNING PREFIX "Unable to map MCFG\n");
178 return -ENODEV; 179 return -ENODEV;
@@ -209,20 +210,17 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
209 210
210 return 0; 211 return 0;
211} 212}
212#endif /* CONFIG_PCI_MMCONFIG */ 213#endif /* CONFIG_PCI_MMCONFIG */
213 214
214#ifdef CONFIG_X86_LOCAL_APIC 215#ifdef CONFIG_X86_LOCAL_APIC
215static int __init 216static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
216acpi_parse_madt (
217 unsigned long phys_addr,
218 unsigned long size)
219{ 217{
220 struct acpi_table_madt *madt = NULL; 218 struct acpi_table_madt *madt = NULL;
221 219
222 if (!phys_addr || !size) 220 if (!phys_addr || !size)
223 return -EINVAL; 221 return -EINVAL;
224 222
225 madt = (struct acpi_table_madt *) __acpi_map_table(phys_addr, size); 223 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
226 if (!madt) { 224 if (!madt) {
227 printk(KERN_WARNING PREFIX "Unable to map MADT\n"); 225 printk(KERN_WARNING PREFIX "Unable to map MADT\n");
228 return -ENODEV; 226 return -ENODEV;
@@ -232,22 +230,20 @@ acpi_parse_madt (
232 acpi_lapic_addr = (u64) madt->lapic_address; 230 acpi_lapic_addr = (u64) madt->lapic_address;
233 231
234 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n", 232 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
235 madt->lapic_address); 233 madt->lapic_address);
236 } 234 }
237 235
238 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); 236 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
239 237
240 return 0; 238 return 0;
241} 239}
242 240
243
244static int __init 241static int __init
245acpi_parse_lapic ( 242acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
246 acpi_table_entry_header *header, const unsigned long end)
247{ 243{
248 struct acpi_table_lapic *processor = NULL; 244 struct acpi_table_lapic *processor = NULL;
249 245
250 processor = (struct acpi_table_lapic*) header; 246 processor = (struct acpi_table_lapic *)header;
251 247
252 if (BAD_MADT_ENTRY(processor, end)) 248 if (BAD_MADT_ENTRY(processor, end))
253 return -EINVAL; 249 return -EINVAL;
@@ -260,20 +256,19 @@ acpi_parse_lapic (
260 256
261 x86_acpiid_to_apicid[processor->acpi_id] = processor->id; 257 x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
262 258
263 mp_register_lapic ( 259 mp_register_lapic(processor->id, /* APIC ID */
264 processor->id, /* APIC ID */ 260 processor->flags.enabled); /* Enabled? */
265 processor->flags.enabled); /* Enabled? */
266 261
267 return 0; 262 return 0;
268} 263}
269 264
270static int __init 265static int __init
271acpi_parse_lapic_addr_ovr ( 266acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
272 acpi_table_entry_header *header, const unsigned long end) 267 const unsigned long end)
273{ 268{
274 struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL; 269 struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
275 270
276 lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr*) header; 271 lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header;
277 272
278 if (BAD_MADT_ENTRY(lapic_addr_ovr, end)) 273 if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
279 return -EINVAL; 274 return -EINVAL;
@@ -284,12 +279,11 @@ acpi_parse_lapic_addr_ovr (
284} 279}
285 280
286static int __init 281static int __init
287acpi_parse_lapic_nmi ( 282acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
288 acpi_table_entry_header *header, const unsigned long end)
289{ 283{
290 struct acpi_table_lapic_nmi *lapic_nmi = NULL; 284 struct acpi_table_lapic_nmi *lapic_nmi = NULL;
291 285
292 lapic_nmi = (struct acpi_table_lapic_nmi*) header; 286 lapic_nmi = (struct acpi_table_lapic_nmi *)header;
293 287
294 if (BAD_MADT_ENTRY(lapic_nmi, end)) 288 if (BAD_MADT_ENTRY(lapic_nmi, end))
295 return -EINVAL; 289 return -EINVAL;
@@ -302,37 +296,32 @@ acpi_parse_lapic_nmi (
302 return 0; 296 return 0;
303} 297}
304 298
299#endif /*CONFIG_X86_LOCAL_APIC */
305 300
306#endif /*CONFIG_X86_LOCAL_APIC*/ 301#ifdef CONFIG_X86_IO_APIC
307
308#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
309 302
310static int __init 303static int __init
311acpi_parse_ioapic ( 304acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end)
312 acpi_table_entry_header *header, const unsigned long end)
313{ 305{
314 struct acpi_table_ioapic *ioapic = NULL; 306 struct acpi_table_ioapic *ioapic = NULL;
315 307
316 ioapic = (struct acpi_table_ioapic*) header; 308 ioapic = (struct acpi_table_ioapic *)header;
317 309
318 if (BAD_MADT_ENTRY(ioapic, end)) 310 if (BAD_MADT_ENTRY(ioapic, end))
319 return -EINVAL; 311 return -EINVAL;
320 312
321 acpi_table_print_madt_entry(header); 313 acpi_table_print_madt_entry(header);
322 314
323 mp_register_ioapic ( 315 mp_register_ioapic(ioapic->id,
324 ioapic->id, 316 ioapic->address, ioapic->global_irq_base);
325 ioapic->address, 317
326 ioapic->global_irq_base);
327
328 return 0; 318 return 0;
329} 319}
330 320
331/* 321/*
332 * Parse Interrupt Source Override for the ACPI SCI 322 * Parse Interrupt Source Override for the ACPI SCI
333 */ 323 */
334static void 324static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
335acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
336{ 325{
337 if (trigger == 0) /* compatible SCI trigger is level */ 326 if (trigger == 0) /* compatible SCI trigger is level */
338 trigger = 3; 327 trigger = 3;
@@ -348,7 +337,7 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
348 polarity = acpi_sci_flags.polarity; 337 polarity = acpi_sci_flags.polarity;
349 338
350 /* 339 /*
351 * mp_config_acpi_legacy_irqs() already setup IRQs < 16 340 * mp_config_acpi_legacy_irqs() already setup IRQs < 16
352 * If GSI is < 16, this will update its flags, 341 * If GSI is < 16, this will update its flags,
353 * else it will create a new mp_irqs[] entry. 342 * else it will create a new mp_irqs[] entry.
354 */ 343 */
@@ -363,12 +352,12 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
363} 352}
364 353
365static int __init 354static int __init
366acpi_parse_int_src_ovr ( 355acpi_parse_int_src_ovr(acpi_table_entry_header * header,
367 acpi_table_entry_header *header, const unsigned long end) 356 const unsigned long end)
368{ 357{
369 struct acpi_table_int_src_ovr *intsrc = NULL; 358 struct acpi_table_int_src_ovr *intsrc = NULL;
370 359
371 intsrc = (struct acpi_table_int_src_ovr*) header; 360 intsrc = (struct acpi_table_int_src_ovr *)header;
372 361
373 if (BAD_MADT_ENTRY(intsrc, end)) 362 if (BAD_MADT_ENTRY(intsrc, end))
374 return -EINVAL; 363 return -EINVAL;
@@ -377,33 +366,30 @@ acpi_parse_int_src_ovr (
377 366
378 if (intsrc->bus_irq == acpi_fadt.sci_int) { 367 if (intsrc->bus_irq == acpi_fadt.sci_int) {
379 acpi_sci_ioapic_setup(intsrc->global_irq, 368 acpi_sci_ioapic_setup(intsrc->global_irq,
380 intsrc->flags.polarity, intsrc->flags.trigger); 369 intsrc->flags.polarity,
370 intsrc->flags.trigger);
381 return 0; 371 return 0;
382 } 372 }
383 373
384 if (acpi_skip_timer_override && 374 if (acpi_skip_timer_override &&
385 intsrc->bus_irq == 0 && intsrc->global_irq == 2) { 375 intsrc->bus_irq == 0 && intsrc->global_irq == 2) {
386 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); 376 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
387 return 0; 377 return 0;
388 } 378 }
389 379
390 mp_override_legacy_irq ( 380 mp_override_legacy_irq(intsrc->bus_irq,
391 intsrc->bus_irq, 381 intsrc->flags.polarity,
392 intsrc->flags.polarity, 382 intsrc->flags.trigger, intsrc->global_irq);
393 intsrc->flags.trigger,
394 intsrc->global_irq);
395 383
396 return 0; 384 return 0;
397} 385}
398 386
399
400static int __init 387static int __init
401acpi_parse_nmi_src ( 388acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
402 acpi_table_entry_header *header, const unsigned long end)
403{ 389{
404 struct acpi_table_nmi_src *nmi_src = NULL; 390 struct acpi_table_nmi_src *nmi_src = NULL;
405 391
406 nmi_src = (struct acpi_table_nmi_src*) header; 392 nmi_src = (struct acpi_table_nmi_src *)header;
407 393
408 if (BAD_MADT_ENTRY(nmi_src, end)) 394 if (BAD_MADT_ENTRY(nmi_src, end))
409 return -EINVAL; 395 return -EINVAL;
@@ -415,9 +401,7 @@ acpi_parse_nmi_src (
415 return 0; 401 return 0;
416} 402}
417 403
418#endif /* CONFIG_X86_IO_APIC */ 404#endif /* CONFIG_X86_IO_APIC */
419
420#ifdef CONFIG_ACPI_BUS
421 405
422/* 406/*
423 * acpi_pic_sci_set_trigger() 407 * acpi_pic_sci_set_trigger()
@@ -433,8 +417,7 @@ acpi_parse_nmi_src (
433 * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0) 417 * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
434 */ 418 */
435 419
436void __init 420void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
437acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
438{ 421{
439 unsigned int mask = 1 << irq; 422 unsigned int mask = 1 << irq;
440 unsigned int old, new; 423 unsigned int old, new;
@@ -454,10 +437,10 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
454 * routing tables.. 437 * routing tables..
455 */ 438 */
456 switch (trigger) { 439 switch (trigger) {
457 case 1: /* Edge - clear */ 440 case 1: /* Edge - clear */
458 new &= ~mask; 441 new &= ~mask;
459 break; 442 break;
460 case 3: /* Level - set */ 443 case 3: /* Level - set */
461 new |= mask; 444 new |= mask;
462 break; 445 break;
463 } 446 }
@@ -470,21 +453,22 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
470 outb(new >> 8, 0x4d1); 453 outb(new >> 8, 0x4d1);
471} 454}
472 455
473
474#endif /* CONFIG_ACPI_BUS */
475
476int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) 456int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
477{ 457{
478#ifdef CONFIG_X86_IO_APIC 458#ifdef CONFIG_X86_IO_APIC
479 if (use_pci_vector() && !platform_legacy_irq(gsi)) 459 if (use_pci_vector() && !platform_legacy_irq(gsi))
480 *irq = IO_APIC_VECTOR(gsi); 460 *irq = IO_APIC_VECTOR(gsi);
481 else 461 else
482#endif 462#endif
483 *irq = gsi; 463 *irq = gsi;
484 return 0; 464 return 0;
485} 465}
486 466
487unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) 467/*
468 * success: return IRQ number (>=0)
469 * failure: return < 0
470 */
471int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
488{ 472{
489 unsigned int irq; 473 unsigned int irq;
490 unsigned int plat_gsi = gsi; 474 unsigned int plat_gsi = gsi;
@@ -497,7 +481,7 @@ unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
497 extern void eisa_set_level_irq(unsigned int irq); 481 extern void eisa_set_level_irq(unsigned int irq);
498 482
499 if (edge_level == ACPI_LEVEL_SENSITIVE) 483 if (edge_level == ACPI_LEVEL_SENSITIVE)
500 eisa_set_level_irq(gsi); 484 eisa_set_level_irq(gsi);
501 } 485 }
502#endif 486#endif
503 487
@@ -509,60 +493,58 @@ unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
509 acpi_gsi_to_irq(plat_gsi, &irq); 493 acpi_gsi_to_irq(plat_gsi, &irq);
510 return irq; 494 return irq;
511} 495}
496
512EXPORT_SYMBOL(acpi_register_gsi); 497EXPORT_SYMBOL(acpi_register_gsi);
513 498
514/* 499/*
515 * ACPI based hotplug support for CPU 500 * ACPI based hotplug support for CPU
516 */ 501 */
517#ifdef CONFIG_ACPI_HOTPLUG_CPU 502#ifdef CONFIG_ACPI_HOTPLUG_CPU
518int 503int acpi_map_lsapic(acpi_handle handle, int *pcpu)
519acpi_map_lsapic(acpi_handle handle, int *pcpu)
520{ 504{
521 /* TBD */ 505 /* TBD */
522 return -EINVAL; 506 return -EINVAL;
523} 507}
524EXPORT_SYMBOL(acpi_map_lsapic);
525 508
509EXPORT_SYMBOL(acpi_map_lsapic);
526 510
527int 511int acpi_unmap_lsapic(int cpu)
528acpi_unmap_lsapic(int cpu)
529{ 512{
530 /* TBD */ 513 /* TBD */
531 return -EINVAL; 514 return -EINVAL;
532} 515}
516
533EXPORT_SYMBOL(acpi_unmap_lsapic); 517EXPORT_SYMBOL(acpi_unmap_lsapic);
534#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 518#endif /* CONFIG_ACPI_HOTPLUG_CPU */
535 519
536int 520int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
537acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
538{ 521{
539 /* TBD */ 522 /* TBD */
540 return -EINVAL; 523 return -EINVAL;
541} 524}
525
542EXPORT_SYMBOL(acpi_register_ioapic); 526EXPORT_SYMBOL(acpi_register_ioapic);
543 527
544int 528int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
545acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
546{ 529{
547 /* TBD */ 530 /* TBD */
548 return -EINVAL; 531 return -EINVAL;
549} 532}
533
550EXPORT_SYMBOL(acpi_unregister_ioapic); 534EXPORT_SYMBOL(acpi_unregister_ioapic);
551 535
552static unsigned long __init 536static unsigned long __init
553acpi_scan_rsdp ( 537acpi_scan_rsdp(unsigned long start, unsigned long length)
554 unsigned long start,
555 unsigned long length)
556{ 538{
557 unsigned long offset = 0; 539 unsigned long offset = 0;
558 unsigned long sig_len = sizeof("RSD PTR ") - 1; 540 unsigned long sig_len = sizeof("RSD PTR ") - 1;
559 541
560 /* 542 /*
561 * Scan all 16-byte boundaries of the physical memory region for the 543 * Scan all 16-byte boundaries of the physical memory region for the
562 * RSDP signature. 544 * RSDP signature.
563 */ 545 */
564 for (offset = 0; offset < length; offset += 16) { 546 for (offset = 0; offset < length; offset += 16) {
565 if (strncmp((char *) (start + offset), "RSD PTR ", sig_len)) 547 if (strncmp((char *)(start + offset), "RSD PTR ", sig_len))
566 continue; 548 continue;
567 return (start + offset); 549 return (start + offset);
568 } 550 }
@@ -575,20 +557,19 @@ static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
575 struct acpi_table_sbf *sb; 557 struct acpi_table_sbf *sb;
576 558
577 if (!phys_addr || !size) 559 if (!phys_addr || !size)
578 return -EINVAL; 560 return -EINVAL;
579 561
580 sb = (struct acpi_table_sbf *) __acpi_map_table(phys_addr, size); 562 sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
581 if (!sb) { 563 if (!sb) {
582 printk(KERN_WARNING PREFIX "Unable to map SBF\n"); 564 printk(KERN_WARNING PREFIX "Unable to map SBF\n");
583 return -ENODEV; 565 return -ENODEV;
584 } 566 }
585 567
586 sbf_port = sb->sbf_cmos; /* Save CMOS port */ 568 sbf_port = sb->sbf_cmos; /* Save CMOS port */
587 569
588 return 0; 570 return 0;
589} 571}
590 572
591
592#ifdef CONFIG_HPET_TIMER 573#ifdef CONFIG_HPET_TIMER
593 574
594static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) 575static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
@@ -598,7 +579,7 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
598 if (!phys || !size) 579 if (!phys || !size)
599 return -EINVAL; 580 return -EINVAL;
600 581
601 hpet_tbl = (struct acpi_table_hpet *) __acpi_map_table(phys, size); 582 hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
602 if (!hpet_tbl) { 583 if (!hpet_tbl) {
603 printk(KERN_WARNING PREFIX "Unable to map HPET\n"); 584 printk(KERN_WARNING PREFIX "Unable to map HPET\n");
604 return -ENODEV; 585 return -ENODEV;
@@ -609,22 +590,21 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
609 "memory.\n"); 590 "memory.\n");
610 return -1; 591 return -1;
611 } 592 }
612
613#ifdef CONFIG_X86_64 593#ifdef CONFIG_X86_64
614 vxtime.hpet_address = hpet_tbl->addr.addrl | 594 vxtime.hpet_address = hpet_tbl->addr.addrl |
615 ((long) hpet_tbl->addr.addrh << 32); 595 ((long)hpet_tbl->addr.addrh << 32);
616 596
617 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 597 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
618 hpet_tbl->id, vxtime.hpet_address); 598 hpet_tbl->id, vxtime.hpet_address);
619#else /* X86 */ 599#else /* X86 */
620 { 600 {
621 extern unsigned long hpet_address; 601 extern unsigned long hpet_address;
622 602
623 hpet_address = hpet_tbl->addr.addrl; 603 hpet_address = hpet_tbl->addr.addrl;
624 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 604 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
625 hpet_tbl->id, hpet_address); 605 hpet_tbl->id, hpet_address);
626 } 606 }
627#endif /* X86 */ 607#endif /* X86 */
628 608
629 return 0; 609 return 0;
630} 610}
@@ -640,28 +620,25 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
640{ 620{
641 struct fadt_descriptor_rev2 *fadt = NULL; 621 struct fadt_descriptor_rev2 *fadt = NULL;
642 622
643 fadt = (struct fadt_descriptor_rev2*) __acpi_map_table(phys,size); 623 fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size);
644 if(!fadt) { 624 if (!fadt) {
645 printk(KERN_WARNING PREFIX "Unable to map FADT\n"); 625 printk(KERN_WARNING PREFIX "Unable to map FADT\n");
646 return 0; 626 return 0;
647 } 627 }
648
649#ifdef CONFIG_ACPI_INTERPRETER
650 /* initialize sci_int early for INT_SRC_OVR MADT parsing */ 628 /* initialize sci_int early for INT_SRC_OVR MADT parsing */
651 acpi_fadt.sci_int = fadt->sci_int; 629 acpi_fadt.sci_int = fadt->sci_int;
652#endif
653 630
654#ifdef CONFIG_ACPI_BUS
655 /* initialize rev and apic_phys_dest_mode for x86_64 genapic */ 631 /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
656 acpi_fadt.revision = fadt->revision; 632 acpi_fadt.revision = fadt->revision;
657 acpi_fadt.force_apic_physical_destination_mode = fadt->force_apic_physical_destination_mode; 633 acpi_fadt.force_apic_physical_destination_mode =
658#endif 634 fadt->force_apic_physical_destination_mode;
659 635
660#ifdef CONFIG_X86_PM_TIMER 636#ifdef CONFIG_X86_PM_TIMER
661 /* detect the location of the ACPI PM Timer */ 637 /* detect the location of the ACPI PM Timer */
662 if (fadt->revision >= FADT2_REVISION_ID) { 638 if (fadt->revision >= FADT2_REVISION_ID) {
663 /* FADT rev. 2 */ 639 /* FADT rev. 2 */
664 if (fadt->xpm_tmr_blk.address_space_id != ACPI_ADR_SPACE_SYSTEM_IO) 640 if (fadt->xpm_tmr_blk.address_space_id !=
641 ACPI_ADR_SPACE_SYSTEM_IO)
665 return 0; 642 return 0;
666 643
667 pmtmr_ioport = fadt->xpm_tmr_blk.address; 644 pmtmr_ioport = fadt->xpm_tmr_blk.address;
@@ -670,16 +647,15 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
670 pmtmr_ioport = fadt->V1_pm_tmr_blk; 647 pmtmr_ioport = fadt->V1_pm_tmr_blk;
671 } 648 }
672 if (pmtmr_ioport) 649 if (pmtmr_ioport)
673 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", pmtmr_ioport); 650 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
651 pmtmr_ioport);
674#endif 652#endif
675 return 0; 653 return 0;
676} 654}
677 655
678 656unsigned long __init acpi_find_rsdp(void)
679unsigned long __init
680acpi_find_rsdp (void)
681{ 657{
682 unsigned long rsdp_phys = 0; 658 unsigned long rsdp_phys = 0;
683 659
684 if (efi_enabled) { 660 if (efi_enabled) {
685 if (efi.acpi20) 661 if (efi.acpi20)
@@ -691,9 +667,9 @@ acpi_find_rsdp (void)
691 * Scan memory looking for the RSDP signature. First search EBDA (low 667 * Scan memory looking for the RSDP signature. First search EBDA (low
692 * memory) paragraphs and then search upper memory (E0000-FFFFF). 668 * memory) paragraphs and then search upper memory (E0000-FFFFF).
693 */ 669 */
694 rsdp_phys = acpi_scan_rsdp (0, 0x400); 670 rsdp_phys = acpi_scan_rsdp(0, 0x400);
695 if (!rsdp_phys) 671 if (!rsdp_phys)
696 rsdp_phys = acpi_scan_rsdp (0xE0000, 0x20000); 672 rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
697 673
698 return rsdp_phys; 674 return rsdp_phys;
699} 675}
@@ -703,8 +679,7 @@ acpi_find_rsdp (void)
703 * Parse LAPIC entries in MADT 679 * Parse LAPIC entries in MADT
704 * returns 0 on success, < 0 on error 680 * returns 0 on success, < 0 on error
705 */ 681 */
706static int __init 682static int __init acpi_parse_madt_lapic_entries(void)
707acpi_parse_madt_lapic_entries(void)
708{ 683{
709 int count; 684 int count;
710 685
@@ -713,28 +688,31 @@ acpi_parse_madt_lapic_entries(void)
713 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). 688 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
714 */ 689 */
715 690
716 count = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0); 691 count =
692 acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
693 acpi_parse_lapic_addr_ovr, 0);
717 if (count < 0) { 694 if (count < 0) {
718 printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); 695 printk(KERN_ERR PREFIX
696 "Error parsing LAPIC address override entry\n");
719 return count; 697 return count;
720 } 698 }
721 699
722 mp_register_lapic_address(acpi_lapic_addr); 700 mp_register_lapic_address(acpi_lapic_addr);
723 701
724 count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, 702 count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
725 MAX_APICS); 703 MAX_APICS);
726 if (!count) { 704 if (!count) {
727 printk(KERN_ERR PREFIX "No LAPIC entries present\n"); 705 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
728 /* TBD: Cleanup to allow fallback to MPS */ 706 /* TBD: Cleanup to allow fallback to MPS */
729 return -ENODEV; 707 return -ENODEV;
730 } 708 } else if (count < 0) {
731 else if (count < 0) {
732 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n"); 709 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
733 /* TBD: Cleanup to allow fallback to MPS */ 710 /* TBD: Cleanup to allow fallback to MPS */
734 return count; 711 return count;
735 } 712 }
736 713
737 count = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); 714 count =
715 acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
738 if (count < 0) { 716 if (count < 0) {
739 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 717 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
740 /* TBD: Cleanup to allow fallback to MPS */ 718 /* TBD: Cleanup to allow fallback to MPS */
@@ -742,15 +720,14 @@ acpi_parse_madt_lapic_entries(void)
742 } 720 }
743 return 0; 721 return 0;
744} 722}
745#endif /* CONFIG_X86_LOCAL_APIC */ 723#endif /* CONFIG_X86_LOCAL_APIC */
746 724
747#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) 725#ifdef CONFIG_X86_IO_APIC
748/* 726/*
749 * Parse IOAPIC related entries in MADT 727 * Parse IOAPIC related entries in MADT
750 * returns 0 on success, < 0 on error 728 * returns 0 on success, < 0 on error
751 */ 729 */
752static int __init 730static int __init acpi_parse_madt_ioapic_entries(void)
753acpi_parse_madt_ioapic_entries(void)
754{ 731{
755 int count; 732 int count;
756 733
@@ -762,30 +739,34 @@ acpi_parse_madt_ioapic_entries(void)
762 */ 739 */
763 if (acpi_disabled || acpi_noirq) { 740 if (acpi_disabled || acpi_noirq) {
764 return -ENODEV; 741 return -ENODEV;
765 } 742 }
766 743
767 /* 744 /*
768 * if "noapic" boot option, don't look for IO-APICs 745 * if "noapic" boot option, don't look for IO-APICs
769 */ 746 */
770 if (skip_ioapic_setup) { 747 if (skip_ioapic_setup) {
771 printk(KERN_INFO PREFIX "Skipping IOAPIC probe " 748 printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
772 "due to 'noapic' option.\n"); 749 "due to 'noapic' option.\n");
773 return -ENODEV; 750 return -ENODEV;
774 } 751 }
775 752
776 count = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS); 753 count =
754 acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
755 MAX_IO_APICS);
777 if (!count) { 756 if (!count) {
778 printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); 757 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
779 return -ENODEV; 758 return -ENODEV;
780 } 759 } else if (count < 0) {
781 else if (count < 0) {
782 printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n"); 760 printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
783 return count; 761 return count;
784 } 762 }
785 763
786 count = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS); 764 count =
765 acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
766 NR_IRQ_VECTORS);
787 if (count < 0) { 767 if (count < 0) {
788 printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); 768 printk(KERN_ERR PREFIX
769 "Error parsing interrupt source overrides entry\n");
789 /* TBD: Cleanup to allow fallback to MPS */ 770 /* TBD: Cleanup to allow fallback to MPS */
790 return count; 771 return count;
791 } 772 }
@@ -800,7 +781,9 @@ acpi_parse_madt_ioapic_entries(void)
800 /* Fill in identity legacy mapings where no override */ 781 /* Fill in identity legacy mapings where no override */
801 mp_config_acpi_legacy_irqs(); 782 mp_config_acpi_legacy_irqs();
802 783
803 count = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS); 784 count =
785 acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
786 NR_IRQ_VECTORS);
804 if (count < 0) { 787 if (count < 0) {
805 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); 788 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
806 /* TBD: Cleanup to allow fallback to MPS */ 789 /* TBD: Cleanup to allow fallback to MPS */
@@ -814,11 +797,9 @@ static inline int acpi_parse_madt_ioapic_entries(void)
814{ 797{
815 return -1; 798 return -1;
816} 799}
817#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */ 800#endif /* !CONFIG_X86_IO_APIC */
818 801
819 802static void __init acpi_process_madt(void)
820static void __init
821acpi_process_madt(void)
822{ 803{
823#ifdef CONFIG_X86_LOCAL_APIC 804#ifdef CONFIG_X86_LOCAL_APIC
824 int count, error; 805 int count, error;
@@ -853,7 +834,8 @@ acpi_process_madt(void)
853 /* 834 /*
854 * Dell Precision Workstation 410, 610 come here. 835 * Dell Precision Workstation 410, 610 come here.
855 */ 836 */
856 printk(KERN_ERR PREFIX "Invalid BIOS MADT, disabling ACPI\n"); 837 printk(KERN_ERR PREFIX
838 "Invalid BIOS MADT, disabling ACPI\n");
857 disable_acpi(); 839 disable_acpi();
858 } 840 }
859 } 841 }
@@ -865,7 +847,6 @@ extern int acpi_force;
865 847
866#ifdef __i386__ 848#ifdef __i386__
867 849
868#ifdef CONFIG_ACPI_PCI
869static int __init disable_acpi_irq(struct dmi_system_id *d) 850static int __init disable_acpi_irq(struct dmi_system_id *d)
870{ 851{
871 if (!acpi_force) { 852 if (!acpi_force) {
@@ -885,12 +866,11 @@ static int __init disable_acpi_pci(struct dmi_system_id *d)
885 } 866 }
886 return 0; 867 return 0;
887} 868}
888#endif
889 869
890static int __init dmi_disable_acpi(struct dmi_system_id *d) 870static int __init dmi_disable_acpi(struct dmi_system_id *d)
891{ 871{
892 if (!acpi_force) { 872 if (!acpi_force) {
893 printk(KERN_NOTICE "%s detected: acpi off\n",d->ident); 873 printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
894 disable_acpi(); 874 disable_acpi();
895 } else { 875 } else {
896 printk(KERN_NOTICE 876 printk(KERN_NOTICE
@@ -905,7 +885,8 @@ static int __init dmi_disable_acpi(struct dmi_system_id *d)
905static int __init force_acpi_ht(struct dmi_system_id *d) 885static int __init force_acpi_ht(struct dmi_system_id *d)
906{ 886{
907 if (!acpi_force) { 887 if (!acpi_force) {
908 printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", d->ident); 888 printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
889 d->ident);
909 disable_acpi(); 890 disable_acpi();
910 acpi_ht = 1; 891 acpi_ht = 1;
911 } else { 892 } else {
@@ -924,155 +905,155 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
924 * Boxes that need ACPI disabled 905 * Boxes that need ACPI disabled
925 */ 906 */
926 { 907 {
927 .callback = dmi_disable_acpi, 908 .callback = dmi_disable_acpi,
928 .ident = "IBM Thinkpad", 909 .ident = "IBM Thinkpad",
929 .matches = { 910 .matches = {
930 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 911 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
931 DMI_MATCH(DMI_BOARD_NAME, "2629H1G"), 912 DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
932 }, 913 },
933 }, 914 },
934 915
935 /* 916 /*
936 * Boxes that need acpi=ht 917 * Boxes that need acpi=ht
937 */ 918 */
938 { 919 {
939 .callback = force_acpi_ht, 920 .callback = force_acpi_ht,
940 .ident = "FSC Primergy T850", 921 .ident = "FSC Primergy T850",
941 .matches = { 922 .matches = {
942 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 923 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
943 DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"), 924 DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
944 }, 925 },
945 }, 926 },
946 { 927 {
947 .callback = force_acpi_ht, 928 .callback = force_acpi_ht,
948 .ident = "DELL GX240", 929 .ident = "DELL GX240",
949 .matches = { 930 .matches = {
950 DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"), 931 DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
951 DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"), 932 DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
952 }, 933 },
953 }, 934 },
954 { 935 {
955 .callback = force_acpi_ht, 936 .callback = force_acpi_ht,
956 .ident = "HP VISUALIZE NT Workstation", 937 .ident = "HP VISUALIZE NT Workstation",
957 .matches = { 938 .matches = {
958 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), 939 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
959 DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"), 940 DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
960 }, 941 },
961 }, 942 },
962 { 943 {
963 .callback = force_acpi_ht, 944 .callback = force_acpi_ht,
964 .ident = "Compaq Workstation W8000", 945 .ident = "Compaq Workstation W8000",
965 .matches = { 946 .matches = {
966 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), 947 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
967 DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"), 948 DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
968 }, 949 },
969 }, 950 },
970 { 951 {
971 .callback = force_acpi_ht, 952 .callback = force_acpi_ht,
972 .ident = "ASUS P4B266", 953 .ident = "ASUS P4B266",
973 .matches = { 954 .matches = {
974 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 955 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
975 DMI_MATCH(DMI_BOARD_NAME, "P4B266"), 956 DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
976 }, 957 },
977 }, 958 },
978 { 959 {
979 .callback = force_acpi_ht, 960 .callback = force_acpi_ht,
980 .ident = "ASUS P2B-DS", 961 .ident = "ASUS P2B-DS",
981 .matches = { 962 .matches = {
982 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 963 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
983 DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"), 964 DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
984 }, 965 },
985 }, 966 },
986 { 967 {
987 .callback = force_acpi_ht, 968 .callback = force_acpi_ht,
988 .ident = "ASUS CUR-DLS", 969 .ident = "ASUS CUR-DLS",
989 .matches = { 970 .matches = {
990 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 971 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
991 DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"), 972 DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
992 }, 973 },
993 }, 974 },
994 { 975 {
995 .callback = force_acpi_ht, 976 .callback = force_acpi_ht,
996 .ident = "ABIT i440BX-W83977", 977 .ident = "ABIT i440BX-W83977",
997 .matches = { 978 .matches = {
998 DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"), 979 DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
999 DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"), 980 DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
1000 }, 981 },
1001 }, 982 },
1002 { 983 {
1003 .callback = force_acpi_ht, 984 .callback = force_acpi_ht,
1004 .ident = "IBM Bladecenter", 985 .ident = "IBM Bladecenter",
1005 .matches = { 986 .matches = {
1006 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 987 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1007 DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"), 988 DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
1008 }, 989 },
1009 }, 990 },
1010 { 991 {
1011 .callback = force_acpi_ht, 992 .callback = force_acpi_ht,
1012 .ident = "IBM eServer xSeries 360", 993 .ident = "IBM eServer xSeries 360",
1013 .matches = { 994 .matches = {
1014 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 995 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1015 DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"), 996 DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
1016 }, 997 },
1017 }, 998 },
1018 { 999 {
1019 .callback = force_acpi_ht, 1000 .callback = force_acpi_ht,
1020 .ident = "IBM eserver xSeries 330", 1001 .ident = "IBM eserver xSeries 330",
1021 .matches = { 1002 .matches = {
1022 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 1003 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1023 DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"), 1004 DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
1024 }, 1005 },
1025 }, 1006 },
1026 { 1007 {
1027 .callback = force_acpi_ht, 1008 .callback = force_acpi_ht,
1028 .ident = "IBM eserver xSeries 440", 1009 .ident = "IBM eserver xSeries 440",
1029 .matches = { 1010 .matches = {
1030 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), 1011 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1031 DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"), 1012 DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
1032 }, 1013 },
1033 }, 1014 },
1034 1015
1035#ifdef CONFIG_ACPI_PCI
1036 /* 1016 /*
1037 * Boxes that need ACPI PCI IRQ routing disabled 1017 * Boxes that need ACPI PCI IRQ routing disabled
1038 */ 1018 */
1039 { 1019 {
1040 .callback = disable_acpi_irq, 1020 .callback = disable_acpi_irq,
1041 .ident = "ASUS A7V", 1021 .ident = "ASUS A7V",
1042 .matches = { 1022 .matches = {
1043 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"), 1023 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
1044 DMI_MATCH(DMI_BOARD_NAME, "<A7V>"), 1024 DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
1045 /* newer BIOS, Revision 1011, does work */ 1025 /* newer BIOS, Revision 1011, does work */
1046 DMI_MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"), 1026 DMI_MATCH(DMI_BIOS_VERSION,
1047 }, 1027 "ASUS A7V ACPI BIOS Revision 1007"),
1048 }, 1028 },
1029 },
1049 1030
1050 /* 1031 /*
1051 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled 1032 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
1052 */ 1033 */
1053 { /* _BBN 0 bug */ 1034 { /* _BBN 0 bug */
1054 .callback = disable_acpi_pci, 1035 .callback = disable_acpi_pci,
1055 .ident = "ASUS PR-DLS", 1036 .ident = "ASUS PR-DLS",
1056 .matches = { 1037 .matches = {
1057 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 1038 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
1058 DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"), 1039 DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
1059 DMI_MATCH(DMI_BIOS_VERSION, "ASUS PR-DLS ACPI BIOS Revision 1010"), 1040 DMI_MATCH(DMI_BIOS_VERSION,
1060 DMI_MATCH(DMI_BIOS_DATE, "03/21/2003") 1041 "ASUS PR-DLS ACPI BIOS Revision 1010"),
1061 }, 1042 DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
1062 }, 1043 },
1044 },
1063 { 1045 {
1064 .callback = disable_acpi_pci, 1046 .callback = disable_acpi_pci,
1065 .ident = "Acer TravelMate 36x Laptop", 1047 .ident = "Acer TravelMate 36x Laptop",
1066 .matches = { 1048 .matches = {
1067 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 1049 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1068 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"), 1050 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
1069 }, 1051 },
1070 }, 1052 },
1071#endif 1053 {}
1072 { }
1073}; 1054};
1074 1055
1075#endif /* __i386__ */ 1056#endif /* __i386__ */
1076 1057
1077/* 1058/*
1078 * acpi_boot_table_init() and acpi_boot_init() 1059 * acpi_boot_table_init() and acpi_boot_init()
@@ -1097,8 +1078,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
1097 * !0: failure 1078 * !0: failure
1098 */ 1079 */
1099 1080
1100int __init 1081int __init acpi_boot_table_init(void)
1101acpi_boot_table_init(void)
1102{ 1082{
1103 int error; 1083 int error;
1104 1084
@@ -1111,7 +1091,7 @@ acpi_boot_table_init(void)
1111 * One exception: acpi=ht continues far enough to enumerate LAPICs 1091 * One exception: acpi=ht continues far enough to enumerate LAPICs
1112 */ 1092 */
1113 if (acpi_disabled && !acpi_ht) 1093 if (acpi_disabled && !acpi_ht)
1114 return 1; 1094 return 1;
1115 1095
1116 /* 1096 /*
1117 * Initialize the ACPI boot-time table parser. 1097 * Initialize the ACPI boot-time table parser.
@@ -1121,7 +1101,6 @@ acpi_boot_table_init(void)
1121 disable_acpi(); 1101 disable_acpi();
1122 return error; 1102 return error;
1123 } 1103 }
1124
1125#ifdef __i386__ 1104#ifdef __i386__
1126 check_acpi_pci(); 1105 check_acpi_pci();
1127#endif 1106#endif
@@ -1145,7 +1124,6 @@ acpi_boot_table_init(void)
1145 return 0; 1124 return 0;
1146} 1125}
1147 1126
1148
1149int __init acpi_boot_init(void) 1127int __init acpi_boot_init(void)
1150{ 1128{
1151 /* 1129 /*
@@ -1153,7 +1131,7 @@ int __init acpi_boot_init(void)
1153 * One exception: acpi=ht continues far enough to enumerate LAPICs 1131 * One exception: acpi=ht continues far enough to enumerate LAPICs
1154 */ 1132 */
1155 if (acpi_disabled && !acpi_ht) 1133 if (acpi_disabled && !acpi_ht)
1156 return 1; 1134 return 1;
1157 1135
1158 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf); 1136 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
1159 1137
@@ -1171,4 +1149,3 @@ int __init acpi_boot_init(void)
1171 1149
1172 return 0; 1150 return 0;
1173} 1151}
1174
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c
index 726a5ca4b165..f1b9d2a46dab 100644
--- a/arch/i386/kernel/acpi/earlyquirk.c
+++ b/arch/i386/kernel/acpi/earlyquirk.c
@@ -8,44 +8,44 @@
8#include <asm/pci-direct.h> 8#include <asm/pci-direct.h>
9#include <asm/acpi.h> 9#include <asm/acpi.h>
10 10
11static int __init check_bridge(int vendor, int device) 11static int __init check_bridge(int vendor, int device)
12{ 12{
13 /* According to Nvidia all timer overrides are bogus. Just ignore 13 /* According to Nvidia all timer overrides are bogus. Just ignore
14 them all. */ 14 them all. */
15 if (vendor == PCI_VENDOR_ID_NVIDIA) { 15 if (vendor == PCI_VENDOR_ID_NVIDIA) {
16 acpi_skip_timer_override = 1; 16 acpi_skip_timer_override = 1;
17 } 17 }
18 return 0; 18 return 0;
19} 19}
20 20
21void __init check_acpi_pci(void) 21void __init check_acpi_pci(void)
22{ 22{
23 int num,slot,func; 23 int num, slot, func;
24 24
25 /* Assume the machine supports type 1. If not it will 25 /* Assume the machine supports type 1. If not it will
26 always read ffffffff and should not have any side effect. */ 26 always read ffffffff and should not have any side effect. */
27 27
28 /* Poor man's PCI discovery */ 28 /* Poor man's PCI discovery */
29 for (num = 0; num < 32; num++) { 29 for (num = 0; num < 32; num++) {
30 for (slot = 0; slot < 32; slot++) { 30 for (slot = 0; slot < 32; slot++) {
31 for (func = 0; func < 8; func++) { 31 for (func = 0; func < 8; func++) {
32 u32 class; 32 u32 class;
33 u32 vendor; 33 u32 vendor;
34 class = read_pci_config(num,slot,func, 34 class = read_pci_config(num, slot, func,
35 PCI_CLASS_REVISION); 35 PCI_CLASS_REVISION);
36 if (class == 0xffffffff) 36 if (class == 0xffffffff)
37 break; 37 break;
38 38
39 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) 39 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
40 continue; 40 continue;
41 41
42 vendor = read_pci_config(num, slot, func, 42 vendor = read_pci_config(num, slot, func,
43 PCI_VENDOR_ID); 43 PCI_VENDOR_ID);
44 44
45 if (check_bridge(vendor&0xffff, vendor >> 16)) 45 if (check_bridge(vendor & 0xffff, vendor >> 16))
46 return; 46 return;
47 } 47 }
48 48
49 } 49 }
50 } 50 }
51} 51}
diff --git a/arch/i386/kernel/acpi/sleep.c b/arch/i386/kernel/acpi/sleep.c
index c1af93032ff3..1cb2b186a3af 100644
--- a/arch/i386/kernel/acpi/sleep.c
+++ b/arch/i386/kernel/acpi/sleep.c
@@ -20,12 +20,13 @@ extern void zap_low_mappings(void);
20 20
21extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); 21extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
22 22
23static void init_low_mapping(pgd_t *pgd, int pgd_limit) 23static void init_low_mapping(pgd_t * pgd, int pgd_limit)
24{ 24{
25 int pgd_ofs = 0; 25 int pgd_ofs = 0;
26 26
27 while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) { 27 while ((pgd_ofs < pgd_limit)
28 set_pgd(pgd, *(pgd+USER_PTRS_PER_PGD)); 28 && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
29 set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
29 pgd_ofs++, pgd++; 30 pgd_ofs++, pgd++;
30 } 31 }
31 flush_tlb_all(); 32 flush_tlb_all();
@@ -37,12 +38,13 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit)
37 * Create an identity mapped page table and copy the wakeup routine to 38 * Create an identity mapped page table and copy the wakeup routine to
38 * low memory. 39 * low memory.
39 */ 40 */
40int acpi_save_state_mem (void) 41int acpi_save_state_mem(void)
41{ 42{
42 if (!acpi_wakeup_address) 43 if (!acpi_wakeup_address)
43 return 1; 44 return 1;
44 init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD); 45 init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
45 memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start); 46 memcpy((void *)acpi_wakeup_address, &wakeup_start,
47 &wakeup_end - &wakeup_start);
46 acpi_copy_wakeup_routine(acpi_wakeup_address); 48 acpi_copy_wakeup_routine(acpi_wakeup_address);
47 49
48 return 0; 50 return 0;
@@ -51,7 +53,7 @@ int acpi_save_state_mem (void)
51/* 53/*
52 * acpi_restore_state - undo effects of acpi_save_state_mem 54 * acpi_restore_state - undo effects of acpi_save_state_mem
53 */ 55 */
54void acpi_restore_state_mem (void) 56void acpi_restore_state_mem(void)
55{ 57{
56 zap_low_mappings(); 58 zap_low_mappings();
57} 59}
@@ -67,7 +69,8 @@ void acpi_restore_state_mem (void)
67void __init acpi_reserve_bootmem(void) 69void __init acpi_reserve_bootmem(void)
68{ 70{
69 if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) { 71 if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) {
70 printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n"); 72 printk(KERN_ERR
73 "ACPI: Wakeup code way too big, S3 disabled.\n");
71 return; 74 return;
72 } 75 }
73 76
@@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str)
90 return 1; 93 return 1;
91} 94}
92 95
93
94__setup("acpi_sleep=", acpi_sleep_setup); 96__setup("acpi_sleep=", acpi_sleep_setup);
95 97
96
97static __init int reset_videomode_after_s3(struct dmi_system_id *d) 98static __init int reset_videomode_after_s3(struct dmi_system_id *d)
98{ 99{
99 acpi_video_flags |= 2; 100 acpi_video_flags |= 2;
@@ -101,14 +102,14 @@ static __init int reset_videomode_after_s3(struct dmi_system_id *d)
101} 102}
102 103
103static __initdata struct dmi_system_id acpisleep_dmi_table[] = { 104static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
104 { /* Reset video mode after returning from ACPI S3 sleep */ 105 { /* Reset video mode after returning from ACPI S3 sleep */
105 .callback = reset_videomode_after_s3, 106 .callback = reset_videomode_after_s3,
106 .ident = "Toshiba Satellite 4030cdt", 107 .ident = "Toshiba Satellite 4030cdt",
107 .matches = { 108 .matches = {
108 DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"), 109 DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
109 }, 110 },
110 }, 111 },
111 { } 112 {}
112}; 113};
113 114
114static int __init acpisleep_dmi_init(void) 115static int __init acpisleep_dmi_init(void)
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 60a9e54dd20e..822c8ce9d1f1 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -31,6 +31,7 @@
31#include <linux/cpufreq.h> 31#include <linux/cpufreq.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34#include <linux/compiler.h>
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/delay.h> 36#include <asm/delay.h>
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
@@ -57,6 +58,8 @@ static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS];
57 58
58static struct cpufreq_driver acpi_cpufreq_driver; 59static struct cpufreq_driver acpi_cpufreq_driver;
59 60
61static unsigned int acpi_pstate_strict;
62
60static int 63static int
61acpi_processor_write_port( 64acpi_processor_write_port(
62 u16 port, 65 u16 port,
@@ -163,34 +166,44 @@ acpi_processor_set_performance (
163 } 166 }
164 167
165 /* 168 /*
166 * Then we read the 'status_register' and compare the value with the 169 * Assume the write went through when acpi_pstate_strict is not used.
167 * target state's 'status' to make sure the transition was successful. 170 * As read status_register is an expensive operation and there
168 * Note that we'll poll for up to 1ms (100 cycles of 10us) before 171 * are no specific error cases where an IO port write will fail.
169 * giving up.
170 */ 172 */
171 173 if (acpi_pstate_strict) {
172 port = data->acpi_data.status_register.address; 174 /* Then we read the 'status_register' and compare the value
173 bit_width = data->acpi_data.status_register.bit_width; 175 * with the target state's 'status' to make sure the
174 176 * transition was successful.
175 dprintk("Looking for 0x%08x from port 0x%04x\n", 177 * Note that we'll poll for up to 1ms (100 cycles of 10us)
176 (u32) data->acpi_data.states[state].status, port); 178 * before giving up.
177 179 */
178 for (i=0; i<100; i++) { 180
179 ret = acpi_processor_read_port(port, bit_width, &value); 181 port = data->acpi_data.status_register.address;
180 if (ret) { 182 bit_width = data->acpi_data.status_register.bit_width;
181 dprintk("Invalid port width 0x%04x\n", bit_width); 183
182 retval = ret; 184 dprintk("Looking for 0x%08x from port 0x%04x\n",
183 goto migrate_end; 185 (u32) data->acpi_data.states[state].status, port);
186
187 for (i=0; i<100; i++) {
188 ret = acpi_processor_read_port(port, bit_width, &value);
189 if (ret) {
190 dprintk("Invalid port width 0x%04x\n", bit_width);
191 retval = ret;
192 goto migrate_end;
193 }
194 if (value == (u32) data->acpi_data.states[state].status)
195 break;
196 udelay(10);
184 } 197 }
185 if (value == (u32) data->acpi_data.states[state].status) 198 } else {
186 break; 199 i = 0;
187 udelay(10); 200 value = (u32) data->acpi_data.states[state].status;
188 } 201 }
189 202
190 /* notify cpufreq */ 203 /* notify cpufreq */
191 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); 204 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
192 205
193 if (value != (u32) data->acpi_data.states[state].status) { 206 if (unlikely(value != (u32) data->acpi_data.states[state].status)) {
194 unsigned int tmp = cpufreq_freqs.new; 207 unsigned int tmp = cpufreq_freqs.new;
195 cpufreq_freqs.new = cpufreq_freqs.old; 208 cpufreq_freqs.new = cpufreq_freqs.old;
196 cpufreq_freqs.old = tmp; 209 cpufreq_freqs.old = tmp;
@@ -537,6 +550,8 @@ acpi_cpufreq_exit (void)
537 return; 550 return;
538} 551}
539 552
553module_param(acpi_pstate_strict, uint, 0644);
554MODULE_PARM_DESC(acpi_pstate_strict, "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes.");
540 555
541late_initcall(acpi_cpufreq_init); 556late_initcall(acpi_cpufreq_init);
542module_exit(acpi_cpufreq_exit); 557module_exit(acpi_cpufreq_exit);
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
index a3cdf894302b..58516e2ac172 100644
--- a/arch/i386/kernel/dmi_scan.c
+++ b/arch/i386/kernel/dmi_scan.c
@@ -6,32 +6,28 @@
6#include <linux/bootmem.h> 6#include <linux/bootmem.h>
7 7
8 8
9struct dmi_header {
10 u8 type;
11 u8 length;
12 u16 handle;
13};
14
15#undef DMI_DEBUG
16
17#ifdef DMI_DEBUG
18#define dmi_printk(x) printk x
19#else
20#define dmi_printk(x)
21#endif
22
23static char * __init dmi_string(struct dmi_header *dm, u8 s) 9static char * __init dmi_string(struct dmi_header *dm, u8 s)
24{ 10{
25 u8 *bp = ((u8 *) dm) + dm->length; 11 u8 *bp = ((u8 *) dm) + dm->length;
12 char *str = "";
26 13
27 if (!s) 14 if (s) {
28 return "";
29 s--;
30 while (s > 0 && *bp) {
31 bp += strlen(bp) + 1;
32 s--; 15 s--;
33 } 16 while (s > 0 && *bp) {
34 return bp; 17 bp += strlen(bp) + 1;
18 s--;
19 }
20
21 if (*bp != 0) {
22 str = alloc_bootmem(strlen(bp) + 1);
23 if (str != NULL)
24 strcpy(str, bp);
25 else
26 printk(KERN_ERR "dmi_string: out of memory.\n");
27 }
28 }
29
30 return str;
35} 31}
36 32
37/* 33/*
@@ -84,69 +80,76 @@ static int __init dmi_checksum(u8 *buf)
84 return sum == 0; 80 return sum == 0;
85} 81}
86 82
87static int __init dmi_iterate(void (*decode)(struct dmi_header *)) 83static char *dmi_ident[DMI_STRING_MAX];
84static LIST_HEAD(dmi_devices);
85
86/*
87 * Save a DMI string
88 */
89static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
88{ 90{
89 u8 buf[15]; 91 char *p, *d = (char*) dm;
90 char __iomem *p, *q;
91 92
92 /* 93 if (dmi_ident[slot])
93 * no iounmap() for that ioremap(); it would be a no-op, but it's 94 return;
94 * so early in setup that sucker gets confused into doing what 95
95 * it shouldn't if we actually call it. 96 p = dmi_string(dm, d[string]);
96 */
97 p = ioremap(0xF0000, 0x10000);
98 if (p == NULL) 97 if (p == NULL)
99 return -1; 98 return;
100 99
101 for (q = p; q < p + 0x10000; q += 16) { 100 dmi_ident[slot] = p;
102 memcpy_fromio(buf, q, 15); 101}
103 if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
104 u16 num = (buf[13] << 8) | buf[12];
105 u16 len = (buf[7] << 8) | buf[6];
106 u32 base = (buf[11] << 24) | (buf[10] << 16) |
107 (buf[9] << 8) | buf[8];
108 102
109 /* 103static void __init dmi_save_devices(struct dmi_header *dm)
110 * DMI version 0.0 means that the real version is taken from 104{
111 * the SMBIOS version, which we don't know at this point. 105 int i, count = (dm->length - sizeof(struct dmi_header)) / 2;
112 */ 106 struct dmi_device *dev;
113 if (buf[14] != 0) 107
114 printk(KERN_INFO "DMI %d.%d present.\n", 108 for (i = 0; i < count; i++) {
115 buf[14] >> 4, buf[14] & 0xF); 109 char *d = ((char *) dm) + (i * 2);
116 else
117 printk(KERN_INFO "DMI present.\n");
118 110
119 dmi_printk((KERN_INFO "%d structures occupying %d bytes.\n", 111 /* Skip disabled device */
120 num, len)); 112 if ((*d & 0x80) == 0)
121 dmi_printk((KERN_INFO "DMI table at 0x%08X.\n", base)); 113 continue;
122 114
123 if (dmi_table(base,len, num, decode) == 0) 115 dev = alloc_bootmem(sizeof(*dev));
124 return 0; 116 if (!dev) {
117 printk(KERN_ERR "dmi_save_devices: out of memory.\n");
118 break;
125 } 119 }
120
121 dev->type = *d++ & 0x7f;
122 dev->name = dmi_string(dm, *d);
123 dev->device_data = NULL;
124
125 list_add(&dev->list, &dmi_devices);
126 } 126 }
127 return -1;
128} 127}
129 128
130static char *dmi_ident[DMI_STRING_MAX]; 129static void __init dmi_save_ipmi_device(struct dmi_header *dm)
131
132/*
133 * Save a DMI string
134 */
135static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
136{ 130{
137 char *d = (char*)dm; 131 struct dmi_device *dev;
138 char *p = dmi_string(dm, d[string]); 132 void * data;
139 133
140 if (p == NULL || *p == 0) 134 data = alloc_bootmem(dm->length);
135 if (data == NULL) {
136 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
141 return; 137 return;
142 if (dmi_ident[slot]) 138 }
139
140 memcpy(data, dm, dm->length);
141
142 dev = alloc_bootmem(sizeof(*dev));
143 if (!dev) {
144 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
143 return; 145 return;
146 }
144 147
145 dmi_ident[slot] = alloc_bootmem(strlen(p) + 1); 148 dev->type = DMI_DEV_TYPE_IPMI;
146 if(dmi_ident[slot]) 149 dev->name = "IPMI controller";
147 strcpy(dmi_ident[slot], p); 150 dev->device_data = data;
148 else 151
149 printk(KERN_ERR "dmi_save_ident: out of memory.\n"); 152 list_add(&dev->list, &dmi_devices);
150} 153}
151 154
152/* 155/*
@@ -156,42 +159,69 @@ static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
156 */ 159 */
157static void __init dmi_decode(struct dmi_header *dm) 160static void __init dmi_decode(struct dmi_header *dm)
158{ 161{
159 u8 *data __attribute__((__unused__)) = (u8 *)dm;
160
161 switch(dm->type) { 162 switch(dm->type) {
162 case 0: 163 case 0: /* BIOS Information */
163 dmi_printk(("BIOS Vendor: %s\n", dmi_string(dm, data[4])));
164 dmi_save_ident(dm, DMI_BIOS_VENDOR, 4); 164 dmi_save_ident(dm, DMI_BIOS_VENDOR, 4);
165 dmi_printk(("BIOS Version: %s\n", dmi_string(dm, data[5])));
166 dmi_save_ident(dm, DMI_BIOS_VERSION, 5); 165 dmi_save_ident(dm, DMI_BIOS_VERSION, 5);
167 dmi_printk(("BIOS Release: %s\n", dmi_string(dm, data[8])));
168 dmi_save_ident(dm, DMI_BIOS_DATE, 8); 166 dmi_save_ident(dm, DMI_BIOS_DATE, 8);
169 break; 167 break;
170 case 1: 168 case 1: /* System Information */
171 dmi_printk(("System Vendor: %s\n", dmi_string(dm, data[4])));
172 dmi_save_ident(dm, DMI_SYS_VENDOR, 4); 169 dmi_save_ident(dm, DMI_SYS_VENDOR, 4);
173 dmi_printk(("Product Name: %s\n", dmi_string(dm, data[5])));
174 dmi_save_ident(dm, DMI_PRODUCT_NAME, 5); 170 dmi_save_ident(dm, DMI_PRODUCT_NAME, 5);
175 dmi_printk(("Version: %s\n", dmi_string(dm, data[6])));
176 dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6); 171 dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
177 dmi_printk(("Serial Number: %s\n", dmi_string(dm, data[7])));
178 dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7); 172 dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7);
179 break; 173 break;
180 case 2: 174 case 2: /* Base Board Information */
181 dmi_printk(("Board Vendor: %s\n", dmi_string(dm, data[4])));
182 dmi_save_ident(dm, DMI_BOARD_VENDOR, 4); 175 dmi_save_ident(dm, DMI_BOARD_VENDOR, 4);
183 dmi_printk(("Board Name: %s\n", dmi_string(dm, data[5])));
184 dmi_save_ident(dm, DMI_BOARD_NAME, 5); 176 dmi_save_ident(dm, DMI_BOARD_NAME, 5);
185 dmi_printk(("Board Version: %s\n", dmi_string(dm, data[6])));
186 dmi_save_ident(dm, DMI_BOARD_VERSION, 6); 177 dmi_save_ident(dm, DMI_BOARD_VERSION, 6);
187 break; 178 break;
179 case 10: /* Onboard Devices Information */
180 dmi_save_devices(dm);
181 break;
182 case 38: /* IPMI Device Information */
183 dmi_save_ipmi_device(dm);
188 } 184 }
189} 185}
190 186
191void __init dmi_scan_machine(void) 187void __init dmi_scan_machine(void)
192{ 188{
193 if (dmi_iterate(dmi_decode)) 189 u8 buf[15];
194 printk(KERN_INFO "DMI not present.\n"); 190 char __iomem *p, *q;
191
192 /*
193 * no iounmap() for that ioremap(); it would be a no-op, but it's
194 * so early in setup that sucker gets confused into doing what
195 * it shouldn't if we actually call it.
196 */
197 p = ioremap(0xF0000, 0x10000);
198 if (p == NULL)
199 goto out;
200
201 for (q = p; q < p + 0x10000; q += 16) {
202 memcpy_fromio(buf, q, 15);
203 if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
204 u16 num = (buf[13] << 8) | buf[12];
205 u16 len = (buf[7] << 8) | buf[6];
206 u32 base = (buf[11] << 24) | (buf[10] << 16) |
207 (buf[9] << 8) | buf[8];
208
209 /*
210 * DMI version 0.0 means that the real version is taken from
211 * the SMBIOS version, which we don't know at this point.
212 */
213 if (buf[14] != 0)
214 printk(KERN_INFO "DMI %d.%d present.\n",
215 buf[14] >> 4, buf[14] & 0xF);
216 else
217 printk(KERN_INFO "DMI present.\n");
218
219 if (dmi_table(base,len, num, dmi_decode) == 0)
220 return;
221 }
222 }
223
224out: printk(KERN_INFO "DMI not present.\n");
195} 225}
196 226
197 227
@@ -218,9 +248,9 @@ int dmi_check_system(struct dmi_system_id *list)
218 /* No match */ 248 /* No match */
219 goto fail; 249 goto fail;
220 } 250 }
251 count++;
221 if (d->callback && d->callback(d)) 252 if (d->callback && d->callback(d))
222 break; 253 break;
223 count++;
224fail: d++; 254fail: d++;
225 } 255 }
226 256
@@ -240,3 +270,32 @@ char *dmi_get_system_info(int field)
240 return dmi_ident[field]; 270 return dmi_ident[field];
241} 271}
242EXPORT_SYMBOL(dmi_get_system_info); 272EXPORT_SYMBOL(dmi_get_system_info);
273
274/**
275 * dmi_find_device - find onboard device by type/name
276 * @type: device type or %DMI_DEV_TYPE_ANY to match all device types
277 * @desc: device name string or %NULL to match all
278 * @from: previous device found in search, or %NULL for new search.
279 *
280 * Iterates through the list of known onboard devices. If a device is
281 * found with a matching @vendor and @device, a pointer to its device
282 * structure is returned. Otherwise, %NULL is returned.
283 * A new search is initiated by passing %NULL to the @from argument.
284 * If @from is not %NULL, searches continue from next device.
285 */
286struct dmi_device * dmi_find_device(int type, const char *name,
287 struct dmi_device *from)
288{
289 struct list_head *d, *head = from ? &from->list : &dmi_devices;
290
291 for(d = head->next; d != &dmi_devices; d = d->next) {
292 struct dmi_device *dev = list_entry(d, struct dmi_device, list);
293
294 if (((type == DMI_DEV_TYPE_ANY) || (dev->type == type)) &&
295 ((name == NULL) || (strcmp(dev->name, name) == 0)))
296 return dev;
297 }
298
299 return NULL;
300}
301EXPORT_SYMBOL(dmi_find_device);
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index abb909793efc..3aad03839660 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -507,7 +507,7 @@ label: \
507 pushl $__KERNEL_CS; \ 507 pushl $__KERNEL_CS; \
508 pushl $sysenter_past_esp 508 pushl $sysenter_past_esp
509 509
510ENTRY(debug) 510KPROBE_ENTRY(debug)
511 cmpl $sysenter_entry,(%esp) 511 cmpl $sysenter_entry,(%esp)
512 jne debug_stack_correct 512 jne debug_stack_correct
513 FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn) 513 FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
@@ -518,7 +518,7 @@ debug_stack_correct:
518 movl %esp,%eax # pt_regs pointer 518 movl %esp,%eax # pt_regs pointer
519 call do_debug 519 call do_debug
520 jmp ret_from_exception 520 jmp ret_from_exception
521 521 .previous .text
522/* 522/*
523 * NMI is doubly nasty. It can happen _while_ we're handling 523 * NMI is doubly nasty. It can happen _while_ we're handling
524 * a debug fault, and the debug fault hasn't yet been able to 524 * a debug fault, and the debug fault hasn't yet been able to
@@ -591,13 +591,14 @@ nmi_16bit_stack:
591 .long 1b,iret_exc 591 .long 1b,iret_exc
592.previous 592.previous
593 593
594ENTRY(int3) 594KPROBE_ENTRY(int3)
595 pushl $-1 # mark this as an int 595 pushl $-1 # mark this as an int
596 SAVE_ALL 596 SAVE_ALL
597 xorl %edx,%edx # zero error code 597 xorl %edx,%edx # zero error code
598 movl %esp,%eax # pt_regs pointer 598 movl %esp,%eax # pt_regs pointer
599 call do_int3 599 call do_int3
600 jmp ret_from_exception 600 jmp ret_from_exception
601 .previous .text
601 602
602ENTRY(overflow) 603ENTRY(overflow)
603 pushl $0 604 pushl $0
@@ -631,17 +632,19 @@ ENTRY(stack_segment)
631 pushl $do_stack_segment 632 pushl $do_stack_segment
632 jmp error_code 633 jmp error_code
633 634
634ENTRY(general_protection) 635KPROBE_ENTRY(general_protection)
635 pushl $do_general_protection 636 pushl $do_general_protection
636 jmp error_code 637 jmp error_code
638 .previous .text
637 639
638ENTRY(alignment_check) 640ENTRY(alignment_check)
639 pushl $do_alignment_check 641 pushl $do_alignment_check
640 jmp error_code 642 jmp error_code
641 643
642ENTRY(page_fault) 644KPROBE_ENTRY(page_fault)
643 pushl $do_page_fault 645 pushl $do_page_fault
644 jmp error_code 646 jmp error_code
647 .previous .text
645 648
646#ifdef CONFIG_X86_MCE 649#ifdef CONFIG_X86_MCE
647ENTRY(machine_check) 650ENTRY(machine_check)
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 6578f40bd501..889eda2d7b17 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -33,6 +33,7 @@
33#include <linux/acpi.h> 33#include <linux/acpi.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/sysdev.h> 35#include <linux/sysdev.h>
36
36#include <asm/io.h> 37#include <asm/io.h>
37#include <asm/smp.h> 38#include <asm/smp.h>
38#include <asm/desc.h> 39#include <asm/desc.h>
@@ -77,7 +78,7 @@ static struct irq_pin_list {
77 int apic, pin, next; 78 int apic, pin, next;
78} irq_2_pin[PIN_MAP_SIZE]; 79} irq_2_pin[PIN_MAP_SIZE];
79 80
80int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; 81int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1};
81#ifdef CONFIG_PCI_MSI 82#ifdef CONFIG_PCI_MSI
82#define vector_to_irq(vector) \ 83#define vector_to_irq(vector) \
83 (platform_legacy_irq(vector) ? vector : vector_irq[vector]) 84 (platform_legacy_irq(vector) ? vector : vector_irq[vector])
@@ -222,13 +223,21 @@ static void clear_IO_APIC (void)
222 clear_IO_APIC_pin(apic, pin); 223 clear_IO_APIC_pin(apic, pin);
223} 224}
224 225
226#ifdef CONFIG_SMP
225static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask) 227static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
226{ 228{
227 unsigned long flags; 229 unsigned long flags;
228 int pin; 230 int pin;
229 struct irq_pin_list *entry = irq_2_pin + irq; 231 struct irq_pin_list *entry = irq_2_pin + irq;
230 unsigned int apicid_value; 232 unsigned int apicid_value;
233 cpumask_t tmp;
231 234
235 cpus_and(tmp, cpumask, cpu_online_map);
236 if (cpus_empty(tmp))
237 tmp = TARGET_CPUS;
238
239 cpus_and(cpumask, tmp, CPU_MASK_ALL);
240
232 apicid_value = cpu_mask_to_apicid(cpumask); 241 apicid_value = cpu_mask_to_apicid(cpumask);
233 /* Prepare to do the io_apic_write */ 242 /* Prepare to do the io_apic_write */
234 apicid_value = apicid_value << 24; 243 apicid_value = apicid_value << 24;
@@ -242,6 +251,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
242 break; 251 break;
243 entry = irq_2_pin + entry->next; 252 entry = irq_2_pin + entry->next;
244 } 253 }
254 set_irq_info(irq, cpumask);
245 spin_unlock_irqrestore(&ioapic_lock, flags); 255 spin_unlock_irqrestore(&ioapic_lock, flags);
246} 256}
247 257
@@ -259,7 +269,6 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
259# define Dprintk(x...) 269# define Dprintk(x...)
260# endif 270# endif
261 271
262cpumask_t __cacheline_aligned pending_irq_balance_cpumask[NR_IRQS];
263 272
264#define IRQBALANCE_CHECK_ARCH -999 273#define IRQBALANCE_CHECK_ARCH -999
265static int irqbalance_disabled = IRQBALANCE_CHECK_ARCH; 274static int irqbalance_disabled = IRQBALANCE_CHECK_ARCH;
@@ -328,12 +337,7 @@ static inline void balance_irq(int cpu, int irq)
328 cpus_and(allowed_mask, cpu_online_map, irq_affinity[irq]); 337 cpus_and(allowed_mask, cpu_online_map, irq_affinity[irq]);
329 new_cpu = move(cpu, allowed_mask, now, 1); 338 new_cpu = move(cpu, allowed_mask, now, 1);
330 if (cpu != new_cpu) { 339 if (cpu != new_cpu) {
331 irq_desc_t *desc = irq_desc + irq; 340 set_pending_irq(irq, cpumask_of_cpu(new_cpu));
332 unsigned long flags;
333
334 spin_lock_irqsave(&desc->lock, flags);
335 pending_irq_balance_cpumask[irq] = cpumask_of_cpu(new_cpu);
336 spin_unlock_irqrestore(&desc->lock, flags);
337 } 341 }
338} 342}
339 343
@@ -528,16 +532,12 @@ tryanotherirq:
528 cpus_and(tmp, target_cpu_mask, allowed_mask); 532 cpus_and(tmp, target_cpu_mask, allowed_mask);
529 533
530 if (!cpus_empty(tmp)) { 534 if (!cpus_empty(tmp)) {
531 irq_desc_t *desc = irq_desc + selected_irq;
532 unsigned long flags;
533 535
534 Dprintk("irq = %d moved to cpu = %d\n", 536 Dprintk("irq = %d moved to cpu = %d\n",
535 selected_irq, min_loaded); 537 selected_irq, min_loaded);
536 /* mark for change destination */ 538 /* mark for change destination */
537 spin_lock_irqsave(&desc->lock, flags); 539 set_pending_irq(selected_irq, cpumask_of_cpu(min_loaded));
538 pending_irq_balance_cpumask[selected_irq] = 540
539 cpumask_of_cpu(min_loaded);
540 spin_unlock_irqrestore(&desc->lock, flags);
541 /* Since we made a change, come back sooner to 541 /* Since we made a change, come back sooner to
542 * check for more variation. 542 * check for more variation.
543 */ 543 */
@@ -568,7 +568,8 @@ static int balanced_irq(void *unused)
568 568
569 /* push everything to CPU 0 to give us a starting point. */ 569 /* push everything to CPU 0 to give us a starting point. */
570 for (i = 0 ; i < NR_IRQS ; i++) { 570 for (i = 0 ; i < NR_IRQS ; i++) {
571 pending_irq_balance_cpumask[i] = cpumask_of_cpu(0); 571 pending_irq_cpumask[i] = cpumask_of_cpu(0);
572 set_pending_irq(i, cpumask_of_cpu(0));
572 } 573 }
573 574
574 for ( ; ; ) { 575 for ( ; ; ) {
@@ -647,20 +648,9 @@ int __init irqbalance_disable(char *str)
647 648
648__setup("noirqbalance", irqbalance_disable); 649__setup("noirqbalance", irqbalance_disable);
649 650
650static inline void move_irq(int irq)
651{
652 /* note - we hold the desc->lock */
653 if (unlikely(!cpus_empty(pending_irq_balance_cpumask[irq]))) {
654 set_ioapic_affinity_irq(irq, pending_irq_balance_cpumask[irq]);
655 cpus_clear(pending_irq_balance_cpumask[irq]);
656 }
657}
658
659late_initcall(balanced_irq_init); 651late_initcall(balanced_irq_init);
660
661#else /* !CONFIG_IRQBALANCE */
662static inline void move_irq(int irq) { }
663#endif /* CONFIG_IRQBALANCE */ 652#endif /* CONFIG_IRQBALANCE */
653#endif /* CONFIG_SMP */
664 654
665#ifndef CONFIG_SMP 655#ifndef CONFIG_SMP
666void fastcall send_IPI_self(int vector) 656void fastcall send_IPI_self(int vector)
@@ -820,6 +810,7 @@ EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
820 * we need to reprogram the ioredtbls to cater for the cpus which have come online 810 * we need to reprogram the ioredtbls to cater for the cpus which have come online
821 * so mask in all cases should simply be TARGET_CPUS 811 * so mask in all cases should simply be TARGET_CPUS
822 */ 812 */
813#ifdef CONFIG_SMP
823void __init setup_ioapic_dest(void) 814void __init setup_ioapic_dest(void)
824{ 815{
825 int pin, ioapic, irq, irq_entry; 816 int pin, ioapic, irq, irq_entry;
@@ -838,6 +829,7 @@ void __init setup_ioapic_dest(void)
838 829
839 } 830 }
840} 831}
832#endif
841 833
842/* 834/*
843 * EISA Edge/Level control register, ELCR 835 * EISA Edge/Level control register, ELCR
@@ -1127,7 +1119,7 @@ static inline int IO_APIC_irq_trigger(int irq)
1127} 1119}
1128 1120
1129/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ 1121/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
1130u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 }; 1122u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
1131 1123
1132int assign_irq_vector(int irq) 1124int assign_irq_vector(int irq)
1133{ 1125{
@@ -1249,6 +1241,7 @@ static void __init setup_IO_APIC_irqs(void)
1249 spin_lock_irqsave(&ioapic_lock, flags); 1241 spin_lock_irqsave(&ioapic_lock, flags);
1250 io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1)); 1242 io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1));
1251 io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0)); 1243 io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0));
1244 set_native_irq_info(irq, TARGET_CPUS);
1252 spin_unlock_irqrestore(&ioapic_lock, flags); 1245 spin_unlock_irqrestore(&ioapic_lock, flags);
1253 } 1246 }
1254 } 1247 }
@@ -1944,6 +1937,7 @@ static void ack_edge_ioapic_vector(unsigned int vector)
1944{ 1937{
1945 int irq = vector_to_irq(vector); 1938 int irq = vector_to_irq(vector);
1946 1939
1940 move_irq(vector);
1947 ack_edge_ioapic_irq(irq); 1941 ack_edge_ioapic_irq(irq);
1948} 1942}
1949 1943
@@ -1958,6 +1952,7 @@ static void end_level_ioapic_vector (unsigned int vector)
1958{ 1952{
1959 int irq = vector_to_irq(vector); 1953 int irq = vector_to_irq(vector);
1960 1954
1955 move_irq(vector);
1961 end_level_ioapic_irq(irq); 1956 end_level_ioapic_irq(irq);
1962} 1957}
1963 1958
@@ -1975,14 +1970,17 @@ static void unmask_IO_APIC_vector (unsigned int vector)
1975 unmask_IO_APIC_irq(irq); 1970 unmask_IO_APIC_irq(irq);
1976} 1971}
1977 1972
1973#ifdef CONFIG_SMP
1978static void set_ioapic_affinity_vector (unsigned int vector, 1974static void set_ioapic_affinity_vector (unsigned int vector,
1979 cpumask_t cpu_mask) 1975 cpumask_t cpu_mask)
1980{ 1976{
1981 int irq = vector_to_irq(vector); 1977 int irq = vector_to_irq(vector);
1982 1978
1979 set_native_irq_info(vector, cpu_mask);
1983 set_ioapic_affinity_irq(irq, cpu_mask); 1980 set_ioapic_affinity_irq(irq, cpu_mask);
1984} 1981}
1985#endif 1982#endif
1983#endif
1986 1984
1987/* 1985/*
1988 * Level and edge triggered IO-APIC interrupts need different handling, 1986 * Level and edge triggered IO-APIC interrupts need different handling,
@@ -1992,7 +1990,7 @@ static void set_ioapic_affinity_vector (unsigned int vector,
1992 * edge-triggered handler, without risking IRQ storms and other ugly 1990 * edge-triggered handler, without risking IRQ storms and other ugly
1993 * races. 1991 * races.
1994 */ 1992 */
1995static struct hw_interrupt_type ioapic_edge_type = { 1993static struct hw_interrupt_type ioapic_edge_type __read_mostly = {
1996 .typename = "IO-APIC-edge", 1994 .typename = "IO-APIC-edge",
1997 .startup = startup_edge_ioapic, 1995 .startup = startup_edge_ioapic,
1998 .shutdown = shutdown_edge_ioapic, 1996 .shutdown = shutdown_edge_ioapic,
@@ -2000,10 +1998,12 @@ static struct hw_interrupt_type ioapic_edge_type = {
2000 .disable = disable_edge_ioapic, 1998 .disable = disable_edge_ioapic,
2001 .ack = ack_edge_ioapic, 1999 .ack = ack_edge_ioapic,
2002 .end = end_edge_ioapic, 2000 .end = end_edge_ioapic,
2001#ifdef CONFIG_SMP
2003 .set_affinity = set_ioapic_affinity, 2002 .set_affinity = set_ioapic_affinity,
2003#endif
2004}; 2004};
2005 2005
2006static struct hw_interrupt_type ioapic_level_type = { 2006static struct hw_interrupt_type ioapic_level_type __read_mostly = {
2007 .typename = "IO-APIC-level", 2007 .typename = "IO-APIC-level",
2008 .startup = startup_level_ioapic, 2008 .startup = startup_level_ioapic,
2009 .shutdown = shutdown_level_ioapic, 2009 .shutdown = shutdown_level_ioapic,
@@ -2011,7 +2011,9 @@ static struct hw_interrupt_type ioapic_level_type = {
2011 .disable = disable_level_ioapic, 2011 .disable = disable_level_ioapic,
2012 .ack = mask_and_ack_level_ioapic, 2012 .ack = mask_and_ack_level_ioapic,
2013 .end = end_level_ioapic, 2013 .end = end_level_ioapic,
2014#ifdef CONFIG_SMP
2014 .set_affinity = set_ioapic_affinity, 2015 .set_affinity = set_ioapic_affinity,
2016#endif
2015}; 2017};
2016 2018
2017static inline void init_IO_APIC_traps(void) 2019static inline void init_IO_APIC_traps(void)
@@ -2074,7 +2076,7 @@ static void ack_lapic_irq (unsigned int irq)
2074 2076
2075static void end_lapic_irq (unsigned int i) { /* nothing */ } 2077static void end_lapic_irq (unsigned int i) { /* nothing */ }
2076 2078
2077static struct hw_interrupt_type lapic_irq_type = { 2079static struct hw_interrupt_type lapic_irq_type __read_mostly = {
2078 .typename = "local-APIC-edge", 2080 .typename = "local-APIC-edge",
2079 .startup = NULL, /* startup_irq() not used for IRQ0 */ 2081 .startup = NULL, /* startup_irq() not used for IRQ0 */
2080 .shutdown = NULL, /* shutdown_irq() not used for IRQ0 */ 2082 .shutdown = NULL, /* shutdown_irq() not used for IRQ0 */
@@ -2421,7 +2423,7 @@ device_initcall(ioapic_init_sysfs);
2421 ACPI-based IOAPIC Configuration 2423 ACPI-based IOAPIC Configuration
2422 -------------------------------------------------------------------------- */ 2424 -------------------------------------------------------------------------- */
2423 2425
2424#ifdef CONFIG_ACPI_BOOT 2426#ifdef CONFIG_ACPI
2425 2427
2426int __init io_apic_get_unique_id (int ioapic, int apic_id) 2428int __init io_apic_get_unique_id (int ioapic, int apic_id)
2427{ 2429{
@@ -2569,9 +2571,10 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2569 spin_lock_irqsave(&ioapic_lock, flags); 2571 spin_lock_irqsave(&ioapic_lock, flags);
2570 io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1)); 2572 io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1));
2571 io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0)); 2573 io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0));
2574 set_native_irq_info(use_pci_vector() ? entry.vector : irq, TARGET_CPUS);
2572 spin_unlock_irqrestore(&ioapic_lock, flags); 2575 spin_unlock_irqrestore(&ioapic_lock, flags);
2573 2576
2574 return 0; 2577 return 0;
2575} 2578}
2576 2579
2577#endif /*CONFIG_ACPI_BOOT*/ 2580#endif /* CONFIG_ACPI */
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index a6d8c45961d3..6345b430b105 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -62,32 +62,32 @@ static inline int is_IF_modifier(kprobe_opcode_t opcode)
62 return 0; 62 return 0;
63} 63}
64 64
65int arch_prepare_kprobe(struct kprobe *p) 65int __kprobes arch_prepare_kprobe(struct kprobe *p)
66{ 66{
67 return 0; 67 return 0;
68} 68}
69 69
70void arch_copy_kprobe(struct kprobe *p) 70void __kprobes arch_copy_kprobe(struct kprobe *p)
71{ 71{
72 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 72 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
73 p->opcode = *p->addr; 73 p->opcode = *p->addr;
74} 74}
75 75
76void arch_arm_kprobe(struct kprobe *p) 76void __kprobes arch_arm_kprobe(struct kprobe *p)
77{ 77{
78 *p->addr = BREAKPOINT_INSTRUCTION; 78 *p->addr = BREAKPOINT_INSTRUCTION;
79 flush_icache_range((unsigned long) p->addr, 79 flush_icache_range((unsigned long) p->addr,
80 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 80 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
81} 81}
82 82
83void arch_disarm_kprobe(struct kprobe *p) 83void __kprobes arch_disarm_kprobe(struct kprobe *p)
84{ 84{
85 *p->addr = p->opcode; 85 *p->addr = p->opcode;
86 flush_icache_range((unsigned long) p->addr, 86 flush_icache_range((unsigned long) p->addr,
87 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 87 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
88} 88}
89 89
90void arch_remove_kprobe(struct kprobe *p) 90void __kprobes arch_remove_kprobe(struct kprobe *p)
91{ 91{
92} 92}
93 93
@@ -127,7 +127,8 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
127 regs->eip = (unsigned long)&p->ainsn.insn; 127 regs->eip = (unsigned long)&p->ainsn.insn;
128} 128}
129 129
130void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) 130void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
131 struct pt_regs *regs)
131{ 132{
132 unsigned long *sara = (unsigned long *)&regs->esp; 133 unsigned long *sara = (unsigned long *)&regs->esp;
133 struct kretprobe_instance *ri; 134 struct kretprobe_instance *ri;
@@ -150,7 +151,7 @@ void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs)
150 * Interrupts are disabled on entry as trap3 is an interrupt gate and they 151 * Interrupts are disabled on entry as trap3 is an interrupt gate and they
151 * remain disabled thorough out this function. 152 * remain disabled thorough out this function.
152 */ 153 */
153static int kprobe_handler(struct pt_regs *regs) 154static int __kprobes kprobe_handler(struct pt_regs *regs)
154{ 155{
155 struct kprobe *p; 156 struct kprobe *p;
156 int ret = 0; 157 int ret = 0;
@@ -176,7 +177,8 @@ static int kprobe_handler(struct pt_regs *regs)
176 Disarm the probe we just hit, and ignore it. */ 177 Disarm the probe we just hit, and ignore it. */
177 p = get_kprobe(addr); 178 p = get_kprobe(addr);
178 if (p) { 179 if (p) {
179 if (kprobe_status == KPROBE_HIT_SS) { 180 if (kprobe_status == KPROBE_HIT_SS &&
181 *p->ainsn.insn == BREAKPOINT_INSTRUCTION) {
180 regs->eflags &= ~TF_MASK; 182 regs->eflags &= ~TF_MASK;
181 regs->eflags |= kprobe_saved_eflags; 183 regs->eflags |= kprobe_saved_eflags;
182 unlock_kprobes(); 184 unlock_kprobes();
@@ -220,7 +222,10 @@ static int kprobe_handler(struct pt_regs *regs)
220 * either a probepoint or a debugger breakpoint 222 * either a probepoint or a debugger breakpoint
221 * at this address. In either case, no further 223 * at this address. In either case, no further
222 * handling of this interrupt is appropriate. 224 * handling of this interrupt is appropriate.
225 * Back up over the (now missing) int3 and run
226 * the original instruction.
223 */ 227 */
228 regs->eip -= sizeof(kprobe_opcode_t);
224 ret = 1; 229 ret = 1;
225 } 230 }
226 /* Not one of ours: let kernel handle it */ 231 /* Not one of ours: let kernel handle it */
@@ -259,7 +264,7 @@ no_kprobe:
259/* 264/*
260 * Called when we hit the probe point at kretprobe_trampoline 265 * Called when we hit the probe point at kretprobe_trampoline
261 */ 266 */
262int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 267int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
263{ 268{
264 struct kretprobe_instance *ri = NULL; 269 struct kretprobe_instance *ri = NULL;
265 struct hlist_head *head; 270 struct hlist_head *head;
@@ -338,7 +343,7 @@ int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
338 * that is atop the stack is the address following the copied instruction. 343 * that is atop the stack is the address following the copied instruction.
339 * We need to make it the address following the original instruction. 344 * We need to make it the address following the original instruction.
340 */ 345 */
341static void resume_execution(struct kprobe *p, struct pt_regs *regs) 346static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
342{ 347{
343 unsigned long *tos = (unsigned long *)&regs->esp; 348 unsigned long *tos = (unsigned long *)&regs->esp;
344 unsigned long next_eip = 0; 349 unsigned long next_eip = 0;
@@ -444,8 +449,8 @@ static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
444/* 449/*
445 * Wrapper routine to for handling exceptions. 450 * Wrapper routine to for handling exceptions.
446 */ 451 */
447int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, 452int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
448 void *data) 453 unsigned long val, void *data)
449{ 454{
450 struct die_args *args = (struct die_args *)data; 455 struct die_args *args = (struct die_args *)data;
451 switch (val) { 456 switch (val) {
@@ -473,7 +478,7 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
473 return NOTIFY_DONE; 478 return NOTIFY_DONE;
474} 479}
475 480
476int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 481int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
477{ 482{
478 struct jprobe *jp = container_of(p, struct jprobe, kp); 483 struct jprobe *jp = container_of(p, struct jprobe, kp);
479 unsigned long addr; 484 unsigned long addr;
@@ -495,7 +500,7 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
495 return 1; 500 return 1;
496} 501}
497 502
498void jprobe_return(void) 503void __kprobes jprobe_return(void)
499{ 504{
500 preempt_enable_no_resched(); 505 preempt_enable_no_resched();
501 asm volatile (" xchgl %%ebx,%%esp \n" 506 asm volatile (" xchgl %%ebx,%%esp \n"
@@ -506,7 +511,7 @@ void jprobe_return(void)
506 (jprobe_saved_esp):"memory"); 511 (jprobe_saved_esp):"memory");
507} 512}
508 513
509int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 514int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
510{ 515{
511 u8 *addr = (u8 *) (regs->eip - 1); 516 u8 *addr = (u8 *) (regs->eip - 1);
512 unsigned long stack_addr = (unsigned long)jprobe_saved_esp; 517 unsigned long stack_addr = (unsigned long)jprobe_saved_esp;
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 5d0b9a8fc43d..cafaeffe3818 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -668,8 +668,6 @@ void __init get_smp_config (void)
668 struct intel_mp_floating *mpf = mpf_found; 668 struct intel_mp_floating *mpf = mpf_found;
669 669
670 /* 670 /*
671 * ACPI may be used to obtain the entire SMP configuration or just to
672 * enumerate/configure processors (CONFIG_ACPI_BOOT). Note that
673 * ACPI supports both logical (e.g. Hyper-Threading) and physical 671 * ACPI supports both logical (e.g. Hyper-Threading) and physical
674 * processors, where MPS only supports physical. 672 * processors, where MPS only supports physical.
675 */ 673 */
@@ -825,7 +823,7 @@ void __init find_smp_config (void)
825 ACPI-based MP Configuration 823 ACPI-based MP Configuration
826 -------------------------------------------------------------------------- */ 824 -------------------------------------------------------------------------- */
827 825
828#ifdef CONFIG_ACPI_BOOT 826#ifdef CONFIG_ACPI
829 827
830void __init mp_register_lapic_address ( 828void __init mp_register_lapic_address (
831 u64 address) 829 u64 address)
@@ -871,7 +869,7 @@ void __init mp_register_lapic (
871 MP_processor_info(&processor); 869 MP_processor_info(&processor);
872} 870}
873 871
874#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) 872#ifdef CONFIG_X86_IO_APIC
875 873
876#define MP_ISA_BUS 0 874#define MP_ISA_BUS 0
877#define MP_MAX_IOAPIC_PIN 127 875#define MP_MAX_IOAPIC_PIN 127
@@ -1086,11 +1084,9 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1086 */ 1084 */
1087 static int gsi_to_irq[MAX_GSI_NUM]; 1085 static int gsi_to_irq[MAX_GSI_NUM];
1088 1086
1089#ifdef CONFIG_ACPI_BUS
1090 /* Don't set up the ACPI SCI because it's already set up */ 1087 /* Don't set up the ACPI SCI because it's already set up */
1091 if (acpi_fadt.sci_int == gsi) 1088 if (acpi_fadt.sci_int == gsi)
1092 return gsi; 1089 return gsi;
1093#endif
1094 1090
1095 ioapic = mp_find_ioapic(gsi); 1091 ioapic = mp_find_ioapic(gsi);
1096 if (ioapic < 0) { 1092 if (ioapic < 0) {
@@ -1133,13 +1129,11 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1133 if (gsi < MAX_GSI_NUM) { 1129 if (gsi < MAX_GSI_NUM) {
1134 if (gsi > 15) 1130 if (gsi > 15)
1135 gsi = pci_irq++; 1131 gsi = pci_irq++;
1136#ifdef CONFIG_ACPI_BUS
1137 /* 1132 /*
1138 * Don't assign IRQ used by ACPI SCI 1133 * Don't assign IRQ used by ACPI SCI
1139 */ 1134 */
1140 if (gsi == acpi_fadt.sci_int) 1135 if (gsi == acpi_fadt.sci_int)
1141 gsi = pci_irq++; 1136 gsi = pci_irq++;
1142#endif
1143 gsi_to_irq[irq] = gsi; 1137 gsi_to_irq[irq] = gsi;
1144 } else { 1138 } else {
1145 printk(KERN_ERR "GSI %u is too high\n", gsi); 1139 printk(KERN_ERR "GSI %u is too high\n", gsi);
@@ -1153,5 +1147,5 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1153 return gsi; 1147 return gsi;
1154} 1148}
1155 1149
1156#endif /*CONFIG_X86_IO_APIC && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT)*/ 1150#endif /* CONFIG_X86_IO_APIC */
1157#endif /*CONFIG_ACPI_BOOT*/ 1151#endif /* CONFIG_ACPI */
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 8bbdbda07a2d..0178457db721 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -478,6 +478,11 @@ void touch_nmi_watchdog (void)
478 */ 478 */
479 for (i = 0; i < NR_CPUS; i++) 479 for (i = 0; i < NR_CPUS; i++)
480 alert_counter[i] = 0; 480 alert_counter[i] = 0;
481
482 /*
483 * Tickle the softlockup detector too:
484 */
485 touch_softlockup_watchdog();
481} 486}
482 487
483extern void die_nmi(struct pt_regs *, const char *msg); 488extern void die_nmi(struct pt_regs *, const char *msg);
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 294bcca985ab..a659d274914c 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -82,19 +82,19 @@ EXPORT_SYMBOL(efi_enabled);
82/* cpu data as detected by the assembly code in head.S */ 82/* cpu data as detected by the assembly code in head.S */
83struct cpuinfo_x86 new_cpu_data __initdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; 83struct cpuinfo_x86 new_cpu_data __initdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
84/* common cpu data for all cpus */ 84/* common cpu data for all cpus */
85struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; 85struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
86EXPORT_SYMBOL(boot_cpu_data); 86EXPORT_SYMBOL(boot_cpu_data);
87 87
88unsigned long mmu_cr4_features; 88unsigned long mmu_cr4_features;
89 89
90#ifdef CONFIG_ACPI_INTERPRETER 90#ifdef CONFIG_ACPI
91 int acpi_disabled = 0; 91 int acpi_disabled = 0;
92#else 92#else
93 int acpi_disabled = 1; 93 int acpi_disabled = 1;
94#endif 94#endif
95EXPORT_SYMBOL(acpi_disabled); 95EXPORT_SYMBOL(acpi_disabled);
96 96
97#ifdef CONFIG_ACPI_BOOT 97#ifdef CONFIG_ACPI
98int __initdata acpi_force = 0; 98int __initdata acpi_force = 0;
99extern acpi_interrupt_flags acpi_sci_flags; 99extern acpi_interrupt_flags acpi_sci_flags;
100#endif 100#endif
@@ -798,7 +798,7 @@ static void __init parse_cmdline_early (char ** cmdline_p)
798 } 798 }
799#endif 799#endif
800 800
801#ifdef CONFIG_ACPI_BOOT 801#ifdef CONFIG_ACPI
802 /* "acpi=off" disables both ACPI table parsing and interpreter */ 802 /* "acpi=off" disables both ACPI table parsing and interpreter */
803 else if (!memcmp(from, "acpi=off", 8)) { 803 else if (!memcmp(from, "acpi=off", 8)) {
804 disable_acpi(); 804 disable_acpi();
@@ -854,7 +854,7 @@ static void __init parse_cmdline_early (char ** cmdline_p)
854 else if (!memcmp(from, "noapic", 6)) 854 else if (!memcmp(from, "noapic", 6))
855 disable_ioapic_setup(); 855 disable_ioapic_setup();
856#endif /* CONFIG_X86_LOCAL_APIC */ 856#endif /* CONFIG_X86_LOCAL_APIC */
857#endif /* CONFIG_ACPI_BOOT */ 857#endif /* CONFIG_ACPI */
858 858
859#ifdef CONFIG_X86_LOCAL_APIC 859#ifdef CONFIG_X86_LOCAL_APIC
860 /* enable local APIC */ 860 /* enable local APIC */
@@ -1579,7 +1579,7 @@ void __init setup_arch(char **cmdline_p)
1579 if (efi_enabled) 1579 if (efi_enabled)
1580 efi_map_memmap(); 1580 efi_map_memmap();
1581 1581
1582#ifdef CONFIG_ACPI_BOOT 1582#ifdef CONFIG_ACPI
1583 /* 1583 /*
1584 * Parse the ACPI tables for possible boot-time SMP configuration. 1584 * Parse the ACPI tables for possible boot-time SMP configuration.
1585 */ 1585 */
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index 6f794a78ee1e..eefea7c55008 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -194,10 +194,7 @@ int do_settimeofday(struct timespec *tv)
194 set_normalized_timespec(&xtime, sec, nsec); 194 set_normalized_timespec(&xtime, sec, nsec);
195 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 195 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
196 196
197 time_adjust = 0; /* stop active adjtime() */ 197 ntp_clear();
198 time_status |= STA_UNSYNC;
199 time_maxerror = NTP_PHASE_LIMIT;
200 time_esterror = NTP_PHASE_LIMIT;
201 write_sequnlock_irq(&xtime_lock); 198 write_sequnlock_irq(&xtime_lock);
202 clock_was_set(); 199 clock_was_set();
203 return 0; 200 return 0;
@@ -252,8 +249,7 @@ EXPORT_SYMBOL(profile_pc);
252 * timer_interrupt() needs to keep up the real-time clock, 249 * timer_interrupt() needs to keep up the real-time clock,
253 * as well as call the "do_timer()" routine every clocktick 250 * as well as call the "do_timer()" routine every clocktick
254 */ 251 */
255static inline void do_timer_interrupt(int irq, void *dev_id, 252static inline void do_timer_interrupt(int irq, struct pt_regs *regs)
256 struct pt_regs *regs)
257{ 253{
258#ifdef CONFIG_X86_IO_APIC 254#ifdef CONFIG_X86_IO_APIC
259 if (timer_ack) { 255 if (timer_ack) {
@@ -307,7 +303,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
307 303
308 cur_timer->mark_offset(); 304 cur_timer->mark_offset();
309 305
310 do_timer_interrupt(irq, NULL, regs); 306 do_timer_interrupt(irq, regs);
311 307
312 write_sequnlock(&xtime_lock); 308 write_sequnlock(&xtime_lock);
313 return IRQ_HANDLED; 309 return IRQ_HANDLED;
@@ -348,7 +344,7 @@ static void sync_cmos_clock(unsigned long dummy)
348 * This code is run on a timer. If the clock is set, that timer 344 * This code is run on a timer. If the clock is set, that timer
349 * may not expire at the correct time. Thus, we adjust... 345 * may not expire at the correct time. Thus, we adjust...
350 */ 346 */
351 if ((time_status & STA_UNSYNC) != 0) 347 if (!ntp_synced())
352 /* 348 /*
353 * Not synced, exit, do not restart a timer (if one is 349 * Not synced, exit, do not restart a timer (if one is
354 * running, let it run out). 350 * running, let it run out).
@@ -422,6 +418,7 @@ static int timer_resume(struct sys_device *dev)
422 last_timer->resume(); 418 last_timer->resume();
423 cur_timer = last_timer; 419 cur_timer = last_timer;
424 last_timer = NULL; 420 last_timer = NULL;
421 touch_softlockup_watchdog();
425 return 0; 422 return 0;
426} 423}
427 424
diff --git a/arch/i386/kernel/timers/timer_hpet.c b/arch/i386/kernel/timers/timer_hpet.c
index 001de97c9e4a..d973a8b681fd 100644
--- a/arch/i386/kernel/timers/timer_hpet.c
+++ b/arch/i386/kernel/timers/timer_hpet.c
@@ -18,8 +18,8 @@
18#include "mach_timer.h" 18#include "mach_timer.h"
19#include <asm/hpet.h> 19#include <asm/hpet.h>
20 20
21static unsigned long __read_mostly hpet_usec_quotient; /* convert hpet clks to usec */ 21static unsigned long hpet_usec_quotient __read_mostly; /* convert hpet clks to usec */
22static unsigned long tsc_hpet_quotient; /* convert tsc to hpet clks */ 22static unsigned long tsc_hpet_quotient __read_mostly; /* convert tsc to hpet clks */
23static unsigned long hpet_last; /* hpet counter value at last tick*/ 23static unsigned long hpet_last; /* hpet counter value at last tick*/
24static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */ 24static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */
25static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */ 25static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 54629bb5893a..09a58cb6daa7 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -363,8 +363,9 @@ static inline void die_if_kernel(const char * str, struct pt_regs * regs, long e
363 die(str, regs, err); 363 die(str, regs, err);
364} 364}
365 365
366static void do_trap(int trapnr, int signr, char *str, int vm86, 366static void __kprobes do_trap(int trapnr, int signr, char *str, int vm86,
367 struct pt_regs * regs, long error_code, siginfo_t *info) 367 struct pt_regs * regs, long error_code,
368 siginfo_t *info)
368{ 369{
369 struct task_struct *tsk = current; 370 struct task_struct *tsk = current;
370 tsk->thread.error_code = error_code; 371 tsk->thread.error_code = error_code;
@@ -460,7 +461,8 @@ DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
460DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) 461DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
461DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0) 462DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0)
462 463
463fastcall void do_general_protection(struct pt_regs * regs, long error_code) 464fastcall void __kprobes do_general_protection(struct pt_regs * regs,
465 long error_code)
464{ 466{
465 int cpu = get_cpu(); 467 int cpu = get_cpu();
466 struct tss_struct *tss = &per_cpu(init_tss, cpu); 468 struct tss_struct *tss = &per_cpu(init_tss, cpu);
@@ -657,7 +659,7 @@ fastcall void do_nmi(struct pt_regs * regs, long error_code)
657 659
658 ++nmi_count(cpu); 660 ++nmi_count(cpu);
659 661
660 if (!nmi_callback(regs, cpu)) 662 if (!rcu_dereference(nmi_callback)(regs, cpu))
661 default_do_nmi(regs); 663 default_do_nmi(regs);
662 664
663 nmi_exit(); 665 nmi_exit();
@@ -665,7 +667,7 @@ fastcall void do_nmi(struct pt_regs * regs, long error_code)
665 667
666void set_nmi_callback(nmi_callback_t callback) 668void set_nmi_callback(nmi_callback_t callback)
667{ 669{
668 nmi_callback = callback; 670 rcu_assign_pointer(nmi_callback, callback);
669} 671}
670EXPORT_SYMBOL_GPL(set_nmi_callback); 672EXPORT_SYMBOL_GPL(set_nmi_callback);
671 673
@@ -676,7 +678,7 @@ void unset_nmi_callback(void)
676EXPORT_SYMBOL_GPL(unset_nmi_callback); 678EXPORT_SYMBOL_GPL(unset_nmi_callback);
677 679
678#ifdef CONFIG_KPROBES 680#ifdef CONFIG_KPROBES
679fastcall void do_int3(struct pt_regs *regs, long error_code) 681fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code)
680{ 682{
681 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) 683 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP)
682 == NOTIFY_STOP) 684 == NOTIFY_STOP)
@@ -710,7 +712,7 @@ fastcall void do_int3(struct pt_regs *regs, long error_code)
710 * find every occurrence of the TF bit that could be saved away even 712 * find every occurrence of the TF bit that could be saved away even
711 * by user code) 713 * by user code)
712 */ 714 */
713fastcall void do_debug(struct pt_regs * regs, long error_code) 715fastcall void __kprobes do_debug(struct pt_regs * regs, long error_code)
714{ 716{
715 unsigned int condition; 717 unsigned int condition;
716 struct task_struct *tsk = current; 718 struct task_struct *tsk = current;
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index 761972f8cb6c..13b9c62cbbb4 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -22,6 +22,7 @@ SECTIONS
22 *(.text) 22 *(.text)
23 SCHED_TEXT 23 SCHED_TEXT
24 LOCK_TEXT 24 LOCK_TEXT
25 KPROBES_TEXT
25 *(.fixup) 26 *(.fixup)
26 *(.gnu.warning) 27 *(.gnu.warning)
27 } = 0x9090 28 } = 0x9090
diff --git a/arch/i386/mach-default/topology.c b/arch/i386/mach-default/topology.c
index 23395fff35d1..b64314069e78 100644
--- a/arch/i386/mach-default/topology.c
+++ b/arch/i386/mach-default/topology.c
@@ -76,7 +76,7 @@ static int __init topology_init(void)
76 for_each_online_node(i) 76 for_each_online_node(i)
77 arch_register_node(i); 77 arch_register_node(i);
78 78
79 for_each_cpu(i) 79 for_each_present_cpu(i)
80 arch_register_cpu(i); 80 arch_register_cpu(i);
81 return 0; 81 return 0;
82} 82}
@@ -87,7 +87,7 @@ static int __init topology_init(void)
87{ 87{
88 int i; 88 int i;
89 89
90 for_each_cpu(i) 90 for_each_present_cpu(i)
91 arch_register_cpu(i); 91 arch_register_cpu(i);
92 return 0; 92 return 0;
93} 93}
diff --git a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c
index 2000bdca2fc2..dc6660511b07 100644
--- a/arch/i386/mach-es7000/es7000plat.c
+++ b/arch/i386/mach-es7000/es7000plat.c
@@ -51,7 +51,7 @@ struct mip_reg *host_reg;
51int mip_port; 51int mip_port;
52unsigned long mip_addr, host_addr; 52unsigned long mip_addr, host_addr;
53 53
54#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT)) 54#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI)
55 55
56/* 56/*
57 * GSI override for ES7000 platforms. 57 * GSI override for ES7000 platforms.
@@ -73,7 +73,7 @@ es7000_rename_gsi(int ioapic, int gsi)
73 return gsi; 73 return gsi;
74} 74}
75 75
76#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT) 76#endif /* (CONFIG_X86_IO_APIC) && (CONFIG_ACPI) */
77 77
78void __init 78void __init
79setup_unisys () 79setup_unisys ()
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index 6711ce3f6916..244d8ec66be2 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -37,7 +37,7 @@
37#include <asm/mmzone.h> 37#include <asm/mmzone.h>
38#include <bios_ebda.h> 38#include <bios_ebda.h>
39 39
40struct pglist_data *node_data[MAX_NUMNODES]; 40struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
41EXPORT_SYMBOL(node_data); 41EXPORT_SYMBOL(node_data);
42bootmem_data_t node0_bdata; 42bootmem_data_t node0_bdata;
43 43
@@ -49,8 +49,8 @@ bootmem_data_t node0_bdata;
49 * 2) node_start_pfn - the starting page frame number for a node 49 * 2) node_start_pfn - the starting page frame number for a node
50 * 3) node_end_pfn - the ending page fram number for a node 50 * 3) node_end_pfn - the ending page fram number for a node
51 */ 51 */
52unsigned long node_start_pfn[MAX_NUMNODES]; 52unsigned long node_start_pfn[MAX_NUMNODES] __read_mostly;
53unsigned long node_end_pfn[MAX_NUMNODES]; 53unsigned long node_end_pfn[MAX_NUMNODES] __read_mostly;
54 54
55 55
56#ifdef CONFIG_DISCONTIGMEM 56#ifdef CONFIG_DISCONTIGMEM
@@ -66,7 +66,7 @@ unsigned long node_end_pfn[MAX_NUMNODES];
66 * physnode_map[4-7] = 1; 66 * physnode_map[4-7] = 1;
67 * physnode_map[8- ] = -1; 67 * physnode_map[8- ] = -1;
68 */ 68 */
69s8 physnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1}; 69s8 physnode_map[MAX_ELEMENTS] __read_mostly = { [0 ... (MAX_ELEMENTS - 1)] = -1};
70EXPORT_SYMBOL(physnode_map); 70EXPORT_SYMBOL(physnode_map);
71 71
72void memory_present(int nid, unsigned long start, unsigned long end) 72void memory_present(int nid, unsigned long start, unsigned long end)
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index 411b8500ad1b..9edd4485b91e 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -21,6 +21,7 @@
21#include <linux/vt_kern.h> /* For unblank_screen() */ 21#include <linux/vt_kern.h> /* For unblank_screen() */
22#include <linux/highmem.h> 22#include <linux/highmem.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/kprobes.h>
24 25
25#include <asm/system.h> 26#include <asm/system.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
@@ -223,7 +224,8 @@ fastcall void do_invalid_op(struct pt_regs *, unsigned long);
223 * bit 1 == 0 means read, 1 means write 224 * bit 1 == 0 means read, 1 means write
224 * bit 2 == 0 means kernel, 1 means user-mode 225 * bit 2 == 0 means kernel, 1 means user-mode
225 */ 226 */
226fastcall void do_page_fault(struct pt_regs *regs, unsigned long error_code) 227fastcall void __kprobes do_page_fault(struct pt_regs *regs,
228 unsigned long error_code)
227{ 229{
228 struct task_struct *tsk; 230 struct task_struct *tsk;
229 struct mm_struct *mm; 231 struct mm_struct *mm;
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 9edfc058b894..2ebaf75f732e 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -393,7 +393,7 @@ void zap_low_mappings (void)
393} 393}
394 394
395static int disable_nx __initdata = 0; 395static int disable_nx __initdata = 0;
396u64 __supported_pte_mask = ~_PAGE_NX; 396u64 __supported_pte_mask __read_mostly = ~_PAGE_NX;
397 397
398/* 398/*
399 * noexec = on|off 399 * noexec = on|off
diff --git a/arch/i386/oprofile/init.c b/arch/i386/oprofile/init.c
index c90332de582b..5341d481d92f 100644
--- a/arch/i386/oprofile/init.c
+++ b/arch/i386/oprofile/init.c
@@ -15,9 +15,9 @@
15 * with the NMI mode driver. 15 * with the NMI mode driver.
16 */ 16 */
17 17
18extern int nmi_init(struct oprofile_operations * ops); 18extern int op_nmi_init(struct oprofile_operations * ops);
19extern int nmi_timer_init(struct oprofile_operations * ops); 19extern int op_nmi_timer_init(struct oprofile_operations * ops);
20extern void nmi_exit(void); 20extern void op_nmi_exit(void);
21extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth); 21extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth);
22 22
23 23
@@ -28,11 +28,11 @@ int __init oprofile_arch_init(struct oprofile_operations * ops)
28 ret = -ENODEV; 28 ret = -ENODEV;
29 29
30#ifdef CONFIG_X86_LOCAL_APIC 30#ifdef CONFIG_X86_LOCAL_APIC
31 ret = nmi_init(ops); 31 ret = op_nmi_init(ops);
32#endif 32#endif
33#ifdef CONFIG_X86_IO_APIC 33#ifdef CONFIG_X86_IO_APIC
34 if (ret < 0) 34 if (ret < 0)
35 ret = nmi_timer_init(ops); 35 ret = op_nmi_timer_init(ops);
36#endif 36#endif
37 ops->backtrace = x86_backtrace; 37 ops->backtrace = x86_backtrace;
38 38
@@ -43,6 +43,6 @@ int __init oprofile_arch_init(struct oprofile_operations * ops)
43void oprofile_arch_exit(void) 43void oprofile_arch_exit(void)
44{ 44{
45#ifdef CONFIG_X86_LOCAL_APIC 45#ifdef CONFIG_X86_LOCAL_APIC
46 nmi_exit(); 46 op_nmi_exit();
47#endif 47#endif
48} 48}
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index 255e4702d185..0493e8b8ec49 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -355,7 +355,7 @@ static int __init ppro_init(char ** cpu_type)
355/* in order to get driverfs right */ 355/* in order to get driverfs right */
356static int using_nmi; 356static int using_nmi;
357 357
358int __init nmi_init(struct oprofile_operations *ops) 358int __init op_nmi_init(struct oprofile_operations *ops)
359{ 359{
360 __u8 vendor = boot_cpu_data.x86_vendor; 360 __u8 vendor = boot_cpu_data.x86_vendor;
361 __u8 family = boot_cpu_data.x86; 361 __u8 family = boot_cpu_data.x86;
@@ -420,7 +420,7 @@ int __init nmi_init(struct oprofile_operations *ops)
420} 420}
421 421
422 422
423void nmi_exit(void) 423void op_nmi_exit(void)
424{ 424{
425 if (using_nmi) 425 if (using_nmi)
426 exit_driverfs(); 426 exit_driverfs();
diff --git a/arch/i386/oprofile/nmi_timer_int.c b/arch/i386/oprofile/nmi_timer_int.c
index c58d0c14f274..ad93cdd55d63 100644
--- a/arch/i386/oprofile/nmi_timer_int.c
+++ b/arch/i386/oprofile/nmi_timer_int.c
@@ -40,7 +40,7 @@ static void timer_stop(void)
40} 40}
41 41
42 42
43int __init nmi_timer_init(struct oprofile_operations * ops) 43int __init op_nmi_timer_init(struct oprofile_operations * ops)
44{ 44{
45 extern int nmi_active; 45 extern int nmi_active;
46 46
diff --git a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile
index 1bff03f36965..ead6122dd06d 100644
--- a/arch/i386/pci/Makefile
+++ b/arch/i386/pci/Makefile
@@ -5,7 +5,7 @@ obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
5obj-$(CONFIG_PCI_DIRECT) += direct.o 5obj-$(CONFIG_PCI_DIRECT) += direct.o
6 6
7pci-y := fixup.o 7pci-y := fixup.o
8pci-$(CONFIG_ACPI_PCI) += acpi.o 8pci-$(CONFIG_ACPI) += acpi.o
9pci-y += legacy.o irq.o 9pci-y += legacy.o irq.o
10 10
11pci-$(CONFIG_X86_VISWS) := visws.o fixup.o 11pci-$(CONFIG_X86_VISWS) := visws.o fixup.o
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 86348b68fda1..326a2edc3834 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -1075,7 +1075,7 @@ static void pirq_penalize_isa_irq(int irq, int active)
1075 1075
1076void pcibios_penalize_isa_irq(int irq, int active) 1076void pcibios_penalize_isa_irq(int irq, int active)
1077{ 1077{
1078#ifdef CONFIG_ACPI_PCI 1078#ifdef CONFIG_ACPI
1079 if (!acpi_noirq) 1079 if (!acpi_noirq)
1080 acpi_penalize_isa_irq(irq, active); 1080 acpi_penalize_isa_irq(irq, active);
1081 else 1081 else
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index d0743c6da6d8..ed25d66c8d50 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -60,6 +60,7 @@ choice
60 60
61config IA64_GENERIC 61config IA64_GENERIC
62 bool "generic" 62 bool "generic"
63 select ACPI
63 select NUMA 64 select NUMA
64 select ACPI_NUMA 65 select ACPI_NUMA
65 select VIRTUAL_MEM_MAP 66 select VIRTUAL_MEM_MAP
@@ -346,38 +347,10 @@ endmenu
346 347
347menu "Power management and ACPI" 348menu "Power management and ACPI"
348 349
349config PM 350source "kernel/power/Kconfig"
350 bool "Power Management support"
351 depends on !IA64_HP_SIM
352 default y
353 help
354 "Power Management" means that parts of your computer are shut
355 off or put into a power conserving "sleep" mode if they are not
356 being used. There are two competing standards for doing this: APM
357 and ACPI. If you want to use either one, say Y here and then also
358 to the requisite support below.
359
360 Power Management is most important for battery powered laptop
361 computers; if you have a laptop, check out the Linux Laptop home
362 page on the WWW at <http://www.linux-on-laptops.com/> and the
363 Battery Powered Linux mini-HOWTO, available from
364 <http://www.tldp.org/docs.html#howto>.
365
366 Note that, even if you say N here, Linux on the x86 architecture
367 will issue the hlt instruction if nothing is to be done, thereby
368 sending the processor to sleep and saving power.
369
370config ACPI
371 bool
372 depends on !IA64_HP_SIM
373 default y
374
375if !IA64_HP_SIM
376 351
377source "drivers/acpi/Kconfig" 352source "drivers/acpi/Kconfig"
378 353
379endif
380
381if PM 354if PM
382 355
383source "arch/ia64/kernel/cpufreq/Kconfig" 356source "arch/ia64/kernel/cpufreq/Kconfig"
@@ -429,6 +402,11 @@ config GENERIC_IRQ_PROBE
429 bool 402 bool
430 default y 403 default y
431 404
405config GENERIC_PENDING_IRQ
406 bool
407 depends on GENERIC_HARDIRQS && SMP
408 default y
409
432source "arch/ia64/hp/sim/Kconfig" 410source "arch/ia64/hp/sim/Kconfig"
433 411
434source "arch/ia64/oprofile/Kconfig" 412source "arch/ia64/oprofile/Kconfig"
diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig
index b95fcf86ea00..3b65cbb31b1d 100644
--- a/arch/ia64/configs/bigsur_defconfig
+++ b/arch/ia64/configs/bigsur_defconfig
@@ -107,18 +107,12 @@ CONFIG_ACPI=y
107# 107#
108# ACPI (Advanced Configuration and Power Interface) Support 108# ACPI (Advanced Configuration and Power Interface) Support
109# 109#
110CONFIG_ACPI_BOOT=y
111CONFIG_ACPI_INTERPRETER=y
112CONFIG_ACPI_BUTTON=m 110CONFIG_ACPI_BUTTON=m
113CONFIG_ACPI_VIDEO=m
114CONFIG_ACPI_FAN=m 111CONFIG_ACPI_FAN=m
115CONFIG_ACPI_PROCESSOR=m 112CONFIG_ACPI_PROCESSOR=m
116CONFIG_ACPI_THERMAL=m 113CONFIG_ACPI_THERMAL=m
117CONFIG_ACPI_BLACKLIST_YEAR=0
118# CONFIG_ACPI_DEBUG is not set 114# CONFIG_ACPI_DEBUG is not set
119CONFIG_ACPI_BUS=y
120CONFIG_ACPI_POWER=y 115CONFIG_ACPI_POWER=y
121CONFIG_ACPI_PCI=y
122CONFIG_ACPI_SYSTEM=y 116CONFIG_ACPI_SYSTEM=y
123 117
124# 118#
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 5f1cceb590cd..08112ab38468 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -129,19 +129,12 @@ CONFIG_ACPI=y
129# 129#
130# ACPI (Advanced Configuration and Power Interface) Support 130# ACPI (Advanced Configuration and Power Interface) Support
131# 131#
132CONFIG_ACPI_BOOT=y
133CONFIG_ACPI_INTERPRETER=y
134# CONFIG_ACPI_BUTTON is not set 132# CONFIG_ACPI_BUTTON is not set
135CONFIG_ACPI_VIDEO=m
136CONFIG_ACPI_HOTKEY=m
137# CONFIG_ACPI_FAN is not set 133# CONFIG_ACPI_FAN is not set
138# CONFIG_ACPI_PROCESSOR is not set 134# CONFIG_ACPI_PROCESSOR is not set
139CONFIG_ACPI_NUMA=y 135CONFIG_ACPI_NUMA=y
140CONFIG_ACPI_BLACKLIST_YEAR=0
141# CONFIG_ACPI_DEBUG is not set 136# CONFIG_ACPI_DEBUG is not set
142CONFIG_ACPI_BUS=y
143CONFIG_ACPI_POWER=y 137CONFIG_ACPI_POWER=y
144CONFIG_ACPI_PCI=y
145CONFIG_ACPI_SYSTEM=y 138CONFIG_ACPI_SYSTEM=y
146# CONFIG_ACPI_CONTAINER is not set 139# CONFIG_ACPI_CONTAINER is not set
147 140
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index d536ec7f129c..d452e18ac494 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -127,20 +127,13 @@ CONFIG_ACPI=y
127# 127#
128# ACPI (Advanced Configuration and Power Interface) Support 128# ACPI (Advanced Configuration and Power Interface) Support
129# 129#
130CONFIG_ACPI_BOOT=y
131CONFIG_ACPI_INTERPRETER=y
132CONFIG_ACPI_BUTTON=m 130CONFIG_ACPI_BUTTON=m
133# CONFIG_ACPI_VIDEO is not set
134# CONFIG_ACPI_HOTKEY is not set
135CONFIG_ACPI_FAN=m 131CONFIG_ACPI_FAN=m
136CONFIG_ACPI_PROCESSOR=m 132CONFIG_ACPI_PROCESSOR=m
137# CONFIG_ACPI_HOTPLUG_CPU is not set 133# CONFIG_ACPI_HOTPLUG_CPU is not set
138CONFIG_ACPI_THERMAL=m 134CONFIG_ACPI_THERMAL=m
139CONFIG_ACPI_BLACKLIST_YEAR=0
140# CONFIG_ACPI_DEBUG is not set 135# CONFIG_ACPI_DEBUG is not set
141CONFIG_ACPI_BUS=y
142CONFIG_ACPI_POWER=y 136CONFIG_ACPI_POWER=y
143CONFIG_ACPI_PCI=y
144CONFIG_ACPI_SYSTEM=y 137CONFIG_ACPI_SYSTEM=y
145# CONFIG_ACPI_CONTAINER is not set 138# CONFIG_ACPI_CONTAINER is not set
146 139
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index d569036a4cea..80b0e9eb7fb3 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -127,19 +127,12 @@ CONFIG_ACPI=y
127# 127#
128# ACPI (Advanced Configuration and Power Interface) Support 128# ACPI (Advanced Configuration and Power Interface) Support
129# 129#
130CONFIG_ACPI_BOOT=y
131CONFIG_ACPI_INTERPRETER=y
132CONFIG_ACPI_BUTTON=y 130CONFIG_ACPI_BUTTON=y
133CONFIG_ACPI_VIDEO=m
134CONFIG_ACPI_HOTKEY=m
135CONFIG_ACPI_FAN=y 131CONFIG_ACPI_FAN=y
136CONFIG_ACPI_PROCESSOR=y 132CONFIG_ACPI_PROCESSOR=y
137CONFIG_ACPI_THERMAL=y 133CONFIG_ACPI_THERMAL=y
138CONFIG_ACPI_BLACKLIST_YEAR=0
139# CONFIG_ACPI_DEBUG is not set 134# CONFIG_ACPI_DEBUG is not set
140CONFIG_ACPI_BUS=y
141CONFIG_ACPI_POWER=y 135CONFIG_ACPI_POWER=y
142CONFIG_ACPI_PCI=y
143CONFIG_ACPI_SYSTEM=y 136CONFIG_ACPI_SYSTEM=y
144# CONFIG_ACPI_CONTAINER is not set 137# CONFIG_ACPI_CONTAINER is not set
145 138
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 2aa32f020707..5da208115ea1 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -117,20 +117,14 @@ CONFIG_ACPI=y
117# 117#
118# ACPI (Advanced Configuration and Power Interface) Support 118# ACPI (Advanced Configuration and Power Interface) Support
119# 119#
120CONFIG_ACPI_BOOT=y
121CONFIG_ACPI_INTERPRETER=y
122CONFIG_ACPI_BUTTON=m 120CONFIG_ACPI_BUTTON=m
123CONFIG_ACPI_VIDEO=m
124CONFIG_ACPI_FAN=m 121CONFIG_ACPI_FAN=m
125CONFIG_ACPI_PROCESSOR=m 122CONFIG_ACPI_PROCESSOR=m
126CONFIG_ACPI_HOTPLUG_CPU=y 123CONFIG_ACPI_HOTPLUG_CPU=y
127CONFIG_ACPI_THERMAL=m 124CONFIG_ACPI_THERMAL=m
128CONFIG_ACPI_NUMA=y 125CONFIG_ACPI_NUMA=y
129CONFIG_ACPI_BLACKLIST_YEAR=0
130# CONFIG_ACPI_DEBUG is not set 126# CONFIG_ACPI_DEBUG is not set
131CONFIG_ACPI_BUS=y
132CONFIG_ACPI_POWER=y 127CONFIG_ACPI_POWER=y
133CONFIG_ACPI_PCI=y
134CONFIG_ACPI_SYSTEM=y 128CONFIG_ACPI_SYSTEM=y
135CONFIG_ACPI_CONTAINER=m 129CONFIG_ACPI_CONTAINER=m
136 130
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 7dcb8582ae0d..b42ec37be51c 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -130,7 +130,7 @@ static void rs_stop(struct tty_struct *tty)
130 130
131static void rs_start(struct tty_struct *tty) 131static void rs_start(struct tty_struct *tty)
132{ 132{
133#if SIMSERIAL_DEBUG 133#ifdef SIMSERIAL_DEBUG
134 printk("rs_start: tty->stopped=%d tty->hw_stopped=%d tty->flow_stopped=%d\n", 134 printk("rs_start: tty->stopped=%d tty->hw_stopped=%d tty->flow_stopped=%d\n",
135 tty->stopped, tty->hw_stopped, tty->flow_stopped); 135 tty->stopped, tty->hw_stopped, tty->flow_stopped);
136#endif 136#endif
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index 829a6d80711c..0708edb06cc4 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -215,7 +215,7 @@ ia32_syscall_table:
215 data8 sys32_fork 215 data8 sys32_fork
216 data8 sys_read 216 data8 sys_read
217 data8 sys_write 217 data8 sys_write
218 data8 sys32_open /* 5 */ 218 data8 compat_sys_open /* 5 */
219 data8 sys_close 219 data8 sys_close
220 data8 sys32_waitpid 220 data8 sys32_waitpid
221 data8 sys_creat 221 data8 sys_creat
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index c1e20d65dd6c..e29a8a55486a 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -2359,37 +2359,6 @@ sys32_brk (unsigned int brk)
2359 return ret; 2359 return ret;
2360} 2360}
2361 2361
2362/*
2363 * Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag.
2364 */
2365asmlinkage long
2366sys32_open (const char __user * filename, int flags, int mode)
2367{
2368 char * tmp;
2369 int fd, error;
2370
2371 tmp = getname(filename);
2372 fd = PTR_ERR(tmp);
2373 if (!IS_ERR(tmp)) {
2374 fd = get_unused_fd();
2375 if (fd >= 0) {
2376 struct file *f = filp_open(tmp, flags, mode);
2377 error = PTR_ERR(f);
2378 if (IS_ERR(f))
2379 goto out_error;
2380 fd_install(fd, f);
2381 }
2382out:
2383 putname(tmp);
2384 }
2385 return fd;
2386
2387out_error:
2388 put_unused_fd(fd);
2389 fd = error;
2390 goto out;
2391}
2392
2393/* Structure for ia32 emulation on ia64 */ 2362/* Structure for ia32 emulation on ia64 */
2394struct epoll_event32 2363struct epoll_event32
2395{ 2364{
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index b242594be55b..307514f7a282 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -16,7 +16,7 @@ obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o
16obj-$(CONFIG_IA64_PALINFO) += palinfo.o 16obj-$(CONFIG_IA64_PALINFO) += palinfo.o
17obj-$(CONFIG_IOSAPIC) += iosapic.o 17obj-$(CONFIG_IOSAPIC) += iosapic.o
18obj-$(CONFIG_MODULES) += module.o 18obj-$(CONFIG_MODULES) += module.o
19obj-$(CONFIG_SMP) += smp.o smpboot.o domain.o 19obj-$(CONFIG_SMP) += smp.o smpboot.o
20obj-$(CONFIG_NUMA) += numa.o 20obj-$(CONFIG_NUMA) += numa.o
21obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o 21obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o
22obj-$(CONFIG_IA64_CYCLONE) += cyclone.o 22obj-$(CONFIG_IA64_CYCLONE) += cyclone.o
diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c
index 2623df5e2633..13a5b3b49bf8 100644
--- a/arch/ia64/kernel/acpi-ext.c
+++ b/arch/ia64/kernel/acpi-ext.c
@@ -17,20 +17,20 @@
17#include <asm/acpi-ext.h> 17#include <asm/acpi-ext.h>
18 18
19struct acpi_vendor_descriptor { 19struct acpi_vendor_descriptor {
20 u8 guid_id; 20 u8 guid_id;
21 efi_guid_t guid; 21 efi_guid_t guid;
22}; 22};
23 23
24struct acpi_vendor_info { 24struct acpi_vendor_info {
25 struct acpi_vendor_descriptor *descriptor; 25 struct acpi_vendor_descriptor *descriptor;
26 u8 *data; 26 u8 *data;
27 u32 length; 27 u32 length;
28}; 28};
29 29
30acpi_status 30acpi_status
31acpi_vendor_resource_match(struct acpi_resource *resource, void *context) 31acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
32{ 32{
33 struct acpi_vendor_info *info = (struct acpi_vendor_info *) context; 33 struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
34 struct acpi_resource_vendor *vendor; 34 struct acpi_resource_vendor *vendor;
35 struct acpi_vendor_descriptor *descriptor; 35 struct acpi_vendor_descriptor *descriptor;
36 u32 length; 36 u32 length;
@@ -38,8 +38,8 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
38 if (resource->id != ACPI_RSTYPE_VENDOR) 38 if (resource->id != ACPI_RSTYPE_VENDOR)
39 return AE_OK; 39 return AE_OK;
40 40
41 vendor = (struct acpi_resource_vendor *) &resource->data; 41 vendor = (struct acpi_resource_vendor *)&resource->data;
42 descriptor = (struct acpi_vendor_descriptor *) vendor->reserved; 42 descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
43 if (vendor->length <= sizeof(*info->descriptor) || 43 if (vendor->length <= sizeof(*info->descriptor) ||
44 descriptor->guid_id != info->descriptor->guid_id || 44 descriptor->guid_id != info->descriptor->guid_id ||
45 efi_guidcmp(descriptor->guid, info->descriptor->guid)) 45 efi_guidcmp(descriptor->guid, info->descriptor->guid))
@@ -50,21 +50,24 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
50 if (!info->data) 50 if (!info->data)
51 return AE_NO_MEMORY; 51 return AE_NO_MEMORY;
52 52
53 memcpy(info->data, vendor->reserved + sizeof(struct acpi_vendor_descriptor), length); 53 memcpy(info->data,
54 vendor->reserved + sizeof(struct acpi_vendor_descriptor),
55 length);
54 info->length = length; 56 info->length = length;
55 return AE_CTRL_TERMINATE; 57 return AE_CTRL_TERMINATE;
56} 58}
57 59
58acpi_status 60acpi_status
59acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id, 61acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
60 u8 **data, u32 *length) 62 u8 ** data, u32 * length)
61{ 63{
62 struct acpi_vendor_info info; 64 struct acpi_vendor_info info;
63 65
64 info.descriptor = id; 66 info.descriptor = id;
65 info.data = NULL; 67 info.data = NULL;
66 68
67 acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info); 69 acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match,
70 &info);
68 if (!info.data) 71 if (!info.data)
69 return AE_NOT_FOUND; 72 return AE_NOT_FOUND;
70 73
@@ -75,17 +78,19 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
75 78
76struct acpi_vendor_descriptor hp_ccsr_descriptor = { 79struct acpi_vendor_descriptor hp_ccsr_descriptor = {
77 .guid_id = 2, 80 .guid_id = 2,
78 .guid = EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad) 81 .guid =
82 EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01,
83 0x37, 0x0e, 0xad)
79}; 84};
80 85
81acpi_status 86acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length)
82hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
83{ 87{
84 acpi_status status; 88 acpi_status status;
85 u8 *data; 89 u8 *data;
86 u32 length; 90 u32 length;
87 91
88 status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length); 92 status =
93 acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
89 94
90 if (ACPI_FAILURE(status) || length != 16) 95 if (ACPI_FAILURE(status) || length != 16)
91 return AE_NOT_FOUND; 96 return AE_NOT_FOUND;
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 66970d7b6c87..28a4529fdd60 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -74,12 +74,11 @@ unsigned int acpi_cpei_override;
74unsigned int acpi_cpei_phys_cpuid; 74unsigned int acpi_cpei_phys_cpuid;
75 75
76#define MAX_SAPICS 256 76#define MAX_SAPICS 256
77u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = 77u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = {[0 ... MAX_SAPICS - 1] = -1 };
78 { [0 ... MAX_SAPICS - 1] = -1 }; 78
79EXPORT_SYMBOL(ia64_acpiid_to_sapicid); 79EXPORT_SYMBOL(ia64_acpiid_to_sapicid);
80 80
81const char * 81const char *acpi_get_sysname(void)
82acpi_get_sysname (void)
83{ 82{
84#ifdef CONFIG_IA64_GENERIC 83#ifdef CONFIG_IA64_GENERIC
85 unsigned long rsdp_phys; 84 unsigned long rsdp_phys;
@@ -89,27 +88,29 @@ acpi_get_sysname (void)
89 88
90 rsdp_phys = acpi_find_rsdp(); 89 rsdp_phys = acpi_find_rsdp();
91 if (!rsdp_phys) { 90 if (!rsdp_phys) {
92 printk(KERN_ERR "ACPI 2.0 RSDP not found, default to \"dig\"\n"); 91 printk(KERN_ERR
92 "ACPI 2.0 RSDP not found, default to \"dig\"\n");
93 return "dig"; 93 return "dig";
94 } 94 }
95 95
96 rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys); 96 rsdp = (struct acpi20_table_rsdp *)__va(rsdp_phys);
97 if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) { 97 if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
98 printk(KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n"); 98 printk(KERN_ERR
99 "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
99 return "dig"; 100 return "dig";
100 } 101 }
101 102
102 xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address); 103 xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address);
103 hdr = &xsdt->header; 104 hdr = &xsdt->header;
104 if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) { 105 if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
105 printk(KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n"); 106 printk(KERN_ERR
107 "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
106 return "dig"; 108 return "dig";
107 } 109 }
108 110
109 if (!strcmp(hdr->oem_id, "HP")) { 111 if (!strcmp(hdr->oem_id, "HP")) {
110 return "hpzx1"; 112 return "hpzx1";
111 } 113 } else if (!strcmp(hdr->oem_id, "SGI")) {
112 else if (!strcmp(hdr->oem_id, "SGI")) {
113 return "sn2"; 114 return "sn2";
114 } 115 }
115 116
@@ -131,7 +132,7 @@ acpi_get_sysname (void)
131#endif 132#endif
132} 133}
133 134
134#ifdef CONFIG_ACPI_BOOT 135#ifdef CONFIG_ACPI
135 136
136#define ACPI_MAX_PLATFORM_INTERRUPTS 256 137#define ACPI_MAX_PLATFORM_INTERRUPTS 256
137 138
@@ -146,8 +147,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
146 * Interrupt routing API for device drivers. Provides interrupt vector for 147 * Interrupt routing API for device drivers. Provides interrupt vector for
147 * a generic platform event. Currently only CPEI is implemented. 148 * a generic platform event. Currently only CPEI is implemented.
148 */ 149 */
149int 150int acpi_request_vector(u32 int_type)
150acpi_request_vector (u32 int_type)
151{ 151{
152 int vector = -1; 152 int vector = -1;
153 153
@@ -155,12 +155,12 @@ acpi_request_vector (u32 int_type)
155 /* corrected platform error interrupt */ 155 /* corrected platform error interrupt */
156 vector = platform_intr_list[int_type]; 156 vector = platform_intr_list[int_type];
157 } else 157 } else
158 printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n"); 158 printk(KERN_ERR
159 "acpi_request_vector(): invalid interrupt type\n");
159 return vector; 160 return vector;
160} 161}
161 162
162char * 163char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
163__acpi_map_table (unsigned long phys_addr, unsigned long size)
164{ 164{
165 return __va(phys_addr); 165 return __va(phys_addr);
166} 166}
@@ -169,19 +169,18 @@ __acpi_map_table (unsigned long phys_addr, unsigned long size)
169 Boot-time Table Parsing 169 Boot-time Table Parsing
170 -------------------------------------------------------------------------- */ 170 -------------------------------------------------------------------------- */
171 171
172static int total_cpus __initdata; 172static int total_cpus __initdata;
173static int available_cpus __initdata; 173static int available_cpus __initdata;
174struct acpi_table_madt * acpi_madt __initdata; 174struct acpi_table_madt *acpi_madt __initdata;
175static u8 has_8259; 175static u8 has_8259;
176
177 176
178static int __init 177static int __init
179acpi_parse_lapic_addr_ovr ( 178acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
180 acpi_table_entry_header *header, const unsigned long end) 179 const unsigned long end)
181{ 180{
182 struct acpi_table_lapic_addr_ovr *lapic; 181 struct acpi_table_lapic_addr_ovr *lapic;
183 182
184 lapic = (struct acpi_table_lapic_addr_ovr *) header; 183 lapic = (struct acpi_table_lapic_addr_ovr *)header;
185 184
186 if (BAD_MADT_ENTRY(lapic, end)) 185 if (BAD_MADT_ENTRY(lapic, end))
187 return -EINVAL; 186 return -EINVAL;
@@ -193,22 +192,23 @@ acpi_parse_lapic_addr_ovr (
193 return 0; 192 return 0;
194} 193}
195 194
196
197static int __init 195static int __init
198acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end) 196acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
199{ 197{
200 struct acpi_table_lsapic *lsapic; 198 struct acpi_table_lsapic *lsapic;
201 199
202 lsapic = (struct acpi_table_lsapic *) header; 200 lsapic = (struct acpi_table_lsapic *)header;
203 201
204 if (BAD_MADT_ENTRY(lsapic, end)) 202 if (BAD_MADT_ENTRY(lsapic, end))
205 return -EINVAL; 203 return -EINVAL;
206 204
207 if (lsapic->flags.enabled) { 205 if (lsapic->flags.enabled) {
208#ifdef CONFIG_SMP 206#ifdef CONFIG_SMP
209 smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid; 207 smp_boot_data.cpu_phys_id[available_cpus] =
208 (lsapic->id << 8) | lsapic->eid;
210#endif 209#endif
211 ia64_acpiid_to_sapicid[lsapic->acpi_id] = (lsapic->id << 8) | lsapic->eid; 210 ia64_acpiid_to_sapicid[lsapic->acpi_id] =
211 (lsapic->id << 8) | lsapic->eid;
212 ++available_cpus; 212 ++available_cpus;
213 } 213 }
214 214
@@ -216,13 +216,12 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
216 return 0; 216 return 0;
217} 217}
218 218
219
220static int __init 219static int __init
221acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end) 220acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
222{ 221{
223 struct acpi_table_lapic_nmi *lacpi_nmi; 222 struct acpi_table_lapic_nmi *lacpi_nmi;
224 223
225 lacpi_nmi = (struct acpi_table_lapic_nmi*) header; 224 lacpi_nmi = (struct acpi_table_lapic_nmi *)header;
226 225
227 if (BAD_MADT_ENTRY(lacpi_nmi, end)) 226 if (BAD_MADT_ENTRY(lacpi_nmi, end))
228 return -EINVAL; 227 return -EINVAL;
@@ -231,13 +230,12 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
231 return 0; 230 return 0;
232} 231}
233 232
234
235static int __init 233static int __init
236acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end) 234acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
237{ 235{
238 struct acpi_table_iosapic *iosapic; 236 struct acpi_table_iosapic *iosapic;
239 237
240 iosapic = (struct acpi_table_iosapic *) header; 238 iosapic = (struct acpi_table_iosapic *)header;
241 239
242 if (BAD_MADT_ENTRY(iosapic, end)) 240 if (BAD_MADT_ENTRY(iosapic, end))
243 return -EINVAL; 241 return -EINVAL;
@@ -245,15 +243,14 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
245 return iosapic_init(iosapic->address, iosapic->global_irq_base); 243 return iosapic_init(iosapic->address, iosapic->global_irq_base);
246} 244}
247 245
248
249static int __init 246static int __init
250acpi_parse_plat_int_src ( 247acpi_parse_plat_int_src(acpi_table_entry_header * header,
251 acpi_table_entry_header *header, const unsigned long end) 248 const unsigned long end)
252{ 249{
253 struct acpi_table_plat_int_src *plintsrc; 250 struct acpi_table_plat_int_src *plintsrc;
254 int vector; 251 int vector;
255 252
256 plintsrc = (struct acpi_table_plat_int_src *) header; 253 plintsrc = (struct acpi_table_plat_int_src *)header;
257 254
258 if (BAD_MADT_ENTRY(plintsrc, end)) 255 if (BAD_MADT_ENTRY(plintsrc, end))
259 return -EINVAL; 256 return -EINVAL;
@@ -267,8 +264,12 @@ acpi_parse_plat_int_src (
267 plintsrc->iosapic_vector, 264 plintsrc->iosapic_vector,
268 plintsrc->eid, 265 plintsrc->eid,
269 plintsrc->id, 266 plintsrc->id,
270 (plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, 267 (plintsrc->flags.polarity ==
271 (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); 268 1) ? IOSAPIC_POL_HIGH :
269 IOSAPIC_POL_LOW,
270 (plintsrc->flags.trigger ==
271 1) ? IOSAPIC_EDGE :
272 IOSAPIC_LEVEL);
272 273
273 platform_intr_list[plintsrc->type] = vector; 274 platform_intr_list[plintsrc->type] = vector;
274 if (acpi_madt_rev > 1) { 275 if (acpi_madt_rev > 1) {
@@ -283,7 +284,6 @@ acpi_parse_plat_int_src (
283 return 0; 284 return 0;
284} 285}
285 286
286
287unsigned int can_cpei_retarget(void) 287unsigned int can_cpei_retarget(void)
288{ 288{
289 extern int cpe_vector; 289 extern int cpe_vector;
@@ -322,29 +322,30 @@ unsigned int get_cpei_target_cpu(void)
322} 322}
323 323
324static int __init 324static int __init
325acpi_parse_int_src_ovr ( 325acpi_parse_int_src_ovr(acpi_table_entry_header * header,
326 acpi_table_entry_header *header, const unsigned long end) 326 const unsigned long end)
327{ 327{
328 struct acpi_table_int_src_ovr *p; 328 struct acpi_table_int_src_ovr *p;
329 329
330 p = (struct acpi_table_int_src_ovr *) header; 330 p = (struct acpi_table_int_src_ovr *)header;
331 331
332 if (BAD_MADT_ENTRY(p, end)) 332 if (BAD_MADT_ENTRY(p, end))
333 return -EINVAL; 333 return -EINVAL;
334 334
335 iosapic_override_isa_irq(p->bus_irq, p->global_irq, 335 iosapic_override_isa_irq(p->bus_irq, p->global_irq,
336 (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, 336 (p->flags.polarity ==
337 (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); 337 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
338 (p->flags.trigger ==
339 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
338 return 0; 340 return 0;
339} 341}
340 342
341
342static int __init 343static int __init
343acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end) 344acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
344{ 345{
345 struct acpi_table_nmi_src *nmi_src; 346 struct acpi_table_nmi_src *nmi_src;
346 347
347 nmi_src = (struct acpi_table_nmi_src*) header; 348 nmi_src = (struct acpi_table_nmi_src *)header;
348 349
349 if (BAD_MADT_ENTRY(nmi_src, end)) 350 if (BAD_MADT_ENTRY(nmi_src, end))
350 return -EINVAL; 351 return -EINVAL;
@@ -353,11 +354,9 @@ acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
353 return 0; 354 return 0;
354} 355}
355 356
356static void __init 357static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
357acpi_madt_oem_check (char *oem_id, char *oem_table_id)
358{ 358{
359 if (!strncmp(oem_id, "IBM", 3) && 359 if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) {
360 (!strncmp(oem_table_id, "SERMOW", 6))) {
361 360
362 /* 361 /*
363 * Unfortunately ITC_DRIFT is not yet part of the 362 * Unfortunately ITC_DRIFT is not yet part of the
@@ -370,19 +369,18 @@ acpi_madt_oem_check (char *oem_id, char *oem_table_id)
370 } 369 }
371} 370}
372 371
373static int __init 372static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
374acpi_parse_madt (unsigned long phys_addr, unsigned long size)
375{ 373{
376 if (!phys_addr || !size) 374 if (!phys_addr || !size)
377 return -EINVAL; 375 return -EINVAL;
378 376
379 acpi_madt = (struct acpi_table_madt *) __va(phys_addr); 377 acpi_madt = (struct acpi_table_madt *)__va(phys_addr);
380 378
381 acpi_madt_rev = acpi_madt->header.revision; 379 acpi_madt_rev = acpi_madt->header.revision;
382 380
383 /* remember the value for reference after free_initmem() */ 381 /* remember the value for reference after free_initmem() */
384#ifdef CONFIG_ITANIUM 382#ifdef CONFIG_ITANIUM
385 has_8259 = 1; /* Firmware on old Itanium systems is broken */ 383 has_8259 = 1; /* Firmware on old Itanium systems is broken */
386#else 384#else
387 has_8259 = acpi_madt->flags.pcat_compat; 385 has_8259 = acpi_madt->flags.pcat_compat;
388#endif 386#endif
@@ -396,19 +394,18 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
396 printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr); 394 printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
397 395
398 acpi_madt_oem_check(acpi_madt->header.oem_id, 396 acpi_madt_oem_check(acpi_madt->header.oem_id,
399 acpi_madt->header.oem_table_id); 397 acpi_madt->header.oem_table_id);
400 398
401 return 0; 399 return 0;
402} 400}
403 401
404
405#ifdef CONFIG_ACPI_NUMA 402#ifdef CONFIG_ACPI_NUMA
406 403
407#undef SLIT_DEBUG 404#undef SLIT_DEBUG
408 405
409#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32) 406#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
410 407
411static int __initdata srat_num_cpus; /* number of cpus */ 408static int __initdata srat_num_cpus; /* number of cpus */
412static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; 409static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
413#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) 410#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
414#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) 411#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
@@ -421,15 +418,15 @@ static struct acpi_table_slit __initdata *slit_table;
421 * ACPI 2.0 SLIT (System Locality Information Table) 418 * ACPI 2.0 SLIT (System Locality Information Table)
422 * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf 419 * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
423 */ 420 */
424void __init 421void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
425acpi_numa_slit_init (struct acpi_table_slit *slit)
426{ 422{
427 u32 len; 423 u32 len;
428 424
429 len = sizeof(struct acpi_table_header) + 8 425 len = sizeof(struct acpi_table_header) + 8
430 + slit->localities * slit->localities; 426 + slit->localities * slit->localities;
431 if (slit->header.length != len) { 427 if (slit->header.length != len) {
432 printk(KERN_ERR "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n", 428 printk(KERN_ERR
429 "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
433 len, slit->header.length); 430 len, slit->header.length);
434 memset(numa_slit, 10, sizeof(numa_slit)); 431 memset(numa_slit, 10, sizeof(numa_slit));
435 return; 432 return;
@@ -438,19 +435,20 @@ acpi_numa_slit_init (struct acpi_table_slit *slit)
438} 435}
439 436
440void __init 437void __init
441acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa) 438acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
442{ 439{
443 /* record this node in proximity bitmap */ 440 /* record this node in proximity bitmap */
444 pxm_bit_set(pa->proximity_domain); 441 pxm_bit_set(pa->proximity_domain);
445 442
446 node_cpuid[srat_num_cpus].phys_id = (pa->apic_id << 8) | (pa->lsapic_eid); 443 node_cpuid[srat_num_cpus].phys_id =
444 (pa->apic_id << 8) | (pa->lsapic_eid);
447 /* nid should be overridden as logical node id later */ 445 /* nid should be overridden as logical node id later */
448 node_cpuid[srat_num_cpus].nid = pa->proximity_domain; 446 node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
449 srat_num_cpus++; 447 srat_num_cpus++;
450} 448}
451 449
452void __init 450void __init
453acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma) 451acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
454{ 452{
455 unsigned long paddr, size; 453 unsigned long paddr, size;
456 u8 pxm; 454 u8 pxm;
@@ -487,8 +485,7 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
487 num_node_memblks++; 485 num_node_memblks++;
488} 486}
489 487
490void __init 488void __init acpi_numa_arch_fixup(void)
491acpi_numa_arch_fixup (void)
492{ 489{
493 int i, j, node_from, node_to; 490 int i, j, node_from, node_to;
494 491
@@ -534,21 +531,24 @@ acpi_numa_arch_fixup (void)
534 for (i = 0; i < srat_num_cpus; i++) 531 for (i = 0; i < srat_num_cpus; i++)
535 node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid]; 532 node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
536 533
537 printk(KERN_INFO "Number of logical nodes in system = %d\n", num_online_nodes()); 534 printk(KERN_INFO "Number of logical nodes in system = %d\n",
538 printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks); 535 num_online_nodes());
536 printk(KERN_INFO "Number of memory chunks in system = %d\n",
537 num_node_memblks);
539 538
540 if (!slit_table) return; 539 if (!slit_table)
540 return;
541 memset(numa_slit, -1, sizeof(numa_slit)); 541 memset(numa_slit, -1, sizeof(numa_slit));
542 for (i=0; i<slit_table->localities; i++) { 542 for (i = 0; i < slit_table->localities; i++) {
543 if (!pxm_bit_test(i)) 543 if (!pxm_bit_test(i))
544 continue; 544 continue;
545 node_from = pxm_to_nid_map[i]; 545 node_from = pxm_to_nid_map[i];
546 for (j=0; j<slit_table->localities; j++) { 546 for (j = 0; j < slit_table->localities; j++) {
547 if (!pxm_bit_test(j)) 547 if (!pxm_bit_test(j))
548 continue; 548 continue;
549 node_to = pxm_to_nid_map[j]; 549 node_to = pxm_to_nid_map[j];
550 node_distance(node_from, node_to) = 550 node_distance(node_from, node_to) =
551 slit_table->entry[i*slit_table->localities + j]; 551 slit_table->entry[i * slit_table->localities + j];
552 } 552 }
553 } 553 }
554 554
@@ -556,34 +556,41 @@ acpi_numa_arch_fixup (void)
556 printk("ACPI 2.0 SLIT locality table:\n"); 556 printk("ACPI 2.0 SLIT locality table:\n");
557 for_each_online_node(i) { 557 for_each_online_node(i) {
558 for_each_online_node(j) 558 for_each_online_node(j)
559 printk("%03d ", node_distance(i,j)); 559 printk("%03d ", node_distance(i, j));
560 printk("\n"); 560 printk("\n");
561 } 561 }
562#endif 562#endif
563} 563}
564#endif /* CONFIG_ACPI_NUMA */ 564#endif /* CONFIG_ACPI_NUMA */
565 565
566unsigned int 566/*
567acpi_register_gsi (u32 gsi, int edge_level, int active_high_low) 567 * success: return IRQ number (>=0)
568 * failure: return < 0
569 */
570int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
568{ 571{
569 if (has_8259 && gsi < 16) 572 if (has_8259 && gsi < 16)
570 return isa_irq_to_vector(gsi); 573 return isa_irq_to_vector(gsi);
571 574
572 return iosapic_register_intr(gsi, 575 return iosapic_register_intr(gsi,
573 (active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, 576 (active_high_low ==
574 (edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); 577 ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
578 IOSAPIC_POL_LOW,
579 (edge_level ==
580 ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
581 IOSAPIC_LEVEL);
575} 582}
583
576EXPORT_SYMBOL(acpi_register_gsi); 584EXPORT_SYMBOL(acpi_register_gsi);
577 585
578void 586void acpi_unregister_gsi(u32 gsi)
579acpi_unregister_gsi (u32 gsi)
580{ 587{
581 iosapic_unregister_intr(gsi); 588 iosapic_unregister_intr(gsi);
582} 589}
590
583EXPORT_SYMBOL(acpi_unregister_gsi); 591EXPORT_SYMBOL(acpi_unregister_gsi);
584 592
585static int __init 593static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size)
586acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
587{ 594{
588 struct acpi_table_header *fadt_header; 595 struct acpi_table_header *fadt_header;
589 struct fadt_descriptor_rev2 *fadt; 596 struct fadt_descriptor_rev2 *fadt;
@@ -591,11 +598,11 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
591 if (!phys_addr || !size) 598 if (!phys_addr || !size)
592 return -EINVAL; 599 return -EINVAL;
593 600
594 fadt_header = (struct acpi_table_header *) __va(phys_addr); 601 fadt_header = (struct acpi_table_header *)__va(phys_addr);
595 if (fadt_header->revision != 3) 602 if (fadt_header->revision != 3)
596 return -ENODEV; /* Only deal with ACPI 2.0 FADT */ 603 return -ENODEV; /* Only deal with ACPI 2.0 FADT */
597 604
598 fadt = (struct fadt_descriptor_rev2 *) fadt_header; 605 fadt = (struct fadt_descriptor_rev2 *)fadt_header;
599 606
600 if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER)) 607 if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
601 acpi_kbd_controller_present = 0; 608 acpi_kbd_controller_present = 0;
@@ -607,22 +614,19 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
607 return 0; 614 return 0;
608} 615}
609 616
610 617unsigned long __init acpi_find_rsdp(void)
611unsigned long __init
612acpi_find_rsdp (void)
613{ 618{
614 unsigned long rsdp_phys = 0; 619 unsigned long rsdp_phys = 0;
615 620
616 if (efi.acpi20) 621 if (efi.acpi20)
617 rsdp_phys = __pa(efi.acpi20); 622 rsdp_phys = __pa(efi.acpi20);
618 else if (efi.acpi) 623 else if (efi.acpi)
619 printk(KERN_WARNING PREFIX "v1.0/r0.71 tables no longer supported\n"); 624 printk(KERN_WARNING PREFIX
625 "v1.0/r0.71 tables no longer supported\n");
620 return rsdp_phys; 626 return rsdp_phys;
621} 627}
622 628
623 629int __init acpi_boot_init(void)
624int __init
625acpi_boot_init (void)
626{ 630{
627 631
628 /* 632 /*
@@ -640,31 +644,43 @@ acpi_boot_init (void)
640 644
641 /* Local APIC */ 645 /* Local APIC */
642 646
643 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0) 647 if (acpi_table_parse_madt
644 printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); 648 (ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
649 printk(KERN_ERR PREFIX
650 "Error parsing LAPIC address override entry\n");
645 651
646 if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1) 652 if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS)
647 printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n"); 653 < 1)
654 printk(KERN_ERR PREFIX
655 "Error parsing MADT - no LAPIC entries\n");
648 656
649 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0) 657 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0)
658 < 0)
650 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 659 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
651 660
652 /* I/O APIC */ 661 /* I/O APIC */
653 662
654 if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) 663 if (acpi_table_parse_madt
655 printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n"); 664 (ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
665 printk(KERN_ERR PREFIX
666 "Error parsing MADT - no IOSAPIC entries\n");
656 667
657 /* System-Level Interrupt Routing */ 668 /* System-Level Interrupt Routing */
658 669
659 if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0) 670 if (acpi_table_parse_madt
660 printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n"); 671 (ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src,
672 ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
673 printk(KERN_ERR PREFIX
674 "Error parsing platform interrupt source entry\n");
661 675
662 if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0) 676 if (acpi_table_parse_madt
663 printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); 677 (ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
678 printk(KERN_ERR PREFIX
679 "Error parsing interrupt source overrides entry\n");
664 680
665 if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0) 681 if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
666 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); 682 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
667 skip_madt: 683 skip_madt:
668 684
669 /* 685 /*
670 * FADT says whether a legacy keyboard controller is present. 686 * FADT says whether a legacy keyboard controller is present.
@@ -679,8 +695,9 @@ acpi_boot_init (void)
679 if (available_cpus == 0) { 695 if (available_cpus == 0) {
680 printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n"); 696 printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
681 printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id()); 697 printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
682 smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id(); 698 smp_boot_data.cpu_phys_id[available_cpus] =
683 available_cpus = 1; /* We've got at least one of these, no? */ 699 hard_smp_processor_id();
700 available_cpus = 1; /* We've got at least one of these, no? */
684 } 701 }
685 smp_boot_data.cpu_count = available_cpus; 702 smp_boot_data.cpu_count = available_cpus;
686 703
@@ -689,8 +706,10 @@ acpi_boot_init (void)
689 if (srat_num_cpus == 0) { 706 if (srat_num_cpus == 0) {
690 int cpu, i = 1; 707 int cpu, i = 1;
691 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++) 708 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
692 if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id()) 709 if (smp_boot_data.cpu_phys_id[cpu] !=
693 node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu]; 710 hard_smp_processor_id())
711 node_cpuid[i++].phys_id =
712 smp_boot_data.cpu_phys_id[cpu];
694 } 713 }
695# endif 714# endif
696#endif 715#endif
@@ -698,12 +717,12 @@ acpi_boot_init (void)
698 build_cpu_to_node_map(); 717 build_cpu_to_node_map();
699#endif 718#endif
700 /* Make boot-up look pretty */ 719 /* Make boot-up look pretty */
701 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus); 720 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
721 total_cpus);
702 return 0; 722 return 0;
703} 723}
704 724
705int 725int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
706acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
707{ 726{
708 int vector; 727 int vector;
709 728
@@ -724,11 +743,10 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
724 */ 743 */
725#ifdef CONFIG_ACPI_HOTPLUG_CPU 744#ifdef CONFIG_ACPI_HOTPLUG_CPU
726static 745static
727int 746int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
728acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
729{ 747{
730#ifdef CONFIG_ACPI_NUMA 748#ifdef CONFIG_ACPI_NUMA
731 int pxm_id; 749 int pxm_id;
732 750
733 pxm_id = acpi_get_pxm(handle); 751 pxm_id = acpi_get_pxm(handle);
734 752
@@ -736,31 +754,28 @@ acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
736 * Assuming that the container driver would have set the proximity 754 * Assuming that the container driver would have set the proximity
737 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag 755 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
738 */ 756 */
739 node_cpuid[cpu].nid = (pxm_id < 0) ? 0: 757 node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
740 pxm_to_nid_map[pxm_id];
741 758
742 node_cpuid[cpu].phys_id = physid; 759 node_cpuid[cpu].phys_id = physid;
743#endif 760#endif
744 return(0); 761 return (0);
745} 762}
746 763
747 764int acpi_map_lsapic(acpi_handle handle, int *pcpu)
748int
749acpi_map_lsapic(acpi_handle handle, int *pcpu)
750{ 765{
751 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 766 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
752 union acpi_object *obj; 767 union acpi_object *obj;
753 struct acpi_table_lsapic *lsapic; 768 struct acpi_table_lsapic *lsapic;
754 cpumask_t tmp_map; 769 cpumask_t tmp_map;
755 long physid; 770 long physid;
756 int cpu; 771 int cpu;
757 772
758 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 773 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
759 return -EINVAL; 774 return -EINVAL;
760 775
761 if (!buffer.length || !buffer.pointer) 776 if (!buffer.length || !buffer.pointer)
762 return -EINVAL; 777 return -EINVAL;
763 778
764 obj = buffer.pointer; 779 obj = buffer.pointer;
765 if (obj->type != ACPI_TYPE_BUFFER || 780 if (obj->type != ACPI_TYPE_BUFFER ||
766 obj->buffer.length < sizeof(*lsapic)) { 781 obj->buffer.length < sizeof(*lsapic)) {
@@ -776,7 +791,7 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
776 return -EINVAL; 791 return -EINVAL;
777 } 792 }
778 793
779 physid = ((lsapic->id <<8) | (lsapic->eid)); 794 physid = ((lsapic->id << 8) | (lsapic->eid));
780 795
781 acpi_os_free(buffer.pointer); 796 acpi_os_free(buffer.pointer);
782 buffer.length = ACPI_ALLOCATE_BUFFER; 797 buffer.length = ACPI_ALLOCATE_BUFFER;
@@ -784,50 +799,49 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
784 799
785 cpus_complement(tmp_map, cpu_present_map); 800 cpus_complement(tmp_map, cpu_present_map);
786 cpu = first_cpu(tmp_map); 801 cpu = first_cpu(tmp_map);
787 if(cpu >= NR_CPUS) 802 if (cpu >= NR_CPUS)
788 return -EINVAL; 803 return -EINVAL;
789 804
790 acpi_map_cpu2node(handle, cpu, physid); 805 acpi_map_cpu2node(handle, cpu, physid);
791 806
792 cpu_set(cpu, cpu_present_map); 807 cpu_set(cpu, cpu_present_map);
793 ia64_cpu_to_sapicid[cpu] = physid; 808 ia64_cpu_to_sapicid[cpu] = physid;
794 ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu]; 809 ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu];
795 810
796 *pcpu = cpu; 811 *pcpu = cpu;
797 return(0); 812 return (0);
798} 813}
799EXPORT_SYMBOL(acpi_map_lsapic);
800 814
815EXPORT_SYMBOL(acpi_map_lsapic);
801 816
802int 817int acpi_unmap_lsapic(int cpu)
803acpi_unmap_lsapic(int cpu)
804{ 818{
805 int i; 819 int i;
806 820
807 for (i=0; i<MAX_SAPICS; i++) { 821 for (i = 0; i < MAX_SAPICS; i++) {
808 if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) { 822 if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
809 ia64_acpiid_to_sapicid[i] = -1; 823 ia64_acpiid_to_sapicid[i] = -1;
810 break; 824 break;
811 } 825 }
812 } 826 }
813 ia64_cpu_to_sapicid[cpu] = -1; 827 ia64_cpu_to_sapicid[cpu] = -1;
814 cpu_clear(cpu,cpu_present_map); 828 cpu_clear(cpu, cpu_present_map);
815 829
816#ifdef CONFIG_ACPI_NUMA 830#ifdef CONFIG_ACPI_NUMA
817 /* NUMA specific cleanup's */ 831 /* NUMA specific cleanup's */
818#endif 832#endif
819 833
820 return(0); 834 return (0);
821} 835}
836
822EXPORT_SYMBOL(acpi_unmap_lsapic); 837EXPORT_SYMBOL(acpi_unmap_lsapic);
823#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 838#endif /* CONFIG_ACPI_HOTPLUG_CPU */
824
825 839
826#ifdef CONFIG_ACPI_NUMA 840#ifdef CONFIG_ACPI_NUMA
827acpi_status __devinit 841acpi_status __devinit
828acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret) 842acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
829{ 843{
830 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 844 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
831 union acpi_object *obj; 845 union acpi_object *obj;
832 struct acpi_table_iosapic *iosapic; 846 struct acpi_table_iosapic *iosapic;
833 unsigned int gsi_base; 847 unsigned int gsi_base;
@@ -876,10 +890,9 @@ acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
876 map_iosapic_to_node(gsi_base, node); 890 map_iosapic_to_node(gsi_base, node);
877 return AE_OK; 891 return AE_OK;
878} 892}
879#endif /* CONFIG_NUMA */ 893#endif /* CONFIG_NUMA */
880 894
881int 895int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
882acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
883{ 896{
884 int err; 897 int err;
885 898
@@ -888,17 +901,18 @@ acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
888 901
889#if CONFIG_ACPI_NUMA 902#if CONFIG_ACPI_NUMA
890 acpi_map_iosapic(handle, 0, NULL, NULL); 903 acpi_map_iosapic(handle, 0, NULL, NULL);
891#endif /* CONFIG_ACPI_NUMA */ 904#endif /* CONFIG_ACPI_NUMA */
892 905
893 return 0; 906 return 0;
894} 907}
908
895EXPORT_SYMBOL(acpi_register_ioapic); 909EXPORT_SYMBOL(acpi_register_ioapic);
896 910
897int 911int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
898acpi_unregister_ioapic (acpi_handle handle, u32 gsi_base)
899{ 912{
900 return iosapic_remove(gsi_base); 913 return iosapic_remove(gsi_base);
901} 914}
915
902EXPORT_SYMBOL(acpi_unregister_ioapic); 916EXPORT_SYMBOL(acpi_unregister_ioapic);
903 917
904#endif /* CONFIG_ACPI_BOOT */ 918#endif /* CONFIG_ACPI */
diff --git a/arch/ia64/kernel/domain.c b/arch/ia64/kernel/domain.c
deleted file mode 100644
index bbb8efe126b7..000000000000
--- a/arch/ia64/kernel/domain.c
+++ /dev/null
@@ -1,396 +0,0 @@
1/*
2 * arch/ia64/kernel/domain.c
3 * Architecture specific sched-domains builder.
4 *
5 * Copyright (C) 2004 Jesse Barnes
6 * Copyright (C) 2004 Silicon Graphics, Inc.
7 */
8
9#include <linux/sched.h>
10#include <linux/percpu.h>
11#include <linux/slab.h>
12#include <linux/cpumask.h>
13#include <linux/init.h>
14#include <linux/topology.h>
15#include <linux/nodemask.h>
16
17#define SD_NODES_PER_DOMAIN 16
18
19#ifdef CONFIG_NUMA
20/**
21 * find_next_best_node - find the next node to include in a sched_domain
22 * @node: node whose sched_domain we're building
23 * @used_nodes: nodes already in the sched_domain
24 *
25 * Find the next node to include in a given scheduling domain. Simply
26 * finds the closest node not already in the @used_nodes map.
27 *
28 * Should use nodemask_t.
29 */
30static int find_next_best_node(int node, unsigned long *used_nodes)
31{
32 int i, n, val, min_val, best_node = 0;
33
34 min_val = INT_MAX;
35
36 for (i = 0; i < MAX_NUMNODES; i++) {
37 /* Start at @node */
38 n = (node + i) % MAX_NUMNODES;
39
40 if (!nr_cpus_node(n))
41 continue;
42
43 /* Skip already used nodes */
44 if (test_bit(n, used_nodes))
45 continue;
46
47 /* Simple min distance search */
48 val = node_distance(node, n);
49
50 if (val < min_val) {
51 min_val = val;
52 best_node = n;
53 }
54 }
55
56 set_bit(best_node, used_nodes);
57 return best_node;
58}
59
60/**
61 * sched_domain_node_span - get a cpumask for a node's sched_domain
62 * @node: node whose cpumask we're constructing
63 * @size: number of nodes to include in this span
64 *
65 * Given a node, construct a good cpumask for its sched_domain to span. It
66 * should be one that prevents unnecessary balancing, but also spreads tasks
67 * out optimally.
68 */
69static cpumask_t sched_domain_node_span(int node)
70{
71 int i;
72 cpumask_t span, nodemask;
73 DECLARE_BITMAP(used_nodes, MAX_NUMNODES);
74
75 cpus_clear(span);
76 bitmap_zero(used_nodes, MAX_NUMNODES);
77
78 nodemask = node_to_cpumask(node);
79 cpus_or(span, span, nodemask);
80 set_bit(node, used_nodes);
81
82 for (i = 1; i < SD_NODES_PER_DOMAIN; i++) {
83 int next_node = find_next_best_node(node, used_nodes);
84 nodemask = node_to_cpumask(next_node);
85 cpus_or(span, span, nodemask);
86 }
87
88 return span;
89}
90#endif
91
92/*
93 * At the moment, CONFIG_SCHED_SMT is never defined, but leave it in so we
94 * can switch it on easily if needed.
95 */
96#ifdef CONFIG_SCHED_SMT
97static DEFINE_PER_CPU(struct sched_domain, cpu_domains);
98static struct sched_group sched_group_cpus[NR_CPUS];
99static int cpu_to_cpu_group(int cpu)
100{
101 return cpu;
102}
103#endif
104
105static DEFINE_PER_CPU(struct sched_domain, phys_domains);
106static struct sched_group sched_group_phys[NR_CPUS];
107static int cpu_to_phys_group(int cpu)
108{
109#ifdef CONFIG_SCHED_SMT
110 return first_cpu(cpu_sibling_map[cpu]);
111#else
112 return cpu;
113#endif
114}
115
116#ifdef CONFIG_NUMA
117/*
118 * The init_sched_build_groups can't handle what we want to do with node
119 * groups, so roll our own. Now each node has its own list of groups which
120 * gets dynamically allocated.
121 */
122static DEFINE_PER_CPU(struct sched_domain, node_domains);
123static struct sched_group *sched_group_nodes[MAX_NUMNODES];
124
125static DEFINE_PER_CPU(struct sched_domain, allnodes_domains);
126static struct sched_group sched_group_allnodes[MAX_NUMNODES];
127
128static int cpu_to_allnodes_group(int cpu)
129{
130 return cpu_to_node(cpu);
131}
132#endif
133
134/*
135 * Build sched domains for a given set of cpus and attach the sched domains
136 * to the individual cpus
137 */
138void build_sched_domains(const cpumask_t *cpu_map)
139{
140 int i;
141
142 /*
143 * Set up domains for cpus specified by the cpu_map.
144 */
145 for_each_cpu_mask(i, *cpu_map) {
146 int group;
147 struct sched_domain *sd = NULL, *p;
148 cpumask_t nodemask = node_to_cpumask(cpu_to_node(i));
149
150 cpus_and(nodemask, nodemask, *cpu_map);
151
152#ifdef CONFIG_NUMA
153 if (num_online_cpus()
154 > SD_NODES_PER_DOMAIN*cpus_weight(nodemask)) {
155 sd = &per_cpu(allnodes_domains, i);
156 *sd = SD_ALLNODES_INIT;
157 sd->span = *cpu_map;
158 group = cpu_to_allnodes_group(i);
159 sd->groups = &sched_group_allnodes[group];
160 p = sd;
161 } else
162 p = NULL;
163
164 sd = &per_cpu(node_domains, i);
165 *sd = SD_NODE_INIT;
166 sd->span = sched_domain_node_span(cpu_to_node(i));
167 sd->parent = p;
168 cpus_and(sd->span, sd->span, *cpu_map);
169#endif
170
171 p = sd;
172 sd = &per_cpu(phys_domains, i);
173 group = cpu_to_phys_group(i);
174 *sd = SD_CPU_INIT;
175 sd->span = nodemask;
176 sd->parent = p;
177 sd->groups = &sched_group_phys[group];
178
179#ifdef CONFIG_SCHED_SMT
180 p = sd;
181 sd = &per_cpu(cpu_domains, i);
182 group = cpu_to_cpu_group(i);
183 *sd = SD_SIBLING_INIT;
184 sd->span = cpu_sibling_map[i];
185 cpus_and(sd->span, sd->span, *cpu_map);
186 sd->parent = p;
187 sd->groups = &sched_group_cpus[group];
188#endif
189 }
190
191#ifdef CONFIG_SCHED_SMT
192 /* Set up CPU (sibling) groups */
193 for_each_cpu_mask(i, *cpu_map) {
194 cpumask_t this_sibling_map = cpu_sibling_map[i];
195 cpus_and(this_sibling_map, this_sibling_map, *cpu_map);
196 if (i != first_cpu(this_sibling_map))
197 continue;
198
199 init_sched_build_groups(sched_group_cpus, this_sibling_map,
200 &cpu_to_cpu_group);
201 }
202#endif
203
204 /* Set up physical groups */
205 for (i = 0; i < MAX_NUMNODES; i++) {
206 cpumask_t nodemask = node_to_cpumask(i);
207
208 cpus_and(nodemask, nodemask, *cpu_map);
209 if (cpus_empty(nodemask))
210 continue;
211
212 init_sched_build_groups(sched_group_phys, nodemask,
213 &cpu_to_phys_group);
214 }
215
216#ifdef CONFIG_NUMA
217 init_sched_build_groups(sched_group_allnodes, *cpu_map,
218 &cpu_to_allnodes_group);
219
220 for (i = 0; i < MAX_NUMNODES; i++) {
221 /* Set up node groups */
222 struct sched_group *sg, *prev;
223 cpumask_t nodemask = node_to_cpumask(i);
224 cpumask_t domainspan;
225 cpumask_t covered = CPU_MASK_NONE;
226 int j;
227
228 cpus_and(nodemask, nodemask, *cpu_map);
229 if (cpus_empty(nodemask))
230 continue;
231
232 domainspan = sched_domain_node_span(i);
233 cpus_and(domainspan, domainspan, *cpu_map);
234
235 sg = kmalloc(sizeof(struct sched_group), GFP_KERNEL);
236 sched_group_nodes[i] = sg;
237 for_each_cpu_mask(j, nodemask) {
238 struct sched_domain *sd;
239 sd = &per_cpu(node_domains, j);
240 sd->groups = sg;
241 if (sd->groups == NULL) {
242 /* Turn off balancing if we have no groups */
243 sd->flags = 0;
244 }
245 }
246 if (!sg) {
247 printk(KERN_WARNING
248 "Can not alloc domain group for node %d\n", i);
249 continue;
250 }
251 sg->cpu_power = 0;
252 sg->cpumask = nodemask;
253 cpus_or(covered, covered, nodemask);
254 prev = sg;
255
256 for (j = 0; j < MAX_NUMNODES; j++) {
257 cpumask_t tmp, notcovered;
258 int n = (i + j) % MAX_NUMNODES;
259
260 cpus_complement(notcovered, covered);
261 cpus_and(tmp, notcovered, *cpu_map);
262 cpus_and(tmp, tmp, domainspan);
263 if (cpus_empty(tmp))
264 break;
265
266 nodemask = node_to_cpumask(n);
267 cpus_and(tmp, tmp, nodemask);
268 if (cpus_empty(tmp))
269 continue;
270
271 sg = kmalloc(sizeof(struct sched_group), GFP_KERNEL);
272 if (!sg) {
273 printk(KERN_WARNING
274 "Can not alloc domain group for node %d\n", j);
275 break;
276 }
277 sg->cpu_power = 0;
278 sg->cpumask = tmp;
279 cpus_or(covered, covered, tmp);
280 prev->next = sg;
281 prev = sg;
282 }
283 prev->next = sched_group_nodes[i];
284 }
285#endif
286
287 /* Calculate CPU power for physical packages and nodes */
288 for_each_cpu_mask(i, *cpu_map) {
289 int power;
290 struct sched_domain *sd;
291#ifdef CONFIG_SCHED_SMT
292 sd = &per_cpu(cpu_domains, i);
293 power = SCHED_LOAD_SCALE;
294 sd->groups->cpu_power = power;
295#endif
296
297 sd = &per_cpu(phys_domains, i);
298 power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE *
299 (cpus_weight(sd->groups->cpumask)-1) / 10;
300 sd->groups->cpu_power = power;
301
302#ifdef CONFIG_NUMA
303 sd = &per_cpu(allnodes_domains, i);
304 if (sd->groups) {
305 power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE *
306 (cpus_weight(sd->groups->cpumask)-1) / 10;
307 sd->groups->cpu_power = power;
308 }
309#endif
310 }
311
312#ifdef CONFIG_NUMA
313 for (i = 0; i < MAX_NUMNODES; i++) {
314 struct sched_group *sg = sched_group_nodes[i];
315 int j;
316
317 if (sg == NULL)
318 continue;
319next_sg:
320 for_each_cpu_mask(j, sg->cpumask) {
321 struct sched_domain *sd;
322 int power;
323
324 sd = &per_cpu(phys_domains, j);
325 if (j != first_cpu(sd->groups->cpumask)) {
326 /*
327 * Only add "power" once for each
328 * physical package.
329 */
330 continue;
331 }
332 power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE *
333 (cpus_weight(sd->groups->cpumask)-1) / 10;
334
335 sg->cpu_power += power;
336 }
337 sg = sg->next;
338 if (sg != sched_group_nodes[i])
339 goto next_sg;
340 }
341#endif
342
343 /* Attach the domains */
344 for_each_cpu_mask(i, *cpu_map) {
345 struct sched_domain *sd;
346#ifdef CONFIG_SCHED_SMT
347 sd = &per_cpu(cpu_domains, i);
348#else
349 sd = &per_cpu(phys_domains, i);
350#endif
351 cpu_attach_domain(sd, i);
352 }
353}
354/*
355 * Set up scheduler domains and groups. Callers must hold the hotplug lock.
356 */
357void arch_init_sched_domains(const cpumask_t *cpu_map)
358{
359 cpumask_t cpu_default_map;
360
361 /*
362 * Setup mask for cpus without special case scheduling requirements.
363 * For now this just excludes isolated cpus, but could be used to
364 * exclude other special cases in the future.
365 */
366 cpus_andnot(cpu_default_map, *cpu_map, cpu_isolated_map);
367
368 build_sched_domains(&cpu_default_map);
369}
370
371void arch_destroy_sched_domains(const cpumask_t *cpu_map)
372{
373#ifdef CONFIG_NUMA
374 int i;
375 for (i = 0; i < MAX_NUMNODES; i++) {
376 cpumask_t nodemask = node_to_cpumask(i);
377 struct sched_group *oldsg, *sg = sched_group_nodes[i];
378
379 cpus_and(nodemask, nodemask, *cpu_map);
380 if (cpus_empty(nodemask))
381 continue;
382
383 if (sg == NULL)
384 continue;
385 sg = sg->next;
386next_sg:
387 oldsg = sg;
388 sg = sg->next;
389 kfree(oldsg);
390 if (oldsg != sched_group_nodes[i])
391 goto next_sg;
392 sched_group_nodes[i] = NULL;
393 }
394#endif
395}
396
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index c0c3f55b0231..574084f343fa 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -561,7 +561,7 @@ static inline int vector_is_shared (int vector)
561 return (iosapic_intr_info[vector].count > 1); 561 return (iosapic_intr_info[vector].count > 1);
562} 562}
563 563
564static void 564static int
565register_intr (unsigned int gsi, int vector, unsigned char delivery, 565register_intr (unsigned int gsi, int vector, unsigned char delivery,
566 unsigned long polarity, unsigned long trigger) 566 unsigned long polarity, unsigned long trigger)
567{ 567{
@@ -576,7 +576,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
576 index = find_iosapic(gsi); 576 index = find_iosapic(gsi);
577 if (index < 0) { 577 if (index < 0) {
578 printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi); 578 printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi);
579 return; 579 return -ENODEV;
580 } 580 }
581 581
582 iosapic_address = iosapic_lists[index].addr; 582 iosapic_address = iosapic_lists[index].addr;
@@ -587,7 +587,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
587 rte = iosapic_alloc_rte(); 587 rte = iosapic_alloc_rte();
588 if (!rte) { 588 if (!rte) {
589 printk(KERN_WARNING "%s: cannot allocate memory\n", __FUNCTION__); 589 printk(KERN_WARNING "%s: cannot allocate memory\n", __FUNCTION__);
590 return; 590 return -ENOMEM;
591 } 591 }
592 592
593 rte_index = gsi - gsi_base; 593 rte_index = gsi - gsi_base;
@@ -603,7 +603,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
603 struct iosapic_intr_info *info = &iosapic_intr_info[vector]; 603 struct iosapic_intr_info *info = &iosapic_intr_info[vector];
604 if (info->trigger != trigger || info->polarity != polarity) { 604 if (info->trigger != trigger || info->polarity != polarity) {
605 printk (KERN_WARNING "%s: cannot override the interrupt\n", __FUNCTION__); 605 printk (KERN_WARNING "%s: cannot override the interrupt\n", __FUNCTION__);
606 return; 606 return -EINVAL;
607 } 607 }
608 } 608 }
609 609
@@ -623,6 +623,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
623 __FUNCTION__, vector, idesc->handler->typename, irq_type->typename); 623 __FUNCTION__, vector, idesc->handler->typename, irq_type->typename);
624 idesc->handler = irq_type; 624 idesc->handler = irq_type;
625 } 625 }
626 return 0;
626} 627}
627 628
628static unsigned int 629static unsigned int
@@ -710,7 +711,7 @@ int
710iosapic_register_intr (unsigned int gsi, 711iosapic_register_intr (unsigned int gsi,
711 unsigned long polarity, unsigned long trigger) 712 unsigned long polarity, unsigned long trigger)
712{ 713{
713 int vector, mask = 1; 714 int vector, mask = 1, err;
714 unsigned int dest; 715 unsigned int dest;
715 unsigned long flags; 716 unsigned long flags;
716 struct iosapic_rte_info *rte; 717 struct iosapic_rte_info *rte;
@@ -737,8 +738,8 @@ again:
737 vector = assign_irq_vector(AUTO_ASSIGN); 738 vector = assign_irq_vector(AUTO_ASSIGN);
738 if (vector < 0) { 739 if (vector < 0) {
739 vector = iosapic_find_sharable_vector(trigger, polarity); 740 vector = iosapic_find_sharable_vector(trigger, polarity);
740 if (vector < 0) 741 if (vector < 0)
741 panic("%s: out of interrupt vectors!\n", __FUNCTION__); 742 return -ENOSPC;
742 } 743 }
743 744
744 spin_lock_irqsave(&irq_descp(vector)->lock, flags); 745 spin_lock_irqsave(&irq_descp(vector)->lock, flags);
@@ -753,8 +754,13 @@ again:
753 } 754 }
754 755
755 dest = get_target_cpu(gsi, vector); 756 dest = get_target_cpu(gsi, vector);
756 register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, 757 err = register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
757 polarity, trigger); 758 polarity, trigger);
759 if (err < 0) {
760 spin_unlock(&iosapic_lock);
761 spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
762 return err;
763 }
758 764
759 /* 765 /*
760 * If the vector is shared and already unmasked for 766 * If the vector is shared and already unmasked for
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 28f2aadc38d0..205d98028261 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -91,23 +91,8 @@ skip:
91} 91}
92 92
93#ifdef CONFIG_SMP 93#ifdef CONFIG_SMP
94/*
95 * This is updated when the user sets irq affinity via /proc
96 */
97static cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS];
98static unsigned long pending_irq_redir[BITS_TO_LONGS(NR_IRQS)];
99
100static char irq_redir [NR_IRQS]; // = { [0 ... NR_IRQS-1] = 1 }; 94static char irq_redir [NR_IRQS]; // = { [0 ... NR_IRQS-1] = 1 };
101 95
102/*
103 * Arch specific routine for deferred write to iosapic rte to reprogram
104 * intr destination.
105 */
106void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val)
107{
108 pending_irq_cpumask[irq] = mask_val;
109}
110
111void set_irq_affinity_info (unsigned int irq, int hwid, int redir) 96void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
112{ 97{
113 cpumask_t mask = CPU_MASK_NONE; 98 cpumask_t mask = CPU_MASK_NONE;
@@ -116,32 +101,10 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
116 101
117 if (irq < NR_IRQS) { 102 if (irq < NR_IRQS) {
118 irq_affinity[irq] = mask; 103 irq_affinity[irq] = mask;
104 set_irq_info(irq, mask);
119 irq_redir[irq] = (char) (redir & 0xff); 105 irq_redir[irq] = (char) (redir & 0xff);
120 } 106 }
121} 107}
122
123
124void move_irq(int irq)
125{
126 /* note - we hold desc->lock */
127 cpumask_t tmp;
128 irq_desc_t *desc = irq_descp(irq);
129 int redir = test_bit(irq, pending_irq_redir);
130
131 if (unlikely(!desc->handler->set_affinity))
132 return;
133
134 if (!cpus_empty(pending_irq_cpumask[irq])) {
135 cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
136 if (unlikely(!cpus_empty(tmp))) {
137 desc->handler->set_affinity(irq | (redir ? IA64_IRQ_REDIRECTED : 0),
138 pending_irq_cpumask[irq]);
139 }
140 cpus_clear(pending_irq_cpumask[irq]);
141 }
142}
143
144
145#endif /* CONFIG_SMP */ 108#endif /* CONFIG_SMP */
146 109
147#ifdef CONFIG_HOTPLUG_CPU 110#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/ia64/kernel/jprobes.S b/arch/ia64/kernel/jprobes.S
index b7fa3ccd2b0f..2323377e3695 100644
--- a/arch/ia64/kernel/jprobes.S
+++ b/arch/ia64/kernel/jprobes.S
@@ -49,6 +49,7 @@
49 /* 49 /*
50 * void jprobe_break(void) 50 * void jprobe_break(void)
51 */ 51 */
52 .section .kprobes.text, "ax"
52ENTRY(jprobe_break) 53ENTRY(jprobe_break)
53 break.m 0x80300 54 break.m 0x80300
54END(jprobe_break) 55END(jprobe_break)
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 884f5cd27d8a..471086b808a4 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -87,12 +87,25 @@ static enum instruction_type bundle_encoding[32][3] = {
87 * is IP relative instruction and update the kprobe 87 * is IP relative instruction and update the kprobe
88 * inst flag accordingly 88 * inst flag accordingly
89 */ 89 */
90static void update_kprobe_inst_flag(uint template, uint slot, uint major_opcode, 90static void __kprobes update_kprobe_inst_flag(uint template, uint slot,
91 unsigned long kprobe_inst, struct kprobe *p) 91 uint major_opcode,
92 unsigned long kprobe_inst,
93 struct kprobe *p)
92{ 94{
93 p->ainsn.inst_flag = 0; 95 p->ainsn.inst_flag = 0;
94 p->ainsn.target_br_reg = 0; 96 p->ainsn.target_br_reg = 0;
95 97
98 /* Check for Break instruction
99 * Bits 37:40 Major opcode to be zero
100 * Bits 27:32 X6 to be zero
101 * Bits 32:35 X3 to be zero
102 */
103 if ((!major_opcode) && (!((kprobe_inst >> 27) & 0x1FF)) ) {
104 /* is a break instruction */
105 p->ainsn.inst_flag |= INST_FLAG_BREAK_INST;
106 return;
107 }
108
96 if (bundle_encoding[template][slot] == B) { 109 if (bundle_encoding[template][slot] == B) {
97 switch (major_opcode) { 110 switch (major_opcode) {
98 case INDIRECT_CALL_OPCODE: 111 case INDIRECT_CALL_OPCODE:
@@ -126,8 +139,10 @@ static void update_kprobe_inst_flag(uint template, uint slot, uint major_opcode
126 * Returns 0 if supported 139 * Returns 0 if supported
127 * Returns -EINVAL if unsupported 140 * Returns -EINVAL if unsupported
128 */ 141 */
129static int unsupported_inst(uint template, uint slot, uint major_opcode, 142static int __kprobes unsupported_inst(uint template, uint slot,
130 unsigned long kprobe_inst, struct kprobe *p) 143 uint major_opcode,
144 unsigned long kprobe_inst,
145 struct kprobe *p)
131{ 146{
132 unsigned long addr = (unsigned long)p->addr; 147 unsigned long addr = (unsigned long)p->addr;
133 148
@@ -168,8 +183,9 @@ static int unsupported_inst(uint template, uint slot, uint major_opcode,
168 * on which we are inserting kprobe is cmp instruction 183 * on which we are inserting kprobe is cmp instruction
169 * with ctype as unc. 184 * with ctype as unc.
170 */ 185 */
171static uint is_cmp_ctype_unc_inst(uint template, uint slot, uint major_opcode, 186static uint __kprobes is_cmp_ctype_unc_inst(uint template, uint slot,
172unsigned long kprobe_inst) 187 uint major_opcode,
188 unsigned long kprobe_inst)
173{ 189{
174 cmp_inst_t cmp_inst; 190 cmp_inst_t cmp_inst;
175 uint ctype_unc = 0; 191 uint ctype_unc = 0;
@@ -201,8 +217,10 @@ out:
201 * In this function we override the bundle with 217 * In this function we override the bundle with
202 * the break instruction at the given slot. 218 * the break instruction at the given slot.
203 */ 219 */
204static void prepare_break_inst(uint template, uint slot, uint major_opcode, 220static void __kprobes prepare_break_inst(uint template, uint slot,
205 unsigned long kprobe_inst, struct kprobe *p) 221 uint major_opcode,
222 unsigned long kprobe_inst,
223 struct kprobe *p)
206{ 224{
207 unsigned long break_inst = BREAK_INST; 225 unsigned long break_inst = BREAK_INST;
208 bundle_t *bundle = &p->ainsn.insn.bundle; 226 bundle_t *bundle = &p->ainsn.insn.bundle;
@@ -271,7 +289,8 @@ static inline int in_ivt_functions(unsigned long addr)
271 && addr < (unsigned long)__end_ivt_text); 289 && addr < (unsigned long)__end_ivt_text);
272} 290}
273 291
274static int valid_kprobe_addr(int template, int slot, unsigned long addr) 292static int __kprobes valid_kprobe_addr(int template, int slot,
293 unsigned long addr)
275{ 294{
276 if ((slot > 2) || ((bundle_encoding[template][1] == L) && slot > 1)) { 295 if ((slot > 2) || ((bundle_encoding[template][1] == L) && slot > 1)) {
277 printk(KERN_WARNING "Attempting to insert unaligned kprobe " 296 printk(KERN_WARNING "Attempting to insert unaligned kprobe "
@@ -323,7 +342,7 @@ static void kretprobe_trampoline(void)
323 * - cleanup by marking the instance as unused 342 * - cleanup by marking the instance as unused
324 * - long jump back to the original return address 343 * - long jump back to the original return address
325 */ 344 */
326int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 345int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
327{ 346{
328 struct kretprobe_instance *ri = NULL; 347 struct kretprobe_instance *ri = NULL;
329 struct hlist_head *head; 348 struct hlist_head *head;
@@ -381,7 +400,8 @@ int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
381 return 1; 400 return 1;
382} 401}
383 402
384void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) 403void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
404 struct pt_regs *regs)
385{ 405{
386 struct kretprobe_instance *ri; 406 struct kretprobe_instance *ri;
387 407
@@ -399,7 +419,7 @@ void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs)
399 } 419 }
400} 420}
401 421
402int arch_prepare_kprobe(struct kprobe *p) 422int __kprobes arch_prepare_kprobe(struct kprobe *p)
403{ 423{
404 unsigned long addr = (unsigned long) p->addr; 424 unsigned long addr = (unsigned long) p->addr;
405 unsigned long *kprobe_addr = (unsigned long *)(addr & ~0xFULL); 425 unsigned long *kprobe_addr = (unsigned long *)(addr & ~0xFULL);
@@ -430,7 +450,7 @@ int arch_prepare_kprobe(struct kprobe *p)
430 return 0; 450 return 0;
431} 451}
432 452
433void arch_arm_kprobe(struct kprobe *p) 453void __kprobes arch_arm_kprobe(struct kprobe *p)
434{ 454{
435 unsigned long addr = (unsigned long)p->addr; 455 unsigned long addr = (unsigned long)p->addr;
436 unsigned long arm_addr = addr & ~0xFULL; 456 unsigned long arm_addr = addr & ~0xFULL;
@@ -439,7 +459,7 @@ void arch_arm_kprobe(struct kprobe *p)
439 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); 459 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t));
440} 460}
441 461
442void arch_disarm_kprobe(struct kprobe *p) 462void __kprobes arch_disarm_kprobe(struct kprobe *p)
443{ 463{
444 unsigned long addr = (unsigned long)p->addr; 464 unsigned long addr = (unsigned long)p->addr;
445 unsigned long arm_addr = addr & ~0xFULL; 465 unsigned long arm_addr = addr & ~0xFULL;
@@ -449,7 +469,7 @@ void arch_disarm_kprobe(struct kprobe *p)
449 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); 469 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t));
450} 470}
451 471
452void arch_remove_kprobe(struct kprobe *p) 472void __kprobes arch_remove_kprobe(struct kprobe *p)
453{ 473{
454} 474}
455 475
@@ -461,7 +481,7 @@ void arch_remove_kprobe(struct kprobe *p)
461 * to original stack address, handle the case where we need to fixup the 481 * to original stack address, handle the case where we need to fixup the
462 * relative IP address and/or fixup branch register. 482 * relative IP address and/or fixup branch register.
463 */ 483 */
464static void resume_execution(struct kprobe *p, struct pt_regs *regs) 484static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
465{ 485{
466 unsigned long bundle_addr = ((unsigned long) (&p->opcode.bundle)) & ~0xFULL; 486 unsigned long bundle_addr = ((unsigned long) (&p->opcode.bundle)) & ~0xFULL;
467 unsigned long resume_addr = (unsigned long)p->addr & ~0xFULL; 487 unsigned long resume_addr = (unsigned long)p->addr & ~0xFULL;
@@ -528,13 +548,16 @@ turn_ss_off:
528 ia64_psr(regs)->ss = 0; 548 ia64_psr(regs)->ss = 0;
529} 549}
530 550
531static void prepare_ss(struct kprobe *p, struct pt_regs *regs) 551static void __kprobes prepare_ss(struct kprobe *p, struct pt_regs *regs)
532{ 552{
533 unsigned long bundle_addr = (unsigned long) &p->opcode.bundle; 553 unsigned long bundle_addr = (unsigned long) &p->opcode.bundle;
534 unsigned long slot = (unsigned long)p->addr & 0xf; 554 unsigned long slot = (unsigned long)p->addr & 0xf;
535 555
536 /* Update instruction pointer (IIP) and slot number (IPSR.ri) */ 556 /* single step inline if break instruction */
537 regs->cr_iip = bundle_addr & ~0xFULL; 557 if (p->ainsn.inst_flag == INST_FLAG_BREAK_INST)
558 regs->cr_iip = (unsigned long)p->addr & ~0xFULL;
559 else
560 regs->cr_iip = bundle_addr & ~0xFULL;
538 561
539 if (slot > 2) 562 if (slot > 2)
540 slot = 0; 563 slot = 0;
@@ -545,7 +568,39 @@ static void prepare_ss(struct kprobe *p, struct pt_regs *regs)
545 ia64_psr(regs)->ss = 1; 568 ia64_psr(regs)->ss = 1;
546} 569}
547 570
548static int pre_kprobes_handler(struct die_args *args) 571static int __kprobes is_ia64_break_inst(struct pt_regs *regs)
572{
573 unsigned int slot = ia64_psr(regs)->ri;
574 unsigned int template, major_opcode;
575 unsigned long kprobe_inst;
576 unsigned long *kprobe_addr = (unsigned long *)regs->cr_iip;
577 bundle_t bundle;
578
579 memcpy(&bundle, kprobe_addr, sizeof(bundle_t));
580 template = bundle.quad0.template;
581
582 /* Move to slot 2, if bundle is MLX type and kprobe slot is 1 */
583 if (slot == 1 && bundle_encoding[template][1] == L)
584 slot++;
585
586 /* Get Kprobe probe instruction at given slot*/
587 get_kprobe_inst(&bundle, slot, &kprobe_inst, &major_opcode);
588
589 /* For break instruction,
590 * Bits 37:40 Major opcode to be zero
591 * Bits 27:32 X6 to be zero
592 * Bits 32:35 X3 to be zero
593 */
594 if (major_opcode || ((kprobe_inst >> 27) & 0x1FF) ) {
595 /* Not a break instruction */
596 return 0;
597 }
598
599 /* Is a break instruction */
600 return 1;
601}
602
603static int __kprobes pre_kprobes_handler(struct die_args *args)
549{ 604{
550 struct kprobe *p; 605 struct kprobe *p;
551 int ret = 0; 606 int ret = 0;
@@ -558,7 +613,9 @@ static int pre_kprobes_handler(struct die_args *args)
558 if (kprobe_running()) { 613 if (kprobe_running()) {
559 p = get_kprobe(addr); 614 p = get_kprobe(addr);
560 if (p) { 615 if (p) {
561 if (kprobe_status == KPROBE_HIT_SS) { 616 if ( (kprobe_status == KPROBE_HIT_SS) &&
617 (p->ainsn.inst_flag == INST_FLAG_BREAK_INST)) {
618 ia64_psr(regs)->ss = 0;
562 unlock_kprobes(); 619 unlock_kprobes();
563 goto no_kprobe; 620 goto no_kprobe;
564 } 621 }
@@ -592,6 +649,19 @@ static int pre_kprobes_handler(struct die_args *args)
592 p = get_kprobe(addr); 649 p = get_kprobe(addr);
593 if (!p) { 650 if (!p) {
594 unlock_kprobes(); 651 unlock_kprobes();
652 if (!is_ia64_break_inst(regs)) {
653 /*
654 * The breakpoint instruction was removed right
655 * after we hit it. Another cpu has removed
656 * either a probepoint or a debugger breakpoint
657 * at this address. In either case, no further
658 * handling of this interrupt is appropriate.
659 */
660 ret = 1;
661
662 }
663
664 /* Not one of our break, let kernel handle it */
595 goto no_kprobe; 665 goto no_kprobe;
596 } 666 }
597 667
@@ -616,7 +686,7 @@ no_kprobe:
616 return ret; 686 return ret;
617} 687}
618 688
619static int post_kprobes_handler(struct pt_regs *regs) 689static int __kprobes post_kprobes_handler(struct pt_regs *regs)
620{ 690{
621 if (!kprobe_running()) 691 if (!kprobe_running())
622 return 0; 692 return 0;
@@ -641,7 +711,7 @@ out:
641 return 1; 711 return 1;
642} 712}
643 713
644static int kprobes_fault_handler(struct pt_regs *regs, int trapnr) 714static int __kprobes kprobes_fault_handler(struct pt_regs *regs, int trapnr)
645{ 715{
646 if (!kprobe_running()) 716 if (!kprobe_running())
647 return 0; 717 return 0;
@@ -659,8 +729,8 @@ static int kprobes_fault_handler(struct pt_regs *regs, int trapnr)
659 return 0; 729 return 0;
660} 730}
661 731
662int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, 732int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
663 void *data) 733 unsigned long val, void *data)
664{ 734{
665 struct die_args *args = (struct die_args *)data; 735 struct die_args *args = (struct die_args *)data;
666 switch(val) { 736 switch(val) {
@@ -681,7 +751,7 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
681 return NOTIFY_DONE; 751 return NOTIFY_DONE;
682} 752}
683 753
684int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 754int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
685{ 755{
686 struct jprobe *jp = container_of(p, struct jprobe, kp); 756 struct jprobe *jp = container_of(p, struct jprobe, kp);
687 unsigned long addr = ((struct fnptr *)(jp->entry))->ip; 757 unsigned long addr = ((struct fnptr *)(jp->entry))->ip;
@@ -703,7 +773,7 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
703 return 1; 773 return 1;
704} 774}
705 775
706int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 776int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
707{ 777{
708 *regs = jprobe_saved_regs; 778 *regs = jprobe_saved_regs;
709 return 1; 779 return 1;
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 84f89da7c640..1f5c26dbe705 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -384,7 +384,7 @@ setup_arch (char **cmdline_p)
384 if (early_console_setup(*cmdline_p) == 0) 384 if (early_console_setup(*cmdline_p) == 0)
385 mark_bsp_online(); 385 mark_bsp_online();
386 386
387#ifdef CONFIG_ACPI_BOOT 387#ifdef CONFIG_ACPI
388 /* Initialize the ACPI boot-time table parser */ 388 /* Initialize the ACPI boot-time table parser */
389 acpi_table_init(); 389 acpi_table_init();
390# ifdef CONFIG_ACPI_NUMA 390# ifdef CONFIG_ACPI_NUMA
@@ -420,7 +420,7 @@ setup_arch (char **cmdline_p)
420 420
421 cpu_init(); /* initialize the bootstrap CPU */ 421 cpu_init(); /* initialize the bootstrap CPU */
422 422
423#ifdef CONFIG_ACPI_BOOT 423#ifdef CONFIG_ACPI
424 acpi_boot_init(); 424 acpi_boot_init();
425#endif 425#endif
426 426
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index 92ff46ad21e2..706b7734e191 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -36,7 +36,7 @@ int arch_register_cpu(int num)
36 parent = &sysfs_nodes[cpu_to_node(num)]; 36 parent = &sysfs_nodes[cpu_to_node(num)];
37#endif /* CONFIG_NUMA */ 37#endif /* CONFIG_NUMA */
38 38
39#ifdef CONFIG_ACPI_BOOT 39#ifdef CONFIG_ACPI
40 /* 40 /*
41 * If CPEI cannot be re-targetted, and this is 41 * If CPEI cannot be re-targetted, and this is
42 * CPEI target, then dont create the control file 42 * CPEI target, then dont create the control file
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index 4440c8343fa4..f970359e7edf 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -15,6 +15,7 @@
15#include <linux/vt_kern.h> /* For unblank_screen() */ 15#include <linux/vt_kern.h> /* For unblank_screen() */
16#include <linux/module.h> /* for EXPORT_SYMBOL */ 16#include <linux/module.h> /* for EXPORT_SYMBOL */
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
18#include <linux/kprobes.h>
18 19
19#include <asm/fpswa.h> 20#include <asm/fpswa.h>
20#include <asm/ia32.h> 21#include <asm/ia32.h>
@@ -122,7 +123,7 @@ die_if_kernel (char *str, struct pt_regs *regs, long err)
122} 123}
123 124
124void 125void
125ia64_bad_break (unsigned long break_num, struct pt_regs *regs) 126__kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs)
126{ 127{
127 siginfo_t siginfo; 128 siginfo_t siginfo;
128 int sig, code; 129 int sig, code;
@@ -444,7 +445,7 @@ ia64_illegal_op_fault (unsigned long ec, long arg1, long arg2, long arg3,
444 return rv; 445 return rv;
445} 446}
446 447
447void 448void __kprobes
448ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa, 449ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
449 unsigned long iim, unsigned long itir, long arg5, long arg6, 450 unsigned long iim, unsigned long itir, long arg5, long arg6,
450 long arg7, struct pt_regs regs) 451 long arg7, struct pt_regs regs)
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index a676e79e0681..30d8564e9603 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -48,6 +48,7 @@ SECTIONS
48 *(.text) 48 *(.text)
49 SCHED_TEXT 49 SCHED_TEXT
50 LOCK_TEXT 50 LOCK_TEXT
51 KPROBES_TEXT
51 *(.gnu.linkonce.t*) 52 *(.gnu.linkonce.t*)
52 } 53 }
53 .text2 : AT(ADDR(.text2) - LOAD_OFFSET) 54 .text2 : AT(ADDR(.text2) - LOAD_OFFSET)
diff --git a/arch/ia64/lib/flush.S b/arch/ia64/lib/flush.S
index 3e2cfa2c6d39..2a0d27f2f21b 100644
--- a/arch/ia64/lib/flush.S
+++ b/arch/ia64/lib/flush.S
@@ -20,6 +20,7 @@
20 * 20 *
21 * Note: "in0" and "in1" are preserved for debugging purposes. 21 * Note: "in0" and "in1" are preserved for debugging purposes.
22 */ 22 */
23 .section .kprobes.text,"ax"
23GLOBAL_ENTRY(flush_icache_range) 24GLOBAL_ENTRY(flush_icache_range)
24 25
25 .prologue 26 .prologue
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 839d4f1234ee..3c32af910d60 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -9,6 +9,7 @@
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/smp_lock.h> 10#include <linux/smp_lock.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/kprobes.h>
12 13
13#include <asm/pgtable.h> 14#include <asm/pgtable.h>
14#include <asm/processor.h> 15#include <asm/processor.h>
@@ -76,7 +77,7 @@ mapped_kernel_page_is_present (unsigned long address)
76 return pte_present(pte); 77 return pte_present(pte);
77} 78}
78 79
79void 80void __kprobes
80ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *regs) 81ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *regs)
81{ 82{
82 int signal = SIGSEGV, code = SEGV_MAPERR; 83 int signal = SIGSEGV, code = SEGV_MAPERR;
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 4564ed0b5ff3..906622d9f933 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -431,7 +431,7 @@ void sn_bus_store_sysdata(struct pci_dev *dev)
431{ 431{
432 struct sysdata_el *element; 432 struct sysdata_el *element;
433 433
434 element = kcalloc(1, sizeof(struct sysdata_el), GFP_KERNEL); 434 element = kzalloc(sizeof(struct sysdata_el), GFP_KERNEL);
435 if (!element) { 435 if (!element) {
436 dev_dbg(dev, "%s: out of memory!\n", __FUNCTION__); 436 dev_dbg(dev, "%s: out of memory!\n", __FUNCTION__);
437 return; 437 return;
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 9fc74631ba8a..01d18b7b5bb3 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -23,7 +23,7 @@ static void force_interrupt(int irq);
23static void register_intr_pda(struct sn_irq_info *sn_irq_info); 23static void register_intr_pda(struct sn_irq_info *sn_irq_info);
24static void unregister_intr_pda(struct sn_irq_info *sn_irq_info); 24static void unregister_intr_pda(struct sn_irq_info *sn_irq_info);
25 25
26extern int sn_force_interrupt_flag; 26int sn_force_interrupt_flag = 1;
27extern int sn_ioif_inited; 27extern int sn_ioif_inited;
28static struct list_head **sn_irq_lh; 28static struct list_head **sn_irq_lh;
29static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */ 29static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index 51bf82720d99..a06719d752a0 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -52,7 +52,7 @@ static int licenseID_open(struct inode *inode, struct file *file)
52 * the bridge chip. The hardware will then send an interrupt message if the 52 * the bridge chip. The hardware will then send an interrupt message if the
53 * interrupt line is active. This mimics a level sensitive interrupt. 53 * interrupt line is active. This mimics a level sensitive interrupt.
54 */ 54 */
55int sn_force_interrupt_flag = 1; 55extern int sn_force_interrupt_flag;
56 56
57static int sn_force_interrupt_show(struct seq_file *s, void *p) 57static int sn_force_interrupt_show(struct seq_file *s, void *p)
58{ 58{
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 254fe15c064b..b45db5133f55 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -191,7 +191,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
191{ 191{
192 struct cx_dev *cx_dev; 192 struct cx_dev *cx_dev;
193 193
194 cx_dev = kcalloc(1, sizeof(struct cx_dev), GFP_KERNEL); 194 cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL);
195 DBG("cx_dev= 0x%p\n", cx_dev); 195 DBG("cx_dev= 0x%p\n", cx_dev);
196 if (cx_dev == NULL) 196 if (cx_dev == NULL)
197 return -ENOMEM; 197 return -ENOMEM;
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index ea09c12f0258..19bced34d5f1 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -148,7 +148,7 @@ tioca_gart_init(struct tioca_kernel *tioca_kern)
148 tioca_kern->ca_pcigart_entries = 148 tioca_kern->ca_pcigart_entries =
149 tioca_kern->ca_pciap_size / tioca_kern->ca_ap_pagesize; 149 tioca_kern->ca_pciap_size / tioca_kern->ca_ap_pagesize;
150 tioca_kern->ca_pcigart_pagemap = 150 tioca_kern->ca_pcigart_pagemap =
151 kcalloc(1, tioca_kern->ca_pcigart_entries / 8, GFP_KERNEL); 151 kzalloc(tioca_kern->ca_pcigart_entries / 8, GFP_KERNEL);
152 if (!tioca_kern->ca_pcigart_pagemap) { 152 if (!tioca_kern->ca_pcigart_pagemap) {
153 free_pages((unsigned long)tioca_kern->ca_gart, 153 free_pages((unsigned long)tioca_kern->ca_gart,
154 get_order(tioca_kern->ca_gart_size)); 154 get_order(tioca_kern->ca_gart_size));
@@ -392,7 +392,7 @@ tioca_dma_mapped(struct pci_dev *pdev, uint64_t paddr, size_t req_size)
392 * allocate a map struct 392 * allocate a map struct
393 */ 393 */
394 394
395 ca_dmamap = kcalloc(1, sizeof(struct tioca_dmamap), GFP_ATOMIC); 395 ca_dmamap = kzalloc(sizeof(struct tioca_dmamap), GFP_ATOMIC);
396 if (!ca_dmamap) 396 if (!ca_dmamap)
397 goto map_return; 397 goto map_return;
398 398
@@ -600,7 +600,7 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
600 * Allocate kernel bus soft and copy from prom. 600 * Allocate kernel bus soft and copy from prom.
601 */ 601 */
602 602
603 tioca_common = kcalloc(1, sizeof(struct tioca_common), GFP_KERNEL); 603 tioca_common = kzalloc(sizeof(struct tioca_common), GFP_KERNEL);
604 if (!tioca_common) 604 if (!tioca_common)
605 return NULL; 605 return NULL;
606 606
@@ -609,7 +609,7 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
609 609
610 /* init kernel-private area */ 610 /* init kernel-private area */
611 611
612 tioca_kern = kcalloc(1, sizeof(struct tioca_kernel), GFP_KERNEL); 612 tioca_kern = kzalloc(sizeof(struct tioca_kernel), GFP_KERNEL);
613 if (!tioca_kern) { 613 if (!tioca_kern) {
614 kfree(tioca_common); 614 kfree(tioca_common);
615 return NULL; 615 return NULL;
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 8a2b77bc5749..539c562cd54d 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -171,10 +171,7 @@ int do_settimeofday(struct timespec *tv)
171 set_normalized_timespec(&xtime, sec, nsec); 171 set_normalized_timespec(&xtime, sec, nsec);
172 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 172 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
173 173
174 time_adjust = 0; /* stop active adjtime() */ 174 ntp_clear();
175 time_status |= STA_UNSYNC;
176 time_maxerror = NTP_PHASE_LIMIT;
177 time_esterror = NTP_PHASE_LIMIT;
178 write_sequnlock_irq(&xtime_lock); 175 write_sequnlock_irq(&xtime_lock);
179 clock_was_set(); 176 clock_was_set();
180 177
@@ -221,7 +218,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
221 * called as close as possible to 500 ms before the new second starts. 218 * called as close as possible to 500 ms before the new second starts.
222 */ 219 */
223 write_seqlock(&xtime_lock); 220 write_seqlock(&xtime_lock);
224 if ((time_status & STA_UNSYNC) == 0 221 if (ntp_synced()
225 && xtime.tv_sec > last_rtc_update + 660 222 && xtime.tv_sec > last_rtc_update + 660
226 && (xtime.tv_nsec / 1000) >= 500000 - ((unsigned)TICK_SIZE) / 2 223 && (xtime.tv_nsec / 1000) >= 500000 - ((unsigned)TICK_SIZE) / 2
227 && (xtime.tv_nsec / 1000) <= 500000 + ((unsigned)TICK_SIZE) / 2) 224 && (xtime.tv_nsec / 1000) <= 500000 + ((unsigned)TICK_SIZE) / 2)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 178c4a3fbb72..ba960bbc8e6d 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -25,6 +25,11 @@ config GENERIC_CALIBRATE_DELAY
25 bool 25 bool
26 default y 26 default y
27 27
28config ARCH_MAY_HAVE_PC_FDC
29 bool
30 depends on Q40 || (BROKEN && SUN3X)
31 default y
32
28mainmenu "Linux/68k Kernel Configuration" 33mainmenu "Linux/68k Kernel Configuration"
29 34
30source "init/Kconfig" 35source "init/Kconfig"
diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c
index c6b2a410bf9a..eb63ca6ed94c 100644
--- a/arch/m68k/bvme6000/rtc.c
+++ b/arch/m68k/bvme6000/rtc.c
@@ -14,6 +14,7 @@
14#include <linux/fcntl.h> 14#include <linux/fcntl.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/poll.h> 16#include <linux/poll.h>
17#include <linux/module.h>
17#include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */ 18#include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */
18#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
19#include <asm/bvme6000hw.h> 20#include <asm/bvme6000hw.h>
@@ -171,7 +172,7 @@ static struct miscdevice rtc_dev = {
171 .fops = &rtc_fops 172 .fops = &rtc_fops
172}; 173};
173 174
174int __init rtc_DP8570A_init(void) 175static int __init rtc_DP8570A_init(void)
175{ 176{
176 if (!MACH_IS_BVME6000) 177 if (!MACH_IS_BVME6000)
177 return -ENODEV; 178 return -ENODEV;
@@ -179,4 +180,4 @@ int __init rtc_DP8570A_init(void)
179 printk(KERN_INFO "DP8570A Real Time Clock Driver v%s\n", RTC_VERSION); 180 printk(KERN_INFO "DP8570A Real Time Clock Driver v%s\n", RTC_VERSION);
180 return misc_register(&rtc_dev); 181 return misc_register(&rtc_dev);
181} 182}
182 183module_init(rtc_DP8570A_init);
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index e47e19588525..4ec95e3cb874 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -166,10 +166,7 @@ int do_settimeofday(struct timespec *tv)
166 set_normalized_timespec(&xtime, sec, nsec); 166 set_normalized_timespec(&xtime, sec, nsec);
167 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 167 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
168 168
169 time_adjust = 0; /* stop active adjtime() */ 169 ntp_clear();
170 time_status |= STA_UNSYNC;
171 time_maxerror = NTP_PHASE_LIMIT;
172 time_esterror = NTP_PHASE_LIMIT;
173 write_sequnlock_irq(&xtime_lock); 170 write_sequnlock_irq(&xtime_lock);
174 clock_was_set(); 171 clock_was_set();
175 return 0; 172 return 0;
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
index 8a2425069088..7977eae50af2 100644
--- a/arch/m68k/mvme16x/rtc.c
+++ b/arch/m68k/mvme16x/rtc.c
@@ -161,7 +161,7 @@ static struct miscdevice rtc_dev=
161 .fops = &rtc_fops 161 .fops = &rtc_fops
162}; 162};
163 163
164int __init rtc_MK48T08_init(void) 164static int __init rtc_MK48T08_init(void)
165{ 165{
166 if (!MACH_IS_MVME16x) 166 if (!MACH_IS_MVME16x)
167 return -ENODEV; 167 return -ENODEV;
@@ -169,4 +169,4 @@ int __init rtc_MK48T08_init(void)
169 printk(KERN_INFO "MK48T08 Real Time Clock Driver v%s\n", RTC_VERSION); 169 printk(KERN_INFO "MK48T08 Real Time Clock Driver v%s\n", RTC_VERSION);
170 return misc_register(&rtc_dev); 170 return misc_register(&rtc_dev);
171} 171}
172 172module_init(rtc_MK48T08_init);
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 5c3ca671627c..b17c1ecba966 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -68,7 +68,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
68 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 68 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
69 * called as close as possible to 500 ms before the new second starts. 69 * called as close as possible to 500 ms before the new second starts.
70 */ 70 */
71 if ((time_status & STA_UNSYNC) == 0 && 71 if (ntp_synced() &&
72 xtime.tv_sec > last_rtc_update + 660 && 72 xtime.tv_sec > last_rtc_update + 660 &&
73 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 73 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
74 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 74 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
@@ -178,10 +178,7 @@ int do_settimeofday(struct timespec *tv)
178 set_normalized_timespec(&xtime, sec, nsec); 178 set_normalized_timespec(&xtime, sec, nsec);
179 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 179 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
180 180
181 time_adjust = 0; /* stop active adjtime() */ 181 ntp_clear();
182 time_status |= STA_UNSYNC;
183 time_maxerror = NTP_PHASE_LIMIT;
184 time_esterror = NTP_PHASE_LIMIT;
185 write_sequnlock_irq(&xtime_lock); 182 write_sequnlock_irq(&xtime_lock);
186 clock_was_set(); 183 clock_was_set();
187 return 0; 184 return 0;
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d79fba0aa8bf..8d76eb1ff291 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -4,6 +4,11 @@ config MIPS
4 # Horrible source of confusion. Die, die, die ... 4 # Horrible source of confusion. Die, die, die ...
5 select EMBEDDED 5 select EMBEDDED
6 6
7# shouldn't it be per-subarchitecture?
8config ARCH_MAY_HAVE_PC_FDC
9 bool
10 default y
11
7mainmenu "Linux/MIPS Kernel Configuration" 12mainmenu "Linux/MIPS Kernel Configuration"
8 13
9source "init/Kconfig" 14source "init/Kconfig"
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 4613219dd73e..ece4564919d8 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -546,20 +546,20 @@ struct msgbuf32 { s32 mtype; char mtext[1]; };
546struct ipc_perm32 546struct ipc_perm32
547{ 547{
548 key_t key; 548 key_t key;
549 compat_uid_t uid; 549 __compat_uid_t uid;
550 compat_gid_t gid; 550 __compat_gid_t gid;
551 compat_uid_t cuid; 551 __compat_uid_t cuid;
552 compat_gid_t cgid; 552 __compat_gid_t cgid;
553 compat_mode_t mode; 553 compat_mode_t mode;
554 unsigned short seq; 554 unsigned short seq;
555}; 555};
556 556
557struct ipc64_perm32 { 557struct ipc64_perm32 {
558 key_t key; 558 key_t key;
559 compat_uid_t uid; 559 __compat_uid_t uid;
560 compat_gid_t gid; 560 __compat_gid_t gid;
561 compat_uid_t cuid; 561 __compat_uid_t cuid;
562 compat_gid_t cgid; 562 __compat_gid_t cgid;
563 compat_mode_t mode; 563 compat_mode_t mode;
564 unsigned short seq; 564 unsigned short seq;
565 unsigned short __pad1; 565 unsigned short __pad1;
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index f3bf0e43b8bb..b46595462717 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -632,10 +632,7 @@ asmlinkage int irix_stime(int value)
632 write_seqlock_irq(&xtime_lock); 632 write_seqlock_irq(&xtime_lock);
633 xtime.tv_sec = value; 633 xtime.tv_sec = value;
634 xtime.tv_nsec = 0; 634 xtime.tv_nsec = 0;
635 time_adjust = 0; /* stop active adjtime() */ 635 ntp_clear();
636 time_status |= STA_UNSYNC;
637 time_maxerror = NTP_PHASE_LIMIT;
638 time_esterror = NTP_PHASE_LIMIT;
639 write_sequnlock_irq(&xtime_lock); 636 write_sequnlock_irq(&xtime_lock);
640 637
641 return 0; 638 return 0;
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 648c82292ed6..0dd0df7a3b04 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -223,10 +223,7 @@ int do_settimeofday(struct timespec *tv)
223 set_normalized_timespec(&xtime, sec, nsec); 223 set_normalized_timespec(&xtime, sec, nsec);
224 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 224 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
225 225
226 time_adjust = 0; /* stop active adjtime() */ 226 ntp_clear();
227 time_status |= STA_UNSYNC;
228 time_maxerror = NTP_PHASE_LIMIT;
229 time_esterror = NTP_PHASE_LIMIT;
230 227
231 write_sequnlock_irq(&xtime_lock); 228 write_sequnlock_irq(&xtime_lock);
232 clock_was_set(); 229 clock_was_set();
@@ -442,7 +439,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
442 * called as close as possible to 500 ms before the new second starts. 439 * called as close as possible to 500 ms before the new second starts.
443 */ 440 */
444 write_seqlock(&xtime_lock); 441 write_seqlock(&xtime_lock);
445 if ((time_status & STA_UNSYNC) == 0 && 442 if (ntp_synced() &&
446 xtime.tv_sec > last_rtc_update + 660 && 443 xtime.tv_sec > last_rtc_update + 660 &&
447 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 444 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
448 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 445 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 8c1b96fffa76..cddf1cedf007 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -118,7 +118,7 @@ again:
118 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 118 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
119 * called as close as possible to when a second starts. 119 * called as close as possible to when a second starts.
120 */ 120 */
121 if ((time_status & STA_UNSYNC) == 0 && 121 if (ntp_synced() &&
122 xtime.tv_sec > last_rtc_update + 660 && 122 xtime.tv_sec > last_rtc_update + 660 &&
123 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 123 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
124 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 124 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 1c2d87435233..0b07922a2ac6 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -49,6 +49,10 @@ config ISA_DMA_API
49 bool 49 bool
50 default y 50 default y
51 51
52config ARCH_MAY_HAVE_PC_FDC
53 bool
54 default y
55
52source "init/Kconfig" 56source "init/Kconfig"
53 57
54 58
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 6cf7407344ba..7ff67f8e9f8c 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -188,10 +188,7 @@ do_settimeofday (struct timespec *tv)
188 set_normalized_timespec(&xtime, sec, nsec); 188 set_normalized_timespec(&xtime, sec, nsec);
189 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 189 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
190 190
191 time_adjust = 0; /* stop active adjtime() */ 191 ntp_clear();
192 time_status |= STA_UNSYNC;
193 time_maxerror = NTP_PHASE_LIMIT;
194 time_esterror = NTP_PHASE_LIMIT;
195 } 192 }
196 write_sequnlock_irq(&xtime_lock); 193 write_sequnlock_irq(&xtime_lock);
197 clock_was_set(); 194 clock_was_set();
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 36dee0ff5ca0..6ab7e5ea5fcf 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -47,6 +47,10 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
47 bool 47 bool
48 default y 48 default y
49 49
50config ARCH_MAY_HAVE_PC_FDC
51 bool
52 default y
53
50source "init/Kconfig" 54source "init/Kconfig"
51 55
52menu "Processor" 56menu "Processor"
diff --git a/arch/ppc/kernel/head_4xx.S b/arch/ppc/kernel/head_4xx.S
index 0a5e723d3be6..ca9518b96c6e 100644
--- a/arch/ppc/kernel/head_4xx.S
+++ b/arch/ppc/kernel/head_4xx.S
@@ -453,6 +453,7 @@ label:
453#else 453#else
454 CRITICAL_EXCEPTION(0x1020, WDTException, UnknownException) 454 CRITICAL_EXCEPTION(0x1020, WDTException, UnknownException)
455#endif 455#endif
456#endif
456 457
457/* 0x1100 - Data TLB Miss Exception 458/* 0x1100 - Data TLB Miss Exception
458 * As the name implies, translation is not in the MMU, so search the 459 * As the name implies, translation is not in the MMU, so search the
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
index bf4ddca5e853..a3c5281a5d2d 100644
--- a/arch/ppc/kernel/time.c
+++ b/arch/ppc/kernel/time.c
@@ -169,7 +169,7 @@ void timer_interrupt(struct pt_regs * regs)
169 * We should have an rtc call that only sets the minutes and 169 * We should have an rtc call that only sets the minutes and
170 * seconds like on Intel to avoid problems with non UTC clocks. 170 * seconds like on Intel to avoid problems with non UTC clocks.
171 */ 171 */
172 if ( ppc_md.set_rtc_time && (time_status & STA_UNSYNC) == 0 && 172 if ( ppc_md.set_rtc_time && ntp_synced() &&
173 xtime.tv_sec - last_rtc_update >= 659 && 173 xtime.tv_sec - last_rtc_update >= 659 &&
174 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && 174 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ &&
175 jiffies - wall_jiffies == 1) { 175 jiffies - wall_jiffies == 1) {
@@ -271,10 +271,7 @@ int do_settimeofday(struct timespec *tv)
271 */ 271 */
272 last_rtc_update = new_sec - 658; 272 last_rtc_update = new_sec - 658;
273 273
274 time_adjust = 0; /* stop active adjtime() */ 274 ntp_clear();
275 time_status |= STA_UNSYNC;
276 time_maxerror = NTP_PHASE_LIMIT;
277 time_esterror = NTP_PHASE_LIMIT;
278 write_sequnlock_irqrestore(&xtime_lock, flags); 275 write_sequnlock_irqrestore(&xtime_lock, flags);
279 clock_was_set(); 276 clock_was_set();
280 return 0; 277 return 0;
diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
index e5fd2ae503ea..9ccce438bd7a 100644
--- a/arch/ppc/syslib/ocp.c
+++ b/arch/ppc/syslib/ocp.c
@@ -165,7 +165,7 @@ ocp_device_remove(struct device *dev)
165} 165}
166 166
167static int 167static int
168ocp_device_suspend(struct device *dev, u32 state) 168ocp_device_suspend(struct device *dev, pm_message_t state)
169{ 169{
170 struct ocp_device *ocp_dev = to_ocp_dev(dev); 170 struct ocp_device *ocp_dev = to_ocp_dev(dev);
171 struct ocp_driver *ocp_drv = to_ocp_drv(dev->driver); 171 struct ocp_driver *ocp_drv = to_ocp_drv(dev->driver);
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
index 13b262f10216..deca68ad644a 100644
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -44,6 +44,10 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
44 bool 44 bool
45 default y 45 default y
46 46
47config ARCH_MAY_HAVE_PC_FDC
48 bool
49 default y
50
47# We optimistically allocate largepages from the VM, so make the limit 51# We optimistically allocate largepages from the VM, so make the limit
48# large enough (16MB). This badly named config option is actually 52# large enough (16MB). This badly named config option is actually
49# max order + 1 53# max order + 1
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 6350cce82efb..8189953a372c 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -49,7 +49,7 @@ NM := $(NM) --synthetic
49 49
50endif 50endif
51 51
52CHECKFLAGS += -m64 -D__powerpc__ 52CHECKFLAGS += -m64 -D__powerpc__ -D__powerpc64__
53 53
54LDFLAGS := -m elf64ppc 54LDFLAGS := -m elf64ppc
55LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) 55LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c
index a3d519518fb8..7e80d49c589a 100644
--- a/arch/ppc64/kernel/kprobes.c
+++ b/arch/ppc64/kernel/kprobes.c
@@ -44,7 +44,7 @@ static struct kprobe *kprobe_prev;
44static unsigned long kprobe_status_prev, kprobe_saved_msr_prev; 44static unsigned long kprobe_status_prev, kprobe_saved_msr_prev;
45static struct pt_regs jprobe_saved_regs; 45static struct pt_regs jprobe_saved_regs;
46 46
47int arch_prepare_kprobe(struct kprobe *p) 47int __kprobes arch_prepare_kprobe(struct kprobe *p)
48{ 48{
49 int ret = 0; 49 int ret = 0;
50 kprobe_opcode_t insn = *p->addr; 50 kprobe_opcode_t insn = *p->addr;
@@ -68,27 +68,27 @@ int arch_prepare_kprobe(struct kprobe *p)
68 return ret; 68 return ret;
69} 69}
70 70
71void arch_copy_kprobe(struct kprobe *p) 71void __kprobes arch_copy_kprobe(struct kprobe *p)
72{ 72{
73 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 73 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
74 p->opcode = *p->addr; 74 p->opcode = *p->addr;
75} 75}
76 76
77void arch_arm_kprobe(struct kprobe *p) 77void __kprobes arch_arm_kprobe(struct kprobe *p)
78{ 78{
79 *p->addr = BREAKPOINT_INSTRUCTION; 79 *p->addr = BREAKPOINT_INSTRUCTION;
80 flush_icache_range((unsigned long) p->addr, 80 flush_icache_range((unsigned long) p->addr,
81 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 81 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
82} 82}
83 83
84void arch_disarm_kprobe(struct kprobe *p) 84void __kprobes arch_disarm_kprobe(struct kprobe *p)
85{ 85{
86 *p->addr = p->opcode; 86 *p->addr = p->opcode;
87 flush_icache_range((unsigned long) p->addr, 87 flush_icache_range((unsigned long) p->addr,
88 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 88 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
89} 89}
90 90
91void arch_remove_kprobe(struct kprobe *p) 91void __kprobes arch_remove_kprobe(struct kprobe *p)
92{ 92{
93 up(&kprobe_mutex); 93 up(&kprobe_mutex);
94 free_insn_slot(p->ainsn.insn); 94 free_insn_slot(p->ainsn.insn);
@@ -102,7 +102,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
102 regs->msr |= MSR_SE; 102 regs->msr |= MSR_SE;
103 103
104 /* single step inline if it is a trap variant */ 104 /* single step inline if it is a trap variant */
105 if (IS_TW(insn) || IS_TD(insn) || IS_TWI(insn) || IS_TDI(insn)) 105 if (is_trap(insn))
106 regs->nip = (unsigned long)p->addr; 106 regs->nip = (unsigned long)p->addr;
107 else 107 else
108 regs->nip = (unsigned long)p->ainsn.insn; 108 regs->nip = (unsigned long)p->ainsn.insn;
@@ -122,7 +122,8 @@ static inline void restore_previous_kprobe(void)
122 kprobe_saved_msr = kprobe_saved_msr_prev; 122 kprobe_saved_msr = kprobe_saved_msr_prev;
123} 123}
124 124
125void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) 125void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
126 struct pt_regs *regs)
126{ 127{
127 struct kretprobe_instance *ri; 128 struct kretprobe_instance *ri;
128 129
@@ -151,7 +152,9 @@ static inline int kprobe_handler(struct pt_regs *regs)
151 Disarm the probe we just hit, and ignore it. */ 152 Disarm the probe we just hit, and ignore it. */
152 p = get_kprobe(addr); 153 p = get_kprobe(addr);
153 if (p) { 154 if (p) {
154 if (kprobe_status == KPROBE_HIT_SS) { 155 kprobe_opcode_t insn = *p->ainsn.insn;
156 if (kprobe_status == KPROBE_HIT_SS &&
157 is_trap(insn)) {
155 regs->msr &= ~MSR_SE; 158 regs->msr &= ~MSR_SE;
156 regs->msr |= kprobe_saved_msr; 159 regs->msr |= kprobe_saved_msr;
157 unlock_kprobes(); 160 unlock_kprobes();
@@ -191,8 +194,7 @@ static inline int kprobe_handler(struct pt_regs *regs)
191 * trap variant, it could belong to someone else 194 * trap variant, it could belong to someone else
192 */ 195 */
193 kprobe_opcode_t cur_insn = *addr; 196 kprobe_opcode_t cur_insn = *addr;
194 if (IS_TW(cur_insn) || IS_TD(cur_insn) || 197 if (is_trap(cur_insn))
195 IS_TWI(cur_insn) || IS_TDI(cur_insn))
196 goto no_kprobe; 198 goto no_kprobe;
197 /* 199 /*
198 * The breakpoint instruction was removed right 200 * The breakpoint instruction was removed right
@@ -244,7 +246,7 @@ void kretprobe_trampoline_holder(void)
244/* 246/*
245 * Called when the probe at kretprobe trampoline is hit 247 * Called when the probe at kretprobe trampoline is hit
246 */ 248 */
247int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 249int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
248{ 250{
249 struct kretprobe_instance *ri = NULL; 251 struct kretprobe_instance *ri = NULL;
250 struct hlist_head *head; 252 struct hlist_head *head;
@@ -308,7 +310,7 @@ int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
308 * single-stepped a copy of the instruction. The address of this 310 * single-stepped a copy of the instruction. The address of this
309 * copy is p->ainsn.insn. 311 * copy is p->ainsn.insn.
310 */ 312 */
311static void resume_execution(struct kprobe *p, struct pt_regs *regs) 313static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
312{ 314{
313 int ret; 315 int ret;
314 unsigned int insn = *p->ainsn.insn; 316 unsigned int insn = *p->ainsn.insn;
@@ -373,8 +375,8 @@ static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
373/* 375/*
374 * Wrapper routine to for handling exceptions. 376 * Wrapper routine to for handling exceptions.
375 */ 377 */
376int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, 378int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
377 void *data) 379 unsigned long val, void *data)
378{ 380{
379 struct die_args *args = (struct die_args *)data; 381 struct die_args *args = (struct die_args *)data;
380 int ret = NOTIFY_DONE; 382 int ret = NOTIFY_DONE;
@@ -402,11 +404,11 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
402 default: 404 default:
403 break; 405 break;
404 } 406 }
405 preempt_enable(); 407 preempt_enable_no_resched();
406 return ret; 408 return ret;
407} 409}
408 410
409int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 411int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
410{ 412{
411 struct jprobe *jp = container_of(p, struct jprobe, kp); 413 struct jprobe *jp = container_of(p, struct jprobe, kp);
412 414
@@ -419,16 +421,16 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
419 return 1; 421 return 1;
420} 422}
421 423
422void jprobe_return(void) 424void __kprobes jprobe_return(void)
423{ 425{
424 asm volatile("trap" ::: "memory"); 426 asm volatile("trap" ::: "memory");
425} 427}
426 428
427void jprobe_return_end(void) 429void __kprobes jprobe_return_end(void)
428{ 430{
429}; 431};
430 432
431int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 433int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
432{ 434{
433 /* 435 /*
434 * FIXME - we should ideally be validating that we got here 'cos 436 * FIXME - we should ideally be validating that we got here 'cos
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index 474df0a862bf..6d860c1d9fa0 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -183,7 +183,7 @@ PPC64_CACHES:
183 * flush all bytes from start through stop-1 inclusive 183 * flush all bytes from start through stop-1 inclusive
184 */ 184 */
185 185
186_GLOBAL(__flush_icache_range) 186_KPROBE(__flush_icache_range)
187 187
188/* 188/*
189 * Flush the data cache to memory 189 * Flush the data cache to memory
@@ -223,7 +223,7 @@ _GLOBAL(__flush_icache_range)
223 bdnz 2b 223 bdnz 2b
224 isync 224 isync
225 blr 225 blr
226 226 .previous .text
227/* 227/*
228 * Like above, but only do the D-cache. 228 * Like above, but only do the D-cache.
229 * 229 *
@@ -957,7 +957,7 @@ _GLOBAL(sys_call_table32)
957 .llong .ppc_fork 957 .llong .ppc_fork
958 .llong .sys_read 958 .llong .sys_read
959 .llong .sys_write 959 .llong .sys_write
960 .llong .sys32_open /* 5 */ 960 .llong .compat_sys_open /* 5 */
961 .llong .sys_close 961 .llong .sys_close
962 .llong .sys32_waitpid 962 .llong .sys32_waitpid
963 .llong .sys32_creat 963 .llong .sys32_creat
diff --git a/arch/ppc64/kernel/pSeries_reconfig.c b/arch/ppc64/kernel/pSeries_reconfig.c
index dc2a69d412a2..58c61219d08e 100644
--- a/arch/ppc64/kernel/pSeries_reconfig.c
+++ b/arch/ppc64/kernel/pSeries_reconfig.c
@@ -111,7 +111,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
111 struct device_node *np; 111 struct device_node *np;
112 int err = -ENOMEM; 112 int err = -ENOMEM;
113 113
114 np = kcalloc(1, sizeof(*np), GFP_KERNEL); 114 np = kzalloc(sizeof(*np), GFP_KERNEL);
115 if (!np) 115 if (!np)
116 goto out_err; 116 goto out_err;
117 117
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 206619080e66..214914a95a50 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -867,37 +867,6 @@ off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin)
867 return sys_lseek(fd, (int)offset, origin); 867 return sys_lseek(fd, (int)offset, origin);
868} 868}
869 869
870/*
871 * This is just a version for 32-bit applications which does
872 * not force O_LARGEFILE on.
873 */
874asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
875{
876 char * tmp;
877 int fd, error;
878
879 tmp = getname(filename);
880 fd = PTR_ERR(tmp);
881 if (!IS_ERR(tmp)) {
882 fd = get_unused_fd();
883 if (fd >= 0) {
884 struct file * f = filp_open(tmp, flags, mode);
885 error = PTR_ERR(f);
886 if (IS_ERR(f))
887 goto out_error;
888 fd_install(fd, f);
889 }
890out:
891 putname(tmp);
892 }
893 return fd;
894
895out_error:
896 put_unused_fd(fd);
897 fd = error;
898 goto out;
899}
900
901/* Note: it is necessary to treat bufsiz as an unsigned int, 870/* Note: it is necessary to treat bufsiz as an unsigned int,
902 * with the corresponding cast to a signed int to insure that the 871 * with the corresponding cast to a signed int to insure that the
903 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 872 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
diff --git a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
index 91ef95ccda4f..9939c206afa4 100644
--- a/arch/ppc64/kernel/time.c
+++ b/arch/ppc64/kernel/time.c
@@ -128,7 +128,7 @@ static __inline__ void timer_check_rtc(void)
128 * We should have an rtc call that only sets the minutes and 128 * We should have an rtc call that only sets the minutes and
129 * seconds like on Intel to avoid problems with non UTC clocks. 129 * seconds like on Intel to avoid problems with non UTC clocks.
130 */ 130 */
131 if ( (time_status & STA_UNSYNC) == 0 && 131 if (ntp_synced() &&
132 xtime.tv_sec - last_rtc_update >= 659 && 132 xtime.tv_sec - last_rtc_update >= 659 &&
133 abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ && 133 abs((xtime.tv_nsec/1000) - (1000000-1000000/HZ)) < 500000/HZ &&
134 jiffies - wall_jiffies == 1) { 134 jiffies - wall_jiffies == 1) {
@@ -435,10 +435,7 @@ int do_settimeofday(struct timespec *tv)
435 */ 435 */
436 last_rtc_update = new_sec - 658; 436 last_rtc_update = new_sec - 658;
437 437
438 time_adjust = 0; /* stop active adjtime() */ 438 ntp_clear();
439 time_status |= STA_UNSYNC;
440 time_maxerror = NTP_PHASE_LIMIT;
441 time_esterror = NTP_PHASE_LIMIT;
442 439
443 delta_xsec = mulhdu( (tb_last_stamp-do_gtod.varp->tb_orig_stamp), 440 delta_xsec = mulhdu( (tb_last_stamp-do_gtod.varp->tb_orig_stamp),
444 do_gtod.varp->tb_to_xs ); 441 do_gtod.varp->tb_to_xs );
diff --git a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
index a8d5e83ee89f..7467ae508e6e 100644
--- a/arch/ppc64/kernel/traps.c
+++ b/arch/ppc64/kernel/traps.c
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/kprobes.h>
33#include <asm/kdebug.h> 34#include <asm/kdebug.h>
34 35
35#include <asm/pgtable.h> 36#include <asm/pgtable.h>
@@ -220,7 +221,7 @@ void instruction_breakpoint_exception(struct pt_regs *regs)
220 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); 221 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
221} 222}
222 223
223void single_step_exception(struct pt_regs *regs) 224void __kprobes single_step_exception(struct pt_regs *regs)
224{ 225{
225 regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */ 226 regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */
226 227
@@ -398,7 +399,7 @@ check_bug_trap(struct pt_regs *regs)
398 return 0; 399 return 0;
399} 400}
400 401
401void program_check_exception(struct pt_regs *regs) 402void __kprobes program_check_exception(struct pt_regs *regs)
402{ 403{
403 if (debugger_fault_handler(regs)) 404 if (debugger_fault_handler(regs))
404 return; 405 return;
diff --git a/arch/ppc64/kernel/vmlinux.lds.S b/arch/ppc64/kernel/vmlinux.lds.S
index 4103cc13f8d6..0306510bc4ff 100644
--- a/arch/ppc64/kernel/vmlinux.lds.S
+++ b/arch/ppc64/kernel/vmlinux.lds.S
@@ -15,6 +15,7 @@ SECTIONS
15 *(.text .text.*) 15 *(.text .text.*)
16 SCHED_TEXT 16 SCHED_TEXT
17 LOCK_TEXT 17 LOCK_TEXT
18 KPROBES_TEXT
18 *(.fixup) 19 *(.fixup)
19 . = ALIGN(4096); 20 . = ALIGN(4096);
20 _etext = .; 21 _etext = .;
diff --git a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c
index 20b0f37e8bf8..772f0714a5b7 100644
--- a/arch/ppc64/mm/fault.c
+++ b/arch/ppc64/mm/fault.c
@@ -29,6 +29,7 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/kprobes.h>
32 33
33#include <asm/page.h> 34#include <asm/page.h>
34#include <asm/pgtable.h> 35#include <asm/pgtable.h>
@@ -84,8 +85,8 @@ static int store_updates_sp(struct pt_regs *regs)
84 * The return value is 0 if the fault was handled, or the signal 85 * The return value is 0 if the fault was handled, or the signal
85 * number if this is a kernel fault that can't be handled here. 86 * number if this is a kernel fault that can't be handled here.
86 */ 87 */
87int do_page_fault(struct pt_regs *regs, unsigned long address, 88int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
88 unsigned long error_code) 89 unsigned long error_code)
89{ 90{
90 struct vm_area_struct * vma; 91 struct vm_area_struct * vma;
91 struct mm_struct *mm = current->mm; 92 struct mm_struct *mm = current->mm;
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 8ca485676780..2fd75da15495 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -139,10 +139,7 @@ int do_settimeofday(struct timespec *tv)
139 set_normalized_timespec(&xtime, sec, nsec); 139 set_normalized_timespec(&xtime, sec, nsec);
140 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 140 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
141 141
142 time_adjust = 0; /* stop active adjtime() */ 142 ntp_clear();
143 time_status |= STA_UNSYNC;
144 time_maxerror = NTP_PHASE_LIMIT;
145 time_esterror = NTP_PHASE_LIMIT;
146 write_sequnlock_irq(&xtime_lock); 143 write_sequnlock_irq(&xtime_lock);
147 clock_was_set(); 144 clock_was_set();
148 return 0; 145 return 0;
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index adc8109f8b77..3e804c736e64 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -37,6 +37,10 @@ config GENERIC_CALIBRATE_DELAY
37 bool 37 bool
38 default y 38 default y
39 39
40config ARCH_MAY_HAVE_PC_FDC
41 bool
42 default y
43
40source "init/Kconfig" 44source "init/Kconfig"
41 45
42menu "System type" 46menu "System type"
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index df7a9b9d4cbf..02ca69918d7c 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -215,10 +215,7 @@ int do_settimeofday(struct timespec *tv)
215 set_normalized_timespec(&xtime, sec, nsec); 215 set_normalized_timespec(&xtime, sec, nsec);
216 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 216 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
217 217
218 time_adjust = 0; /* stop active adjtime() */ 218 ntp_clear();
219 time_status |= STA_UNSYNC;
220 time_maxerror = NTP_PHASE_LIMIT;
221 time_esterror = NTP_PHASE_LIMIT;
222 write_sequnlock_irq(&xtime_lock); 219 write_sequnlock_irq(&xtime_lock);
223 clock_was_set(); 220 clock_was_set();
224 221
@@ -234,7 +231,7 @@ static long last_rtc_update;
234 * timer_interrupt() needs to keep up the real-time clock, 231 * timer_interrupt() needs to keep up the real-time clock,
235 * as well as call the "do_timer()" routine every clocktick 232 * as well as call the "do_timer()" routine every clocktick
236 */ 233 */
237static inline void do_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 234static inline void do_timer_interrupt(int irq, struct pt_regs *regs)
238{ 235{
239 do_timer(regs); 236 do_timer(regs);
240#ifndef CONFIG_SMP 237#ifndef CONFIG_SMP
@@ -252,7 +249,7 @@ static inline void do_timer_interrupt(int irq, void *dev_id, struct pt_regs *reg
252 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 249 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
253 * called as close as possible to 500 ms before the new second starts. 250 * called as close as possible to 500 ms before the new second starts.
254 */ 251 */
255 if ((time_status & STA_UNSYNC) == 0 && 252 if (ntp_synced() &&
256 xtime.tv_sec > last_rtc_update + 660 && 253 xtime.tv_sec > last_rtc_update + 660 &&
257 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 254 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
258 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 255 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
@@ -285,7 +282,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
285 * locally disabled. -arca 282 * locally disabled. -arca
286 */ 283 */
287 write_seqlock(&xtime_lock); 284 write_seqlock(&xtime_lock);
288 do_timer_interrupt(irq, NULL, regs); 285 do_timer_interrupt(irq, regs);
289 write_sequnlock(&xtime_lock); 286 write_sequnlock(&xtime_lock);
290 287
291 return IRQ_HANDLED; 288 return IRQ_HANDLED;
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index 6c84da3efc73..f4a62a10053c 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -247,10 +247,7 @@ int do_settimeofday(struct timespec *tv)
247 set_normalized_timespec(&xtime, sec, nsec); 247 set_normalized_timespec(&xtime, sec, nsec);
248 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 248 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
249 249
250 time_adjust = 0; /* stop active adjtime() */ 250 ntp_clear();
251 time_status |= STA_UNSYNC;
252 time_maxerror = NTP_PHASE_LIMIT;
253 time_esterror = NTP_PHASE_LIMIT;
254 write_sequnlock_irq(&xtime_lock); 251 write_sequnlock_irq(&xtime_lock);
255 clock_was_set(); 252 clock_was_set();
256 253
@@ -303,7 +300,7 @@ static long last_rtc_update = 0;
303 * timer_interrupt() needs to keep up the real-time clock, 300 * timer_interrupt() needs to keep up the real-time clock,
304 * as well as call the "do_timer()" routine every clocktick 301 * as well as call the "do_timer()" routine every clocktick
305 */ 302 */
306static inline void do_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 303static inline void do_timer_interrupt(int irq, struct pt_regs *regs)
307{ 304{
308 unsigned long long current_ctc; 305 unsigned long long current_ctc;
309 asm ("getcon cr62, %0" : "=r" (current_ctc)); 306 asm ("getcon cr62, %0" : "=r" (current_ctc));
@@ -328,7 +325,7 @@ static inline void do_timer_interrupt(int irq, void *dev_id, struct pt_regs *reg
328 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 325 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
329 * called as close as possible to 500 ms before the new second starts. 326 * called as close as possible to 500 ms before the new second starts.
330 */ 327 */
331 if ((time_status & STA_UNSYNC) == 0 && 328 if (ntp_synced() &&
332 xtime.tv_sec > last_rtc_update + 660 && 329 xtime.tv_sec > last_rtc_update + 660 &&
333 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 330 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
334 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 331 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
@@ -361,7 +358,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
361 * locally disabled. -arca 358 * locally disabled. -arca
362 */ 359 */
363 write_lock(&xtime_lock); 360 write_lock(&xtime_lock);
364 do_timer_interrupt(irq, NULL, regs); 361 do_timer_interrupt(irq, regs);
365 write_unlock(&xtime_lock); 362 write_unlock(&xtime_lock);
366 363
367 return IRQ_HANDLED; 364 return IRQ_HANDLED;
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index aca028aa29bf..aba05394d30a 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -211,6 +211,10 @@ config GENERIC_CALIBRATE_DELAY
211 bool 211 bool
212 default y 212 default y
213 213
214config ARCH_MAY_HAVE_PC_FDC
215 bool
216 default y
217
214config SUN_PM 218config SUN_PM
215 bool 219 bool
216 default y 220 default y
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 597d3ff6ad68..36a40697b8d6 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -840,10 +840,7 @@ static int pci_do_settimeofday(struct timespec *tv)
840 840
841 xtime.tv_sec = tv->tv_sec; 841 xtime.tv_sec = tv->tv_sec;
842 xtime.tv_nsec = tv->tv_nsec; 842 xtime.tv_nsec = tv->tv_nsec;
843 time_adjust = 0; /* stop active adjtime() */ 843 ntp_clear();
844 time_status |= STA_UNSYNC;
845 time_maxerror = NTP_PHASE_LIMIT;
846 time_esterror = NTP_PHASE_LIMIT;
847 return 0; 844 return 0;
848} 845}
849 846
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 3b759aefc170..bc015e980341 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -139,7 +139,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
139 139
140 140
141 /* Determine when to update the Mostek clock. */ 141 /* Determine when to update the Mostek clock. */
142 if ((time_status & STA_UNSYNC) == 0 && 142 if (ntp_synced() &&
143 xtime.tv_sec > last_rtc_update + 660 && 143 xtime.tv_sec > last_rtc_update + 660 &&
144 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 144 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
145 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 145 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
@@ -554,10 +554,7 @@ static int sbus_do_settimeofday(struct timespec *tv)
554 set_normalized_timespec(&xtime, sec, nsec); 554 set_normalized_timespec(&xtime, sec, nsec);
555 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 555 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
556 556
557 time_adjust = 0; /* stop active adjtime() */ 557 ntp_clear();
558 time_status |= STA_UNSYNC;
559 time_maxerror = NTP_PHASE_LIMIT;
560 time_esterror = NTP_PHASE_LIMIT;
561 return 0; 558 return 0;
562} 559}
563 560
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 73ec6aec5ed5..1e9d8638a28a 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -26,6 +26,10 @@ config TIME_INTERPOLATION
26 bool 26 bool
27 default y 27 default y
28 28
29config ARCH_MAY_HAVE_PC_FDC
30 bool
31 default y
32
29choice 33choice
30 prompt "Kernel page size" 34 prompt "Kernel page size"
31 default SPARC64_PAGE_SIZE_8KB 35 default SPARC64_PAGE_SIZE_8KB
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
index bbf11f85dab1..0d66d07c8c6e 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc64/kernel/kprobes.c
@@ -8,6 +8,7 @@
8#include <linux/kprobes.h> 8#include <linux/kprobes.h>
9#include <asm/kdebug.h> 9#include <asm/kdebug.h>
10#include <asm/signal.h> 10#include <asm/signal.h>
11#include <asm/cacheflush.h>
11 12
12/* We do not have hardware single-stepping on sparc64. 13/* We do not have hardware single-stepping on sparc64.
13 * So we implement software single-stepping with breakpoint 14 * So we implement software single-stepping with breakpoint
@@ -37,31 +38,31 @@
37 * - Mark that we are no longer actively in a kprobe. 38 * - Mark that we are no longer actively in a kprobe.
38 */ 39 */
39 40
40int arch_prepare_kprobe(struct kprobe *p) 41int __kprobes arch_prepare_kprobe(struct kprobe *p)
41{ 42{
42 return 0; 43 return 0;
43} 44}
44 45
45void arch_copy_kprobe(struct kprobe *p) 46void __kprobes arch_copy_kprobe(struct kprobe *p)
46{ 47{
47 p->ainsn.insn[0] = *p->addr; 48 p->ainsn.insn[0] = *p->addr;
48 p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; 49 p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2;
49 p->opcode = *p->addr; 50 p->opcode = *p->addr;
50} 51}
51 52
52void arch_arm_kprobe(struct kprobe *p) 53void __kprobes arch_arm_kprobe(struct kprobe *p)
53{ 54{
54 *p->addr = BREAKPOINT_INSTRUCTION; 55 *p->addr = BREAKPOINT_INSTRUCTION;
55 flushi(p->addr); 56 flushi(p->addr);
56} 57}
57 58
58void arch_disarm_kprobe(struct kprobe *p) 59void __kprobes arch_disarm_kprobe(struct kprobe *p)
59{ 60{
60 *p->addr = p->opcode; 61 *p->addr = p->opcode;
61 flushi(p->addr); 62 flushi(p->addr);
62} 63}
63 64
64void arch_remove_kprobe(struct kprobe *p) 65void __kprobes arch_remove_kprobe(struct kprobe *p)
65{ 66{
66} 67}
67 68
@@ -111,7 +112,7 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
111 } 112 }
112} 113}
113 114
114static int kprobe_handler(struct pt_regs *regs) 115static int __kprobes kprobe_handler(struct pt_regs *regs)
115{ 116{
116 struct kprobe *p; 117 struct kprobe *p;
117 void *addr = (void *) regs->tpc; 118 void *addr = (void *) regs->tpc;
@@ -191,8 +192,9 @@ no_kprobe:
191 * The original INSN location was REAL_PC, it actually 192 * The original INSN location was REAL_PC, it actually
192 * executed at PC and produced destination address NPC. 193 * executed at PC and produced destination address NPC.
193 */ 194 */
194static unsigned long relbranch_fixup(u32 insn, unsigned long real_pc, 195static unsigned long __kprobes relbranch_fixup(u32 insn, unsigned long real_pc,
195 unsigned long pc, unsigned long npc) 196 unsigned long pc,
197 unsigned long npc)
196{ 198{
197 /* Branch not taken, no mods necessary. */ 199 /* Branch not taken, no mods necessary. */
198 if (npc == pc + 0x4UL) 200 if (npc == pc + 0x4UL)
@@ -217,7 +219,8 @@ static unsigned long relbranch_fixup(u32 insn, unsigned long real_pc,
217/* If INSN is an instruction which writes it's PC location 219/* If INSN is an instruction which writes it's PC location
218 * into a destination register, fix that up. 220 * into a destination register, fix that up.
219 */ 221 */
220static void retpc_fixup(struct pt_regs *regs, u32 insn, unsigned long real_pc) 222static void __kprobes retpc_fixup(struct pt_regs *regs, u32 insn,
223 unsigned long real_pc)
221{ 224{
222 unsigned long *slot = NULL; 225 unsigned long *slot = NULL;
223 226
@@ -257,7 +260,7 @@ static void retpc_fixup(struct pt_regs *regs, u32 insn, unsigned long real_pc)
257 * This function prepares to return from the post-single-step 260 * This function prepares to return from the post-single-step
258 * breakpoint trap. 261 * breakpoint trap.
259 */ 262 */
260static void resume_execution(struct kprobe *p, struct pt_regs *regs) 263static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
261{ 264{
262 u32 insn = p->ainsn.insn[0]; 265 u32 insn = p->ainsn.insn[0];
263 266
@@ -315,8 +318,8 @@ static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
315/* 318/*
316 * Wrapper routine to for handling exceptions. 319 * Wrapper routine to for handling exceptions.
317 */ 320 */
318int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, 321int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
319 void *data) 322 unsigned long val, void *data)
320{ 323{
321 struct die_args *args = (struct die_args *)data; 324 struct die_args *args = (struct die_args *)data;
322 switch (val) { 325 switch (val) {
@@ -344,7 +347,8 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
344 return NOTIFY_DONE; 347 return NOTIFY_DONE;
345} 348}
346 349
347asmlinkage void kprobe_trap(unsigned long trap_level, struct pt_regs *regs) 350asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
351 struct pt_regs *regs)
348{ 352{
349 BUG_ON(trap_level != 0x170 && trap_level != 0x171); 353 BUG_ON(trap_level != 0x170 && trap_level != 0x171);
350 354
@@ -368,7 +372,7 @@ static struct pt_regs jprobe_saved_regs;
368static struct pt_regs *jprobe_saved_regs_location; 372static struct pt_regs *jprobe_saved_regs_location;
369static struct sparc_stackf jprobe_saved_stack; 373static struct sparc_stackf jprobe_saved_stack;
370 374
371int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 375int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
372{ 376{
373 struct jprobe *jp = container_of(p, struct jprobe, kp); 377 struct jprobe *jp = container_of(p, struct jprobe, kp);
374 378
@@ -390,7 +394,7 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
390 return 1; 394 return 1;
391} 395}
392 396
393void jprobe_return(void) 397void __kprobes jprobe_return(void)
394{ 398{
395 preempt_enable_no_resched(); 399 preempt_enable_no_resched();
396 __asm__ __volatile__( 400 __asm__ __volatile__(
@@ -403,7 +407,7 @@ extern void jprobe_return_trap_instruction(void);
403 407
404extern void __show_regs(struct pt_regs * regs); 408extern void __show_regs(struct pt_regs * regs);
405 409
406int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 410int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
407{ 411{
408 u32 *addr = (u32 *) regs->tpc; 412 u32 *addr = (u32 *) regs->tpc;
409 413
diff --git a/arch/sparc64/kernel/sunos_ioctl32.c b/arch/sparc64/kernel/sunos_ioctl32.c
index 87c1aeb02220..7654b8a7f03a 100644
--- a/arch/sparc64/kernel/sunos_ioctl32.c
+++ b/arch/sparc64/kernel/sunos_ioctl32.c
@@ -152,11 +152,12 @@ asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg)
152 ret = compat_sys_ioctl(fd, SIOCGIFCONF, arg); 152 ret = compat_sys_ioctl(fd, SIOCGIFCONF, arg);
153 goto out; 153 goto out;
154 154
155 case _IOW('i', 21, struct ifreq): /* SIOCSIFMTU */ 155 case _IOW('i', 21, struct ifreq32):
156 ret = sys_ioctl(fd, SIOCSIFMTU, arg); 156 ret = compat_sys_ioctl(fd, SIOCSIFMTU, arg);
157 goto out; 157 goto out;
158 case _IOWR('i', 22, struct ifreq): /* SIOCGIFMTU */ 158
159 ret = sys_ioctl(fd, SIOCGIFMTU, arg); 159 case _IOWR('i', 22, struct ifreq32):
160 ret = compat_sys_ioctl(fd, SIOCGIFMTU, arg);
160 goto out; 161 goto out;
161 162
162 case _IOWR('i', 23, struct ifreq32): 163 case _IOWR('i', 23, struct ifreq32):
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 1d3aa588df8a..7f6239ed2521 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -1002,29 +1002,7 @@ asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
1002asmlinkage long sparc32_open(const char __user *filename, 1002asmlinkage long sparc32_open(const char __user *filename,
1003 int flags, int mode) 1003 int flags, int mode)
1004{ 1004{
1005 char * tmp; 1005 return do_sys_open(filename, flags, mode);
1006 int fd, error;
1007
1008 tmp = getname(filename);
1009 fd = PTR_ERR(tmp);
1010 if (!IS_ERR(tmp)) {
1011 fd = get_unused_fd();
1012 if (fd >= 0) {
1013 struct file * f = filp_open(tmp, flags, mode);
1014 error = PTR_ERR(f);
1015 if (IS_ERR(f))
1016 goto out_error;
1017 fd_install(fd, f);
1018 }
1019out:
1020 putname(tmp);
1021 }
1022 return fd;
1023
1024out_error:
1025 put_unused_fd(fd);
1026 fd = error;
1027 goto out;
1028} 1006}
1029 1007
1030extern unsigned long do_mremap(unsigned long addr, 1008extern unsigned long do_mremap(unsigned long addr,
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 362b9c26871b..3f08a32f51a1 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -449,7 +449,7 @@ static inline void timer_check_rtc(void)
449 static long last_rtc_update; 449 static long last_rtc_update;
450 450
451 /* Determine when to update the Mostek clock. */ 451 /* Determine when to update the Mostek clock. */
452 if ((time_status & STA_UNSYNC) == 0 && 452 if (ntp_synced() &&
453 xtime.tv_sec > last_rtc_update + 660 && 453 xtime.tv_sec > last_rtc_update + 660 &&
454 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 454 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
455 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 455 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index 950423da8a6a..f47d0be39378 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -17,6 +17,7 @@ SECTIONS
17 *(.text) 17 *(.text)
18 SCHED_TEXT 18 SCHED_TEXT
19 LOCK_TEXT 19 LOCK_TEXT
20 KPROBES_TEXT
20 *(.gnu.warning) 21 *(.gnu.warning)
21 } =0 22 } =0
22 _etext = .; 23 _etext = .;
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index 52e9375288a9..db1e3310e907 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -18,6 +18,7 @@
18#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/kprobes.h>
21 22
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
@@ -117,8 +118,9 @@ unsigned long __init prom_probe_memory (void)
117 return tally; 118 return tally;
118} 119}
119 120
120static void unhandled_fault(unsigned long address, struct task_struct *tsk, 121static void __kprobes unhandled_fault(unsigned long address,
121 struct pt_regs *regs) 122 struct task_struct *tsk,
123 struct pt_regs *regs)
122{ 124{
123 if ((unsigned long) address < PAGE_SIZE) { 125 if ((unsigned long) address < PAGE_SIZE) {
124 printk(KERN_ALERT "Unable to handle kernel NULL " 126 printk(KERN_ALERT "Unable to handle kernel NULL "
@@ -304,7 +306,7 @@ cannot_handle:
304 unhandled_fault (address, current, regs); 306 unhandled_fault (address, current, regs);
305} 307}
306 308
307asmlinkage void do_sparc64_fault(struct pt_regs *regs) 309asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
308{ 310{
309 struct mm_struct *mm = current->mm; 311 struct mm_struct *mm = current->mm;
310 struct vm_area_struct *vma; 312 struct vm_area_struct *vma;
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 3fbaf342a452..fdb1ebb308c9 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -19,6 +19,7 @@
19#include <linux/pagemap.h> 19#include <linux/pagemap.h>
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/seq_file.h> 21#include <linux/seq_file.h>
22#include <linux/kprobes.h>
22 23
23#include <asm/head.h> 24#include <asm/head.h>
24#include <asm/system.h> 25#include <asm/system.h>
@@ -250,7 +251,7 @@ out:
250 put_cpu(); 251 put_cpu();
251} 252}
252 253
253void flush_icache_range(unsigned long start, unsigned long end) 254void __kprobes flush_icache_range(unsigned long start, unsigned long end)
254{ 255{
255 /* Cheetah has coherent I-cache. */ 256 /* Cheetah has coherent I-cache. */
256 if (tlb_type == spitfire) { 257 if (tlb_type == spitfire) {
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
index 8dfa825eca51..b2ee9b53227f 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc64/mm/ultra.S
@@ -119,6 +119,7 @@ __spitfire_flush_tlb_mm_slow:
119#else 119#else
120#error unsupported PAGE_SIZE 120#error unsupported PAGE_SIZE
121#endif 121#endif
122 .section .kprobes.text, "ax"
122 .align 32 123 .align 32
123 .globl __flush_icache_page 124 .globl __flush_icache_page
124__flush_icache_page: /* %o0 = phys_page */ 125__flush_icache_page: /* %o0 = phys_page */
@@ -201,6 +202,7 @@ dflush4:stxa %g0, [%o4] ASI_DCACHE_TAG
201 nop 202 nop
202#endif /* DCACHE_ALIASING_POSSIBLE */ 203#endif /* DCACHE_ALIASING_POSSIBLE */
203 204
205 .previous .text
204 .align 32 206 .align 32
205__prefill_dtlb: 207__prefill_dtlb:
206 rdpr %pstate, %g7 208 rdpr %pstate, %g7
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index a777e57dbf89..1ab431a53ac3 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -27,7 +27,7 @@ export LDFLAGS HOSTCFLAGS HOSTLDFLAGS UML_OBJCOPYFLAGS
27endif 27endif
28endif 28endif
29 29
30CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) $(STUB_CFLAGS) 30CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH)
31 31
32ifneq ($(CONFIG_GPROF),y) 32ifneq ($(CONFIG_GPROF),y)
33ARCH_CFLAGS += -DUM_FASTCALL 33ARCH_CFLAGS += -DUM_FASTCALL
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h
index d705daa2d854..0aa620970adb 100644
--- a/arch/um/include/common-offsets.h
+++ b/arch/um/include/common-offsets.h
@@ -12,3 +12,4 @@ DEFINE_STR(UM_KERN_WARNING, KERN_WARNING);
12DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE); 12DEFINE_STR(UM_KERN_NOTICE, KERN_NOTICE);
13DEFINE_STR(UM_KERN_INFO, KERN_INFO); 13DEFINE_STR(UM_KERN_INFO, KERN_INFO);
14DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG); 14DEFINE_STR(UM_KERN_DEBUG, KERN_DEBUG);
15DEFINE(HOST_ELF_CLASS, ELF_CLASS);
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h
index 6e348cb6de24..84c0868cd561 100644
--- a/arch/um/include/um_uaccess.h
+++ b/arch/um/include/um_uaccess.h
@@ -20,13 +20,6 @@
20#define access_ok(type, addr, size) \ 20#define access_ok(type, addr, size) \
21 CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size) 21 CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)
22 22
23/* this function will go away soon - use access_ok() instead */
24static inline int __deprecated verify_area(int type, const void __user *addr, unsigned long size)
25{
26 return (CHOOSE_MODE_PROC(verify_area_tt, verify_area_skas, type, addr,
27 size));
28}
29
30static inline int copy_from_user(void *to, const void __user *from, int n) 23static inline int copy_from_user(void *to, const void __user *from, int n)
31{ 24{
32 return(CHOOSE_MODE_PROC(copy_from_user_tt, copy_from_user_skas, to, 25 return(CHOOSE_MODE_PROC(copy_from_user_tt, copy_from_user_skas, to,
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 5597bd39e6b5..64fa062cc119 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -196,7 +196,7 @@ static void init_highmem(void)
196 196
197static void __init fixaddr_user_init( void) 197static void __init fixaddr_user_init( void)
198{ 198{
199#if CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA 199#ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
200 long size = FIXADDR_USER_END - FIXADDR_USER_START; 200 long size = FIXADDR_USER_END - FIXADDR_USER_START;
201 pgd_t *pgd; 201 pgd_t *pgd;
202 pud_t *pud; 202 pud_t *pud;
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index d3c1560e3ed8..7a1662419c0c 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -9,6 +9,9 @@ obj-y = aio.o elf_aux.o file.o process.o signal.o start_up.o time.o tt.o \
9USER_OBJS := aio.o elf_aux.o file.o process.o signal.o start_up.o time.o tt.o \ 9USER_OBJS := aio.o elf_aux.o file.o process.o signal.o start_up.o time.o tt.o \
10 tty.o 10 tty.o
11 11
12elf_aux.o: $(ARCH_DIR)/kernel-offsets.h
13CFLAGS_elf_aux.o += -I$(objtree)/arch/um
14
12CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) 15CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
13 16
14HAVE_AIO_ABI := $(shell [ -r /usr/include/linux/aio_abi.h ] && \ 17HAVE_AIO_ABI := $(shell [ -r /usr/include/linux/aio_abi.h ] && \
diff --git a/arch/um/os-Linux/elf_aux.c b/arch/um/os-Linux/elf_aux.c
index 4cca3e9c23fe..1399520a8588 100644
--- a/arch/um/os-Linux/elf_aux.c
+++ b/arch/um/os-Linux/elf_aux.c
@@ -12,8 +12,9 @@
12#include "init.h" 12#include "init.h"
13#include "elf_user.h" 13#include "elf_user.h"
14#include "mem_user.h" 14#include "mem_user.h"
15#include <kernel-offsets.h>
15 16
16#if ELF_CLASS == ELFCLASS32 17#if HOST_ELF_CLASS == ELFCLASS32
17typedef Elf32_auxv_t elf_auxv_t; 18typedef Elf32_auxv_t elf_auxv_t;
18#else 19#else
19typedef Elf64_auxv_t elf_auxv_t; 20typedef Elf64_auxv_t elf_auxv_t;
diff --git a/arch/um/sys-i386/kernel-offsets.c b/arch/um/sys-i386/kernel-offsets.c
index 9f8ecd1fdd96..a1070af2bcd8 100644
--- a/arch/um/sys-i386/kernel-offsets.c
+++ b/arch/um/sys-i386/kernel-offsets.c
@@ -2,6 +2,7 @@
2#include <linux/stddef.h> 2#include <linux/stddef.h>
3#include <linux/sched.h> 3#include <linux/sched.h>
4#include <linux/time.h> 4#include <linux/time.h>
5#include <linux/elf.h>
5#include <asm/page.h> 6#include <asm/page.h>
6 7
7#define DEFINE(sym, val) \ 8#define DEFINE(sym, val) \
diff --git a/arch/um/sys-x86_64/kernel-offsets.c b/arch/um/sys-x86_64/kernel-offsets.c
index 220e875cbe29..998541eade41 100644
--- a/arch/um/sys-x86_64/kernel-offsets.c
+++ b/arch/um/sys-x86_64/kernel-offsets.c
@@ -2,6 +2,7 @@
2#include <linux/stddef.h> 2#include <linux/stddef.h>
3#include <linux/sched.h> 3#include <linux/sched.h>
4#include <linux/time.h> 4#include <linux/time.h>
5#include <linux/elf.h>
5#include <asm/page.h> 6#include <asm/page.h>
6 7
7#define DEFINE(sym, val) \ 8#define DEFINE(sym, val) \
diff --git a/arch/v850/kernel/time.c b/arch/v850/kernel/time.c
index f722a268238a..ea3fd8844ff0 100644
--- a/arch/v850/kernel/time.c
+++ b/arch/v850/kernel/time.c
@@ -66,7 +66,7 @@ static irqreturn_t timer_interrupt (int irq, void *dummy, struct pt_regs *regs)
66 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 66 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
67 * called as close as possible to 500 ms before the new second starts. 67 * called as close as possible to 500 ms before the new second starts.
68 */ 68 */
69 if ((time_status & STA_UNSYNC) == 0 && 69 if (ntp_synced() &&
70 xtime.tv_sec > last_rtc_update + 660 && 70 xtime.tv_sec > last_rtc_update + 660 &&
71 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 71 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
72 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 72 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
@@ -169,10 +169,7 @@ int do_settimeofday(struct timespec *tv)
169 xtime.tv_sec = tv->tv_sec; 169 xtime.tv_sec = tv->tv_sec;
170 xtime.tv_nsec = tv->tv_nsec; 170 xtime.tv_nsec = tv->tv_nsec;
171 171
172 time_adjust = 0; /* stop active adjtime () */ 172 ntp_clear();
173 time_status |= STA_UNSYNC;
174 time_maxerror = NTP_PHASE_LIMIT;
175 time_esterror = NTP_PHASE_LIMIT;
176 173
177 write_sequnlock_irq (&xtime_lock); 174 write_sequnlock_irq (&xtime_lock);
178 clock_was_set(); 175 clock_was_set();
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 75e52c57f19c..e63323e03ea9 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -65,6 +65,10 @@ config GENERIC_IOMAP
65 bool 65 bool
66 default y 66 default y
67 67
68config ARCH_MAY_HAVE_PC_FDC
69 bool
70 default y
71
68source "init/Kconfig" 72source "init/Kconfig"
69 73
70 74
@@ -148,7 +152,6 @@ config X86_CPUID
148 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to 152 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
149 /dev/cpu/31/cpuid. 153 /dev/cpu/31/cpuid.
150 154
151# disable it for opteron optimized builds because it pulls in ACPI_BOOT
152config X86_HT 155config X86_HT
153 bool 156 bool
154 depends on SMP && !MK8 157 depends on SMP && !MK8
@@ -441,6 +444,11 @@ config ISA_DMA_API
441 bool 444 bool
442 default y 445 default y
443 446
447config GENERIC_PENDING_IRQ
448 bool
449 depends on GENERIC_HARDIRQS && SMP
450 default y
451
444menu "Power management options" 452menu "Power management options"
445 453
446source kernel/power/Kconfig 454source kernel/power/Kconfig
@@ -465,7 +473,6 @@ config PCI_DIRECT
465config PCI_MMCONFIG 473config PCI_MMCONFIG
466 bool "Support mmconfig PCI config space access" 474 bool "Support mmconfig PCI config space access"
467 depends on PCI && ACPI 475 depends on PCI && ACPI
468 select ACPI_BOOT
469 476
470config UNORDERED_IO 477config UNORDERED_IO
471 bool "Unordered IO mapping access" 478 bool "Unordered IO mapping access"
diff --git a/arch/x86_64/boot/setup.S b/arch/x86_64/boot/setup.S
index ff58b2832b75..12ea0b6c52e2 100644
--- a/arch/x86_64/boot/setup.S
+++ b/arch/x86_64/boot/setup.S
@@ -81,7 +81,7 @@ start:
81# This is the setup header, and it must start at %cs:2 (old 0x9020:2) 81# This is the setup header, and it must start at %cs:2 (old 0x9020:2)
82 82
83 .ascii "HdrS" # header signature 83 .ascii "HdrS" # header signature
84 .word 0x0203 # header version number (>= 0x0105) 84 .word 0x0204 # header version number (>= 0x0105)
85 # or else old loadlin-1.5 will fail) 85 # or else old loadlin-1.5 will fail)
86realmode_swtch: .word 0, 0 # default_switch, SETUPSEG 86realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
87start_sys_seg: .word SYSSEG 87start_sys_seg: .word SYSSEG
diff --git a/arch/x86_64/boot/tools/build.c b/arch/x86_64/boot/tools/build.c
index 18b5bac1c428..c44f5e2ec100 100644
--- a/arch/x86_64/boot/tools/build.c
+++ b/arch/x86_64/boot/tools/build.c
@@ -178,7 +178,9 @@ int main(int argc, char ** argv)
178 die("Output: seek failed"); 178 die("Output: seek failed");
179 buf[0] = (sys_size & 0xff); 179 buf[0] = (sys_size & 0xff);
180 buf[1] = ((sys_size >> 8) & 0xff); 180 buf[1] = ((sys_size >> 8) & 0xff);
181 if (write(1, buf, 2) != 2) 181 buf[2] = ((sys_size >> 16) & 0xff);
182 buf[3] = ((sys_size >> 24) & 0xff);
183 if (write(1, buf, 4) != 4)
182 die("Write of image length failed"); 184 die("Write of image length failed");
183 185
184 return 0; /* Everything is OK */ 186 return 0; /* Everything is OK */
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index b97a61e1c71c..bf57e2362bf4 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -135,8 +135,6 @@ CONFIG_PM_STD_PARTITION=""
135# ACPI (Advanced Configuration and Power Interface) Support 135# ACPI (Advanced Configuration and Power Interface) Support
136# 136#
137CONFIG_ACPI=y 137CONFIG_ACPI=y
138CONFIG_ACPI_BOOT=y
139CONFIG_ACPI_INTERPRETER=y
140CONFIG_ACPI_AC=y 138CONFIG_ACPI_AC=y
141CONFIG_ACPI_BATTERY=y 139CONFIG_ACPI_BATTERY=y
142CONFIG_ACPI_BUTTON=y 140CONFIG_ACPI_BUTTON=y
@@ -151,10 +149,8 @@ CONFIG_ACPI_NUMA=y
151CONFIG_ACPI_TOSHIBA=y 149CONFIG_ACPI_TOSHIBA=y
152CONFIG_ACPI_BLACKLIST_YEAR=2001 150CONFIG_ACPI_BLACKLIST_YEAR=2001
153# CONFIG_ACPI_DEBUG is not set 151# CONFIG_ACPI_DEBUG is not set
154CONFIG_ACPI_BUS=y
155CONFIG_ACPI_EC=y 152CONFIG_ACPI_EC=y
156CONFIG_ACPI_POWER=y 153CONFIG_ACPI_POWER=y
157CONFIG_ACPI_PCI=y
158CONFIG_ACPI_SYSTEM=y 154CONFIG_ACPI_SYSTEM=y
159# CONFIG_ACPI_CONTAINER is not set 155# CONFIG_ACPI_CONTAINER is not set
160 156
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index c45d6a05b984..f174083d5567 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -307,7 +307,7 @@ ia32_sys_call_table:
307 .quad stub32_fork 307 .quad stub32_fork
308 .quad sys_read 308 .quad sys_read
309 .quad sys_write 309 .quad sys_write
310 .quad sys32_open /* 5 */ 310 .quad compat_sys_open /* 5 */
311 .quad sys_close 311 .quad sys_close
312 .quad sys32_waitpid 312 .quad sys32_waitpid
313 .quad sys_creat 313 .quad sys_creat
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index be996d1b691e..04d80406ce4f 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -969,32 +969,6 @@ long sys32_kill(int pid, int sig)
969 return sys_kill(pid, sig); 969 return sys_kill(pid, sig);
970} 970}
971 971
972asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
973{
974 char * tmp;
975 int fd, error;
976
977 /* don't force O_LARGEFILE */
978 tmp = getname(filename);
979 fd = PTR_ERR(tmp);
980 if (!IS_ERR(tmp)) {
981 fd = get_unused_fd();
982 if (fd >= 0) {
983 struct file *f = filp_open(tmp, flags, mode);
984 error = PTR_ERR(f);
985 if (IS_ERR(f)) {
986 put_unused_fd(fd);
987 fd = error;
988 } else {
989 fsnotify_open(f->f_dentry);
990 fd_install(fd, f);
991 }
992 }
993 putname(tmp);
994 }
995 return fd;
996}
997
998extern asmlinkage long 972extern asmlinkage long
999sys_timer_create(clockid_t which_clock, 973sys_timer_create(clockid_t which_clock,
1000 struct sigevent __user *timer_event_spec, 974 struct sigevent __user *timer_event_spec,
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index c32e198d7b2b..1579bdd0adcd 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -12,7 +12,7 @@ obj-y := process.o signal.o entry.o traps.o irq.o \
12obj-$(CONFIG_X86_MCE) += mce.o 12obj-$(CONFIG_X86_MCE) += mce.o
13obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o 13obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o
14obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/ 14obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/
15obj-$(CONFIG_ACPI_BOOT) += acpi/ 15obj-$(CONFIG_ACPI) += acpi/
16obj-$(CONFIG_X86_MSR) += msr.o 16obj-$(CONFIG_X86_MSR) += msr.o
17obj-$(CONFIG_MICROCODE) += microcode.o 17obj-$(CONFIG_MICROCODE) += microcode.o
18obj-$(CONFIG_X86_CPUID) += cpuid.o 18obj-$(CONFIG_X86_CPUID) += cpuid.o
diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile
index d2c2ee5f9a88..7da9ace890bd 100644
--- a/arch/x86_64/kernel/acpi/Makefile
+++ b/arch/x86_64/kernel/acpi/Makefile
@@ -1,3 +1,3 @@
1obj-$(CONFIG_ACPI_BOOT) := boot.o 1obj-y := boot.o
2boot-$(CONFIG_ACPI_BOOT) := ../../../i386/kernel/acpi/boot.o 2boot-y := ../../../i386/kernel/acpi/boot.o
3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o 3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c
index 7a275de6df22..148f6f7ea315 100644
--- a/arch/x86_64/kernel/acpi/sleep.c
+++ b/arch/x86_64/kernel/acpi/sleep.c
@@ -47,7 +47,6 @@
47#include <asm/proto.h> 47#include <asm/proto.h>
48#include <asm/tlbflush.h> 48#include <asm/tlbflush.h>
49 49
50
51/* -------------------------------------------------------------------------- 50/* --------------------------------------------------------------------------
52 Low-Level Sleep Support 51 Low-Level Sleep Support
53 -------------------------------------------------------------------------- */ 52 -------------------------------------------------------------------------- */
@@ -77,11 +76,12 @@ static void init_low_mapping(void)
77 * Create an identity mapped page table and copy the wakeup routine to 76 * Create an identity mapped page table and copy the wakeup routine to
78 * low memory. 77 * low memory.
79 */ 78 */
80int acpi_save_state_mem (void) 79int acpi_save_state_mem(void)
81{ 80{
82 init_low_mapping(); 81 init_low_mapping();
83 82
84 memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start); 83 memcpy((void *)acpi_wakeup_address, &wakeup_start,
84 &wakeup_end - &wakeup_start);
85 acpi_copy_wakeup_routine(acpi_wakeup_address); 85 acpi_copy_wakeup_routine(acpi_wakeup_address);
86 86
87 return 0; 87 return 0;
@@ -90,7 +90,7 @@ int acpi_save_state_mem (void)
90/* 90/*
91 * acpi_restore_state 91 * acpi_restore_state
92 */ 92 */
93void acpi_restore_state_mem (void) 93void acpi_restore_state_mem(void)
94{ 94{
95 set_pgd(pgd_offset(current->mm, 0UL), low_ptr); 95 set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
96 flush_tlb_all(); 96 flush_tlb_all();
@@ -108,7 +108,8 @@ void __init acpi_reserve_bootmem(void)
108{ 108{
109 acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE); 109 acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
110 if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) 110 if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
111 printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n"); 111 printk(KERN_CRIT
112 "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
112} 113}
113 114
114static int __init acpi_sleep_setup(char *str) 115static int __init acpi_sleep_setup(char *str)
@@ -127,6 +128,8 @@ static int __init acpi_sleep_setup(char *str)
127 128
128__setup("acpi_sleep=", acpi_sleep_setup); 129__setup("acpi_sleep=", acpi_sleep_setup);
129 130
130#endif /*CONFIG_ACPI_SLEEP*/ 131#endif /*CONFIG_ACPI_SLEEP */
131 132
132void acpi_pci_link_exit(void) {} 133void acpi_pci_link_exit(void)
134{
135}
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index b548dea4e5b9..116ac5f53dce 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -85,7 +85,7 @@ int __init e820_mapped(unsigned long start, unsigned long end, unsigned type)
85 struct e820entry *ei = &e820.map[i]; 85 struct e820entry *ei = &e820.map[i];
86 if (type && ei->type != type) 86 if (type && ei->type != type)
87 continue; 87 continue;
88 if (ei->addr >= end || ei->addr + ei->size < start) 88 if (ei->addr >= end || ei->addr + ei->size <= start)
89 continue; 89 continue;
90 return 1; 90 return 1;
91 } 91 }
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 096d470e280f..be51dbe1f75e 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -784,8 +784,9 @@ ENTRY(execve)
784 ret 784 ret
785 CFI_ENDPROC 785 CFI_ENDPROC
786 786
787ENTRY(page_fault) 787KPROBE_ENTRY(page_fault)
788 errorentry do_page_fault 788 errorentry do_page_fault
789 .previous .text
789 790
790ENTRY(coprocessor_error) 791ENTRY(coprocessor_error)
791 zeroentry do_coprocessor_error 792 zeroentry do_coprocessor_error
@@ -797,13 +798,14 @@ ENTRY(device_not_available)
797 zeroentry math_state_restore 798 zeroentry math_state_restore
798 799
799 /* runs on exception stack */ 800 /* runs on exception stack */
800ENTRY(debug) 801KPROBE_ENTRY(debug)
801 CFI_STARTPROC 802 CFI_STARTPROC
802 pushq $0 803 pushq $0
803 CFI_ADJUST_CFA_OFFSET 8 804 CFI_ADJUST_CFA_OFFSET 8
804 paranoidentry do_debug 805 paranoidentry do_debug
805 jmp paranoid_exit 806 jmp paranoid_exit
806 CFI_ENDPROC 807 CFI_ENDPROC
808 .previous .text
807 809
808 /* runs on exception stack */ 810 /* runs on exception stack */
809ENTRY(nmi) 811ENTRY(nmi)
@@ -854,8 +856,9 @@ paranoid_schedule:
854 jmp paranoid_userspace 856 jmp paranoid_userspace
855 CFI_ENDPROC 857 CFI_ENDPROC
856 858
857ENTRY(int3) 859KPROBE_ENTRY(int3)
858 zeroentry do_int3 860 zeroentry do_int3
861 .previous .text
859 862
860ENTRY(overflow) 863ENTRY(overflow)
861 zeroentry do_overflow 864 zeroentry do_overflow
@@ -892,8 +895,9 @@ ENTRY(stack_segment)
892 jmp paranoid_exit 895 jmp paranoid_exit
893 CFI_ENDPROC 896 CFI_ENDPROC
894 897
895ENTRY(general_protection) 898KPROBE_ENTRY(general_protection)
896 errorentry do_general_protection 899 errorentry do_general_protection
900 .previous .text
897 901
898ENTRY(alignment_check) 902ENTRY(alignment_check)
899 errorentry do_alignment_check 903 errorentry do_alignment_check
diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c
index 30c843a5efdd..b1c144f73149 100644
--- a/arch/x86_64/kernel/genapic.c
+++ b/arch/x86_64/kernel/genapic.c
@@ -20,12 +20,12 @@
20#include <asm/smp.h> 20#include <asm/smp.h>
21#include <asm/ipi.h> 21#include <asm/ipi.h>
22 22
23#if defined(CONFIG_ACPI_BUS) 23#if defined(CONFIG_ACPI)
24#include <acpi/acpi_bus.h> 24#include <acpi/acpi_bus.h>
25#endif 25#endif
26 26
27/* which logical CPU number maps to which CPU (physical APIC ID) */ 27/* which logical CPU number maps to which CPU (physical APIC ID) */
28u8 x86_cpu_to_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 28u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
29EXPORT_SYMBOL(x86_cpu_to_apicid); 29EXPORT_SYMBOL(x86_cpu_to_apicid);
30u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 30u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
31 31
@@ -47,7 +47,7 @@ void __init clustered_apic_check(void)
47 u8 cluster_cnt[NUM_APIC_CLUSTERS]; 47 u8 cluster_cnt[NUM_APIC_CLUSTERS];
48 int num_cpus = 0; 48 int num_cpus = 0;
49 49
50#if defined(CONFIG_ACPI_BUS) 50#if defined(CONFIG_ACPI)
51 /* 51 /*
52 * Some x86_64 machines use physical APIC mode regardless of how many 52 * Some x86_64 machines use physical APIC mode regardless of how many
53 * procs/clusters are present (x86_64 ES7000 is an example). 53 * procs/clusters are present (x86_64 ES7000 is an example).
diff --git a/arch/x86_64/kernel/genapic_cluster.c b/arch/x86_64/kernel/genapic_cluster.c
index 9703da7202e3..f6523dd1bc09 100644
--- a/arch/x86_64/kernel/genapic_cluster.c
+++ b/arch/x86_64/kernel/genapic_cluster.c
@@ -72,10 +72,14 @@ static void cluster_send_IPI_mask(cpumask_t mask, int vector)
72static void cluster_send_IPI_allbutself(int vector) 72static void cluster_send_IPI_allbutself(int vector)
73{ 73{
74 cpumask_t mask = cpu_online_map; 74 cpumask_t mask = cpu_online_map;
75 cpu_clear(smp_processor_id(), mask); 75 int me = get_cpu(); /* Ensure we are not preempted when we clear */
76
77 cpu_clear(me, mask);
76 78
77 if (!cpus_empty(mask)) 79 if (!cpus_empty(mask))
78 cluster_send_IPI_mask(mask, vector); 80 cluster_send_IPI_mask(mask, vector);
81
82 put_cpu();
79} 83}
80 84
81static void cluster_send_IPI_all(int vector) 85static void cluster_send_IPI_all(int vector)
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index d206d7e49cf5..40e0aca088fb 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -70,7 +70,7 @@ static struct irq_pin_list {
70 short apic, pin, next; 70 short apic, pin, next;
71} irq_2_pin[PIN_MAP_SIZE]; 71} irq_2_pin[PIN_MAP_SIZE];
72 72
73int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; 73int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1};
74#ifdef CONFIG_PCI_MSI 74#ifdef CONFIG_PCI_MSI
75#define vector_to_irq(vector) \ 75#define vector_to_irq(vector) \
76 (platform_legacy_irq(vector) ? vector : vector_irq[vector]) 76 (platform_legacy_irq(vector) ? vector : vector_irq[vector])
@@ -78,6 +78,54 @@ int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1};
78#define vector_to_irq(vector) (vector) 78#define vector_to_irq(vector) (vector)
79#endif 79#endif
80 80
81#define __DO_ACTION(R, ACTION, FINAL) \
82 \
83{ \
84 int pin; \
85 struct irq_pin_list *entry = irq_2_pin + irq; \
86 \
87 for (;;) { \
88 unsigned int reg; \
89 pin = entry->pin; \
90 if (pin == -1) \
91 break; \
92 reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \
93 reg ACTION; \
94 io_apic_modify(entry->apic, reg); \
95 if (!entry->next) \
96 break; \
97 entry = irq_2_pin + entry->next; \
98 } \
99 FINAL; \
100}
101
102#ifdef CONFIG_SMP
103static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
104{
105 unsigned long flags;
106 unsigned int dest;
107 cpumask_t tmp;
108
109 cpus_and(tmp, mask, cpu_online_map);
110 if (cpus_empty(tmp))
111 tmp = TARGET_CPUS;
112
113 cpus_and(mask, tmp, CPU_MASK_ALL);
114
115 dest = cpu_mask_to_apicid(mask);
116
117 /*
118 * Only the high 8 bits are valid.
119 */
120 dest = SET_APIC_LOGICAL_ID(dest);
121
122 spin_lock_irqsave(&ioapic_lock, flags);
123 __DO_ACTION(1, = dest, )
124 set_irq_info(irq, mask);
125 spin_unlock_irqrestore(&ioapic_lock, flags);
126}
127#endif
128
81/* 129/*
82 * The common case is 1:1 IRQ<->pin mappings. Sometimes there are 130 * The common case is 1:1 IRQ<->pin mappings. Sometimes there are
83 * shared ISA-space IRQs, so we have to support them. We are super 131 * shared ISA-space IRQs, so we have to support them. We are super
@@ -101,26 +149,6 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)
101 entry->pin = pin; 149 entry->pin = pin;
102} 150}
103 151
104#define __DO_ACTION(R, ACTION, FINAL) \
105 \
106{ \
107 int pin; \
108 struct irq_pin_list *entry = irq_2_pin + irq; \
109 \
110 for (;;) { \
111 unsigned int reg; \
112 pin = entry->pin; \
113 if (pin == -1) \
114 break; \
115 reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \
116 reg ACTION; \
117 io_apic_modify(entry->apic, reg); \
118 if (!entry->next) \
119 break; \
120 entry = irq_2_pin + entry->next; \
121 } \
122 FINAL; \
123}
124 152
125#define DO_ACTION(name,R,ACTION, FINAL) \ 153#define DO_ACTION(name,R,ACTION, FINAL) \
126 \ 154 \
@@ -655,7 +683,7 @@ static inline int IO_APIC_irq_trigger(int irq)
655} 683}
656 684
657/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ 685/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
658u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 }; 686u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
659 687
660int assign_irq_vector(int irq) 688int assign_irq_vector(int irq)
661{ 689{
@@ -767,6 +795,7 @@ static void __init setup_IO_APIC_irqs(void)
767 spin_lock_irqsave(&ioapic_lock, flags); 795 spin_lock_irqsave(&ioapic_lock, flags);
768 io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1)); 796 io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1));
769 io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0)); 797 io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0));
798 set_native_irq_info(irq, TARGET_CPUS);
770 spin_unlock_irqrestore(&ioapic_lock, flags); 799 spin_unlock_irqrestore(&ioapic_lock, flags);
771 } 800 }
772 } 801 }
@@ -1314,6 +1343,7 @@ static unsigned int startup_edge_ioapic_irq(unsigned int irq)
1314 */ 1343 */
1315static void ack_edge_ioapic_irq(unsigned int irq) 1344static void ack_edge_ioapic_irq(unsigned int irq)
1316{ 1345{
1346 move_irq(irq);
1317 if ((irq_desc[irq].status & (IRQ_PENDING | IRQ_DISABLED)) 1347 if ((irq_desc[irq].status & (IRQ_PENDING | IRQ_DISABLED))
1318 == (IRQ_PENDING | IRQ_DISABLED)) 1348 == (IRQ_PENDING | IRQ_DISABLED))
1319 mask_IO_APIC_irq(irq); 1349 mask_IO_APIC_irq(irq);
@@ -1343,26 +1373,10 @@ static unsigned int startup_level_ioapic_irq (unsigned int irq)
1343 1373
1344static void end_level_ioapic_irq (unsigned int irq) 1374static void end_level_ioapic_irq (unsigned int irq)
1345{ 1375{
1376 move_irq(irq);
1346 ack_APIC_irq(); 1377 ack_APIC_irq();
1347} 1378}
1348 1379
1349static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
1350{
1351 unsigned long flags;
1352 unsigned int dest;
1353
1354 dest = cpu_mask_to_apicid(mask);
1355
1356 /*
1357 * Only the high 8 bits are valid.
1358 */
1359 dest = SET_APIC_LOGICAL_ID(dest);
1360
1361 spin_lock_irqsave(&ioapic_lock, flags);
1362 __DO_ACTION(1, = dest, )
1363 spin_unlock_irqrestore(&ioapic_lock, flags);
1364}
1365
1366#ifdef CONFIG_PCI_MSI 1380#ifdef CONFIG_PCI_MSI
1367static unsigned int startup_edge_ioapic_vector(unsigned int vector) 1381static unsigned int startup_edge_ioapic_vector(unsigned int vector)
1368{ 1382{
@@ -1375,6 +1389,7 @@ static void ack_edge_ioapic_vector(unsigned int vector)
1375{ 1389{
1376 int irq = vector_to_irq(vector); 1390 int irq = vector_to_irq(vector);
1377 1391
1392 move_native_irq(vector);
1378 ack_edge_ioapic_irq(irq); 1393 ack_edge_ioapic_irq(irq);
1379} 1394}
1380 1395
@@ -1389,6 +1404,7 @@ static void end_level_ioapic_vector (unsigned int vector)
1389{ 1404{
1390 int irq = vector_to_irq(vector); 1405 int irq = vector_to_irq(vector);
1391 1406
1407 move_native_irq(vector);
1392 end_level_ioapic_irq(irq); 1408 end_level_ioapic_irq(irq);
1393} 1409}
1394 1410
@@ -1406,14 +1422,17 @@ static void unmask_IO_APIC_vector (unsigned int vector)
1406 unmask_IO_APIC_irq(irq); 1422 unmask_IO_APIC_irq(irq);
1407} 1423}
1408 1424
1425#ifdef CONFIG_SMP
1409static void set_ioapic_affinity_vector (unsigned int vector, 1426static void set_ioapic_affinity_vector (unsigned int vector,
1410 cpumask_t cpu_mask) 1427 cpumask_t cpu_mask)
1411{ 1428{
1412 int irq = vector_to_irq(vector); 1429 int irq = vector_to_irq(vector);
1413 1430
1431 set_native_irq_info(vector, cpu_mask);
1414 set_ioapic_affinity_irq(irq, cpu_mask); 1432 set_ioapic_affinity_irq(irq, cpu_mask);
1415} 1433}
1416#endif 1434#endif // CONFIG_SMP
1435#endif // CONFIG_PCI_MSI
1417 1436
1418/* 1437/*
1419 * Level and edge triggered IO-APIC interrupts need different handling, 1438 * Level and edge triggered IO-APIC interrupts need different handling,
@@ -1424,7 +1443,7 @@ static void set_ioapic_affinity_vector (unsigned int vector,
1424 * races. 1443 * races.
1425 */ 1444 */
1426 1445
1427static struct hw_interrupt_type ioapic_edge_type = { 1446static struct hw_interrupt_type ioapic_edge_type __read_mostly = {
1428 .typename = "IO-APIC-edge", 1447 .typename = "IO-APIC-edge",
1429 .startup = startup_edge_ioapic, 1448 .startup = startup_edge_ioapic,
1430 .shutdown = shutdown_edge_ioapic, 1449 .shutdown = shutdown_edge_ioapic,
@@ -1432,10 +1451,12 @@ static struct hw_interrupt_type ioapic_edge_type = {
1432 .disable = disable_edge_ioapic, 1451 .disable = disable_edge_ioapic,
1433 .ack = ack_edge_ioapic, 1452 .ack = ack_edge_ioapic,
1434 .end = end_edge_ioapic, 1453 .end = end_edge_ioapic,
1454#ifdef CONFIG_SMP
1435 .set_affinity = set_ioapic_affinity, 1455 .set_affinity = set_ioapic_affinity,
1456#endif
1436}; 1457};
1437 1458
1438static struct hw_interrupt_type ioapic_level_type = { 1459static struct hw_interrupt_type ioapic_level_type __read_mostly = {
1439 .typename = "IO-APIC-level", 1460 .typename = "IO-APIC-level",
1440 .startup = startup_level_ioapic, 1461 .startup = startup_level_ioapic,
1441 .shutdown = shutdown_level_ioapic, 1462 .shutdown = shutdown_level_ioapic,
@@ -1443,7 +1464,9 @@ static struct hw_interrupt_type ioapic_level_type = {
1443 .disable = disable_level_ioapic, 1464 .disable = disable_level_ioapic,
1444 .ack = mask_and_ack_level_ioapic, 1465 .ack = mask_and_ack_level_ioapic,
1445 .end = end_level_ioapic, 1466 .end = end_level_ioapic,
1467#ifdef CONFIG_SMP
1446 .set_affinity = set_ioapic_affinity, 1468 .set_affinity = set_ioapic_affinity,
1469#endif
1447}; 1470};
1448 1471
1449static inline void init_IO_APIC_traps(void) 1472static inline void init_IO_APIC_traps(void)
@@ -1506,7 +1529,7 @@ static void ack_lapic_irq (unsigned int irq)
1506 1529
1507static void end_lapic_irq (unsigned int i) { /* nothing */ } 1530static void end_lapic_irq (unsigned int i) { /* nothing */ }
1508 1531
1509static struct hw_interrupt_type lapic_irq_type = { 1532static struct hw_interrupt_type lapic_irq_type __read_mostly = {
1510 .typename = "local-APIC-edge", 1533 .typename = "local-APIC-edge",
1511 .startup = NULL, /* startup_irq() not used for IRQ0 */ 1534 .startup = NULL, /* startup_irq() not used for IRQ0 */
1512 .shutdown = NULL, /* shutdown_irq() not used for IRQ0 */ 1535 .shutdown = NULL, /* shutdown_irq() not used for IRQ0 */
@@ -1841,7 +1864,7 @@ device_initcall(ioapic_init_sysfs);
1841 ACPI-based IOAPIC Configuration 1864 ACPI-based IOAPIC Configuration
1842 -------------------------------------------------------------------------- */ 1865 -------------------------------------------------------------------------- */
1843 1866
1844#ifdef CONFIG_ACPI_BOOT 1867#ifdef CONFIG_ACPI
1845 1868
1846#define IO_APIC_MAX_ID 0xFE 1869#define IO_APIC_MAX_ID 0xFE
1847 1870
@@ -1918,12 +1941,13 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
1918 spin_lock_irqsave(&ioapic_lock, flags); 1941 spin_lock_irqsave(&ioapic_lock, flags);
1919 io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1)); 1942 io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1));
1920 io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0)); 1943 io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0));
1944 set_native_irq_info(use_pci_vector() ? entry.vector : irq, TARGET_CPUS);
1921 spin_unlock_irqrestore(&ioapic_lock, flags); 1945 spin_unlock_irqrestore(&ioapic_lock, flags);
1922 1946
1923 return 0; 1947 return 0;
1924} 1948}
1925 1949
1926#endif /*CONFIG_ACPI_BOOT*/ 1950#endif /* CONFIG_ACPI */
1927 1951
1928 1952
1929/* 1953/*
@@ -1931,6 +1955,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
1931 * we need to reprogram the ioredtbls to cater for the cpus which have come online 1955 * we need to reprogram the ioredtbls to cater for the cpus which have come online
1932 * so mask in all cases should simply be TARGET_CPUS 1956 * so mask in all cases should simply be TARGET_CPUS
1933 */ 1957 */
1958#ifdef CONFIG_SMP
1934void __init setup_ioapic_dest(void) 1959void __init setup_ioapic_dest(void)
1935{ 1960{
1936 int pin, ioapic, irq, irq_entry; 1961 int pin, ioapic, irq, irq_entry;
@@ -1949,3 +1974,4 @@ void __init setup_ioapic_dest(void)
1949 1974
1950 } 1975 }
1951} 1976}
1977#endif
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c
index 5c6dc7051482..df08c43276a0 100644
--- a/arch/x86_64/kernel/kprobes.c
+++ b/arch/x86_64/kernel/kprobes.c
@@ -74,7 +74,7 @@ static inline int is_IF_modifier(kprobe_opcode_t *insn)
74 return 0; 74 return 0;
75} 75}
76 76
77int arch_prepare_kprobe(struct kprobe *p) 77int __kprobes arch_prepare_kprobe(struct kprobe *p)
78{ 78{
79 /* insn: must be on special executable page on x86_64. */ 79 /* insn: must be on special executable page on x86_64. */
80 up(&kprobe_mutex); 80 up(&kprobe_mutex);
@@ -189,7 +189,7 @@ static inline s32 *is_riprel(u8 *insn)
189 return NULL; 189 return NULL;
190} 190}
191 191
192void arch_copy_kprobe(struct kprobe *p) 192void __kprobes arch_copy_kprobe(struct kprobe *p)
193{ 193{
194 s32 *ripdisp; 194 s32 *ripdisp;
195 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE); 195 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE);
@@ -215,21 +215,21 @@ void arch_copy_kprobe(struct kprobe *p)
215 p->opcode = *p->addr; 215 p->opcode = *p->addr;
216} 216}
217 217
218void arch_arm_kprobe(struct kprobe *p) 218void __kprobes arch_arm_kprobe(struct kprobe *p)
219{ 219{
220 *p->addr = BREAKPOINT_INSTRUCTION; 220 *p->addr = BREAKPOINT_INSTRUCTION;
221 flush_icache_range((unsigned long) p->addr, 221 flush_icache_range((unsigned long) p->addr,
222 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 222 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
223} 223}
224 224
225void arch_disarm_kprobe(struct kprobe *p) 225void __kprobes arch_disarm_kprobe(struct kprobe *p)
226{ 226{
227 *p->addr = p->opcode; 227 *p->addr = p->opcode;
228 flush_icache_range((unsigned long) p->addr, 228 flush_icache_range((unsigned long) p->addr,
229 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 229 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
230} 230}
231 231
232void arch_remove_kprobe(struct kprobe *p) 232void __kprobes arch_remove_kprobe(struct kprobe *p)
233{ 233{
234 up(&kprobe_mutex); 234 up(&kprobe_mutex);
235 free_insn_slot(p->ainsn.insn); 235 free_insn_slot(p->ainsn.insn);
@@ -261,7 +261,7 @@ static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs)
261 kprobe_saved_rflags &= ~IF_MASK; 261 kprobe_saved_rflags &= ~IF_MASK;
262} 262}
263 263
264static void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 264static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
265{ 265{
266 regs->eflags |= TF_MASK; 266 regs->eflags |= TF_MASK;
267 regs->eflags &= ~IF_MASK; 267 regs->eflags &= ~IF_MASK;
@@ -272,7 +272,8 @@ static void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
272 regs->rip = (unsigned long)p->ainsn.insn; 272 regs->rip = (unsigned long)p->ainsn.insn;
273} 273}
274 274
275void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) 275void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
276 struct pt_regs *regs)
276{ 277{
277 unsigned long *sara = (unsigned long *)regs->rsp; 278 unsigned long *sara = (unsigned long *)regs->rsp;
278 struct kretprobe_instance *ri; 279 struct kretprobe_instance *ri;
@@ -295,7 +296,7 @@ void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs)
295 * Interrupts are disabled on entry as trap3 is an interrupt gate and they 296 * Interrupts are disabled on entry as trap3 is an interrupt gate and they
296 * remain disabled thorough out this function. 297 * remain disabled thorough out this function.
297 */ 298 */
298int kprobe_handler(struct pt_regs *regs) 299int __kprobes kprobe_handler(struct pt_regs *regs)
299{ 300{
300 struct kprobe *p; 301 struct kprobe *p;
301 int ret = 0; 302 int ret = 0;
@@ -310,7 +311,8 @@ int kprobe_handler(struct pt_regs *regs)
310 Disarm the probe we just hit, and ignore it. */ 311 Disarm the probe we just hit, and ignore it. */
311 p = get_kprobe(addr); 312 p = get_kprobe(addr);
312 if (p) { 313 if (p) {
313 if (kprobe_status == KPROBE_HIT_SS) { 314 if (kprobe_status == KPROBE_HIT_SS &&
315 *p->ainsn.insn == BREAKPOINT_INSTRUCTION) {
314 regs->eflags &= ~TF_MASK; 316 regs->eflags &= ~TF_MASK;
315 regs->eflags |= kprobe_saved_rflags; 317 regs->eflags |= kprobe_saved_rflags;
316 unlock_kprobes(); 318 unlock_kprobes();
@@ -360,7 +362,10 @@ int kprobe_handler(struct pt_regs *regs)
360 * either a probepoint or a debugger breakpoint 362 * either a probepoint or a debugger breakpoint
361 * at this address. In either case, no further 363 * at this address. In either case, no further
362 * handling of this interrupt is appropriate. 364 * handling of this interrupt is appropriate.
365 * Back up over the (now missing) int3 and run
366 * the original instruction.
363 */ 367 */
368 regs->rip = (unsigned long)addr;
364 ret = 1; 369 ret = 1;
365 } 370 }
366 /* Not one of ours: let kernel handle it */ 371 /* Not one of ours: let kernel handle it */
@@ -399,7 +404,7 @@ no_kprobe:
399/* 404/*
400 * Called when we hit the probe point at kretprobe_trampoline 405 * Called when we hit the probe point at kretprobe_trampoline
401 */ 406 */
402int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 407int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
403{ 408{
404 struct kretprobe_instance *ri = NULL; 409 struct kretprobe_instance *ri = NULL;
405 struct hlist_head *head; 410 struct hlist_head *head;
@@ -478,7 +483,7 @@ int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
478 * that is atop the stack is the address following the copied instruction. 483 * that is atop the stack is the address following the copied instruction.
479 * We need to make it the address following the original instruction. 484 * We need to make it the address following the original instruction.
480 */ 485 */
481static void resume_execution(struct kprobe *p, struct pt_regs *regs) 486static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
482{ 487{
483 unsigned long *tos = (unsigned long *)regs->rsp; 488 unsigned long *tos = (unsigned long *)regs->rsp;
484 unsigned long next_rip = 0; 489 unsigned long next_rip = 0;
@@ -536,7 +541,7 @@ static void resume_execution(struct kprobe *p, struct pt_regs *regs)
536 * Interrupts are disabled on entry as trap1 is an interrupt gate and they 541 * Interrupts are disabled on entry as trap1 is an interrupt gate and they
537 * remain disabled thoroughout this function. And we hold kprobe lock. 542 * remain disabled thoroughout this function. And we hold kprobe lock.
538 */ 543 */
539int post_kprobe_handler(struct pt_regs *regs) 544int __kprobes post_kprobe_handler(struct pt_regs *regs)
540{ 545{
541 if (!kprobe_running()) 546 if (!kprobe_running())
542 return 0; 547 return 0;
@@ -571,7 +576,7 @@ out:
571} 576}
572 577
573/* Interrupts disabled, kprobe_lock held. */ 578/* Interrupts disabled, kprobe_lock held. */
574int kprobe_fault_handler(struct pt_regs *regs, int trapnr) 579int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
575{ 580{
576 if (current_kprobe->fault_handler 581 if (current_kprobe->fault_handler
577 && current_kprobe->fault_handler(current_kprobe, regs, trapnr)) 582 && current_kprobe->fault_handler(current_kprobe, regs, trapnr))
@@ -590,8 +595,8 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
590/* 595/*
591 * Wrapper routine for handling exceptions. 596 * Wrapper routine for handling exceptions.
592 */ 597 */
593int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, 598int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
594 void *data) 599 unsigned long val, void *data)
595{ 600{
596 struct die_args *args = (struct die_args *)data; 601 struct die_args *args = (struct die_args *)data;
597 switch (val) { 602 switch (val) {
@@ -619,7 +624,7 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
619 return NOTIFY_DONE; 624 return NOTIFY_DONE;
620} 625}
621 626
622int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 627int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
623{ 628{
624 struct jprobe *jp = container_of(p, struct jprobe, kp); 629 struct jprobe *jp = container_of(p, struct jprobe, kp);
625 unsigned long addr; 630 unsigned long addr;
@@ -640,7 +645,7 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
640 return 1; 645 return 1;
641} 646}
642 647
643void jprobe_return(void) 648void __kprobes jprobe_return(void)
644{ 649{
645 preempt_enable_no_resched(); 650 preempt_enable_no_resched();
646 asm volatile (" xchg %%rbx,%%rsp \n" 651 asm volatile (" xchg %%rbx,%%rsp \n"
@@ -651,7 +656,7 @@ void jprobe_return(void)
651 (jprobe_saved_rsp):"memory"); 656 (jprobe_saved_rsp):"memory");
652} 657}
653 658
654int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 659int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
655{ 660{
656 u8 *addr = (u8 *) (regs->rip - 1); 661 u8 *addr = (u8 *) (regs->rip - 1);
657 unsigned long stack_addr = (unsigned long)jprobe_saved_rsp; 662 unsigned long stack_addr = (unsigned long)jprobe_saved_rsp;
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 79c362d03e2e..8d8ed6ae1d0c 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -74,7 +74,7 @@ static unsigned int num_processors = 0;
74physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE; 74physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
75 75
76/* ACPI MADT entry parsing functions */ 76/* ACPI MADT entry parsing functions */
77#ifdef CONFIG_ACPI_BOOT 77#ifdef CONFIG_ACPI
78extern struct acpi_boot_flags acpi_boot; 78extern struct acpi_boot_flags acpi_boot;
79#ifdef CONFIG_X86_LOCAL_APIC 79#ifdef CONFIG_X86_LOCAL_APIC
80extern int acpi_parse_lapic (acpi_table_entry_header *header); 80extern int acpi_parse_lapic (acpi_table_entry_header *header);
@@ -84,7 +84,7 @@ extern int acpi_parse_lapic_nmi (acpi_table_entry_header *header);
84#ifdef CONFIG_X86_IO_APIC 84#ifdef CONFIG_X86_IO_APIC
85extern int acpi_parse_ioapic (acpi_table_entry_header *header); 85extern int acpi_parse_ioapic (acpi_table_entry_header *header);
86#endif /*CONFIG_X86_IO_APIC*/ 86#endif /*CONFIG_X86_IO_APIC*/
87#endif /*CONFIG_ACPI_BOOT*/ 87#endif /*CONFIG_ACPI*/
88 88
89u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 89u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
90 90
@@ -519,8 +519,6 @@ void __init get_smp_config (void)
519 struct intel_mp_floating *mpf = mpf_found; 519 struct intel_mp_floating *mpf = mpf_found;
520 520
521 /* 521 /*
522 * ACPI may be used to obtain the entire SMP configuration or just to
523 * enumerate/configure processors (CONFIG_ACPI_BOOT). Note that
524 * ACPI supports both logical (e.g. Hyper-Threading) and physical 522 * ACPI supports both logical (e.g. Hyper-Threading) and physical
525 * processors, where MPS only supports physical. 523 * processors, where MPS only supports physical.
526 */ 524 */
@@ -673,7 +671,7 @@ void __init find_smp_config (void)
673 ACPI-based MP Configuration 671 ACPI-based MP Configuration
674 -------------------------------------------------------------------------- */ 672 -------------------------------------------------------------------------- */
675 673
676#ifdef CONFIG_ACPI_BOOT 674#ifdef CONFIG_ACPI
677 675
678void __init mp_register_lapic_address ( 676void __init mp_register_lapic_address (
679 u64 address) 677 u64 address)
@@ -929,11 +927,9 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
929 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) 927 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
930 return gsi; 928 return gsi;
931 929
932#ifdef CONFIG_ACPI_BUS
933 /* Don't set up the ACPI SCI because it's already set up */ 930 /* Don't set up the ACPI SCI because it's already set up */
934 if (acpi_fadt.sci_int == gsi) 931 if (acpi_fadt.sci_int == gsi)
935 return gsi; 932 return gsi;
936#endif
937 933
938 ioapic = mp_find_ioapic(gsi); 934 ioapic = mp_find_ioapic(gsi);
939 if (ioapic < 0) { 935 if (ioapic < 0) {
@@ -973,13 +969,11 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
973 if (gsi < MAX_GSI_NUM) { 969 if (gsi < MAX_GSI_NUM) {
974 if (gsi > 15) 970 if (gsi > 15)
975 gsi = pci_irq++; 971 gsi = pci_irq++;
976#ifdef CONFIG_ACPI_BUS
977 /* 972 /*
978 * Don't assign IRQ used by ACPI SCI 973 * Don't assign IRQ used by ACPI SCI
979 */ 974 */
980 if (gsi == acpi_fadt.sci_int) 975 if (gsi == acpi_fadt.sci_int)
981 gsi = pci_irq++; 976 gsi = pci_irq++;
982#endif
983 gsi_to_irq[irq] = gsi; 977 gsi_to_irq[irq] = gsi;
984 } else { 978 } else {
985 printk(KERN_ERR "GSI %u is too high\n", gsi); 979 printk(KERN_ERR "GSI %u is too high\n", gsi);
@@ -994,4 +988,4 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
994} 988}
995 989
996#endif /*CONFIG_X86_IO_APIC*/ 990#endif /*CONFIG_X86_IO_APIC*/
997#endif /*CONFIG_ACPI_BOOT*/ 991#endif /*CONFIG_ACPI*/
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 64a8e05d5811..caf164959e19 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -463,6 +463,8 @@ void touch_nmi_watchdog (void)
463 */ 463 */
464 for (i = 0; i < NR_CPUS; i++) 464 for (i = 0; i < NR_CPUS; i++)
465 per_cpu(nmi_touch, i) = 1; 465 per_cpu(nmi_touch, i) = 1;
466
467 touch_softlockup_watchdog();
466} 468}
467 469
468void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason) 470void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason)
@@ -522,14 +524,14 @@ asmlinkage void do_nmi(struct pt_regs * regs, long error_code)
522 524
523 nmi_enter(); 525 nmi_enter();
524 add_pda(__nmi_count,1); 526 add_pda(__nmi_count,1);
525 if (!nmi_callback(regs, cpu)) 527 if (!rcu_dereference(nmi_callback)(regs, cpu))
526 default_do_nmi(regs); 528 default_do_nmi(regs);
527 nmi_exit(); 529 nmi_exit();
528} 530}
529 531
530void set_nmi_callback(nmi_callback_t callback) 532void set_nmi_callback(nmi_callback_t callback)
531{ 533{
532 nmi_callback = callback; 534 rcu_assign_pointer(nmi_callback, callback);
533} 535}
534 536
535void unset_nmi_callback(void) 537void unset_nmi_callback(void)
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 7577f9d7a75d..8661f82ac70b 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -310,6 +310,7 @@ void __show_regs(struct pt_regs * regs)
310 310
311void show_regs(struct pt_regs *regs) 311void show_regs(struct pt_regs *regs)
312{ 312{
313 printk("CPU %d:", smp_processor_id());
313 __show_regs(regs); 314 __show_regs(regs);
314 show_trace(&regs->rsp); 315 show_trace(&regs->rsp);
315} 316}
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 116a491e2961..0511d8087910 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -65,13 +65,13 @@
65 * Machine setup.. 65 * Machine setup..
66 */ 66 */
67 67
68struct cpuinfo_x86 boot_cpu_data; 68struct cpuinfo_x86 boot_cpu_data __read_mostly;
69 69
70unsigned long mmu_cr4_features; 70unsigned long mmu_cr4_features;
71 71
72int acpi_disabled; 72int acpi_disabled;
73EXPORT_SYMBOL(acpi_disabled); 73EXPORT_SYMBOL(acpi_disabled);
74#ifdef CONFIG_ACPI_BOOT 74#ifdef CONFIG_ACPI
75extern int __initdata acpi_ht; 75extern int __initdata acpi_ht;
76extern acpi_interrupt_flags acpi_sci_flags; 76extern acpi_interrupt_flags acpi_sci_flags;
77int __initdata acpi_force = 0; 77int __initdata acpi_force = 0;
@@ -294,7 +294,7 @@ static __init void parse_cmdline_early (char ** cmdline_p)
294 maxcpus = simple_strtoul(from + 8, NULL, 0); 294 maxcpus = simple_strtoul(from + 8, NULL, 0);
295 } 295 }
296#endif 296#endif
297#ifdef CONFIG_ACPI_BOOT 297#ifdef CONFIG_ACPI
298 /* "acpi=off" disables both ACPI table parsing and interpreter init */ 298 /* "acpi=off" disables both ACPI table parsing and interpreter init */
299 if (!memcmp(from, "acpi=off", 8)) 299 if (!memcmp(from, "acpi=off", 8))
300 disable_acpi(); 300 disable_acpi();
@@ -566,7 +566,7 @@ void __init setup_arch(char **cmdline_p)
566 566
567 init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT)); 567 init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT));
568 568
569#ifdef CONFIG_ACPI_BOOT 569#ifdef CONFIG_ACPI
570 /* 570 /*
571 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT). 571 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
572 * Call this early for SRAT node setup. 572 * Call this early for SRAT node setup.
@@ -658,7 +658,7 @@ void __init setup_arch(char **cmdline_p)
658 658
659 check_ioapic(); 659 check_ioapic();
660 660
661#ifdef CONFIG_ACPI_BOOT 661#ifdef CONFIG_ACPI
662 /* 662 /*
663 * Read APIC and some other early information from ACPI tables. 663 * Read APIC and some other early information from ACPI tables.
664 */ 664 */
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index 34082c1cc41e..e3ffcacc8c90 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -36,7 +36,7 @@ struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
36 36
37char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); 37char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
38 38
39unsigned long __supported_pte_mask = ~0UL; 39unsigned long __supported_pte_mask __read_mostly = ~0UL;
40static int do_not_nx __initdata = 0; 40static int do_not_nx __initdata = 0;
41 41
42/* noexec=on|off 42/* noexec=on|off
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index fa25e39fe54d..90aeccd15190 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -62,13 +62,13 @@
62/* Number of siblings per CPU package */ 62/* Number of siblings per CPU package */
63int smp_num_siblings = 1; 63int smp_num_siblings = 1;
64/* Package ID of each logical CPU */ 64/* Package ID of each logical CPU */
65u8 phys_proc_id[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 65u8 phys_proc_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
66u8 cpu_core_id[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 66u8 cpu_core_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
67EXPORT_SYMBOL(phys_proc_id); 67EXPORT_SYMBOL(phys_proc_id);
68EXPORT_SYMBOL(cpu_core_id); 68EXPORT_SYMBOL(cpu_core_id);
69 69
70/* Bitmask of currently online CPUs */ 70/* Bitmask of currently online CPUs */
71cpumask_t cpu_online_map; 71cpumask_t cpu_online_map __read_mostly;
72 72
73EXPORT_SYMBOL(cpu_online_map); 73EXPORT_SYMBOL(cpu_online_map);
74 74
@@ -88,8 +88,8 @@ struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
88/* Set when the idlers are all forked */ 88/* Set when the idlers are all forked */
89int smp_threads_ready; 89int smp_threads_ready;
90 90
91cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; 91cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;
92cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; 92cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
93EXPORT_SYMBOL(cpu_core_map); 93EXPORT_SYMBOL(cpu_core_map);
94 94
95/* 95/*
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 66bf6ddeb0c3..7b6abe058253 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -176,10 +176,7 @@ int do_settimeofday(struct timespec *tv)
176 set_normalized_timespec(&xtime, sec, nsec); 176 set_normalized_timespec(&xtime, sec, nsec);
177 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 177 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
178 178
179 time_adjust = 0; /* stop active adjtime() */ 179 ntp_clear();
180 time_status |= STA_UNSYNC;
181 time_maxerror = NTP_PHASE_LIMIT;
182 time_esterror = NTP_PHASE_LIMIT;
183 180
184 write_sequnlock_irq(&xtime_lock); 181 write_sequnlock_irq(&xtime_lock);
185 clock_was_set(); 182 clock_was_set();
@@ -471,7 +468,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
471 * off) isn't likely to go away much sooner anyway. 468 * off) isn't likely to go away much sooner anyway.
472 */ 469 */
473 470
474 if ((~time_status & STA_UNSYNC) && xtime.tv_sec > rtc_update && 471 if (ntp_synced() && xtime.tv_sec > rtc_update &&
475 abs(xtime.tv_nsec - 500000000) <= tick_nsec / 2) { 472 abs(xtime.tv_nsec - 500000000) <= tick_nsec / 2) {
476 set_rtc_mmss(xtime.tv_sec); 473 set_rtc_mmss(xtime.tv_sec);
477 rtc_update = xtime.tv_sec + 660; 474 rtc_update = xtime.tv_sec + 660;
@@ -1041,6 +1038,7 @@ static int timer_resume(struct sys_device *dev)
1041 write_sequnlock_irqrestore(&xtime_lock,flags); 1038 write_sequnlock_irqrestore(&xtime_lock,flags);
1042 jiffies += sleep_length; 1039 jiffies += sleep_length;
1043 wall_jiffies += sleep_length; 1040 wall_jiffies += sleep_length;
1041 touch_softlockup_watchdog();
1044 return 0; 1042 return 0;
1045} 1043}
1046 1044
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 6ead433a3885..f238d6078a5a 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -29,6 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/moduleparam.h> 30#include <linux/moduleparam.h>
31#include <linux/nmi.h> 31#include <linux/nmi.h>
32#include <linux/kprobes.h>
32 33
33#include <asm/system.h> 34#include <asm/system.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -419,8 +420,9 @@ void die_nmi(char *str, struct pt_regs *regs)
419 do_exit(SIGSEGV); 420 do_exit(SIGSEGV);
420} 421}
421 422
422static void do_trap(int trapnr, int signr, char *str, 423static void __kprobes do_trap(int trapnr, int signr, char *str,
423 struct pt_regs * regs, long error_code, siginfo_t *info) 424 struct pt_regs * regs, long error_code,
425 siginfo_t *info)
424{ 426{
425 conditional_sti(regs); 427 conditional_sti(regs);
426 428
@@ -504,7 +506,8 @@ DO_ERROR(18, SIGSEGV, "reserved", reserved)
504DO_ERROR(12, SIGBUS, "stack segment", stack_segment) 506DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
505DO_ERROR( 8, SIGSEGV, "double fault", double_fault) 507DO_ERROR( 8, SIGSEGV, "double fault", double_fault)
506 508
507asmlinkage void do_general_protection(struct pt_regs * regs, long error_code) 509asmlinkage void __kprobes do_general_protection(struct pt_regs * regs,
510 long error_code)
508{ 511{
509 conditional_sti(regs); 512 conditional_sti(regs);
510 513
@@ -622,7 +625,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
622 io_check_error(reason, regs); 625 io_check_error(reason, regs);
623} 626}
624 627
625asmlinkage void do_int3(struct pt_regs * regs, long error_code) 628asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code)
626{ 629{
627 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { 630 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) {
628 return; 631 return;
@@ -653,7 +656,8 @@ asmlinkage struct pt_regs *sync_regs(struct pt_regs *eregs)
653} 656}
654 657
655/* runs on IST stack. */ 658/* runs on IST stack. */
656asmlinkage void do_debug(struct pt_regs * regs, unsigned long error_code) 659asmlinkage void __kprobes do_debug(struct pt_regs * regs,
660 unsigned long error_code)
657{ 661{
658 unsigned long condition; 662 unsigned long condition;
659 struct task_struct *tsk = current; 663 struct task_struct *tsk = current;
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index 2a94f9b60b2d..d4abb07af52d 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -21,6 +21,7 @@ SECTIONS
21 *(.text) 21 *(.text)
22 SCHED_TEXT 22 SCHED_TEXT
23 LOCK_TEXT 23 LOCK_TEXT
24 KPROBES_TEXT
24 *(.fixup) 25 *(.fixup)
25 *(.gnu.warning) 26 *(.gnu.warning)
26 } = 0x9090 27 } = 0x9090
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index ca914c3bd49c..816732d8858c 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -23,6 +23,7 @@
23#include <linux/vt_kern.h> /* For unblank_screen() */ 23#include <linux/vt_kern.h> /* For unblank_screen() */
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kprobes.h>
26 27
27#include <asm/system.h> 28#include <asm/system.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
@@ -294,7 +295,8 @@ int exception_trace = 1;
294 * bit 2 == 0 means kernel, 1 means user-mode 295 * bit 2 == 0 means kernel, 1 means user-mode
295 * bit 3 == 1 means fault was an instruction fetch 296 * bit 3 == 1 means fault was an instruction fetch
296 */ 297 */
297asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code) 298asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
299 unsigned long error_code)
298{ 300{
299 struct task_struct *tsk; 301 struct task_struct *tsk;
300 struct mm_struct *mm; 302 struct mm_struct *mm;
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 6a156f5692ae..04f7a33e144c 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -22,14 +22,14 @@
22#define Dprintk(x...) 22#define Dprintk(x...)
23#endif 23#endif
24 24
25struct pglist_data *node_data[MAX_NUMNODES]; 25struct pglist_data *node_data[MAX_NUMNODES] __read_mostly;
26bootmem_data_t plat_node_bdata[MAX_NUMNODES]; 26bootmem_data_t plat_node_bdata[MAX_NUMNODES];
27 27
28int memnode_shift; 28int memnode_shift;
29u8 memnodemap[NODEMAPSIZE]; 29u8 memnodemap[NODEMAPSIZE];
30 30
31unsigned char cpu_to_node[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; 31unsigned char cpu_to_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = NUMA_NO_NODE };
32cpumask_t node_to_cpumask[MAX_NUMNODES]; 32cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly;
33 33
34int numa_off __initdata; 34int numa_off __initdata;
35 35
diff --git a/arch/x86_64/pci/Makefile b/arch/x86_64/pci/Makefile
index 37c92e841dec..bb34e5ef916c 100644
--- a/arch/x86_64/pci/Makefile
+++ b/arch/x86_64/pci/Makefile
@@ -8,7 +8,7 @@ CFLAGS += -Iarch/i386/pci
8obj-y := i386.o 8obj-y := i386.o
9obj-$(CONFIG_PCI_DIRECT)+= direct.o 9obj-$(CONFIG_PCI_DIRECT)+= direct.o
10obj-y += fixup.o 10obj-y += fixup.o
11obj-$(CONFIG_ACPI_PCI) += acpi.o 11obj-$(CONFIG_ACPI) += acpi.o
12obj-y += legacy.o irq.o common.o 12obj-y += legacy.o irq.o common.o
13# mmconfig has a 64bit special 13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o 14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
diff --git a/arch/x86_64/pci/Makefile-BUS b/arch/x86_64/pci/Makefile-BUS
index 291985f0d2e4..4f0c05abd408 100644
--- a/arch/x86_64/pci/Makefile-BUS
+++ b/arch/x86_64/pci/Makefile-BUS
@@ -8,7 +8,7 @@ CFLAGS += -I arch/i386/pci
8obj-y := i386.o 8obj-y := i386.o
9obj-$(CONFIG_PCI_DIRECT)+= direct.o 9obj-$(CONFIG_PCI_DIRECT)+= direct.o
10obj-y += fixup.o 10obj-y += fixup.o
11obj-$(CONFIG_ACPI_PCI) += acpi.o 11obj-$(CONFIG_ACPI) += acpi.o
12obj-y += legacy.o irq.o common.o 12obj-y += legacy.o irq.o common.o
13# mmconfig has a 64bit special 13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o 14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index e07287db5a40..1ac7d5ce7456 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -122,10 +122,7 @@ int do_settimeofday(struct timespec *tv)
122 set_normalized_timespec(&xtime, sec, nsec); 122 set_normalized_timespec(&xtime, sec, nsec);
123 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 123 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
124 124
125 time_adjust = 0; /* stop active adjtime() */ 125 ntp_clear();
126 time_status |= STA_UNSYNC;
127 time_maxerror = NTP_PHASE_LIMIT;
128 time_esterror = NTP_PHASE_LIMIT;
129 write_sequnlock_irq(&xtime_lock); 126 write_sequnlock_irq(&xtime_lock);
130 return 0; 127 return 0;
131} 128}
@@ -184,7 +181,7 @@ again:
184 next += CCOUNT_PER_JIFFY; 181 next += CCOUNT_PER_JIFFY;
185 do_timer (regs); /* Linux handler in kernel/timer.c */ 182 do_timer (regs); /* Linux handler in kernel/timer.c */
186 183
187 if ((time_status & STA_UNSYNC) == 0 && 184 if (ntp_synced() &&
188 xtime.tv_sec - last_rtc_update >= 659 && 185 xtime.tv_sec - last_rtc_update >= 659 &&
189 abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ && 186 abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ &&
190 jiffies - wall_jiffies == 1) { 187 jiffies - wall_jiffies == 1) {