aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/setup.c14
-rw-r--r--arch/alpha/kernel/time.c3
-rw-r--r--arch/alpha/mm/numa.c4
-rw-r--r--arch/arm/Kconfig14
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/boot/compressed/Makefile4
-rw-r--r--arch/arm/boot/compressed/ice-dcc.S17
-rw-r--r--arch/arm/boot/compressed/misc.c41
-rw-r--r--arch/arm/common/rtctime.c108
-rw-r--r--arch/arm/configs/ixp23xx_defconfig1302
-rw-r--r--arch/arm/lib/Makefile2
-rw-r--r--arch/arm/lib/copy_template.S2
-rw-r--r--arch/arm/mach-ep93xx/core.c68
-rw-r--r--arch/arm/mach-footbridge/time.c17
-rw-r--r--arch/arm/mach-integrator/core.c46
-rw-r--r--arch/arm/mach-integrator/time.c16
-rw-r--r--arch/arm/mach-ixp23xx/Kconfig25
-rw-r--r--arch/arm/mach-ixp23xx/Makefile11
-rw-r--r--arch/arm/mach-ixp23xx/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp23xx/core.c431
-rw-r--r--arch/arm/mach-ixp23xx/espresso.c69
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c325
-rw-r--r--arch/arm/mach-ixp23xx/pci.c275
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c164
-rw-r--r--arch/arm/mach-omap1/board-netstar.c2
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c2
-rw-r--r--arch/arm/mach-pxa/Kconfig5
-rw-r--r--arch/arm/mach-pxa/Makefile1
-rw-r--r--arch/arm/mach-pxa/generic.c6
-rw-r--r--arch/arm/mach-pxa/lpd270.c393
-rw-r--r--arch/arm/mach-pxa/spitz.c2
-rw-r--r--arch/arm/mach-sa1100/Kconfig2
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1100.c2
-rw-r--r--arch/arm/mach-sa1100/generic.c6
-rw-r--r--arch/arm/mm/Kconfig19
-rw-r--r--arch/arm/mm/Makefile2
-rw-r--r--arch/arm/mm/copypage-xsc3.S97
-rw-r--r--arch/arm/mm/mm-armv.c3
-rw-r--r--arch/arm/mm/proc-v6.S16
-rw-r--r--arch/arm/mm/proc-xsc3.S498
-rw-r--r--arch/arm26/mm/init.c7
-rw-r--r--arch/cris/kernel/setup.c5
-rw-r--r--arch/i386/Kconfig9
-rw-r--r--arch/i386/boot/video.S2
-rw-r--r--arch/i386/kernel/cpu/common.c10
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h4
-rw-r--r--arch/i386/kernel/cpu/intel_cacheinfo.c77
-rw-r--r--arch/i386/kernel/io_apic.c4
-rw-r--r--arch/i386/kernel/microcode.c17
-rw-r--r--arch/i386/kernel/nmi.c9
-rw-r--r--arch/i386/kernel/setup.c1
-rw-r--r--arch/i386/kernel/smpboot.c24
-rw-r--r--arch/i386/kernel/syscall_table.S2
-rw-r--r--arch/i386/kernel/timers/timer_pm.c104
-rw-r--r--arch/i386/kernel/traps.c17
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c2
-rw-r--r--arch/i386/mm/discontig.c12
-rw-r--r--arch/i386/mm/pgtable.c2
-rw-r--r--arch/i386/oprofile/nmi_int.c2
-rw-r--r--arch/ia64/kernel/traps.c6
-rw-r--r--arch/ia64/mm/discontig.c33
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c39
-rw-r--r--arch/m32r/kernel/setup.c1
-rw-r--r--arch/m32r/mm/discontig.c7
-rw-r--r--arch/m32r/mm/init.c3
-rw-r--r--arch/m68k/mvme16x/rtc.c4
-rw-r--r--arch/mips/au1000/common/setup.c2
-rw-r--r--arch/mips/ddb5xxx/common/rtc_ds1386.c4
-rw-r--r--arch/mips/dec/time.c51
-rw-r--r--arch/mips/ite-boards/generic/time.c4
-rw-r--r--arch/mips/ite-boards/ivr/init.c3
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/init.c3
-rw-r--r--arch/mips/jmr3927/common/rtc_ds1742.c4
-rw-r--r--arch/mips/kernel/setup.c9
-rw-r--r--arch/mips/kernel/time.c22
-rw-r--r--arch/mips/lasat/setup.c7
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c2
-rw-r--r--arch/mips/mips-boards/generic/memory.c7
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_mem.c7
-rw-r--r--arch/mips/mm/init.c4
-rw-r--r--arch/mips/momentum/jaguar_atx/setup.c4
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c38
-rw-r--r--arch/mips/momentum/ocelot_c/setup.c4
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c4
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-time.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c3
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c2
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c4
-rw-r--r--arch/mips/sibyte/swarm/setup.c8
-rw-r--r--arch/mips/sni/setup.c4
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c4
-rw-r--r--arch/mips/tx4938/common/rtc_rx5c348.c16
-rw-r--r--arch/parisc/kernel/pdc_chassis.c3
-rw-r--r--arch/powerpc/kernel/setup_64.c3
-rw-r--r--arch/powerpc/kernel/traps.c16
-rw-r--r--arch/powerpc/mm/mem.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c2
-rw-r--r--arch/powerpc/platforms/chrp/time.c22
-rw-r--r--arch/powerpc/platforms/maple/time.c24
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c10
-rw-r--r--arch/ppc/kernel/ppc_htab.c2
-rw-r--r--arch/ppc/platforms/prep_setup.c2
-rw-r--r--arch/s390/kernel/process.c11
-rw-r--r--arch/sh/boards/mpc1211/rtc.c50
-rw-r--r--arch/sh/boards/sh03/rtc.c13
-rw-r--r--arch/sh/kernel/cpu/rtc.c10
-rw-r--r--arch/sh/kernel/setup.c5
-rw-r--r--arch/sh64/kernel/setup.c1
-rw-r--r--arch/sh64/kernel/time.c9
-rw-r--r--arch/sparc64/kernel/time.c16
-rw-r--r--arch/sparc64/kernel/traps.c17
-rw-r--r--arch/sparc64/mm/fault.c4
-rw-r--r--arch/um/drivers/mconsole_kern.c3
-rw-r--r--arch/um/drivers/ubd_kern.c76
-rw-r--r--arch/um/include/irq_user.h15
-rw-r--r--arch/um/include/kern.h2
-rw-r--r--arch/um/include/misc_constants.h6
-rw-r--r--arch/um/include/os.h36
-rw-r--r--arch/um/include/sigio.h3
-rw-r--r--arch/um/include/skas/mode-skas.h1
-rw-r--r--arch/um/include/skas/skas.h1
-rw-r--r--arch/um/include/user_util.h1
-rw-r--r--arch/um/kernel/Makefile9
-rw-r--r--arch/um/kernel/exec_kern.c2
-rw-r--r--arch/um/kernel/irq.c294
-rw-r--r--arch/um/kernel/irq_user.c412
-rw-r--r--arch/um/kernel/physmem.c3
-rw-r--r--arch/um/kernel/sigio_kern.c10
-rw-r--r--arch/um/kernel/smp.c14
-rw-r--r--arch/um/kernel/um_arch.c12
-rw-r--r--arch/um/os-Linux/Makefile13
-rw-r--r--arch/um/os-Linux/irq.c162
-rw-r--r--arch/um/os-Linux/sigio.c (renamed from arch/um/kernel/sigio_user.c)233
-rw-r--r--arch/um/os-Linux/start_up.c128
-rw-r--r--arch/um/os-Linux/tt.c10
-rw-r--r--arch/um/os-Linux/tty_log.c (renamed from arch/um/kernel/tty_log.c)18
-rw-r--r--arch/um/os-Linux/umid.c33
-rw-r--r--arch/um/sys-i386/ptrace.c15
-rw-r--r--arch/um/sys-i386/signal.c59
-rw-r--r--arch/um/sys-i386/user-offsets.c10
-rw-r--r--arch/um/sys-x86_64/ptrace.c22
-rw-r--r--arch/um/sys-x86_64/signal.c56
-rw-r--r--arch/um/sys-x86_64/user-offsets.c6
-rw-r--r--arch/x86_64/Kconfig13
-rw-r--r--arch/x86_64/ia32/ia32entry.S2
-rw-r--r--arch/x86_64/kernel/process.c17
-rw-r--r--arch/x86_64/kernel/setup.c3
-rw-r--r--arch/x86_64/kernel/smpboot.c24
-rw-r--r--arch/x86_64/kernel/time.c41
-rw-r--r--arch/x86_64/kernel/traps.c18
-rw-r--r--arch/x86_64/mm/init.c2
-rw-r--r--arch/x86_64/mm/numa.c15
-rw-r--r--arch/xtensa/platform-iss/setup.c2
157 files changed, 5236 insertions, 1448 deletions
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index b4e5f8ff2b25..dd8769670596 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -34,6 +34,7 @@
34#include <linux/root_dev.h> 34#include <linux/root_dev.h>
35#include <linux/initrd.h> 35#include <linux/initrd.h>
36#include <linux/eisa.h> 36#include <linux/eisa.h>
37#include <linux/pfn.h>
37#ifdef CONFIG_MAGIC_SYSRQ 38#ifdef CONFIG_MAGIC_SYSRQ
38#include <linux/sysrq.h> 39#include <linux/sysrq.h>
39#include <linux/reboot.h> 40#include <linux/reboot.h>
@@ -42,7 +43,7 @@
42#include <asm/setup.h> 43#include <asm/setup.h>
43#include <asm/io.h> 44#include <asm/io.h>
44 45
45extern struct notifier_block *panic_notifier_list; 46extern struct atomic_notifier_head panic_notifier_list;
46static int alpha_panic_event(struct notifier_block *, unsigned long, void *); 47static int alpha_panic_event(struct notifier_block *, unsigned long, void *);
47static struct notifier_block alpha_panic_block = { 48static struct notifier_block alpha_panic_block = {
48 alpha_panic_event, 49 alpha_panic_event,
@@ -241,9 +242,6 @@ reserve_std_resources(void)
241 request_resource(io, standard_io_resources+i); 242 request_resource(io, standard_io_resources+i);
242} 243}
243 244
244#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
245#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
246#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
247#define PFN_MAX PFN_DOWN(0x80000000) 245#define PFN_MAX PFN_DOWN(0x80000000)
248#define for_each_mem_cluster(memdesc, cluster, i) \ 246#define for_each_mem_cluster(memdesc, cluster, i) \
249 for ((cluster) = (memdesc)->cluster, (i) = 0; \ 247 for ((cluster) = (memdesc)->cluster, (i) = 0; \
@@ -472,11 +470,6 @@ page_is_ram(unsigned long pfn)
472 return 0; 470 return 0;
473} 471}
474 472
475#undef PFN_UP
476#undef PFN_DOWN
477#undef PFN_PHYS
478#undef PFN_MAX
479
480void __init 473void __init
481setup_arch(char **cmdline_p) 474setup_arch(char **cmdline_p)
482{ 475{
@@ -507,7 +500,8 @@ setup_arch(char **cmdline_p)
507 } 500 }
508 501
509 /* Register a call for panic conditions. */ 502 /* Register a call for panic conditions. */
510 notifier_chain_register(&panic_notifier_list, &alpha_panic_block); 503 atomic_notifier_chain_register(&panic_notifier_list,
504 &alpha_panic_block);
511 505
512#ifdef CONFIG_ALPHA_GENERIC 506#ifdef CONFIG_ALPHA_GENERIC
513 /* Assume that we've booted from SRM if we haven't booted from MILO. 507 /* Assume that we've booted from SRM if we haven't booted from MILO.
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 6b2921be1909..3859749810b4 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -314,10 +314,11 @@ time_init(void)
314 if (!est_cycle_freq) 314 if (!est_cycle_freq)
315 est_cycle_freq = validate_cc_value(calibrate_cc_with_pit()); 315 est_cycle_freq = validate_cc_value(calibrate_cc_with_pit());
316 316
317 cc1 = rpcc_after_update_in_progress(); 317 cc1 = rpcc();
318 318
319 /* Calibrate CPU clock -- attempt #2. */ 319 /* Calibrate CPU clock -- attempt #2. */
320 if (!est_cycle_freq) { 320 if (!est_cycle_freq) {
321 cc1 = rpcc_after_update_in_progress();
321 cc2 = rpcc_after_update_in_progress(); 322 cc2 = rpcc_after_update_in_progress();
322 est_cycle_freq = validate_cc_value(cc2 - cc1); 323 est_cycle_freq = validate_cc_value(cc2 - cc1);
323 cc1 = cc2; 324 cc1 = cc2;
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index 6d5251254f68..bf6b65c81bef 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -13,6 +13,7 @@
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/swap.h> 14#include <linux/swap.h>
15#include <linux/initrd.h> 15#include <linux/initrd.h>
16#include <linux/pfn.h>
16 17
17#include <asm/hwrpb.h> 18#include <asm/hwrpb.h>
18#include <asm/pgalloc.h> 19#include <asm/pgalloc.h>
@@ -27,9 +28,6 @@ bootmem_data_t node_bdata[MAX_NUMNODES];
27#define DBGDCONT(args...) 28#define DBGDCONT(args...)
28#endif 29#endif
29 30
30#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
31#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
32#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
33#define for_each_mem_cluster(memdesc, cluster, i) \ 31#define for_each_mem_cluster(memdesc, cluster, i) \
34 for ((cluster) = (memdesc)->cluster, (i) = 0; \ 32 for ((cluster) = (memdesc)->cluster, (i) = 0; \
35 (i) < (memdesc)->numclusters; (i)++, (cluster)++) 33 (i) < (memdesc)->numclusters; (i)++, (cluster)++)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bf2e72698d02..ba46d779ede7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -8,6 +8,7 @@ mainmenu "Linux Kernel Configuration"
8config ARM 8config ARM
9 bool 9 bool
10 default y 10 default y
11 select RTC_LIB
11 help 12 help
12 The ARM series is a line of low-power-consumption RISC chip designs 13 The ARM series is a line of low-power-consumption RISC chip designs
13 licensed by ARM Ltd and targeted at embedded applications and 14 licensed by ARM Ltd and targeted at embedded applications and
@@ -152,6 +153,12 @@ config ARCH_IXP2000
152 help 153 help
153 Support for Intel's IXP2400/2800 (XScale) family of processors. 154 Support for Intel's IXP2400/2800 (XScale) family of processors.
154 155
156config ARCH_IXP23XX
157 bool "IXP23XX-based"
158 select PCI
159 help
160 Support for Intel's IXP23xx (XScale) family of processors.
161
155config ARCH_L7200 162config ARCH_L7200
156 bool "LinkUp-L7200" 163 bool "LinkUp-L7200"
157 select FIQ 164 select FIQ
@@ -273,6 +280,8 @@ source "arch/arm/mach-ixp4xx/Kconfig"
273 280
274source "arch/arm/mach-ixp2000/Kconfig" 281source "arch/arm/mach-ixp2000/Kconfig"
275 282
283source "arch/arm/mach-ixp23xx/Kconfig"
284
276source "arch/arm/mach-pxa/Kconfig" 285source "arch/arm/mach-pxa/Kconfig"
277 286
278source "arch/arm/mach-sa1100/Kconfig" 287source "arch/arm/mach-sa1100/Kconfig"
@@ -791,7 +800,8 @@ source "drivers/acorn/block/Kconfig"
791 800
792if PCMCIA || ARCH_CLPS7500 || ARCH_IOP3XX || ARCH_IXP4XX \ 801if PCMCIA || ARCH_CLPS7500 || ARCH_IOP3XX || ARCH_IXP4XX \
793 || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \ 802 || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \
794 || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE 803 || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \
804 || ARCH_IXP23XX
795source "drivers/ide/Kconfig" 805source "drivers/ide/Kconfig"
796endif 806endif
797 807
@@ -839,6 +849,8 @@ source "drivers/usb/Kconfig"
839 849
840source "drivers/mmc/Kconfig" 850source "drivers/mmc/Kconfig"
841 851
852source "drivers/rtc/Kconfig"
853
842endmenu 854endmenu
843 855
844source "fs/Kconfig" 856source "fs/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 99c0d323719a..ce3e804ea0f3 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -57,6 +57,7 @@ tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
57tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110 57tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110
58tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100 58tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
59tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 59tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
60tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
60tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) 61tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
61 62
62ifeq ($(CONFIG_AEABI),y) 63ifeq ($(CONFIG_AEABI),y)
@@ -97,6 +98,7 @@ endif
97 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx 98 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx
98 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 99 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
99 machine-$(CONFIG_ARCH_IXP2000) := ixp2000 100 machine-$(CONFIG_ARCH_IXP2000) := ixp2000
101 machine-$(CONFIG_ARCH_IXP23XX) := ixp23xx
100 machine-$(CONFIG_ARCH_OMAP1) := omap1 102 machine-$(CONFIG_ARCH_OMAP1) := omap1
101 machine-$(CONFIG_ARCH_OMAP2) := omap2 103 machine-$(CONFIG_ARCH_OMAP2) := omap2
102 incdir-$(CONFIG_ARCH_OMAP) := omap 104 incdir-$(CONFIG_ARCH_OMAP) := omap
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 35ffe0f4ece7..2adc1527e0eb 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -50,10 +50,6 @@ ifeq ($(CONFIG_ARCH_AT91RM9200),y)
50OBJS += head-at91rm9200.o 50OBJS += head-at91rm9200.o
51endif 51endif
52 52
53ifeq ($(CONFIG_DEBUG_ICEDCC),y)
54OBJS += ice-dcc.o
55endif
56
57ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) 53ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
58OBJS += big-endian.o 54OBJS += big-endian.o
59endif 55endif
diff --git a/arch/arm/boot/compressed/ice-dcc.S b/arch/arm/boot/compressed/ice-dcc.S
deleted file mode 100644
index 104377a199bb..000000000000
--- a/arch/arm/boot/compressed/ice-dcc.S
+++ /dev/null
@@ -1,17 +0,0 @@
1
2
3 .text
4
5 .global icedcc_putc
6
7icedcc_putc:
8 mov r2, #0x4000000
91:
10 subs r2, r2, #1
11 movlt pc, r14
12 mrc p14, 0, r1, c0, c0, 0
13 tst r1, #2
14 bne 1b
15
16 mcr p14, 0, r0, c1, c0, 0
17 mov pc, r14
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 5ab94584baee..0af3772efcb7 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -20,24 +20,45 @@ unsigned int __machine_arch_type;
20 20
21#include <linux/string.h> 21#include <linux/string.h>
22 22
23#include <asm/arch/uncompress.h>
24
25#ifdef STANDALONE_DEBUG 23#ifdef STANDALONE_DEBUG
26#define putstr printf 24#define putstr printf
27#endif 25#else
26
27static void putstr(const char *ptr);
28
29#include <linux/compiler.h>
30#include <asm/arch/uncompress.h>
28 31
29#ifdef CONFIG_DEBUG_ICEDCC 32#ifdef CONFIG_DEBUG_ICEDCC
30#define putstr icedcc_putstr 33static void icedcc_putc(int ch)
31#define putc icedcc_putc 34{
35 int status, i = 0x4000000;
32 36
33extern void icedcc_putc(int ch); 37 do {
38 if (--i < 0)
39 return;
34 40
35static void 41 asm("mrc p14, 0, %0, c0, c0, 0" : "=r" (status));
36icedcc_putstr(const char *ptr) 42 } while (status & 2);
43
44 asm("mcr p15, 0, %0, c1, c0, 0" : : "r" (ch));
45}
46
47#define putc(ch) icedcc_putc(ch)
48#define flush() do { } while (0)
49#endif
50
51static void putstr(const char *ptr)
37{ 52{
38 for (; *ptr != '\0'; ptr++) { 53 char c;
39 icedcc_putc(*ptr); 54
55 while ((c = *ptr++) != '\0') {
56 if (c == '\n')
57 putc('\r');
58 putc(c);
40 } 59 }
60
61 flush();
41} 62}
42 63
43#endif 64#endif
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
index e851d86c212c..35c9a64ac14c 100644
--- a/arch/arm/common/rtctime.c
+++ b/arch/arm/common/rtctime.c
@@ -20,6 +20,7 @@
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/rtc.h>
23 24
24#include <asm/rtc.h> 25#include <asm/rtc.h>
25#include <asm/semaphore.h> 26#include <asm/semaphore.h>
@@ -42,89 +43,6 @@ static struct rtc_ops *rtc_ops;
42 43
43#define rtc_epoch 1900UL 44#define rtc_epoch 1900UL
44 45
45static const unsigned char days_in_month[] = {
46 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
47};
48
49#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400)
50#define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400))
51
52static int month_days(unsigned int month, unsigned int year)
53{
54 return days_in_month[month] + (LEAP_YEAR(year) && month == 1);
55}
56
57/*
58 * Convert seconds since 01-01-1970 00:00:00 to Gregorian date.
59 */
60void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
61{
62 int days, month, year;
63
64 days = time / 86400;
65 time -= days * 86400;
66
67 tm->tm_wday = (days + 4) % 7;
68
69 year = 1970 + days / 365;
70 days -= (year - 1970) * 365
71 + LEAPS_THRU_END_OF(year - 1)
72 - LEAPS_THRU_END_OF(1970 - 1);
73 if (days < 0) {
74 year -= 1;
75 days += 365 + LEAP_YEAR(year);
76 }
77 tm->tm_year = year - 1900;
78 tm->tm_yday = days + 1;
79
80 for (month = 0; month < 11; month++) {
81 int newdays;
82
83 newdays = days - month_days(month, year);
84 if (newdays < 0)
85 break;
86 days = newdays;
87 }
88 tm->tm_mon = month;
89 tm->tm_mday = days + 1;
90
91 tm->tm_hour = time / 3600;
92 time -= tm->tm_hour * 3600;
93 tm->tm_min = time / 60;
94 tm->tm_sec = time - tm->tm_min * 60;
95}
96EXPORT_SYMBOL(rtc_time_to_tm);
97
98/*
99 * Does the rtc_time represent a valid date/time?
100 */
101int rtc_valid_tm(struct rtc_time *tm)
102{
103 if (tm->tm_year < 70 ||
104 tm->tm_mon >= 12 ||
105 tm->tm_mday < 1 ||
106 tm->tm_mday > month_days(tm->tm_mon, tm->tm_year + 1900) ||
107 tm->tm_hour >= 24 ||
108 tm->tm_min >= 60 ||
109 tm->tm_sec >= 60)
110 return -EINVAL;
111
112 return 0;
113}
114EXPORT_SYMBOL(rtc_valid_tm);
115
116/*
117 * Convert Gregorian date to seconds since 01-01-1970 00:00:00.
118 */
119int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
120{
121 *time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
122 tm->tm_hour, tm->tm_min, tm->tm_sec);
123
124 return 0;
125}
126EXPORT_SYMBOL(rtc_tm_to_time);
127
128/* 46/*
129 * Calculate the next alarm time given the requested alarm time mask 47 * Calculate the next alarm time given the requested alarm time mask
130 * and the current time. 48 * and the current time.
@@ -151,13 +69,13 @@ void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc
151 } 69 }
152} 70}
153 71
154static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm) 72static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm)
155{ 73{
156 memset(tm, 0, sizeof(struct rtc_time)); 74 memset(tm, 0, sizeof(struct rtc_time));
157 return ops->read_time(tm); 75 return ops->read_time(tm);
158} 76}
159 77
160static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm) 78static inline int rtc_arm_set_time(struct rtc_ops *ops, struct rtc_time *tm)
161{ 79{
162 int ret; 80 int ret;
163 81
@@ -168,7 +86,7 @@ static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm)
168 return ret; 86 return ret;
169} 87}
170 88
171static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) 89static inline int rtc_arm_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
172{ 90{
173 int ret = -EINVAL; 91 int ret = -EINVAL;
174 if (ops->read_alarm) { 92 if (ops->read_alarm) {
@@ -178,7 +96,7 @@ static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
178 return ret; 96 return ret;
179} 97}
180 98
181static inline int rtc_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) 99static inline int rtc_arm_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
182{ 100{
183 int ret = -EINVAL; 101 int ret = -EINVAL;
184 if (ops->set_alarm) 102 if (ops->set_alarm)
@@ -266,7 +184,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
266 184
267 switch (cmd) { 185 switch (cmd) {
268 case RTC_ALM_READ: 186 case RTC_ALM_READ:
269 ret = rtc_read_alarm(ops, &alrm); 187 ret = rtc_arm_read_alarm(ops, &alrm);
270 if (ret) 188 if (ret)
271 break; 189 break;
272 ret = copy_to_user(uarg, &alrm.time, sizeof(tm)); 190 ret = copy_to_user(uarg, &alrm.time, sizeof(tm));
@@ -288,11 +206,11 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
288 alrm.time.tm_wday = -1; 206 alrm.time.tm_wday = -1;
289 alrm.time.tm_yday = -1; 207 alrm.time.tm_yday = -1;
290 alrm.time.tm_isdst = -1; 208 alrm.time.tm_isdst = -1;
291 ret = rtc_set_alarm(ops, &alrm); 209 ret = rtc_arm_set_alarm(ops, &alrm);
292 break; 210 break;
293 211
294 case RTC_RD_TIME: 212 case RTC_RD_TIME:
295 ret = rtc_read_time(ops, &tm); 213 ret = rtc_arm_read_time(ops, &tm);
296 if (ret) 214 if (ret)
297 break; 215 break;
298 ret = copy_to_user(uarg, &tm, sizeof(tm)); 216 ret = copy_to_user(uarg, &tm, sizeof(tm));
@@ -310,7 +228,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
310 ret = -EFAULT; 228 ret = -EFAULT;
311 break; 229 break;
312 } 230 }
313 ret = rtc_set_time(ops, &tm); 231 ret = rtc_arm_set_time(ops, &tm);
314 break; 232 break;
315 233
316 case RTC_EPOCH_SET: 234 case RTC_EPOCH_SET:
@@ -341,11 +259,11 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
341 ret = -EFAULT; 259 ret = -EFAULT;
342 break; 260 break;
343 } 261 }
344 ret = rtc_set_alarm(ops, &alrm); 262 ret = rtc_arm_set_alarm(ops, &alrm);
345 break; 263 break;
346 264
347 case RTC_WKALM_RD: 265 case RTC_WKALM_RD:
348 ret = rtc_read_alarm(ops, &alrm); 266 ret = rtc_arm_read_alarm(ops, &alrm);
349 if (ret) 267 if (ret)
350 break; 268 break;
351 ret = copy_to_user(uarg, &alrm, sizeof(alrm)); 269 ret = copy_to_user(uarg, &alrm, sizeof(alrm));
@@ -435,7 +353,7 @@ static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eo
435 struct rtc_time tm; 353 struct rtc_time tm;
436 char *p = page; 354 char *p = page;
437 355
438 if (rtc_read_time(ops, &tm) == 0) { 356 if (rtc_arm_read_time(ops, &tm) == 0) {
439 p += sprintf(p, 357 p += sprintf(p,
440 "rtc_time\t: %02d:%02d:%02d\n" 358 "rtc_time\t: %02d:%02d:%02d\n"
441 "rtc_date\t: %04d-%02d-%02d\n" 359 "rtc_date\t: %04d-%02d-%02d\n"
@@ -445,7 +363,7 @@ static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eo
445 rtc_epoch); 363 rtc_epoch);
446 } 364 }
447 365
448 if (rtc_read_alarm(ops, &alrm) == 0) { 366 if (rtc_arm_read_alarm(ops, &alrm) == 0) {
449 p += sprintf(p, "alrm_time\t: "); 367 p += sprintf(p, "alrm_time\t: ");
450 if ((unsigned int)alrm.time.tm_hour <= 24) 368 if ((unsigned int)alrm.time.tm_hour <= 24)
451 p += sprintf(p, "%02d:", alrm.time.tm_hour); 369 p += sprintf(p, "%02d:", alrm.time.tm_hour);
diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig
new file mode 100644
index 000000000000..1a2751e9ab05
--- /dev/null
+++ b/arch/arm/configs/ixp23xx_defconfig
@@ -0,0 +1,1302 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16
4# Tue Mar 21 03:27:20 2006
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_BROKEN_ON_SMP=y
16CONFIG_INIT_ENV_ARG_LIMIT=32
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_LOCALVERSION_AUTO=y
23CONFIG_SWAP=y
24CONFIG_SYSVIPC=y
25# CONFIG_POSIX_MQUEUE is not set
26CONFIG_BSD_PROCESS_ACCT=y
27# CONFIG_BSD_PROCESS_ACCT_V3 is not set
28CONFIG_SYSCTL=y
29# CONFIG_AUDIT is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_UID16=y
33CONFIG_CC_OPTIMIZE_FOR_SIZE=y
34CONFIG_EMBEDDED=y
35CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_ALL is not set
37# CONFIG_KALLSYMS_EXTRA_PASS is not set
38CONFIG_HOTPLUG=y
39CONFIG_PRINTK=y
40CONFIG_BUG=y
41CONFIG_ELF_CORE=y
42CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y
44CONFIG_EPOLL=y
45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50CONFIG_SLAB=y
51# CONFIG_TINY_SHMEM is not set
52CONFIG_BASE_SMALL=0
53# CONFIG_SLOB is not set
54CONFIG_OBSOLETE_INTERMODULE=y
55
56#
57# Loadable module support
58#
59CONFIG_MODULES=y
60CONFIG_MODULE_UNLOAD=y
61# CONFIG_MODULE_FORCE_UNLOAD is not set
62CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_MODVERSIONS is not set
64# CONFIG_MODULE_SRCVERSION_ALL is not set
65CONFIG_KMOD=y
66
67#
68# Block layer
69#
70
71#
72# IO Schedulers
73#
74CONFIG_IOSCHED_NOOP=y
75CONFIG_IOSCHED_AS=y
76CONFIG_IOSCHED_DEADLINE=y
77CONFIG_IOSCHED_CFQ=y
78CONFIG_DEFAULT_AS=y
79# CONFIG_DEFAULT_DEADLINE is not set
80# CONFIG_DEFAULT_CFQ is not set
81# CONFIG_DEFAULT_NOOP is not set
82CONFIG_DEFAULT_IOSCHED="anticipatory"
83
84#
85# System Type
86#
87# CONFIG_ARCH_CLPS7500 is not set
88# CONFIG_ARCH_CLPS711X is not set
89# CONFIG_ARCH_CO285 is not set
90# CONFIG_ARCH_EBSA110 is not set
91# CONFIG_ARCH_EP93XX is not set
92# CONFIG_ARCH_FOOTBRIDGE is not set
93# CONFIG_ARCH_INTEGRATOR is not set
94# CONFIG_ARCH_IOP3XX is not set
95# CONFIG_ARCH_IXP4XX is not set
96# CONFIG_ARCH_IXP2000 is not set
97CONFIG_ARCH_IXP23XX=y
98# CONFIG_ARCH_L7200 is not set
99# CONFIG_ARCH_PXA is not set
100# CONFIG_ARCH_RPC is not set
101# CONFIG_ARCH_SA1100 is not set
102# CONFIG_ARCH_S3C2410 is not set
103# CONFIG_ARCH_SHARK is not set
104# CONFIG_ARCH_LH7A40X is not set
105# CONFIG_ARCH_OMAP is not set
106# CONFIG_ARCH_VERSATILE is not set
107# CONFIG_ARCH_REALVIEW is not set
108# CONFIG_ARCH_IMX is not set
109# CONFIG_ARCH_H720X is not set
110# CONFIG_ARCH_AAEC2000 is not set
111# CONFIG_ARCH_AT91RM9200 is not set
112CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
113
114#
115# Intel IXP23xx Implementation Options
116#
117
118#
119# IXP23xx Platforms
120#
121CONFIG_MACH_ESPRESSO=y
122CONFIG_MACH_IXDP2351=y
123CONFIG_MACH_ROADRUNNER=y
124
125#
126# Processor Type
127#
128CONFIG_CPU_32=y
129CONFIG_CPU_XSC3=y
130CONFIG_CPU_32v5=y
131CONFIG_CPU_ABRT_EV5T=y
132CONFIG_CPU_CACHE_VIVT=y
133CONFIG_CPU_TLB_V4WBI=y
134CONFIG_IO_36=y
135
136#
137# Processor Features
138#
139# CONFIG_ARM_THUMB is not set
140CONFIG_CPU_BIG_ENDIAN=y
141
142#
143# Bus support
144#
145CONFIG_PCI=y
146CONFIG_PCI_LEGACY_PROC=y
147# CONFIG_PCI_DEBUG is not set
148
149#
150# PCCARD (PCMCIA/CardBus) support
151#
152# CONFIG_PCCARD is not set
153
154#
155# Kernel Features
156#
157# CONFIG_PREEMPT is not set
158# CONFIG_NO_IDLE_HZ is not set
159CONFIG_HZ=100
160# CONFIG_AEABI is not set
161# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
162CONFIG_SELECT_MEMORY_MODEL=y
163CONFIG_FLATMEM_MANUAL=y
164# CONFIG_DISCONTIGMEM_MANUAL is not set
165# CONFIG_SPARSEMEM_MANUAL is not set
166CONFIG_FLATMEM=y
167CONFIG_FLAT_NODE_MEM_MAP=y
168# CONFIG_SPARSEMEM_STATIC is not set
169CONFIG_SPLIT_PTLOCK_CPUS=4096
170CONFIG_ALIGNMENT_TRAP=y
171
172#
173# Boot options
174#
175CONFIG_ZBOOT_ROM_TEXT=0x0
176CONFIG_ZBOOT_ROM_BSS=0x0
177CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp"
178# CONFIG_XIP_KERNEL is not set
179
180#
181# Floating point emulation
182#
183
184#
185# At least one emulation must be selected
186#
187CONFIG_FPE_NWFPE=y
188CONFIG_FPE_NWFPE_XP=y
189# CONFIG_FPE_FASTFPE is not set
190
191#
192# Userspace binary formats
193#
194CONFIG_BINFMT_ELF=y
195# CONFIG_BINFMT_AOUT is not set
196# CONFIG_BINFMT_MISC is not set
197# CONFIG_ARTHUR is not set
198
199#
200# Power management options
201#
202# CONFIG_PM is not set
203# CONFIG_APM is not set
204
205#
206# Networking
207#
208CONFIG_NET=y
209
210#
211# Networking options
212#
213# CONFIG_NETDEBUG is not set
214CONFIG_PACKET=y
215CONFIG_PACKET_MMAP=y
216CONFIG_UNIX=y
217# CONFIG_NET_KEY is not set
218CONFIG_INET=y
219# CONFIG_IP_MULTICAST is not set
220# CONFIG_IP_ADVANCED_ROUTER is not set
221CONFIG_IP_FIB_HASH=y
222CONFIG_IP_PNP=y
223CONFIG_IP_PNP_DHCP=y
224CONFIG_IP_PNP_BOOTP=y
225# CONFIG_IP_PNP_RARP is not set
226# CONFIG_NET_IPIP is not set
227# CONFIG_NET_IPGRE is not set
228# CONFIG_ARPD is not set
229CONFIG_SYN_COOKIES=y
230# CONFIG_INET_AH is not set
231# CONFIG_INET_ESP is not set
232# CONFIG_INET_IPCOMP is not set
233# CONFIG_INET_TUNNEL is not set
234CONFIG_INET_DIAG=y
235CONFIG_INET_TCP_DIAG=y
236# CONFIG_TCP_CONG_ADVANCED is not set
237CONFIG_TCP_CONG_BIC=y
238# CONFIG_IPV6 is not set
239# CONFIG_NETFILTER is not set
240
241#
242# DCCP Configuration (EXPERIMENTAL)
243#
244# CONFIG_IP_DCCP is not set
245
246#
247# SCTP Configuration (EXPERIMENTAL)
248#
249# CONFIG_IP_SCTP is not set
250
251#
252# TIPC Configuration (EXPERIMENTAL)
253#
254# CONFIG_TIPC is not set
255# CONFIG_ATM is not set
256# CONFIG_BRIDGE is not set
257# CONFIG_VLAN_8021Q is not set
258# CONFIG_DECNET is not set
259# CONFIG_LLC2 is not set
260# CONFIG_IPX is not set
261# CONFIG_ATALK is not set
262# CONFIG_X25 is not set
263# CONFIG_LAPB is not set
264# CONFIG_NET_DIVERT is not set
265# CONFIG_ECONET is not set
266# CONFIG_WAN_ROUTER is not set
267
268#
269# QoS and/or fair queueing
270#
271# CONFIG_NET_SCHED is not set
272
273#
274# Network testing
275#
276# CONFIG_NET_PKTGEN is not set
277# CONFIG_HAMRADIO is not set
278# CONFIG_IRDA is not set
279# CONFIG_BT is not set
280# CONFIG_IEEE80211 is not set
281
282#
283# Device Drivers
284#
285
286#
287# Generic Driver Options
288#
289CONFIG_STANDALONE=y
290# CONFIG_PREVENT_FIRMWARE_BUILD is not set
291# CONFIG_FW_LOADER is not set
292# CONFIG_DEBUG_DRIVER is not set
293
294#
295# Connector - unified userspace <-> kernelspace linker
296#
297# CONFIG_CONNECTOR is not set
298
299#
300# Memory Technology Devices (MTD)
301#
302CONFIG_MTD=y
303# CONFIG_MTD_DEBUG is not set
304# CONFIG_MTD_CONCAT is not set
305CONFIG_MTD_PARTITIONS=y
306CONFIG_MTD_REDBOOT_PARTS=y
307CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
308CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
309CONFIG_MTD_REDBOOT_PARTS_READONLY=y
310# CONFIG_MTD_CMDLINE_PARTS is not set
311# CONFIG_MTD_AFS_PARTS is not set
312
313#
314# User Modules And Translation Layers
315#
316CONFIG_MTD_CHAR=y
317CONFIG_MTD_BLOCK=y
318# CONFIG_FTL is not set
319# CONFIG_NFTL is not set
320# CONFIG_INFTL is not set
321# CONFIG_RFD_FTL is not set
322
323#
324# RAM/ROM/Flash chip drivers
325#
326CONFIG_MTD_CFI=y
327# CONFIG_MTD_JEDECPROBE is not set
328CONFIG_MTD_GEN_PROBE=y
329# CONFIG_MTD_CFI_ADV_OPTIONS is not set
330CONFIG_MTD_MAP_BANK_WIDTH_1=y
331CONFIG_MTD_MAP_BANK_WIDTH_2=y
332CONFIG_MTD_MAP_BANK_WIDTH_4=y
333# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
334# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
335# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
336CONFIG_MTD_CFI_I1=y
337CONFIG_MTD_CFI_I2=y
338# CONFIG_MTD_CFI_I4 is not set
339# CONFIG_MTD_CFI_I8 is not set
340CONFIG_MTD_CFI_INTELEXT=y
341# CONFIG_MTD_CFI_AMDSTD is not set
342# CONFIG_MTD_CFI_STAA is not set
343CONFIG_MTD_CFI_UTIL=y
344# CONFIG_MTD_RAM is not set
345# CONFIG_MTD_ROM is not set
346# CONFIG_MTD_ABSENT is not set
347# CONFIG_MTD_OBSOLETE_CHIPS is not set
348
349#
350# Mapping drivers for chip access
351#
352CONFIG_MTD_COMPLEX_MAPPINGS=y
353CONFIG_MTD_PHYSMAP=y
354CONFIG_MTD_PHYSMAP_START=0x0
355CONFIG_MTD_PHYSMAP_LEN=0x0
356CONFIG_MTD_PHYSMAP_BANKWIDTH=1
357# CONFIG_MTD_ARM_INTEGRATOR is not set
358# CONFIG_MTD_PCI is not set
359# CONFIG_MTD_PLATRAM is not set
360
361#
362# Self-contained MTD device drivers
363#
364# CONFIG_MTD_PMC551 is not set
365# CONFIG_MTD_SLRAM is not set
366# CONFIG_MTD_PHRAM is not set
367# CONFIG_MTD_MTDRAM is not set
368# CONFIG_MTD_BLKMTD is not set
369# CONFIG_MTD_BLOCK2MTD is not set
370
371#
372# Disk-On-Chip Device Drivers
373#
374# CONFIG_MTD_DOC2000 is not set
375# CONFIG_MTD_DOC2001 is not set
376# CONFIG_MTD_DOC2001PLUS is not set
377
378#
379# NAND Flash Device Drivers
380#
381# CONFIG_MTD_NAND is not set
382
383#
384# OneNAND Flash Device Drivers
385#
386# CONFIG_MTD_ONENAND is not set
387
388#
389# Parallel port support
390#
391# CONFIG_PARPORT is not set
392
393#
394# Plug and Play support
395#
396
397#
398# Block devices
399#
400# CONFIG_BLK_CPQ_DA is not set
401# CONFIG_BLK_CPQ_CISS_DA is not set
402# CONFIG_BLK_DEV_DAC960 is not set
403# CONFIG_BLK_DEV_UMEM is not set
404# CONFIG_BLK_DEV_COW_COMMON is not set
405CONFIG_BLK_DEV_LOOP=y
406# CONFIG_BLK_DEV_CRYPTOLOOP is not set
407# CONFIG_BLK_DEV_NBD is not set
408# CONFIG_BLK_DEV_SX8 is not set
409# CONFIG_BLK_DEV_UB is not set
410CONFIG_BLK_DEV_RAM=y
411CONFIG_BLK_DEV_RAM_COUNT=16
412CONFIG_BLK_DEV_RAM_SIZE=8192
413CONFIG_BLK_DEV_INITRD=y
414# CONFIG_CDROM_PKTCDVD is not set
415# CONFIG_ATA_OVER_ETH is not set
416
417#
418# ATA/ATAPI/MFM/RLL support
419#
420CONFIG_IDE=y
421CONFIG_BLK_DEV_IDE=y
422
423#
424# Please see Documentation/ide.txt for help/info on IDE drives
425#
426# CONFIG_BLK_DEV_IDE_SATA is not set
427CONFIG_BLK_DEV_IDEDISK=y
428# CONFIG_IDEDISK_MULTI_MODE is not set
429# CONFIG_BLK_DEV_IDECD is not set
430# CONFIG_BLK_DEV_IDETAPE is not set
431# CONFIG_BLK_DEV_IDEFLOPPY is not set
432# CONFIG_BLK_DEV_IDESCSI is not set
433# CONFIG_IDE_TASK_IOCTL is not set
434
435#
436# IDE chipset support/bugfixes
437#
438CONFIG_IDE_GENERIC=y
439CONFIG_BLK_DEV_IDEPCI=y
440# CONFIG_IDEPCI_SHARE_IRQ is not set
441# CONFIG_BLK_DEV_OFFBOARD is not set
442# CONFIG_BLK_DEV_GENERIC is not set
443# CONFIG_BLK_DEV_OPTI621 is not set
444# CONFIG_BLK_DEV_SL82C105 is not set
445CONFIG_BLK_DEV_IDEDMA_PCI=y
446# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
447# CONFIG_IDEDMA_PCI_AUTO is not set
448# CONFIG_BLK_DEV_AEC62XX is not set
449# CONFIG_BLK_DEV_ALI15X3 is not set
450# CONFIG_BLK_DEV_AMD74XX is not set
451# CONFIG_BLK_DEV_CMD64X is not set
452# CONFIG_BLK_DEV_TRIFLEX is not set
453# CONFIG_BLK_DEV_CY82C693 is not set
454# CONFIG_BLK_DEV_CS5520 is not set
455# CONFIG_BLK_DEV_CS5530 is not set
456# CONFIG_BLK_DEV_HPT34X is not set
457# CONFIG_BLK_DEV_HPT366 is not set
458# CONFIG_BLK_DEV_SC1200 is not set
459# CONFIG_BLK_DEV_PIIX is not set
460# CONFIG_BLK_DEV_IT821X is not set
461# CONFIG_BLK_DEV_NS87415 is not set
462# CONFIG_BLK_DEV_PDC202XX_OLD is not set
463# CONFIG_BLK_DEV_PDC202XX_NEW is not set
464# CONFIG_BLK_DEV_SVWKS is not set
465CONFIG_BLK_DEV_SIIMAGE=y
466# CONFIG_BLK_DEV_SLC90E66 is not set
467# CONFIG_BLK_DEV_TRM290 is not set
468# CONFIG_BLK_DEV_VIA82CXXX is not set
469# CONFIG_IDE_ARM is not set
470CONFIG_BLK_DEV_IDEDMA=y
471# CONFIG_IDEDMA_IVB is not set
472# CONFIG_IDEDMA_AUTO is not set
473# CONFIG_BLK_DEV_HD is not set
474
475#
476# SCSI device support
477#
478# CONFIG_RAID_ATTRS is not set
479CONFIG_SCSI=y
480CONFIG_SCSI_PROC_FS=y
481
482#
483# SCSI support type (disk, tape, CD-ROM)
484#
485CONFIG_BLK_DEV_SD=y
486# CONFIG_CHR_DEV_ST is not set
487# CONFIG_CHR_DEV_OSST is not set
488# CONFIG_BLK_DEV_SR is not set
489# CONFIG_CHR_DEV_SG is not set
490# CONFIG_CHR_DEV_SCH is not set
491
492#
493# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
494#
495# CONFIG_SCSI_MULTI_LUN is not set
496# CONFIG_SCSI_CONSTANTS is not set
497# CONFIG_SCSI_LOGGING is not set
498
499#
500# SCSI Transport Attributes
501#
502# CONFIG_SCSI_SPI_ATTRS is not set
503# CONFIG_SCSI_FC_ATTRS is not set
504# CONFIG_SCSI_ISCSI_ATTRS is not set
505# CONFIG_SCSI_SAS_ATTRS is not set
506
507#
508# SCSI low-level drivers
509#
510# CONFIG_ISCSI_TCP is not set
511# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
512# CONFIG_SCSI_3W_9XXX is not set
513# CONFIG_SCSI_ACARD is not set
514# CONFIG_SCSI_AACRAID is not set
515# CONFIG_SCSI_AIC7XXX is not set
516# CONFIG_SCSI_AIC7XXX_OLD is not set
517# CONFIG_SCSI_AIC79XX is not set
518# CONFIG_SCSI_DPT_I2O is not set
519# CONFIG_MEGARAID_NEWGEN is not set
520# CONFIG_MEGARAID_LEGACY is not set
521# CONFIG_MEGARAID_SAS is not set
522# CONFIG_SCSI_SATA is not set
523# CONFIG_SCSI_DMX3191D is not set
524# CONFIG_SCSI_FUTURE_DOMAIN is not set
525# CONFIG_SCSI_IPS is not set
526# CONFIG_SCSI_INITIO is not set
527# CONFIG_SCSI_INIA100 is not set
528# CONFIG_SCSI_SYM53C8XX_2 is not set
529# CONFIG_SCSI_IPR is not set
530# CONFIG_SCSI_QLOGIC_FC is not set
531# CONFIG_SCSI_QLOGIC_1280 is not set
532# CONFIG_SCSI_QLA_FC is not set
533# CONFIG_SCSI_LPFC is not set
534# CONFIG_SCSI_DC395x is not set
535# CONFIG_SCSI_DC390T is not set
536# CONFIG_SCSI_NSP32 is not set
537# CONFIG_SCSI_DEBUG is not set
538
539#
540# Multi-device support (RAID and LVM)
541#
542# CONFIG_MD is not set
543
544#
545# Fusion MPT device support
546#
547# CONFIG_FUSION is not set
548# CONFIG_FUSION_SPI is not set
549# CONFIG_FUSION_FC is not set
550# CONFIG_FUSION_SAS is not set
551
552#
553# IEEE 1394 (FireWire) support
554#
555# CONFIG_IEEE1394 is not set
556
557#
558# I2O device support
559#
560# CONFIG_I2O is not set
561
562#
563# Network device support
564#
565CONFIG_NETDEVICES=y
566CONFIG_DUMMY=y
567# CONFIG_BONDING is not set
568# CONFIG_EQUALIZER is not set
569# CONFIG_TUN is not set
570
571#
572# ARCnet devices
573#
574# CONFIG_ARCNET is not set
575
576#
577# PHY device support
578#
579# CONFIG_PHYLIB is not set
580
581#
582# Ethernet (10 or 100Mbit)
583#
584CONFIG_NET_ETHERNET=y
585CONFIG_MII=y
586# CONFIG_HAPPYMEAL is not set
587# CONFIG_SUNGEM is not set
588# CONFIG_CASSINI is not set
589# CONFIG_NET_VENDOR_3COM is not set
590# CONFIG_SMC91X is not set
591# CONFIG_DM9000 is not set
592
593#
594# Tulip family network device support
595#
596# CONFIG_NET_TULIP is not set
597# CONFIG_HP100 is not set
598CONFIG_NET_PCI=y
599# CONFIG_PCNET32 is not set
600# CONFIG_AMD8111_ETH is not set
601# CONFIG_ADAPTEC_STARFIRE is not set
602# CONFIG_B44 is not set
603# CONFIG_FORCEDETH is not set
604# CONFIG_CS89x0 is not set
605# CONFIG_DGRS is not set
606# CONFIG_EEPRO100 is not set
607CONFIG_E100=y
608# CONFIG_FEALNX is not set
609# CONFIG_NATSEMI is not set
610# CONFIG_NE2K_PCI is not set
611# CONFIG_8139CP is not set
612# CONFIG_8139TOO is not set
613# CONFIG_SIS900 is not set
614# CONFIG_EPIC100 is not set
615# CONFIG_SUNDANCE is not set
616# CONFIG_TLAN is not set
617# CONFIG_VIA_RHINE is not set
618
619#
620# Ethernet (1000 Mbit)
621#
622# CONFIG_ACENIC is not set
623# CONFIG_DL2K is not set
624CONFIG_E1000=y
625CONFIG_E1000_NAPI=y
626# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
627# CONFIG_NS83820 is not set
628# CONFIG_HAMACHI is not set
629# CONFIG_YELLOWFIN is not set
630# CONFIG_R8169 is not set
631# CONFIG_SIS190 is not set
632# CONFIG_SKGE is not set
633# CONFIG_SKY2 is not set
634# CONFIG_SK98LIN is not set
635# CONFIG_VIA_VELOCITY is not set
636# CONFIG_TIGON3 is not set
637# CONFIG_BNX2 is not set
638
639#
640# Ethernet (10000 Mbit)
641#
642# CONFIG_CHELSIO_T1 is not set
643# CONFIG_IXGB is not set
644# CONFIG_S2IO is not set
645
646#
647# Token Ring devices
648#
649# CONFIG_TR is not set
650
651#
652# Wireless LAN (non-hamradio)
653#
654# CONFIG_NET_RADIO is not set
655
656#
657# Wan interfaces
658#
659CONFIG_WAN=y
660# CONFIG_DSCC4 is not set
661# CONFIG_LANMEDIA is not set
662# CONFIG_SYNCLINK_SYNCPPP is not set
663CONFIG_HDLC=y
664CONFIG_HDLC_RAW=y
665# CONFIG_HDLC_RAW_ETH is not set
666CONFIG_HDLC_CISCO=y
667CONFIG_HDLC_FR=y
668CONFIG_HDLC_PPP=y
669
670#
671# X.25/LAPB support is disabled
672#
673# CONFIG_PCI200SYN is not set
674# CONFIG_WANXL is not set
675# CONFIG_PC300 is not set
676# CONFIG_FARSYNC is not set
677CONFIG_DLCI=y
678CONFIG_DLCI_COUNT=24
679CONFIG_DLCI_MAX=8
680# CONFIG_FDDI is not set
681# CONFIG_HIPPI is not set
682# CONFIG_PPP is not set
683# CONFIG_SLIP is not set
684# CONFIG_NET_FC is not set
685# CONFIG_SHAPER is not set
686# CONFIG_NETCONSOLE is not set
687# CONFIG_NETPOLL is not set
688# CONFIG_NET_POLL_CONTROLLER is not set
689
690#
691# ISDN subsystem
692#
693# CONFIG_ISDN is not set
694
695#
696# Input device support
697#
698CONFIG_INPUT=y
699
700#
701# Userland interfaces
702#
703CONFIG_INPUT_MOUSEDEV=y
704CONFIG_INPUT_MOUSEDEV_PSAUX=y
705CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
706CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
707# CONFIG_INPUT_JOYDEV is not set
708# CONFIG_INPUT_TSDEV is not set
709# CONFIG_INPUT_EVDEV is not set
710# CONFIG_INPUT_EVBUG is not set
711
712#
713# Input Device Drivers
714#
715# CONFIG_INPUT_KEYBOARD is not set
716# CONFIG_INPUT_MOUSE is not set
717# CONFIG_INPUT_JOYSTICK is not set
718# CONFIG_INPUT_TOUCHSCREEN is not set
719# CONFIG_INPUT_MISC is not set
720
721#
722# Hardware I/O ports
723#
724# CONFIG_SERIO is not set
725# CONFIG_GAMEPORT is not set
726
727#
728# Character devices
729#
730# CONFIG_VT is not set
731# CONFIG_SERIAL_NONSTANDARD is not set
732
733#
734# Serial drivers
735#
736CONFIG_SERIAL_8250=y
737CONFIG_SERIAL_8250_CONSOLE=y
738CONFIG_SERIAL_8250_NR_UARTS=4
739CONFIG_SERIAL_8250_RUNTIME_UARTS=4
740# CONFIG_SERIAL_8250_EXTENDED is not set
741
742#
743# Non-8250 serial port support
744#
745CONFIG_SERIAL_CORE=y
746CONFIG_SERIAL_CORE_CONSOLE=y
747# CONFIG_SERIAL_JSM is not set
748CONFIG_UNIX98_PTYS=y
749CONFIG_LEGACY_PTYS=y
750CONFIG_LEGACY_PTY_COUNT=256
751
752#
753# IPMI
754#
755# CONFIG_IPMI_HANDLER is not set
756
757#
758# Watchdog Cards
759#
760CONFIG_WATCHDOG=y
761# CONFIG_WATCHDOG_NOWAYOUT is not set
762
763#
764# Watchdog Device Drivers
765#
766# CONFIG_SOFT_WATCHDOG is not set
767
768#
769# PCI-based Watchdog Cards
770#
771# CONFIG_PCIPCWATCHDOG is not set
772# CONFIG_WDTPCI is not set
773
774#
775# USB-based Watchdog Cards
776#
777# CONFIG_USBPCWATCHDOG is not set
778# CONFIG_NVRAM is not set
779# CONFIG_RTC is not set
780# CONFIG_DTLK is not set
781# CONFIG_R3964 is not set
782# CONFIG_APPLICOM is not set
783
784#
785# Ftape, the floppy tape device driver
786#
787# CONFIG_DRM is not set
788# CONFIG_RAW_DRIVER is not set
789
790#
791# TPM devices
792#
793# CONFIG_TCG_TPM is not set
794# CONFIG_TELCLOCK is not set
795
796#
797# I2C support
798#
799CONFIG_I2C=y
800CONFIG_I2C_CHARDEV=y
801
802#
803# I2C Algorithms
804#
805CONFIG_I2C_ALGOBIT=y
806# CONFIG_I2C_ALGOPCF is not set
807# CONFIG_I2C_ALGOPCA is not set
808
809#
810# I2C Hardware Bus support
811#
812# CONFIG_I2C_ALI1535 is not set
813# CONFIG_I2C_ALI1563 is not set
814# CONFIG_I2C_ALI15X3 is not set
815# CONFIG_I2C_AMD756 is not set
816# CONFIG_I2C_AMD8111 is not set
817# CONFIG_I2C_I801 is not set
818# CONFIG_I2C_I810 is not set
819# CONFIG_I2C_PIIX4 is not set
820# CONFIG_I2C_NFORCE2 is not set
821# CONFIG_I2C_PARPORT_LIGHT is not set
822# CONFIG_I2C_PROSAVAGE is not set
823# CONFIG_I2C_SAVAGE4 is not set
824# CONFIG_SCx200_ACB is not set
825# CONFIG_I2C_SIS5595 is not set
826# CONFIG_I2C_SIS630 is not set
827# CONFIG_I2C_SIS96X is not set
828# CONFIG_I2C_STUB is not set
829# CONFIG_I2C_VIA is not set
830# CONFIG_I2C_VIAPRO is not set
831# CONFIG_I2C_VOODOO3 is not set
832# CONFIG_I2C_PCA_ISA is not set
833
834#
835# Miscellaneous I2C Chip support
836#
837# CONFIG_SENSORS_DS1337 is not set
838# CONFIG_SENSORS_DS1374 is not set
839CONFIG_SENSORS_EEPROM=y
840# CONFIG_SENSORS_PCF8574 is not set
841# CONFIG_SENSORS_PCA9539 is not set
842# CONFIG_SENSORS_PCF8591 is not set
843# CONFIG_SENSORS_RTC8564 is not set
844# CONFIG_SENSORS_MAX6875 is not set
845# CONFIG_RTC_X1205_I2C is not set
846# CONFIG_I2C_DEBUG_CORE is not set
847# CONFIG_I2C_DEBUG_ALGO is not set
848# CONFIG_I2C_DEBUG_BUS is not set
849# CONFIG_I2C_DEBUG_CHIP is not set
850
851#
852# SPI support
853#
854# CONFIG_SPI is not set
855# CONFIG_SPI_MASTER is not set
856
857#
858# Dallas's 1-wire bus
859#
860# CONFIG_W1 is not set
861
862#
863# Hardware Monitoring support
864#
865CONFIG_HWMON=y
866# CONFIG_HWMON_VID is not set
867# CONFIG_SENSORS_ADM1021 is not set
868# CONFIG_SENSORS_ADM1025 is not set
869# CONFIG_SENSORS_ADM1026 is not set
870# CONFIG_SENSORS_ADM1031 is not set
871# CONFIG_SENSORS_ADM9240 is not set
872# CONFIG_SENSORS_ASB100 is not set
873# CONFIG_SENSORS_ATXP1 is not set
874# CONFIG_SENSORS_DS1621 is not set
875# CONFIG_SENSORS_F71805F is not set
876# CONFIG_SENSORS_FSCHER is not set
877# CONFIG_SENSORS_FSCPOS is not set
878# CONFIG_SENSORS_GL518SM is not set
879# CONFIG_SENSORS_GL520SM is not set
880# CONFIG_SENSORS_IT87 is not set
881# CONFIG_SENSORS_LM63 is not set
882# CONFIG_SENSORS_LM75 is not set
883# CONFIG_SENSORS_LM77 is not set
884# CONFIG_SENSORS_LM78 is not set
885# CONFIG_SENSORS_LM80 is not set
886# CONFIG_SENSORS_LM83 is not set
887# CONFIG_SENSORS_LM85 is not set
888# CONFIG_SENSORS_LM87 is not set
889# CONFIG_SENSORS_LM90 is not set
890# CONFIG_SENSORS_LM92 is not set
891# CONFIG_SENSORS_MAX1619 is not set
892# CONFIG_SENSORS_PC87360 is not set
893# CONFIG_SENSORS_SIS5595 is not set
894# CONFIG_SENSORS_SMSC47M1 is not set
895# CONFIG_SENSORS_SMSC47B397 is not set
896# CONFIG_SENSORS_VIA686A is not set
897# CONFIG_SENSORS_VT8231 is not set
898# CONFIG_SENSORS_W83781D is not set
899# CONFIG_SENSORS_W83792D is not set
900# CONFIG_SENSORS_W83L785TS is not set
901# CONFIG_SENSORS_W83627HF is not set
902# CONFIG_SENSORS_W83627EHF is not set
903# CONFIG_HWMON_DEBUG_CHIP is not set
904
905#
906# Misc devices
907#
908
909#
910# Multimedia Capabilities Port drivers
911#
912
913#
914# Multimedia devices
915#
916# CONFIG_VIDEO_DEV is not set
917
918#
919# Digital Video Broadcasting Devices
920#
921# CONFIG_DVB is not set
922
923#
924# Graphics support
925#
926# CONFIG_FB is not set
927
928#
929# Sound
930#
931# CONFIG_SOUND is not set
932
933#
934# USB support
935#
936CONFIG_USB_ARCH_HAS_HCD=y
937CONFIG_USB_ARCH_HAS_OHCI=y
938CONFIG_USB=y
939# CONFIG_USB_DEBUG is not set
940
941#
942# Miscellaneous USB options
943#
944# CONFIG_USB_DEVICEFS is not set
945# CONFIG_USB_BANDWIDTH is not set
946# CONFIG_USB_DYNAMIC_MINORS is not set
947# CONFIG_USB_OTG is not set
948
949#
950# USB Host Controller Drivers
951#
952CONFIG_USB_EHCI_HCD=y
953# CONFIG_USB_EHCI_SPLIT_ISO is not set
954# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
955# CONFIG_USB_ISP116X_HCD is not set
956CONFIG_USB_OHCI_HCD=y
957# CONFIG_USB_OHCI_BIG_ENDIAN is not set
958CONFIG_USB_OHCI_LITTLE_ENDIAN=y
959CONFIG_USB_UHCI_HCD=y
960# CONFIG_USB_SL811_HCD is not set
961
962#
963# USB Device Class drivers
964#
965# CONFIG_USB_ACM is not set
966# CONFIG_USB_PRINTER is not set
967
968#
969# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
970#
971
972#
973# may also be needed; see USB_STORAGE Help for more information
974#
975CONFIG_USB_STORAGE=y
976# CONFIG_USB_STORAGE_DEBUG is not set
977# CONFIG_USB_STORAGE_DATAFAB is not set
978# CONFIG_USB_STORAGE_FREECOM is not set
979# CONFIG_USB_STORAGE_ISD200 is not set
980# CONFIG_USB_STORAGE_DPCM is not set
981# CONFIG_USB_STORAGE_USBAT is not set
982# CONFIG_USB_STORAGE_SDDR09 is not set
983# CONFIG_USB_STORAGE_SDDR55 is not set
984# CONFIG_USB_STORAGE_JUMPSHOT is not set
985# CONFIG_USB_STORAGE_ALAUDA is not set
986# CONFIG_USB_LIBUSUAL is not set
987
988#
989# USB Input Devices
990#
991# CONFIG_USB_HID is not set
992
993#
994# USB HID Boot Protocol drivers
995#
996# CONFIG_USB_KBD is not set
997# CONFIG_USB_MOUSE is not set
998# CONFIG_USB_AIPTEK is not set
999# CONFIG_USB_WACOM is not set
1000# CONFIG_USB_ACECAD is not set
1001# CONFIG_USB_KBTAB is not set
1002# CONFIG_USB_POWERMATE is not set
1003# CONFIG_USB_MTOUCH is not set
1004# CONFIG_USB_ITMTOUCH is not set
1005# CONFIG_USB_EGALAX is not set
1006# CONFIG_USB_YEALINK is not set
1007# CONFIG_USB_XPAD is not set
1008# CONFIG_USB_ATI_REMOTE is not set
1009# CONFIG_USB_ATI_REMOTE2 is not set
1010# CONFIG_USB_KEYSPAN_REMOTE is not set
1011# CONFIG_USB_APPLETOUCH is not set
1012
1013#
1014# USB Imaging devices
1015#
1016# CONFIG_USB_MDC800 is not set
1017# CONFIG_USB_MICROTEK is not set
1018
1019#
1020# USB Multimedia devices
1021#
1022# CONFIG_USB_DABUSB is not set
1023
1024#
1025# Video4Linux support is needed for USB Multimedia device support
1026#
1027
1028#
1029# USB Network Adapters
1030#
1031# CONFIG_USB_CATC is not set
1032# CONFIG_USB_KAWETH is not set
1033# CONFIG_USB_PEGASUS is not set
1034# CONFIG_USB_RTL8150 is not set
1035# CONFIG_USB_USBNET is not set
1036CONFIG_USB_MON=y
1037
1038#
1039# USB port drivers
1040#
1041
1042#
1043# USB Serial Converter support
1044#
1045# CONFIG_USB_SERIAL is not set
1046
1047#
1048# USB Miscellaneous drivers
1049#
1050# CONFIG_USB_EMI62 is not set
1051# CONFIG_USB_EMI26 is not set
1052# CONFIG_USB_AUERSWALD is not set
1053# CONFIG_USB_RIO500 is not set
1054# CONFIG_USB_LEGOTOWER is not set
1055# CONFIG_USB_LCD is not set
1056# CONFIG_USB_LED is not set
1057# CONFIG_USB_CYTHERM is not set
1058# CONFIG_USB_PHIDGETKIT is not set
1059# CONFIG_USB_PHIDGETSERVO is not set
1060# CONFIG_USB_IDMOUSE is not set
1061# CONFIG_USB_SISUSBVGA is not set
1062# CONFIG_USB_LD is not set
1063
1064#
1065# USB DSL modem support
1066#
1067
1068#
1069# USB Gadget Support
1070#
1071# CONFIG_USB_GADGET is not set
1072
1073#
1074# MMC/SD Card support
1075#
1076# CONFIG_MMC is not set
1077
1078#
1079# File systems
1080#
1081CONFIG_EXT2_FS=y
1082CONFIG_EXT2_FS_XATTR=y
1083CONFIG_EXT2_FS_POSIX_ACL=y
1084# CONFIG_EXT2_FS_SECURITY is not set
1085# CONFIG_EXT2_FS_XIP is not set
1086CONFIG_EXT3_FS=y
1087CONFIG_EXT3_FS_XATTR=y
1088CONFIG_EXT3_FS_POSIX_ACL=y
1089# CONFIG_EXT3_FS_SECURITY is not set
1090CONFIG_JBD=y
1091# CONFIG_JBD_DEBUG is not set
1092CONFIG_FS_MBCACHE=y
1093# CONFIG_REISERFS_FS is not set
1094# CONFIG_JFS_FS is not set
1095CONFIG_FS_POSIX_ACL=y
1096# CONFIG_XFS_FS is not set
1097# CONFIG_OCFS2_FS is not set
1098# CONFIG_MINIX_FS is not set
1099# CONFIG_ROMFS_FS is not set
1100CONFIG_INOTIFY=y
1101# CONFIG_QUOTA is not set
1102CONFIG_DNOTIFY=y
1103# CONFIG_AUTOFS_FS is not set
1104# CONFIG_AUTOFS4_FS is not set
1105# CONFIG_FUSE_FS is not set
1106
1107#
1108# CD-ROM/DVD Filesystems
1109#
1110# CONFIG_ISO9660_FS is not set
1111# CONFIG_UDF_FS is not set
1112
1113#
1114# DOS/FAT/NT Filesystems
1115#
1116CONFIG_FAT_FS=y
1117CONFIG_MSDOS_FS=y
1118# CONFIG_VFAT_FS is not set
1119CONFIG_FAT_DEFAULT_CODEPAGE=437
1120# CONFIG_NTFS_FS is not set
1121
1122#
1123# Pseudo filesystems
1124#
1125CONFIG_PROC_FS=y
1126CONFIG_SYSFS=y
1127CONFIG_TMPFS=y
1128# CONFIG_HUGETLB_PAGE is not set
1129CONFIG_RAMFS=y
1130# CONFIG_RELAYFS_FS is not set
1131# CONFIG_CONFIGFS_FS is not set
1132
1133#
1134# Miscellaneous filesystems
1135#
1136# CONFIG_ADFS_FS is not set
1137# CONFIG_AFFS_FS is not set
1138# CONFIG_HFS_FS is not set
1139# CONFIG_HFSPLUS_FS is not set
1140# CONFIG_BEFS_FS is not set
1141# CONFIG_BFS_FS is not set
1142# CONFIG_EFS_FS is not set
1143# CONFIG_JFFS_FS is not set
1144CONFIG_JFFS2_FS=y
1145CONFIG_JFFS2_FS_DEBUG=0
1146CONFIG_JFFS2_FS_WRITEBUFFER=y
1147# CONFIG_JFFS2_SUMMARY is not set
1148# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1149CONFIG_JFFS2_ZLIB=y
1150CONFIG_JFFS2_RTIME=y
1151# CONFIG_JFFS2_RUBIN is not set
1152# CONFIG_CRAMFS is not set
1153# CONFIG_VXFS_FS is not set
1154# CONFIG_HPFS_FS is not set
1155# CONFIG_QNX4FS_FS is not set
1156# CONFIG_SYSV_FS is not set
1157# CONFIG_UFS_FS is not set
1158
1159#
1160# Network File Systems
1161#
1162CONFIG_NFS_FS=y
1163CONFIG_NFS_V3=y
1164# CONFIG_NFS_V3_ACL is not set
1165# CONFIG_NFS_V4 is not set
1166# CONFIG_NFS_DIRECTIO is not set
1167# CONFIG_NFSD is not set
1168CONFIG_ROOT_NFS=y
1169CONFIG_LOCKD=y
1170CONFIG_LOCKD_V4=y
1171CONFIG_NFS_COMMON=y
1172CONFIG_SUNRPC=y
1173# CONFIG_RPCSEC_GSS_KRB5 is not set
1174# CONFIG_RPCSEC_GSS_SPKM3 is not set
1175# CONFIG_SMB_FS is not set
1176# CONFIG_CIFS is not set
1177# CONFIG_NCP_FS is not set
1178# CONFIG_CODA_FS is not set
1179# CONFIG_AFS_FS is not set
1180# CONFIG_9P_FS is not set
1181
1182#
1183# Partition Types
1184#
1185CONFIG_PARTITION_ADVANCED=y
1186# CONFIG_ACORN_PARTITION is not set
1187# CONFIG_OSF_PARTITION is not set
1188# CONFIG_AMIGA_PARTITION is not set
1189# CONFIG_ATARI_PARTITION is not set
1190# CONFIG_MAC_PARTITION is not set
1191CONFIG_MSDOS_PARTITION=y
1192# CONFIG_BSD_DISKLABEL is not set
1193# CONFIG_MINIX_SUBPARTITION is not set
1194# CONFIG_SOLARIS_X86_PARTITION is not set
1195# CONFIG_UNIXWARE_DISKLABEL is not set
1196# CONFIG_LDM_PARTITION is not set
1197# CONFIG_SGI_PARTITION is not set
1198# CONFIG_ULTRIX_PARTITION is not set
1199# CONFIG_SUN_PARTITION is not set
1200# CONFIG_KARMA_PARTITION is not set
1201# CONFIG_EFI_PARTITION is not set
1202
1203#
1204# Native Language Support
1205#
1206CONFIG_NLS=y
1207CONFIG_NLS_DEFAULT="iso8859-1"
1208CONFIG_NLS_CODEPAGE_437=y
1209# CONFIG_NLS_CODEPAGE_737 is not set
1210# CONFIG_NLS_CODEPAGE_775 is not set
1211# CONFIG_NLS_CODEPAGE_850 is not set
1212# CONFIG_NLS_CODEPAGE_852 is not set
1213# CONFIG_NLS_CODEPAGE_855 is not set
1214# CONFIG_NLS_CODEPAGE_857 is not set
1215# CONFIG_NLS_CODEPAGE_860 is not set
1216# CONFIG_NLS_CODEPAGE_861 is not set
1217# CONFIG_NLS_CODEPAGE_862 is not set
1218# CONFIG_NLS_CODEPAGE_863 is not set
1219# CONFIG_NLS_CODEPAGE_864 is not set
1220# CONFIG_NLS_CODEPAGE_865 is not set
1221# CONFIG_NLS_CODEPAGE_866 is not set
1222# CONFIG_NLS_CODEPAGE_869 is not set
1223# CONFIG_NLS_CODEPAGE_936 is not set
1224# CONFIG_NLS_CODEPAGE_950 is not set
1225# CONFIG_NLS_CODEPAGE_932 is not set
1226# CONFIG_NLS_CODEPAGE_949 is not set
1227# CONFIG_NLS_CODEPAGE_874 is not set
1228# CONFIG_NLS_ISO8859_8 is not set
1229# CONFIG_NLS_CODEPAGE_1250 is not set
1230# CONFIG_NLS_CODEPAGE_1251 is not set
1231# CONFIG_NLS_ASCII is not set
1232# CONFIG_NLS_ISO8859_1 is not set
1233# CONFIG_NLS_ISO8859_2 is not set
1234# CONFIG_NLS_ISO8859_3 is not set
1235# CONFIG_NLS_ISO8859_4 is not set
1236# CONFIG_NLS_ISO8859_5 is not set
1237# CONFIG_NLS_ISO8859_6 is not set
1238# CONFIG_NLS_ISO8859_7 is not set
1239# CONFIG_NLS_ISO8859_9 is not set
1240# CONFIG_NLS_ISO8859_13 is not set
1241# CONFIG_NLS_ISO8859_14 is not set
1242# CONFIG_NLS_ISO8859_15 is not set
1243# CONFIG_NLS_KOI8_R is not set
1244# CONFIG_NLS_KOI8_U is not set
1245# CONFIG_NLS_UTF8 is not set
1246
1247#
1248# Profiling support
1249#
1250# CONFIG_PROFILING is not set
1251
1252#
1253# Kernel hacking
1254#
1255# CONFIG_PRINTK_TIME is not set
1256CONFIG_MAGIC_SYSRQ=y
1257CONFIG_DEBUG_KERNEL=y
1258CONFIG_LOG_BUF_SHIFT=14
1259CONFIG_DETECT_SOFTLOCKUP=y
1260# CONFIG_SCHEDSTATS is not set
1261# CONFIG_DEBUG_SLAB is not set
1262CONFIG_DEBUG_MUTEXES=y
1263# CONFIG_DEBUG_SPINLOCK is not set
1264# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1265# CONFIG_DEBUG_KOBJECT is not set
1266CONFIG_DEBUG_BUGVERBOSE=y
1267# CONFIG_DEBUG_INFO is not set
1268# CONFIG_DEBUG_FS is not set
1269# CONFIG_DEBUG_VM is not set
1270CONFIG_FRAME_POINTER=y
1271CONFIG_FORCED_INLINING=y
1272# CONFIG_RCU_TORTURE_TEST is not set
1273CONFIG_DEBUG_USER=y
1274# CONFIG_DEBUG_WAITQ is not set
1275CONFIG_DEBUG_ERRORS=y
1276CONFIG_DEBUG_LL=y
1277# CONFIG_DEBUG_ICEDCC is not set
1278
1279#
1280# Security options
1281#
1282# CONFIG_KEYS is not set
1283# CONFIG_SECURITY is not set
1284
1285#
1286# Cryptographic options
1287#
1288# CONFIG_CRYPTO is not set
1289
1290#
1291# Hardware crypto devices
1292#
1293
1294#
1295# Library routines
1296#
1297# CONFIG_CRC_CCITT is not set
1298# CONFIG_CRC16 is not set
1299CONFIG_CRC32=y
1300# CONFIG_LIBCRC32C is not set
1301CONFIG_ZLIB_INFLATE=y
1302CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 391f3ab3ff32..7b726b627ea5 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -18,7 +18,7 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
18 18
19# the code in uaccess.S is not preemption safe and 19# the code in uaccess.S is not preemption safe and
20# probably faster on ARMv3 only 20# probably faster on ARMv3 only
21ifeq ($CONFIG_PREEMPT,y) 21ifeq ($(CONFIG_PREEMPT),y)
22 lib-y += copy_from_user.o copy_to_user.o 22 lib-y += copy_from_user.o copy_to_user.o
23else 23else
24ifneq ($(CONFIG_CPU_32v3),y) 24ifneq ($(CONFIG_CPU_32v3),y)
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 838e435e4922..cab355c0c1f7 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -236,7 +236,7 @@
236 236
237 237
238/* 238/*
239 * Abort preanble and completion macros. 239 * Abort preamble and completion macros.
240 * If a fixup handler is required then those macros must surround it. 240 * If a fixup handler is required then those macros must surround it.
241 * It is assumed that the fixup code will handle the private part of 241 * It is assumed that the fixup code will handle the private part of
242 * the exit macro. 242 * the exit macro.
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 865427bfad7e..2d892e4daa07 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -30,7 +30,9 @@
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/timex.h> 31#include <linux/timex.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/termios.h>
33#include <linux/amba/bus.h> 34#include <linux/amba/bus.h>
35#include <linux/amba/serial.h>
34 36
35#include <asm/types.h> 37#include <asm/types.h>
36#include <asm/setup.h> 38#include <asm/setup.h>
@@ -360,6 +362,68 @@ void __init ep93xx_init_irq(void)
360/************************************************************************* 362/*************************************************************************
361 * EP93xx peripheral handling 363 * EP93xx peripheral handling
362 *************************************************************************/ 364 *************************************************************************/
365#define EP93XX_UART_MCR_OFFSET (0x0100)
366
367static void ep93xx_uart_set_mctrl(struct amba_device *dev,
368 void __iomem *base, unsigned int mctrl)
369{
370 unsigned int mcr;
371
372 mcr = 0;
373 if (!(mctrl & TIOCM_RTS))
374 mcr |= 2;
375 if (!(mctrl & TIOCM_DTR))
376 mcr |= 1;
377
378 __raw_writel(mcr, base + EP93XX_UART_MCR_OFFSET);
379}
380
381static struct amba_pl010_data ep93xx_uart_data = {
382 .set_mctrl = ep93xx_uart_set_mctrl,
383};
384
385static struct amba_device uart1_device = {
386 .dev = {
387 .bus_id = "apb:uart1",
388 .platform_data = &ep93xx_uart_data,
389 },
390 .res = {
391 .start = EP93XX_UART1_PHYS_BASE,
392 .end = EP93XX_UART1_PHYS_BASE + 0x0fff,
393 .flags = IORESOURCE_MEM,
394 },
395 .irq = { IRQ_EP93XX_UART1, NO_IRQ },
396 .periphid = 0x00041010,
397};
398
399static struct amba_device uart2_device = {
400 .dev = {
401 .bus_id = "apb:uart2",
402 .platform_data = &ep93xx_uart_data,
403 },
404 .res = {
405 .start = EP93XX_UART2_PHYS_BASE,
406 .end = EP93XX_UART2_PHYS_BASE + 0x0fff,
407 .flags = IORESOURCE_MEM,
408 },
409 .irq = { IRQ_EP93XX_UART2, NO_IRQ },
410 .periphid = 0x00041010,
411};
412
413static struct amba_device uart3_device = {
414 .dev = {
415 .bus_id = "apb:uart3",
416 .platform_data = &ep93xx_uart_data,
417 },
418 .res = {
419 .start = EP93XX_UART3_PHYS_BASE,
420 .end = EP93XX_UART3_PHYS_BASE + 0x0fff,
421 .flags = IORESOURCE_MEM,
422 },
423 .irq = { IRQ_EP93XX_UART3, NO_IRQ },
424 .periphid = 0x00041010,
425};
426
363void __init ep93xx_init_devices(void) 427void __init ep93xx_init_devices(void)
364{ 428{
365 unsigned int v; 429 unsigned int v;
@@ -371,4 +435,8 @@ void __init ep93xx_init_devices(void)
371 v &= ~EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE; 435 v &= ~EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE;
372 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); 436 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
373 __raw_writel(v, EP93XX_SYSCON_DEVICE_CONFIG); 437 __raw_writel(v, EP93XX_SYSCON_DEVICE_CONFIG);
438
439 amba_device_register(&uart1_device, &iomem_resource);
440 amba_device_register(&uart2_device, &iomem_resource);
441 amba_device_register(&uart3_device, &iomem_resource);
374} 442}
diff --git a/arch/arm/mach-footbridge/time.c b/arch/arm/mach-footbridge/time.c
index 2c64a0b0502e..5d02e95dede3 100644
--- a/arch/arm/mach-footbridge/time.c
+++ b/arch/arm/mach-footbridge/time.c
@@ -34,27 +34,12 @@ static int rtc_base;
34static unsigned long __init get_isa_cmos_time(void) 34static unsigned long __init get_isa_cmos_time(void)
35{ 35{
36 unsigned int year, mon, day, hour, min, sec; 36 unsigned int year, mon, day, hour, min, sec;
37 int i;
38 37
39 // check to see if the RTC makes sense..... 38 // check to see if the RTC makes sense.....
40 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0) 39 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0)
41 return mktime(1970, 1, 1, 0, 0, 0); 40 return mktime(1970, 1, 1, 0, 0, 0);
42 41
43 /* The Linux interpretation of the CMOS clock register contents: 42 do {
44 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
45 * RTC registers show the second which has precisely just started.
46 * Let's hope other operating systems interpret the RTC the same way.
47 */
48 /* read RTC exactly on falling edge of update flag */
49 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
50 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
51 break;
52
53 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
54 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
55 break;
56
57 do { /* Isn't this overkill ? UIP above should guarantee consistency */
58 sec = CMOS_READ(RTC_SECONDS); 43 sec = CMOS_READ(RTC_SECONDS);
59 min = CMOS_READ(RTC_MINUTES); 44 min = CMOS_READ(RTC_MINUTES);
60 hour = CMOS_READ(RTC_HOURS); 45 hour = CMOS_READ(RTC_HOURS);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 20071a2767cc..576a5e979c00 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -15,7 +15,9 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/termios.h>
18#include <linux/amba/bus.h> 19#include <linux/amba/bus.h>
20#include <linux/amba/serial.h>
19 21
20#include <asm/hardware.h> 22#include <asm/hardware.h>
21#include <asm/irq.h> 23#include <asm/irq.h>
@@ -28,6 +30,8 @@
28 30
29#include "common.h" 31#include "common.h"
30 32
33static struct amba_pl010_data integrator_uart_data;
34
31static struct amba_device rtc_device = { 35static struct amba_device rtc_device = {
32 .dev = { 36 .dev = {
33 .bus_id = "mb:15", 37 .bus_id = "mb:15",
@@ -44,6 +48,7 @@ static struct amba_device rtc_device = {
44static struct amba_device uart0_device = { 48static struct amba_device uart0_device = {
45 .dev = { 49 .dev = {
46 .bus_id = "mb:16", 50 .bus_id = "mb:16",
51 .platform_data = &integrator_uart_data,
47 }, 52 },
48 .res = { 53 .res = {
49 .start = INTEGRATOR_UART0_BASE, 54 .start = INTEGRATOR_UART0_BASE,
@@ -57,6 +62,7 @@ static struct amba_device uart0_device = {
57static struct amba_device uart1_device = { 62static struct amba_device uart1_device = {
58 .dev = { 63 .dev = {
59 .bus_id = "mb:17", 64 .bus_id = "mb:17",
65 .platform_data = &integrator_uart_data,
60 }, 66 },
61 .res = { 67 .res = {
62 .start = INTEGRATOR_UART1_BASE, 68 .start = INTEGRATOR_UART1_BASE,
@@ -115,6 +121,46 @@ static int __init integrator_init(void)
115 121
116arch_initcall(integrator_init); 122arch_initcall(integrator_init);
117 123
124/*
125 * On the Integrator platform, the port RTS and DTR are provided by
126 * bits in the following SC_CTRLS register bits:
127 * RTS DTR
128 * UART0 7 6
129 * UART1 5 4
130 */
131#define SC_CTRLC (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLC_OFFSET)
132#define SC_CTRLS (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLS_OFFSET)
133
134static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
135{
136 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
137
138 if (dev == &uart0_device) {
139 rts_mask = 1 << 4;
140 dtr_mask = 1 << 5;
141 } else {
142 rts_mask = 1 << 6;
143 dtr_mask = 1 << 7;
144 }
145
146 if (mctrl & TIOCM_RTS)
147 ctrlc |= rts_mask;
148 else
149 ctrls |= rts_mask;
150
151 if (mctrl & TIOCM_DTR)
152 ctrlc |= dtr_mask;
153 else
154 ctrls |= dtr_mask;
155
156 __raw_writel(ctrls, SC_CTRLS);
157 __raw_writel(ctrlc, SC_CTRLC);
158}
159
160static struct amba_pl010_data integrator_uart_data = {
161 .set_mctrl = integrator_uart_set_mctrl,
162};
163
118#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET 164#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
119 165
120static DEFINE_SPINLOCK(cm_lock); 166static DEFINE_SPINLOCK(cm_lock);
diff --git a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c
index 3c22c16b38bf..bc07f52a6fd7 100644
--- a/arch/arm/mach-integrator/time.c
+++ b/arch/arm/mach-integrator/time.c
@@ -40,13 +40,13 @@ static int integrator_set_rtc(void)
40 return 1; 40 return 1;
41} 41}
42 42
43static int rtc_read_alarm(struct rtc_wkalrm *alrm) 43static int integrator_rtc_read_alarm(struct rtc_wkalrm *alrm)
44{ 44{
45 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time); 45 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time);
46 return 0; 46 return 0;
47} 47}
48 48
49static inline int rtc_set_alarm(struct rtc_wkalrm *alrm) 49static inline int integrator_rtc_set_alarm(struct rtc_wkalrm *alrm)
50{ 50{
51 unsigned long time; 51 unsigned long time;
52 int ret; 52 int ret;
@@ -62,7 +62,7 @@ static inline int rtc_set_alarm(struct rtc_wkalrm *alrm)
62 return ret; 62 return ret;
63} 63}
64 64
65static int rtc_read_time(struct rtc_time *tm) 65static int integrator_rtc_read_time(struct rtc_time *tm)
66{ 66{
67 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm); 67 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm);
68 return 0; 68 return 0;
@@ -76,7 +76,7 @@ static int rtc_read_time(struct rtc_time *tm)
76 * edge of the 1Hz clock, we must write the time one second 76 * edge of the 1Hz clock, we must write the time one second
77 * in advance. 77 * in advance.
78 */ 78 */
79static inline int rtc_set_time(struct rtc_time *tm) 79static inline int integrator_rtc_set_time(struct rtc_time *tm)
80{ 80{
81 unsigned long time; 81 unsigned long time;
82 int ret; 82 int ret;
@@ -90,10 +90,10 @@ static inline int rtc_set_time(struct rtc_time *tm)
90 90
91static struct rtc_ops rtc_ops = { 91static struct rtc_ops rtc_ops = {
92 .owner = THIS_MODULE, 92 .owner = THIS_MODULE,
93 .read_time = rtc_read_time, 93 .read_time = integrator_rtc_read_time,
94 .set_time = rtc_set_time, 94 .set_time = integrator_rtc_set_time,
95 .read_alarm = rtc_read_alarm, 95 .read_alarm = integrator_rtc_read_alarm,
96 .set_alarm = rtc_set_alarm, 96 .set_alarm = integrator_rtc_set_alarm,
97}; 97};
98 98
99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id, 99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id,
diff --git a/arch/arm/mach-ixp23xx/Kconfig b/arch/arm/mach-ixp23xx/Kconfig
new file mode 100644
index 000000000000..982670ec3866
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/Kconfig
@@ -0,0 +1,25 @@
1if ARCH_IXP23XX
2
3config ARCH_SUPPORTS_BIG_ENDIAN
4 bool
5 default y
6
7menu "Intel IXP23xx Implementation Options"
8
9comment "IXP23xx Platforms"
10
11config MACH_ESPRESSO
12 bool "Support IP Fabrics Double Espresso platform"
13 help
14
15config MACH_IXDP2351
16 bool "Support Intel IXDP2351 platform"
17 help
18
19config MACH_ROADRUNNER
20 bool "Support ADI RoadRunner platform"
21 help
22
23endmenu
24
25endif
diff --git a/arch/arm/mach-ixp23xx/Makefile b/arch/arm/mach-ixp23xx/Makefile
new file mode 100644
index 000000000000..288b371b6d03
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the linux kernel.
3#
4obj-y := core.o pci.o
5obj-m :=
6obj-n :=
7obj- :=
8
9obj-$(CONFIG_MACH_ESPRESSO) += espresso.o
10obj-$(CONFIG_MACH_IXDP2351) += ixdp2351.o
11obj-$(CONFIG_MACH_ROADRUNNER) += roadrunner.o
diff --git a/arch/arm/mach-ixp23xx/Makefile.boot b/arch/arm/mach-ixp23xx/Makefile.boot
new file mode 100644
index 000000000000..d5561ad15bad
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/Makefile.boot
@@ -0,0 +1,2 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
new file mode 100644
index 000000000000..092ee12ced42
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -0,0 +1,431 @@
1/*
2 * arch/arm/mach-ixp23xx/core.c
3 *
4 * Core routines for IXP23xx chips
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2004 (c) Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/serial.h>
24#include <linux/tty.h>
25#include <linux/bitops.h>
26#include <linux/serial.h>
27#include <linux/serial_8250.h>
28#include <linux/serial_core.h>
29#include <linux/device.h>
30#include <linux/mm.h>
31#include <linux/time.h>
32#include <linux/timex.h>
33
34#include <asm/types.h>
35#include <asm/setup.h>
36#include <asm/memory.h>
37#include <asm/hardware.h>
38#include <asm/mach-types.h>
39#include <asm/irq.h>
40#include <asm/system.h>
41#include <asm/tlbflush.h>
42#include <asm/pgtable.h>
43
44#include <asm/mach/map.h>
45#include <asm/mach/time.h>
46#include <asm/mach/irq.h>
47#include <asm/mach/arch.h>
48
49
50/*************************************************************************
51 * Chip specific mappings shared by all IXP23xx systems
52 *************************************************************************/
53static struct map_desc ixp23xx_io_desc[] __initdata = {
54 { /* XSI-CPP CSRs */
55 .virtual = IXP23XX_XSI2CPP_CSR_VIRT,
56 .pfn = __phys_to_pfn(IXP23XX_XSI2CPP_CSR_PHYS),
57 .length = IXP23XX_XSI2CPP_CSR_SIZE,
58 .type = MT_DEVICE,
59 }, { /* Expansion Bus Config */
60 .virtual = IXP23XX_EXP_CFG_VIRT,
61 .pfn = __phys_to_pfn(IXP23XX_EXP_CFG_PHYS),
62 .length = IXP23XX_EXP_CFG_SIZE,
63 .type = MT_DEVICE,
64 }, { /* UART, Interrupt ctrl, GPIO, timers, NPEs, MACS,.... */
65 .virtual = IXP23XX_PERIPHERAL_VIRT,
66 .pfn = __phys_to_pfn(IXP23XX_PERIPHERAL_PHYS),
67 .length = IXP23XX_PERIPHERAL_SIZE,
68 .type = MT_DEVICE,
69 }, { /* CAP CSRs */
70 .virtual = IXP23XX_CAP_CSR_VIRT,
71 .pfn = __phys_to_pfn(IXP23XX_CAP_CSR_PHYS),
72 .length = IXP23XX_CAP_CSR_SIZE,
73 .type = MT_DEVICE,
74 }, { /* MSF CSRs */
75 .virtual = IXP23XX_MSF_CSR_VIRT,
76 .pfn = __phys_to_pfn(IXP23XX_MSF_CSR_PHYS),
77 .length = IXP23XX_MSF_CSR_SIZE,
78 .type = MT_DEVICE,
79 }, { /* PCI I/O Space */
80 .virtual = IXP23XX_PCI_IO_VIRT,
81 .pfn = __phys_to_pfn(IXP23XX_PCI_IO_PHYS),
82 .length = IXP23XX_PCI_IO_SIZE,
83 .type = MT_DEVICE,
84 }, { /* PCI Config Space */
85 .virtual = IXP23XX_PCI_CFG_VIRT,
86 .pfn = __phys_to_pfn(IXP23XX_PCI_CFG_PHYS),
87 .length = IXP23XX_PCI_CFG_SIZE,
88 .type = MT_DEVICE,
89 }, { /* PCI local CFG CSRs */
90 .virtual = IXP23XX_PCI_CREG_VIRT,
91 .pfn = __phys_to_pfn(IXP23XX_PCI_CREG_PHYS),
92 .length = IXP23XX_PCI_CREG_SIZE,
93 .type = MT_DEVICE,
94 }, { /* PCI MEM Space */
95 .virtual = IXP23XX_PCI_MEM_VIRT,
96 .pfn = __phys_to_pfn(IXP23XX_PCI_MEM_PHYS),
97 .length = IXP23XX_PCI_MEM_SIZE,
98 .type = MT_DEVICE,
99 }
100};
101
102void __init ixp23xx_map_io(void)
103{
104 iotable_init(ixp23xx_io_desc, ARRAY_SIZE(ixp23xx_io_desc));
105}
106
107
108/***************************************************************************
109 * IXP23xx Interrupt Handling
110 ***************************************************************************/
111enum ixp23xx_irq_type {
112 IXP23XX_IRQ_LEVEL, IXP23XX_IRQ_EDGE
113};
114
115static void ixp23xx_config_irq(unsigned int, enum ixp23xx_irq_type);
116
117static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type)
118{
119 int line = irq - IRQ_IXP23XX_GPIO6 + 6;
120 u32 int_style;
121 enum ixp23xx_irq_type irq_type;
122 volatile u32 *int_reg;
123
124 /*
125 * Only GPIOs 6-15 are wired to interrupts on IXP23xx
126 */
127 if (line < 6 || line > 15)
128 return -EINVAL;
129
130 switch (type) {
131 case IRQT_BOTHEDGE:
132 int_style = IXP23XX_GPIO_STYLE_TRANSITIONAL;
133 irq_type = IXP23XX_IRQ_EDGE;
134 break;
135 case IRQT_RISING:
136 int_style = IXP23XX_GPIO_STYLE_RISING_EDGE;
137 irq_type = IXP23XX_IRQ_EDGE;
138 break;
139 case IRQT_FALLING:
140 int_style = IXP23XX_GPIO_STYLE_FALLING_EDGE;
141 irq_type = IXP23XX_IRQ_EDGE;
142 break;
143 case IRQT_HIGH:
144 int_style = IXP23XX_GPIO_STYLE_ACTIVE_HIGH;
145 irq_type = IXP23XX_IRQ_LEVEL;
146 break;
147 case IRQT_LOW:
148 int_style = IXP23XX_GPIO_STYLE_ACTIVE_LOW;
149 irq_type = IXP23XX_IRQ_LEVEL;
150 break;
151 default:
152 return -EINVAL;
153 }
154
155 ixp23xx_config_irq(irq, irq_type);
156
157 if (line >= 8) { /* pins 8-15 */
158 line -= 8;
159 int_reg = (volatile u32 *)IXP23XX_GPIO_GPIT2R;
160 } else { /* pins 0-7 */
161 int_reg = (volatile u32 *)IXP23XX_GPIO_GPIT1R;
162 }
163
164 /*
165 * Clear pending interrupts
166 */
167 *IXP23XX_GPIO_GPISR = (1 << line);
168
169 /* Clear the style for the appropriate pin */
170 *int_reg &= ~(IXP23XX_GPIO_STYLE_MASK <<
171 (line * IXP23XX_GPIO_STYLE_SIZE));
172
173 /* Set the new style */
174 *int_reg |= (int_style << (line * IXP23XX_GPIO_STYLE_SIZE));
175
176 return 0;
177}
178
179static void ixp23xx_irq_mask(unsigned int irq)
180{
181 volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
182
183 *intr_reg &= ~(1 << (irq % 32));
184}
185
186static void ixp23xx_irq_ack(unsigned int irq)
187{
188 int line = irq - IRQ_IXP23XX_GPIO6 + 6;
189
190 if ((line < 6) || (line > 15))
191 return;
192
193 *IXP23XX_GPIO_GPISR = (1 << line);
194}
195
196/*
197 * Level triggered interrupts on GPIO lines can only be cleared when the
198 * interrupt condition disappears.
199 */
200static void ixp23xx_irq_level_unmask(unsigned int irq)
201{
202 volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
203
204 ixp23xx_irq_ack(irq);
205
206 *intr_reg |= (1 << (irq % 32));
207}
208
209static void ixp23xx_irq_edge_unmask(unsigned int irq)
210{
211 volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
212
213 *intr_reg |= (1 << (irq % 32));
214}
215
216static struct irqchip ixp23xx_irq_level_chip = {
217 .ack = ixp23xx_irq_mask,
218 .mask = ixp23xx_irq_mask,
219 .unmask = ixp23xx_irq_level_unmask,
220 .set_type = ixp23xx_irq_set_type
221};
222
223static struct irqchip ixp23xx_irq_edge_chip = {
224 .ack = ixp23xx_irq_ack,
225 .mask = ixp23xx_irq_mask,
226 .unmask = ixp23xx_irq_edge_unmask,
227 .set_type = ixp23xx_irq_set_type
228};
229
230static void ixp23xx_pci_irq_mask(unsigned int irq)
231{
232 *IXP23XX_PCI_XSCALE_INT_ENABLE &= ~(1 << (IRQ_IXP23XX_INTA + 27 - irq));
233}
234
235static void ixp23xx_pci_irq_unmask(unsigned int irq)
236{
237 *IXP23XX_PCI_XSCALE_INT_ENABLE |= (1 << (IRQ_IXP23XX_INTA + 27 - irq));
238}
239
240/*
241 * TODO: Should this just be done at ASM level?
242 */
243static void pci_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
244{
245 u32 pci_interrupt;
246 unsigned int irqno;
247 struct irqdesc *int_desc;
248
249 pci_interrupt = *IXP23XX_PCI_XSCALE_INT_STATUS;
250
251 desc->chip->ack(irq);
252
253 /* See which PCI_INTA, or PCI_INTB interrupted */
254 if (pci_interrupt & (1 << 26)) {
255 irqno = IRQ_IXP23XX_INTB;
256 } else if (pci_interrupt & (1 << 27)) {
257 irqno = IRQ_IXP23XX_INTA;
258 } else {
259 BUG();
260 }
261
262 int_desc = irq_desc + irqno;
263 int_desc->handle(irqno, int_desc, regs);
264
265 desc->chip->unmask(irq);
266}
267
268static struct irqchip ixp23xx_pci_irq_chip = {
269 .ack = ixp23xx_pci_irq_mask,
270 .mask = ixp23xx_pci_irq_mask,
271 .unmask = ixp23xx_pci_irq_unmask
272};
273
274static void ixp23xx_config_irq(unsigned int irq, enum ixp23xx_irq_type type)
275{
276 switch (type) {
277 case IXP23XX_IRQ_LEVEL:
278 set_irq_chip(irq, &ixp23xx_irq_level_chip);
279 set_irq_handler(irq, do_level_IRQ);
280 break;
281 case IXP23XX_IRQ_EDGE:
282 set_irq_chip(irq, &ixp23xx_irq_edge_chip);
283 set_irq_handler(irq, do_edge_IRQ);
284 break;
285 }
286 set_irq_flags(irq, IRQF_VALID);
287}
288
289void __init ixp23xx_init_irq(void)
290{
291 int irq;
292
293 /* Route everything to IRQ */
294 *IXP23XX_INTR_SEL1 = 0x0;
295 *IXP23XX_INTR_SEL2 = 0x0;
296 *IXP23XX_INTR_SEL3 = 0x0;
297 *IXP23XX_INTR_SEL4 = 0x0;
298
299 /* Mask all sources */
300 *IXP23XX_INTR_EN1 = 0x0;
301 *IXP23XX_INTR_EN2 = 0x0;
302 *IXP23XX_INTR_EN3 = 0x0;
303 *IXP23XX_INTR_EN4 = 0x0;
304
305 /*
306 * Configure all IRQs for level-sensitive operation
307 */
308 for (irq = 0; irq <= NUM_IXP23XX_RAW_IRQS; irq++) {
309 ixp23xx_config_irq(irq, IXP23XX_IRQ_LEVEL);
310 }
311
312 for (irq = IRQ_IXP23XX_INTA; irq <= IRQ_IXP23XX_INTB; irq++) {
313 set_irq_chip(irq, &ixp23xx_pci_irq_chip);
314 set_irq_handler(irq, do_level_IRQ);
315 set_irq_flags(irq, IRQF_VALID);
316 }
317
318 set_irq_chained_handler(IRQ_IXP23XX_PCI_INT_RPH, pci_handler);
319}
320
321
322/*************************************************************************
323 * Timer-tick functions for IXP23xx
324 *************************************************************************/
325#define CLOCK_TICKS_PER_USEC CLOCK_TICK_RATE / (USEC_PER_SEC)
326
327static unsigned long next_jiffy_time;
328
329static unsigned long
330ixp23xx_gettimeoffset(void)
331{
332 unsigned long elapsed;
333
334 elapsed = *IXP23XX_TIMER_CONT - (next_jiffy_time - LATCH);
335
336 return elapsed / CLOCK_TICKS_PER_USEC;
337}
338
339static irqreturn_t
340ixp23xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
341{
342 /* Clear Pending Interrupt by writing '1' to it */
343 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND;
344 while ((*IXP23XX_TIMER_CONT - next_jiffy_time) > LATCH) {
345 timer_tick(regs);
346 next_jiffy_time += LATCH;
347 }
348
349 return IRQ_HANDLED;
350}
351
352static struct irqaction ixp23xx_timer_irq = {
353 .name = "IXP23xx Timer Tick",
354 .handler = ixp23xx_timer_interrupt,
355 .flags = SA_INTERRUPT | SA_TIMER,
356};
357
358void __init ixp23xx_init_timer(void)
359{
360 /* Clear Pending Interrupt by writing '1' to it */
361 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND;
362
363 /* Setup the Timer counter value */
364 *IXP23XX_TIMER1_RELOAD =
365 (LATCH & ~IXP23XX_TIMER_RELOAD_MASK) | IXP23XX_TIMER_ENABLE;
366
367 *IXP23XX_TIMER_CONT = 0;
368 next_jiffy_time = LATCH;
369
370 /* Connect the interrupt handler and enable the interrupt */
371 setup_irq(IRQ_IXP23XX_TIMER1, &ixp23xx_timer_irq);
372}
373
374struct sys_timer ixp23xx_timer = {
375 .init = ixp23xx_init_timer,
376 .offset = ixp23xx_gettimeoffset,
377};
378
379
380/*************************************************************************
381 * IXP23xx Platform Initializaion
382 *************************************************************************/
383static struct resource ixp23xx_uart_resources[] = {
384 {
385 .start = IXP23XX_UART1_PHYS,
386 .end = IXP23XX_UART1_PHYS + 0x0fff,
387 .flags = IORESOURCE_MEM
388 }, {
389 .start = IXP23XX_UART2_PHYS,
390 .end = IXP23XX_UART2_PHYS + 0x0fff,
391 .flags = IORESOURCE_MEM
392 }
393};
394
395static struct plat_serial8250_port ixp23xx_uart_data[] = {
396 {
397 .mapbase = IXP23XX_UART1_PHYS,
398 .membase = (char *)(IXP23XX_UART1_VIRT + 3),
399 .irq = IRQ_IXP23XX_UART1,
400 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
401 .iotype = UPIO_MEM,
402 .regshift = 2,
403 .uartclk = IXP23XX_UART_XTAL,
404 }, {
405 .mapbase = IXP23XX_UART2_PHYS,
406 .membase = (char *)(IXP23XX_UART2_VIRT + 3),
407 .irq = IRQ_IXP23XX_UART2,
408 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
409 .iotype = UPIO_MEM,
410 .regshift = 2,
411 .uartclk = IXP23XX_UART_XTAL,
412 },
413 { },
414};
415
416static struct platform_device ixp23xx_uart = {
417 .name = "serial8250",
418 .id = 0,
419 .dev.platform_data = ixp23xx_uart_data,
420 .num_resources = 2,
421 .resource = ixp23xx_uart_resources,
422};
423
424static struct platform_device *ixp23xx_devices[] __initdata = {
425 &ixp23xx_uart,
426};
427
428void __init ixp23xx_sys_init(void)
429{
430 platform_add_devices(ixp23xx_devices, ARRAY_SIZE(ixp23xx_devices));
431}
diff --git a/arch/arm/mach-ixp23xx/espresso.c b/arch/arm/mach-ixp23xx/espresso.c
new file mode 100644
index 000000000000..2327c9790416
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/espresso.c
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/mach-ixp23xx/espresso.c
3 *
4 * Double Espresso-specific routines
5 *
6 * Author: Lennert Buytenhek <buytenh@wantstofly.org>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/config.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/spinlock.h>
17#include <linux/sched.h>
18#include <linux/interrupt.h>
19#include <linux/serial.h>
20#include <linux/tty.h>
21#include <linux/bitops.h>
22#include <linux/ioport.h>
23#include <linux/serial.h>
24#include <linux/serial_8250.h>
25#include <linux/serial_core.h>
26#include <linux/device.h>
27#include <linux/mm.h>
28#include <linux/pci.h>
29#include <linux/mtd/physmap.h>
30
31#include <asm/types.h>
32#include <asm/setup.h>
33#include <asm/memory.h>
34#include <asm/hardware.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37#include <asm/system.h>
38#include <asm/tlbflush.h>
39#include <asm/pgtable.h>
40
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43#include <asm/mach/arch.h>
44#include <asm/mach/irq.h>
45#include <asm/mach/pci.h>
46
47static void __init espresso_init(void)
48{
49 physmap_configure(0x90000000, 0x02000000, 2, NULL);
50
51 /*
52 * Mark flash as writeable.
53 */
54 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
55 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
56
57 ixp23xx_sys_init();
58}
59
60MACHINE_START(ESPRESSO, "IP Fabrics Double Espresso")
61 /* Maintainer: Lennert Buytenhek */
62 .phys_io = IXP23XX_PERIPHERAL_PHYS,
63 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
64 .map_io = ixp23xx_map_io,
65 .init_irq = ixp23xx_init_irq,
66 .timer = &ixp23xx_timer,
67 .boot_params = 0x00000100,
68 .init_machine = espresso_init,
69MACHINE_END
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
new file mode 100644
index 000000000000..00146c35daac
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -0,0 +1,325 @@
1/*
2 * arch/arm/mach-ixp23xx/ixdp2351.c
3 *
4 * IXDP2351 board-specific routines
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2004 (c) Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/serial.h>
24#include <linux/tty.h>
25#include <linux/bitops.h>
26#include <linux/ioport.h>
27#include <linux/serial.h>
28#include <linux/serial_8250.h>
29#include <linux/serial_core.h>
30#include <linux/device.h>
31#include <linux/mm.h>
32#include <linux/pci.h>
33#include <linux/mtd/physmap.h>
34
35#include <asm/types.h>
36#include <asm/setup.h>
37#include <asm/memory.h>
38#include <asm/hardware.h>
39#include <asm/mach-types.h>
40#include <asm/irq.h>
41#include <asm/system.h>
42#include <asm/tlbflush.h>
43#include <asm/pgtable.h>
44
45#include <asm/mach/map.h>
46#include <asm/mach/irq.h>
47#include <asm/mach/arch.h>
48#include <asm/mach/irq.h>
49#include <asm/mach/pci.h>
50
51/*
52 * IXDP2351 Interrupt Handling
53 */
54static void ixdp2351_inta_mask(unsigned int irq)
55{
56 *IXDP2351_CPLD_INTA_MASK_SET_REG = IXDP2351_INTA_IRQ_MASK(irq);
57}
58
59static void ixdp2351_inta_unmask(unsigned int irq)
60{
61 *IXDP2351_CPLD_INTA_MASK_CLR_REG = IXDP2351_INTA_IRQ_MASK(irq);
62}
63
64static void ixdp2351_inta_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
65{
66 u16 ex_interrupt =
67 *IXDP2351_CPLD_INTA_STAT_REG & IXDP2351_INTA_IRQ_VALID;
68 int i;
69
70 desc->chip->mask(irq);
71
72 for (i = 0; i < IXDP2351_INTA_IRQ_NUM; i++) {
73 if (ex_interrupt & (1 << i)) {
74 struct irqdesc *cpld_desc;
75 int cpld_irq =
76 IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE + i);
77 cpld_desc = irq_desc + cpld_irq;
78 cpld_desc->handle(cpld_irq, cpld_desc, regs);
79 }
80 }
81
82 desc->chip->unmask(irq);
83}
84
85static struct irqchip ixdp2351_inta_chip = {
86 .ack = ixdp2351_inta_mask,
87 .mask = ixdp2351_inta_mask,
88 .unmask = ixdp2351_inta_unmask
89};
90
91static void ixdp2351_intb_mask(unsigned int irq)
92{
93 *IXDP2351_CPLD_INTB_MASK_SET_REG = IXDP2351_INTB_IRQ_MASK(irq);
94}
95
96static void ixdp2351_intb_unmask(unsigned int irq)
97{
98 *IXDP2351_CPLD_INTB_MASK_CLR_REG = IXDP2351_INTB_IRQ_MASK(irq);
99}
100
101static void ixdp2351_intb_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
102{
103 u16 ex_interrupt =
104 *IXDP2351_CPLD_INTB_STAT_REG & IXDP2351_INTB_IRQ_VALID;
105 int i;
106
107 desc->chip->ack(irq);
108
109 for (i = 0; i < IXDP2351_INTB_IRQ_NUM; i++) {
110 if (ex_interrupt & (1 << i)) {
111 struct irqdesc *cpld_desc;
112 int cpld_irq =
113 IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE + i);
114 cpld_desc = irq_desc + cpld_irq;
115 cpld_desc->handle(cpld_irq, cpld_desc, regs);
116 }
117 }
118
119 desc->chip->unmask(irq);
120}
121
122static struct irqchip ixdp2351_intb_chip = {
123 .ack = ixdp2351_intb_mask,
124 .mask = ixdp2351_intb_mask,
125 .unmask = ixdp2351_intb_unmask
126};
127
128void ixdp2351_init_irq(void)
129{
130 int irq;
131
132 /* Mask all interrupts from CPLD, disable simulation */
133 *IXDP2351_CPLD_INTA_MASK_SET_REG = (u16) -1;
134 *IXDP2351_CPLD_INTB_MASK_SET_REG = (u16) -1;
135 *IXDP2351_CPLD_INTA_SIM_REG = 0;
136 *IXDP2351_CPLD_INTB_SIM_REG = 0;
137
138 ixp23xx_init_irq();
139
140 for (irq = IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE);
141 irq <
142 IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE + IXDP2351_INTA_IRQ_NUM);
143 irq++) {
144 if (IXDP2351_INTA_IRQ_MASK(irq) & IXDP2351_INTA_IRQ_VALID) {
145 set_irq_flags(irq, IRQF_VALID);
146 set_irq_handler(irq, do_level_IRQ);
147 set_irq_chip(irq, &ixdp2351_inta_chip);
148 }
149 }
150
151 for (irq = IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE);
152 irq <
153 IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE + IXDP2351_INTB_IRQ_NUM);
154 irq++) {
155 if (IXDP2351_INTB_IRQ_MASK(irq) & IXDP2351_INTB_IRQ_VALID) {
156 set_irq_flags(irq, IRQF_VALID);
157 set_irq_handler(irq, do_level_IRQ);
158 set_irq_chip(irq, &ixdp2351_intb_chip);
159 }
160 }
161
162 set_irq_chained_handler(IRQ_IXP23XX_INTA, &ixdp2351_inta_handler);
163 set_irq_chained_handler(IRQ_IXP23XX_INTB, &ixdp2351_intb_handler);
164}
165
166/*
167 * IXDP2351 PCI
168 */
169
170/*
171 * This board does not do normal PCI IRQ routing, or any
172 * sort of swizzling, so we just need to check where on the
173 * bus the device is and figure out what CPLD pin it is
174 * being routed to.
175 */
176#define DEVPIN(dev, pin) ((pin) | ((dev) << 3))
177
178static int __init ixdp2351_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
179{
180 u8 bus = dev->bus->number;
181 u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin);
182 struct pci_bus *tmp_bus = dev->bus;
183
184 /* Primary bus, no interrupts here */
185 if (!bus)
186 return -1;
187
188 /* Lookup first leaf in bus tree */
189 while ((tmp_bus->parent != NULL) && (tmp_bus->parent->parent != NULL))
190 tmp_bus = tmp_bus->parent;
191
192 /* Select between known bridges */
193 switch (tmp_bus->self->devfn | (tmp_bus->self->bus->number << 8)) {
194 /* Device is located after first bridge */
195 case 0x0008:
196 if (tmp_bus == dev->bus) {
197 /* Device is located directy after first bridge */
198 switch (devpin) {
199 /* Onboard 82546 */
200 case DEVPIN(1, 1): /* Onboard 82546 ch 0 */
201 return IRQ_IXDP2351_INTA_82546;
202 case DEVPIN(1, 2): /* Onboard 82546 ch 1 */
203 return IRQ_IXDP2351_INTB_82546;
204 /* PMC SLOT */
205 case DEVPIN(0, 1): /* PMCP INTA# */
206 case DEVPIN(2, 4): /* PMCS INTD# */
207 return IRQ_IXDP2351_SPCI_PMC_INTA;
208 case DEVPIN(0, 2): /* PMCP INTB# */
209 case DEVPIN(2, 1): /* PMCS INTA# */
210 return IRQ_IXDP2351_SPCI_PMC_INTB;
211 case DEVPIN(0, 3): /* PMCP INTC# */
212 case DEVPIN(2, 2): /* PMCS INTB# */
213 return IRQ_IXDP2351_SPCI_PMC_INTC;
214 case DEVPIN(0, 4): /* PMCP INTD# */
215 case DEVPIN(2, 3): /* PMCS INTC# */
216 return IRQ_IXDP2351_SPCI_PMC_INTD;
217 }
218 } else {
219 /* Device is located indirectly after first bridge */
220 /* Not supported now */
221 return -1;
222 }
223 break;
224 case 0x0010:
225 if (tmp_bus == dev->bus) {
226 /* Device is located directy after second bridge */
227 /* Secondary bus of second bridge */
228 switch (devpin) {
229 case DEVPIN(0, 1): /* DB#0 */
230 case DEVPIN(0, 2):
231 case DEVPIN(0, 3):
232 case DEVPIN(0, 4):
233 return IRQ_IXDP2351_SPCI_DB_0;
234 case DEVPIN(1, 1): /* DB#1 */
235 case DEVPIN(1, 2):
236 case DEVPIN(1, 3):
237 case DEVPIN(1, 4):
238 return IRQ_IXDP2351_SPCI_DB_1;
239 case DEVPIN(2, 1): /* FIC1 */
240 case DEVPIN(2, 2):
241 case DEVPIN(2, 3):
242 case DEVPIN(2, 4):
243 case DEVPIN(3, 1): /* FIC2 */
244 case DEVPIN(3, 2):
245 case DEVPIN(3, 3):
246 case DEVPIN(3, 4):
247 return IRQ_IXDP2351_SPCI_FIC;
248 }
249 } else {
250 /* Device is located indirectly after second bridge */
251 /* Not supported now */
252 return -1;
253 }
254 break;
255 }
256
257 return -1;
258}
259
260struct hw_pci ixdp2351_pci __initdata = {
261 .nr_controllers = 1,
262 .preinit = ixp23xx_pci_preinit,
263 .setup = ixp23xx_pci_setup,
264 .scan = ixp23xx_pci_scan_bus,
265 .map_irq = ixdp2351_map_irq,
266};
267
268int __init ixdp2351_pci_init(void)
269{
270 if (machine_is_ixdp2351())
271 pci_common_init(&ixdp2351_pci);
272
273 return 0;
274}
275
276subsys_initcall(ixdp2351_pci_init);
277
278/*
279 * IXDP2351 Static Mapped I/O
280 */
281static struct map_desc ixdp2351_io_desc[] __initdata = {
282 {
283 .virtual = IXDP2351_NP_VIRT_BASE,
284 .pfn = __phys_to_pfn((u64)IXDP2351_NP_PHYS_BASE),
285 .length = IXDP2351_NP_PHYS_SIZE,
286 .type = MT_DEVICE
287 }, {
288 .virtual = IXDP2351_BB_BASE_VIRT,
289 .pfn = __phys_to_pfn((u64)IXDP2351_BB_BASE_PHYS),
290 .length = IXDP2351_BB_SIZE,
291 .type = MT_DEVICE
292 }
293};
294
295static void __init ixdp2351_map_io(void)
296{
297 ixp23xx_map_io();
298 iotable_init(ixdp2351_io_desc, ARRAY_SIZE(ixdp2351_io_desc));
299}
300
301static void __init ixdp2351_init(void)
302{
303 physmap_configure(0x90000000, 0x04000000, 1, NULL);
304
305 /*
306 * Mark flash as writeable
307 */
308 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
309 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
310 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
311 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
312
313 ixp23xx_sys_init();
314}
315
316MACHINE_START(IXDP2351, "Intel IXDP2351 Development Platform")
317 /* Maintainer: MontaVista Software, Inc. */
318 .phys_io = IXP23XX_PERIPHERAL_PHYS,
319 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
320 .map_io = ixdp2351_map_io,
321 .init_irq = ixdp2351_init_irq,
322 .timer = &ixp23xx_timer,
323 .boot_params = 0x00000100,
324 .init_machine = ixdp2351_init,
325MACHINE_END
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c
new file mode 100644
index 000000000000..5330ad78c1bb
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/pci.c
@@ -0,0 +1,275 @@
1/*
2 * arch/arm/mach-ixp23xx/pci.c
3 *
4 * PCI routines for IXP23XX based systems
5 *
6 * Copyright (c) 2005 MontaVista Software, Inc.
7 *
8 * based on original code:
9 *
10 * Author: Naeem Afzal <naeem.m.afzal@intel.com>
11 * Copyright 2002-2005 Intel Corp.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19#include <linux/config.h>
20#include <linux/sched.h>
21#include <linux/kernel.h>
22#include <linux/pci.h>
23#include <linux/interrupt.h>
24#include <linux/mm.h>
25#include <linux/init.h>
26#include <linux/ioport.h>
27#include <linux/slab.h>
28#include <linux/delay.h>
29
30#include <asm/io.h>
31#include <asm/irq.h>
32#include <asm/sizes.h>
33#include <asm/system.h>
34#include <asm/mach/pci.h>
35#include <asm/mach-types.h>
36#include <asm/hardware.h>
37
38extern int (*external_fault) (unsigned long, struct pt_regs *);
39
40static int pci_master_aborts = 0;
41
42#ifdef DEBUG
43#define DBG(x...) printk(x)
44#else
45#define DBG(x...)
46#endif
47
48int clear_master_aborts(void);
49
50static u32
51*ixp23xx_pci_config_addr(unsigned int bus_nr, unsigned int devfn, int where)
52{
53 u32 *paddress;
54
55 /*
56 * Must be dword aligned
57 */
58 where &= ~3;
59
60 /*
61 * For top bus, generate type 0, else type 1
62 */
63 if (!bus_nr) {
64 if (PCI_SLOT(devfn) >= 8)
65 return 0;
66
67 paddress = (u32 *) (IXP23XX_PCI_CFG0_VIRT
68 | (1 << (PCI_SLOT(devfn) + 16))
69 | (PCI_FUNC(devfn) << 8) | where);
70 } else {
71 paddress = (u32 *) (IXP23XX_PCI_CFG1_VIRT
72 | (bus_nr << 16)
73 | (PCI_SLOT(devfn) << 11)
74 | (PCI_FUNC(devfn) << 8) | where);
75 }
76
77 return paddress;
78}
79
80/*
81 * Mask table, bits to mask for quantity of size 1, 2 or 4 bytes.
82 * 0 and 3 are not valid indexes...
83 */
84static u32 bytemask[] = {
85 /*0*/ 0,
86 /*1*/ 0xff,
87 /*2*/ 0xffff,
88 /*3*/ 0,
89 /*4*/ 0xffffffff,
90};
91
92static int ixp23xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
93 int where, int size, u32 *value)
94{
95 u32 n;
96 u32 *addr;
97
98 n = where % 4;
99
100 DBG("In config_read(%d) %d from dev %d:%d:%d\n", size, where,
101 bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
102
103 addr = ixp23xx_pci_config_addr(bus->number, devfn, where);
104 if (!addr)
105 return PCIBIOS_DEVICE_NOT_FOUND;
106
107 pci_master_aborts = 0;
108 *value = (*addr >> (8*n)) & bytemask[size];
109 if (pci_master_aborts) {
110 pci_master_aborts = 0;
111 *value = 0xffffffff;
112 return PCIBIOS_DEVICE_NOT_FOUND;
113 }
114
115 return PCIBIOS_SUCCESSFUL;
116}
117
118/*
119 * We don't do error checking on the address for writes.
120 * It's assumed that the user checked for the device existing first
121 * by doing a read first.
122 */
123static int ixp23xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
124 int where, int size, u32 value)
125{
126 u32 mask;
127 u32 *addr;
128 u32 temp;
129
130 mask = ~(bytemask[size] << ((where % 0x4) * 8));
131 addr = ixp23xx_pci_config_addr(bus->number, devfn, where);
132 if (!addr)
133 return PCIBIOS_DEVICE_NOT_FOUND;
134 temp = (u32) (value) << ((where % 0x4) * 8);
135 *addr = (*addr & mask) | temp;
136
137 clear_master_aborts();
138
139 return PCIBIOS_SUCCESSFUL;
140}
141
142struct pci_ops ixp23xx_pci_ops = {
143 .read = ixp23xx_pci_read_config,
144 .write = ixp23xx_pci_write_config,
145};
146
147struct pci_bus *ixp23xx_pci_scan_bus(int nr, struct pci_sys_data *sysdata)
148{
149 return pci_scan_bus(sysdata->busnr, &ixp23xx_pci_ops, sysdata);
150}
151
152int ixp23xx_pci_abort_handler(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
153{
154 volatile unsigned long temp;
155 unsigned long flags;
156
157 pci_master_aborts = 1;
158
159 local_irq_save(flags);
160 temp = *IXP23XX_PCI_CONTROL;
161
162 /*
163 * master abort and cmd tgt err
164 */
165 if (temp & ((1 << 8) | (1 << 5)))
166 *IXP23XX_PCI_CONTROL = temp;
167
168 temp = *IXP23XX_PCI_CMDSTAT;
169
170 if (temp & (1 << 29))
171 *IXP23XX_PCI_CMDSTAT = temp;
172 local_irq_restore(flags);
173
174 /*
175 * If it was an imprecise abort, then we need to correct the
176 * return address to be _after_ the instruction.
177 */
178 if (fsr & (1 << 10))
179 regs->ARM_pc += 4;
180
181 return 0;
182}
183
184int clear_master_aborts(void)
185{
186 volatile u32 temp;
187
188 temp = *IXP23XX_PCI_CONTROL;
189
190 /*
191 * master abort and cmd tgt err
192 */
193 if (temp & ((1 << 8) | (1 << 5)))
194 *IXP23XX_PCI_CONTROL = temp;
195
196 temp = *IXP23XX_PCI_CMDSTAT;
197
198 if (temp & (1 << 29))
199 *IXP23XX_PCI_CMDSTAT = temp;
200
201 return 0;
202}
203
204void __init ixp23xx_pci_preinit(void)
205{
206#ifdef __ARMEB__
207 *IXP23XX_PCI_CONTROL |= 0x20000; /* set I/O swapping */
208#endif
209 /*
210 * ADDR_31 needs to be clear for PCI memory access to CPP memory
211 */
212 *IXP23XX_CPP2XSI_CURR_XFER_REG3 &= ~IXP23XX_CPP2XSI_ADDR_31;
213 *IXP23XX_CPP2XSI_CURR_XFER_REG3 |= IXP23XX_CPP2XSI_PSH_OFF;
214
215 /*
216 * Select correct memory for PCI inbound transactions
217 */
218 if (ixp23xx_cpp_boot()) {
219 *IXP23XX_PCI_CPP_ADDR_BITS &= ~(1 << 1);
220 } else {
221 *IXP23XX_PCI_CPP_ADDR_BITS |= (1 << 1);
222 }
223
224 hook_fault_code(16+6, ixp23xx_pci_abort_handler, SIGBUS,
225 "PCI config cycle to non-existent device");
226
227 *IXP23XX_PCI_ADDR_EXT = 0x0000e000;
228}
229
230/*
231 * Prevent PCI layer from seeing the inbound host-bridge resources
232 */
233static void __devinit pci_fixup_ixp23xx(struct pci_dev *dev)
234{
235 int i;
236
237 dev->class &= 0xff;
238 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
239 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
240 dev->resource[i].start = 0;
241 dev->resource[i].end = 0;
242 dev->resource[i].flags = 0;
243 }
244}
245DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9002, pci_fixup_ixp23xx);
246
247/*
248 * IXP2300 systems often have large resource requirements, so we just
249 * use our own resource space.
250 */
251static struct resource ixp23xx_pci_mem_space = {
252 .start = IXP23XX_PCI_MEM_START,
253 .end = IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE - 1,
254 .flags = IORESOURCE_MEM,
255 .name = "PCI Mem Space"
256};
257
258static struct resource ixp23xx_pci_io_space = {
259 .start = 0x00000100,
260 .end = 0x01ffffff,
261 .flags = IORESOURCE_IO,
262 .name = "PCI I/O Space"
263};
264
265int ixp23xx_pci_setup(int nr, struct pci_sys_data *sys)
266{
267 if (nr >= 1)
268 return 0;
269
270 sys->resource[0] = &ixp23xx_pci_io_space;
271 sys->resource[1] = &ixp23xx_pci_mem_space;
272 sys->resource[2] = NULL;
273
274 return 1;
275}
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
new file mode 100644
index 000000000000..43c14e740794
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/roadrunner.c
@@ -0,0 +1,164 @@
1/*
2 * arch/arm/mach-ixp23xx/roadrunner.c
3 *
4 * RoadRunner board-specific routines
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2005 (c) ADI Engineering Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/serial.h>
24#include <linux/tty.h>
25#include <linux/bitops.h>
26#include <linux/ioport.h>
27#include <linux/serial.h>
28#include <linux/serial_8250.h>
29#include <linux/serial_core.h>
30#include <linux/device.h>
31#include <linux/mm.h>
32#include <linux/pci.h>
33#include <linux/mtd/physmap.h>
34
35#include <asm/types.h>
36#include <asm/setup.h>
37#include <asm/memory.h>
38#include <asm/hardware.h>
39#include <asm/mach-types.h>
40#include <asm/irq.h>
41#include <asm/system.h>
42#include <asm/tlbflush.h>
43#include <asm/pgtable.h>
44
45#include <asm/mach/map.h>
46#include <asm/mach/irq.h>
47#include <asm/mach/arch.h>
48#include <asm/mach/irq.h>
49#include <asm/mach/pci.h>
50
51/*
52 * Interrupt mapping
53 */
54#define INTA IRQ_ROADRUNNER_PCI_INTA
55#define INTB IRQ_ROADRUNNER_PCI_INTB
56#define INTC IRQ_ROADRUNNER_PCI_INTC
57#define INTD IRQ_ROADRUNNER_PCI_INTD
58
59#define INTC_PIN IXP23XX_GPIO_PIN_11
60#define INTD_PIN IXP23XX_GPIO_PIN_12
61
62static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
63{
64 static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
65 static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
66 static int usb_irq[] = {INTB, INTC, INTD, -1};
67 static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};
68 static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};
69
70 switch(dev->bus->number) {
71 case 0:
72 switch(dev->devfn) {
73 case 0x0: // PCI-PCI bridge
74 break;
75 case 0x8: // PCI Card Slot
76 return pci_card_slot_irq[pin - 1];
77 case 0x10: // PMC Slot
78 return pmc_card_slot_irq[pin - 1];
79 case 0x18: // PMC Slot Secondary Agent
80 break;
81 case 0x20: // IXP Processor
82 break;
83 default:
84 return NO_IRQ;
85 }
86 break;
87
88 case 1:
89 switch(dev->devfn) {
90 case 0x0: // IDE Controller
91 return (pin == 1) ? INTC : -1;
92 case 0x8: // USB fun 0
93 case 0x9: // USB fun 1
94 case 0xa: // USB fun 2
95 return usb_irq[pin - 1];
96 case 0x10: // Mini PCI 1
97 return mini_pci_1_irq[pin-1];
98 case 0x18: // Mini PCI 2
99 return mini_pci_2_irq[pin-1];
100 case 0x20: // MEM slot
101 return (pin == 1) ? INTA : -1;
102 default:
103 return NO_IRQ;
104 }
105 break;
106
107 default:
108 return NO_IRQ;
109 }
110
111 return NO_IRQ;
112}
113
114static void roadrunner_pci_preinit(void)
115{
116 set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQT_LOW);
117 set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQT_LOW);
118
119 ixp23xx_pci_preinit();
120}
121
122static struct hw_pci roadrunner_pci __initdata = {
123 .nr_controllers = 1,
124 .preinit = roadrunner_pci_preinit,
125 .setup = ixp23xx_pci_setup,
126 .scan = ixp23xx_pci_scan_bus,
127 .map_irq = roadrunner_map_irq,
128};
129
130static int __init roadrunner_pci_init(void)
131{
132 if (machine_is_roadrunner())
133 pci_common_init(&roadrunner_pci);
134
135 return 0;
136};
137
138subsys_initcall(roadrunner_pci_init);
139
140static void __init roadrunner_init(void)
141{
142 physmap_configure(0x90000000, 0x04000000, 2, NULL);
143
144 /*
145 * Mark flash as writeable
146 */
147 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
148 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
149 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
150 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
151
152 ixp23xx_sys_init();
153}
154
155MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")
156 /* Maintainer: Deepak Saxena */
157 .phys_io = IXP23XX_PERIPHERAL_PHYS,
158 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
159 .map_io = ixp23xx_map_io,
160 .init_irq = ixp23xx_init_irq,
161 .timer = &ixp23xx_timer,
162 .boot_params = 0x00000100,
163 .init_machine = roadrunner_init,
164MACHINE_END
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 60d5f8a3339c..7520e602d7a2 100644
--- a/arch/arm/mach-omap1/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -141,7 +141,7 @@ static int __init netstar_late_init(void)
141 /* TODO: Setup front panel switch here */ 141 /* TODO: Setup front panel switch here */
142 142
143 /* Setup panic notifier */ 143 /* Setup panic notifier */
144 notifier_chain_register(&panic_notifier_list, &panic_block); 144 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
145 145
146 return 0; 146 return 0;
147} 147}
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index bfd5fdd1a875..52e4a9d69642 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -235,7 +235,7 @@ static struct notifier_block panic_block = {
235static int __init voiceblue_setup(void) 235static int __init voiceblue_setup(void)
236{ 236{
237 /* Setup panic notifier */ 237 /* Setup panic notifier */
238 notifier_chain_register(&panic_notifier_list, &panic_block); 238 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
239 239
240 return 0; 240 return 0;
241} 241}
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index c1d77f5b3823..0104fd142e70 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -10,6 +10,11 @@ config ARCH_LUBBOCK
10 select PXA25x 10 select PXA25x
11 select SA1111 11 select SA1111
12 12
13config MACH_LOGICPD_PXA270
14 bool "LogicPD PXA270 Card Engine Development Platform"
15 select PXA27x
16 select IWMMXT
17
13config MACH_MAINSTONE 18config MACH_MAINSTONE
14 bool "Intel HCDDBBVA0 Development Platform" 19 bool "Intel HCDDBBVA0 Development Platform"
15 select PXA27x 20 select PXA27x
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 382644401a4d..4e8a983e2b83 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_PXA27x) += pxa27x.o
9 9
10# Specific board support 10# Specific board support
11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
12obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o
12obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 13obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
13obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 14obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
14obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o 15obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 9b48a90aefce..5efa84749f37 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -319,6 +319,11 @@ void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
319 pxaficp_device.dev.platform_data = info; 319 pxaficp_device.dev.platform_data = info;
320} 320}
321 321
322static struct platform_device pxartc_device = {
323 .name = "sa1100-rtc",
324 .id = -1,
325};
326
322static struct platform_device *devices[] __initdata = { 327static struct platform_device *devices[] __initdata = {
323 &pxamci_device, 328 &pxamci_device,
324 &udc_device, 329 &udc_device,
@@ -329,6 +334,7 @@ static struct platform_device *devices[] __initdata = {
329 &pxaficp_device, 334 &pxaficp_device,
330 &i2c_device, 335 &i2c_device,
331 &i2s_device, 336 &i2s_device,
337 &pxartc_device,
332}; 338};
333 339
334static int __init pxa_init(void) 340static int __init pxa_init(void)
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
new file mode 100644
index 000000000000..ec0f43a102c7
--- /dev/null
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -0,0 +1,393 @@
1/*
2 * linux/arch/arm/mach-pxa/lpd270.c
3 *
4 * Support for the LogicPD PXA270 Card Engine.
5 * Derived from the mainstone code, which carries these notices:
6 *
7 * Author: Nicolas Pitre
8 * Created: Nov 05, 2002
9 * Copyright: MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/sysdev.h>
19#include <linux/interrupt.h>
20#include <linux/sched.h>
21#include <linux/bitops.h>
22#include <linux/fb.h>
23#include <linux/ioport.h>
24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h>
26
27#include <asm/types.h>
28#include <asm/setup.h>
29#include <asm/memory.h>
30#include <asm/mach-types.h>
31#include <asm/hardware.h>
32#include <asm/irq.h>
33#include <asm/sizes.h>
34
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/irq.h>
38#include <asm/mach/flash.h>
39
40#include <asm/arch/pxa-regs.h>
41#include <asm/arch/lpd270.h>
42#include <asm/arch/audio.h>
43#include <asm/arch/pxafb.h>
44#include <asm/arch/mmc.h>
45#include <asm/arch/irda.h>
46#include <asm/arch/ohci.h>
47
48#include "generic.h"
49
50
51static unsigned int lpd270_irq_enabled;
52
53static void lpd270_mask_irq(unsigned int irq)
54{
55 int lpd270_irq = irq - LPD270_IRQ(0);
56
57 __raw_writew(~(1 << lpd270_irq), LPD270_INT_STATUS);
58
59 lpd270_irq_enabled &= ~(1 << lpd270_irq);
60 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
61}
62
63static void lpd270_unmask_irq(unsigned int irq)
64{
65 int lpd270_irq = irq - LPD270_IRQ(0);
66
67 lpd270_irq_enabled |= 1 << lpd270_irq;
68 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
69}
70
71static struct irqchip lpd270_irq_chip = {
72 .ack = lpd270_mask_irq,
73 .mask = lpd270_mask_irq,
74 .unmask = lpd270_unmask_irq,
75};
76
77static void lpd270_irq_handler(unsigned int irq, struct irqdesc *desc,
78 struct pt_regs *regs)
79{
80 unsigned long pending;
81
82 pending = __raw_readw(LPD270_INT_STATUS) & lpd270_irq_enabled;
83 do {
84 GEDR(0) = GPIO_bit(0); /* clear useless edge notification */
85 if (likely(pending)) {
86 irq = LPD270_IRQ(0) + __ffs(pending);
87 desc = irq_desc + irq;
88 desc_handle_irq(irq, desc, regs);
89
90 pending = __raw_readw(LPD270_INT_STATUS) &
91 lpd270_irq_enabled;
92 }
93 } while (pending);
94}
95
96static void __init lpd270_init_irq(void)
97{
98 int irq;
99
100 pxa_init_irq();
101
102 __raw_writew(0, LPD270_INT_MASK);
103 __raw_writew(0, LPD270_INT_STATUS);
104
105 /* setup extra LogicPD PXA270 irqs */
106 for (irq = LPD270_IRQ(2); irq <= LPD270_IRQ(4); irq++) {
107 set_irq_chip(irq, &lpd270_irq_chip);
108 set_irq_handler(irq, do_level_IRQ);
109 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
110 }
111 set_irq_chained_handler(IRQ_GPIO(0), lpd270_irq_handler);
112 set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
113}
114
115
116#ifdef CONFIG_PM
117static int lpd270_irq_resume(struct sys_device *dev)
118{
119 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
120 return 0;
121}
122
123static struct sysdev_class lpd270_irq_sysclass = {
124 set_kset_name("cpld_irq"),
125 .resume = lpd270_irq_resume,
126};
127
128static struct sys_device lpd270_irq_device = {
129 .cls = &lpd270_irq_sysclass,
130};
131
132static int __init lpd270_irq_device_init(void)
133{
134 int ret = sysdev_class_register(&lpd270_irq_sysclass);
135 if (ret == 0)
136 ret = sysdev_register(&lpd270_irq_device);
137 return ret;
138}
139
140device_initcall(lpd270_irq_device_init);
141#endif
142
143
144static struct resource smc91x_resources[] = {
145 [0] = {
146 .start = LPD270_ETH_PHYS,
147 .end = (LPD270_ETH_PHYS + 0xfffff),
148 .flags = IORESOURCE_MEM,
149 },
150 [1] = {
151 .start = LPD270_ETHERNET_IRQ,
152 .end = LPD270_ETHERNET_IRQ,
153 .flags = IORESOURCE_IRQ,
154 },
155};
156
157static struct platform_device smc91x_device = {
158 .name = "smc91x",
159 .id = 0,
160 .num_resources = ARRAY_SIZE(smc91x_resources),
161 .resource = smc91x_resources,
162};
163
164static struct platform_device lpd270_audio_device = {
165 .name = "pxa2xx-ac97",
166 .id = -1,
167};
168
169static struct resource lpd270_flash_resources[] = {
170 [0] = {
171 .start = PXA_CS0_PHYS,
172 .end = PXA_CS0_PHYS + SZ_64M - 1,
173 .flags = IORESOURCE_MEM,
174 },
175 [1] = {
176 .start = PXA_CS1_PHYS,
177 .end = PXA_CS1_PHYS + SZ_64M - 1,
178 .flags = IORESOURCE_MEM,
179 },
180};
181
182static struct mtd_partition lpd270_flash0_partitions[] = {
183 {
184 .name = "Bootloader",
185 .size = 0x00040000,
186 .offset = 0,
187 .mask_flags = MTD_WRITEABLE /* force read-only */
188 }, {
189 .name = "Kernel",
190 .size = 0x00400000,
191 .offset = 0x00040000,
192 }, {
193 .name = "Filesystem",
194 .size = MTDPART_SIZ_FULL,
195 .offset = 0x00440000
196 },
197};
198
199static struct flash_platform_data lpd270_flash_data[2] = {
200 {
201 .name = "processor-flash",
202 .map_name = "cfi_probe",
203 .parts = lpd270_flash0_partitions,
204 .nr_parts = ARRAY_SIZE(lpd270_flash0_partitions),
205 }, {
206 .name = "mainboard-flash",
207 .map_name = "cfi_probe",
208 .parts = NULL,
209 .nr_parts = 0,
210 }
211};
212
213static struct platform_device lpd270_flash_device[2] = {
214 {
215 .name = "pxa2xx-flash",
216 .id = 0,
217 .dev = {
218 .platform_data = &lpd270_flash_data[0],
219 },
220 .resource = &lpd270_flash_resources[0],
221 .num_resources = 1,
222 }, {
223 .name = "pxa2xx-flash",
224 .id = 1,
225 .dev = {
226 .platform_data = &lpd270_flash_data[1],
227 },
228 .resource = &lpd270_flash_resources[1],
229 .num_resources = 1,
230 },
231};
232
233static void lpd270_backlight_power(int on)
234{
235 if (on) {
236 pxa_gpio_mode(GPIO16_PWM0_MD);
237 pxa_set_cken(CKEN0_PWM0, 1);
238 PWM_CTRL0 = 0;
239 PWM_PWDUTY0 = 0x3ff;
240 PWM_PERVAL0 = 0x3ff;
241 } else {
242 PWM_CTRL0 = 0;
243 PWM_PWDUTY0 = 0x0;
244 PWM_PERVAL0 = 0x3FF;
245 pxa_set_cken(CKEN0_PWM0, 0);
246 }
247}
248
249/* 5.7" TFT QVGA (LoLo display number 1) */
250static struct pxafb_mach_info sharp_lq057q3dc02 __initdata = {
251 .pixclock = 100000,
252 .xres = 240,
253 .yres = 320,
254 .bpp = 16,
255 .hsync_len = 64,
256 .left_margin = 0x27,
257 .right_margin = 0x09,
258 .vsync_len = 0x04,
259 .upper_margin = 0x08,
260 .lower_margin = 0x14,
261 .sync = 0,
262 .lccr0 = 0x07800080,
263 .lccr3 = 0x04400007,
264 .pxafb_backlight_power = lpd270_backlight_power,
265};
266
267/* 6.4" TFT VGA (LoLo display number 5) */
268static struct pxafb_mach_info sharp_lq64d343 __initdata = {
269 .pixclock = 20000,
270 .xres = 640,
271 .yres = 480,
272 .bpp = 16,
273 .hsync_len = 49,
274 .left_margin = 0x89,
275 .right_margin = 0x19,
276 .vsync_len = 18,
277 .upper_margin = 0x22,
278 .lower_margin = 0,
279 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
280 .lccr0 = 0x07800080,
281 .lccr3 = 0x04400001,
282 .pxafb_backlight_power = lpd270_backlight_power,
283};
284
285/* 3.5" TFT QVGA (LoLo display number 8) */
286static struct pxafb_mach_info sharp_lq035q7db02_20 __initdata = {
287 .pixclock = 100000,
288 .xres = 240,
289 .yres = 320,
290 .bpp = 16,
291 .hsync_len = 0x34,
292 .left_margin = 0x09,
293 .right_margin = 0x09,
294 .vsync_len = 0x08,
295 .upper_margin = 0x05,
296 .lower_margin = 0x14,
297 .sync = 0,
298 .lccr0 = 0x07800080,
299 .lccr3 = 0x04400007,
300 .pxafb_backlight_power = lpd270_backlight_power,
301};
302
303static struct platform_device *platform_devices[] __initdata = {
304 &smc91x_device,
305 &lpd270_audio_device,
306 &lpd270_flash_device[0],
307 &lpd270_flash_device[1],
308};
309
310static int lpd270_ohci_init(struct device *dev)
311{
312 /* setup Port1 GPIO pin. */
313 pxa_gpio_mode(88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */
314 pxa_gpio_mode(89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */
315
316 /* Set the Power Control Polarity Low and Power Sense
317 Polarity Low to active low. */
318 UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
319 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
320
321 return 0;
322}
323
324static struct pxaohci_platform_data lpd270_ohci_platform_data = {
325 .port_mode = PMM_PERPORT_MODE,
326 .init = lpd270_ohci_init,
327};
328
329static void __init lpd270_init(void)
330{
331 lpd270_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4;
332 lpd270_flash_data[1].width = 4;
333
334 /*
335 * System bus arbiter setting:
336 * - Core_Park
337 * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
338 */
339 ARB_CNTRL = ARB_CORE_PARK | 0x234;
340
341 /*
342 * On LogicPD PXA270, we route AC97_SYSCLK via GPIO45.
343 */
344 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);
345
346 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
347
348 // set_pxa_fb_info(&sharp_lq057q3dc02);
349 set_pxa_fb_info(&sharp_lq64d343);
350 // set_pxa_fb_info(&sharp_lq035q7db02_20);
351
352 pxa_set_ohci_info(&lpd270_ohci_platform_data);
353}
354
355
356static struct map_desc lpd270_io_desc[] __initdata = {
357 {
358 .virtual = LPD270_CPLD_VIRT,
359 .pfn = __phys_to_pfn(LPD270_CPLD_PHYS),
360 .length = LPD270_CPLD_SIZE,
361 .type = MT_DEVICE,
362 },
363};
364
365static void __init lpd270_map_io(void)
366{
367 pxa_map_io();
368 iotable_init(lpd270_io_desc, ARRAY_SIZE(lpd270_io_desc));
369
370 /* initialize sleep mode regs (wake-up sources, etc) */
371 PGSR0 = 0x00008800;
372 PGSR1 = 0x00000002;
373 PGSR2 = 0x0001FC00;
374 PGSR3 = 0x00001F81;
375 PWER = 0xC0000002;
376 PRER = 0x00000002;
377 PFER = 0x00000002;
378
379 /* for use I SRAM as framebuffer. */
380 PSLR |= 0x00000F04;
381 PCFR = 0x00000066;
382}
383
384MACHINE_START(LOGICPD_PXA270, "LogicPD PXA270 Card Engine")
385 /* Maintainer: Peter Barada */
386 .phys_io = 0x40000000,
387 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
388 .boot_params = 0xa0000100,
389 .map_io = lpd270_map_io,
390 .init_irq = lpd270_init_irq,
391 .timer = &pxa_timer,
392 .init_machine = lpd270_init,
393MACHINE_END
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 30ec317bbb97..0dbb079ecd25 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -467,6 +467,8 @@ struct platform_device akitaioexp_device = {
467 .id = -1, 467 .id = -1,
468}; 468};
469 469
470EXPORT_SYMBOL_GPL(akitaioexp_device);
471
470static void __init akita_init(void) 472static void __init akita_init(void)
471{ 473{
472 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; 474 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index 6923316b3d0d..cd67ab1b217b 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -111,7 +111,7 @@ config SA1100_LART
111 bool "LART" 111 bool "LART"
112 help 112 help
113 Say Y here if you are using the Linux Advanced Radio Terminal 113 Say Y here if you are using the Linux Advanced Radio Terminal
114 (also known as the LART). See <http://www.lart.tudelft.nl/> for 114 (also known as the LART). See <http://www.lartmaker.nl/> for
115 information on the LART. 115 information on the LART.
116 116
117config SA1100_PLEB 117config SA1100_PLEB
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
index 6435b2e48ffa..d68630b74d78 100644
--- a/arch/arm/mach-sa1100/cpu-sa1100.c
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c
@@ -11,7 +11,7 @@
11 * linux-2.4.5-rmk1 11 * linux-2.4.5-rmk1
12 * 12 *
13 * This software has been developed while working on the LART 13 * This software has been developed while working on the LART
14 * computing board (http://www.lart.tudelft.nl/), which is 14 * computing board (http://www.lartmaker.nl/), which is
15 * sponsored by the Mobile Multi-media Communications 15 * sponsored by the Mobile Multi-media Communications
16 * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications 16 * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications
17 * (http://www.ubicom.tudelft.nl/) projects. 17 * (http://www.ubicom.tudelft.nl/) projects.
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 2abdc419e984..9ea71551fc04 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -324,6 +324,11 @@ void sa11x0_set_irda_data(struct irda_platform_data *irda)
324 sa11x0ir_device.dev.platform_data = irda; 324 sa11x0ir_device.dev.platform_data = irda;
325} 325}
326 326
327static struct platform_device sa11x0rtc_device = {
328 .name = "sa1100-rtc",
329 .id = -1,
330};
331
327static struct platform_device *sa11x0_devices[] __initdata = { 332static struct platform_device *sa11x0_devices[] __initdata = {
328 &sa11x0udc_device, 333 &sa11x0udc_device,
329 &sa11x0uart1_device, 334 &sa11x0uart1_device,
@@ -333,6 +338,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
333 &sa11x0pcmcia_device, 338 &sa11x0pcmcia_device,
334 &sa11x0fb_device, 339 &sa11x0fb_device,
335 &sa11x0mtd_device, 340 &sa11x0mtd_device,
341 &sa11x0rtc_device,
336}; 342};
337 343
338static int __init sa1100_init(void) 344static int __init sa1100_init(void)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index e680c5fd93b5..c55b739e10ba 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -239,6 +239,17 @@ config CPU_XSCALE
239 select CPU_CACHE_VIVT 239 select CPU_CACHE_VIVT
240 select CPU_TLB_V4WBI 240 select CPU_TLB_V4WBI
241 241
242# XScale Core Version 3
243config CPU_XSC3
244 bool
245 depends on ARCH_IXP23XX
246 default y
247 select CPU_32v5
248 select CPU_ABRT_EV5T
249 select CPU_CACHE_VIVT
250 select CPU_TLB_V4WBI
251 select IO_36
252
242# ARMv6 253# ARMv6
243config CPU_V6 254config CPU_V6
244 bool "Support ARM V6 processor" 255 bool "Support ARM V6 processor"
@@ -361,11 +372,17 @@ config CPU_TLB_V4WBI
361config CPU_TLB_V6 372config CPU_TLB_V6
362 bool 373 bool
363 374
375#
376# CPU supports 36-bit I/O
377#
378config IO_36
379 bool
380
364comment "Processor Features" 381comment "Processor Features"
365 382
366config ARM_THUMB 383config ARM_THUMB
367 bool "Support Thumb user binaries" 384 bool "Support Thumb user binaries"
368 depends on CPU_ARM720T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_V6 385 depends on CPU_ARM720T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_V6
369 default y 386 default y
370 help 387 help
371 Say Y if you want to include kernel support for running user space 388 Say Y if you want to include kernel support for running user space
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index ffe73ba2bf17..07a538505784 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o
30obj-$(CONFIG_CPU_COPY_V6) += copypage-v6.o mmu.o 30obj-$(CONFIG_CPU_COPY_V6) += copypage-v6.o mmu.o
31obj-$(CONFIG_CPU_SA1100) += copypage-v4mc.o 31obj-$(CONFIG_CPU_SA1100) += copypage-v4mc.o
32obj-$(CONFIG_CPU_XSCALE) += copypage-xscale.o 32obj-$(CONFIG_CPU_XSCALE) += copypage-xscale.o
33obj-$(CONFIG_CPU_XSC3) += copypage-xsc3.o
33 34
34obj-$(CONFIG_CPU_TLB_V3) += tlb-v3.o 35obj-$(CONFIG_CPU_TLB_V3) += tlb-v3.o
35obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o 36obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o
@@ -51,4 +52,5 @@ obj-$(CONFIG_CPU_ARM1026) += proc-arm1026.o
51obj-$(CONFIG_CPU_SA110) += proc-sa110.o 52obj-$(CONFIG_CPU_SA110) += proc-sa110.o
52obj-$(CONFIG_CPU_SA1100) += proc-sa1100.o 53obj-$(CONFIG_CPU_SA1100) += proc-sa1100.o
53obj-$(CONFIG_CPU_XSCALE) += proc-xscale.o 54obj-$(CONFIG_CPU_XSCALE) += proc-xscale.o
55obj-$(CONFIG_CPU_XSC3) += proc-xsc3.o
54obj-$(CONFIG_CPU_V6) += proc-v6.o 56obj-$(CONFIG_CPU_V6) += proc-v6.o
diff --git a/arch/arm/mm/copypage-xsc3.S b/arch/arm/mm/copypage-xsc3.S
new file mode 100644
index 000000000000..9a2cb4332b4c
--- /dev/null
+++ b/arch/arm/mm/copypage-xsc3.S
@@ -0,0 +1,97 @@
1/*
2 * linux/arch/arm/lib/copypage-xsc3.S
3 *
4 * Copyright (C) 2004 Intel Corp.
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 * Adapted for 3rd gen XScale core, no more mini-dcache
11 * Author: Matt Gilbert (matthew.m.gilbert@intel.com)
12 */
13
14#include <linux/linkage.h>
15#include <linux/init.h>
16#include <asm/asm-offsets.h>
17
18/*
19 * General note:
20 * We don't really want write-allocate cache behaviour for these functions
21 * since that will just eat through 8K of the cache.
22 */
23
24 .text
25 .align 5
26/*
27 * XSC3 optimised copy_user_page
28 * r0 = destination
29 * r1 = source
30 * r2 = virtual user address of ultimate destination page
31 *
32 * The source page may have some clean entries in the cache already, but we
33 * can safely ignore them - break_cow() will flush them out of the cache
34 * if we eventually end up using our copied page.
35 *
36 */
37ENTRY(xsc3_mc_copy_user_page)
38 stmfd sp!, {r4, r5, lr}
39 mov lr, #PAGE_SZ/64-1
40
41 pld [r1, #0]
42 pld [r1, #32]
431: pld [r1, #64]
44 pld [r1, #96]
45
462: ldrd r2, [r1], #8
47 mov ip, r0
48 ldrd r4, [r1], #8
49 mcr p15, 0, ip, c7, c6, 1 @ invalidate
50 strd r2, [r0], #8
51 ldrd r2, [r1], #8
52 strd r4, [r0], #8
53 ldrd r4, [r1], #8
54 strd r2, [r0], #8
55 strd r4, [r0], #8
56 ldrd r2, [r1], #8
57 mov ip, r0
58 ldrd r4, [r1], #8
59 mcr p15, 0, ip, c7, c6, 1 @ invalidate
60 strd r2, [r0], #8
61 ldrd r2, [r1], #8
62 subs lr, lr, #1
63 strd r4, [r0], #8
64 ldrd r4, [r1], #8
65 strd r2, [r0], #8
66 strd r4, [r0], #8
67 bgt 1b
68 beq 2b
69
70 ldmfd sp!, {r4, r5, pc}
71
72 .align 5
73/*
74 * XScale optimised clear_user_page
75 * r0 = destination
76 * r1 = virtual user address of ultimate destination page
77 */
78ENTRY(xsc3_mc_clear_user_page)
79 mov r1, #PAGE_SZ/32
80 mov r2, #0
81 mov r3, #0
821: mcr p15, 0, r0, c7, c6, 1 @ invalidate line
83 strd r2, [r0], #8
84 strd r2, [r0], #8
85 strd r2, [r0], #8
86 strd r2, [r0], #8
87 subs r1, r1, #1
88 bne 1b
89 mov pc, lr
90
91 __INITDATA
92
93 .type xsc3_mc_user_fns, #object
94ENTRY(xsc3_mc_user_fns)
95 .long xsc3_mc_clear_user_page
96 .long xsc3_mc_copy_user_page
97 .size xsc3_mc_user_fns, . - xsc3_mc_user_fns
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index ef8d30a185a9..5e5d05bcad50 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -557,7 +557,8 @@ void __init create_mapping(struct map_desc *md)
557 * supersections are only allocated for domain 0 regardless 557 * supersections are only allocated for domain 0 regardless
558 * of the actual domain assignments in use. 558 * of the actual domain assignments in use.
559 */ 559 */
560 if (cpu_architecture() >= CPU_ARCH_ARMv6 && domain == 0) { 560 if ((cpu_architecture() >= CPU_ARCH_ARMv6 || cpu_is_xsc3())
561 && domain == 0) {
561 /* 562 /*
562 * Align to supersection boundary if !high pages. 563 * Align to supersection boundary if !high pages.
563 * High pages have already been checked for proper 564 * High pages have already been checked for proper
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 9a7e7c096aa9..ee6f15298735 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -21,6 +21,14 @@
21 21
22#define D_CACHE_LINE_SIZE 32 22#define D_CACHE_LINE_SIZE 32
23 23
24#define TTB_C (1 << 0)
25#define TTB_S (1 << 1)
26#define TTB_IMP (1 << 2)
27#define TTB_RGN_NC (0 << 3)
28#define TTB_RGN_WBWA (1 << 3)
29#define TTB_RGN_WT (2 << 3)
30#define TTB_RGN_WB (3 << 3)
31
24 .macro cpsie, flags 32 .macro cpsie, flags
25 .ifc \flags, f 33 .ifc \flags, f
26 .long 0xf1080040 34 .long 0xf1080040
@@ -115,7 +123,7 @@ ENTRY(cpu_v6_switch_mm)
115 mov r2, #0 123 mov r2, #0
116 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id 124 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id
117#ifdef CONFIG_SMP 125#ifdef CONFIG_SMP
118 orr r0, r0, #2 @ set shared pgtable 126 orr r0, r0, #TTB_RGN_WBWA|TTB_S @ mark PTWs shared, outer cacheable
119#endif 127#endif
120 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB 128 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB
121 mcr p15, 0, r2, c7, c10, 4 @ drain write buffer 129 mcr p15, 0, r2, c7, c10, 4 @ drain write buffer
@@ -161,8 +169,8 @@ ENTRY(cpu_v6_set_pte)
161 tst r1, #L_PTE_YOUNG 169 tst r1, #L_PTE_YOUNG
162 biceq r2, r2, #PTE_EXT_APX | PTE_EXT_AP_MASK 170 biceq r2, r2, #PTE_EXT_APX | PTE_EXT_AP_MASK
163 171
164@ tst r1, #L_PTE_EXEC 172 tst r1, #L_PTE_EXEC
165@ orreq r2, r2, #PTE_EXT_XN 173 orreq r2, r2, #PTE_EXT_XN
166 174
167 tst r1, #L_PTE_PRESENT 175 tst r1, #L_PTE_PRESENT
168 moveq r2, #0 176 moveq r2, #0
@@ -221,7 +229,7 @@ __v6_setup:
221 mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs 229 mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs
222 mcr p15, 0, r0, c2, c0, 2 @ TTB control register 230 mcr p15, 0, r0, c2, c0, 2 @ TTB control register
223#ifdef CONFIG_SMP 231#ifdef CONFIG_SMP
224 orr r4, r4, #2 @ set shared pgtable 232 orr r4, r4, #TTB_RGN_WBWA|TTB_S @ mark PTWs shared, outer cacheable
225#endif 233#endif
226 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 234 mcr p15, 0, r4, c2, c0, 1 @ load TTB1
227#ifdef CONFIG_VFP 235#ifdef CONFIG_VFP
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
new file mode 100644
index 000000000000..f90513e9af0c
--- /dev/null
+++ b/arch/arm/mm/proc-xsc3.S
@@ -0,0 +1,498 @@
1/*
2 * linux/arch/arm/mm/proc-xsc3.S
3 *
4 * Original Author: Matthew Gilbert
5 * Current Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright 2004 (C) Intel Corp.
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * MMU functions for the Intel XScale3 Core (XSC3). The XSC3 core is an
15 * extension to Intel's original XScale core that adds the following
16 * features:
17 *
18 * - ARMv6 Supersections
19 * - Low Locality Reference pages (replaces mini-cache)
20 * - 36-bit addressing
21 * - L2 cache
22 * - Cache-coherency if chipset supports it
23 *
24 * Based on orignal XScale code by Nicolas Pitre
25 */
26
27#include <linux/linkage.h>
28#include <linux/init.h>
29#include <asm/assembler.h>
30#include <asm/procinfo.h>
31#include <asm/hardware.h>
32#include <asm/pgtable.h>
33#include <asm/page.h>
34#include <asm/ptrace.h>
35#include "proc-macros.S"
36
37/*
38 * This is the maximum size of an area which will be flushed. If the
39 * area is larger than this, then we flush the whole cache.
40 */
41#define MAX_AREA_SIZE 32768
42
43/*
44 * The cache line size of the I and D cache.
45 */
46#define CACHELINESIZE 32
47
48/*
49 * The size of the data cache.
50 */
51#define CACHESIZE 32768
52
53/*
54 * Run with L2 enabled.
55 */
56#define L2_CACHE_ENABLE 1
57
58/*
59 * Enable the Branch Target Buffer (can cause crashes, see erratum #42.)
60 */
61#define BTB_ENABLE 0
62
63/*
64 * This macro is used to wait for a CP15 write and is needed
65 * when we have to ensure that the last operation to the co-pro
66 * was completed before continuing with operation.
67 */
68 .macro cpwait_ret, lr, rd
69 mrc p15, 0, \rd, c2, c0, 0 @ arbitrary read of cp15
70 sub pc, \lr, \rd, LSR #32 @ wait for completion and
71 @ flush instruction pipeline
72 .endm
73
74/*
75 * This macro cleans & invalidates the entire xsc3 dcache by set & way.
76 */
77
78 .macro clean_d_cache rd, rs
79 mov \rd, #0x1f00
80 orr \rd, \rd, #0x00e0
811: mcr p15, 0, \rd, c7, c14, 2 @ clean/inv set/way
82 adds \rd, \rd, #0x40000000
83 bcc 1b
84 subs \rd, \rd, #0x20
85 bpl 1b
86 .endm
87
88 .text
89
90/*
91 * cpu_xsc3_proc_init()
92 *
93 * Nothing too exciting at the moment
94 */
95ENTRY(cpu_xsc3_proc_init)
96 mov pc, lr
97
98/*
99 * cpu_xsc3_proc_fin()
100 */
101ENTRY(cpu_xsc3_proc_fin)
102 str lr, [sp, #-4]!
103 mov r0, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
104 msr cpsr_c, r0
105 bl xsc3_flush_kern_cache_all @ clean caches
106 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
107 bic r0, r0, #0x1800 @ ...IZ...........
108 bic r0, r0, #0x0006 @ .............CA.
109 mcr p15, 0, r0, c1, c0, 0 @ disable caches
110 ldr pc, [sp], #4
111
112/*
113 * cpu_xsc3_reset(loc)
114 *
115 * Perform a soft reset of the system. Put the CPU into the
116 * same state as it would be if it had been reset, and branch
117 * to what would be the reset vector.
118 *
119 * loc: location to jump to for soft reset
120 */
121 .align 5
122ENTRY(cpu_xsc3_reset)
123 mov r1, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
124 msr cpsr_c, r1 @ reset CPSR
125 mrc p15, 0, r1, c1, c0, 0 @ ctrl register
126 bic r1, r1, #0x0086 @ ........B....CA.
127 bic r1, r1, #0x3900 @ ..VIZ..S........
128 mcr p15, 0, r1, c1, c0, 0 @ ctrl register
129 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches & BTB
130 bic r1, r1, #0x0001 @ ...............M
131 mcr p15, 0, r1, c1, c0, 0 @ ctrl register
132 @ CAUTION: MMU turned off from this point. We count on the pipeline
133 @ already containing those two last instructions to survive.
134 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
135 mov pc, r0
136
137/*
138 * cpu_xsc3_do_idle()
139 *
140 * Cause the processor to idle
141 *
142 * For now we do nothing but go to idle mode for every case
143 *
144 * XScale supports clock switching, but using idle mode support
145 * allows external hardware to react to system state changes.
146
147 MMG: Come back to this one.
148 */
149 .align 5
150
151ENTRY(cpu_xsc3_do_idle)
152 mov r0, #1
153 mcr p14, 0, r0, c7, c0, 0 @ Go to IDLE
154 mov pc, lr
155
156/* ================================= CACHE ================================ */
157
158/*
159 * flush_user_cache_all()
160 *
161 * Invalidate all cache entries in a particular address
162 * space.
163 */
164ENTRY(xsc3_flush_user_cache_all)
165 /* FALLTHROUGH */
166
167/*
168 * flush_kern_cache_all()
169 *
170 * Clean and invalidate the entire cache.
171 */
172ENTRY(xsc3_flush_kern_cache_all)
173 mov r2, #VM_EXEC
174 mov ip, #0
175__flush_whole_cache:
176 clean_d_cache r0, r1
177 tst r2, #VM_EXEC
178 mcrne p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
179 mcrne p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
180 mcrne p15, 0, ip, c7, c5, 4 @ Prefetch Flush
181 mov pc, lr
182
183/*
184 * flush_user_cache_range(start, end, vm_flags)
185 *
186 * Invalidate a range of cache entries in the specified
187 * address space.
188 *
189 * - start - start address (may not be aligned)
190 * - end - end address (exclusive, may not be aligned)
191 * - vma - vma_area_struct describing address space
192 */
193 .align 5
194ENTRY(xsc3_flush_user_cache_range)
195 mov ip, #0
196 sub r3, r1, r0 @ calculate total size
197 cmp r3, #MAX_AREA_SIZE
198 bhs __flush_whole_cache
199
2001: tst r2, #VM_EXEC
201 mcrne p15, 0, r0, c7, c5, 1 @ Invalidate I cache line
202 mcr p15, 0, r0, c7, c14, 1 @ Clean/invalidate D cache line
203 add r0, r0, #CACHELINESIZE
204 cmp r0, r1
205 blo 1b
206 tst r2, #VM_EXEC
207 mcrne p15, 0, ip, c7, c5, 6 @ Invalidate BTB
208 mcrne p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
209 mcrne p15, 0, ip, c7, c5, 4 @ Prefetch Flush
210 mov pc, lr
211
212/*
213 * coherent_kern_range(start, end)
214 *
215 * Ensure coherency between the Icache and the Dcache in the
216 * region described by start. If you have non-snooping
217 * Harvard caches, you need to implement this function.
218 *
219 * - start - virtual start address
220 * - end - virtual end address
221 *
222 * Note: single I-cache line invalidation isn't used here since
223 * it also trashes the mini I-cache used by JTAG debuggers.
224 */
225ENTRY(xsc3_coherent_kern_range)
226/* FALLTHROUGH */
227ENTRY(xsc3_coherent_user_range)
228 bic r0, r0, #CACHELINESIZE - 1
2291: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
230 add r0, r0, #CACHELINESIZE
231 cmp r0, r1
232 blo 1b
233 mov r0, #0
234 mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
235 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
236 mcr p15, 0, r0, c7, c5, 4 @ Prefetch Flush
237 mov pc, lr
238
239/*
240 * flush_kern_dcache_page(void *page)
241 *
242 * Ensure no D cache aliasing occurs, either with itself or
243 * the I cache
244 *
245 * - addr - page aligned address
246 */
247ENTRY(xsc3_flush_kern_dcache_page)
248 add r1, r0, #PAGE_SZ
2491: mcr p15, 0, r0, c7, c14, 1 @ Clean/Invalidate D Cache line
250 add r0, r0, #CACHELINESIZE
251 cmp r0, r1
252 blo 1b
253 mov r0, #0
254 mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
255 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
256 mcr p15, 0, r0, c7, c5, 4 @ Prefetch Flush
257 mov pc, lr
258
259/*
260 * dma_inv_range(start, end)
261 *
262 * Invalidate (discard) the specified virtual address range.
263 * May not write back any entries. If 'start' or 'end'
264 * are not cache line aligned, those lines must be written
265 * back.
266 *
267 * - start - virtual start address
268 * - end - virtual end address
269 */
270ENTRY(xsc3_dma_inv_range)
271 tst r0, #CACHELINESIZE - 1
272 bic r0, r0, #CACHELINESIZE - 1
273 mcrne p15, 0, r0, c7, c10, 1 @ clean L1 D entry
274 mcrne p15, 1, r0, c7, c11, 1 @ clean L2 D entry
275 tst r1, #CACHELINESIZE - 1
276 mcrne p15, 0, r1, c7, c10, 1 @ clean L1 D entry
277 mcrne p15, 1, r1, c7, c11, 1 @ clean L2 D entry
2781: mcr p15, 0, r0, c7, c6, 1 @ invalidate L1 D entry
279 mcr p15, 1, r0, c7, c7, 1 @ Invalidate L2 D cache line
280 add r0, r0, #CACHELINESIZE
281 cmp r0, r1
282 blo 1b
283 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
284 mov pc, lr
285
286/*
287 * dma_clean_range(start, end)
288 *
289 * Clean the specified virtual address range.
290 *
291 * - start - virtual start address
292 * - end - virtual end address
293 */
294ENTRY(xsc3_dma_clean_range)
295 bic r0, r0, #CACHELINESIZE - 1
2961: mcr p15, 0, r0, c7, c10, 1 @ clean L1 D entry
297 mcr p15, 1, r0, c7, c11, 1 @ clean L2 D entry
298 add r0, r0, #CACHELINESIZE
299 cmp r0, r1
300 blo 1b
301 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
302 mov pc, lr
303
304/*
305 * dma_flush_range(start, end)
306 *
307 * Clean and invalidate the specified virtual address range.
308 *
309 * - start - virtual start address
310 * - end - virtual end address
311 */
312ENTRY(xsc3_dma_flush_range)
313 bic r0, r0, #CACHELINESIZE - 1
3141: mcr p15, 0, r0, c7, c14, 1 @ Clean/invalidate L1 D cache line
315 mcr p15, 1, r0, c7, c11, 1 @ Clean L2 D cache line
316 mcr p15, 1, r0, c7, c7, 1 @ Invalidate L2 D cache line
317 add r0, r0, #CACHELINESIZE
318 cmp r0, r1
319 blo 1b
320 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
321 mov pc, lr
322
323ENTRY(xsc3_cache_fns)
324 .long xsc3_flush_kern_cache_all
325 .long xsc3_flush_user_cache_all
326 .long xsc3_flush_user_cache_range
327 .long xsc3_coherent_kern_range
328 .long xsc3_coherent_user_range
329 .long xsc3_flush_kern_dcache_page
330 .long xsc3_dma_inv_range
331 .long xsc3_dma_clean_range
332 .long xsc3_dma_flush_range
333
334ENTRY(cpu_xsc3_dcache_clean_area)
3351: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
336 add r0, r0, #CACHELINESIZE
337 subs r1, r1, #CACHELINESIZE
338 bhi 1b
339 mov pc, lr
340
341/* =============================== PageTable ============================== */
342
343/*
344 * cpu_xsc3_switch_mm(pgd)
345 *
346 * Set the translation base pointer to be as described by pgd.
347 *
348 * pgd: new page tables
349 */
350 .align 5
351ENTRY(cpu_xsc3_switch_mm)
352 clean_d_cache r1, r2
353 mcr p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
354 mcr p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
355 mcr p15, 0, ip, c7, c5, 4 @ Prefetch Flush
356#ifdef L2_CACHE_ENABLE
357 orr r0, r0, #0x18 @ cache the page table in L2
358#endif
359 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
360 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
361 cpwait_ret lr, ip
362
363/*
364 * cpu_xsc3_set_pte(ptep, pte)
365 *
366 * Set a PTE and flush it out
367 *
368 */
369 .align 5
370ENTRY(cpu_xsc3_set_pte)
371 str r1, [r0], #-2048 @ linux version
372
373 bic r2, r1, #0xff0
374 orr r2, r2, #PTE_TYPE_EXT @ extended page
375
376 eor r3, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
377
378 tst r3, #L_PTE_USER @ User?
379 orrne r2, r2, #PTE_EXT_AP_URO_SRW @ yes -> user r/o, system r/w
380
381 tst r3, #L_PTE_WRITE | L_PTE_DIRTY @ Write and Dirty?
382 orreq r2, r2, #PTE_EXT_AP_UNO_SRW @ yes -> user n/a, system r/w
383 @ combined with user -> user r/w
384
385#if L2_CACHE_ENABLE
386 @ If its cacheable it needs to be in L2 also.
387 eor ip, r1, #L_PTE_CACHEABLE
388 tst ip, #L_PTE_CACHEABLE
389 orreq r2, r2, #PTE_EXT_TEX(0x5)
390#endif
391
392 tst r3, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young?
393 movne r2, #0 @ no -> fault
394
395 str r2, [r0] @ hardware version
396 mov ip, #0
397 mcr p15, 0, r0, c7, c10, 1 @ Clean D cache line mcr
398 mcr p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
399 mov pc, lr
400
401 .ltorg
402
403 .align
404
405 __INIT
406
407 .type __xsc3_setup, #function
408__xsc3_setup:
409 mov r0, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
410 msr cpsr_c, r0
411 mcr p15, 0, ip, c7, c7, 0 @ invalidate I, D caches & BTB
412 mcr p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
413 mcr p15, 0, ip, c7, c5, 4 @ Prefetch Flush
414 mcr p15, 0, ip, c8, c7, 0 @ invalidate I, D TLBs
415#if L2_CACHE_ENABLE
416 orr r4, r4, #0x18 @ cache the page table in L2
417#endif
418 mcr p15, 0, r4, c2, c0, 0 @ load page table pointer
419 mov r0, #1 @ Allow access to CP0 and CP13
420 orr r0, r0, #1 << 13 @ Its undefined whether this
421 mcr p15, 0, r0, c15, c1, 0 @ affects USR or SVC modes
422 mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg
423 and r0, r0, #2 @ preserve bit P bit setting
424#if L2_CACHE_ENABLE
425 orr r0, r0, #(1 << 10) @ enable L2 for LLR cache
426#endif
427 mcr p15, 0, r0, c1, c0, 1 @ set auxiliary control reg
428 mrc p15, 0, r0, c1, c0, 0 @ get control register
429 bic r0, r0, #0x0200 @ .... ..R. .... ....
430 bic r0, r0, #0x0002 @ .... .... .... ..A.
431 orr r0, r0, #0x0005 @ .... .... .... .C.M
432#if BTB_ENABLE
433 orr r0, r0, #0x3900 @ ..VI Z..S .... ....
434#else
435 orr r0, r0, #0x3100 @ ..VI ...S .... ....
436#endif
437#if L2_CACHE_ENABLE
438 orr r0, r0, #0x4000000 @ L2 enable
439#endif
440 mov pc, lr
441
442 .size __xsc3_setup, . - __xsc3_setup
443
444 __INITDATA
445
446/*
447 * Purpose : Function pointers used to access above functions - all calls
448 * come through these
449 */
450
451 .type xsc3_processor_functions, #object
452ENTRY(xsc3_processor_functions)
453 .word v5t_early_abort
454 .word cpu_xsc3_proc_init
455 .word cpu_xsc3_proc_fin
456 .word cpu_xsc3_reset
457 .word cpu_xsc3_do_idle
458 .word cpu_xsc3_dcache_clean_area
459 .word cpu_xsc3_switch_mm
460 .word cpu_xsc3_set_pte
461 .size xsc3_processor_functions, . - xsc3_processor_functions
462
463 .section ".rodata"
464
465 .type cpu_arch_name, #object
466cpu_arch_name:
467 .asciz "armv5te"
468 .size cpu_arch_name, . - cpu_arch_name
469
470 .type cpu_elf_name, #object
471cpu_elf_name:
472 .asciz "v5"
473 .size cpu_elf_name, . - cpu_elf_name
474
475 .type cpu_xsc3_name, #object
476cpu_xsc3_name:
477 .asciz "XScale-Core3"
478 .size cpu_xsc3_name, . - cpu_xsc3_name
479
480 .align
481
482 .section ".proc.info.init", #alloc, #execinstr
483
484 .type __xsc3_proc_info,#object
485__xsc3_proc_info:
486 .long 0x69056000
487 .long 0xffffe000
488 .long 0x00000c0e
489 b __xsc3_setup
490 .long cpu_arch_name
491 .long cpu_elf_name
492 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
493 .long cpu_xsc3_name
494 .long xsc3_processor_functions
495 .long v4wbi_tlb_fns
496 .long xsc3_mc_user_fns
497 .long xsc3_cache_fns
498 .size __xsc3_proc_info, . - __xsc3_proc_info
diff --git a/arch/arm26/mm/init.c b/arch/arm26/mm/init.c
index e3ecaa453747..7da8a5205678 100644
--- a/arch/arm26/mm/init.c
+++ b/arch/arm26/mm/init.c
@@ -23,6 +23,7 @@
23#include <linux/initrd.h> 23#include <linux/initrd.h>
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/blkdev.h> 25#include <linux/blkdev.h>
26#include <linux/pfn.h>
26 27
27#include <asm/segment.h> 28#include <asm/segment.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -101,12 +102,6 @@ struct node_info {
101 int bootmap_pages; 102 int bootmap_pages;
102}; 103};
103 104
104#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
105#define PFN_UP(x) (PAGE_ALIGN(x) >> PAGE_SHIFT)
106#define PFN_SIZE(x) ((x) >> PAGE_SHIFT)
107#define PFN_RANGE(s,e) PFN_SIZE(PAGE_ALIGN((unsigned long)(e)) - \
108 (((unsigned long)(s)) & PAGE_MASK))
109
110/* 105/*
111 * FIXME: We really want to avoid allocating the bootmap bitmap 106 * FIXME: We really want to avoid allocating the bootmap bitmap
112 * over the top of the initrd. Hopefully, this is located towards 107 * over the top of the initrd. Hopefully, this is located towards
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 1ba57efff60d..619a6eefd893 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -18,6 +18,7 @@
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19#include <linux/tty.h> 19#include <linux/tty.h>
20#include <linux/utsname.h> 20#include <linux/utsname.h>
21#include <linux/pfn.h>
21 22
22#include <asm/setup.h> 23#include <asm/setup.h>
23 24
@@ -88,10 +89,6 @@ setup_arch(char **cmdline_p)
88 init_mm.end_data = (unsigned long) &_edata; 89 init_mm.end_data = (unsigned long) &_edata;
89 init_mm.brk = (unsigned long) &_end; 90 init_mm.brk = (unsigned long) &_end;
90 91
91#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
92#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
93#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
94
95 /* min_low_pfn points to the start of DRAM, start_pfn points 92 /* min_low_pfn points to the start of DRAM, start_pfn points
96 * to the first DRAM pages after the kernel, and max_low_pfn 93 * to the first DRAM pages after the kernel, and max_low_pfn
97 * to the end of DRAM. 94 * to the end of DRAM.
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index f7db71d0b913..f17bd1d2707e 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -231,6 +231,15 @@ config SCHED_SMT
231 cost of slightly increased overhead in some places. If unsure say 231 cost of slightly increased overhead in some places. If unsure say
232 N here. 232 N here.
233 233
234config SCHED_MC
235 bool "Multi-core scheduler support"
236 depends on SMP
237 default y
238 help
239 Multi-core scheduler support improves the CPU scheduler's decision
240 making when dealing with multi-core CPU chips at a cost of slightly
241 increased overhead in some places. If unsure say N here.
242
234source "kernel/Kconfig.preempt" 243source "kernel/Kconfig.preempt"
235 244
236config X86_UP_APIC 245config X86_UP_APIC
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 2ac40c8244c4..0000a2674537 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -1924,6 +1924,7 @@ skip10: movb %ah, %al
1924 ret 1924 ret
1925 1925
1926store_edid: 1926store_edid:
1927#ifdef CONFIG_FB_FIRMWARE_EDID
1927 pushw %es # just save all registers 1928 pushw %es # just save all registers
1928 pushw %ax 1929 pushw %ax
1929 pushw %bx 1930 pushw %bx
@@ -1954,6 +1955,7 @@ store_edid:
1954 popw %bx 1955 popw %bx
1955 popw %ax 1956 popw %ax
1956 popw %es 1957 popw %es
1958#endif
1957 ret 1959 ret
1958 1960
1959# VIDEO_SELECT-only variables 1961# VIDEO_SELECT-only variables
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 7e3d6b6a4e96..a06a49075f10 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -266,7 +266,7 @@ static void __init early_cpu_detect(void)
266void __cpuinit generic_identify(struct cpuinfo_x86 * c) 266void __cpuinit generic_identify(struct cpuinfo_x86 * c)
267{ 267{
268 u32 tfms, xlvl; 268 u32 tfms, xlvl;
269 int junk; 269 int ebx;
270 270
271 if (have_cpuid_p()) { 271 if (have_cpuid_p()) {
272 /* Get vendor name */ 272 /* Get vendor name */
@@ -282,7 +282,7 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c)
282 /* Intel-defined flags: level 0x00000001 */ 282 /* Intel-defined flags: level 0x00000001 */
283 if ( c->cpuid_level >= 0x00000001 ) { 283 if ( c->cpuid_level >= 0x00000001 ) {
284 u32 capability, excap; 284 u32 capability, excap;
285 cpuid(0x00000001, &tfms, &junk, &excap, &capability); 285 cpuid(0x00000001, &tfms, &ebx, &excap, &capability);
286 c->x86_capability[0] = capability; 286 c->x86_capability[0] = capability;
287 c->x86_capability[4] = excap; 287 c->x86_capability[4] = excap;
288 c->x86 = (tfms >> 8) & 15; 288 c->x86 = (tfms >> 8) & 15;
@@ -292,6 +292,11 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c)
292 if (c->x86 >= 0x6) 292 if (c->x86 >= 0x6)
293 c->x86_model += ((tfms >> 16) & 0xF) << 4; 293 c->x86_model += ((tfms >> 16) & 0xF) << 4;
294 c->x86_mask = tfms & 15; 294 c->x86_mask = tfms & 15;
295#ifdef CONFIG_SMP
296 c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
297#else
298 c->apicid = (ebx >> 24) & 0xFF;
299#endif
295 } else { 300 } else {
296 /* Have CPUID level 0 only - unheard of */ 301 /* Have CPUID level 0 only - unheard of */
297 c->x86 = 4; 302 c->x86 = 4;
@@ -474,7 +479,6 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
474 479
475 cpuid(1, &eax, &ebx, &ecx, &edx); 480 cpuid(1, &eax, &ebx, &ecx, &edx);
476 481
477 c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
478 482
479 if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) 483 if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
480 return; 484 return;
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 1e70823e1cb5..712a26bd4457 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -1095,10 +1095,15 @@ static int __devexit powernowk8_cpu_exit (struct cpufreq_policy *pol)
1095 1095
1096static unsigned int powernowk8_get (unsigned int cpu) 1096static unsigned int powernowk8_get (unsigned int cpu)
1097{ 1097{
1098 struct powernow_k8_data *data = powernow_data[cpu]; 1098 struct powernow_k8_data *data;
1099 cpumask_t oldmask = current->cpus_allowed; 1099 cpumask_t oldmask = current->cpus_allowed;
1100 unsigned int khz = 0; 1100 unsigned int khz = 0;
1101 1101
1102 data = powernow_data[first_cpu(cpu_core_map[cpu])];
1103
1104 if (!data)
1105 return -EINVAL;
1106
1102 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 1107 set_cpus_allowed(current, cpumask_of_cpu(cpu));
1103 if (smp_processor_id() != cpu) { 1108 if (smp_processor_id() != cpu) {
1104 printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); 1109 printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu);
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index 00ea899c17e1..79a7c5c87edc 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -182,10 +182,6 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid);
182 182
183static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); 183static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index);
184 184
185#ifndef for_each_cpu_mask
186#define for_each_cpu_mask(i,mask) for (i=0;i<1;i++)
187#endif
188
189#ifdef CONFIG_SMP 185#ifdef CONFIG_SMP
190static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) 186static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[])
191{ 187{
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c
index ce61921369e5..9df87b03612c 100644
--- a/arch/i386/kernel/cpu/intel_cacheinfo.c
+++ b/arch/i386/kernel/cpu/intel_cacheinfo.c
@@ -173,6 +173,10 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
173 unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */ 173 unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
174 unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */ 174 unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
175 unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ 175 unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
176 unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
177#ifdef CONFIG_SMP
178 unsigned int cpu = (c == &boot_cpu_data) ? 0 : (c - cpu_data);
179#endif
176 180
177 if (c->cpuid_level > 3) { 181 if (c->cpuid_level > 3) {
178 static int is_initialized; 182 static int is_initialized;
@@ -205,9 +209,15 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
205 break; 209 break;
206 case 2: 210 case 2:
207 new_l2 = this_leaf.size/1024; 211 new_l2 = this_leaf.size/1024;
212 num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
213 index_msb = get_count_order(num_threads_sharing);
214 l2_id = c->apicid >> index_msb;
208 break; 215 break;
209 case 3: 216 case 3:
210 new_l3 = this_leaf.size/1024; 217 new_l3 = this_leaf.size/1024;
218 num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
219 index_msb = get_count_order(num_threads_sharing);
220 l3_id = c->apicid >> index_msb;
211 break; 221 break;
212 default: 222 default:
213 break; 223 break;
@@ -215,11 +225,19 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
215 } 225 }
216 } 226 }
217 } 227 }
218 if (c->cpuid_level > 1) { 228 /*
229 * Don't use cpuid2 if cpuid4 is supported. For P4, we use cpuid2 for
230 * trace cache
231 */
232 if ((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1) {
219 /* supports eax=2 call */ 233 /* supports eax=2 call */
220 int i, j, n; 234 int i, j, n;
221 int regs[4]; 235 int regs[4];
222 unsigned char *dp = (unsigned char *)regs; 236 unsigned char *dp = (unsigned char *)regs;
237 int only_trace = 0;
238
239 if (num_cache_leaves != 0 && c->x86 == 15)
240 only_trace = 1;
223 241
224 /* Number of times to iterate */ 242 /* Number of times to iterate */
225 n = cpuid_eax(2) & 0xFF; 243 n = cpuid_eax(2) & 0xFF;
@@ -241,6 +259,8 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
241 while (cache_table[k].descriptor != 0) 259 while (cache_table[k].descriptor != 0)
242 { 260 {
243 if (cache_table[k].descriptor == des) { 261 if (cache_table[k].descriptor == des) {
262 if (only_trace && cache_table[k].cache_type != LVL_TRACE)
263 break;
244 switch (cache_table[k].cache_type) { 264 switch (cache_table[k].cache_type) {
245 case LVL_1_INST: 265 case LVL_1_INST:
246 l1i += cache_table[k].size; 266 l1i += cache_table[k].size;
@@ -266,34 +286,45 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
266 } 286 }
267 } 287 }
268 } 288 }
289 }
269 290
270 if (new_l1d) 291 if (new_l1d)
271 l1d = new_l1d; 292 l1d = new_l1d;
272 293
273 if (new_l1i) 294 if (new_l1i)
274 l1i = new_l1i; 295 l1i = new_l1i;
275 296
276 if (new_l2) 297 if (new_l2) {
277 l2 = new_l2; 298 l2 = new_l2;
299#ifdef CONFIG_SMP
300 cpu_llc_id[cpu] = l2_id;
301#endif
302 }
278 303
279 if (new_l3) 304 if (new_l3) {
280 l3 = new_l3; 305 l3 = new_l3;
306#ifdef CONFIG_SMP
307 cpu_llc_id[cpu] = l3_id;
308#endif
309 }
281 310
282 if ( trace ) 311 if (trace)
283 printk (KERN_INFO "CPU: Trace cache: %dK uops", trace); 312 printk (KERN_INFO "CPU: Trace cache: %dK uops", trace);
284 else if ( l1i ) 313 else if ( l1i )
285 printk (KERN_INFO "CPU: L1 I cache: %dK", l1i); 314 printk (KERN_INFO "CPU: L1 I cache: %dK", l1i);
286 if ( l1d )
287 printk(", L1 D cache: %dK\n", l1d);
288 else
289 printk("\n");
290 if ( l2 )
291 printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);
292 if ( l3 )
293 printk(KERN_INFO "CPU: L3 cache: %dK\n", l3);
294 315
295 c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d)); 316 if (l1d)
296 } 317 printk(", L1 D cache: %dK\n", l1d);
318 else
319 printk("\n");
320
321 if (l2)
322 printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);
323
324 if (l3)
325 printk(KERN_INFO "CPU: L3 cache: %dK\n", l3);
326
327 c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d));
297 328
298 return l2; 329 return l2;
299} 330}
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 311b4e7266f1..3b329af4afc5 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -381,7 +381,7 @@ static void do_irq_balance(void)
381 unsigned long imbalance = 0; 381 unsigned long imbalance = 0;
382 cpumask_t allowed_mask, target_cpu_mask, tmp; 382 cpumask_t allowed_mask, target_cpu_mask, tmp;
383 383
384 for_each_cpu(i) { 384 for_each_possible_cpu(i) {
385 int package_index; 385 int package_index;
386 CPU_IRQ(i) = 0; 386 CPU_IRQ(i) = 0;
387 if (!cpu_online(i)) 387 if (!cpu_online(i))
@@ -632,7 +632,7 @@ static int __init balanced_irq_init(void)
632 else 632 else
633 printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq"); 633 printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq");
634failed: 634failed:
635 for_each_cpu(i) { 635 for_each_possible_cpu(i) {
636 kfree(irq_cpu_data[i].irq_delta); 636 kfree(irq_cpu_data[i].irq_delta);
637 irq_cpu_data[i].irq_delta = NULL; 637 irq_cpu_data[i].irq_delta = NULL;
638 kfree(irq_cpu_data[i].last_irq); 638 kfree(irq_cpu_data[i].last_irq);
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index dd780a00553f..e7c138f66c5a 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -459,26 +459,9 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
459 return ret; 459 return ret;
460} 460}
461 461
462static int microcode_ioctl (struct inode *inode, struct file *file,
463 unsigned int cmd, unsigned long arg)
464{
465 switch (cmd) {
466 /*
467 * XXX: will be removed after microcode_ctl
468 * is updated to ignore failure of this ioctl()
469 */
470 case MICROCODE_IOCFREE:
471 return 0;
472 default:
473 return -EINVAL;
474 }
475 return -EINVAL;
476}
477
478static struct file_operations microcode_fops = { 462static struct file_operations microcode_fops = {
479 .owner = THIS_MODULE, 463 .owner = THIS_MODULE,
480 .write = microcode_write, 464 .write = microcode_write,
481 .ioctl = microcode_ioctl,
482 .open = microcode_open, 465 .open = microcode_open,
483}; 466};
484 467
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 9074818b9473..d43b498ec745 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -138,12 +138,12 @@ static int __init check_nmi_watchdog(void)
138 if (nmi_watchdog == NMI_LOCAL_APIC) 138 if (nmi_watchdog == NMI_LOCAL_APIC)
139 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); 139 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
140 140
141 for_each_cpu(cpu) 141 for_each_possible_cpu(cpu)
142 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; 142 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
143 local_irq_enable(); 143 local_irq_enable();
144 mdelay((10*1000)/nmi_hz); // wait 10 ticks 144 mdelay((10*1000)/nmi_hz); // wait 10 ticks
145 145
146 for_each_cpu(cpu) { 146 for_each_possible_cpu(cpu) {
147#ifdef CONFIG_SMP 147#ifdef CONFIG_SMP
148 /* Check cpu_callin_map here because that is set 148 /* Check cpu_callin_map here because that is set
149 after the timer is started. */ 149 after the timer is started. */
@@ -510,7 +510,7 @@ void touch_nmi_watchdog (void)
510 * Just reset the alert counters, (other CPUs might be 510 * Just reset the alert counters, (other CPUs might be
511 * spinning on locks we hold): 511 * spinning on locks we hold):
512 */ 512 */
513 for_each_cpu(i) 513 for_each_possible_cpu(i)
514 alert_counter[i] = 0; 514 alert_counter[i] = 0;
515 515
516 /* 516 /*
@@ -529,7 +529,8 @@ void nmi_watchdog_tick (struct pt_regs * regs)
529 * always switch the stack NMI-atomically, it's safe to use 529 * always switch the stack NMI-atomically, it's safe to use
530 * smp_processor_id(). 530 * smp_processor_id().
531 */ 531 */
532 int sum, cpu = smp_processor_id(); 532 unsigned int sum;
533 int cpu = smp_processor_id();
533 534
534 sum = per_cpu(irq_stat, cpu).apic_timer_irqs; 535 sum = per_cpu(irq_stat, cpu).apic_timer_irqs;
535 536
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 6917daa159ab..8c08660b4e5d 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -46,6 +46,7 @@
46#include <linux/kexec.h> 46#include <linux/kexec.h>
47#include <linux/crash_dump.h> 47#include <linux/crash_dump.h>
48#include <linux/dmi.h> 48#include <linux/dmi.h>
49#include <linux/pfn.h>
49 50
50#include <video/edid.h> 51#include <video/edid.h>
51 52
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 82371d83bfa9..a6969903f2d6 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -72,6 +72,9 @@ int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
72/* Core ID of each logical CPU */ 72/* Core ID of each logical CPU */
73int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; 73int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
74 74
75/* Last level cache ID of each logical CPU */
76int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
77
75/* representing HT siblings of each logical CPU */ 78/* representing HT siblings of each logical CPU */
76cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 79cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;
77EXPORT_SYMBOL(cpu_sibling_map); 80EXPORT_SYMBOL(cpu_sibling_map);
@@ -440,6 +443,18 @@ static void __devinit smp_callin(void)
440 443
441static int cpucount; 444static int cpucount;
442 445
446/* maps the cpu to the sched domain representing multi-core */
447cpumask_t cpu_coregroup_map(int cpu)
448{
449 struct cpuinfo_x86 *c = cpu_data + cpu;
450 /*
451 * For perf, we return last level cache shared map.
452 * TBD: when power saving sched policy is added, we will return
453 * cpu_core_map when power saving policy is enabled
454 */
455 return c->llc_shared_map;
456}
457
443/* representing cpus for which sibling maps can be computed */ 458/* representing cpus for which sibling maps can be computed */
444static cpumask_t cpu_sibling_setup_map; 459static cpumask_t cpu_sibling_setup_map;
445 460
@@ -459,12 +474,16 @@ set_cpu_sibling_map(int cpu)
459 cpu_set(cpu, cpu_sibling_map[i]); 474 cpu_set(cpu, cpu_sibling_map[i]);
460 cpu_set(i, cpu_core_map[cpu]); 475 cpu_set(i, cpu_core_map[cpu]);
461 cpu_set(cpu, cpu_core_map[i]); 476 cpu_set(cpu, cpu_core_map[i]);
477 cpu_set(i, c[cpu].llc_shared_map);
478 cpu_set(cpu, c[i].llc_shared_map);
462 } 479 }
463 } 480 }
464 } else { 481 } else {
465 cpu_set(cpu, cpu_sibling_map[cpu]); 482 cpu_set(cpu, cpu_sibling_map[cpu]);
466 } 483 }
467 484
485 cpu_set(cpu, c[cpu].llc_shared_map);
486
468 if (current_cpu_data.x86_max_cores == 1) { 487 if (current_cpu_data.x86_max_cores == 1) {
469 cpu_core_map[cpu] = cpu_sibling_map[cpu]; 488 cpu_core_map[cpu] = cpu_sibling_map[cpu];
470 c[cpu].booted_cores = 1; 489 c[cpu].booted_cores = 1;
@@ -472,6 +491,11 @@ set_cpu_sibling_map(int cpu)
472 } 491 }
473 492
474 for_each_cpu_mask(i, cpu_sibling_setup_map) { 493 for_each_cpu_mask(i, cpu_sibling_setup_map) {
494 if (cpu_llc_id[cpu] != BAD_APICID &&
495 cpu_llc_id[cpu] == cpu_llc_id[i]) {
496 cpu_set(i, c[cpu].llc_shared_map);
497 cpu_set(cpu, c[i].llc_shared_map);
498 }
475 if (phys_proc_id[cpu] == phys_proc_id[i]) { 499 if (phys_proc_id[cpu] == phys_proc_id[i]) {
476 cpu_set(i, cpu_core_map[cpu]); 500 cpu_set(i, cpu_core_map[cpu]);
477 cpu_set(cpu, cpu_core_map[i]); 501 cpu_set(cpu, cpu_core_map[i]);
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index ac687d00a1ce..326595f3fa4d 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -310,3 +310,5 @@ ENTRY(sys_call_table)
310 .long sys_pselect6 310 .long sys_pselect6
311 .long sys_ppoll 311 .long sys_ppoll
312 .long sys_unshare /* 310 */ 312 .long sys_unshare /* 310 */
313 .long sys_set_robust_list
314 .long sys_get_robust_list
diff --git a/arch/i386/kernel/timers/timer_pm.c b/arch/i386/kernel/timers/timer_pm.c
index 264edaaac315..144e94a04933 100644
--- a/arch/i386/kernel/timers/timer_pm.c
+++ b/arch/i386/kernel/timers/timer_pm.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/pci.h>
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/timer.h> 20#include <asm/timer.h>
20#include <asm/smp.h> 21#include <asm/smp.h>
@@ -45,24 +46,31 @@ static seqlock_t monotonic_lock = SEQLOCK_UNLOCKED;
45 46
46#define ACPI_PM_MASK 0xFFFFFF /* limit it to 24 bits */ 47#define ACPI_PM_MASK 0xFFFFFF /* limit it to 24 bits */
47 48
49static int pmtmr_need_workaround __read_mostly = 1;
50
48/*helper function to safely read acpi pm timesource*/ 51/*helper function to safely read acpi pm timesource*/
49static inline u32 read_pmtmr(void) 52static inline u32 read_pmtmr(void)
50{ 53{
51 u32 v1=0,v2=0,v3=0; 54 if (pmtmr_need_workaround) {
52 /* It has been reported that because of various broken 55 u32 v1, v2, v3;
53 * chipsets (ICH4, PIIX4 and PIIX4E) where the ACPI PM time 56
54 * source is not latched, so you must read it multiple 57 /* It has been reported that because of various broken
55 * times to insure a safe value is read. 58 * chipsets (ICH4, PIIX4 and PIIX4E) where the ACPI PM time
56 */ 59 * source is not latched, so you must read it multiple
57 do { 60 * times to insure a safe value is read.
58 v1 = inl(pmtmr_ioport); 61 */
59 v2 = inl(pmtmr_ioport); 62 do {
60 v3 = inl(pmtmr_ioport); 63 v1 = inl(pmtmr_ioport);
61 } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1) 64 v2 = inl(pmtmr_ioport);
62 || (v3 > v1 && v3 < v2)); 65 v3 = inl(pmtmr_ioport);
63 66 } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1)
64 /* mask the output to 24 bits */ 67 || (v3 > v1 && v3 < v2));
65 return v2 & ACPI_PM_MASK; 68
69 /* mask the output to 24 bits */
70 return v2 & ACPI_PM_MASK;
71 }
72
73 return inl(pmtmr_ioport) & ACPI_PM_MASK;
66} 74}
67 75
68 76
@@ -263,6 +271,72 @@ struct init_timer_opts __initdata timer_pmtmr_init = {
263 .opts = &timer_pmtmr, 271 .opts = &timer_pmtmr,
264}; 272};
265 273
274#ifdef CONFIG_PCI
275/*
276 * PIIX4 Errata:
277 *
278 * The power management timer may return improper results when read.
279 * Although the timer value settles properly after incrementing,
280 * while incrementing there is a 3 ns window every 69.8 ns where the
281 * timer value is indeterminate (a 4.2% chance that the data will be
282 * incorrect when read). As a result, the ACPI free running count up
283 * timer specification is violated due to erroneous reads.
284 */
285static int __init pmtmr_bug_check(void)
286{
287 static struct pci_device_id gray_list[] __initdata = {
288 /* these chipsets may have bug. */
289 { PCI_DEVICE(PCI_VENDOR_ID_INTEL,
290 PCI_DEVICE_ID_INTEL_82801DB_0) },
291 { },
292 };
293 struct pci_dev *dev;
294 int pmtmr_has_bug = 0;
295 u8 rev;
296
297 if (cur_timer != &timer_pmtmr || !pmtmr_need_workaround)
298 return 0;
299
300 dev = pci_get_device(PCI_VENDOR_ID_INTEL,
301 PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
302 if (dev) {
303 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
304 /* the bug has been fixed in PIIX4M */
305 if (rev < 3) {
306 printk(KERN_WARNING "* Found PM-Timer Bug on this "
307 "chipset. Due to workarounds for a bug,\n"
308 "* this time source is slow. Consider trying "
309 "other time sources (clock=)\n");
310 pmtmr_has_bug = 1;
311 }
312 pci_dev_put(dev);
313 }
314
315 if (pci_dev_present(gray_list)) {
316 printk(KERN_WARNING "* This chipset may have PM-Timer Bug. Due"
317 " to workarounds for a bug,\n"
318 "* this time source is slow. If you are sure your timer"
319 " does not have\n"
320 "* this bug, please use \"pmtmr_good\" to disable the "
321 "workaround\n");
322 pmtmr_has_bug = 1;
323 }
324
325 if (!pmtmr_has_bug)
326 pmtmr_need_workaround = 0;
327
328 return 0;
329}
330device_initcall(pmtmr_bug_check);
331#endif
332
333static int __init pmtr_good_setup(char *__str)
334{
335 pmtmr_need_workaround = 0;
336 return 1;
337}
338__setup("pmtmr_good", pmtr_good_setup);
339
266MODULE_LICENSE("GPL"); 340MODULE_LICENSE("GPL");
267MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); 341MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
268MODULE_DESCRIPTION("Power Management Timer (PMTMR) as primary timing source for x86"); 342MODULE_DESCRIPTION("Power Management Timer (PMTMR) as primary timing source for x86");
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 4624f8ca2459..6b63a5aa1e46 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -92,22 +92,21 @@ asmlinkage void spurious_interrupt_bug(void);
92asmlinkage void machine_check(void); 92asmlinkage void machine_check(void);
93 93
94static int kstack_depth_to_print = 24; 94static int kstack_depth_to_print = 24;
95struct notifier_block *i386die_chain; 95ATOMIC_NOTIFIER_HEAD(i386die_chain);
96static DEFINE_SPINLOCK(die_notifier_lock);
97 96
98int register_die_notifier(struct notifier_block *nb) 97int register_die_notifier(struct notifier_block *nb)
99{ 98{
100 int err = 0;
101 unsigned long flags;
102
103 vmalloc_sync_all(); 99 vmalloc_sync_all();
104 spin_lock_irqsave(&die_notifier_lock, flags); 100 return atomic_notifier_chain_register(&i386die_chain, nb);
105 err = notifier_chain_register(&i386die_chain, nb);
106 spin_unlock_irqrestore(&die_notifier_lock, flags);
107 return err;
108} 101}
109EXPORT_SYMBOL(register_die_notifier); 102EXPORT_SYMBOL(register_die_notifier);
110 103
104int unregister_die_notifier(struct notifier_block *nb)
105{
106 return atomic_notifier_chain_unregister(&i386die_chain, nb);
107}
108EXPORT_SYMBOL(unregister_die_notifier);
109
111static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) 110static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
112{ 111{
113 return p > (void *)tinfo && 112 return p > (void *)tinfo &&
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 8165626a5c30..70e560a1b79a 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -1700,7 +1700,7 @@ after_handle_vic_irq(unsigned int irq)
1700 1700
1701 printk("VOYAGER SMP: CPU%d lost interrupt %d\n", 1701 printk("VOYAGER SMP: CPU%d lost interrupt %d\n",
1702 cpu, irq); 1702 cpu, irq);
1703 for_each_cpu(real_cpu, mask) { 1703 for_each_possible_cpu(real_cpu, mask) {
1704 1704
1705 outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu, 1705 outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu,
1706 VIC_PROCESSOR_ID); 1706 VIC_PROCESSOR_ID);
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index c4af9638dbfa..fe6eb901326e 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -31,6 +31,7 @@
31#include <linux/nodemask.h> 31#include <linux/nodemask.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kexec.h> 33#include <linux/kexec.h>
34#include <linux/pfn.h>
34 35
35#include <asm/e820.h> 36#include <asm/e820.h>
36#include <asm/setup.h> 37#include <asm/setup.h>
@@ -352,17 +353,6 @@ void __init zone_sizes_init(void)
352{ 353{
353 int nid; 354 int nid;
354 355
355 /*
356 * Insert nodes into pgdat_list backward so they appear in order.
357 * Clobber node 0's links and NULL out pgdat_list before starting.
358 */
359 pgdat_list = NULL;
360 for (nid = MAX_NUMNODES - 1; nid >= 0; nid--) {
361 if (!node_online(nid))
362 continue;
363 NODE_DATA(nid)->pgdat_next = pgdat_list;
364 pgdat_list = NODE_DATA(nid);
365 }
366 356
367 for_each_online_node(nid) { 357 for_each_online_node(nid) {
368 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; 358 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
diff --git a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c
index 9db3242103be..2889567e21a1 100644
--- a/arch/i386/mm/pgtable.c
+++ b/arch/i386/mm/pgtable.c
@@ -36,7 +36,7 @@ void show_mem(void)
36 printk(KERN_INFO "Mem-info:\n"); 36 printk(KERN_INFO "Mem-info:\n");
37 show_free_areas(); 37 show_free_areas();
38 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 38 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
39 for_each_pgdat(pgdat) { 39 for_each_online_pgdat(pgdat) {
40 pgdat_resize_lock(pgdat, &flags); 40 pgdat_resize_lock(pgdat, &flags);
41 for (i = 0; i < pgdat->node_spanned_pages; ++i) { 41 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
42 page = pgdat_page_nr(pgdat, i); 42 page = pgdat_page_nr(pgdat, i);
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index 1accce50c2c7..1a2076ce6f6a 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -122,7 +122,7 @@ static void nmi_save_registers(void * dummy)
122static void free_msrs(void) 122static void free_msrs(void)
123{ 123{
124 int i; 124 int i;
125 for_each_cpu(i) { 125 for_each_possible_cpu(i) {
126 kfree(cpu_msrs[i].counters); 126 kfree(cpu_msrs[i].counters);
127 cpu_msrs[i].counters = NULL; 127 cpu_msrs[i].counters = NULL;
128 kfree(cpu_msrs[i].controls); 128 kfree(cpu_msrs[i].controls);
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index dabd6c32641e..7c1ddc8ac443 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -30,19 +30,19 @@ extern spinlock_t timerlist_lock;
30fpswa_interface_t *fpswa_interface; 30fpswa_interface_t *fpswa_interface;
31EXPORT_SYMBOL(fpswa_interface); 31EXPORT_SYMBOL(fpswa_interface);
32 32
33struct notifier_block *ia64die_chain; 33ATOMIC_NOTIFIER_HEAD(ia64die_chain);
34 34
35int 35int
36register_die_notifier(struct notifier_block *nb) 36register_die_notifier(struct notifier_block *nb)
37{ 37{
38 return notifier_chain_register(&ia64die_chain, nb); 38 return atomic_notifier_chain_register(&ia64die_chain, nb);
39} 39}
40EXPORT_SYMBOL_GPL(register_die_notifier); 40EXPORT_SYMBOL_GPL(register_die_notifier);
41 41
42int 42int
43unregister_die_notifier(struct notifier_block *nb) 43unregister_die_notifier(struct notifier_block *nb)
44{ 44{
45 return notifier_chain_unregister(&ia64die_chain, nb); 45 return atomic_notifier_chain_unregister(&ia64die_chain, nb);
46} 46}
47EXPORT_SYMBOL_GPL(unregister_die_notifier); 47EXPORT_SYMBOL_GPL(unregister_die_notifier);
48 48
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 2f5e44862e91..ec9eeb89975d 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -379,31 +379,6 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
379} 379}
380 380
381/** 381/**
382 * pgdat_insert - insert the pgdat into global pgdat_list
383 * @pgdat: the pgdat for a node.
384 */
385static void __init pgdat_insert(pg_data_t *pgdat)
386{
387 pg_data_t *prev = NULL, *next;
388
389 for_each_pgdat(next)
390 if (pgdat->node_id < next->node_id)
391 break;
392 else
393 prev = next;
394
395 if (prev) {
396 prev->pgdat_next = pgdat;
397 pgdat->pgdat_next = next;
398 } else {
399 pgdat->pgdat_next = pgdat_list;
400 pgdat_list = pgdat;
401 }
402
403 return;
404}
405
406/**
407 * memory_less_nodes - allocate and initialize CPU only nodes pernode 382 * memory_less_nodes - allocate and initialize CPU only nodes pernode
408 * information. 383 * information.
409 */ 384 */
@@ -560,7 +535,7 @@ void show_mem(void)
560 printk("Mem-info:\n"); 535 printk("Mem-info:\n");
561 show_free_areas(); 536 show_free_areas();
562 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 537 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
563 for_each_pgdat(pgdat) { 538 for_each_online_pgdat(pgdat) {
564 unsigned long present; 539 unsigned long present;
565 unsigned long flags; 540 unsigned long flags;
566 int shared = 0, cached = 0, reserved = 0; 541 int shared = 0, cached = 0, reserved = 0;
@@ -745,11 +720,5 @@ void __init paging_init(void)
745 pfn_offset, zholes_size); 720 pfn_offset, zholes_size);
746 } 721 }
747 722
748 /*
749 * Make memory less nodes become a member of the known nodes.
750 */
751 for_each_node_mask(node, memory_less_mask)
752 pgdat_insert(mem_data[node].pgdat);
753
754 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page)); 723 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
755} 724}
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index ff4f31fcd330..2ef1151cde90 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -600,7 +600,7 @@ mem_init (void)
600 kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START); 600 kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START);
601 kclist_add(&kcore_kernel, _stext, _end - _stext); 601 kclist_add(&kcore_kernel, _stext, _end - _stext);
602 602
603 for_each_pgdat(pgdat) 603 for_each_online_pgdat(pgdat)
604 if (pgdat->bdata->node_bootmem_map) 604 if (pgdat->bdata->node_bootmem_map)
605 totalram_pages += free_all_bootmem_node(pgdat); 605 totalram_pages += free_all_bootmem_node(pgdat);
606 606
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index c686d9c12f7b..5100261310f7 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -93,19 +93,22 @@ static int coherence_id_open(struct inode *inode, struct file *file)
93static struct proc_dir_entry 93static struct proc_dir_entry
94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent, 94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent,
95 int (*openfunc)(struct inode *, struct file *), 95 int (*openfunc)(struct inode *, struct file *),
96 int (*releasefunc)(struct inode *, struct file *)) 96 int (*releasefunc)(struct inode *, struct file *),
97 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *))
97{ 98{
98 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); 99 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent);
99 100
100 if (e) { 101 if (e) {
101 e->proc_fops = (struct file_operations *)kmalloc( 102 struct file_operations *f;
102 sizeof(struct file_operations), GFP_KERNEL); 103
103 if (e->proc_fops) { 104 f = kzalloc(sizeof(*f), GFP_KERNEL);
104 memset(e->proc_fops, 0, sizeof(struct file_operations)); 105 if (f) {
105 e->proc_fops->open = openfunc; 106 f->open = openfunc;
106 e->proc_fops->read = seq_read; 107 f->read = seq_read;
107 e->proc_fops->llseek = seq_lseek; 108 f->llseek = seq_lseek;
108 e->proc_fops->release = releasefunc; 109 f->release = releasefunc;
110 f->write = write;
111 e->proc_fops = f;
109 } 112 }
110 } 113 }
111 114
@@ -119,31 +122,29 @@ extern int sn_topology_release(struct inode *, struct file *);
119void register_sn_procfs(void) 122void register_sn_procfs(void)
120{ 123{
121 static struct proc_dir_entry *sgi_proc_dir = NULL; 124 static struct proc_dir_entry *sgi_proc_dir = NULL;
122 struct proc_dir_entry *e;
123 125
124 BUG_ON(sgi_proc_dir != NULL); 126 BUG_ON(sgi_proc_dir != NULL);
125 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) 127 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))
126 return; 128 return;
127 129
128 sn_procfs_create_entry("partition_id", sgi_proc_dir, 130 sn_procfs_create_entry("partition_id", sgi_proc_dir,
129 partition_id_open, single_release); 131 partition_id_open, single_release, NULL);
130 132
131 sn_procfs_create_entry("system_serial_number", sgi_proc_dir, 133 sn_procfs_create_entry("system_serial_number", sgi_proc_dir,
132 system_serial_number_open, single_release); 134 system_serial_number_open, single_release, NULL);
133 135
134 sn_procfs_create_entry("licenseID", sgi_proc_dir, 136 sn_procfs_create_entry("licenseID", sgi_proc_dir,
135 licenseID_open, single_release); 137 licenseID_open, single_release, NULL);
136 138
137 e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, 139 sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir,
138 sn_force_interrupt_open, single_release); 140 sn_force_interrupt_open, single_release,
139 if (e) 141 sn_force_interrupt_write_proc);
140 e->proc_fops->write = sn_force_interrupt_write_proc;
141 142
142 sn_procfs_create_entry("coherence_id", sgi_proc_dir, 143 sn_procfs_create_entry("coherence_id", sgi_proc_dir,
143 coherence_id_open, single_release); 144 coherence_id_open, single_release, NULL);
144 145
145 sn_procfs_create_entry("sn_topology", sgi_proc_dir, 146 sn_procfs_create_entry("sn_topology", sgi_proc_dir,
146 sn_topology_open, sn_topology_release); 147 sn_topology_open, sn_topology_release, NULL);
147} 148}
148 149
149#endif /* CONFIG_PROC_FS */ 150#endif /* CONFIG_PROC_FS */
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index d742037a7ccb..0d78942b4c76 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -24,6 +24,7 @@
24#include <linux/tty.h> 24#include <linux/tty.h>
25#include <linux/cpu.h> 25#include <linux/cpu.h>
26#include <linux/nodemask.h> 26#include <linux/nodemask.h>
27#include <linux/pfn.h>
27 28
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/pgtable.h> 30#include <asm/pgtable.h>
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index 08e727955555..cf610a7c5ff0 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -13,6 +13,7 @@
13#include <linux/initrd.h> 13#include <linux/initrd.h>
14#include <linux/nodemask.h> 14#include <linux/nodemask.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/pfn.h>
16 17
17#include <asm/setup.h> 18#include <asm/setup.h>
18 19
@@ -137,12 +138,6 @@ unsigned long __init zone_sizes_init(void)
137 int nid, i; 138 int nid, i;
138 mem_prof_t *mp; 139 mem_prof_t *mp;
139 140
140 pgdat_list = NULL;
141 for (nid = num_online_nodes() - 1 ; nid >= 0 ; nid--) {
142 NODE_DATA(nid)->pgdat_next = pgdat_list;
143 pgdat_list = NODE_DATA(nid);
144 }
145
146 for_each_online_node(nid) { 141 for_each_online_node(nid) {
147 mp = &mem_prof[nid]; 142 mp = &mem_prof[nid];
148 for (i = 0 ; i < MAX_NR_ZONES ; i++) { 143 for (i = 0 ; i < MAX_NR_ZONES ; i++) {
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index c9e7dad860b7..b71348fec1f4 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -18,6 +18,7 @@
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <linux/nodemask.h> 20#include <linux/nodemask.h>
21#include <linux/pfn.h>
21#include <asm/types.h> 22#include <asm/types.h>
22#include <asm/processor.h> 23#include <asm/processor.h>
23#include <asm/page.h> 24#include <asm/page.h>
@@ -47,7 +48,7 @@ void show_mem(void)
47 printk("Mem-info:\n"); 48 printk("Mem-info:\n");
48 show_free_areas(); 49 show_free_areas();
49 printk("Free swap: %6ldkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); 50 printk("Free swap: %6ldkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
50 for_each_pgdat(pgdat) { 51 for_each_online_pgdat(pgdat) {
51 unsigned long flags; 52 unsigned long flags;
52 pgdat_resize_lock(pgdat, &flags); 53 pgdat_resize_lock(pgdat, &flags);
53 for (i = 0; i < pgdat->node_spanned_pages; ++i) { 54 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
index a69fe3048edc..b0e4c084df8a 100644
--- a/arch/m68k/mvme16x/rtc.c
+++ b/arch/m68k/mvme16x/rtc.c
@@ -17,6 +17,7 @@
17#include <linux/poll.h> 17#include <linux/poll.h>
18#include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */ 18#include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <linux/bcd.h>
20#include <asm/mvme16xhw.h> 21#include <asm/mvme16xhw.h>
21 22
22#include <asm/io.h> 23#include <asm/io.h>
@@ -31,9 +32,6 @@
31 * ioctls. 32 * ioctls.
32 */ 33 */
33 34
34#define BCD2BIN(val) (((val)&15) + ((val)>>4)*10)
35#define BIN2BCD(val) ((((val)/10)<<4) + (val)%10)
36
37static const unsigned char days_in_mo[] = 35static const unsigned char days_in_mo[] =
38{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 36{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
39 37
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 1080558c8100..307e98c29ddc 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -94,7 +94,7 @@ void __init plat_setup(void)
94 94
95 argptr = prom_getcmdline(); 95 argptr = prom_getcmdline();
96 96
97#if defined(CONFIG_SERIAL_AU1X00_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) 97#ifdef CONFIG_SERIAL_8250_CONSOLE
98 if ((argptr = strstr(argptr, "console=")) == NULL) { 98 if ((argptr = strstr(argptr, "console=")) == NULL) {
99 argptr = prom_getcmdline(); 99 argptr = prom_getcmdline();
100 strcat(argptr, " console=ttyS0,115200"); 100 strcat(argptr, " console=ttyS0,115200");
diff --git a/arch/mips/ddb5xxx/common/rtc_ds1386.c b/arch/mips/ddb5xxx/common/rtc_ds1386.c
index 995896ac0e39..5dc34daa7150 100644
--- a/arch/mips/ddb5xxx/common/rtc_ds1386.c
+++ b/arch/mips/ddb5xxx/common/rtc_ds1386.c
@@ -165,6 +165,6 @@ rtc_ds1386_init(unsigned long base)
165 WRITE_RTC(0xB, byte); 165 WRITE_RTC(0xB, byte);
166 166
167 /* set the function pointers */ 167 /* set the function pointers */
168 rtc_get_time = rtc_ds1386_get_time; 168 rtc_mips_get_time = rtc_ds1386_get_time;
169 rtc_set_time = rtc_ds1386_set_time; 169 rtc_mips_set_time = rtc_ds1386_set_time;
170} 170}
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
index 174822344131..74cb055d4bf6 100644
--- a/arch/mips/dec/time.c
+++ b/arch/mips/dec/time.c
@@ -36,41 +36,13 @@
36#include <asm/dec/ioasic_addrs.h> 36#include <asm/dec/ioasic_addrs.h>
37#include <asm/dec/machtype.h> 37#include <asm/dec/machtype.h>
38 38
39
40/*
41 * Returns true if a clock update is in progress
42 */
43static inline unsigned char dec_rtc_is_updating(void)
44{
45 unsigned char uip;
46 unsigned long flags;
47
48 spin_lock_irqsave(&rtc_lock, flags);
49 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
50 spin_unlock_irqrestore(&rtc_lock, flags);
51 return uip;
52}
53
54static unsigned long dec_rtc_get_time(void) 39static unsigned long dec_rtc_get_time(void)
55{ 40{
56 unsigned int year, mon, day, hour, min, sec, real_year; 41 unsigned int year, mon, day, hour, min, sec, real_year;
57 int i;
58 unsigned long flags; 42 unsigned long flags;
59 43
60 /* The Linux interpretation of the DS1287 clock register contents:
61 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
62 * RTC registers show the second which has precisely just started.
63 * Let's hope other operating systems interpret the RTC the same way.
64 */
65 /* read RTC exactly on falling edge of update flag */
66 for (i = 0; i < 1000000; i++) /* may take up to 1 second... */
67 if (dec_rtc_is_updating())
68 break;
69 for (i = 0; i < 1000000; i++) /* must try at least 2.228 ms */
70 if (!dec_rtc_is_updating())
71 break;
72 spin_lock_irqsave(&rtc_lock, flags); 44 spin_lock_irqsave(&rtc_lock, flags);
73 /* Isn't this overkill? UIP above should guarantee consistency */ 45
74 do { 46 do {
75 sec = CMOS_READ(RTC_SECONDS); 47 sec = CMOS_READ(RTC_SECONDS);
76 min = CMOS_READ(RTC_MINUTES); 48 min = CMOS_READ(RTC_MINUTES);
@@ -78,7 +50,16 @@ static unsigned long dec_rtc_get_time(void)
78 day = CMOS_READ(RTC_DAY_OF_MONTH); 50 day = CMOS_READ(RTC_DAY_OF_MONTH);
79 mon = CMOS_READ(RTC_MONTH); 51 mon = CMOS_READ(RTC_MONTH);
80 year = CMOS_READ(RTC_YEAR); 52 year = CMOS_READ(RTC_YEAR);
53 /*
54 * The PROM will reset the year to either '72 or '73.
55 * Therefore we store the real year separately, in one
56 * of unused BBU RAM locations.
57 */
58 real_year = CMOS_READ(RTC_DEC_YEAR);
81 } while (sec != CMOS_READ(RTC_SECONDS)); 59 } while (sec != CMOS_READ(RTC_SECONDS));
60
61 spin_unlock_irqrestore(&rtc_lock, flags);
62
82 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 63 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
83 sec = BCD2BIN(sec); 64 sec = BCD2BIN(sec);
84 min = BCD2BIN(min); 65 min = BCD2BIN(min);
@@ -87,13 +68,7 @@ static unsigned long dec_rtc_get_time(void)
87 mon = BCD2BIN(mon); 68 mon = BCD2BIN(mon);
88 year = BCD2BIN(year); 69 year = BCD2BIN(year);
89 } 70 }
90 /* 71
91 * The PROM will reset the year to either '72 or '73.
92 * Therefore we store the real year separately, in one
93 * of unused BBU RAM locations.
94 */
95 real_year = CMOS_READ(RTC_DEC_YEAR);
96 spin_unlock_irqrestore(&rtc_lock, flags);
97 year += real_year - 72 + 2000; 72 year += real_year - 72 + 2000;
98 73
99 return mktime(year, mon, day, hour, min, sec); 74 return mktime(year, mon, day, hour, min, sec);
@@ -193,8 +168,8 @@ static void dec_ioasic_hpt_init(unsigned int count)
193 168
194void __init dec_time_init(void) 169void __init dec_time_init(void)
195{ 170{
196 rtc_get_time = dec_rtc_get_time; 171 rtc_mips_get_time = dec_rtc_get_time;
197 rtc_set_mmss = dec_rtc_set_mmss; 172 rtc_mips_set_mmss = dec_rtc_set_mmss;
198 173
199 mips_timer_state = dec_timer_state; 174 mips_timer_state = dec_timer_state;
200 mips_timer_ack = dec_timer_ack; 175 mips_timer_ack = dec_timer_ack;
diff --git a/arch/mips/ite-boards/generic/time.c b/arch/mips/ite-boards/generic/time.c
index f5d67ee21ac6..b79817bb6cce 100644
--- a/arch/mips/ite-boards/generic/time.c
+++ b/arch/mips/ite-boards/generic/time.c
@@ -227,8 +227,8 @@ void __init it8172_time_init(void)
227 227
228 local_irq_restore(flags); 228 local_irq_restore(flags);
229 229
230 rtc_get_time = it8172_rtc_get_time; 230 rtc_mips_get_time = it8172_rtc_get_time;
231 rtc_set_time = it8172_rtc_set_time; 231 rtc_mips_set_time = it8172_rtc_set_time;
232} 232}
233 233
234#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) 234#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
diff --git a/arch/mips/ite-boards/ivr/init.c b/arch/mips/ite-boards/ivr/init.c
index ea4e1935fec5..b774db035b31 100644
--- a/arch/mips/ite-boards/ivr/init.c
+++ b/arch/mips/ite-boards/ivr/init.c
@@ -45,9 +45,6 @@ extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void); 45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize); 46extern void __init it8172_init_ram_resource(unsigned long memsize);
47 47
48#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
49#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
50
51const char *get_system_type(void) 48const char *get_system_type(void)
52{ 49{
53 return "Globespan IVR"; 50 return "Globespan IVR";
diff --git a/arch/mips/ite-boards/qed-4n-s01b/init.c b/arch/mips/ite-boards/qed-4n-s01b/init.c
index 56dca7e0c21d..e8ec8be66a80 100644
--- a/arch/mips/ite-boards/qed-4n-s01b/init.c
+++ b/arch/mips/ite-boards/qed-4n-s01b/init.c
@@ -45,9 +45,6 @@ extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void); 45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize); 46extern void __init it8172_init_ram_resource(unsigned long memsize);
47 47
48#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
49#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
50
51const char *get_system_type(void) 48const char *get_system_type(void)
52{ 49{
53 return "ITE QED-4N-S01B"; 50 return "ITE QED-4N-S01B";
diff --git a/arch/mips/jmr3927/common/rtc_ds1742.c b/arch/mips/jmr3927/common/rtc_ds1742.c
index 9a8bff153d80..a6bd3f4d3049 100644
--- a/arch/mips/jmr3927/common/rtc_ds1742.c
+++ b/arch/mips/jmr3927/common/rtc_ds1742.c
@@ -159,8 +159,8 @@ rtc_ds1742_init(unsigned long base)
159 db_assert((rtc_base & 0xe0000000) == KSEG1); 159 db_assert((rtc_base & 0xe0000000) == KSEG1);
160 160
161 /* set the function pointers */ 161 /* set the function pointers */
162 rtc_get_time = rtc_ds1742_get_time; 162 rtc_mips_get_time = rtc_ds1742_get_time;
163 rtc_set_time = rtc_ds1742_set_time; 163 rtc_mips_set_time = rtc_ds1742_set_time;
164 164
165 /* clear oscillator stop bit */ 165 /* clear oscillator stop bit */
166 CMOS_WRITE(RTC_READ, RTC_CONTROL); 166 CMOS_WRITE(RTC_READ, RTC_CONTROL);
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 0cb3b6097e0e..dcbfd27071f0 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -34,6 +34,7 @@
34#include <linux/highmem.h> 34#include <linux/highmem.h>
35#include <linux/console.h> 35#include <linux/console.h>
36#include <linux/mmzone.h> 36#include <linux/mmzone.h>
37#include <linux/pfn.h>
37 38
38#include <asm/addrspace.h> 39#include <asm/addrspace.h>
39#include <asm/bootinfo.h> 40#include <asm/bootinfo.h>
@@ -257,10 +258,6 @@ static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_en
257 return 0; 258 return 0;
258} 259}
259 260
260#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
261#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
262#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
263
264#define MAXMEM HIGHMEM_START 261#define MAXMEM HIGHMEM_START
265#define MAXMEM_PFN PFN_DOWN(MAXMEM) 262#define MAXMEM_PFN PFN_DOWN(MAXMEM)
266 263
@@ -493,10 +490,6 @@ static inline void resource_init(void)
493 } 490 }
494} 491}
495 492
496#undef PFN_UP
497#undef PFN_DOWN
498#undef PFN_PHYS
499
500#undef MAXMEM 493#undef MAXMEM
501#undef MAXMEM_PFN 494#undef MAXMEM_PFN
502 495
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 51273b7297a7..5e51a2d8f3f0 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -65,9 +65,9 @@ static int null_rtc_set_time(unsigned long sec)
65 return 0; 65 return 0;
66} 66}
67 67
68unsigned long (*rtc_get_time)(void) = null_rtc_get_time; 68unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time;
69int (*rtc_set_time)(unsigned long) = null_rtc_set_time; 69int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time;
70int (*rtc_set_mmss)(unsigned long); 70int (*rtc_mips_set_mmss)(unsigned long);
71 71
72 72
73/* usecs per counter cycle, shifted to left by 32 bits */ 73/* usecs per counter cycle, shifted to left by 32 bits */
@@ -440,14 +440,14 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
440 440
441 /* 441 /*
442 * If we have an externally synchronized Linux clock, then update 442 * If we have an externally synchronized Linux clock, then update
443 * CMOS clock accordingly every ~11 minutes. rtc_set_time() has to be 443 * CMOS clock accordingly every ~11 minutes. rtc_mips_set_time() has to be
444 * called as close as possible to 500 ms before the new second starts. 444 * called as close as possible to 500 ms before the new second starts.
445 */ 445 */
446 if (ntp_synced() && 446 if (ntp_synced() &&
447 xtime.tv_sec > last_rtc_update + 660 && 447 xtime.tv_sec > last_rtc_update + 660 &&
448 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 448 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
449 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 449 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
450 if (rtc_set_mmss(xtime.tv_sec) == 0) { 450 if (rtc_mips_set_mmss(xtime.tv_sec) == 0) {
451 last_rtc_update = xtime.tv_sec; 451 last_rtc_update = xtime.tv_sec;
452 } else { 452 } else {
453 /* do it again in 60 s */ 453 /* do it again in 60 s */
@@ -565,7 +565,7 @@ asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs)
565 * b) (optional) calibrate and set the mips_hpt_frequency 565 * b) (optional) calibrate and set the mips_hpt_frequency
566 * (only needed if you intended to use fixed_rate_gettimeoffset 566 * (only needed if you intended to use fixed_rate_gettimeoffset
567 * or use cpu counter as timer interrupt source) 567 * or use cpu counter as timer interrupt source)
568 * 2) setup xtime based on rtc_get_time(). 568 * 2) setup xtime based on rtc_mips_get_time().
569 * 3) choose a appropriate gettimeoffset routine. 569 * 3) choose a appropriate gettimeoffset routine.
570 * 4) calculate a couple of cached variables for later usage 570 * 4) calculate a couple of cached variables for later usage
571 * 5) board_timer_setup() - 571 * 5) board_timer_setup() -
@@ -633,10 +633,10 @@ void __init time_init(void)
633 if (board_time_init) 633 if (board_time_init)
634 board_time_init(); 634 board_time_init();
635 635
636 if (!rtc_set_mmss) 636 if (!rtc_mips_set_mmss)
637 rtc_set_mmss = rtc_set_time; 637 rtc_mips_set_mmss = rtc_mips_set_time;
638 638
639 xtime.tv_sec = rtc_get_time(); 639 xtime.tv_sec = rtc_mips_get_time();
640 xtime.tv_nsec = 0; 640 xtime.tv_nsec = 0;
641 641
642 set_normalized_timespec(&wall_to_monotonic, 642 set_normalized_timespec(&wall_to_monotonic,
@@ -772,8 +772,8 @@ void to_tm(unsigned long tim, struct rtc_time *tm)
772 772
773EXPORT_SYMBOL(rtc_lock); 773EXPORT_SYMBOL(rtc_lock);
774EXPORT_SYMBOL(to_tm); 774EXPORT_SYMBOL(to_tm);
775EXPORT_SYMBOL(rtc_set_time); 775EXPORT_SYMBOL(rtc_mips_set_time);
776EXPORT_SYMBOL(rtc_get_time); 776EXPORT_SYMBOL(rtc_mips_get_time);
777 777
778unsigned long long sched_clock(void) 778unsigned long long sched_clock(void)
779{ 779{
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index 83eb08b7a072..bb70a8240e61 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -165,7 +165,8 @@ void __init plat_setup(void)
165 165
166 /* Set up panic notifier */ 166 /* Set up panic notifier */
167 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++) 167 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++)
168 notifier_chain_register(&panic_notifier_list, &lasat_panic_block[i]); 168 atomic_notifier_chain_register(&panic_notifier_list,
169 &lasat_panic_block[i]);
169 170
170 lasat_reboot_setup(); 171 lasat_reboot_setup();
171 172
@@ -174,8 +175,8 @@ void __init plat_setup(void)
174 175
175#ifdef CONFIG_DS1603 176#ifdef CONFIG_DS1603
176 ds1603 = &ds_defs[mips_machtype]; 177 ds1603 = &ds_defs[mips_machtype];
177 rtc_get_time = ds1603_read; 178 rtc_mips_get_time = ds1603_read;
178 rtc_set_time = ds1603_set; 179 rtc_mips_set_time = ds1603_set;
179#endif 180#endif
180 181
181#ifdef DYNAMIC_SERIAL_INIT 182#ifdef DYNAMIC_SERIAL_INIT
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index 873cf3141a31..c20d401ecf80 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -65,7 +65,7 @@ void __init plat_setup(void)
65 65
66 board_time_init = mips_time_init; 66 board_time_init = mips_time_init;
67 board_timer_setup = mips_timer_setup; 67 board_timer_setup = mips_timer_setup;
68 rtc_get_time = mips_rtc_get_time; 68 rtc_mips_get_time = mips_rtc_get_time;
69} 69}
70 70
71static void __init serial_init(void) 71static void __init serial_init(void)
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index ee5e70c95cf3..32c9210373ac 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -49,9 +49,6 @@ static char *mtypes[3] = {
49/* References to section boundaries */ 49/* References to section boundaries */
50extern char _end; 50extern char _end;
51 51
52#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
53
54
55struct prom_pmemblock * __init prom_getmdesc(void) 52struct prom_pmemblock * __init prom_getmdesc(void)
56{ 53{
57 char *memsize_str; 54 char *memsize_str;
@@ -109,10 +106,10 @@ struct prom_pmemblock * __init prom_getmdesc(void)
109 106
110 mdesc[3].type = yamon_dontuse; 107 mdesc[3].type = yamon_dontuse;
111 mdesc[3].base = 0x00100000; 108 mdesc[3].base = 0x00100000;
112 mdesc[3].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[3].base; 109 mdesc[3].size = CPHYSADDR(PAGE_ALIGN(&_end)) - mdesc[3].base;
113 110
114 mdesc[4].type = yamon_free; 111 mdesc[4].type = yamon_free;
115 mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end)); 112 mdesc[4].base = CPHYSADDR(PAGE_ALIGN(&_end));
116 mdesc[4].size = memsize - mdesc[4].base; 113 mdesc[4].size = memsize - mdesc[4].base;
117 114
118 return &mdesc[0]; 115 return &mdesc[0];
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index 2209e8a9de34..b8488aab6df1 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -225,5 +225,5 @@ void __init plat_setup(void)
225 225
226 board_time_init = mips_time_init; 226 board_time_init = mips_time_init;
227 board_timer_setup = mips_timer_setup; 227 board_timer_setup = mips_timer_setup;
228 rtc_get_time = mips_rtc_get_time; 228 rtc_mips_get_time = mips_rtc_get_time;
229} 229}
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c
index 1ec4e75656bd..e57f737bab10 100644
--- a/arch/mips/mips-boards/sim/sim_mem.c
+++ b/arch/mips/mips-boards/sim/sim_mem.c
@@ -42,9 +42,6 @@ static char *mtypes[3] = {
42/* References to section boundaries */ 42/* References to section boundaries */
43extern char _end; 43extern char _end;
44 44
45#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
46
47
48struct prom_pmemblock * __init prom_getmdesc(void) 45struct prom_pmemblock * __init prom_getmdesc(void)
49{ 46{
50 unsigned int memsize; 47 unsigned int memsize;
@@ -64,10 +61,10 @@ struct prom_pmemblock * __init prom_getmdesc(void)
64 61
65 mdesc[2].type = simmem_reserved; 62 mdesc[2].type = simmem_reserved;
66 mdesc[2].base = 0x00100000; 63 mdesc[2].base = 0x00100000;
67 mdesc[2].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[2].base; 64 mdesc[2].size = CPHYSADDR(PAGE_ALIGN(&_end)) - mdesc[2].base;
68 65
69 mdesc[3].type = simmem_free; 66 mdesc[3].type = simmem_free;
70 mdesc[3].base = CPHYSADDR(PFN_ALIGN(&_end)); 67 mdesc[3].base = CPHYSADDR(PAGE_ALIGN(&_end));
71 mdesc[3].size = memsize - mdesc[3].base; 68 mdesc[3].size = memsize - mdesc[3].base;
72 69
73 return &mdesc[0]; 70 return &mdesc[0];
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 52f7d59fe612..ad89c442f299 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -25,6 +25,7 @@
25#include <linux/highmem.h> 25#include <linux/highmem.h>
26#include <linux/swap.h> 26#include <linux/swap.h>
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/pfn.h>
28 29
29#include <asm/bootinfo.h> 30#include <asm/bootinfo.h>
30#include <asm/cachectl.h> 31#include <asm/cachectl.h>
@@ -177,9 +178,6 @@ void __init paging_init(void)
177 free_area_init(zones_size); 178 free_area_init(zones_size);
178} 179}
179 180
180#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
181#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
182
183static inline int page_is_ram(unsigned long pagenr) 181static inline int page_is_ram(unsigned long pagenr)
184{ 182{
185 int i; 183 int i;
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c
index 3784c898db1a..91d9637143d7 100644
--- a/arch/mips/momentum/jaguar_atx/setup.c
+++ b/arch/mips/momentum/jaguar_atx/setup.c
@@ -229,8 +229,8 @@ void momenco_time_init(void)
229 mips_hpt_frequency = cpu_clock / 2; 229 mips_hpt_frequency = cpu_clock / 2;
230 board_timer_setup = momenco_timer_setup; 230 board_timer_setup = momenco_timer_setup;
231 231
232 rtc_get_time = m48t37y_get_time; 232 rtc_mips_get_time = m48t37y_get_time;
233 rtc_set_time = m48t37y_set_time; 233 rtc_mips_set_time = m48t37y_set_time;
234} 234}
235 235
236static struct resource mv_pci_io_mem0_resource = { 236static struct resource mv_pci_io_mem0_resource = {
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
index f95677f4f06f..370e75d0e75c 100644
--- a/arch/mips/momentum/ocelot_3/setup.c
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -58,6 +58,7 @@
58#include <linux/bootmem.h> 58#include <linux/bootmem.h>
59#include <linux/mv643xx.h> 59#include <linux/mv643xx.h>
60#include <linux/pm.h> 60#include <linux/pm.h>
61#include <linux/bcd.h>
61 62
62#include <asm/time.h> 63#include <asm/time.h>
63#include <asm/page.h> 64#include <asm/page.h>
@@ -131,9 +132,6 @@ void setup_wired_tlb_entries(void)
131 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), (signed)0xfc000000, PM_16M); 132 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), (signed)0xfc000000, PM_16M);
132} 133}
133 134
134#define CONV_BCD_TO_BIN(val) (((val) & 0xf) + (((val) >> 4) * 10))
135#define CONV_BIN_TO_BCD(val) (((val) % 10) + (((val) / 10) << 4))
136
137unsigned long m48t37y_get_time(void) 135unsigned long m48t37y_get_time(void)
138{ 136{
139 unsigned int year, month, day, hour, min, sec; 137 unsigned int year, month, day, hour, min, sec;
@@ -143,16 +141,16 @@ unsigned long m48t37y_get_time(void)
143 /* stop the update */ 141 /* stop the update */
144 rtc_base[0x7ff8] = 0x40; 142 rtc_base[0x7ff8] = 0x40;
145 143
146 year = CONV_BCD_TO_BIN(rtc_base[0x7fff]); 144 year = BCD2BIN(rtc_base[0x7fff]);
147 year += CONV_BCD_TO_BIN(rtc_base[0x7ff1]) * 100; 145 year += BCD2BIN(rtc_base[0x7ff1]) * 100;
148 146
149 month = CONV_BCD_TO_BIN(rtc_base[0x7ffe]); 147 month = BCD2BIN(rtc_base[0x7ffe]);
150 148
151 day = CONV_BCD_TO_BIN(rtc_base[0x7ffd]); 149 day = BCD2BIN(rtc_base[0x7ffd]);
152 150
153 hour = CONV_BCD_TO_BIN(rtc_base[0x7ffb]); 151 hour = BCD2BIN(rtc_base[0x7ffb]);
154 min = CONV_BCD_TO_BIN(rtc_base[0x7ffa]); 152 min = BCD2BIN(rtc_base[0x7ffa]);
155 sec = CONV_BCD_TO_BIN(rtc_base[0x7ff9]); 153 sec = BCD2BIN(rtc_base[0x7ff9]);
156 154
157 /* start the update */ 155 /* start the update */
158 rtc_base[0x7ff8] = 0x00; 156 rtc_base[0x7ff8] = 0x00;
@@ -175,22 +173,22 @@ int m48t37y_set_time(unsigned long sec)
175 rtc_base[0x7ff8] = 0x80; 173 rtc_base[0x7ff8] = 0x80;
176 174
177 /* year */ 175 /* year */
178 rtc_base[0x7fff] = CONV_BIN_TO_BCD(tm.tm_year % 100); 176 rtc_base[0x7fff] = BIN2BCD(tm.tm_year % 100);
179 rtc_base[0x7ff1] = CONV_BIN_TO_BCD(tm.tm_year / 100); 177 rtc_base[0x7ff1] = BIN2BCD(tm.tm_year / 100);
180 178
181 /* month */ 179 /* month */
182 rtc_base[0x7ffe] = CONV_BIN_TO_BCD(tm.tm_mon); 180 rtc_base[0x7ffe] = BIN2BCD(tm.tm_mon);
183 181
184 /* day */ 182 /* day */
185 rtc_base[0x7ffd] = CONV_BIN_TO_BCD(tm.tm_mday); 183 rtc_base[0x7ffd] = BIN2BCD(tm.tm_mday);
186 184
187 /* hour/min/sec */ 185 /* hour/min/sec */
188 rtc_base[0x7ffb] = CONV_BIN_TO_BCD(tm.tm_hour); 186 rtc_base[0x7ffb] = BIN2BCD(tm.tm_hour);
189 rtc_base[0x7ffa] = CONV_BIN_TO_BCD(tm.tm_min); 187 rtc_base[0x7ffa] = BIN2BCD(tm.tm_min);
190 rtc_base[0x7ff9] = CONV_BIN_TO_BCD(tm.tm_sec); 188 rtc_base[0x7ff9] = BIN2BCD(tm.tm_sec);
191 189
192 /* day of week -- not really used, but let's keep it up-to-date */ 190 /* day of week -- not really used, but let's keep it up-to-date */
193 rtc_base[0x7ffc] = CONV_BIN_TO_BCD(tm.tm_wday + 1); 191 rtc_base[0x7ffc] = BIN2BCD(tm.tm_wday + 1);
194 192
195 /* disable writing */ 193 /* disable writing */
196 rtc_base[0x7ff8] = 0x00; 194 rtc_base[0x7ff8] = 0x00;
@@ -215,8 +213,8 @@ void momenco_time_init(void)
215 mips_hpt_frequency = cpu_clock / 2; 213 mips_hpt_frequency = cpu_clock / 2;
216 board_timer_setup = momenco_timer_setup; 214 board_timer_setup = momenco_timer_setup;
217 215
218 rtc_get_time = m48t37y_get_time; 216 rtc_mips_get_time = m48t37y_get_time;
219 rtc_set_time = m48t37y_set_time; 217 rtc_mips_set_time = m48t37y_set_time;
220} 218}
221 219
222/* 220/*
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c
index bd02e60d037a..a3e6f5575592 100644
--- a/arch/mips/momentum/ocelot_c/setup.c
+++ b/arch/mips/momentum/ocelot_c/setup.c
@@ -227,8 +227,8 @@ void momenco_time_init(void)
227 printk("momenco_time_init cpu_clock=%d\n", cpu_clock); 227 printk("momenco_time_init cpu_clock=%d\n", cpu_clock);
228 board_timer_setup = momenco_timer_setup; 228 board_timer_setup = momenco_timer_setup;
229 229
230 rtc_get_time = m48t37y_get_time; 230 rtc_mips_get_time = m48t37y_get_time;
231 rtc_set_time = m48t37y_set_time; 231 rtc_mips_set_time = m48t37y_set_time;
232} 232}
233 233
234void __init plat_setup(void) 234void __init plat_setup(void)
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 8bce711575de..3f724d661bdb 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -198,8 +198,8 @@ static void __init py_rtc_setup(void)
198 if (!m48t37_base) 198 if (!m48t37_base)
199 printk(KERN_ERR "Mapping the RTC failed\n"); 199 printk(KERN_ERR "Mapping the RTC failed\n");
200 200
201 rtc_get_time = m48t37y_get_time; 201 rtc_mips_get_time = m48t37y_get_time;
202 rtc_set_time = m48t37y_set_time; 202 rtc_mips_set_time = m48t37y_set_time;
203 203
204 write_seqlock(&xtime_lock); 204 write_seqlock(&xtime_lock);
205 xtime.tv_sec = m48t37y_get_time(); 205 xtime.tv_sec = m48t37y_get_time();
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 92a3b3c15ed3..a9c58e067b53 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -238,7 +238,7 @@ static int __init reboot_setup(void)
238 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); 238 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
239 init_timer(&blink_timer); 239 init_timer(&blink_timer);
240 blink_timer.function = blink_timeout; 240 blink_timer.function = blink_timeout;
241 notifier_chain_register(&panic_notifier_list, &panic_block); 241 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
242 242
243 return 0; 243 return 0;
244} 244}
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
index b7300cc5c5ad..cca688ad64ad 100644
--- a/arch/mips/sgi-ip22/ip22-time.c
+++ b/arch/mips/sgi-ip22/ip22-time.c
@@ -212,8 +212,8 @@ static void indy_timer_setup(struct irqaction *irq)
212void __init ip22_time_init(void) 212void __init ip22_time_init(void)
213{ 213{
214 /* setup hookup functions */ 214 /* setup hookup functions */
215 rtc_get_time = indy_rtc_get_time; 215 rtc_mips_get_time = indy_rtc_get_time;
216 rtc_set_time = indy_rtc_set_time; 216 rtc_mips_set_time = indy_rtc_set_time;
217 217
218 board_time_init = indy_time_init; 218 board_time_init = indy_time_init;
219 board_timer_setup = indy_timer_setup; 219 board_timer_setup = indy_timer_setup;
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index e0d095daa5ed..6c00dce9f73f 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -19,6 +19,7 @@
19#include <linux/nodemask.h> 19#include <linux/nodemask.h>
20#include <linux/swap.h> 20#include <linux/swap.h>
21#include <linux/bootmem.h> 21#include <linux/bootmem.h>
22#include <linux/pfn.h>
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/sections.h> 24#include <asm/sections.h>
24 25
@@ -28,8 +29,6 @@
28#include <asm/sn/sn_private.h> 29#include <asm/sn/sn_private.h>
29 30
30 31
31#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
32
33#define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) 32#define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT)
34#define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) 33#define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT)
35 34
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 0c948008b023..ab9d9cef089e 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -193,7 +193,7 @@ static __init int ip32_reboot_setup(void)
193 193
194 init_timer(&blink_timer); 194 init_timer(&blink_timer);
195 blink_timer.function = blink_timeout; 195 blink_timer.function = blink_timeout;
196 notifier_chain_register(&panic_notifier_list, &panic_block); 196 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
197 197
198 request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL); 198 request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL);
199 199
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index 2f50c79b7887..a2dd8ae1ea8f 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -91,8 +91,8 @@ void __init plat_setup(void)
91{ 91{
92 board_be_init = ip32_be_init; 92 board_be_init = ip32_be_init;
93 93
94 rtc_get_time = mc146818_get_cmos_time; 94 rtc_mips_get_time = mc146818_get_cmos_time;
95 rtc_set_mmss = mc146818_set_rtc_mmss; 95 rtc_mips_set_mmss = mc146818_set_rtc_mmss;
96 96
97 board_time_init = ip32_time_init; 97 board_time_init = ip32_time_init;
98 board_timer_setup = ip32_timer_setup; 98 board_timer_setup = ip32_timer_setup;
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index b661d2425a36..4b5f74ff3edd 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -121,14 +121,14 @@ void __init plat_setup(void)
121 121
122 if (xicor_probe()) { 122 if (xicor_probe()) {
123 printk("swarm setup: Xicor 1241 RTC detected.\n"); 123 printk("swarm setup: Xicor 1241 RTC detected.\n");
124 rtc_get_time = xicor_get_time; 124 rtc_mips_get_time = xicor_get_time;
125 rtc_set_time = xicor_set_time; 125 rtc_mips_set_time = xicor_set_time;
126 } 126 }
127 127
128 if (m41t81_probe()) { 128 if (m41t81_probe()) {
129 printk("swarm setup: M41T81 RTC detected.\n"); 129 printk("swarm setup: M41T81 RTC detected.\n");
130 rtc_get_time = m41t81_get_time; 130 rtc_mips_get_time = m41t81_get_time;
131 rtc_set_time = m41t81_set_time; 131 rtc_mips_set_time = m41t81_set_time;
132 } 132 }
133 133
134 printk("This kernel optimized for " 134 printk("This kernel optimized for "
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 1141fcd13a59..01ba6c581e3d 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -164,8 +164,8 @@ static struct pci_controller sni_controller = {
164 164
165static inline void sni_pcimt_time_init(void) 165static inline void sni_pcimt_time_init(void)
166{ 166{
167 rtc_get_time = mc146818_get_cmos_time; 167 rtc_mips_get_time = mc146818_get_cmos_time;
168 rtc_set_time = mc146818_set_rtc_mmss; 168 rtc_mips_set_time = mc146818_set_rtc_mmss;
169} 169}
170 170
171void __init plat_setup(void) 171void __init plat_setup(void)
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index 2ad6401d2af4..6dcf077f61a0 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -1036,8 +1036,8 @@ toshiba_rbtx4927_time_init(void)
1036 1036
1037#ifdef CONFIG_RTC_DS1742 1037#ifdef CONFIG_RTC_DS1742
1038 1038
1039 rtc_get_time = rtc_ds1742_get_time; 1039 rtc_mips_get_time = rtc_ds1742_get_time;
1040 rtc_set_time = rtc_ds1742_set_time; 1040 rtc_mips_set_time = rtc_ds1742_set_time;
1041 1041
1042 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, 1042 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1043 ":rtc_ds1742_init()-\n"); 1043 ":rtc_ds1742_init()-\n");
diff --git a/arch/mips/tx4938/common/rtc_rx5c348.c b/arch/mips/tx4938/common/rtc_rx5c348.c
index d249edbb6af4..07f782fc0725 100644
--- a/arch/mips/tx4938/common/rtc_rx5c348.c
+++ b/arch/mips/tx4938/common/rtc_rx5c348.c
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/rtc.h> 15#include <linux/rtc.h>
16#include <linux/time.h> 16#include <linux/time.h>
17#include <linux/bcd.h>
17#include <asm/time.h> 18#include <asm/time.h>
18#include <asm/tx4938/spi.h> 19#include <asm/tx4938/spi.h>
19 20
@@ -77,17 +78,6 @@ spi_rtc_io(unsigned char *inbuf, unsigned char *outbuf, unsigned int count)
77 inbufs, incounts, outbufs, outcounts, 0); 78 inbufs, incounts, outbufs, outcounts, 0);
78} 79}
79 80
80/*
81 * Conversion between binary and BCD.
82 */
83#ifndef BCD_TO_BIN
84#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
85#endif
86
87#ifndef BIN_TO_BCD
88#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
89#endif
90
91/* RTC-dependent code for time.c */ 81/* RTC-dependent code for time.c */
92 82
93static int 83static int
@@ -197,6 +187,6 @@ rtc_rx5c348_init(int chipid)
197 srtc_24h = 1; 187 srtc_24h = 1;
198 188
199 /* set the function pointers */ 189 /* set the function pointers */
200 rtc_get_time = rtc_rx5c348_get_time; 190 rtc_mips_get_time = rtc_rx5c348_get_time;
201 rtc_set_time = rtc_rx5c348_set_time; 191 rtc_mips_set_time = rtc_rx5c348_set_time;
202} 192}
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
index 2a01fe1bdc98..0cea6958f427 100644
--- a/arch/parisc/kernel/pdc_chassis.c
+++ b/arch/parisc/kernel/pdc_chassis.c
@@ -150,7 +150,8 @@ void __init parisc_pdc_chassis_init(void)
150 150
151 if (handle) { 151 if (handle) {
152 /* initialize panic notifier chain */ 152 /* initialize panic notifier chain */
153 notifier_chain_register(&panic_notifier_list, &pdc_chassis_panic_block); 153 atomic_notifier_chain_register(&panic_notifier_list,
154 &pdc_chassis_panic_block);
154 155
155 /* initialize reboot notifier chain */ 156 /* initialize reboot notifier chain */
156 register_reboot_notifier(&pdc_chassis_reboot_block); 157 register_reboot_notifier(&pdc_chassis_reboot_block);
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 6aea1fb74b69..05b152299396 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -537,7 +537,8 @@ void __init setup_arch(char **cmdline_p)
537 panic_timeout = 180; 537 panic_timeout = 180;
538 538
539 if (ppc_md.panic) 539 if (ppc_md.panic)
540 notifier_chain_register(&panic_notifier_list, &ppc64_panic_block); 540 atomic_notifier_chain_register(&panic_notifier_list,
541 &ppc64_panic_block);
541 542
542 init_mm.start_code = PAGE_OFFSET; 543 init_mm.start_code = PAGE_OFFSET;
543 init_mm.end_code = (unsigned long) _etext; 544 init_mm.end_code = (unsigned long) _etext;
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 27600c9432bc..4cbde211eb69 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -74,19 +74,19 @@ EXPORT_SYMBOL(__debugger_dabr_match);
74EXPORT_SYMBOL(__debugger_fault_handler); 74EXPORT_SYMBOL(__debugger_fault_handler);
75#endif 75#endif
76 76
77struct notifier_block *powerpc_die_chain; 77ATOMIC_NOTIFIER_HEAD(powerpc_die_chain);
78static DEFINE_SPINLOCK(die_notifier_lock);
79 78
80int register_die_notifier(struct notifier_block *nb) 79int register_die_notifier(struct notifier_block *nb)
81{ 80{
82 int err = 0; 81 return atomic_notifier_chain_register(&powerpc_die_chain, nb);
83 unsigned long flags; 82}
83EXPORT_SYMBOL(register_die_notifier);
84 84
85 spin_lock_irqsave(&die_notifier_lock, flags); 85int unregister_die_notifier(struct notifier_block *nb)
86 err = notifier_chain_register(&powerpc_die_chain, nb); 86{
87 spin_unlock_irqrestore(&die_notifier_lock, flags); 87 return atomic_notifier_chain_unregister(&powerpc_die_chain, nb);
88 return err;
89} 88}
89EXPORT_SYMBOL(unregister_die_notifier);
90 90
91/* 91/*
92 * Trap & Exception support 92 * Trap & Exception support
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 4737f84bb19e..741dd8802d49 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -195,7 +195,7 @@ void show_mem(void)
195 printk("Mem-info:\n"); 195 printk("Mem-info:\n");
196 show_free_areas(); 196 show_free_areas();
197 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 197 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
198 for_each_pgdat(pgdat) { 198 for_each_online_pgdat(pgdat) {
199 unsigned long flags; 199 unsigned long flags;
200 pgdat_resize_lock(pgdat, &flags); 200 pgdat_resize_lock(pgdat, &flags);
201 for (i = 0; i < pgdat->node_spanned_pages; i++) { 201 for (i = 0; i < pgdat->node_spanned_pages; i++) {
@@ -351,7 +351,7 @@ void __init mem_init(void)
351 max_mapnr = max_pfn; 351 max_mapnr = max_pfn;
352 totalram_pages += free_all_bootmem(); 352 totalram_pages += free_all_bootmem();
353#endif 353#endif
354 for_each_pgdat(pgdat) { 354 for_each_online_pgdat(pgdat) {
355 for (i = 0; i < pgdat->node_spanned_pages; i++) { 355 for (i = 0; i < pgdat->node_spanned_pages; i++) {
356 if (!pfn_valid(pgdat->node_start_pfn + i)) 356 if (!pfn_valid(pgdat->node_start_pfn + i))
357 continue; 357 continue;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 61e70d35d808..d9554199afa7 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -103,7 +103,7 @@ spufs_setattr(struct dentry *dentry, struct iattr *attr)
103 103
104static int 104static int
105spufs_new_file(struct super_block *sb, struct dentry *dentry, 105spufs_new_file(struct super_block *sb, struct dentry *dentry,
106 struct file_operations *fops, int mode, 106 const struct file_operations *fops, int mode,
107 struct spu_context *ctx) 107 struct spu_context *ctx)
108{ 108{
109 static struct inode_operations spufs_file_iops = { 109 static struct inode_operations spufs_file_iops = {
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 12c6f689b1aa..7d7889026936 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -120,33 +120,15 @@ int chrp_set_rtc_time(struct rtc_time *tmarg)
120void chrp_get_rtc_time(struct rtc_time *tm) 120void chrp_get_rtc_time(struct rtc_time *tm)
121{ 121{
122 unsigned int year, mon, day, hour, min, sec; 122 unsigned int year, mon, day, hour, min, sec;
123 int uip, i;
124 123
125 /* The Linux interpretation of the CMOS clock register contents: 124 do {
126 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
127 * RTC registers show the second which has precisely just started.
128 * Let's hope other operating systems interpret the RTC the same way.
129 */
130
131 /* Since the UIP flag is set for about 2.2 ms and the clock
132 * is typically written with a precision of 1 jiffy, trying
133 * to obtain a precision better than a few milliseconds is
134 * an illusion. Only consistency is interesting, this also
135 * allows to use the routine for /dev/rtc without a potential
136 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
137 */
138
139 for ( i = 0; i<1000000; i++) {
140 uip = chrp_cmos_clock_read(RTC_FREQ_SELECT);
141 sec = chrp_cmos_clock_read(RTC_SECONDS); 125 sec = chrp_cmos_clock_read(RTC_SECONDS);
142 min = chrp_cmos_clock_read(RTC_MINUTES); 126 min = chrp_cmos_clock_read(RTC_MINUTES);
143 hour = chrp_cmos_clock_read(RTC_HOURS); 127 hour = chrp_cmos_clock_read(RTC_HOURS);
144 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH); 128 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH);
145 mon = chrp_cmos_clock_read(RTC_MONTH); 129 mon = chrp_cmos_clock_read(RTC_MONTH);
146 year = chrp_cmos_clock_read(RTC_YEAR); 130 year = chrp_cmos_clock_read(RTC_YEAR);
147 uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT); 131 } while (sec != chrp_cmos_clock_read(RTC_SECONDS));
148 if ((uip & RTC_UIP)==0) break;
149 }
150 132
151 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 133 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
152 BCD_TO_BIN(sec); 134 BCD_TO_BIN(sec);
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 5e6981d17379..b9a2b3d4bf33 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -60,34 +60,14 @@ static void maple_clock_write(unsigned long val, int addr)
60 60
61void maple_get_rtc_time(struct rtc_time *tm) 61void maple_get_rtc_time(struct rtc_time *tm)
62{ 62{
63 int uip, i; 63 do {
64
65 /* The Linux interpretation of the CMOS clock register contents:
66 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
67 * RTC registers show the second which has precisely just started.
68 * Let's hope other operating systems interpret the RTC the same way.
69 */
70
71 /* Since the UIP flag is set for about 2.2 ms and the clock
72 * is typically written with a precision of 1 jiffy, trying
73 * to obtain a precision better than a few milliseconds is
74 * an illusion. Only consistency is interesting, this also
75 * allows to use the routine for /dev/rtc without a potential
76 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
77 */
78
79 for (i = 0; i<1000000; i++) {
80 uip = maple_clock_read(RTC_FREQ_SELECT);
81 tm->tm_sec = maple_clock_read(RTC_SECONDS); 64 tm->tm_sec = maple_clock_read(RTC_SECONDS);
82 tm->tm_min = maple_clock_read(RTC_MINUTES); 65 tm->tm_min = maple_clock_read(RTC_MINUTES);
83 tm->tm_hour = maple_clock_read(RTC_HOURS); 66 tm->tm_hour = maple_clock_read(RTC_HOURS);
84 tm->tm_mday = maple_clock_read(RTC_DAY_OF_MONTH); 67 tm->tm_mday = maple_clock_read(RTC_DAY_OF_MONTH);
85 tm->tm_mon = maple_clock_read(RTC_MONTH); 68 tm->tm_mon = maple_clock_read(RTC_MONTH);
86 tm->tm_year = maple_clock_read(RTC_YEAR); 69 tm->tm_year = maple_clock_read(RTC_YEAR);
87 uip |= maple_clock_read(RTC_FREQ_SELECT); 70 } while (tm->tm_sec != maple_clock_read(RTC_SECONDS));
88 if ((uip & RTC_UIP)==0)
89 break;
90 }
91 71
92 if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY) 72 if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY)
93 || RTC_ALWAYS_BCD) { 73 || RTC_ALWAYS_BCD) {
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 9a4b592e40bc..1773103354be 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -95,16 +95,16 @@ static struct device_node *derive_parent(const char *path)
95 return parent; 95 return parent;
96} 96}
97 97
98static struct notifier_block *pSeries_reconfig_chain; 98static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
99 99
100int pSeries_reconfig_notifier_register(struct notifier_block *nb) 100int pSeries_reconfig_notifier_register(struct notifier_block *nb)
101{ 101{
102 return notifier_chain_register(&pSeries_reconfig_chain, nb); 102 return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb);
103} 103}
104 104
105void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) 105void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
106{ 106{
107 notifier_chain_unregister(&pSeries_reconfig_chain, nb); 107 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
108} 108}
109 109
110static int pSeries_reconfig_add_node(const char *path, struct property *proplist) 110static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
@@ -132,7 +132,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
132 goto out_err; 132 goto out_err;
133 } 133 }
134 134
135 err = notifier_call_chain(&pSeries_reconfig_chain, 135 err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
136 PSERIES_RECONFIG_ADD, np); 136 PSERIES_RECONFIG_ADD, np);
137 if (err == NOTIFY_BAD) { 137 if (err == NOTIFY_BAD) {
138 printk(KERN_ERR "Failed to add device node %s\n", path); 138 printk(KERN_ERR "Failed to add device node %s\n", path);
@@ -172,7 +172,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
172 172
173 remove_node_proc_entries(np); 173 remove_node_proc_entries(np);
174 174
175 notifier_call_chain(&pSeries_reconfig_chain, 175 blocking_notifier_call_chain(&pSeries_reconfig_chain,
176 PSERIES_RECONFIG_REMOVE, np); 176 PSERIES_RECONFIG_REMOVE, np);
177 of_detach_node(np); 177 of_detach_node(np);
178 178
diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
index eabac6cad1f5..75c645043746 100644
--- a/arch/ppc/kernel/ppc_htab.c
+++ b/arch/ppc/kernel/ppc_htab.c
@@ -52,7 +52,7 @@ static int ppc_htab_open(struct inode *inode, struct file *file)
52 return single_open(file, ppc_htab_show, NULL); 52 return single_open(file, ppc_htab_show, NULL);
53} 53}
54 54
55struct file_operations ppc_htab_operations = { 55const struct file_operations ppc_htab_operations = {
56 .open = ppc_htab_open, 56 .open = ppc_htab_open,
57 .read = seq_read, 57 .read = seq_read,
58 .llseek = seq_lseek, 58 .llseek = seq_lseek,
diff --git a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c
index fa46f8ce5c71..e86f6156d589 100644
--- a/arch/ppc/platforms/prep_setup.c
+++ b/arch/ppc/platforms/prep_setup.c
@@ -736,7 +736,7 @@ ibm_statusled_progress(char *s, unsigned short hex)
736 hex = 0xfff; 736 hex = 0xfff;
737 if (!notifier_installed) { 737 if (!notifier_installed) {
738 ++notifier_installed; 738 ++notifier_installed;
739 notifier_chain_register(&panic_notifier_list, 739 atomic_notifier_chain_register(&panic_notifier_list,
740 &ibm_statusled_block); 740 &ibm_statusled_block);
741 } 741 }
742 } 742 }
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 99182a415fe7..4a0f5a1551ea 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -76,17 +76,17 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
76/* 76/*
77 * Need to know about CPUs going idle? 77 * Need to know about CPUs going idle?
78 */ 78 */
79static struct notifier_block *idle_chain; 79static ATOMIC_NOTIFIER_HEAD(idle_chain);
80 80
81int register_idle_notifier(struct notifier_block *nb) 81int register_idle_notifier(struct notifier_block *nb)
82{ 82{
83 return notifier_chain_register(&idle_chain, nb); 83 return atomic_notifier_chain_register(&idle_chain, nb);
84} 84}
85EXPORT_SYMBOL(register_idle_notifier); 85EXPORT_SYMBOL(register_idle_notifier);
86 86
87int unregister_idle_notifier(struct notifier_block *nb) 87int unregister_idle_notifier(struct notifier_block *nb)
88{ 88{
89 return notifier_chain_unregister(&idle_chain, nb); 89 return atomic_notifier_chain_unregister(&idle_chain, nb);
90} 90}
91EXPORT_SYMBOL(unregister_idle_notifier); 91EXPORT_SYMBOL(unregister_idle_notifier);
92 92
@@ -95,7 +95,7 @@ void do_monitor_call(struct pt_regs *regs, long interruption_code)
95 /* disable monitor call class 0 */ 95 /* disable monitor call class 0 */
96 __ctl_clear_bit(8, 15); 96 __ctl_clear_bit(8, 15);
97 97
98 notifier_call_chain(&idle_chain, CPU_NOT_IDLE, 98 atomic_notifier_call_chain(&idle_chain, CPU_NOT_IDLE,
99 (void *)(long) smp_processor_id()); 99 (void *)(long) smp_processor_id());
100} 100}
101 101
@@ -116,7 +116,8 @@ static void default_idle(void)
116 return; 116 return;
117 } 117 }
118 118
119 rc = notifier_call_chain(&idle_chain, CPU_IDLE, (void *)(long) cpu); 119 rc = atomic_notifier_call_chain(&idle_chain,
120 CPU_IDLE, (void *)(long) cpu);
120 if (rc != NOTIFY_OK && rc != NOTIFY_DONE) 121 if (rc != NOTIFY_OK && rc != NOTIFY_DONE)
121 BUG(); 122 BUG();
122 if (rc != NOTIFY_OK) { 123 if (rc != NOTIFY_OK) {
diff --git a/arch/sh/boards/mpc1211/rtc.c b/arch/sh/boards/mpc1211/rtc.c
index 4d100f048072..a76c655dceee 100644
--- a/arch/sh/boards/mpc1211/rtc.c
+++ b/arch/sh/boards/mpc1211/rtc.c
@@ -9,36 +9,16 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12#include <linux/bcd.h>
12#include <linux/mc146818rtc.h> 13#include <linux/mc146818rtc.h>
13 14
14#ifndef BCD_TO_BIN
15#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
16#endif
17
18#ifndef BIN_TO_BCD
19#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
20#endif
21
22/* arc/i386/kernel/time.c */
23unsigned long get_cmos_time(void) 15unsigned long get_cmos_time(void)
24{ 16{
25 unsigned int year, mon, day, hour, min, sec; 17 unsigned int year, mon, day, hour, min, sec;
26 int i;
27 18
28 spin_lock(&rtc_lock); 19 spin_lock(&rtc_lock);
29 /* The Linux interpretation of the CMOS clock register contents: 20
30 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the 21 do {
31 * RTC registers show the second which has precisely just started.
32 * Let's hope other operating systems interpret the RTC the same way.
33 */
34 /* read RTC exactly on falling edge of update flag */
35 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
36 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
37 break;
38 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
39 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
40 break;
41 do { /* Isn't this overkill ? UIP above should guarantee consistency */
42 sec = CMOS_READ(RTC_SECONDS); 22 sec = CMOS_READ(RTC_SECONDS);
43 min = CMOS_READ(RTC_MINUTES); 23 min = CMOS_READ(RTC_MINUTES);
44 hour = CMOS_READ(RTC_HOURS); 24 hour = CMOS_READ(RTC_HOURS);
@@ -46,18 +26,22 @@ unsigned long get_cmos_time(void)
46 mon = CMOS_READ(RTC_MONTH); 26 mon = CMOS_READ(RTC_MONTH);
47 year = CMOS_READ(RTC_YEAR); 27 year = CMOS_READ(RTC_YEAR);
48 } while (sec != CMOS_READ(RTC_SECONDS)); 28 } while (sec != CMOS_READ(RTC_SECONDS));
49 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 29
50 { 30 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
51 BCD_TO_BIN(sec); 31 BCD_TO_BIN(sec);
52 BCD_TO_BIN(min); 32 BCD_TO_BIN(min);
53 BCD_TO_BIN(hour); 33 BCD_TO_BIN(hour);
54 BCD_TO_BIN(day); 34 BCD_TO_BIN(day);
55 BCD_TO_BIN(mon); 35 BCD_TO_BIN(mon);
56 BCD_TO_BIN(year); 36 BCD_TO_BIN(year);
57 } 37 }
38
58 spin_unlock(&rtc_lock); 39 spin_unlock(&rtc_lock);
59 if ((year += 1900) < 1970) 40
41 year += 1900;
42 if (year < 1970)
60 year += 100; 43 year += 100;
44
61 return mktime(year, mon, day, hour, min, sec); 45 return mktime(year, mon, day, hour, min, sec);
62} 46}
63 47
diff --git a/arch/sh/boards/sh03/rtc.c b/arch/sh/boards/sh03/rtc.c
index cbeca7037ba5..d609863cfe53 100644
--- a/arch/sh/boards/sh03/rtc.c
+++ b/arch/sh/boards/sh03/rtc.c
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12#include <linux/bcd.h>
12#include <asm/io.h> 13#include <asm/io.h>
13#include <linux/rtc.h> 14#include <linux/rtc.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -33,14 +34,6 @@
33#define RTC_BUSY 1 34#define RTC_BUSY 1
34#define RTC_STOP 2 35#define RTC_STOP 2
35 36
36#ifndef BCD_TO_BIN
37#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
38#endif
39
40#ifndef BIN_TO_BCD
41#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
42#endif
43
44extern void (*rtc_get_time)(struct timespec *); 37extern void (*rtc_get_time)(struct timespec *);
45extern int (*rtc_set_time)(const time_t); 38extern int (*rtc_set_time)(const time_t);
46extern spinlock_t rtc_lock; 39extern spinlock_t rtc_lock;
@@ -48,13 +41,9 @@ extern spinlock_t rtc_lock;
48unsigned long get_cmos_time(void) 41unsigned long get_cmos_time(void)
49{ 42{
50 unsigned int year, mon, day, hour, min, sec; 43 unsigned int year, mon, day, hour, min, sec;
51 int i;
52 44
53 spin_lock(&rtc_lock); 45 spin_lock(&rtc_lock);
54 again: 46 again:
55 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
56 if (!(ctrl_inb(RTC_CTL) & RTC_BUSY))
57 break;
58 do { 47 do {
59 sec = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10; 48 sec = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10;
60 min = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10; 49 min = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10;
diff --git a/arch/sh/kernel/cpu/rtc.c b/arch/sh/kernel/cpu/rtc.c
index f8361f5e788b..4304cf75cfa2 100644
--- a/arch/sh/kernel/cpu/rtc.c
+++ b/arch/sh/kernel/cpu/rtc.c
@@ -9,18 +9,10 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12 12#include <linux/bcd.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/rtc.h> 14#include <asm/rtc.h>
15 15
16#ifndef BCD_TO_BIN
17#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
18#endif
19
20#ifndef BIN_TO_BCD
21#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
22#endif
23
24void sh_rtc_gettimeofday(struct timespec *ts) 16void sh_rtc_gettimeofday(struct timespec *ts)
25{ 17{
26 unsigned int sec128, sec, sec2, min, hr, wk, day, mon, yr, yr100, cf_bit; 18 unsigned int sec128, sec, sec2, min, hr, wk, day, mon, yr, yr100, cf_bit;
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index c0e79843f580..7ee4ca203616 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -20,6 +20,7 @@
20#include <linux/root_dev.h> 20#include <linux/root_dev.h>
21#include <linux/utsname.h> 21#include <linux/utsname.h>
22#include <linux/cpu.h> 22#include <linux/cpu.h>
23#include <linux/pfn.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/sections.h> 26#include <asm/sections.h>
@@ -275,10 +276,6 @@ void __init setup_arch(char **cmdline_p)
275 276
276 sh_mv_setup(cmdline_p); 277 sh_mv_setup(cmdline_p);
277 278
278#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
279#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
280#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
281
282 /* 279 /*
283 * Find the highest page frame number we have available 280 * Find the highest page frame number we have available
284 */ 281 */
diff --git a/arch/sh64/kernel/setup.c b/arch/sh64/kernel/setup.c
index c7a7b816a30f..d2711c9c9d13 100644
--- a/arch/sh64/kernel/setup.c
+++ b/arch/sh64/kernel/setup.c
@@ -48,6 +48,7 @@
48#include <linux/root_dev.h> 48#include <linux/root_dev.h>
49#include <linux/cpu.h> 49#include <linux/cpu.h>
50#include <linux/initrd.h> 50#include <linux/initrd.h>
51#include <linux/pfn.h>
51#include <asm/processor.h> 52#include <asm/processor.h>
52#include <asm/page.h> 53#include <asm/page.h>
53#include <asm/pgtable.h> 54#include <asm/pgtable.h>
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index 0773c9f389f3..6b8f4d22abc6 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -30,6 +30,7 @@
30#include <linux/profile.h> 30#include <linux/profile.h>
31#include <linux/smp.h> 31#include <linux/smp.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/bcd.h>
33 34
34#include <asm/registers.h> /* required by inline __asm__ stmt. */ 35#include <asm/registers.h> /* required by inline __asm__ stmt. */
35 36
@@ -105,14 +106,6 @@
105#define RCR1 rtc_base+0x38 106#define RCR1 rtc_base+0x38
106#define RCR2 rtc_base+0x3c 107#define RCR2 rtc_base+0x3c
107 108
108#ifndef BCD_TO_BIN
109#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
110#endif
111
112#ifndef BIN_TO_BCD
113#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
114#endif
115
116#define TICK_SIZE (tick_nsec / 1000) 109#define TICK_SIZE (tick_nsec / 1000)
117 110
118extern unsigned long wall_jiffies; 111extern unsigned long wall_jiffies;
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 7d61f1bfd3d3..e55b5c6ece02 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -641,23 +641,8 @@ static void __init set_system_time(void)
641 mon = MSTK_REG_MONTH(mregs); 641 mon = MSTK_REG_MONTH(mregs);
642 year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) ); 642 year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
643 } else { 643 } else {
644 int i;
645
646 /* Dallas 12887 RTC chip. */ 644 /* Dallas 12887 RTC chip. */
647 645
648 /* Stolen from arch/i386/kernel/time.c, see there for
649 * credits and descriptive comments.
650 */
651 for (i = 0; i < 1000000; i++) {
652 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
653 break;
654 udelay(10);
655 }
656 for (i = 0; i < 1000000; i++) {
657 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
658 break;
659 udelay(10);
660 }
661 do { 646 do {
662 sec = CMOS_READ(RTC_SECONDS); 647 sec = CMOS_READ(RTC_SECONDS);
663 min = CMOS_READ(RTC_MINUTES); 648 min = CMOS_READ(RTC_MINUTES);
@@ -666,6 +651,7 @@ static void __init set_system_time(void)
666 mon = CMOS_READ(RTC_MONTH); 651 mon = CMOS_READ(RTC_MONTH);
667 year = CMOS_READ(RTC_YEAR); 652 year = CMOS_READ(RTC_YEAR);
668 } while (sec != CMOS_READ(RTC_SECONDS)); 653 } while (sec != CMOS_READ(RTC_SECONDS));
654
669 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 655 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
670 BCD_TO_BIN(sec); 656 BCD_TO_BIN(sec);
671 BCD_TO_BIN(min); 657 BCD_TO_BIN(min);
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index df612e4f75f9..ff090bb9734b 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -43,18 +43,19 @@
43#include <linux/kmod.h> 43#include <linux/kmod.h>
44#endif 44#endif
45 45
46struct notifier_block *sparc64die_chain; 46ATOMIC_NOTIFIER_HEAD(sparc64die_chain);
47static DEFINE_SPINLOCK(die_notifier_lock);
48 47
49int register_die_notifier(struct notifier_block *nb) 48int register_die_notifier(struct notifier_block *nb)
50{ 49{
51 int err = 0; 50 return atomic_notifier_chain_register(&sparc64die_chain, nb);
52 unsigned long flags;
53 spin_lock_irqsave(&die_notifier_lock, flags);
54 err = notifier_chain_register(&sparc64die_chain, nb);
55 spin_unlock_irqrestore(&die_notifier_lock, flags);
56 return err;
57} 51}
52EXPORT_SYMBOL(register_die_notifier);
53
54int unregister_die_notifier(struct notifier_block *nb)
55{
56 return atomic_notifier_chain_unregister(&sparc64die_chain, nb);
57}
58EXPORT_SYMBOL(unregister_die_notifier);
58 59
59/* When an irrecoverable trap occurs at tl > 0, the trap entry 60/* When an irrecoverable trap occurs at tl > 0, the trap entry
60 * code logs the trap state registers at every level in the trap 61 * code logs the trap state registers at every level in the trap
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index d21ff3230c02..0db2f7d9fab5 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -413,12 +413,12 @@ good_area:
413#ifdef CONFIG_HUGETLB_PAGE 413#ifdef CONFIG_HUGETLB_PAGE
414 mm_rss -= (mm->context.huge_pte_count * (HPAGE_SIZE / PAGE_SIZE)); 414 mm_rss -= (mm->context.huge_pte_count * (HPAGE_SIZE / PAGE_SIZE));
415#endif 415#endif
416 if (unlikely(mm_rss >= 416 if (unlikely(mm_rss >
417 mm->context.tsb_block[MM_TSB_BASE].tsb_rss_limit)) 417 mm->context.tsb_block[MM_TSB_BASE].tsb_rss_limit))
418 tsb_grow(mm, MM_TSB_BASE, mm_rss); 418 tsb_grow(mm, MM_TSB_BASE, mm_rss);
419#ifdef CONFIG_HUGETLB_PAGE 419#ifdef CONFIG_HUGETLB_PAGE
420 mm_rss = mm->context.huge_pte_count; 420 mm_rss = mm->context.huge_pte_count;
421 if (unlikely(mm_rss >= 421 if (unlikely(mm_rss >
422 mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit)) 422 mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit))
423 tsb_grow(mm, MM_TSB_HUGE, mm_rss); 423 tsb_grow(mm, MM_TSB_HUGE, mm_rss);
424#endif 424#endif
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 54388d10bcf9..1488816588ea 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -762,7 +762,8 @@ static struct notifier_block panic_exit_notifier = {
762 762
763static int add_notifier(void) 763static int add_notifier(void)
764{ 764{
765 notifier_chain_register(&panic_notifier_list, &panic_exit_notifier); 765 atomic_notifier_chain_register(&panic_notifier_list,
766 &panic_exit_notifier);
766 return(0); 767 return(0);
767} 768}
768 769
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index fa617e0719ab..0336575d2448 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -71,7 +71,7 @@ struct io_thread_req {
71 int error; 71 int error;
72}; 72};
73 73
74extern int open_ubd_file(char *file, struct openflags *openflags, 74extern int open_ubd_file(char *file, struct openflags *openflags, int shared,
75 char **backing_file_out, int *bitmap_offset_out, 75 char **backing_file_out, int *bitmap_offset_out,
76 unsigned long *bitmap_len_out, int *data_offset_out, 76 unsigned long *bitmap_len_out, int *data_offset_out,
77 int *create_cow_out); 77 int *create_cow_out);
@@ -137,7 +137,7 @@ static int fake_major = MAJOR_NR;
137 137
138static struct gendisk *ubd_gendisk[MAX_DEV]; 138static struct gendisk *ubd_gendisk[MAX_DEV];
139static struct gendisk *fake_gendisk[MAX_DEV]; 139static struct gendisk *fake_gendisk[MAX_DEV];
140 140
141#ifdef CONFIG_BLK_DEV_UBD_SYNC 141#ifdef CONFIG_BLK_DEV_UBD_SYNC
142#define OPEN_FLAGS ((struct openflags) { .r = 1, .w = 1, .s = 1, .c = 0, \ 142#define OPEN_FLAGS ((struct openflags) { .r = 1, .w = 1, .s = 1, .c = 0, \
143 .cl = 1 }) 143 .cl = 1 })
@@ -168,6 +168,7 @@ struct ubd {
168 __u64 size; 168 __u64 size;
169 struct openflags boot_openflags; 169 struct openflags boot_openflags;
170 struct openflags openflags; 170 struct openflags openflags;
171 int shared;
171 int no_cow; 172 int no_cow;
172 struct cow cow; 173 struct cow cow;
173 struct platform_device pdev; 174 struct platform_device pdev;
@@ -189,6 +190,7 @@ struct ubd {
189 .boot_openflags = OPEN_FLAGS, \ 190 .boot_openflags = OPEN_FLAGS, \
190 .openflags = OPEN_FLAGS, \ 191 .openflags = OPEN_FLAGS, \
191 .no_cow = 0, \ 192 .no_cow = 0, \
193 .shared = 0, \
192 .cow = DEFAULT_COW, \ 194 .cow = DEFAULT_COW, \
193} 195}
194 196
@@ -305,7 +307,7 @@ static int ubd_setup_common(char *str, int *index_out)
305 } 307 }
306 major = simple_strtoul(str, &end, 0); 308 major = simple_strtoul(str, &end, 0);
307 if((*end != '\0') || (end == str)){ 309 if((*end != '\0') || (end == str)){
308 printk(KERN_ERR 310 printk(KERN_ERR
309 "ubd_setup : didn't parse major number\n"); 311 "ubd_setup : didn't parse major number\n");
310 return(1); 312 return(1);
311 } 313 }
@@ -316,7 +318,7 @@ static int ubd_setup_common(char *str, int *index_out)
316 printk(KERN_ERR "Can't assign a fake major twice\n"); 318 printk(KERN_ERR "Can't assign a fake major twice\n");
317 goto out1; 319 goto out1;
318 } 320 }
319 321
320 fake_major = major; 322 fake_major = major;
321 323
322 printk(KERN_INFO "Setting extra ubd major number to %d\n", 324 printk(KERN_INFO "Setting extra ubd major number to %d\n",
@@ -351,7 +353,7 @@ static int ubd_setup_common(char *str, int *index_out)
351 if (index_out) 353 if (index_out)
352 *index_out = n; 354 *index_out = n;
353 355
354 for (i = 0; i < 4; i++) { 356 for (i = 0; i < sizeof("rscd="); i++) {
355 switch (*str) { 357 switch (*str) {
356 case 'r': 358 case 'r':
357 flags.w = 0; 359 flags.w = 0;
@@ -362,11 +364,14 @@ static int ubd_setup_common(char *str, int *index_out)
362 case 'd': 364 case 'd':
363 dev->no_cow = 1; 365 dev->no_cow = 1;
364 break; 366 break;
367 case 'c':
368 dev->shared = 1;
369 break;
365 case '=': 370 case '=':
366 str++; 371 str++;
367 goto break_loop; 372 goto break_loop;
368 default: 373 default:
369 printk(KERN_ERR "ubd_setup : Expected '=' or flag letter (r,s or d)\n"); 374 printk(KERN_ERR "ubd_setup : Expected '=' or flag letter (r, s, c, or d)\n");
370 goto out; 375 goto out;
371 } 376 }
372 str++; 377 str++;
@@ -515,7 +520,7 @@ static void ubd_handler(void)
515 spin_unlock(&ubd_io_lock); 520 spin_unlock(&ubd_io_lock);
516 return; 521 return;
517 } 522 }
518 523
519 ubd_finish(rq, req.error); 524 ubd_finish(rq, req.error);
520 reactivate_fd(thread_fd, UBD_IRQ); 525 reactivate_fd(thread_fd, UBD_IRQ);
521 do_ubd_request(ubd_queue); 526 do_ubd_request(ubd_queue);
@@ -532,7 +537,7 @@ static int io_pid = -1;
532 537
533void kill_io_thread(void) 538void kill_io_thread(void)
534{ 539{
535 if(io_pid != -1) 540 if(io_pid != -1)
536 os_kill_process(io_pid, 1); 541 os_kill_process(io_pid, 1);
537} 542}
538 543
@@ -567,14 +572,15 @@ static int ubd_open_dev(struct ubd *dev)
567 create_cow = 0; 572 create_cow = 0;
568 create_ptr = (dev->cow.file != NULL) ? &create_cow : NULL; 573 create_ptr = (dev->cow.file != NULL) ? &create_cow : NULL;
569 back_ptr = dev->no_cow ? NULL : &dev->cow.file; 574 back_ptr = dev->no_cow ? NULL : &dev->cow.file;
570 dev->fd = open_ubd_file(dev->file, &dev->openflags, back_ptr, 575 dev->fd = open_ubd_file(dev->file, &dev->openflags, dev->shared,
571 &dev->cow.bitmap_offset, &dev->cow.bitmap_len, 576 back_ptr, &dev->cow.bitmap_offset,
572 &dev->cow.data_offset, create_ptr); 577 &dev->cow.bitmap_len, &dev->cow.data_offset,
578 create_ptr);
573 579
574 if((dev->fd == -ENOENT) && create_cow){ 580 if((dev->fd == -ENOENT) && create_cow){
575 dev->fd = create_cow_file(dev->file, dev->cow.file, 581 dev->fd = create_cow_file(dev->file, dev->cow.file,
576 dev->openflags, 1 << 9, PAGE_SIZE, 582 dev->openflags, 1 << 9, PAGE_SIZE,
577 &dev->cow.bitmap_offset, 583 &dev->cow.bitmap_offset,
578 &dev->cow.bitmap_len, 584 &dev->cow.bitmap_len,
579 &dev->cow.data_offset); 585 &dev->cow.data_offset);
580 if(dev->fd >= 0){ 586 if(dev->fd >= 0){
@@ -598,16 +604,16 @@ static int ubd_open_dev(struct ubd *dev)
598 } 604 }
599 flush_tlb_kernel_vm(); 605 flush_tlb_kernel_vm();
600 606
601 err = read_cow_bitmap(dev->fd, dev->cow.bitmap, 607 err = read_cow_bitmap(dev->fd, dev->cow.bitmap,
602 dev->cow.bitmap_offset, 608 dev->cow.bitmap_offset,
603 dev->cow.bitmap_len); 609 dev->cow.bitmap_len);
604 if(err < 0) 610 if(err < 0)
605 goto error; 611 goto error;
606 612
607 flags = dev->openflags; 613 flags = dev->openflags;
608 flags.w = 0; 614 flags.w = 0;
609 err = open_ubd_file(dev->cow.file, &flags, NULL, NULL, NULL, 615 err = open_ubd_file(dev->cow.file, &flags, dev->shared, NULL,
610 NULL, NULL); 616 NULL, NULL, NULL, NULL);
611 if(err < 0) goto error; 617 if(err < 0) goto error;
612 dev->cow.fd = err; 618 dev->cow.fd = err;
613 } 619 }
@@ -685,11 +691,11 @@ static int ubd_add(int n)
685 dev->size = ROUND_BLOCK(dev->size); 691 dev->size = ROUND_BLOCK(dev->size);
686 692
687 err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]); 693 err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]);
688 if(err) 694 if(err)
689 goto out_close; 695 goto out_close;
690 696
691 if(fake_major != MAJOR_NR) 697 if(fake_major != MAJOR_NR)
692 ubd_new_disk(fake_major, dev->size, n, 698 ubd_new_disk(fake_major, dev->size, n,
693 &fake_gendisk[n]); 699 &fake_gendisk[n]);
694 700
695 /* perhaps this should also be under the "if (fake_major)" above */ 701 /* perhaps this should also be under the "if (fake_major)" above */
@@ -854,7 +860,7 @@ int ubd_init(void)
854 return -1; 860 return -1;
855 } 861 }
856 platform_driver_register(&ubd_driver); 862 platform_driver_register(&ubd_driver);
857 for (i = 0; i < MAX_DEV; i++) 863 for (i = 0; i < MAX_DEV; i++)
858 ubd_add(i); 864 ubd_add(i);
859 return 0; 865 return 0;
860} 866}
@@ -872,16 +878,16 @@ int ubd_driver_init(void){
872 * enough. So use anyway the io thread. */ 878 * enough. So use anyway the io thread. */
873 } 879 }
874 stack = alloc_stack(0, 0); 880 stack = alloc_stack(0, 0);
875 io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *), 881 io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *),
876 &thread_fd); 882 &thread_fd);
877 if(io_pid < 0){ 883 if(io_pid < 0){
878 printk(KERN_ERR 884 printk(KERN_ERR
879 "ubd : Failed to start I/O thread (errno = %d) - " 885 "ubd : Failed to start I/O thread (errno = %d) - "
880 "falling back to synchronous I/O\n", -io_pid); 886 "falling back to synchronous I/O\n", -io_pid);
881 io_pid = -1; 887 io_pid = -1;
882 return(0); 888 return(0);
883 } 889 }
884 err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr, 890 err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr,
885 SA_INTERRUPT, "ubd", ubd_dev); 891 SA_INTERRUPT, "ubd", ubd_dev);
886 if(err != 0) 892 if(err != 0)
887 printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err); 893 printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err);
@@ -978,7 +984,7 @@ static void cowify_req(struct io_thread_req *req, unsigned long *bitmap,
978 if(req->op == UBD_READ) { 984 if(req->op == UBD_READ) {
979 for(i = 0; i < req->length >> 9; i++){ 985 for(i = 0; i < req->length >> 9; i++){
980 if(ubd_test_bit(sector + i, (unsigned char *) bitmap)) 986 if(ubd_test_bit(sector + i, (unsigned char *) bitmap))
981 ubd_set_bit(i, (unsigned char *) 987 ubd_set_bit(i, (unsigned char *)
982 &req->sector_mask); 988 &req->sector_mask);
983 } 989 }
984 } 990 }
@@ -999,7 +1005,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
999 1005
1000 /* This should be impossible now */ 1006 /* This should be impossible now */
1001 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ 1007 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){
1002 printk("Write attempted on readonly ubd device %s\n", 1008 printk("Write attempted on readonly ubd device %s\n",
1003 disk->disk_name); 1009 disk->disk_name);
1004 end_request(req, 0); 1010 end_request(req, 0);
1005 return(1); 1011 return(1);
@@ -1182,7 +1188,7 @@ int read_cow_bitmap(int fd, void *buf, int offset, int len)
1182 return(0); 1188 return(0);
1183} 1189}
1184 1190
1185int open_ubd_file(char *file, struct openflags *openflags, 1191int open_ubd_file(char *file, struct openflags *openflags, int shared,
1186 char **backing_file_out, int *bitmap_offset_out, 1192 char **backing_file_out, int *bitmap_offset_out,
1187 unsigned long *bitmap_len_out, int *data_offset_out, 1193 unsigned long *bitmap_len_out, int *data_offset_out,
1188 int *create_cow_out) 1194 int *create_cow_out)
@@ -1206,10 +1212,14 @@ int open_ubd_file(char *file, struct openflags *openflags,
1206 return fd; 1212 return fd;
1207 } 1213 }
1208 1214
1209 err = os_lock_file(fd, openflags->w); 1215 if(shared)
1210 if(err < 0){ 1216 printk("Not locking \"%s\" on the host\n", file);
1211 printk("Failed to lock '%s', err = %d\n", file, -err); 1217 else {
1212 goto out_close; 1218 err = os_lock_file(fd, openflags->w);
1219 if(err < 0){
1220 printk("Failed to lock '%s', err = %d\n", file, -err);
1221 goto out_close;
1222 }
1213 } 1223 }
1214 1224
1215 /* Succesful return case! */ 1225 /* Succesful return case! */
@@ -1260,7 +1270,7 @@ int create_cow_file(char *cow_file, char *backing_file, struct openflags flags,
1260 int err, fd; 1270 int err, fd;
1261 1271
1262 flags.c = 1; 1272 flags.c = 1;
1263 fd = open_ubd_file(cow_file, &flags, NULL, NULL, NULL, NULL, NULL); 1273 fd = open_ubd_file(cow_file, &flags, 0, NULL, NULL, NULL, NULL, NULL);
1264 if(fd < 0){ 1274 if(fd < 0){
1265 err = fd; 1275 err = fd;
1266 printk("Open of COW file '%s' failed, errno = %d\n", cow_file, 1276 printk("Open of COW file '%s' failed, errno = %d\n", cow_file,
diff --git a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h
index b61deb8b362a..69a93c804f0e 100644
--- a/arch/um/include/irq_user.h
+++ b/arch/um/include/irq_user.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -6,6 +6,17 @@
6#ifndef __IRQ_USER_H__ 6#ifndef __IRQ_USER_H__
7#define __IRQ_USER_H__ 7#define __IRQ_USER_H__
8 8
9struct irq_fd {
10 struct irq_fd *next;
11 void *id;
12 int fd;
13 int type;
14 int irq;
15 int pid;
16 int events;
17 int current_events;
18};
19
9enum { IRQ_READ, IRQ_WRITE }; 20enum { IRQ_READ, IRQ_WRITE };
10 21
11extern void sigio_handler(int sig, union uml_pt_regs *regs); 22extern void sigio_handler(int sig, union uml_pt_regs *regs);
@@ -16,8 +27,6 @@ extern void reactivate_fd(int fd, int irqnum);
16extern void deactivate_fd(int fd, int irqnum); 27extern void deactivate_fd(int fd, int irqnum);
17extern int deactivate_all_fds(void); 28extern int deactivate_all_fds(void);
18extern void forward_interrupts(int pid); 29extern void forward_interrupts(int pid);
19extern void init_irq_signals(int on_sigstack);
20extern void forward_ipi(int fd, int pid);
21extern int activate_ipi(int fd, int pid); 30extern int activate_ipi(int fd, int pid);
22extern unsigned long irq_lock(void); 31extern unsigned long irq_lock(void);
23extern void irq_unlock(unsigned long flags); 32extern void irq_unlock(unsigned long flags);
diff --git a/arch/um/include/kern.h b/arch/um/include/kern.h
index 7d223beccbc0..4ce3fc650e57 100644
--- a/arch/um/include/kern.h
+++ b/arch/um/include/kern.h
@@ -29,7 +29,7 @@ extern int getuid(void);
29extern int getgid(void); 29extern int getgid(void);
30extern int pause(void); 30extern int pause(void);
31extern int write(int, const void *, int); 31extern int write(int, const void *, int);
32extern int exit(int); 32extern void exit(int);
33extern int close(int); 33extern int close(int);
34extern int read(unsigned int, char *, int); 34extern int read(unsigned int, char *, int);
35extern int pipe(int *); 35extern int pipe(int *);
diff --git a/arch/um/include/misc_constants.h b/arch/um/include/misc_constants.h
new file mode 100644
index 000000000000..989bc08de36e
--- /dev/null
+++ b/arch/um/include/misc_constants.h
@@ -0,0 +1,6 @@
1#ifndef __MISC_CONSTANT_H_
2#define __MISC_CONSTANT_H_
3
4#include <user_constants.h>
5
6#endif
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 2a1c64d8d0bf..d3d1bc6074ef 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -12,6 +12,7 @@
12#include "sysdep/ptrace.h" 12#include "sysdep/ptrace.h"
13#include "kern_util.h" 13#include "kern_util.h"
14#include "skas/mm_id.h" 14#include "skas/mm_id.h"
15#include "irq_user.h"
15 16
16#define OS_TYPE_FILE 1 17#define OS_TYPE_FILE 1
17#define OS_TYPE_DIR 2 18#define OS_TYPE_DIR 2
@@ -121,6 +122,7 @@ static inline struct openflags of_cloexec(struct openflags flags)
121 return(flags); 122 return(flags);
122} 123}
123 124
125/* file.c */
124extern int os_stat_file(const char *file_name, struct uml_stat *buf); 126extern int os_stat_file(const char *file_name, struct uml_stat *buf);
125extern int os_stat_fd(const int fd, struct uml_stat *buf); 127extern int os_stat_fd(const int fd, struct uml_stat *buf);
126extern int os_access(const char *file, int mode); 128extern int os_access(const char *file, int mode);
@@ -156,10 +158,20 @@ extern int os_connect_socket(char *name);
156extern int os_file_type(char *file); 158extern int os_file_type(char *file);
157extern int os_file_mode(char *file, struct openflags *mode_out); 159extern int os_file_mode(char *file, struct openflags *mode_out);
158extern int os_lock_file(int fd, int excl); 160extern int os_lock_file(int fd, int excl);
161extern void os_flush_stdout(void);
162extern int os_stat_filesystem(char *path, long *bsize_out,
163 long long *blocks_out, long long *bfree_out,
164 long long *bavail_out, long long *files_out,
165 long long *ffree_out, void *fsid_out,
166 int fsid_size, long *namelen_out,
167 long *spare_out);
168extern int os_change_dir(char *dir);
169extern int os_fchange_dir(int fd);
159 170
160/* start_up.c */ 171/* start_up.c */
161extern void os_early_checks(void); 172extern void os_early_checks(void);
162extern int can_do_skas(void); 173extern int can_do_skas(void);
174extern void os_check_bugs(void);
163 175
164/* Make sure they are clear when running in TT mode. Required by 176/* Make sure they are clear when running in TT mode. Required by
165 * SEGV_MAYBE_FIXABLE */ 177 * SEGV_MAYBE_FIXABLE */
@@ -198,6 +210,8 @@ extern void os_flush_stdout(void);
198/* tt.c 210/* tt.c
199 * for tt mode only (will be deleted in future...) 211 * for tt mode only (will be deleted in future...)
200 */ 212 */
213extern void forward_ipi(int fd, int pid);
214extern void kill_child_dead(int pid);
201extern void stop(void); 215extern void stop(void);
202extern int wait_for_stop(int pid, int sig, int cont_type, void *relay); 216extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
203extern int protect_memory(unsigned long addr, unsigned long len, 217extern int protect_memory(unsigned long addr, unsigned long len,
@@ -294,4 +308,26 @@ extern void initial_thread_cb_skas(void (*proc)(void *),
294extern void halt_skas(void); 308extern void halt_skas(void);
295extern void reboot_skas(void); 309extern void reboot_skas(void);
296 310
311/* irq.c */
312extern int os_waiting_for_events(struct irq_fd *active_fds);
313extern int os_isatty(int fd);
314extern int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds);
315extern void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
316 struct irq_fd *active_fds, struct irq_fd ***last_irq_ptr2);
317extern void os_free_irq_later(struct irq_fd *active_fds,
318 int irq, void *dev_id);
319extern int os_get_pollfd(int i);
320extern void os_set_pollfd(int i, int fd);
321extern void os_set_ioignore(void);
322extern void init_irq_signals(int on_sigstack);
323
324/* sigio.c */
325extern void write_sigio_workaround(void);
326extern int add_sigio_fd(int fd, int read);
327extern int ignore_sigio_fd(int fd);
328
329/* skas/trap */
330extern void sig_handler_common_skas(int sig, void *sc_ptr);
331extern void user_signal(int sig, union uml_pt_regs *regs, int pid);
332
297#endif 333#endif
diff --git a/arch/um/include/sigio.h b/arch/um/include/sigio.h
index 37d76e29a147..fe99ea163c2e 100644
--- a/arch/um/include/sigio.h
+++ b/arch/um/include/sigio.h
@@ -8,9 +8,6 @@
8 8
9extern int write_sigio_irq(int fd); 9extern int write_sigio_irq(int fd);
10extern int register_sigio_fd(int fd); 10extern int register_sigio_fd(int fd);
11extern int read_sigio_fd(int fd);
12extern int add_sigio_fd(int fd, int read);
13extern int ignore_sigio_fd(int fd);
14extern void sigio_lock(void); 11extern void sigio_lock(void);
15extern void sigio_unlock(void); 12extern void sigio_unlock(void);
16 13
diff --git a/arch/um/include/skas/mode-skas.h b/arch/um/include/skas/mode-skas.h
index 260065cfeef1..8bc6916bbbb1 100644
--- a/arch/um/include/skas/mode-skas.h
+++ b/arch/um/include/skas/mode-skas.h
@@ -13,7 +13,6 @@ extern unsigned long exec_fp_regs[];
13extern unsigned long exec_fpx_regs[]; 13extern unsigned long exec_fpx_regs[];
14extern int have_fpx_regs; 14extern int have_fpx_regs;
15 15
16extern void sig_handler_common_skas(int sig, void *sc_ptr);
17extern void kill_off_processes_skas(void); 16extern void kill_off_processes_skas(void);
18 17
19#endif 18#endif
diff --git a/arch/um/include/skas/skas.h b/arch/um/include/skas/skas.h
index 86357282d681..853b26f148c5 100644
--- a/arch/um/include/skas/skas.h
+++ b/arch/um/include/skas/skas.h
@@ -17,7 +17,6 @@ extern int user_thread(unsigned long stack, int flags);
17extern void new_thread_proc(void *stack, void (*handler)(int sig)); 17extern void new_thread_proc(void *stack, void (*handler)(int sig));
18extern void new_thread_handler(int sig); 18extern void new_thread_handler(int sig);
19extern void handle_syscall(union uml_pt_regs *regs); 19extern void handle_syscall(union uml_pt_regs *regs);
20extern void user_signal(int sig, union uml_pt_regs *regs, int pid);
21extern int new_mm(unsigned long stack); 20extern int new_mm(unsigned long stack);
22extern void get_skas_faultinfo(int pid, struct faultinfo * fi); 21extern void get_skas_faultinfo(int pid, struct faultinfo * fi);
23extern long execute_syscall_skas(void *r); 22extern long execute_syscall_skas(void *r);
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h
index a6f1f176cf84..992a7e1e0fca 100644
--- a/arch/um/include/user_util.h
+++ b/arch/um/include/user_util.h
@@ -58,7 +58,6 @@ extern int attach(int pid);
58extern void kill_child_dead(int pid); 58extern void kill_child_dead(int pid);
59extern int cont(int pid); 59extern int cont(int pid);
60extern void check_sigio(void); 60extern void check_sigio(void);
61extern void write_sigio_workaround(void);
62extern void arch_check_bugs(void); 61extern void arch_check_bugs(void);
63extern int cpu_feature(char *what, char *buf, int len); 62extern int cpu_feature(char *what, char *buf, int len);
64extern int arch_handle_signal(int sig, union uml_pt_regs *regs); 63extern int arch_handle_signal(int sig, union uml_pt_regs *regs);
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 693018ba80f1..fe08971b64cf 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -7,23 +7,20 @@ extra-y := vmlinux.lds
7clean-files := 7clean-files :=
8 8
9obj-y = config.o exec_kern.o exitcode.o \ 9obj-y = config.o exec_kern.o exitcode.o \
10 init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \ 10 init_task.o irq.o ksyms.o mem.o physmem.o \
11 process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \ 11 process_kern.o ptrace.o reboot.o resource.o sigio_kern.o \
12 signal_kern.o smp.o syscall_kern.o sysrq.o \ 12 signal_kern.o smp.o syscall_kern.o sysrq.o \
13 time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o 13 time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o
14 14
15obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o 15obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
16obj-$(CONFIG_GPROF) += gprof_syms.o 16obj-$(CONFIG_GPROF) += gprof_syms.o
17obj-$(CONFIG_GCOV) += gmon_syms.o 17obj-$(CONFIG_GCOV) += gmon_syms.o
18obj-$(CONFIG_TTY_LOG) += tty_log.o
19obj-$(CONFIG_SYSCALL_DEBUG) += syscall.o 18obj-$(CONFIG_SYSCALL_DEBUG) += syscall.o
20 19
21obj-$(CONFIG_MODE_TT) += tt/ 20obj-$(CONFIG_MODE_TT) += tt/
22obj-$(CONFIG_MODE_SKAS) += skas/ 21obj-$(CONFIG_MODE_SKAS) += skas/
23 22
24user-objs-$(CONFIG_TTY_LOG) += tty_log.o 23USER_OBJS := config.o
25
26USER_OBJS := $(user-objs-y) config.o tty_log.o
27 24
28include arch/um/scripts/Makefile.rules 25include arch/um/scripts/Makefile.rules
29 26
diff --git a/arch/um/kernel/exec_kern.c b/arch/um/kernel/exec_kern.c
index c264e1c05ab3..1ca84319317d 100644
--- a/arch/um/kernel/exec_kern.c
+++ b/arch/um/kernel/exec_kern.c
@@ -30,8 +30,6 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
30 CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); 30 CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp);
31} 31}
32 32
33extern void log_exec(char **argv, void *tty);
34
35static long execve1(char *file, char __user * __user *argv, 33static long execve1(char *file, char __user * __user *argv,
36 char __user *__user *env) 34 char __user *__user *env)
37{ 35{
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index bbf94bf2921e..c39ea3abeda4 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -31,6 +31,8 @@
31#include "irq_user.h" 31#include "irq_user.h"
32#include "irq_kern.h" 32#include "irq_kern.h"
33#include "os.h" 33#include "os.h"
34#include "sigio.h"
35#include "misc_constants.h"
34 36
35/* 37/*
36 * Generic, controller-independent functions: 38 * Generic, controller-independent functions:
@@ -77,6 +79,298 @@ skip:
77 return 0; 79 return 0;
78} 80}
79 81
82struct irq_fd *active_fds = NULL;
83static struct irq_fd **last_irq_ptr = &active_fds;
84
85extern void free_irqs(void);
86
87void sigio_handler(int sig, union uml_pt_regs *regs)
88{
89 struct irq_fd *irq_fd;
90 int n;
91
92 if(smp_sigio_handler()) return;
93 while(1){
94 n = os_waiting_for_events(active_fds);
95 if (n <= 0) {
96 if(n == -EINTR) continue;
97 else break;
98 }
99
100 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
101 if(irq_fd->current_events != 0){
102 irq_fd->current_events = 0;
103 do_IRQ(irq_fd->irq, regs);
104 }
105 }
106 }
107
108 free_irqs();
109}
110
111static void maybe_sigio_broken(int fd, int type)
112{
113 if(os_isatty(fd)){
114 if((type == IRQ_WRITE) && !pty_output_sigio){
115 write_sigio_workaround();
116 add_sigio_fd(fd, 0);
117 }
118 else if((type == IRQ_READ) && !pty_close_sigio){
119 write_sigio_workaround();
120 add_sigio_fd(fd, 1);
121 }
122 }
123}
124
125
126int activate_fd(int irq, int fd, int type, void *dev_id)
127{
128 struct pollfd *tmp_pfd;
129 struct irq_fd *new_fd, *irq_fd;
130 unsigned long flags;
131 int pid, events, err, n;
132
133 pid = os_getpid();
134 err = os_set_fd_async(fd, pid);
135 if(err < 0)
136 goto out;
137
138 new_fd = um_kmalloc(sizeof(*new_fd));
139 err = -ENOMEM;
140 if(new_fd == NULL)
141 goto out;
142
143 if(type == IRQ_READ) events = UM_POLLIN | UM_POLLPRI;
144 else events = UM_POLLOUT;
145 *new_fd = ((struct irq_fd) { .next = NULL,
146 .id = dev_id,
147 .fd = fd,
148 .type = type,
149 .irq = irq,
150 .pid = pid,
151 .events = events,
152 .current_events = 0 } );
153
154 /* Critical section - locked by a spinlock because this stuff can
155 * be changed from interrupt handlers. The stuff above is done
156 * outside the lock because it allocates memory.
157 */
158
159 /* Actually, it only looks like it can be called from interrupt
160 * context. The culprit is reactivate_fd, which calls
161 * maybe_sigio_broken, which calls write_sigio_workaround,
162 * which calls activate_fd. However, write_sigio_workaround should
163 * only be called once, at boot time. That would make it clear that
164 * this is called only from process context, and can be locked with
165 * a semaphore.
166 */
167 flags = irq_lock();
168 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
169 if((irq_fd->fd == fd) && (irq_fd->type == type)){
170 printk("Registering fd %d twice\n", fd);
171 printk("Irqs : %d, %d\n", irq_fd->irq, irq);
172 printk("Ids : 0x%p, 0x%p\n", irq_fd->id, dev_id);
173 goto out_unlock;
174 }
175 }
176
177 /*-------------*/
178 if(type == IRQ_WRITE)
179 fd = -1;
180
181 tmp_pfd = NULL;
182 n = 0;
183
184 while(1){
185 n = os_create_pollfd(fd, events, tmp_pfd, n);
186 if (n == 0)
187 break;
188
189 /* n > 0
190 * It means we couldn't put new pollfd to current pollfds
191 * and tmp_fds is NULL or too small for new pollfds array.
192 * Needed size is equal to n as minimum.
193 *
194 * Here we have to drop the lock in order to call
195 * kmalloc, which might sleep.
196 * If something else came in and changed the pollfds array
197 * so we will not be able to put new pollfd struct to pollfds
198 * then we free the buffer tmp_fds and try again.
199 */
200 irq_unlock(flags);
201 if (tmp_pfd != NULL) {
202 kfree(tmp_pfd);
203 tmp_pfd = NULL;
204 }
205
206 tmp_pfd = um_kmalloc(n);
207 if (tmp_pfd == NULL)
208 goto out_kfree;
209
210 flags = irq_lock();
211 }
212 /*-------------*/
213
214 *last_irq_ptr = new_fd;
215 last_irq_ptr = &new_fd->next;
216
217 irq_unlock(flags);
218
219 /* This calls activate_fd, so it has to be outside the critical
220 * section.
221 */
222 maybe_sigio_broken(fd, type);
223
224 return(0);
225
226 out_unlock:
227 irq_unlock(flags);
228 out_kfree:
229 kfree(new_fd);
230 out:
231 return(err);
232}
233
234static void free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg)
235{
236 unsigned long flags;
237
238 flags = irq_lock();
239 os_free_irq_by_cb(test, arg, active_fds, &last_irq_ptr);
240 irq_unlock(flags);
241}
242
243struct irq_and_dev {
244 int irq;
245 void *dev;
246};
247
248static int same_irq_and_dev(struct irq_fd *irq, void *d)
249{
250 struct irq_and_dev *data = d;
251
252 return((irq->irq == data->irq) && (irq->id == data->dev));
253}
254
255void free_irq_by_irq_and_dev(unsigned int irq, void *dev)
256{
257 struct irq_and_dev data = ((struct irq_and_dev) { .irq = irq,
258 .dev = dev });
259
260 free_irq_by_cb(same_irq_and_dev, &data);
261}
262
263static int same_fd(struct irq_fd *irq, void *fd)
264{
265 return(irq->fd == *((int *) fd));
266}
267
268void free_irq_by_fd(int fd)
269{
270 free_irq_by_cb(same_fd, &fd);
271}
272
273static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out)
274{
275 struct irq_fd *irq;
276 int i = 0;
277 int fdi;
278
279 for(irq=active_fds; irq != NULL; irq = irq->next){
280 if((irq->fd == fd) && (irq->irq == irqnum)) break;
281 i++;
282 }
283 if(irq == NULL){
284 printk("find_irq_by_fd doesn't have descriptor %d\n", fd);
285 goto out;
286 }
287 fdi = os_get_pollfd(i);
288 if((fdi != -1) && (fdi != fd)){
289 printk("find_irq_by_fd - mismatch between active_fds and "
290 "pollfds, fd %d vs %d, need %d\n", irq->fd,
291 fdi, fd);
292 irq = NULL;
293 goto out;
294 }
295 *index_out = i;
296 out:
297 return(irq);
298}
299
300void reactivate_fd(int fd, int irqnum)
301{
302 struct irq_fd *irq;
303 unsigned long flags;
304 int i;
305
306 flags = irq_lock();
307 irq = find_irq_by_fd(fd, irqnum, &i);
308 if(irq == NULL){
309 irq_unlock(flags);
310 return;
311 }
312 os_set_pollfd(i, irq->fd);
313 irq_unlock(flags);
314
315 /* This calls activate_fd, so it has to be outside the critical
316 * section.
317 */
318 maybe_sigio_broken(fd, irq->type);
319}
320
321void deactivate_fd(int fd, int irqnum)
322{
323 struct irq_fd *irq;
324 unsigned long flags;
325 int i;
326
327 flags = irq_lock();
328 irq = find_irq_by_fd(fd, irqnum, &i);
329 if(irq == NULL)
330 goto out;
331 os_set_pollfd(i, -1);
332 out:
333 irq_unlock(flags);
334}
335
336int deactivate_all_fds(void)
337{
338 struct irq_fd *irq;
339 int err;
340
341 for(irq=active_fds;irq != NULL;irq = irq->next){
342 err = os_clear_fd_async(irq->fd);
343 if(err)
344 return(err);
345 }
346 /* If there is a signal already queued, after unblocking ignore it */
347 os_set_ioignore();
348
349 return(0);
350}
351
352void forward_interrupts(int pid)
353{
354 struct irq_fd *irq;
355 unsigned long flags;
356 int err;
357
358 flags = irq_lock();
359 for(irq=active_fds;irq != NULL;irq = irq->next){
360 err = os_set_owner(irq->fd, pid);
361 if(err < 0){
362 /* XXX Just remove the irq rather than
363 * print out an infinite stream of these
364 */
365 printk("Failed to forward %d to pid %d, err = %d\n",
366 irq->fd, pid, -err);
367 }
368
369 irq->pid = pid;
370 }
371 irq_unlock(flags);
372}
373
80/* 374/*
81 * do_IRQ handles all normal device IRQ's (the special 375 * do_IRQ handles all normal device IRQ's (the special
82 * SMP cross-CPU interrupts have their own specific 376 * SMP cross-CPU interrupts have their own specific
diff --git a/arch/um/kernel/irq_user.c b/arch/um/kernel/irq_user.c
deleted file mode 100644
index 0e32f5f4a887..000000000000
--- a/arch/um/kernel/irq_user.c
+++ /dev/null
@@ -1,412 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <unistd.h>
8#include <errno.h>
9#include <signal.h>
10#include <string.h>
11#include <sys/poll.h>
12#include <sys/types.h>
13#include <sys/time.h>
14#include "user_util.h"
15#include "kern_util.h"
16#include "user.h"
17#include "process.h"
18#include "sigio.h"
19#include "irq_user.h"
20#include "os.h"
21
22struct irq_fd {
23 struct irq_fd *next;
24 void *id;
25 int fd;
26 int type;
27 int irq;
28 int pid;
29 int events;
30 int current_events;
31};
32
33static struct irq_fd *active_fds = NULL;
34static struct irq_fd **last_irq_ptr = &active_fds;
35
36static struct pollfd *pollfds = NULL;
37static int pollfds_num = 0;
38static int pollfds_size = 0;
39
40extern int io_count, intr_count;
41
42extern void free_irqs(void);
43
44void sigio_handler(int sig, union uml_pt_regs *regs)
45{
46 struct irq_fd *irq_fd;
47 int i, n;
48
49 if(smp_sigio_handler()) return;
50 while(1){
51 n = poll(pollfds, pollfds_num, 0);
52 if(n < 0){
53 if(errno == EINTR) continue;
54 printk("sigio_handler : poll returned %d, "
55 "errno = %d\n", n, errno);
56 break;
57 }
58 if(n == 0) break;
59
60 irq_fd = active_fds;
61 for(i = 0; i < pollfds_num; i++){
62 if(pollfds[i].revents != 0){
63 irq_fd->current_events = pollfds[i].revents;
64 pollfds[i].fd = -1;
65 }
66 irq_fd = irq_fd->next;
67 }
68
69 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
70 if(irq_fd->current_events != 0){
71 irq_fd->current_events = 0;
72 do_IRQ(irq_fd->irq, regs);
73 }
74 }
75 }
76
77 free_irqs();
78}
79
80int activate_ipi(int fd, int pid)
81{
82 return(os_set_fd_async(fd, pid));
83}
84
85static void maybe_sigio_broken(int fd, int type)
86{
87 if(isatty(fd)){
88 if((type == IRQ_WRITE) && !pty_output_sigio){
89 write_sigio_workaround();
90 add_sigio_fd(fd, 0);
91 }
92 else if((type == IRQ_READ) && !pty_close_sigio){
93 write_sigio_workaround();
94 add_sigio_fd(fd, 1);
95 }
96 }
97}
98
99int activate_fd(int irq, int fd, int type, void *dev_id)
100{
101 struct pollfd *tmp_pfd;
102 struct irq_fd *new_fd, *irq_fd;
103 unsigned long flags;
104 int pid, events, err, n, size;
105
106 pid = os_getpid();
107 err = os_set_fd_async(fd, pid);
108 if(err < 0)
109 goto out;
110
111 new_fd = um_kmalloc(sizeof(*new_fd));
112 err = -ENOMEM;
113 if(new_fd == NULL)
114 goto out;
115
116 if(type == IRQ_READ) events = POLLIN | POLLPRI;
117 else events = POLLOUT;
118 *new_fd = ((struct irq_fd) { .next = NULL,
119 .id = dev_id,
120 .fd = fd,
121 .type = type,
122 .irq = irq,
123 .pid = pid,
124 .events = events,
125 .current_events = 0 } );
126
127 /* Critical section - locked by a spinlock because this stuff can
128 * be changed from interrupt handlers. The stuff above is done
129 * outside the lock because it allocates memory.
130 */
131
132 /* Actually, it only looks like it can be called from interrupt
133 * context. The culprit is reactivate_fd, which calls
134 * maybe_sigio_broken, which calls write_sigio_workaround,
135 * which calls activate_fd. However, write_sigio_workaround should
136 * only be called once, at boot time. That would make it clear that
137 * this is called only from process context, and can be locked with
138 * a semaphore.
139 */
140 flags = irq_lock();
141 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
142 if((irq_fd->fd == fd) && (irq_fd->type == type)){
143 printk("Registering fd %d twice\n", fd);
144 printk("Irqs : %d, %d\n", irq_fd->irq, irq);
145 printk("Ids : 0x%x, 0x%x\n", irq_fd->id, dev_id);
146 goto out_unlock;
147 }
148 }
149
150 n = pollfds_num;
151 if(n == pollfds_size){
152 while(1){
153 /* Here we have to drop the lock in order to call
154 * kmalloc, which might sleep. If something else
155 * came in and changed the pollfds array, we free
156 * the buffer and try again.
157 */
158 irq_unlock(flags);
159 size = (pollfds_num + 1) * sizeof(pollfds[0]);
160 tmp_pfd = um_kmalloc(size);
161 flags = irq_lock();
162 if(tmp_pfd == NULL)
163 goto out_unlock;
164 if(n == pollfds_size)
165 break;
166 kfree(tmp_pfd);
167 }
168 if(pollfds != NULL){
169 memcpy(tmp_pfd, pollfds,
170 sizeof(pollfds[0]) * pollfds_size);
171 kfree(pollfds);
172 }
173 pollfds = tmp_pfd;
174 pollfds_size++;
175 }
176
177 if(type == IRQ_WRITE)
178 fd = -1;
179
180 pollfds[pollfds_num] = ((struct pollfd) { .fd = fd,
181 .events = events,
182 .revents = 0 });
183 pollfds_num++;
184
185 *last_irq_ptr = new_fd;
186 last_irq_ptr = &new_fd->next;
187
188 irq_unlock(flags);
189
190 /* This calls activate_fd, so it has to be outside the critical
191 * section.
192 */
193 maybe_sigio_broken(fd, type);
194
195 return(0);
196
197 out_unlock:
198 irq_unlock(flags);
199 kfree(new_fd);
200 out:
201 return(err);
202}
203
204static void free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg)
205{
206 struct irq_fd **prev;
207 unsigned long flags;
208 int i = 0;
209
210 flags = irq_lock();
211 prev = &active_fds;
212 while(*prev != NULL){
213 if((*test)(*prev, arg)){
214 struct irq_fd *old_fd = *prev;
215 if((pollfds[i].fd != -1) &&
216 (pollfds[i].fd != (*prev)->fd)){
217 printk("free_irq_by_cb - mismatch between "
218 "active_fds and pollfds, fd %d vs %d\n",
219 (*prev)->fd, pollfds[i].fd);
220 goto out;
221 }
222
223 pollfds_num--;
224
225 /* This moves the *whole* array after pollfds[i] (though
226 * it doesn't spot as such)! */
227
228 memmove(&pollfds[i], &pollfds[i + 1],
229 (pollfds_num - i) * sizeof(pollfds[0]));
230
231 if(last_irq_ptr == &old_fd->next)
232 last_irq_ptr = prev;
233 *prev = (*prev)->next;
234 if(old_fd->type == IRQ_WRITE)
235 ignore_sigio_fd(old_fd->fd);
236 kfree(old_fd);
237 continue;
238 }
239 prev = &(*prev)->next;
240 i++;
241 }
242 out:
243 irq_unlock(flags);
244}
245
246struct irq_and_dev {
247 int irq;
248 void *dev;
249};
250
251static int same_irq_and_dev(struct irq_fd *irq, void *d)
252{
253 struct irq_and_dev *data = d;
254
255 return((irq->irq == data->irq) && (irq->id == data->dev));
256}
257
258void free_irq_by_irq_and_dev(unsigned int irq, void *dev)
259{
260 struct irq_and_dev data = ((struct irq_and_dev) { .irq = irq,
261 .dev = dev });
262
263 free_irq_by_cb(same_irq_and_dev, &data);
264}
265
266static int same_fd(struct irq_fd *irq, void *fd)
267{
268 return(irq->fd == *((int *) fd));
269}
270
271void free_irq_by_fd(int fd)
272{
273 free_irq_by_cb(same_fd, &fd);
274}
275
276static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out)
277{
278 struct irq_fd *irq;
279 int i = 0;
280
281 for(irq=active_fds; irq != NULL; irq = irq->next){
282 if((irq->fd == fd) && (irq->irq == irqnum)) break;
283 i++;
284 }
285 if(irq == NULL){
286 printk("find_irq_by_fd doesn't have descriptor %d\n", fd);
287 goto out;
288 }
289 if((pollfds[i].fd != -1) && (pollfds[i].fd != fd)){
290 printk("find_irq_by_fd - mismatch between active_fds and "
291 "pollfds, fd %d vs %d, need %d\n", irq->fd,
292 pollfds[i].fd, fd);
293 irq = NULL;
294 goto out;
295 }
296 *index_out = i;
297 out:
298 return(irq);
299}
300
301void reactivate_fd(int fd, int irqnum)
302{
303 struct irq_fd *irq;
304 unsigned long flags;
305 int i;
306
307 flags = irq_lock();
308 irq = find_irq_by_fd(fd, irqnum, &i);
309 if(irq == NULL){
310 irq_unlock(flags);
311 return;
312 }
313
314 pollfds[i].fd = irq->fd;
315
316 irq_unlock(flags);
317
318 /* This calls activate_fd, so it has to be outside the critical
319 * section.
320 */
321 maybe_sigio_broken(fd, irq->type);
322}
323
324void deactivate_fd(int fd, int irqnum)
325{
326 struct irq_fd *irq;
327 unsigned long flags;
328 int i;
329
330 flags = irq_lock();
331 irq = find_irq_by_fd(fd, irqnum, &i);
332 if(irq == NULL)
333 goto out;
334 pollfds[i].fd = -1;
335 out:
336 irq_unlock(flags);
337}
338
339int deactivate_all_fds(void)
340{
341 struct irq_fd *irq;
342 int err;
343
344 for(irq=active_fds;irq != NULL;irq = irq->next){
345 err = os_clear_fd_async(irq->fd);
346 if(err)
347 return(err);
348 }
349 /* If there is a signal already queued, after unblocking ignore it */
350 set_handler(SIGIO, SIG_IGN, 0, -1);
351
352 return(0);
353}
354
355void forward_ipi(int fd, int pid)
356{
357 int err;
358
359 err = os_set_owner(fd, pid);
360 if(err < 0)
361 printk("forward_ipi: set_owner failed, fd = %d, me = %d, "
362 "target = %d, err = %d\n", fd, os_getpid(), pid, -err);
363}
364
365void forward_interrupts(int pid)
366{
367 struct irq_fd *irq;
368 unsigned long flags;
369 int err;
370
371 flags = irq_lock();
372 for(irq=active_fds;irq != NULL;irq = irq->next){
373 err = os_set_owner(irq->fd, pid);
374 if(err < 0){
375 /* XXX Just remove the irq rather than
376 * print out an infinite stream of these
377 */
378 printk("Failed to forward %d to pid %d, err = %d\n",
379 irq->fd, pid, -err);
380 }
381
382 irq->pid = pid;
383 }
384 irq_unlock(flags);
385}
386
387void init_irq_signals(int on_sigstack)
388{
389 __sighandler_t h;
390 int flags;
391
392 flags = on_sigstack ? SA_ONSTACK : 0;
393 if(timer_irq_inited) h = (__sighandler_t) alarm_handler;
394 else h = boot_timer_handler;
395
396 set_handler(SIGVTALRM, h, flags | SA_RESTART,
397 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
398 set_handler(SIGIO, (__sighandler_t) sig_handler, flags | SA_RESTART,
399 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
400 signal(SIGWINCH, SIG_IGN);
401}
402
403/*
404 * Overrides for Emacs so that we follow Linus's tabbing style.
405 * Emacs will notice this stuff at the end of the file and automatically
406 * adjust the settings for this buffer only. This must remain at the end
407 * of the file.
408 * ---------------------------------------------------------------------------
409 * Local variables:
410 * c-file-style: "linux"
411 * End:
412 */
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 0e65340eee33..0500800df1c1 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -9,6 +9,7 @@
9#include "linux/vmalloc.h" 9#include "linux/vmalloc.h"
10#include "linux/bootmem.h" 10#include "linux/bootmem.h"
11#include "linux/module.h" 11#include "linux/module.h"
12#include "linux/pfn.h"
12#include "asm/types.h" 13#include "asm/types.h"
13#include "asm/pgtable.h" 14#include "asm/pgtable.h"
14#include "kern_util.h" 15#include "kern_util.h"
@@ -316,8 +317,6 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
316 } 317 }
317} 318}
318 319
319#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
320
321extern int __syscall_stub_start, __binary_start; 320extern int __syscall_stub_start, __binary_start;
322 321
323void setup_physmem(unsigned long start, unsigned long reserve_end, 322void setup_physmem(unsigned long start, unsigned long reserve_end,
diff --git a/arch/um/kernel/sigio_kern.c b/arch/um/kernel/sigio_kern.c
index 229988463c4c..1c1300fb1e95 100644
--- a/arch/um/kernel/sigio_kern.c
+++ b/arch/um/kernel/sigio_kern.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -12,13 +12,16 @@
12#include "sigio.h" 12#include "sigio.h"
13#include "irq_user.h" 13#include "irq_user.h"
14#include "irq_kern.h" 14#include "irq_kern.h"
15#include "os.h"
15 16
16/* Protected by sigio_lock() called from write_sigio_workaround */ 17/* Protected by sigio_lock() called from write_sigio_workaround */
17static int sigio_irq_fd = -1; 18static int sigio_irq_fd = -1;
18 19
19static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused) 20static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused)
20{ 21{
21 read_sigio_fd(sigio_irq_fd); 22 char c;
23
24 os_read_file(sigio_irq_fd, &c, sizeof(c));
22 reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ); 25 reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ);
23 return(IRQ_HANDLED); 26 return(IRQ_HANDLED);
24} 27}
@@ -51,6 +54,9 @@ void sigio_unlock(void)
51 spin_unlock(&sigio_spinlock); 54 spin_unlock(&sigio_spinlock);
52} 55}
53 56
57extern void sigio_cleanup(void);
58__uml_exitcall(sigio_cleanup);
59
54/* 60/*
55 * Overrides for Emacs so that we follow Linus's tabbing style. 61 * Overrides for Emacs so that we follow Linus's tabbing style.
56 * Emacs will notice this stuff at the end of the file and automatically 62 * Emacs will notice this stuff at the end of the file and automatically
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index 72113b0a96e7..c8d8d0ac1a7f 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -77,9 +77,9 @@ static int idle_proc(void *cpup)
77 if(err < 0) 77 if(err < 0)
78 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err); 78 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err);
79 79
80 activate_ipi(cpu_data[cpu].ipi_pipe[0], 80 os_set_fd_async(cpu_data[cpu].ipi_pipe[0],
81 current->thread.mode.tt.extern_pid); 81 current->thread.mode.tt.extern_pid);
82 82
83 wmb(); 83 wmb();
84 if (cpu_test_and_set(cpu, cpu_callin_map)) { 84 if (cpu_test_and_set(cpu, cpu_callin_map)) {
85 printk("huh, CPU#%d already present??\n", cpu); 85 printk("huh, CPU#%d already present??\n", cpu);
@@ -106,7 +106,7 @@ static struct task_struct *idle_thread(int cpu)
106 panic("copy_process failed in idle_thread, error = %ld", 106 panic("copy_process failed in idle_thread, error = %ld",
107 PTR_ERR(new_task)); 107 PTR_ERR(new_task));
108 108
109 cpu_tasks[cpu] = ((struct cpu_task) 109 cpu_tasks[cpu] = ((struct cpu_task)
110 { .pid = new_task->thread.mode.tt.extern_pid, 110 { .pid = new_task->thread.mode.tt.extern_pid,
111 .task = new_task } ); 111 .task = new_task } );
112 idle_threads[cpu] = new_task; 112 idle_threads[cpu] = new_task;
@@ -134,12 +134,12 @@ void smp_prepare_cpus(unsigned int maxcpus)
134 if(err < 0) 134 if(err < 0)
135 panic("CPU#0 failed to create IPI pipe, errno = %d", -err); 135 panic("CPU#0 failed to create IPI pipe, errno = %d", -err);
136 136
137 activate_ipi(cpu_data[me].ipi_pipe[0], 137 os_set_fd_async(cpu_data[me].ipi_pipe[0],
138 current->thread.mode.tt.extern_pid); 138 current->thread.mode.tt.extern_pid);
139 139
140 for(cpu = 1; cpu < ncpus; cpu++){ 140 for(cpu = 1; cpu < ncpus; cpu++){
141 printk("Booting processor %d...\n", cpu); 141 printk("Booting processor %d...\n", cpu);
142 142
143 idle = idle_thread(cpu); 143 idle = idle_thread(cpu);
144 144
145 init_idle(idle, cpu); 145 init_idle(idle, cpu);
@@ -223,7 +223,7 @@ void smp_call_function_slave(int cpu)
223 atomic_inc(&scf_finished); 223 atomic_inc(&scf_finished);
224} 224}
225 225
226int smp_call_function(void (*_func)(void *info), void *_info, int nonatomic, 226int smp_call_function(void (*_func)(void *info), void *_info, int nonatomic,
227 int wait) 227 int wait)
228{ 228{
229 int cpus = num_online_cpus() - 1; 229 int cpus = num_online_cpus() - 1;
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 80c9c18aae94..7d51dd7201c3 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -421,7 +421,7 @@ int linux_main(int argc, char **argv)
421#ifndef CONFIG_HIGHMEM 421#ifndef CONFIG_HIGHMEM
422 highmem = 0; 422 highmem = 0;
423 printf("CONFIG_HIGHMEM not enabled - physical memory shrunk " 423 printf("CONFIG_HIGHMEM not enabled - physical memory shrunk "
424 "to %lu bytes\n", physmem_size); 424 "to %Lu bytes\n", physmem_size);
425#endif 425#endif
426 } 426 }
427 427
@@ -433,8 +433,8 @@ int linux_main(int argc, char **argv)
433 433
434 setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); 434 setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
435 if(init_maps(physmem_size, iomem_size, highmem)){ 435 if(init_maps(physmem_size, iomem_size, highmem)){
436 printf("Failed to allocate mem_map for %lu bytes of physical " 436 printf("Failed to allocate mem_map for %Lu bytes of physical "
437 "memory and %lu bytes of highmem\n", physmem_size, 437 "memory and %Lu bytes of highmem\n", physmem_size,
438 highmem); 438 highmem);
439 exit(1); 439 exit(1);
440 } 440 }
@@ -477,7 +477,8 @@ static struct notifier_block panic_exit_notifier = {
477 477
478void __init setup_arch(char **cmdline_p) 478void __init setup_arch(char **cmdline_p)
479{ 479{
480 notifier_chain_register(&panic_notifier_list, &panic_exit_notifier); 480 atomic_notifier_chain_register(&panic_notifier_list,
481 &panic_exit_notifier);
481 paging_init(); 482 paging_init();
482 strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); 483 strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
483 *cmdline_p = command_line; 484 *cmdline_p = command_line;
@@ -487,8 +488,7 @@ void __init setup_arch(char **cmdline_p)
487void __init check_bugs(void) 488void __init check_bugs(void)
488{ 489{
489 arch_check_bugs(); 490 arch_check_bugs();
490 check_sigio(); 491 os_check_bugs();
491 check_devanon();
492} 492}
493 493
494void apply_alternatives(struct alt_instr *start, struct alt_instr *end) 494void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index 08a4e628b24c..1659386b42bb 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -3,14 +3,17 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-y = aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \ 6obj-y = aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o sigio.o \
7 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o user_syms.o \ 7 signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o \
8 util.o drivers/ sys-$(SUBARCH)/ 8 user_syms.o util.o drivers/ sys-$(SUBARCH)/
9 9
10obj-$(CONFIG_MODE_SKAS) += skas/ 10obj-$(CONFIG_MODE_SKAS) += skas/
11obj-$(CONFIG_TTY_LOG) += tty_log.o
12user-objs-$(CONFIG_TTY_LOG) += tty_log.o
11 13
12USER_OBJS := aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \ 14USER_OBJS := $(user-objs-y) aio.o elf_aux.o file.o helper.o irq.o main.o mem.o \
13 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o util.o 15 process.o sigio.o signal.o start_up.o time.o trap.o tt.o tty.o \
16 uaccess.o umid.o util.o
14 17
15elf_aux.o: $(ARCH_DIR)/kernel-offsets.h 18elf_aux.o: $(ARCH_DIR)/kernel-offsets.h
16CFLAGS_elf_aux.o += -I$(objtree)/arch/um 19CFLAGS_elf_aux.o += -I$(objtree)/arch/um
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
new file mode 100644
index 000000000000..e599be423da1
--- /dev/null
+++ b/arch/um/os-Linux/irq.c
@@ -0,0 +1,162 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <unistd.h>
8#include <errno.h>
9#include <signal.h>
10#include <string.h>
11#include <sys/poll.h>
12#include <sys/types.h>
13#include <sys/time.h>
14#include "user_util.h"
15#include "kern_util.h"
16#include "user.h"
17#include "process.h"
18#include "sigio.h"
19#include "irq_user.h"
20#include "os.h"
21
22static struct pollfd *pollfds = NULL;
23static int pollfds_num = 0;
24static int pollfds_size = 0;
25
26int os_waiting_for_events(struct irq_fd *active_fds)
27{
28 struct irq_fd *irq_fd;
29 int i, n, err;
30
31 n = poll(pollfds, pollfds_num, 0);
32 if(n < 0){
33 err = -errno;
34 if(errno != EINTR)
35 printk("sigio_handler: os_waiting_for_events:"
36 " poll returned %d, errno = %d\n", n, errno);
37 return err;
38 }
39
40 if(n == 0)
41 return 0;
42
43 irq_fd = active_fds;
44
45 for(i = 0; i < pollfds_num; i++){
46 if(pollfds[i].revents != 0){
47 irq_fd->current_events = pollfds[i].revents;
48 pollfds[i].fd = -1;
49 }
50 irq_fd = irq_fd->next;
51 }
52 return n;
53}
54
55int os_isatty(int fd)
56{
57 return(isatty(fd));
58}
59
60int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds)
61{
62 if (pollfds_num == pollfds_size) {
63 if (size_tmpfds <= pollfds_size * sizeof(pollfds[0])) {
64 /* return min size needed for new pollfds area */
65 return((pollfds_size + 1) * sizeof(pollfds[0]));
66 }
67
68 if(pollfds != NULL){
69 memcpy(tmp_pfd, pollfds,
70 sizeof(pollfds[0]) * pollfds_size);
71 /* remove old pollfds */
72 kfree(pollfds);
73 }
74 pollfds = tmp_pfd;
75 pollfds_size++;
76 } else {
77 /* remove not used tmp_pfd */
78 if (tmp_pfd != NULL)
79 kfree(tmp_pfd);
80 }
81
82 pollfds[pollfds_num] = ((struct pollfd) { .fd = fd,
83 .events = events,
84 .revents = 0 });
85 pollfds_num++;
86
87 return(0);
88}
89
90void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
91 struct irq_fd *active_fds, struct irq_fd ***last_irq_ptr2)
92{
93 struct irq_fd **prev;
94 int i = 0;
95
96 prev = &active_fds;
97 while(*prev != NULL){
98 if((*test)(*prev, arg)){
99 struct irq_fd *old_fd = *prev;
100 if((pollfds[i].fd != -1) &&
101 (pollfds[i].fd != (*prev)->fd)){
102 printk("os_free_irq_by_cb - mismatch between "
103 "active_fds and pollfds, fd %d vs %d\n",
104 (*prev)->fd, pollfds[i].fd);
105 goto out;
106 }
107
108 pollfds_num--;
109
110 /* This moves the *whole* array after pollfds[i]
111 * (though it doesn't spot as such)!
112 */
113
114 memmove(&pollfds[i], &pollfds[i + 1],
115 (pollfds_num - i) * sizeof(pollfds[0]));
116 if(*last_irq_ptr2 == &old_fd->next)
117 *last_irq_ptr2 = prev;
118
119 *prev = (*prev)->next;
120 if(old_fd->type == IRQ_WRITE)
121 ignore_sigio_fd(old_fd->fd);
122 kfree(old_fd);
123 continue;
124 }
125 prev = &(*prev)->next;
126 i++;
127 }
128 out:
129 return;
130}
131
132
133int os_get_pollfd(int i)
134{
135 return(pollfds[i].fd);
136}
137
138void os_set_pollfd(int i, int fd)
139{
140 pollfds[i].fd = fd;
141}
142
143void os_set_ioignore(void)
144{
145 set_handler(SIGIO, SIG_IGN, 0, -1);
146}
147
148void init_irq_signals(int on_sigstack)
149{
150 __sighandler_t h;
151 int flags;
152
153 flags = on_sigstack ? SA_ONSTACK : 0;
154 if(timer_irq_inited) h = (__sighandler_t) alarm_handler;
155 else h = boot_timer_handler;
156
157 set_handler(SIGVTALRM, h, flags | SA_RESTART,
158 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
159 set_handler(SIGIO, (__sighandler_t) sig_handler, flags | SA_RESTART,
160 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
161 signal(SIGWINCH, SIG_IGN);
162}
diff --git a/arch/um/kernel/sigio_user.c b/arch/um/os-Linux/sigio.c
index f7b18e157d35..9ba942947146 100644
--- a/arch/um/kernel/sigio_user.c
+++ b/arch/um/os-Linux/sigio.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -20,128 +20,7 @@
20#include "sigio.h" 20#include "sigio.h"
21#include "os.h" 21#include "os.h"
22 22
23/* Changed during early boot */ 23/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
24int pty_output_sigio = 0;
25int pty_close_sigio = 0;
26
27/* Used as a flag during SIGIO testing early in boot */
28static volatile int got_sigio = 0;
29
30void __init handler(int sig)
31{
32 got_sigio = 1;
33}
34
35struct openpty_arg {
36 int master;
37 int slave;
38 int err;
39};
40
41static void openpty_cb(void *arg)
42{
43 struct openpty_arg *info = arg;
44
45 info->err = 0;
46 if(openpty(&info->master, &info->slave, NULL, NULL, NULL))
47 info->err = -errno;
48}
49
50void __init check_one_sigio(void (*proc)(int, int))
51{
52 struct sigaction old, new;
53 struct openpty_arg pty = { .master = -1, .slave = -1 };
54 int master, slave, err;
55
56 initial_thread_cb(openpty_cb, &pty);
57 if(pty.err){
58 printk("openpty failed, errno = %d\n", -pty.err);
59 return;
60 }
61
62 master = pty.master;
63 slave = pty.slave;
64
65 if((master == -1) || (slave == -1)){
66 printk("openpty failed to allocate a pty\n");
67 return;
68 }
69
70 /* Not now, but complain so we now where we failed. */
71 err = raw(master);
72 if (err < 0)
73 panic("check_sigio : __raw failed, errno = %d\n", -err);
74
75 err = os_sigio_async(master, slave);
76 if(err < 0)
77 panic("tty_fds : sigio_async failed, err = %d\n", -err);
78
79 if(sigaction(SIGIO, NULL, &old) < 0)
80 panic("check_sigio : sigaction 1 failed, errno = %d\n", errno);
81 new = old;
82 new.sa_handler = handler;
83 if(sigaction(SIGIO, &new, NULL) < 0)
84 panic("check_sigio : sigaction 2 failed, errno = %d\n", errno);
85
86 got_sigio = 0;
87 (*proc)(master, slave);
88
89 os_close_file(master);
90 os_close_file(slave);
91
92 if(sigaction(SIGIO, &old, NULL) < 0)
93 panic("check_sigio : sigaction 3 failed, errno = %d\n", errno);
94}
95
96static void tty_output(int master, int slave)
97{
98 int n;
99 char buf[512];
100
101 printk("Checking that host ptys support output SIGIO...");
102
103 memset(buf, 0, sizeof(buf));
104
105 while(os_write_file(master, buf, sizeof(buf)) > 0) ;
106 if(errno != EAGAIN)
107 panic("check_sigio : write failed, errno = %d\n", errno);
108 while(((n = os_read_file(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
109
110 if (got_sigio) {
111 printk("Yes\n");
112 pty_output_sigio = 1;
113 } else if (n == -EAGAIN) {
114 printk("No, enabling workaround\n");
115 } else {
116 panic("check_sigio : read failed, err = %d\n", n);
117 }
118}
119
120static void tty_close(int master, int slave)
121{
122 printk("Checking that host ptys support SIGIO on close...");
123
124 os_close_file(slave);
125 if(got_sigio){
126 printk("Yes\n");
127 pty_close_sigio = 1;
128 }
129 else printk("No, enabling workaround\n");
130}
131
132void __init check_sigio(void)
133{
134 if((os_access("/dev/ptmx", OS_ACC_R_OK) < 0) &&
135 (os_access("/dev/ptyp0", OS_ACC_R_OK) < 0)){
136 printk("No pseudo-terminals available - skipping pty SIGIO "
137 "check\n");
138 return;
139 }
140 check_one_sigio(tty_output);
141 check_one_sigio(tty_close);
142}
143
144/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
145 * exitcall. 24 * exitcall.
146 */ 25 */
147static int write_sigio_pid = -1; 26static int write_sigio_pid = -1;
@@ -150,8 +29,10 @@ static int write_sigio_pid = -1;
150 * the descriptors closed after it is killed. So, it can't see them change. 29 * the descriptors closed after it is killed. So, it can't see them change.
151 * On the UML side, they are changed under the sigio_lock. 30 * On the UML side, they are changed under the sigio_lock.
152 */ 31 */
153static int write_sigio_fds[2] = { -1, -1 }; 32#define SIGIO_FDS_INIT {-1, -1}
154static int sigio_private[2] = { -1, -1 }; 33
34static int write_sigio_fds[2] = SIGIO_FDS_INIT;
35static int sigio_private[2] = SIGIO_FDS_INIT;
155 36
156struct pollfds { 37struct pollfds {
157 struct pollfd *poll; 38 struct pollfd *poll;
@@ -264,13 +145,13 @@ static void update_thread(void)
264 return; 145 return;
265 fail: 146 fail:
266 /* Critical section start */ 147 /* Critical section start */
267 if(write_sigio_pid != -1) 148 if(write_sigio_pid != -1)
268 os_kill_process(write_sigio_pid, 1); 149 os_kill_process(write_sigio_pid, 1);
269 write_sigio_pid = -1; 150 write_sigio_pid = -1;
270 os_close_file(sigio_private[0]); 151 close(sigio_private[0]);
271 os_close_file(sigio_private[1]); 152 close(sigio_private[1]);
272 os_close_file(write_sigio_fds[0]); 153 close(write_sigio_fds[0]);
273 os_close_file(write_sigio_fds[1]); 154 close(write_sigio_fds[1]);
274 /* Critical section end */ 155 /* Critical section end */
275 set_signals(flags); 156 set_signals(flags);
276} 157}
@@ -281,13 +162,13 @@ int add_sigio_fd(int fd, int read)
281 162
282 sigio_lock(); 163 sigio_lock();
283 for(i = 0; i < current_poll.used; i++){ 164 for(i = 0; i < current_poll.used; i++){
284 if(current_poll.poll[i].fd == fd) 165 if(current_poll.poll[i].fd == fd)
285 goto out; 166 goto out;
286 } 167 }
287 168
288 n = current_poll.used + 1; 169 n = current_poll.used + 1;
289 err = need_poll(n); 170 err = need_poll(n);
290 if(err) 171 if(err)
291 goto out; 172 goto out;
292 173
293 for(i = 0; i < current_poll.used; i++) 174 for(i = 0; i < current_poll.used; i++)
@@ -316,7 +197,7 @@ int ignore_sigio_fd(int fd)
316 } 197 }
317 if(i == current_poll.used) 198 if(i == current_poll.used)
318 goto out; 199 goto out;
319 200
320 err = need_poll(current_poll.used - 1); 201 err = need_poll(current_poll.used - 1);
321 if(err) 202 if(err)
322 goto out; 203 goto out;
@@ -337,7 +218,7 @@ int ignore_sigio_fd(int fd)
337 return(err); 218 return(err);
338} 219}
339 220
340static struct pollfd* setup_initial_poll(int fd) 221static struct pollfd *setup_initial_poll(int fd)
341{ 222{
342 struct pollfd *p; 223 struct pollfd *p;
343 224
@@ -377,7 +258,7 @@ void write_sigio_workaround(void)
377 } 258 }
378 err = os_pipe(l_sigio_private, 1, 1); 259 err = os_pipe(l_sigio_private, 1, 1);
379 if(err < 0){ 260 if(err < 0){
380 printk("write_sigio_workaround - os_pipe 1 failed, " 261 printk("write_sigio_workaround - os_pipe 2 failed, "
381 "err = %d\n", -err); 262 "err = %d\n", -err);
382 goto out_close1; 263 goto out_close1;
383 } 264 }
@@ -391,76 +272,52 @@ void write_sigio_workaround(void)
391 /* Did we race? Don't try to optimize this, please, it's not so likely 272 /* Did we race? Don't try to optimize this, please, it's not so likely
392 * to happen, and no more than once at the boot. */ 273 * to happen, and no more than once at the boot. */
393 if(write_sigio_pid != -1) 274 if(write_sigio_pid != -1)
394 goto out_unlock; 275 goto out_free;
395 276
396 write_sigio_pid = run_helper_thread(write_sigio_thread, NULL, 277 current_poll = ((struct pollfds) { .poll = p,
397 CLONE_FILES | CLONE_VM, &stack, 0); 278 .used = 1,
398 279 .size = 1 });
399 if (write_sigio_pid < 0)
400 goto out_clear;
401 280
402 if (write_sigio_irq(l_write_sigio_fds[0])) 281 if (write_sigio_irq(l_write_sigio_fds[0]))
403 goto out_kill; 282 goto out_clear_poll;
404 283
405 /* Success, finally. */
406 memcpy(write_sigio_fds, l_write_sigio_fds, sizeof(l_write_sigio_fds)); 284 memcpy(write_sigio_fds, l_write_sigio_fds, sizeof(l_write_sigio_fds));
407 memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private)); 285 memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private));
408 286
409 current_poll = ((struct pollfds) { .poll = p, 287 write_sigio_pid = run_helper_thread(write_sigio_thread, NULL,
410 .used = 1, 288 CLONE_FILES | CLONE_VM, &stack, 0);
411 .size = 1 });
412 289
413 sigio_unlock(); 290 if (write_sigio_pid < 0)
414 return; 291 goto out_clear;
415 292
416 out_kill:
417 l_write_sigio_pid = write_sigio_pid;
418 write_sigio_pid = -1;
419 sigio_unlock(); 293 sigio_unlock();
420 /* Going to call waitpid, avoid holding the lock. */ 294 return;
421 os_kill_process(l_write_sigio_pid, 1);
422 goto out_free;
423 295
424 out_clear: 296out_clear:
425 write_sigio_pid = -1; 297 write_sigio_pid = -1;
426 out_unlock: 298 write_sigio_fds[0] = -1;
427 sigio_unlock(); 299 write_sigio_fds[1] = -1;
428 out_free: 300 sigio_private[0] = -1;
301 sigio_private[1] = -1;
302out_clear_poll:
303 current_poll = ((struct pollfds) { .poll = NULL,
304 .size = 0,
305 .used = 0 });
306out_free:
429 kfree(p); 307 kfree(p);
430 out_close2: 308 sigio_unlock();
431 os_close_file(l_sigio_private[0]); 309out_close2:
432 os_close_file(l_sigio_private[1]); 310 close(l_sigio_private[0]);
433 out_close1: 311 close(l_sigio_private[1]);
434 os_close_file(l_write_sigio_fds[0]); 312out_close1:
435 os_close_file(l_write_sigio_fds[1]); 313 close(l_write_sigio_fds[0]);
436 return; 314 close(l_write_sigio_fds[1]);
437}
438
439int read_sigio_fd(int fd)
440{
441 int n;
442 char c;
443
444 n = os_read_file(fd, &c, sizeof(c));
445 if(n != sizeof(c)){
446 if(n < 0) {
447 printk("read_sigio_fd - read failed, err = %d\n", -n);
448 return(n);
449 }
450 else {
451 printk("read_sigio_fd - short read, bytes = %d\n", n);
452 return(-EIO);
453 }
454 }
455 return(n);
456} 315}
457 316
458static void sigio_cleanup(void) 317void sigio_cleanup(void)
459{ 318{
460 if (write_sigio_pid != -1) { 319 if(write_sigio_pid != -1){
461 os_kill_process(write_sigio_pid, 1); 320 os_kill_process(write_sigio_pid, 1);
462 write_sigio_pid = -1; 321 write_sigio_pid = -1;
463 } 322 }
464} 323}
465
466__uml_exitcall(sigio_cleanup);
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 829d6b0d8b02..32753131f8d8 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -3,6 +3,7 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <pty.h>
6#include <stdio.h> 7#include <stdio.h>
7#include <stddef.h> 8#include <stddef.h>
8#include <stdarg.h> 9#include <stdarg.h>
@@ -539,3 +540,130 @@ int __init parse_iomem(char *str, int *add)
539 return(1); 540 return(1);
540} 541}
541 542
543
544/* Changed during early boot */
545int pty_output_sigio = 0;
546int pty_close_sigio = 0;
547
548/* Used as a flag during SIGIO testing early in boot */
549static volatile int got_sigio = 0;
550
551static void __init handler(int sig)
552{
553 got_sigio = 1;
554}
555
556struct openpty_arg {
557 int master;
558 int slave;
559 int err;
560};
561
562static void openpty_cb(void *arg)
563{
564 struct openpty_arg *info = arg;
565
566 info->err = 0;
567 if(openpty(&info->master, &info->slave, NULL, NULL, NULL))
568 info->err = -errno;
569}
570
571static void __init check_one_sigio(void (*proc)(int, int))
572{
573 struct sigaction old, new;
574 struct openpty_arg pty = { .master = -1, .slave = -1 };
575 int master, slave, err;
576
577 initial_thread_cb(openpty_cb, &pty);
578 if(pty.err){
579 printk("openpty failed, errno = %d\n", -pty.err);
580 return;
581 }
582
583 master = pty.master;
584 slave = pty.slave;
585
586 if((master == -1) || (slave == -1)){
587 printk("openpty failed to allocate a pty\n");
588 return;
589 }
590
591 /* Not now, but complain so we now where we failed. */
592 err = raw(master);
593 if (err < 0)
594 panic("check_sigio : __raw failed, errno = %d\n", -err);
595
596 err = os_sigio_async(master, slave);
597 if(err < 0)
598 panic("tty_fds : sigio_async failed, err = %d\n", -err);
599
600 if(sigaction(SIGIO, NULL, &old) < 0)
601 panic("check_sigio : sigaction 1 failed, errno = %d\n", errno);
602 new = old;
603 new.sa_handler = handler;
604 if(sigaction(SIGIO, &new, NULL) < 0)
605 panic("check_sigio : sigaction 2 failed, errno = %d\n", errno);
606
607 got_sigio = 0;
608 (*proc)(master, slave);
609
610 close(master);
611 close(slave);
612
613 if(sigaction(SIGIO, &old, NULL) < 0)
614 panic("check_sigio : sigaction 3 failed, errno = %d\n", errno);
615}
616
617static void tty_output(int master, int slave)
618{
619 int n;
620 char buf[512];
621
622 printk("Checking that host ptys support output SIGIO...");
623
624 memset(buf, 0, sizeof(buf));
625
626 while(os_write_file(master, buf, sizeof(buf)) > 0) ;
627 if(errno != EAGAIN)
628 panic("check_sigio : write failed, errno = %d\n", errno);
629 while(((n = os_read_file(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
630
631 if(got_sigio){
632 printk("Yes\n");
633 pty_output_sigio = 1;
634 }
635 else if(n == -EAGAIN) printk("No, enabling workaround\n");
636 else panic("check_sigio : read failed, err = %d\n", n);
637}
638
639static void tty_close(int master, int slave)
640{
641 printk("Checking that host ptys support SIGIO on close...");
642
643 close(slave);
644 if(got_sigio){
645 printk("Yes\n");
646 pty_close_sigio = 1;
647 }
648 else printk("No, enabling workaround\n");
649}
650
651void __init check_sigio(void)
652{
653 if((os_access("/dev/ptmx", OS_ACC_R_OK) < 0) &&
654 (os_access("/dev/ptyp0", OS_ACC_R_OK) < 0)){
655 printk("No pseudo-terminals available - skipping pty SIGIO "
656 "check\n");
657 return;
658 }
659 check_one_sigio(tty_output);
660 check_one_sigio(tty_close);
661}
662
663void os_check_bugs(void)
664{
665 check_ptrace();
666 check_sigio();
667 check_devanon();
668}
669
diff --git a/arch/um/os-Linux/tt.c b/arch/um/os-Linux/tt.c
index 919d19f11537..5461a065bbb9 100644
--- a/arch/um/os-Linux/tt.c
+++ b/arch/um/os-Linux/tt.c
@@ -110,6 +110,16 @@ int wait_for_stop(int pid, int sig, int cont_type, void *relay)
110 } 110 }
111} 111}
112 112
113void forward_ipi(int fd, int pid)
114{
115 int err;
116
117 err = os_set_owner(fd, pid);
118 if(err < 0)
119 printk("forward_ipi: set_owner failed, fd = %d, me = %d, "
120 "target = %d, err = %d\n", fd, os_getpid(), pid, -err);
121}
122
113/* 123/*
114 *------------------------- 124 *-------------------------
115 * only for tt mode (will be deleted in future...) 125 * only for tt mode (will be deleted in future...)
diff --git a/arch/um/kernel/tty_log.c b/arch/um/os-Linux/tty_log.c
index 9ada656f68ce..c6ba56c1560f 100644
--- a/arch/um/kernel/tty_log.c
+++ b/arch/um/os-Linux/tty_log.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) and 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) and
3 * geoffrey hing <ghing@net.ohio-state.edu> 3 * geoffrey hing <ghing@net.ohio-state.edu>
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
@@ -58,7 +58,7 @@ int open_tty_log(void *tty, void *current_tty)
58 return(tty_log_fd); 58 return(tty_log_fd);
59 } 59 }
60 60
61 sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec, 61 sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec,
62 (unsigned int) tv.tv_usec); 62 (unsigned int) tv.tv_usec);
63 63
64 fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS()))), 64 fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS()))),
@@ -216,15 +216,3 @@ __uml_setup("tty_log_fd=", set_tty_log_fd,
216" tty data will be written. Preconfigure the descriptor with something\n" 216" tty data will be written. Preconfigure the descriptor with something\n"
217" like '10>tty_log tty_log_fd=10'.\n\n" 217" like '10>tty_log tty_log_fd=10'.\n\n"
218); 218);
219
220
221/*
222 * Overrides for Emacs so that we follow Linus's tabbing style.
223 * Emacs will notice this stuff at the end of the file and automatically
224 * adjust the settings for this buffer only. This must remain at the end
225 * of the file.
226 * ---------------------------------------------------------------------------
227 * Local variables:
228 * c-file-style: "linux"
229 * End:
230 */
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index ecf107ae5ac8..198e59163288 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -143,8 +143,10 @@ static int not_dead_yet(char *dir)
143 goto out_close; 143 goto out_close;
144 } 144 }
145 145
146 if((kill(p, 0) == 0) || (errno != ESRCH)) 146 if((kill(p, 0) == 0) || (errno != ESRCH)){
147 printk("umid \"%s\" is already in use by pid %d\n", umid, p);
147 return 1; 148 return 1;
149 }
148 150
149 err = actually_do_remove(dir); 151 err = actually_do_remove(dir);
150 if(err) 152 if(err)
@@ -234,33 +236,44 @@ int __init make_umid(void)
234 err = mkdir(tmp, 0777); 236 err = mkdir(tmp, 0777);
235 if(err < 0){ 237 if(err < 0){
236 err = -errno; 238 err = -errno;
237 if(errno != EEXIST) 239 if(err != -EEXIST)
238 goto err; 240 goto err;
239 241
240 if(not_dead_yet(tmp) < 0) 242 /* 1 -> this umid is already in use
243 * < 0 -> we couldn't remove the umid directory
244 * In either case, we can't use this umid, so return -EEXIST.
245 */
246 if(not_dead_yet(tmp) != 0)
241 goto err; 247 goto err;
242 248
243 err = mkdir(tmp, 0777); 249 err = mkdir(tmp, 0777);
244 } 250 }
245 if(err < 0){ 251 if(err){
246 printk("Failed to create '%s' - err = %d\n", umid, err); 252 err = -errno;
247 goto err_rmdir; 253 printk("Failed to create '%s' - err = %d\n", umid, -errno);
254 goto err;
248 } 255 }
249 256
250 umid_setup = 1; 257 umid_setup = 1;
251 258
252 create_pid_file(); 259 create_pid_file();
253 260
254 return 0; 261 err = 0;
255
256 err_rmdir:
257 rmdir(tmp);
258 err: 262 err:
259 return err; 263 return err;
260} 264}
261 265
262static int __init make_umid_init(void) 266static int __init make_umid_init(void)
263{ 267{
268 if(!make_umid())
269 return 0;
270
271 /* If initializing with the given umid failed, then try again with
272 * a random one.
273 */
274 printk("Failed to initialize umid \"%s\", trying with a random umid\n",
275 umid);
276 *umid = '\0';
264 make_umid(); 277 make_umid();
265 278
266 return 0; 279 return 0;
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index e839ce65ad28..8032a105949a 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -6,6 +6,7 @@
6#include <linux/config.h> 6#include <linux/config.h>
7#include <linux/compiler.h> 7#include <linux/compiler.h>
8#include "linux/sched.h" 8#include "linux/sched.h"
9#include "linux/mm.h"
9#include "asm/elf.h" 10#include "asm/elf.h"
10#include "asm/ptrace.h" 11#include "asm/ptrace.h"
11#include "asm/uaccess.h" 12#include "asm/uaccess.h"
@@ -26,9 +27,17 @@ int is_syscall(unsigned long addr)
26 27
27 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr)); 28 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
28 if(n){ 29 if(n){
29 printk("is_syscall : failed to read instruction from 0x%lx\n", 30 /* access_process_vm() grants access to vsyscall and stub,
30 addr); 31 * while copy_from_user doesn't. Maybe access_process_vm is
31 return(0); 32 * slow, but that doesn't matter, since it will be called only
33 * in case of singlestepping, if copy_from_user failed.
34 */
35 n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
36 if(n != sizeof(instr)) {
37 printk("is_syscall : failed to read instruction from "
38 "0x%lx\n", addr);
39 return(1);
40 }
32 } 41 }
33 /* int 0x80 or sysenter */ 42 /* int 0x80 or sysenter */
34 return((instr == 0x80cd) || (instr == 0x340f)); 43 return((instr == 0x80cd) || (instr == 0x340f));
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 7cd1a82dc8c2..33a40f5ef0d2 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -58,7 +58,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
58} 58}
59 59
60int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, 60int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
61 struct pt_regs *regs) 61 struct pt_regs *regs, unsigned long sp)
62{ 62{
63 struct sigcontext sc; 63 struct sigcontext sc;
64 unsigned long fpregs[HOST_FP_SIZE]; 64 unsigned long fpregs[HOST_FP_SIZE];
@@ -72,7 +72,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
72 sc.edi = REGS_EDI(regs->regs.skas.regs); 72 sc.edi = REGS_EDI(regs->regs.skas.regs);
73 sc.esi = REGS_ESI(regs->regs.skas.regs); 73 sc.esi = REGS_ESI(regs->regs.skas.regs);
74 sc.ebp = REGS_EBP(regs->regs.skas.regs); 74 sc.ebp = REGS_EBP(regs->regs.skas.regs);
75 sc.esp = REGS_SP(regs->regs.skas.regs); 75 sc.esp = sp;
76 sc.ebx = REGS_EBX(regs->regs.skas.regs); 76 sc.ebx = REGS_EBX(regs->regs.skas.regs);
77 sc.edx = REGS_EDX(regs->regs.skas.regs); 77 sc.edx = REGS_EDX(regs->regs.skas.regs);
78 sc.ecx = REGS_ECX(regs->regs.skas.regs); 78 sc.ecx = REGS_ECX(regs->regs.skas.regs);
@@ -132,7 +132,7 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
132} 132}
133 133
134int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, 134int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
135 struct sigcontext *from, int fpsize) 135 struct sigcontext *from, int fpsize, unsigned long sp)
136{ 136{
137 struct _fpstate *to_fp, *from_fp; 137 struct _fpstate *to_fp, *from_fp;
138 int err; 138 int err;
@@ -140,11 +140,18 @@ int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
140 to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); 140 to_fp = (fp ? fp : (struct _fpstate *) (to + 1));
141 from_fp = from->fpstate; 141 from_fp = from->fpstate;
142 err = copy_to_user(to, from, sizeof(*to)); 142 err = copy_to_user(to, from, sizeof(*to));
143
144 /* The SP in the sigcontext is the updated one for the signal
145 * delivery. The sp passed in is the original, and this needs
146 * to be restored, so we stick it in separately.
147 */
148 err |= copy_to_user(&SC_SP(to), sp, sizeof(sp));
149
143 if(from_fp != NULL){ 150 if(from_fp != NULL){
144 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); 151 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
145 err |= copy_to_user(to_fp, from_fp, fpsize); 152 err |= copy_to_user(to_fp, from_fp, fpsize);
146 } 153 }
147 return(err); 154 return err;
148} 155}
149#endif 156#endif
150 157
@@ -159,11 +166,11 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
159} 166}
160 167
161static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, 168static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
162 struct pt_regs *from) 169 struct pt_regs *from, unsigned long sp)
163{ 170{
164 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), 171 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
165 sizeof(*fp)), 172 sizeof(*fp), sp),
166 copy_sc_to_user_skas(to, fp, from))); 173 copy_sc_to_user_skas(to, fp, from, sp)));
167} 174}
168 175
169static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp, 176static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
@@ -174,7 +181,7 @@ static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
174 err |= put_user(current->sas_ss_sp, &uc->uc_stack.ss_sp); 181 err |= put_user(current->sas_ss_sp, &uc->uc_stack.ss_sp);
175 err |= put_user(sas_ss_flags(sp), &uc->uc_stack.ss_flags); 182 err |= put_user(sas_ss_flags(sp), &uc->uc_stack.ss_flags);
176 err |= put_user(current->sas_ss_size, &uc->uc_stack.ss_size); 183 err |= put_user(current->sas_ss_size, &uc->uc_stack.ss_size);
177 err |= copy_sc_to_user(&uc->uc_mcontext, fp, &current->thread.regs); 184 err |= copy_sc_to_user(&uc->uc_mcontext, fp, &current->thread.regs, sp);
178 err |= copy_to_user(&uc->uc_sigmask, set, sizeof(*set)); 185 err |= copy_to_user(&uc->uc_sigmask, set, sizeof(*set));
179 return(err); 186 return(err);
180} 187}
@@ -207,6 +214,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
207{ 214{
208 struct sigframe __user *frame; 215 struct sigframe __user *frame;
209 void *restorer; 216 void *restorer;
217 unsigned long save_sp = PT_REGS_SP(regs);
210 int err = 0; 218 int err = 0;
211 219
212 stack_top &= -8UL; 220 stack_top &= -8UL;
@@ -218,9 +226,19 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
218 if(ka->sa.sa_flags & SA_RESTORER) 226 if(ka->sa.sa_flags & SA_RESTORER)
219 restorer = ka->sa.sa_restorer; 227 restorer = ka->sa.sa_restorer;
220 228
229 /* Update SP now because the page fault handler refuses to extend
230 * the stack if the faulting address is too far below the current
231 * SP, which frame now certainly is. If there's an error, the original
232 * value is restored on the way out.
233 * When writing the sigcontext to the stack, we have to write the
234 * original value, so that's passed to copy_sc_to_user, which does
235 * the right thing with it.
236 */
237 PT_REGS_SP(regs) = (unsigned long) frame;
238
221 err |= __put_user(restorer, &frame->pretcode); 239 err |= __put_user(restorer, &frame->pretcode);
222 err |= __put_user(sig, &frame->sig); 240 err |= __put_user(sig, &frame->sig);
223 err |= copy_sc_to_user(&frame->sc, NULL, regs); 241 err |= copy_sc_to_user(&frame->sc, NULL, regs, save_sp);
224 err |= __put_user(mask->sig[0], &frame->sc.oldmask); 242 err |= __put_user(mask->sig[0], &frame->sc.oldmask);
225 if (_NSIG_WORDS > 1) 243 if (_NSIG_WORDS > 1)
226 err |= __copy_to_user(&frame->extramask, &mask->sig[1], 244 err |= __copy_to_user(&frame->extramask, &mask->sig[1],
@@ -238,7 +256,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
238 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6)); 256 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
239 257
240 if(err) 258 if(err)
241 return(err); 259 goto err;
242 260
243 PT_REGS_SP(regs) = (unsigned long) frame; 261 PT_REGS_SP(regs) = (unsigned long) frame;
244 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 262 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
@@ -248,7 +266,11 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
248 266
249 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) 267 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
250 ptrace_notify(SIGTRAP); 268 ptrace_notify(SIGTRAP);
251 return(0); 269 return 0;
270
271err:
272 PT_REGS_SP(regs) = save_sp;
273 return err;
252} 274}
253 275
254int setup_signal_stack_si(unsigned long stack_top, int sig, 276int setup_signal_stack_si(unsigned long stack_top, int sig,
@@ -257,6 +279,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
257{ 279{
258 struct rt_sigframe __user *frame; 280 struct rt_sigframe __user *frame;
259 void *restorer; 281 void *restorer;
282 unsigned long save_sp = PT_REGS_SP(regs);
260 int err = 0; 283 int err = 0;
261 284
262 stack_top &= -8UL; 285 stack_top &= -8UL;
@@ -268,13 +291,16 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
268 if(ka->sa.sa_flags & SA_RESTORER) 291 if(ka->sa.sa_flags & SA_RESTORER)
269 restorer = ka->sa.sa_restorer; 292 restorer = ka->sa.sa_restorer;
270 293
294 /* See comment above about why this is here */
295 PT_REGS_SP(regs) = (unsigned long) frame;
296
271 err |= __put_user(restorer, &frame->pretcode); 297 err |= __put_user(restorer, &frame->pretcode);
272 err |= __put_user(sig, &frame->sig); 298 err |= __put_user(sig, &frame->sig);
273 err |= __put_user(&frame->info, &frame->pinfo); 299 err |= __put_user(&frame->info, &frame->pinfo);
274 err |= __put_user(&frame->uc, &frame->puc); 300 err |= __put_user(&frame->uc, &frame->puc);
275 err |= copy_siginfo_to_user(&frame->info, info); 301 err |= copy_siginfo_to_user(&frame->info, info);
276 err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask, 302 err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask,
277 PT_REGS_SP(regs)); 303 save_sp);
278 304
279 /* 305 /*
280 * This is movl $,%eax ; int $0x80 306 * This is movl $,%eax ; int $0x80
@@ -288,9 +314,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
288 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5)); 314 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
289 315
290 if(err) 316 if(err)
291 return(err); 317 goto err;
292 318
293 PT_REGS_SP(regs) = (unsigned long) frame;
294 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 319 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
295 PT_REGS_EAX(regs) = (unsigned long) sig; 320 PT_REGS_EAX(regs) = (unsigned long) sig;
296 PT_REGS_EDX(regs) = (unsigned long) &frame->info; 321 PT_REGS_EDX(regs) = (unsigned long) &frame->info;
@@ -298,7 +323,11 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
298 323
299 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) 324 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
300 ptrace_notify(SIGTRAP); 325 ptrace_notify(SIGTRAP);
301 return(0); 326 return 0;
327
328err:
329 PT_REGS_SP(regs) = save_sp;
330 return err;
302} 331}
303 332
304long sys_sigreturn(struct pt_regs regs) 333long sys_sigreturn(struct pt_regs regs)
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 26b68675053d..6f4ef2b7fa4a 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -3,12 +3,13 @@
3#include <asm/ptrace.h> 3#include <asm/ptrace.h>
4#include <asm/user.h> 4#include <asm/user.h>
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <sys/poll.h>
6 7
7#define DEFINE(sym, val) \ 8#define DEFINE(sym, val) \
8 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 9 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
9 10
10#define DEFINE_LONGS(sym, val) \ 11#define DEFINE_LONGS(sym, val) \
11 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long))) 12 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
12 13
13#define OFFSET(sym, str, mem) \ 14#define OFFSET(sym, str, mem) \
14 DEFINE(sym, offsetof(struct str, mem)); 15 DEFINE(sym, offsetof(struct str, mem));
@@ -67,4 +68,9 @@ void foo(void)
67 DEFINE(HOST_ES, ES); 68 DEFINE(HOST_ES, ES);
68 DEFINE(HOST_GS, GS); 69 DEFINE(HOST_GS, GS);
69 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct)); 70 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
71
72 /* XXX Duplicated between i386 and x86_64 */
73 DEFINE(UM_POLLIN, POLLIN);
74 DEFINE(UM_POLLPRI, POLLPRI);
75 DEFINE(UM_POLLOUT, POLLOUT);
70} 76}
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index 74eee5c7c6dd..147bbf05cbc2 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -8,6 +8,7 @@
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/mm.h>
11#include <asm/uaccess.h> 12#include <asm/uaccess.h>
12#include <asm/elf.h> 13#include <asm/elf.h>
13 14
@@ -136,9 +137,28 @@ void arch_switch(void)
136*/ 137*/
137} 138}
138 139
140/* XXX Mostly copied from sys-i386 */
139int is_syscall(unsigned long addr) 141int is_syscall(unsigned long addr)
140{ 142{
141 panic("is_syscall"); 143 unsigned short instr;
144 int n;
145
146 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
147 if(n){
148 /* access_process_vm() grants access to vsyscall and stub,
149 * while copy_from_user doesn't. Maybe access_process_vm is
150 * slow, but that doesn't matter, since it will be called only
151 * in case of singlestepping, if copy_from_user failed.
152 */
153 n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
154 if(n != sizeof(instr)) {
155 printk("is_syscall : failed to read instruction from "
156 "0x%lx\n", addr);
157 return(1);
158 }
159 }
160 /* sysenter */
161 return(instr == 0x050f);
142} 162}
143 163
144int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu ) 164int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index fe1d065332b1..e75c4e1838b0 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -55,7 +55,8 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
55} 55}
56 56
57int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, 57int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
58 struct pt_regs *regs, unsigned long mask) 58 struct pt_regs *regs, unsigned long mask,
59 unsigned long sp)
59{ 60{
60 struct faultinfo * fi = &current->thread.arch.faultinfo; 61 struct faultinfo * fi = &current->thread.arch.faultinfo;
61 int err = 0; 62 int err = 0;
@@ -70,7 +71,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
70 err |= PUTREG(regs, RDI, to, rdi); 71 err |= PUTREG(regs, RDI, to, rdi);
71 err |= PUTREG(regs, RSI, to, rsi); 72 err |= PUTREG(regs, RSI, to, rsi);
72 err |= PUTREG(regs, RBP, to, rbp); 73 err |= PUTREG(regs, RBP, to, rbp);
73 err |= PUTREG(regs, RSP, to, rsp); 74 /* Must use orignal RSP, which is passed in, rather than what's in
75 * the pt_regs, because that's already been updated to point at the
76 * signal frame.
77 */
78 err |= __put_user(sp, &to->rsp);
74 err |= PUTREG(regs, RBX, to, rbx); 79 err |= PUTREG(regs, RBX, to, rbx);
75 err |= PUTREG(regs, RDX, to, rdx); 80 err |= PUTREG(regs, RDX, to, rdx);
76 err |= PUTREG(regs, RCX, to, rcx); 81 err |= PUTREG(regs, RCX, to, rcx);
@@ -102,7 +107,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
102 107
103#ifdef CONFIG_MODE_TT 108#ifdef CONFIG_MODE_TT
104int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, 109int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
105 int fpsize) 110 int fpsize)
106{ 111{
107 struct _fpstate *to_fp, *from_fp; 112 struct _fpstate *to_fp, *from_fp;
108 unsigned long sigs; 113 unsigned long sigs;
@@ -120,7 +125,7 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
120} 125}
121 126
122int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, 127int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
123 struct sigcontext *from, int fpsize) 128 struct sigcontext *from, int fpsize, unsigned long sp)
124{ 129{
125 struct _fpstate *to_fp, *from_fp; 130 struct _fpstate *to_fp, *from_fp;
126 int err; 131 int err;
@@ -128,11 +133,17 @@ int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
128 to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); 133 to_fp = (fp ? fp : (struct _fpstate *) (to + 1));
129 from_fp = from->fpstate; 134 from_fp = from->fpstate;
130 err = copy_to_user(to, from, sizeof(*to)); 135 err = copy_to_user(to, from, sizeof(*to));
136 /* The SP in the sigcontext is the updated one for the signal
137 * delivery. The sp passed in is the original, and this needs
138 * to be restored, so we stick it in separately.
139 */
140 err |= copy_to_user(&SC_SP(to), sp, sizeof(sp));
141
131 if(from_fp != NULL){ 142 if(from_fp != NULL){
132 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); 143 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
133 err |= copy_to_user(to_fp, from_fp, fpsize); 144 err |= copy_to_user(to_fp, from_fp, fpsize);
134 } 145 }
135 return(err); 146 return err;
136} 147}
137 148
138#endif 149#endif
@@ -148,11 +159,12 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
148} 159}
149 160
150static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, 161static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
151 struct pt_regs *from, unsigned long mask) 162 struct pt_regs *from, unsigned long mask,
163 unsigned long sp)
152{ 164{
153 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), 165 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
154 sizeof(*fp)), 166 sizeof(*fp), sp),
155 copy_sc_to_user_skas(to, fp, from, mask))); 167 copy_sc_to_user_skas(to, fp, from, mask, sp)));
156} 168}
157 169
158struct rt_sigframe 170struct rt_sigframe
@@ -170,6 +182,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
170{ 182{
171 struct rt_sigframe __user *frame; 183 struct rt_sigframe __user *frame;
172 struct _fpstate __user *fp = NULL; 184 struct _fpstate __user *fp = NULL;
185 unsigned long save_sp = PT_REGS_RSP(regs);
173 int err = 0; 186 int err = 0;
174 struct task_struct *me = current; 187 struct task_struct *me = current;
175 188
@@ -193,14 +206,25 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
193 goto out; 206 goto out;
194 } 207 }
195 208
209 /* Update SP now because the page fault handler refuses to extend
210 * the stack if the faulting address is too far below the current
211 * SP, which frame now certainly is. If there's an error, the original
212 * value is restored on the way out.
213 * When writing the sigcontext to the stack, we have to write the
214 * original value, so that's passed to copy_sc_to_user, which does
215 * the right thing with it.
216 */
217 PT_REGS_RSP(regs) = (unsigned long) frame;
218
196 /* Create the ucontext. */ 219 /* Create the ucontext. */
197 err |= __put_user(0, &frame->uc.uc_flags); 220 err |= __put_user(0, &frame->uc.uc_flags);
198 err |= __put_user(0, &frame->uc.uc_link); 221 err |= __put_user(0, &frame->uc.uc_link);
199 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 222 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
200 err |= __put_user(sas_ss_flags(PT_REGS_SP(regs)), 223 err |= __put_user(sas_ss_flags(save_sp),
201 &frame->uc.uc_stack.ss_flags); 224 &frame->uc.uc_stack.ss_flags);
202 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size); 225 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
203 err |= copy_sc_to_user(&frame->uc.uc_mcontext, fp, regs, set->sig[0]); 226 err |= copy_sc_to_user(&frame->uc.uc_mcontext, fp, regs, set->sig[0],
227 save_sp);
204 err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate); 228 err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate);
205 if (sizeof(*set) == 16) { 229 if (sizeof(*set) == 16) {
206 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); 230 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
@@ -217,10 +241,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
217 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); 241 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
218 else 242 else
219 /* could use a vstub here */ 243 /* could use a vstub here */
220 goto out; 244 goto restore_sp;
221 245
222 if (err) 246 if (err)
223 goto out; 247 goto restore_sp;
224 248
225 /* Set up registers for signal handler */ 249 /* Set up registers for signal handler */
226 { 250 {
@@ -238,10 +262,12 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
238 PT_REGS_RSI(regs) = (unsigned long) &frame->info; 262 PT_REGS_RSI(regs) = (unsigned long) &frame->info;
239 PT_REGS_RDX(regs) = (unsigned long) &frame->uc; 263 PT_REGS_RDX(regs) = (unsigned long) &frame->uc;
240 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler; 264 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler;
241
242 PT_REGS_RSP(regs) = (unsigned long) frame;
243 out: 265 out:
244 return(err); 266 return err;
267
268restore_sp:
269 PT_REGS_RSP(regs) = save_sp;
270 return err;
245} 271}
246 272
247long sys_rt_sigreturn(struct pt_regs *regs) 273long sys_rt_sigreturn(struct pt_regs *regs)
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 7bd54a921cf7..899cebb57c3f 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -1,6 +1,7 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stddef.h> 2#include <stddef.h>
3#include <signal.h> 3#include <signal.h>
4#include <sys/poll.h>
4#define __FRAME_OFFSETS 5#define __FRAME_OFFSETS
5#include <asm/ptrace.h> 6#include <asm/ptrace.h>
6#include <asm/types.h> 7#include <asm/types.h>
@@ -88,4 +89,9 @@ void foo(void)
88 DEFINE_LONGS(HOST_IP, RIP); 89 DEFINE_LONGS(HOST_IP, RIP);
89 DEFINE_LONGS(HOST_SP, RSP); 90 DEFINE_LONGS(HOST_SP, RSP);
90 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct)); 91 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
92
93 /* XXX Duplicated between i386 and x86_64 */
94 DEFINE(UM_POLLIN, POLLIN);
95 DEFINE(UM_POLLPRI, POLLPRI);
96 DEFINE(UM_POLLOUT, POLLOUT);
91} 97}
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 45efe0ca88f8..4310b4a311a5 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -250,6 +250,15 @@ config SCHED_SMT
250 cost of slightly increased overhead in some places. If unsure say 250 cost of slightly increased overhead in some places. If unsure say
251 N here. 251 N here.
252 252
253config SCHED_MC
254 bool "Multi-core scheduler support"
255 depends on SMP
256 default y
257 help
258 Multi-core scheduler support improves the CPU scheduler's decision
259 making when dealing with multi-core CPU chips at a cost of slightly
260 increased overhead in some places. If unsure say N here.
261
253source "kernel/Kconfig.preempt" 262source "kernel/Kconfig.preempt"
254 263
255config NUMA 264config NUMA
@@ -325,6 +334,10 @@ config HAVE_ARCH_EARLY_PFN_TO_NID
325 def_bool y 334 def_bool y
326 depends on NUMA 335 depends on NUMA
327 336
337config OUT_OF_LINE_PFN_TO_PAGE
338 def_bool y
339 depends on DISCONTIGMEM
340
328config NR_CPUS 341config NR_CPUS
329 int "Maximum number of CPUs (2-256)" 342 int "Maximum number of CPUs (2-256)"
330 range 2 255 343 range 2 255
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 7549a4389fbf..35b2faccdc6c 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -688,6 +688,8 @@ ia32_sys_call_table:
688 .quad sys_ni_syscall /* pselect6 for now */ 688 .quad sys_ni_syscall /* pselect6 for now */
689 .quad sys_ni_syscall /* ppoll for now */ 689 .quad sys_ni_syscall /* ppoll for now */
690 .quad sys_unshare /* 310 */ 690 .quad sys_unshare /* 310 */
691 .quad compat_sys_set_robust_list
692 .quad compat_sys_get_robust_list
691ia32_syscall_end: 693ia32_syscall_end:
692 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 694 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
693 .quad ni_syscall 695 .quad ni_syscall
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 0370720515f1..70dd8e5c6889 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -66,24 +66,17 @@ EXPORT_SYMBOL(boot_option_idle_override);
66void (*pm_idle)(void); 66void (*pm_idle)(void);
67static DEFINE_PER_CPU(unsigned int, cpu_idle_state); 67static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
68 68
69static struct notifier_block *idle_notifier; 69static ATOMIC_NOTIFIER_HEAD(idle_notifier);
70static DEFINE_SPINLOCK(idle_notifier_lock);
71 70
72void idle_notifier_register(struct notifier_block *n) 71void idle_notifier_register(struct notifier_block *n)
73{ 72{
74 unsigned long flags; 73 atomic_notifier_chain_register(&idle_notifier, n);
75 spin_lock_irqsave(&idle_notifier_lock, flags);
76 notifier_chain_register(&idle_notifier, n);
77 spin_unlock_irqrestore(&idle_notifier_lock, flags);
78} 74}
79EXPORT_SYMBOL_GPL(idle_notifier_register); 75EXPORT_SYMBOL_GPL(idle_notifier_register);
80 76
81void idle_notifier_unregister(struct notifier_block *n) 77void idle_notifier_unregister(struct notifier_block *n)
82{ 78{
83 unsigned long flags; 79 atomic_notifier_chain_unregister(&idle_notifier, n);
84 spin_lock_irqsave(&idle_notifier_lock, flags);
85 notifier_chain_unregister(&idle_notifier, n);
86 spin_unlock_irqrestore(&idle_notifier_lock, flags);
87} 80}
88EXPORT_SYMBOL(idle_notifier_unregister); 81EXPORT_SYMBOL(idle_notifier_unregister);
89 82
@@ -93,13 +86,13 @@ static DEFINE_PER_CPU(enum idle_state, idle_state) = CPU_NOT_IDLE;
93void enter_idle(void) 86void enter_idle(void)
94{ 87{
95 __get_cpu_var(idle_state) = CPU_IDLE; 88 __get_cpu_var(idle_state) = CPU_IDLE;
96 notifier_call_chain(&idle_notifier, IDLE_START, NULL); 89 atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
97} 90}
98 91
99static void __exit_idle(void) 92static void __exit_idle(void)
100{ 93{
101 __get_cpu_var(idle_state) = CPU_NOT_IDLE; 94 __get_cpu_var(idle_state) = CPU_NOT_IDLE;
102 notifier_call_chain(&idle_notifier, IDLE_END, NULL); 95 atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
103} 96}
104 97
105/* Called from interrupts to signify idle end */ 98/* Called from interrupts to signify idle end */
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index a57eec8311a7..d1f3e9272c05 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -962,7 +962,6 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
962 962
963 cpuid(1, &eax, &ebx, &ecx, &edx); 963 cpuid(1, &eax, &ebx, &ecx, &edx);
964 964
965 c->apicid = phys_pkg_id(0);
966 965
967 if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) 966 if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
968 return; 967 return;
@@ -1171,6 +1170,8 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
1171 c->x86_capability[2] = cpuid_edx(0x80860001); 1170 c->x86_capability[2] = cpuid_edx(0x80860001);
1172 } 1171 }
1173 1172
1173 c->apicid = phys_pkg_id(0);
1174
1174 /* 1175 /*
1175 * Vendor-specific initialization. In this section we 1176 * Vendor-specific initialization. In this section we
1176 * canonicalize the feature flags, meaning if there are 1177 * canonicalize the feature flags, meaning if there are
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 66e98659d077..ea48fa638070 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -68,6 +68,9 @@ u8 phys_proc_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
68/* core ID of each logical CPU */ 68/* core ID of each logical CPU */
69u8 cpu_core_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; 69u8 cpu_core_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
70 70
71/* Last level cache ID of each logical CPU */
72u8 cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
73
71/* Bitmask of currently online CPUs */ 74/* Bitmask of currently online CPUs */
72cpumask_t cpu_online_map __read_mostly; 75cpumask_t cpu_online_map __read_mostly;
73 76
@@ -445,6 +448,18 @@ void __cpuinit smp_callin(void)
445 cpu_set(cpuid, cpu_callin_map); 448 cpu_set(cpuid, cpu_callin_map);
446} 449}
447 450
451/* maps the cpu to the sched domain representing multi-core */
452cpumask_t cpu_coregroup_map(int cpu)
453{
454 struct cpuinfo_x86 *c = cpu_data + cpu;
455 /*
456 * For perf, we return last level cache shared map.
457 * TBD: when power saving sched policy is added, we will return
458 * cpu_core_map when power saving policy is enabled
459 */
460 return c->llc_shared_map;
461}
462
448/* representing cpus for which sibling maps can be computed */ 463/* representing cpus for which sibling maps can be computed */
449static cpumask_t cpu_sibling_setup_map; 464static cpumask_t cpu_sibling_setup_map;
450 465
@@ -463,12 +478,16 @@ static inline void set_cpu_sibling_map(int cpu)
463 cpu_set(cpu, cpu_sibling_map[i]); 478 cpu_set(cpu, cpu_sibling_map[i]);
464 cpu_set(i, cpu_core_map[cpu]); 479 cpu_set(i, cpu_core_map[cpu]);
465 cpu_set(cpu, cpu_core_map[i]); 480 cpu_set(cpu, cpu_core_map[i]);
481 cpu_set(i, c[cpu].llc_shared_map);
482 cpu_set(cpu, c[i].llc_shared_map);
466 } 483 }
467 } 484 }
468 } else { 485 } else {
469 cpu_set(cpu, cpu_sibling_map[cpu]); 486 cpu_set(cpu, cpu_sibling_map[cpu]);
470 } 487 }
471 488
489 cpu_set(cpu, c[cpu].llc_shared_map);
490
472 if (current_cpu_data.x86_max_cores == 1) { 491 if (current_cpu_data.x86_max_cores == 1) {
473 cpu_core_map[cpu] = cpu_sibling_map[cpu]; 492 cpu_core_map[cpu] = cpu_sibling_map[cpu];
474 c[cpu].booted_cores = 1; 493 c[cpu].booted_cores = 1;
@@ -476,6 +495,11 @@ static inline void set_cpu_sibling_map(int cpu)
476 } 495 }
477 496
478 for_each_cpu_mask(i, cpu_sibling_setup_map) { 497 for_each_cpu_mask(i, cpu_sibling_setup_map) {
498 if (cpu_llc_id[cpu] != BAD_APICID &&
499 cpu_llc_id[cpu] == cpu_llc_id[i]) {
500 cpu_set(i, c[cpu].llc_shared_map);
501 cpu_set(cpu, c[i].llc_shared_map);
502 }
479 if (phys_proc_id[cpu] == phys_proc_id[i]) { 503 if (phys_proc_id[cpu] == phys_proc_id[i]) {
480 cpu_set(i, cpu_core_map[cpu]); 504 cpu_set(i, cpu_core_map[cpu]);
481 cpu_set(cpu, cpu_core_map[i]); 505 cpu_set(cpu, cpu_core_map[i]);
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 7f58fa682491..473b514b66e4 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -504,42 +504,25 @@ unsigned long long sched_clock(void)
504 504
505static unsigned long get_cmos_time(void) 505static unsigned long get_cmos_time(void)
506{ 506{
507 unsigned int timeout = 1000000, year, mon, day, hour, min, sec; 507 unsigned int year, mon, day, hour, min, sec;
508 unsigned char uip = 0, this = 0;
509 unsigned long flags; 508 unsigned long flags;
510 unsigned extyear = 0; 509 unsigned extyear = 0;
511 510
512/*
513 * The Linux interpretation of the CMOS clock register contents: When the
514 * Update-In-Progress (UIP) flag goes from 1 to 0, the RTC registers show the
515 * second which has precisely just started. Waiting for this can take up to 1
516 * second, we timeout approximately after 2.4 seconds on a machine with
517 * standard 8.3 MHz ISA bus.
518 */
519
520 spin_lock_irqsave(&rtc_lock, flags); 511 spin_lock_irqsave(&rtc_lock, flags);
521 512
522 while (timeout && (!uip || this)) { 513 do {
523 uip |= this; 514 sec = CMOS_READ(RTC_SECONDS);
524 this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP; 515 min = CMOS_READ(RTC_MINUTES);
525 timeout--; 516 hour = CMOS_READ(RTC_HOURS);
526 } 517 day = CMOS_READ(RTC_DAY_OF_MONTH);
527 518 mon = CMOS_READ(RTC_MONTH);
528 /* 519 year = CMOS_READ(RTC_YEAR);
529 * Here we are safe to assume the registers won't change for a whole
530 * second, so we just go ahead and read them.
531 */
532 sec = CMOS_READ(RTC_SECONDS);
533 min = CMOS_READ(RTC_MINUTES);
534 hour = CMOS_READ(RTC_HOURS);
535 day = CMOS_READ(RTC_DAY_OF_MONTH);
536 mon = CMOS_READ(RTC_MONTH);
537 year = CMOS_READ(RTC_YEAR);
538
539#ifdef CONFIG_ACPI 520#ifdef CONFIG_ACPI
540 if (acpi_fadt.revision >= FADT2_REVISION_ID && acpi_fadt.century) 521 if (acpi_fadt.revision >= FADT2_REVISION_ID &&
541 extyear = CMOS_READ(acpi_fadt.century); 522 acpi_fadt.century)
523 extyear = CMOS_READ(acpi_fadt.century);
542#endif 524#endif
525 } while (sec != CMOS_READ(RTC_SECONDS));
543 526
544 spin_unlock_irqrestore(&rtc_lock, flags); 527 spin_unlock_irqrestore(&rtc_lock, flags);
545 528
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 7b148309c529..edaa9fe654dc 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -69,20 +69,20 @@ asmlinkage void alignment_check(void);
69asmlinkage void machine_check(void); 69asmlinkage void machine_check(void);
70asmlinkage void spurious_interrupt_bug(void); 70asmlinkage void spurious_interrupt_bug(void);
71 71
72struct notifier_block *die_chain; 72ATOMIC_NOTIFIER_HEAD(die_chain);
73static DEFINE_SPINLOCK(die_notifier_lock);
74 73
75int register_die_notifier(struct notifier_block *nb) 74int register_die_notifier(struct notifier_block *nb)
76{ 75{
77 int err = 0;
78 unsigned long flags;
79
80 vmalloc_sync_all(); 76 vmalloc_sync_all();
81 spin_lock_irqsave(&die_notifier_lock, flags); 77 return atomic_notifier_chain_register(&die_chain, nb);
82 err = notifier_chain_register(&die_chain, nb); 78}
83 spin_unlock_irqrestore(&die_notifier_lock, flags); 79EXPORT_SYMBOL(register_die_notifier);
84 return err; 80
81int unregister_die_notifier(struct notifier_block *nb)
82{
83 return atomic_notifier_chain_unregister(&die_chain, nb);
85} 84}
85EXPORT_SYMBOL(unregister_die_notifier);
86 86
87static inline void conditional_sti(struct pt_regs *regs) 87static inline void conditional_sti(struct pt_regs *regs)
88{ 88{
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index b04415625442..e5f7f1c34462 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -72,7 +72,7 @@ void show_mem(void)
72 show_free_areas(); 72 show_free_areas();
73 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 73 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
74 74
75 for_each_pgdat(pgdat) { 75 for_each_online_pgdat(pgdat) {
76 for (i = 0; i < pgdat->node_spanned_pages; ++i) { 76 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
77 page = pfn_to_page(pgdat->node_start_pfn + i); 77 page = pfn_to_page(pgdat->node_start_pfn + i);
78 total++; 78 total++;
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 63c72641b737..4be82d6e2b48 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -377,21 +377,6 @@ EXPORT_SYMBOL(node_data);
377 * Should do that. 377 * Should do that.
378 */ 378 */
379 379
380/* Requires pfn_valid(pfn) to be true */
381struct page *pfn_to_page(unsigned long pfn)
382{
383 int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);
384 return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;
385}
386EXPORT_SYMBOL(pfn_to_page);
387
388unsigned long page_to_pfn(struct page *page)
389{
390 return (long)(((page) - page_zone(page)->zone_mem_map) +
391 page_zone(page)->zone_start_pfn);
392}
393EXPORT_SYMBOL(page_to_pfn);
394
395int pfn_valid(unsigned long pfn) 380int pfn_valid(unsigned long pfn)
396{ 381{
397 unsigned nid; 382 unsigned nid;
diff --git a/arch/xtensa/platform-iss/setup.c b/arch/xtensa/platform-iss/setup.c
index 2e6dcbf0cc04..23790a5610e2 100644
--- a/arch/xtensa/platform-iss/setup.c
+++ b/arch/xtensa/platform-iss/setup.c
@@ -108,5 +108,5 @@ static struct notifier_block iss_panic_block = {
108 108
109void __init platform_setup(char **p_cmdline) 109void __init platform_setup(char **p_cmdline)
110{ 110{
111 notifier_chain_register(&panic_notifier_list, &iss_panic_block); 111 atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
112} 112}