aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ks8695/board-micrel.c8
-rw-r--r--arch/arm/mach-s3c2442/Kconfig2
-rw-r--r--arch/avr32/boards/atngw100/setup.c18
-rw-r--r--arch/avr32/boards/atstk1000/Kconfig26
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c62
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig1
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig1
-rw-r--r--arch/h8300/kernel/process.c1
-rw-r--r--arch/h8300/kernel/sys_h8300.c1
-rw-r--r--arch/i386/Kconfig13
-rw-r--r--arch/i386/Makefile4
-rw-r--r--arch/i386/boot/edd.c54
-rw-r--r--arch/i386/boot/video.c2
-rw-r--r--arch/i386/kernel/alternative.c2
-rw-r--r--arch/i386/kernel/apic.c2
-rw-r--r--arch/i386/kernel/nmi.c4
-rw-r--r--arch/i386/kernel/tsc.c1
-rw-r--r--arch/i386/mm/fault.c5
-rw-r--r--arch/i386/xen/xen-head.S6
-rw-r--r--arch/ia64/Kconfig12
-rw-r--r--arch/ia64/configs/bigsur_defconfig2
-rw-r--r--arch/ia64/configs/gensparse_defconfig2
-rw-r--r--arch/ia64/configs/sim_defconfig2
-rw-r--r--arch/ia64/configs/sn2_defconfig2
-rw-r--r--arch/ia64/configs/tiger_defconfig2
-rw-r--r--arch/ia64/configs/zx1_defconfig2
-rw-r--r--arch/ia64/defconfig3
-rw-r--r--arch/ia64/hp/sim/boot/boot_head.S1
-rw-r--r--arch/ia64/kernel/cpufreq/acpi-cpufreq.c6
-rw-r--r--arch/ia64/kernel/irq.c5
-rw-r--r--arch/ia64/kernel/mca.c34
-rw-r--r--arch/ia64/kernel/process.c10
-rw-r--r--arch/ia64/kernel/ptrace.c10
-rw-r--r--arch/ia64/kernel/setup.c7
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S12
-rw-r--r--arch/ia64/mm/fault.c14
-rw-r--r--arch/ia64/sn/kernel/irq.c12
-rw-r--r--arch/m68k/kernel/setup.c2
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds4
-rw-r--r--arch/m68k/mm/motorola.c6
-rw-r--r--arch/m68knommu/kernel/process.c1
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c1
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts88
-rw-r--r--arch/powerpc/boot/dts/mpc8641_hpcn.dts114
-rw-r--r--arch/powerpc/boot/flatdevtree.c18
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/misc_32.S12
-rw-r--r--arch/powerpc/kernel/traps.c4
-rw-r--r--arch/powerpc/mm/hash_utils_64.c2
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/85xx/mpc8544_ds.c214
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c224
-rw-r--r--arch/powerpc/platforms/Kconfig8
-rw-r--r--arch/powerpc/platforms/Makefile3
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c1
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c255
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c2
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c2
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c1
-rw-r--r--arch/powerpc/sysdev/rtc_cmos_setup.c17
-rw-r--r--arch/ppc/kernel/misc.S12
-rw-r--r--arch/s390/hypfs/inode.c33
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/diag.c102
-rw-r--r--arch/s390/kernel/dis.c2
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--arch/s390/kernel/s390_ksyms.c1
-rw-r--r--arch/s390/mm/cmm.c1
-rw-r--r--arch/s390/mm/init.c17
-rw-r--r--arch/sh/Makefile17
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh4-202.c5
-rw-r--r--arch/sh/kernel/early_printk.c2
-rw-r--r--arch/sh/kernel/machvec.c7
-rw-r--r--arch/sh/kernel/ptrace.c1
-rw-r--r--arch/sh64/kernel/setup.c4
-rw-r--r--arch/sh64/kernel/signal.c1
-rw-r--r--arch/sparc/kernel/ebus.c1
-rw-r--r--arch/sparc/mm/io-unit.c18
-rw-r--r--arch/sparc/mm/iommu.c12
-rw-r--r--arch/sparc/mm/sun4c.c2
-rw-r--r--arch/sparc64/kernel/head.S14
-rw-r--r--arch/sparc64/kernel/mdesc.c38
-rw-r--r--arch/sparc64/kernel/trampoline.S7
-rw-r--r--arch/sparc64/lib/Makefile2
-rw-r--r--arch/sparc64/lib/NG2copy_from_user.S40
-rw-r--r--arch/sparc64/lib/NG2copy_to_user.S49
-rw-r--r--arch/sparc64/lib/NG2memcpy.S520
-rw-r--r--arch/sparc64/lib/NG2page.S61
-rw-r--r--arch/sparc64/lib/NG2patch.S33
-rw-r--r--arch/sparc64/lib/NGpage.S1
-rw-r--r--arch/um/drivers/ubd_kern.c4
-rw-r--r--arch/x86_64/Makefile4
-rw-r--r--arch/x86_64/kernel/head.S3
-rw-r--r--arch/x86_64/kernel/nmi.c4
-rw-r--r--arch/x86_64/kernel/pci-dma.c4
96 files changed, 1595 insertions, 764 deletions
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c
index 8fc0edb5211e..2feeef81d843 100644
--- a/arch/arm/mach-ks8695/board-micrel.c
+++ b/arch/arm/mach-ks8695/board-micrel.c
@@ -23,24 +23,24 @@
23#include "generic.h" 23#include "generic.h"
24 24
25#ifdef CONFIG_PCI 25#ifdef CONFIG_PCI
26static int __init micrel_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 26static int micrel_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
27{ 27{
28 return KS8695_IRQ_EXTERN0; 28 return KS8695_IRQ_EXTERN0;
29} 29}
30 30
31static struct ks8695_pci_cfg micrel_pci = { 31static struct ks8695_pci_cfg __initdata micrel_pci = {
32 .mode = KS8695_MODE_MINIPCI, 32 .mode = KS8695_MODE_MINIPCI,
33 .map_irq = micrel_pci_map_irq, 33 .map_irq = micrel_pci_map_irq,
34}; 34};
35#endif 35#endif
36 36
37 37
38static void micrel_init(void) 38static void __init micrel_init(void)
39{ 39{
40 printk(KERN_INFO "Micrel KS8695 Development Board initializing\n"); 40 printk(KERN_INFO "Micrel KS8695 Development Board initializing\n");
41 41
42#ifdef CONFIG_PCI 42#ifdef CONFIG_PCI
43 ks8695_init_pci(&micrel_pci); 43// ks8695_init_pci(&micrel_pci);
44#endif 44#endif
45 45
46 /* Add devices */ 46 /* Add devices */
diff --git a/arch/arm/mach-s3c2442/Kconfig b/arch/arm/mach-s3c2442/Kconfig
index 88d5fd34fe3b..26d131a77074 100644
--- a/arch/arm/mach-s3c2442/Kconfig
+++ b/arch/arm/mach-s3c2442/Kconfig
@@ -6,7 +6,7 @@
6 6
7config CPU_S3C2442 7config CPU_S3C2442
8 bool 8 bool
9 depends on ARCH_S3C2420 9 depends on ARCH_S3C2410
10 select S3C2410_CLOCK 10 select S3C2410_CLOCK
11 select S3C2410_GPIO 11 select S3C2410_GPIO
12 select S3C2410_PM if PM 12 select S3C2410_PM if PM
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 2edcecdea8bd..ef801563bbf5 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
12#include <linux/i2c-gpio.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/linkage.h> 14#include <linux/linkage.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -123,6 +124,19 @@ static struct platform_device ngw_gpio_leds = {
123 } 124 }
124}; 125};
125 126
127static struct i2c_gpio_platform_data i2c_gpio_data = {
128 .sda_pin = GPIO_PIN_PA(6),
129 .scl_pin = GPIO_PIN_PA(7),
130};
131
132static struct platform_device i2c_gpio_device = {
133 .name = "i2c-gpio",
134 .id = 0,
135 .dev = {
136 .platform_data = &i2c_gpio_data,
137 },
138};
139
126static int __init atngw100_init(void) 140static int __init atngw100_init(void)
127{ 141{
128 unsigned i; 142 unsigned i;
@@ -147,6 +161,10 @@ static int __init atngw100_init(void)
147 } 161 }
148 platform_device_register(&ngw_gpio_leds); 162 platform_device_register(&ngw_gpio_leds);
149 163
164 at32_select_gpio(i2c_gpio_data.sda_pin, 0);
165 at32_select_gpio(i2c_gpio_data.scl_pin, 0);
166 platform_device_register(&i2c_gpio_device);
167
150 return 0; 168 return 0;
151} 169}
152postcore_initcall(atngw100_init); 170postcore_initcall(atngw100_init);
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig
index 71bc7d364fb7..718578f64069 100644
--- a/arch/avr32/boards/atstk1000/Kconfig
+++ b/arch/avr32/boards/atstk1000/Kconfig
@@ -50,4 +50,30 @@ config BOARD_ATSTK1002_SPI1
50 GPIO lines and accessed through the J1 jumper block. Say "y" 50 GPIO lines and accessed through the J1 jumper block. Say "y"
51 here to configure that SPI controller. 51 here to configure that SPI controller.
52 52
53config BOARD_ATSTK1002_J2_LED
54 bool
55 default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB
56
57choice
58 prompt "LEDs connected to J2:"
59 depends on LEDS_GPIO && !BOARD_ATSTK1002_SW4_CUSTOM
60 optional
61 help
62 Select this if you have jumpered the J2 jumper block to the
63 LED0..LED7 amber leds, or to the RGB leds, using a ten-pin
64 IDC cable. A default "heartbeat" trigger is provided, but
65 you can of course override this.
66
67config BOARD_ATSTK1002_J2_LED8
68 bool "LED0..LED7"
69 help
70 Select this if J2 is jumpered to LED0..LED7 amber leds.
71
72config BOARD_ATSTK1002_J2_RGB
73 bool "RGB leds"
74 help
75 Select this if J2 is jumpered to the RGB leds.
76
77endchoice
78
53endif # stk 1002 79endif # stk 1002
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index cb93eabb9c6c..c9981b731efa 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -11,6 +11,7 @@
11#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/leds.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/types.h> 17#include <linux/types.h>
@@ -120,6 +121,65 @@ static void __init set_hw_addr(struct platform_device *pdev)
120 clk_put(pclk); 121 clk_put(pclk);
121} 122}
122 123
124#ifdef CONFIG_BOARD_ATSTK1002_J2_LED
125
126static struct gpio_led stk_j2_led[] = {
127#ifdef CONFIG_BOARD_ATSTK1002_J2_LED8
128#define LEDSTRING "J2 jumpered to LED8"
129 { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
130 { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
131 { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
132 { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
133 { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
134 { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
135 { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
136 { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
137 .default_trigger = "heartbeat", },
138#else /* RGB */
139#define LEDSTRING "J2 jumpered to RGB LEDs"
140 { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
141 { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
142 { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
143
144 { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
145 .default_trigger = "heartbeat", },
146 { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
147 { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
148 .default_trigger = "heartbeat", },
149 /* PB16, PB30 unused */
150#endif
151};
152
153static struct gpio_led_platform_data stk_j2_led_data = {
154 .num_leds = ARRAY_SIZE(stk_j2_led),
155 .leds = stk_j2_led,
156};
157
158static struct platform_device stk_j2_led_dev = {
159 .name = "leds-gpio",
160 .id = 2, /* gpio block J2 */
161 .dev = {
162 .platform_data = &stk_j2_led_data,
163 },
164};
165
166static void setup_j2_leds(void)
167{
168 unsigned i;
169
170 for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++)
171 at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
172
173 printk("STK1002: " LEDSTRING "\n");
174 platform_device_register(&stk_j2_led_dev);
175}
176
177#else
178static void setup_j2_leds(void)
179{
180}
181#endif
182
123void __init setup_board(void) 183void __init setup_board(void)
124{ 184{
125#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 185#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
@@ -185,6 +245,8 @@ static int __init atstk1002_init(void)
185 at32_add_device_ssc(0, ATMEL_SSC_TX); 245 at32_add_device_ssc(0, ATMEL_SSC_TX);
186#endif 246#endif
187 247
248 setup_j2_leds();
249
188 return 0; 250 return 0;
189} 251}
190postcore_initcall(atstk1002_init); 252postcore_initcall(atstk1002_init);
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index e7e724bc0ba6..03e2e68f947d 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -548,6 +548,7 @@ config ETRAX_IDE
548 select BLK_DEV_IDEDISK 548 select BLK_DEV_IDEDISK
549 select BLK_DEV_IDECD 549 select BLK_DEV_IDECD
550 select BLK_DEV_IDEDMA 550 select BLK_DEV_IDEDMA
551 select IDE_GENERIC
551 help 552 help
552 Enable this to get support for ATA/IDE. 553 Enable this to get support for ATA/IDE.
553 You can't use parallel ports or SCSI ports 554 You can't use parallel ports or SCSI ports
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index 1d859c16931e..cc6ba5423754 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -592,6 +592,7 @@ config ETRAX_IDE
592 select BLK_DEV_IDEDISK 592 select BLK_DEV_IDEDISK
593 select BLK_DEV_IDECD 593 select BLK_DEV_IDECD
594 select BLK_DEV_IDEDMA 594 select BLK_DEV_IDEDMA
595 select IDE_GENERIC
595 help 596 help
596 Enables the ETRAX IDE driver. 597 Enables the ETRAX IDE driver.
597 598
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index e061b63a0038..dfbe7ab9ffe2 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -37,6 +37,7 @@
37#include <linux/a.out.h> 37#include <linux/a.out.h>
38#include <linux/interrupt.h> 38#include <linux/interrupt.h>
39#include <linux/reboot.h> 39#include <linux/reboot.h>
40#include <linux/fs.h>
40 41
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42#include <asm/system.h> 43#include <asm/system.h>
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index de7688cfd573..ddc62727dc9f 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -18,6 +18,7 @@
18#include <linux/mman.h> 18#include <linux/mman.h>
19#include <linux/file.h> 19#include <linux/file.h>
20#include <linux/utsname.h> 20#include <linux/utsname.h>
21#include <linux/fs.h>
21 22
22#include <asm/setup.h> 23#include <asm/setup.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index f9524933258a..97b64d7d6bf6 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -614,10 +614,14 @@ config X86_PAE
614 614
615# Common NUMA Features 615# Common NUMA Features
616config NUMA 616config NUMA
617 bool "Numa Memory Allocation and Scheduler Support" 617 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
618 depends on SMP && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) 618 depends on SMP && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL
619 default n if X86_PC 619 default n if X86_PC
620 default y if (X86_NUMAQ || X86_SUMMIT) 620 default y if (X86_NUMAQ || X86_SUMMIT)
621 help
622 NUMA support for i386. This is currently high experimental
623 and should be only used for kernel development. It might also
624 cause boot failures.
621 625
622comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" 626comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI"
623 depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI) 627 depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI)
@@ -1228,6 +1232,11 @@ menuconfig INSTRUMENTATION
1228 bool "Instrumentation Support" 1232 bool "Instrumentation Support"
1229 depends on EXPERIMENTAL 1233 depends on EXPERIMENTAL
1230 default y 1234 default y
1235 ---help---
1236 Say Y here to get to see options related to performance measurement,
1237 debugging, and testing. This option alone does not add any kernel code.
1238
1239 If you say N, all options in this submenu will be skipped and disabled.
1231 1240
1232if INSTRUMENTATION 1241if INSTRUMENTATION
1233 1242
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index 01f0ff0daaf4..52b932478c6d 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -51,8 +51,8 @@ cflags-y += -maccumulate-outgoing-args
51CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;) 51CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;)
52 52
53# do binutils support CFI? 53# do binutils support CFI?
54cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 54cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
55AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 55AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
56 56
57# is .cfi_signal_frame supported too? 57# is .cfi_signal_frame supported too?
58cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 58cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
diff --git a/arch/i386/boot/edd.c b/arch/i386/boot/edd.c
index 658834d9f92a..82b5c846a194 100644
--- a/arch/i386/boot/edd.c
+++ b/arch/i386/boot/edd.c
@@ -19,40 +19,12 @@
19 19
20#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) 20#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
21 21
22struct edd_dapa {
23 u8 pkt_size;
24 u8 rsvd;
25 u16 sector_cnt;
26 u16 buf_off, buf_seg;
27 u64 lba;
28 u64 buf_lin_addr;
29};
30
31/* 22/*
32 * Read the MBR (first sector) from a specific device. 23 * Read the MBR (first sector) from a specific device.
33 */ 24 */
34static int read_mbr(u8 devno, void *buf) 25static int read_mbr(u8 devno, void *buf)
35{ 26{
36 struct edd_dapa dapa; 27 u16 ax, bx, cx, dx;
37 u16 ax, bx, cx, dx, si;
38
39 memset(&dapa, 0, sizeof dapa);
40 dapa.pkt_size = sizeof(dapa);
41 dapa.sector_cnt = 1;
42 dapa.buf_off = (size_t)buf;
43 dapa.buf_seg = ds();
44 /* dapa.lba = 0; */
45
46 ax = 0x4200; /* Extended Read */
47 si = (size_t)&dapa;
48 dx = devno;
49 asm("pushfl; stc; int $0x13; setc %%al; popfl"
50 : "+a" (ax), "+S" (si), "+d" (dx)
51 : "m" (dapa)
52 : "ebx", "ecx", "edi", "memory");
53
54 if (!(u8)ax)
55 return 0; /* OK */
56 28
57 ax = 0x0201; /* Legacy Read, one sector */ 29 ax = 0x0201; /* Legacy Read, one sector */
58 cx = 0x0001; /* Sector 0-0-1 */ 30 cx = 0x0001; /* Sector 0-0-1 */
@@ -65,11 +37,10 @@ static int read_mbr(u8 devno, void *buf)
65 return -(u8)ax; /* 0 or -1 */ 37 return -(u8)ax; /* 0 or -1 */
66} 38}
67 39
68static u32 read_mbr_sig(u8 devno, struct edd_info *ei) 40static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig)
69{ 41{
70 int sector_size; 42 int sector_size;
71 char *mbrbuf_ptr, *mbrbuf_end; 43 char *mbrbuf_ptr, *mbrbuf_end;
72 u32 mbrsig;
73 u32 buf_base, mbr_base; 44 u32 buf_base, mbr_base;
74 extern char _end[]; 45 extern char _end[];
75 46
@@ -85,15 +56,15 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
85 56
86 /* Make sure we actually have space on the heap... */ 57 /* Make sure we actually have space on the heap... */
87 if (!(boot_params.hdr.loadflags & CAN_USE_HEAP)) 58 if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
88 return 0; 59 return -1;
89 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) 60 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
90 return 0; 61 return -1;
91 62
92 if (read_mbr(devno, mbrbuf_ptr)) 63 if (read_mbr(devno, mbrbuf_ptr))
93 return 0; 64 return -1;
94 65
95 mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET]; 66 *mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
96 return mbrsig; 67 return 0;
97} 68}
98 69
99static int get_edd_info(u8 devno, struct edd_info *ei) 70static int get_edd_info(u8 devno, struct edd_info *ei)
@@ -160,6 +131,7 @@ void query_edd(void)
160 int do_edd = 1; 131 int do_edd = 1;
161 int devno; 132 int devno;
162 struct edd_info ei, *edp; 133 struct edd_info ei, *edp;
134 u32 *mbrptr;
163 135
164 if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { 136 if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
165 if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) 137 if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip"))
@@ -168,7 +140,8 @@ void query_edd(void)
168 do_edd = 0; 140 do_edd = 0;
169 } 141 }
170 142
171 edp = (struct edd_info *)boot_params.eddbuf; 143 edp = boot_params.eddbuf;
144 mbrptr = boot_params.edd_mbr_sig_buffer;
172 145
173 if (!do_edd) 146 if (!do_edd)
174 return; 147 return;
@@ -186,11 +159,8 @@ void query_edd(void)
186 boot_params.eddbuf_entries++; 159 boot_params.eddbuf_entries++;
187 } 160 }
188 161
189 if (do_mbr) { 162 if (do_mbr && !read_mbr_sig(devno, &ei, mbrptr++))
190 u32 mbr_sig; 163 boot_params.edd_mbr_sig_buf_entries = devno-0x80+1;
191 mbr_sig = read_mbr_sig(devno, &ei);
192 boot_params.edd_mbr_sig_buffer[devno-0x80] = mbr_sig;
193 }
194 } 164 }
195} 165}
196 166
diff --git a/arch/i386/boot/video.c b/arch/i386/boot/video.c
index 958130ef0042..693f20d3102e 100644
--- a/arch/i386/boot/video.c
+++ b/arch/i386/boot/video.c
@@ -61,7 +61,7 @@ static void store_video_mode(void)
61 61
62 /* Not all BIOSes are clean with respect to the top bit */ 62 /* Not all BIOSes are clean with respect to the top bit */
63 boot_params.screen_info.orig_video_mode = ax & 0x7f; 63 boot_params.screen_info.orig_video_mode = ax & 0x7f;
64 boot_params.screen_info.orig_video_page = page; 64 boot_params.screen_info.orig_video_page = page >> 8;
65} 65}
66 66
67/* 67/*
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index 1b66d5c70eaf..9f4ac8b02de4 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -366,6 +366,8 @@ void apply_paravirt(struct paravirt_patch_site *start,
366 unsigned int used; 366 unsigned int used;
367 367
368 BUG_ON(p->len > MAX_PATCH_LEN); 368 BUG_ON(p->len > MAX_PATCH_LEN);
369 /* prep the buffer with the original instructions */
370 memcpy(insnbuf, p->instr, p->len);
369 used = paravirt_ops.patch(p->instrtype, p->clobbers, insnbuf, 371 used = paravirt_ops.patch(p->instrtype, p->clobbers, insnbuf,
370 (unsigned long)p->instr, p->len); 372 (unsigned long)p->instr, p->len);
371 373
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index f9fff29e01a9..3d67ae18d762 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -1085,7 +1085,7 @@ static int __init detect_init_APIC (void)
1085 if (l & MSR_IA32_APICBASE_ENABLE) 1085 if (l & MSR_IA32_APICBASE_ENABLE)
1086 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; 1086 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
1087 1087
1088 if (nmi_watchdog != NMI_NONE) 1088 if (nmi_watchdog != NMI_NONE && nmi_watchdog != NMI_DISABLED)
1089 nmi_watchdog = NMI_LOCAL_APIC; 1089 nmi_watchdog = NMI_LOCAL_APIC;
1090 1090
1091 printk(KERN_INFO "Found and enabled local APIC!\n"); 1091 printk(KERN_INFO "Found and enabled local APIC!\n");
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 99beac7f96ce..8c1c965eb2a8 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -77,7 +77,7 @@ static int __init check_nmi_watchdog(void)
77 unsigned int *prev_nmi_count; 77 unsigned int *prev_nmi_count;
78 int cpu; 78 int cpu;
79 79
80 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 80 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED))
81 return 0; 81 return 0;
82 82
83 if (!atomic_read(&nmi_active)) 83 if (!atomic_read(&nmi_active))
@@ -424,7 +424,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
424 if (!!old_state == !!nmi_watchdog_enabled) 424 if (!!old_state == !!nmi_watchdog_enabled)
425 return 0; 425 return 0;
426 426
427 if (atomic_read(&nmi_active) < 0) { 427 if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) {
428 printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 428 printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
429 return -EIO; 429 return -EIO;
430 } 430 }
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index debd7dbb4158..a39280b4dd3a 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -292,7 +292,6 @@ static struct clocksource clocksource_tsc = {
292 292
293void mark_tsc_unstable(char *reason) 293void mark_tsc_unstable(char *reason)
294{ 294{
295 sched_clock_unstable_event();
296 if (!tsc_unstable) { 295 if (!tsc_unstable) {
297 tsc_unstable = 1; 296 tsc_unstable = 1;
298 tsc_enabled = 0; 297 tsc_enabled = 0;
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index 01ffdd4964f0..fcb38e7f3543 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -249,9 +249,10 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
249 pmd_k = pmd_offset(pud_k, address); 249 pmd_k = pmd_offset(pud_k, address);
250 if (!pmd_present(*pmd_k)) 250 if (!pmd_present(*pmd_k))
251 return NULL; 251 return NULL;
252 if (!pmd_present(*pmd)) 252 if (!pmd_present(*pmd)) {
253 set_pmd(pmd, *pmd_k); 253 set_pmd(pmd, *pmd_k);
254 else 254 arch_flush_lazy_mmu_mode();
255 } else
255 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); 256 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k));
256 return pmd_k; 257 return pmd_k;
257} 258}
diff --git a/arch/i386/xen/xen-head.S b/arch/i386/xen/xen-head.S
index bc71f3bc4014..f8d6937db2ec 100644
--- a/arch/i386/xen/xen-head.S
+++ b/arch/i386/xen/xen-head.S
@@ -7,20 +7,20 @@
7#include <asm/boot.h> 7#include <asm/boot.h>
8#include <xen/interface/elfnote.h> 8#include <xen/interface/elfnote.h>
9 9
10 .section .init.text 10.pushsection .init.text
11ENTRY(startup_xen) 11ENTRY(startup_xen)
12 movl %esi,xen_start_info 12 movl %esi,xen_start_info
13 cld 13 cld
14 movl $(init_thread_union+THREAD_SIZE),%esp 14 movl $(init_thread_union+THREAD_SIZE),%esp
15 jmp xen_start_kernel 15 jmp xen_start_kernel
16.popsection
16 17
17.pushsection ".bss.page_aligned" 18.pushsection .bss.page_aligned
18 .align PAGE_SIZE_asm 19 .align PAGE_SIZE_asm
19ENTRY(hypercall_page) 20ENTRY(hypercall_page)
20 .skip 0x1000 21 .skip 0x1000
21.popsection 22.popsection
22 23
23 .section .text
24 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") 24 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
25 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6") 25 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
26 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") 26 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 21aa4fc5f8ef..8c39913d1729 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -327,17 +327,7 @@ config FORCE_CPEI_RETARGET
327 This option it useful to enable this feature on older BIOS's as well. 327 This option it useful to enable this feature on older BIOS's as well.
328 You can also enable this by using boot command line option force_cpei=1. 328 You can also enable this by using boot command line option force_cpei=1.
329 329
330config PREEMPT 330source "kernel/Kconfig.preempt"
331 bool "Preemptible Kernel"
332 help
333 This option reduces the latency of the kernel when reacting to
334 real-time or interactive events by allowing a low priority process to
335 be preempted even if it is in kernel mode executing a system call.
336 This allows applications to run more reliably even when the system is
337 under load.
338
339 Say Y here if you are building a kernel for a desktop, embedded
340 or real-time system. Say N if you are unsure.
341 331
342source "mm/Kconfig" 332source "mm/Kconfig"
343 333
diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig
index 9eb48c0927b0..6dd8655664f3 100644
--- a/arch/ia64/configs/bigsur_defconfig
+++ b/arch/ia64/configs/bigsur_defconfig
@@ -42,7 +42,7 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0 42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0 43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0 44CONFIG_CC_ALIGN_JUMPS=0
45CONFIG_SLAB=y 45CONFIG_SLUB=y
46# CONFIG_TINY_SHMEM is not set 46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0 47CONFIG_BASE_SMALL=0
48# CONFIG_SLOB is not set 48# CONFIG_SLOB is not set
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig
index 3a9ed951db08..e86fbd39c795 100644
--- a/arch/ia64/configs/gensparse_defconfig
+++ b/arch/ia64/configs/gensparse_defconfig
@@ -43,7 +43,7 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0 43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLAB=y 46CONFIG_SLUB=y
47# CONFIG_TINY_SHMEM is not set 47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0 48CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set 49# CONFIG_SLOB is not set
diff --git a/arch/ia64/configs/sim_defconfig b/arch/ia64/configs/sim_defconfig
index c420d9f3df98..546a772f438e 100644
--- a/arch/ia64/configs/sim_defconfig
+++ b/arch/ia64/configs/sim_defconfig
@@ -43,7 +43,7 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0 43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLAB=y 46CONFIG_SLUB=y
47# CONFIG_TINY_SHMEM is not set 47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0 48CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set 49# CONFIG_SLOB is not set
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 4c9ffc47bc7a..9aecfceeb38c 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -46,7 +46,7 @@ CONFIG_BASE_FULL=y
46CONFIG_FUTEX=y 46CONFIG_FUTEX=y
47CONFIG_EPOLL=y 47CONFIG_EPOLL=y
48CONFIG_SHMEM=y 48CONFIG_SHMEM=y
49CONFIG_SLAB=y 49CONFIG_SLUB=y
50CONFIG_VM_EVENT_COUNTERS=y 50CONFIG_VM_EVENT_COUNTERS=y
51CONFIG_RT_MUTEXES=y 51CONFIG_RT_MUTEXES=y
52# CONFIG_TINY_SHMEM is not set 52# CONFIG_TINY_SHMEM is not set
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index 3dbb3987df27..797acf9066c1 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -53,7 +53,7 @@ CONFIG_TIMERFD=y
53CONFIG_EVENTFD=y 53CONFIG_EVENTFD=y
54CONFIG_SHMEM=y 54CONFIG_SHMEM=y
55CONFIG_VM_EVENT_COUNTERS=y 55CONFIG_VM_EVENT_COUNTERS=y
56CONFIG_SLAB=y 56CONFIG_SLUB=y
57# CONFIG_SLUB is not set 57# CONFIG_SLUB is not set
58# CONFIG_SLOB is not set 58# CONFIG_SLOB is not set
59CONFIG_RT_MUTEXES=y 59CONFIG_RT_MUTEXES=y
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 4a060fc39934..0a06b1333c95 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -48,7 +48,7 @@ CONFIG_BASE_FULL=y
48CONFIG_FUTEX=y 48CONFIG_FUTEX=y
49CONFIG_EPOLL=y 49CONFIG_EPOLL=y
50CONFIG_SHMEM=y 50CONFIG_SHMEM=y
51CONFIG_SLAB=y 51CONFIG_SLUB=y
52CONFIG_VM_EVENT_COUNTERS=y 52CONFIG_VM_EVENT_COUNTERS=y
53CONFIG_RT_MUTEXES=y 53CONFIG_RT_MUTEXES=y
54# CONFIG_TINY_SHMEM is not set 54# CONFIG_TINY_SHMEM is not set
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 03172dc8c403..0210545e7f61 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -53,8 +53,7 @@ CONFIG_TIMERFD=y
53CONFIG_EVENTFD=y 53CONFIG_EVENTFD=y
54CONFIG_SHMEM=y 54CONFIG_SHMEM=y
55CONFIG_VM_EVENT_COUNTERS=y 55CONFIG_VM_EVENT_COUNTERS=y
56CONFIG_SLAB=y 56CONFIG_SLUB=y
57# CONFIG_SLUB is not set
58# CONFIG_SLOB is not set 57# CONFIG_SLOB is not set
59CONFIG_RT_MUTEXES=y 58CONFIG_RT_MUTEXES=y
60# CONFIG_TINY_SHMEM is not set 59# CONFIG_TINY_SHMEM is not set
diff --git a/arch/ia64/hp/sim/boot/boot_head.S b/arch/ia64/hp/sim/boot/boot_head.S
index a9bd71ac78e2..8808565491fb 100644
--- a/arch/ia64/hp/sim/boot/boot_head.S
+++ b/arch/ia64/hp/sim/boot/boot_head.S
@@ -26,6 +26,7 @@ GLOBAL_ENTRY(_start)
26 movl sp = stack_mem+16384-16 26 movl sp = stack_mem+16384-16
27 bsw.1 27 bsw.1
28 br.call.sptk.many rp=start_bootloader 28 br.call.sptk.many rp=start_bootloader
290: nop 0 /* dummy nop to make unwinding work */
29END(_start) 30END(_start)
30 31
31/* 32/*
diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
index 15c08d52f09f..8c6ec7070844 100644
--- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
+++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
@@ -113,10 +113,8 @@ processor_get_freq (
113 113
114 saved_mask = current->cpus_allowed; 114 saved_mask = current->cpus_allowed;
115 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 115 set_cpus_allowed(current, cpumask_of_cpu(cpu));
116 if (smp_processor_id() != cpu) { 116 if (smp_processor_id() != cpu)
117 ret = -EAGAIN;
118 goto migrate_end; 117 goto migrate_end;
119 }
120 118
121 /* processor_get_pstate gets the instantaneous frequency */ 119 /* processor_get_pstate gets the instantaneous frequency */
122 ret = processor_get_pstate(&value); 120 ret = processor_get_pstate(&value);
@@ -125,7 +123,7 @@ processor_get_freq (
125 set_cpus_allowed(current, saved_mask); 123 set_cpus_allowed(current, saved_mask);
126 printk(KERN_WARNING "get performance failed with error %d\n", 124 printk(KERN_WARNING "get performance failed with error %d\n",
127 ret); 125 ret);
128 ret = -EAGAIN; 126 ret = 0;
129 goto migrate_end; 127 goto migrate_end;
130 } 128 }
131 clock_freq = extract_clock(data, value, cpu); 129 clock_freq = extract_clock(data, value, cpu);
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index cc3ee4ef37af..44be1c952b7c 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -33,6 +33,11 @@ void ack_bad_irq(unsigned int irq)
33} 33}
34 34
35#ifdef CONFIG_IA64_GENERIC 35#ifdef CONFIG_IA64_GENERIC
36ia64_vector __ia64_irq_to_vector(int irq)
37{
38 return irq_cfg[irq].vector;
39}
40
36unsigned int __ia64_local_vector_to_irq (ia64_vector vec) 41unsigned int __ia64_local_vector_to_irq (ia64_vector vec)
37{ 42{
38 return __get_cpu_var(vector_irq)[vec]; 43 return __get_cpu_var(vector_irq)[vec];
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index ff28620cb992..63b73f3d4c9f 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -2018,22 +2018,26 @@ ia64_mca_late_init(void)
2018 2018
2019 if (cpe_vector >= 0) { 2019 if (cpe_vector >= 0) {
2020 /* If platform supports CPEI, enable the irq. */ 2020 /* If platform supports CPEI, enable the irq. */
2021 cpe_poll_enabled = 0; 2021 irq = local_vector_to_irq(cpe_vector);
2022 for (irq = 0; irq < NR_IRQS; ++irq) 2022 if (irq > 0) {
2023 if (irq_to_vector(irq) == cpe_vector) { 2023 cpe_poll_enabled = 0;
2024 desc = irq_desc + irq; 2024 desc = irq_desc + irq;
2025 desc->status |= IRQ_PER_CPU; 2025 desc->status |= IRQ_PER_CPU;
2026 setup_irq(irq, &mca_cpe_irqaction); 2026 setup_irq(irq, &mca_cpe_irqaction);
2027 ia64_cpe_irq = irq; 2027 ia64_cpe_irq = irq;
2028 } 2028 ia64_mca_register_cpev(cpe_vector);
2029 ia64_mca_register_cpev(cpe_vector); 2029 IA64_MCA_DEBUG("%s: CPEI/P setup and enabled.\n",
2030 IA64_MCA_DEBUG("%s: CPEI/P setup and enabled.\n", __FUNCTION__); 2030 __FUNCTION__);
2031 } else { 2031 return 0;
2032 /* If platform doesn't support CPEI, get the timer going. */
2033 if (cpe_poll_enabled) {
2034 ia64_mca_cpe_poll(0UL);
2035 IA64_MCA_DEBUG("%s: CPEP setup and enabled.\n", __FUNCTION__);
2036 } 2032 }
2033 printk(KERN_ERR "%s: Failed to find irq for CPE "
2034 "interrupt handler, vector %d\n",
2035 __FUNCTION__, cpe_vector);
2036 }
2037 /* If platform doesn't support CPEI, get the timer going. */
2038 if (cpe_poll_enabled) {
2039 ia64_mca_cpe_poll(0UL);
2040 IA64_MCA_DEBUG("%s: CPEP setup and enabled.\n", __FUNCTION__);
2037 } 2041 }
2038 } 2042 }
2039#endif 2043#endif
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 4158906c45aa..c613fc0e91cc 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -198,9 +198,13 @@ default_idle (void)
198{ 198{
199 local_irq_enable(); 199 local_irq_enable();
200 while (!need_resched()) { 200 while (!need_resched()) {
201 if (can_do_pal_halt) 201 if (can_do_pal_halt) {
202 safe_halt(); 202 local_irq_disable();
203 else 203 if (!need_resched()) {
204 safe_halt();
205 }
206 local_irq_enable();
207 } else
204 cpu_relax(); 208 cpu_relax();
205 } 209 }
206} 210}
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 00f803246948..122444a97897 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -951,10 +951,14 @@ access_uarea (struct task_struct *child, unsigned long addr,
951 return 0; 951 return 0;
952 952
953 case PT_CR_IPSR: 953 case PT_CR_IPSR:
954 if (write_access) 954 if (write_access) {
955 pt->cr_ipsr = ((*data & IPSR_MASK) 955 unsigned long tmp = *data;
956 /* psr.ri==3 is a reserved value: SDM 2:25 */
957 if ((tmp & IA64_PSR_RI) == IA64_PSR_RI)
958 tmp &= ~IA64_PSR_RI;
959 pt->cr_ipsr = ((tmp & IPSR_MASK)
956 | (pt->cr_ipsr & ~IPSR_MASK)); 960 | (pt->cr_ipsr & ~IPSR_MASK));
957 else 961 } else
958 *data = (pt->cr_ipsr & IPSR_MASK); 962 *data = (pt->cr_ipsr & IPSR_MASK);
959 return 0; 963 return 0;
960 964
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index cd9a37a552c3..407efea04bf5 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -389,6 +389,13 @@ early_console_setup (char *cmdline)
389 if (!efi_setup_pcdp_console(cmdline)) 389 if (!efi_setup_pcdp_console(cmdline))
390 earlycons++; 390 earlycons++;
391#endif 391#endif
392#ifdef CONFIG_HP_SIMSERIAL_CONSOLE
393 {
394 extern struct console hpsim_cons;
395 register_console(&hpsim_cons);
396 earlycons++;
397 }
398#endif
392 399
393 return (earlycons) ? 0 : -1; 400 return (earlycons) ? 0 : -1;
394} 401}
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 83e80677de70..00232b4357ba 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -20,6 +20,8 @@ PHDRS {
20 code PT_LOAD; 20 code PT_LOAD;
21 percpu PT_LOAD; 21 percpu PT_LOAD;
22 data PT_LOAD; 22 data PT_LOAD;
23 note PT_NOTE;
24 unwind 0x70000001; /* PT_IA_64_UNWIND, but ld doesn't match the name */
23} 25}
24SECTIONS 26SECTIONS
25{ 27{
@@ -62,6 +64,9 @@ SECTIONS
62 64
63 /* Read-only data */ 65 /* Read-only data */
64 66
67 NOTES :code :note /* put .notes in text and mark in PT_NOTE */
68 code_continues : {} :code /* switch back to regular program... */
69
65 /* Exception table */ 70 /* Exception table */
66 . = ALIGN(16); 71 . = ALIGN(16);
67 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) 72 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET)
@@ -99,7 +104,8 @@ SECTIONS
99 __start_unwind = .; 104 __start_unwind = .;
100 *(.IA_64.unwind*) 105 *(.IA_64.unwind*)
101 __end_unwind = .; 106 __end_unwind = .;
102 } 107 } :code :unwind
108 code_continues2 : {} : code
103 109
104 RODATA 110 RODATA
105 111
@@ -276,10 +282,6 @@ SECTIONS
276 .debug_typenames 0 : { *(.debug_typenames) } 282 .debug_typenames 0 : { *(.debug_typenames) }
277 .debug_varnames 0 : { *(.debug_varnames) } 283 .debug_varnames 0 : { *(.debug_varnames) }
278 /* These must appear regardless of . */ 284 /* These must appear regardless of . */
279 /* Discard them for now since Intel SoftSDV cannot handle them.
280 .comment 0 : { *(.comment) }
281 .note 0 : { *(.note) }
282 */
283 /DISCARD/ : { *(.comment) } 285 /DISCARD/ : { *(.comment) }
284 /DISCARD/ : { *(.note) } 286 /DISCARD/ : { *(.note) }
285} 287}
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 73ccb6010c05..9150ffaff9e8 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -112,11 +112,17 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
112 down_read(&mm->mmap_sem); 112 down_read(&mm->mmap_sem);
113 113
114 vma = find_vma_prev(mm, address, &prev_vma); 114 vma = find_vma_prev(mm, address, &prev_vma);
115 if (!vma) 115 if (!vma && !prev_vma )
116 goto bad_area; 116 goto bad_area;
117 117
118 /* find_vma_prev() returns vma such that address < vma->vm_end or NULL */ 118 /*
119 if (address < vma->vm_start) 119 * find_vma_prev() returns vma such that address < vma->vm_end or NULL
120 *
121 * May find no vma, but could be that the last vm area is the
122 * register backing store that needs to expand upwards, in
123 * this case vma will be null, but prev_vma will ne non-null
124 */
125 if (( !vma && prev_vma ) || (address < vma->vm_start) )
120 goto check_expansion; 126 goto check_expansion;
121 127
122 good_area: 128 good_area:
@@ -172,6 +178,8 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
172 178
173 check_expansion: 179 check_expansion:
174 if (!(prev_vma && (prev_vma->vm_flags & VM_GROWSUP) && (address == prev_vma->vm_end))) { 180 if (!(prev_vma && (prev_vma->vm_flags & VM_GROWSUP) && (address == prev_vma->vm_end))) {
181 if (!vma)
182 goto bad_area;
175 if (!(vma->vm_flags & VM_GROWSDOWN)) 183 if (!(vma->vm_flags & VM_GROWSDOWN))
176 goto bad_area; 184 goto bad_area;
177 if (REGION_NUMBER(address) != REGION_NUMBER(vma->vm_start) 185 if (REGION_NUMBER(address) != REGION_NUMBER(vma->vm_start)
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 7f6d2360a262..360047389449 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -256,6 +256,13 @@ struct irq_chip irq_type_sn = {
256 .set_affinity = sn_set_affinity_irq 256 .set_affinity = sn_set_affinity_irq
257}; 257};
258 258
259ia64_vector sn_irq_to_vector(int irq)
260{
261 if (irq >= IA64_NUM_VECTORS)
262 return 0;
263 return (ia64_vector)irq;
264}
265
259unsigned int sn_local_vector_to_irq(u8 vector) 266unsigned int sn_local_vector_to_irq(u8 vector)
260{ 267{
261 return (CPU_VECTOR_TO_IRQ(smp_processor_id(), vector)); 268 return (CPU_VECTOR_TO_IRQ(smp_processor_id(), vector));
@@ -398,7 +405,10 @@ sn_call_force_intr_provider(struct sn_irq_info *sn_irq_info)
398 struct sn_pcibus_provider *pci_provider; 405 struct sn_pcibus_provider *pci_provider;
399 406
400 pci_provider = sn_pci_provider[sn_irq_info->irq_bridge_type]; 407 pci_provider = sn_pci_provider[sn_irq_info->irq_bridge_type];
401 if (pci_provider && pci_provider->force_interrupt) 408
409 /* Don't force an interrupt if the irq has been disabled */
410 if (!(irq_desc[sn_irq_info->irq_irq].status & IRQ_DISABLED) &&
411 pci_provider && pci_provider->force_interrupt)
402 (*pci_provider->force_interrupt)(sn_irq_info); 412 (*pci_provider->force_interrupt)(sn_irq_info);
403} 413}
404 414
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 7e6d5fb75390..ed3a4caec620 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -62,7 +62,6 @@ EXPORT_SYMBOL(m68k_num_memory);
62int m68k_realnum_memory; 62int m68k_realnum_memory;
63EXPORT_SYMBOL(m68k_realnum_memory); 63EXPORT_SYMBOL(m68k_realnum_memory);
64unsigned long m68k_memoffset; 64unsigned long m68k_memoffset;
65EXPORT_SYMBOL(m68k_memoffset);
66struct mem_info m68k_memory[NUM_MEMINFO]; 65struct mem_info m68k_memory[NUM_MEMINFO];
67EXPORT_SYMBOL(m68k_memory); 66EXPORT_SYMBOL(m68k_memory);
68 67
@@ -200,7 +199,6 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
200 (m68k_num_memory - 1)); 199 (m68k_num_memory - 1));
201 m68k_num_memory = 1; 200 m68k_num_memory = 1;
202 } 201 }
203 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET;
204#endif 202#endif
205} 203}
206 204
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index c42245775a4d..59fe285865ec 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -19,6 +19,8 @@ SECTIONS
19 *(.gnu.warning) 19 *(.gnu.warning)
20 } :text = 0x4e75 20 } :text = 0x4e75
21 21
22 _etext = .; /* End of text section */
23
22 . = ALIGN(16); /* Exception table */ 24 . = ALIGN(16); /* Exception table */
23 __start___ex_table = .; 25 __start___ex_table = .;
24 __ex_table : { *(__ex_table) } 26 __ex_table : { *(__ex_table) }
@@ -26,8 +28,6 @@ SECTIONS
26 28
27 RODATA 29 RODATA
28 30
29 _etext = .; /* End of text section */
30
31 .data : { /* Data */ 31 .data : { /* Data */
32 DATA_DATA 32 DATA_DATA
33 CONSTRUCTORS 33 CONSTRUCTORS
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 7d571a2b44dd..30d34f285024 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -210,11 +210,7 @@ void __init paging_init(void)
210 int i; 210 int i;
211 211
212#ifdef DEBUG 212#ifdef DEBUG
213 { 213 printk ("start of paging_init (%p, %lx)\n", kernel_pg_dir, availmem);
214 extern unsigned long availmem;
215 printk ("start of paging_init (%p, %lx)\n",
216 kernel_pg_dir, availmem);
217 }
218#endif 214#endif
219 215
220 /* Fix the cache mode in the page descriptors for the 680[46]0. */ 216 /* Fix the cache mode in the page descriptors for the 680[46]0. */
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 846f97534685..47502d5ec19f 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -28,6 +28,7 @@
28#include <linux/a.out.h> 28#include <linux/a.out.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/reboot.h> 30#include <linux/reboot.h>
31#include <linux/fs.h>
31 32
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/system.h> 34#include <asm/system.h>
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index 48e6b33e8b44..15d62c5279a9 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -18,6 +18,7 @@
18#include <linux/mman.h> 18#include <linux/mman.h>
19#include <linux/file.h> 19#include <linux/file.h>
20#include <linux/utsname.h> 20#include <linux/utsname.h>
21#include <linux/fs.h>
21 22
22#include <asm/setup.h> 23#include <asm/setup.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index 4680e2010887..3e79bf0a3159 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -44,8 +44,18 @@
44 #size-cells = <1>; 44 #size-cells = <1>;
45 #interrupt-cells = <2>; 45 #interrupt-cells = <2>;
46 device_type = "soc"; 46 device_type = "soc";
47 ranges = <0 e0000000 00100000>; 47
48 reg = <e0000000 00100000>; // CCSRBAR 1M 48
49 ranges = <00001000 e0001000 000ff000
50 80000000 80000000 20000000
51 a0000000 a0000000 10000000
52 b0000000 b0000000 00100000
53 c0000000 c0000000 20000000
54 b0100000 b0100000 00100000
55 e1000000 e1000000 00010000
56 e1010000 e1010000 00010000
57 e1020000 e1020000 00010000>;
58 reg = <e0000000 00001000>; // CCSRBAR 1M
49 bus-frequency = <0>; // Filled out by uboot. 59 bus-frequency = <0>; // Filled out by uboot.
50 60
51 memory-controller@2000 { 61 memory-controller@2000 {
@@ -161,8 +171,8 @@
161 interrupt-parent = <&mpic>; 171 interrupt-parent = <&mpic>;
162 interrupts = <18 2>; 172 interrupts = <18 2>;
163 bus-range = <0 ff>; 173 bus-range = <0 ff>;
164 ranges = <02000000 0 80000000 80000000 0 10000000 174 ranges = <02000000 0 c0000000 c0000000 0 20000000
165 01000000 0 00000000 e2000000 0 00800000>; 175 01000000 0 00000000 e1000000 0 00010000>;
166 clock-frequency = <3f940aa>; 176 clock-frequency = <3f940aa>;
167 #interrupt-cells = <1>; 177 #interrupt-cells = <1>;
168 #size-cells = <2>; 178 #size-cells = <2>;
@@ -178,8 +188,8 @@
178 #address-cells = <3>; 188 #address-cells = <3>;
179 reg = <9000 1000>; 189 reg = <9000 1000>;
180 bus-range = <0 ff>; 190 bus-range = <0 ff>;
181 ranges = <02000000 0 90000000 90000000 0 10000000 191 ranges = <02000000 0 80000000 80000000 0 20000000
182 01000000 0 00000000 e3000000 0 00800000>; 192 01000000 0 00000000 e1010000 0 00010000>;
183 clock-frequency = <1fca055>; 193 clock-frequency = <1fca055>;
184 interrupt-parent = <&mpic>; 194 interrupt-parent = <&mpic>;
185 interrupts = <1a 2>; 195 interrupts = <1a 2>;
@@ -202,7 +212,7 @@
202 reg = <a000 1000>; 212 reg = <a000 1000>;
203 bus-range = <0 ff>; 213 bus-range = <0 ff>;
204 ranges = <02000000 0 a0000000 a0000000 0 10000000 214 ranges = <02000000 0 a0000000 a0000000 0 10000000
205 01000000 0 00000000 e2800000 0 00800000>; 215 01000000 0 00000000 e1020000 0 00010000>;
206 clock-frequency = <1fca055>; 216 clock-frequency = <1fca055>;
207 interrupt-parent = <&mpic>; 217 interrupt-parent = <&mpic>;
208 interrupts = <19 2>; 218 interrupts = <19 2>;
@@ -224,49 +234,29 @@
224 #address-cells = <3>; 234 #address-cells = <3>;
225 reg = <b000 1000>; 235 reg = <b000 1000>;
226 bus-range = <0 ff>; 236 bus-range = <0 ff>;
227 ranges = <02000000 0 b0000000 b0000000 0 10000000 237 ranges = <02000000 0 b0000000 b0000000 0 00100000
228 01000000 0 00000000 e3800000 0 00800000>; 238 01000000 0 00000000 b0100000 0 00100000>;
229 clock-frequency = <1fca055>; 239 clock-frequency = <1fca055>;
230 interrupt-parent = <&mpic>; 240 interrupt-parent = <&mpic>;
231 interrupts = <1b 2>; 241 interrupts = <1b 2>;
232 interrupt-map-mask = <f800 0 0 7>; 242 interrupt-map-mask = <fb00 0 0 0>;
233 interrupt-map = < 243 interrupt-map = <
234
235 // IDSEL 0x1a
236 d000 0 0 1 &i8259 6 2
237 d000 0 0 2 &i8259 3 2
238 d000 0 0 3 &i8259 4 2
239 d000 0 0 4 &i8259 5 2
240
241 // IDSEL 0x1b
242 d800 0 0 1 &i8259 5 2
243 d800 0 0 2 &i8259 0 0
244 d800 0 0 3 &i8259 0 0
245 d800 0 0 4 &i8259 0 0
246
247 // IDSEL 0x1c USB 244 // IDSEL 0x1c USB
248 e000 0 0 1 &i8259 9 2 245 e000 0 0 0 &i8259 c 2
249 e000 0 0 2 &i8259 a 2 246 e100 0 0 0 &i8259 9 2
250 e000 0 0 3 &i8259 c 2 247 e200 0 0 0 &i8259 a 2
251 e000 0 0 4 &i8259 7 2 248 e300 0 0 0 &i8259 b 2
252 249
253 // IDSEL 0x1d Audio 250 // IDSEL 0x1d Audio
254 e800 0 0 1 &i8259 9 2 251 e800 0 0 0 &i8259 6 2
255 e800 0 0 2 &i8259 a 2
256 e800 0 0 3 &i8259 b 2
257 e800 0 0 4 &i8259 0 0
258 252
259 // IDSEL 0x1e Legacy 253 // IDSEL 0x1e Legacy
260 f000 0 0 1 &i8259 c 2 254 f000 0 0 0 &i8259 7 2
261 f000 0 0 2 &i8259 0 0 255 f100 0 0 0 &i8259 7 2
262 f000 0 0 3 &i8259 0 0
263 f000 0 0 4 &i8259 0 0
264 256
265 // IDSEL 0x1f IDE/SATA 257 // IDSEL 0x1f IDE/SATA
266 f800 0 0 1 &i8259 6 2 258 f800 0 0 0 &i8259 e 2
267 f800 0 0 2 &i8259 0 0 259 f900 0 0 0 &i8259 5 2
268 f800 0 0 3 &i8259 0 0
269 f800 0 0 4 &i8259 0 0
270 >; 260 >;
271 uli1575@0 { 261 uli1575@0 {
272 reg = <0 0 0 0 0>; 262 reg = <0 0 0 0 0>;
@@ -274,10 +264,10 @@
274 #address-cells = <3>; 264 #address-cells = <3>;
275 ranges = <02000000 0 b0000000 265 ranges = <02000000 0 b0000000
276 02000000 0 b0000000 266 02000000 0 b0000000
277 0 10000000 267 0 00100000
278 01000000 0 00000000 268 01000000 0 00000000
279 01000000 0 00000000 269 01000000 0 00000000
280 0 00080000>; 270 0 00100000>;
281 271
282 pci_bridge@0 { 272 pci_bridge@0 {
283 reg = <0 0 0 0 0>; 273 reg = <0 0 0 0 0>;
@@ -285,10 +275,10 @@
285 #address-cells = <3>; 275 #address-cells = <3>;
286 ranges = <02000000 0 b0000000 276 ranges = <02000000 0 b0000000
287 02000000 0 b0000000 277 02000000 0 b0000000
288 0 20000000 278 0 00100000
289 01000000 0 00000000 279 01000000 0 00000000
290 01000000 0 00000000 280 01000000 0 00000000
291 0 00100000>; 281 0 00100000>;
292 282
293 isa@1e { 283 isa@1e {
294 device_type = "isa"; 284 device_type = "isa";
@@ -296,7 +286,8 @@
296 #size-cells = <1>; 286 #size-cells = <1>;
297 #address-cells = <2>; 287 #address-cells = <2>;
298 reg = <f000 0 0 0 0>; 288 reg = <f000 0 0 0 0>;
299 ranges = <1 0 01000000 0 0 289 ranges = <1 0
290 01000000 0 0
300 00001000>; 291 00001000>;
301 interrupt-parent = <&i8259>; 292 interrupt-parent = <&i8259>;
302 293
@@ -312,8 +303,7 @@
312 built-in; 303 built-in;
313 compatible = "chrp,iic"; 304 compatible = "chrp,iic";
314 interrupts = <9 2>; 305 interrupts = <9 2>;
315 interrupt-parent = 306 interrupt-parent = <&mpic>;
316 <&mpic>;
317 }; 307 };
318 308
319 i8042@60 { 309 i8042@60 {
@@ -321,8 +311,7 @@
321 #address-cells = <1>; 311 #address-cells = <1>;
322 reg = <1 60 1 1 64 1>; 312 reg = <1 60 1 1 64 1>;
323 interrupts = <1 3 c 3>; 313 interrupts = <1 3 c 3>;
324 interrupt-parent = 314 interrupt-parent = <&i8259>;
325 <&i8259>;
326 315
327 keyboard@0 { 316 keyboard@0 {
328 reg = <0>; 317 reg = <0>;
@@ -336,8 +325,7 @@
336 }; 325 };
337 326
338 rtc@70 { 327 rtc@70 {
339 compatible = 328 compatible = "pnpPNP,b00";
340 "pnpPNP,b00";
341 reg = <1 70 2>; 329 reg = <1 70 2>;
342 }; 330 };
343 331
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
index 5d82709cfcbb..b0166e5c177e 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -224,98 +224,36 @@
224 clock-frequency = <1fca055>; 224 clock-frequency = <1fca055>;
225 interrupt-parent = <&mpic>; 225 interrupt-parent = <&mpic>;
226 interrupts = <18 2>; 226 interrupts = <18 2>;
227 interrupt-map-mask = <f800 0 0 7>; 227 interrupt-map-mask = <fb00 0 0 0>;
228 interrupt-map = < 228 interrupt-map = <
229 /* IDSEL 0x11 */ 229 /* IDSEL 0x11 */
230 8800 0 0 1 &i8259 3 2 230 8800 0 0 1 &i8259 9 2
231 8800 0 0 2 &i8259 4 2 231 8800 0 0 2 &i8259 a 2
232 8800 0 0 3 &i8259 5 2 232 8800 0 0 3 &i8259 b 2
233 8800 0 0 4 &i8259 6 2 233 8800 0 0 4 &i8259 c 2
234 234
235 /* IDSEL 0x12 */ 235 /* IDSEL 0x12 */
236 9000 0 0 1 &i8259 4 2 236 9000 0 0 1 &i8259 a 2
237 9000 0 0 2 &i8259 5 2 237 9000 0 0 2 &i8259 b 2
238 9000 0 0 3 &i8259 6 2 238 9000 0 0 3 &i8259 c 2
239 9000 0 0 4 &i8259 3 2 239 9000 0 0 4 &i8259 9 2
240 240
241 /* IDSEL 0x13 */ 241 // IDSEL 0x1c USB
242 9800 0 0 1 &i8259 0 0 242 e000 0 0 0 &i8259 c 2
243 9800 0 0 2 &i8259 0 0 243 e100 0 0 0 &i8259 9 2
244 9800 0 0 3 &i8259 0 0 244 e200 0 0 0 &i8259 a 2
245 9800 0 0 4 &i8259 0 0 245 e300 0 0 0 &i8259 b 2
246 246
247 /* IDSEL 0x14 */ 247 // IDSEL 0x1d Audio
248 a000 0 0 1 &i8259 0 0 248 e800 0 0 0 &i8259 6 2
249 a000 0 0 2 &i8259 0 0 249
250 a000 0 0 3 &i8259 0 0 250 // IDSEL 0x1e Legacy
251 a000 0 0 4 &i8259 0 0 251 f000 0 0 0 &i8259 7 2
252 252 f100 0 0 0 &i8259 7 2
253 /* IDSEL 0x15 */ 253
254 a800 0 0 1 &i8259 0 0 254 // IDSEL 0x1f IDE/SATA
255 a800 0 0 2 &i8259 0 0 255 f800 0 0 0 &i8259 e 2
256 a800 0 0 3 &i8259 0 0 256 f900 0 0 0 &i8259 5 2
257 a800 0 0 4 &i8259 0 0
258
259 /* IDSEL 0x16 */
260 b000 0 0 1 &i8259 0 0
261 b000 0 0 2 &i8259 0 0
262 b000 0 0 3 &i8259 0 0
263 b000 0 0 4 &i8259 0 0
264
265 /* IDSEL 0x17 */
266 b800 0 0 1 &i8259 0 0
267 b800 0 0 2 &i8259 0 0
268 b800 0 0 3 &i8259 0 0
269 b800 0 0 4 &i8259 0 0
270
271 /* IDSEL 0x18 */
272 c000 0 0 1 &i8259 0 0
273 c000 0 0 2 &i8259 0 0
274 c000 0 0 3 &i8259 0 0
275 c000 0 0 4 &i8259 0 0
276
277 /* IDSEL 0x19 */
278 c800 0 0 1 &i8259 0 0
279 c800 0 0 2 &i8259 0 0
280 c800 0 0 3 &i8259 0 0
281 c800 0 0 4 &i8259 0 0
282
283 /* IDSEL 0x1a */
284 d000 0 0 1 &i8259 6 2
285 d000 0 0 2 &i8259 3 2
286 d000 0 0 3 &i8259 4 2
287 d000 0 0 4 &i8259 5 2
288
289
290 /* IDSEL 0x1b */
291 d800 0 0 1 &i8259 5 2
292 d800 0 0 2 &i8259 0 0
293 d800 0 0 3 &i8259 0 0
294 d800 0 0 4 &i8259 0 0
295
296 /* IDSEL 0x1c */
297 e000 0 0 1 &i8259 9 2
298 e000 0 0 2 &i8259 a 2
299 e000 0 0 3 &i8259 c 2
300 e000 0 0 4 &i8259 7 2
301
302 /* IDSEL 0x1d */
303 e800 0 0 1 &i8259 9 2
304 e800 0 0 2 &i8259 a 2
305 e800 0 0 3 &i8259 b 2
306 e800 0 0 4 &i8259 0 0
307
308 /* IDSEL 0x1e */
309 f000 0 0 1 &i8259 c 2
310 f000 0 0 2 &i8259 0 0
311 f000 0 0 3 &i8259 0 0
312 f000 0 0 4 &i8259 0 0
313
314 /* IDSEL 0x1f */
315 f800 0 0 1 &i8259 6 2
316 f800 0 0 2 &i8259 0 0
317 f800 0 0 3 &i8259 0 0
318 f800 0 0 4 &i8259 0 0
319 >; 257 >;
320 uli1575@0 { 258 uli1575@0 {
321 reg = <0 0 0 0 0>; 259 reg = <0 0 0 0 0>;
diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index b732644788db..13761bf160c4 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -134,20 +134,6 @@ static char *ft_next(struct ft_cxt *cxt, char *p, struct ft_atom *ret)
134#define HDR_SIZE _ALIGN(sizeof(struct boot_param_header), 8) 134#define HDR_SIZE _ALIGN(sizeof(struct boot_param_header), 8)
135#define EXPAND_INCR 1024 /* alloc this much extra when expanding */ 135#define EXPAND_INCR 1024 /* alloc this much extra when expanding */
136 136
137/* See if the regions are in the standard order and non-overlapping */
138static int ft_ordered(struct ft_cxt *cxt)
139{
140 char *p = (char *)cxt->bph + HDR_SIZE;
141 enum ft_rgn_id r;
142
143 for (r = FT_RSVMAP; r <= FT_STRINGS; ++r) {
144 if (p > cxt->rgn[r].start)
145 return 0;
146 p = cxt->rgn[r].start + cxt->rgn[r].size;
147 }
148 return p <= (char *)cxt->bph + cxt->max_size;
149}
150
151/* Copy the tree to a newly-allocated region and put things in order */ 137/* Copy the tree to a newly-allocated region and put things in order */
152static int ft_reorder(struct ft_cxt *cxt, int nextra) 138static int ft_reorder(struct ft_cxt *cxt, int nextra)
153{ 139{
@@ -573,10 +559,6 @@ int ft_open(struct ft_cxt *cxt, void *blob, unsigned int max_size,
573 cxt->rgn[FT_STRUCT].size = struct_size(cxt); 559 cxt->rgn[FT_STRUCT].size = struct_size(cxt);
574 cxt->rgn[FT_STRINGS].start = blob + be32_to_cpu(bph->off_dt_strings); 560 cxt->rgn[FT_STRINGS].start = blob + be32_to_cpu(bph->off_dt_strings);
575 cxt->rgn[FT_STRINGS].size = be32_to_cpu(bph->dt_strings_size); 561 cxt->rgn[FT_STRINGS].size = be32_to_cpu(bph->dt_strings_size);
576 /* Leave as '0' to force first ft_make_space call to do a ft_reorder
577 * and move dt to an area allocated by realloc.
578 cxt->isordered = ft_ordered(cxt);
579 */
580 562
581 cxt->p = cxt->rgn[FT_STRUCT].start; 563 cxt->p = cxt->rgn[FT_STRUCT].start;
582 cxt->str_anchor = cxt->rgn[FT_STRINGS].start; 564 cxt->str_anchor = cxt->rgn[FT_STRINGS].start;
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index f39a72f30aad..b0cb2e662c25 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -81,6 +81,7 @@ obj-y += iomap.o
81endif 81endif
82 82
83ifeq ($(CONFIG_PPC_ISERIES),y) 83ifeq ($(CONFIG_PPC_ISERIES),y)
84CFLAGS_lparmap.s += -g0
84extra-y += lparmap.s 85extra-y += lparmap.s
85$(obj)/head_64.o: $(obj)/lparmap.s 86$(obj)/head_64.o: $(obj)/lparmap.s
86AFLAGS_head_64.o += -I$(obj) 87AFLAGS_head_64.o += -I$(obj)
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index e708ab7ca9e8..8533de50347d 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -301,9 +301,19 @@ _GLOBAL(_tlbie)
301 mfspr r4,SPRN_MMUCR 301 mfspr r4,SPRN_MMUCR
302 mfspr r5,SPRN_PID /* Get PID */ 302 mfspr r5,SPRN_PID /* Get PID */
303 rlwimi r4,r5,0,24,31 /* Set TID */ 303 rlwimi r4,r5,0,24,31 /* Set TID */
304 mtspr SPRN_MMUCR,r4
305 304
305 /* We have to run the search with interrupts disabled, even critical
306 * and debug interrupts (in fact the only critical exceptions we have
307 * are debug and machine check). Otherwise an interrupt which causes
308 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
309 mfmsr r5
310 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
311 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
312 andc r6,r5,r6
313 mtmsr r6
314 mtspr SPRN_MMUCR,r4
306 tlbsx. r3, 0, r3 315 tlbsx. r3, 0, r3
316 mtmsr r5
307 bne 10f 317 bne 10f
308 sync 318 sync
309 /* There are only 64 TLB entries, so r3 < 64, 319 /* There are only 64 TLB entries, so r3 < 64,
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 2bb1cb911783..d8502e377518 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -299,7 +299,7 @@ static inline int check_io_access(struct pt_regs *regs)
299#ifndef CONFIG_FSL_BOOKE 299#ifndef CONFIG_FSL_BOOKE
300#define get_mc_reason(regs) ((regs)->dsisr) 300#define get_mc_reason(regs) ((regs)->dsisr)
301#else 301#else
302#define get_mc_reason(regs) (mfspr(SPRN_MCSR)) 302#define get_mc_reason(regs) (mfspr(SPRN_MCSR) & MCSR_MASK)
303#endif 303#endif
304#define REASON_FP ESR_FP 304#define REASON_FP ESR_FP
305#define REASON_ILLEGAL (ESR_PIL | ESR_PUO) 305#define REASON_ILLEGAL (ESR_PIL | ESR_PUO)
@@ -414,8 +414,6 @@ void machine_check_exception(struct pt_regs *regs)
414 printk("Data Cache Push Parity Error\n"); 414 printk("Data Cache Push Parity Error\n");
415 if (reason & MCSR_DCPERR) 415 if (reason & MCSR_DCPERR)
416 printk("Data Cache Parity Error\n"); 416 printk("Data Cache Parity Error\n");
417 if (reason & MCSR_GL_CI)
418 printk("Guarded Load or Cache-Inhibited stwcx.\n");
419 if (reason & MCSR_BUS_IAERR) 417 if (reason & MCSR_BUS_IAERR)
420 printk("Bus - Instruction Address Error\n"); 418 printk("Bus - Instruction Address Error\n");
421 if (reason & MCSR_BUS_RAERR) 419 if (reason & MCSR_BUS_RAERR)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index f1789578747a..a47151e806ca 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -795,7 +795,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
795 795
796#ifdef CONFIG_PPC_MM_SLICES 796#ifdef CONFIG_PPC_MM_SLICES
797 /* We only prefault standard pages for now */ 797 /* We only prefault standard pages for now */
798 if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize)); 798 if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize))
799 return; 799 return;
800#endif 800#endif
801 801
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index f58184086c8c..f620171ad6b1 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -33,6 +33,7 @@ config MPC8544_DS
33 bool "Freescale MPC8544 DS" 33 bool "Freescale MPC8544 DS"
34 select PPC_I8259 34 select PPC_I8259
35 select DEFAULT_UIMAGE 35 select DEFAULT_UIMAGE
36 select FSL_ULI1575
36 help 37 help
37 This option enables support for the MPC8544 DS board 38 This option enables support for the MPC8544 DS board
38 39
diff --git a/arch/powerpc/platforms/85xx/mpc8544_ds.c b/arch/powerpc/platforms/85xx/mpc8544_ds.c
index 4905f6f8903b..0f834d8be444 100644
--- a/arch/powerpc/platforms/85xx/mpc8544_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8544_ds.c
@@ -114,211 +114,25 @@ void __init mpc8544_ds_pic_init(void)
114} 114}
115 115
116#ifdef CONFIG_PCI 116#ifdef CONFIG_PCI
117enum pirq { PIRQA = 8, PIRQB, PIRQC, PIRQD, PIRQE, PIRQF, PIRQG, PIRQH }; 117extern int uses_fsl_uli_m1575;
118extern int uli_exclude_device(struct pci_controller *hose,
119 u_char bus, u_char devfn);
118 120
119/* 121static int mpc85xx_exclude_device(struct pci_controller *hose,
120 * Value in table -- IRQ number 122 u_char bus, u_char devfn)
121 */
122const unsigned char uli1575_irq_route_table[16] = {
123 0, /* 0: Reserved */
124 0x8,
125 0, /* 2: Reserved */
126 0x2,
127 0x4,
128 0x5,
129 0x7,
130 0x6,
131 0, /* 8: Reserved */
132 0x1,
133 0x3,
134 0x9,
135 0xb,
136 0, /* 13: Reserved */
137 0xd,
138 0xf,
139};
140
141static int __devinit
142get_pci_irq_from_of(struct pci_controller *hose, int slot, int pin)
143{
144 struct of_irq oirq;
145 u32 laddr[3];
146 struct device_node *hosenode = hose ? hose->arch_data : NULL;
147
148 if (!hosenode)
149 return -EINVAL;
150
151 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(slot, 0) << 8);
152 laddr[1] = laddr[2] = 0;
153 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq);
154 DBG("mpc8544_ds: pci irq addr %x, slot %d, pin %d, irq %d\n",
155 laddr[0], slot, pin, oirq.specifier[0]);
156 return oirq.specifier[0];
157}
158
159/*8259*/
160static void __devinit quirk_uli1575(struct pci_dev *dev)
161{
162 unsigned short temp;
163 struct pci_controller *hose = pci_bus_to_host(dev->bus);
164 unsigned char irq2pin[16];
165 unsigned long pirq_map_word = 0;
166 u32 irq;
167 int i;
168
169 /*
170 * ULI1575 interrupts route setup
171 */
172 memset(irq2pin, 0, 16); /* Initialize default value 0 */
173
174 irq2pin[6]=PIRQA+3; /* enabled mapping for IRQ6 to PIRQD, used by SATA */
175
176 /*
177 * PIRQE -> PIRQF mapping set manually
178 *
179 * IRQ pin IRQ#
180 * PIRQE ---- 9
181 * PIRQF ---- 10
182 * PIRQG ---- 11
183 * PIRQH ---- 12
184 */
185 for (i = 0; i < 4; i++)
186 irq2pin[i + 9] = PIRQE + i;
187
188 /* Set IRQ-PIRQ Mapping to ULI1575 */
189 for (i = 0; i < 16; i++)
190 if (irq2pin[i])
191 pirq_map_word |= (uli1575_irq_route_table[i] & 0xf)
192 << ((irq2pin[i] - PIRQA) * 4);
193
194 pirq_map_word |= 1<<26; /* disable INTx in EP mode*/
195
196 /* ULI1575 IRQ mapping conf register default value is 0xb9317542 */
197 DBG("Setup ULI1575 IRQ mapping configuration register value = 0x%x\n",
198 (int)pirq_map_word);
199 pci_write_config_dword(dev, 0x48, pirq_map_word);
200
201#define ULI1575_SET_DEV_IRQ(slot, pin, reg) \
202 do { \
203 int irq; \
204 irq = get_pci_irq_from_of(hose, slot, pin); \
205 if (irq > 0 && irq < 16) \
206 pci_write_config_byte(dev, reg, irq2pin[irq]); \
207 else \
208 printk(KERN_WARNING "ULI1575 device" \
209 "(slot %d, pin %d) irq %d is invalid.\n", \
210 slot, pin, irq); \
211 } while(0)
212
213 /* USB 1.1 OHCI controller 1, slot 28, pin 1 */
214 ULI1575_SET_DEV_IRQ(28, 1, 0x86);
215
216 /* USB 1.1 OHCI controller 2, slot 28, pin 2 */
217 ULI1575_SET_DEV_IRQ(28, 2, 0x87);
218
219 /* USB 1.1 OHCI controller 3, slot 28, pin 3 */
220 ULI1575_SET_DEV_IRQ(28, 3, 0x88);
221
222 /* USB 2.0 controller, slot 28, pin 4 */
223 irq = get_pci_irq_from_of(hose, 28, 4);
224 if (irq >= 0 && irq <= 15)
225 pci_write_config_dword(dev, 0x74, uli1575_irq_route_table[irq]);
226
227 /* Audio controller, slot 29, pin 1 */
228 ULI1575_SET_DEV_IRQ(29, 1, 0x8a);
229
230 /* Modem controller, slot 29, pin 2 */
231 ULI1575_SET_DEV_IRQ(29, 2, 0x8b);
232
233 /* HD audio controller, slot 29, pin 3 */
234 ULI1575_SET_DEV_IRQ(29, 3, 0x8c);
235
236 /* SMB interrupt: slot 30, pin 1 */
237 ULI1575_SET_DEV_IRQ(30, 1, 0x8e);
238
239 /* PMU ACPI SCI interrupt: slot 30, pin 2 */
240 ULI1575_SET_DEV_IRQ(30, 2, 0x8f);
241
242 /* Serial ATA interrupt: slot 31, pin 1 */
243 ULI1575_SET_DEV_IRQ(31, 1, 0x8d);
244
245 /* Primary PATA IDE IRQ: 14
246 * Secondary PATA IDE IRQ: 15
247 */
248 pci_write_config_byte(dev, 0x44, 0x30 | uli1575_irq_route_table[14]);
249 pci_write_config_byte(dev, 0x75, uli1575_irq_route_table[15]);
250
251 /* Set IRQ14 and IRQ15 to legacy IRQs */
252 pci_read_config_word(dev, 0x46, &temp);
253 temp |= 0xc000;
254 pci_write_config_word(dev, 0x46, temp);
255
256 /* Set i8259 interrupt trigger
257 * IRQ 3: Level
258 * IRQ 4: Level
259 * IRQ 5: Level
260 * IRQ 6: Level
261 * IRQ 7: Level
262 * IRQ 9: Level
263 * IRQ 10: Level
264 * IRQ 11: Level
265 * IRQ 12: Level
266 * IRQ 14: Edge
267 * IRQ 15: Edge
268 */
269 outb(0xfa, 0x4d0);
270 outb(0x1e, 0x4d1);
271
272#undef ULI1575_SET_DEV_IRQ
273}
274
275/* SATA */
276static void __devinit quirk_uli5288(struct pci_dev *dev)
277{ 123{
278 unsigned char c; 124 struct device_node* node;
279 125 struct resource rsrc;
280 pci_read_config_byte(dev, 0x83, &c);
281 c |= 0x80; /* read/write lock */
282 pci_write_config_byte(dev, 0x83, c);
283
284 pci_write_config_byte(dev, 0x09, 0x01); /* Base class code: storage */
285 pci_write_config_byte(dev, 0x0a, 0x06); /* IDE disk */
286 126
287 pci_read_config_byte(dev, 0x83, &c); 127 node = (struct device_node *)hose->arch_data;
288 c &= 0x7f; 128 of_address_to_resource(node, 0, &rsrc);
289 pci_write_config_byte(dev, 0x83, c);
290
291 pci_read_config_byte(dev, 0x84, &c);
292 c |= 0x01; /* emulated PATA mode enabled */
293 pci_write_config_byte(dev, 0x84, c);
294}
295 129
296/* PATA */ 130 if ((rsrc.start & 0xfffff) == 0xb000) {
297static void __devinit quirk_uli5229(struct pci_dev *dev) 131 return uli_exclude_device(hose, bus, devfn);
298{ 132 }
299 unsigned short temp;
300 pci_write_config_word(dev, 0x04, 0x0405); /* MEM IO MSI */
301 pci_read_config_word(dev, 0x4a, &temp);
302 temp |= 0x1000; /* Enable Native IRQ 14/15 */
303 pci_write_config_word(dev, 0x4a, temp);
304}
305 133
306/*Bridge*/ 134 return PCIBIOS_SUCCESSFUL;
307static void __devinit early_uli5249(struct pci_dev *dev)
308{
309 unsigned char temp;
310 pci_write_config_word(dev, 0x04, 0x0007); /* mem access */
311 pci_read_config_byte(dev, 0x7c, &temp);
312 pci_write_config_byte(dev, 0x7c, 0x80); /* R/W lock control */
313 pci_write_config_byte(dev, 0x09, 0x01); /* set as pci-pci bridge */
314 pci_write_config_byte(dev, 0x7c, temp); /* restore pci bus debug control */
315 dev->class |= 0x1;
316} 135}
317
318DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
319DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
320DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
321DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
322#endif /* CONFIG_PCI */ 136#endif /* CONFIG_PCI */
323 137
324/* 138/*
@@ -342,6 +156,8 @@ static void __init mpc8544_ds_setup_arch(void)
342 else 156 else
343 fsl_add_bridge(np, 0); 157 fsl_add_bridge(np, 0);
344 } 158 }
159 uses_fsl_uli_m1575 = 1;
160 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
345#endif 161#endif
346 162
347 printk("MPC8544 DS board from Freescale Semiconductor\n"); 163 printk("MPC8544 DS board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 343b76d0d793..685b2fbbbe00 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -7,6 +7,7 @@ config MPC8641_HPCN
7 bool "Freescale MPC8641 HPCN" 7 bool "Freescale MPC8641 HPCN"
8 select PPC_I8259 8 select PPC_I8259
9 select DEFAULT_UIMAGE 9 select DEFAULT_UIMAGE
10 select FSL_ULI1575
10 help 11 help
11 This option enables support for the MPC8641 HPCN board. 12 This option enables support for the MPC8641 HPCN board.
12 13
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index e9eaa0749ae6..56b27caf7a27 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -107,220 +107,25 @@ mpc86xx_hpcn_init_irq(void)
107} 107}
108 108
109#ifdef CONFIG_PCI 109#ifdef CONFIG_PCI
110extern int uses_fsl_uli_m1575;
111extern int uli_exclude_device(struct pci_controller *hose,
112 u_char bus, u_char devfn);
110 113
111enum pirq{PIRQA = 8, PIRQB, PIRQC, PIRQD, PIRQE, PIRQF, PIRQG, PIRQH}; 114static int mpc86xx_exclude_device(struct pci_controller *hose,
112const unsigned char uli1575_irq_route_table[16] = { 115 u_char bus, u_char devfn)
113 0, /* 0: Reserved */
114 0x8, /* 1: 0b1000 */
115 0, /* 2: Reserved */
116 0x2, /* 3: 0b0010 */
117 0x4, /* 4: 0b0100 */
118 0x5, /* 5: 0b0101 */
119 0x7, /* 6: 0b0111 */
120 0x6, /* 7: 0b0110 */
121 0, /* 8: Reserved */
122 0x1, /* 9: 0b0001 */
123 0x3, /* 10: 0b0011 */
124 0x9, /* 11: 0b1001 */
125 0xb, /* 12: 0b1011 */
126 0, /* 13: Reserved */
127 0xd, /* 14, 0b1101 */
128 0xf, /* 15, 0b1111 */
129};
130
131static int __devinit
132get_pci_irq_from_of(struct pci_controller *hose, int slot, int pin)
133{
134 struct of_irq oirq;
135 u32 laddr[3];
136 struct device_node *hosenode = hose ? hose->arch_data : NULL;
137
138 if (!hosenode) return -EINVAL;
139
140 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(slot, 0) << 8);
141 laddr[1] = laddr[2] = 0;
142 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq);
143 DBG("mpc86xx_hpcn: pci irq addr %x, slot %d, pin %d, irq %d\n",
144 laddr[0], slot, pin, oirq.specifier[0]);
145 return oirq.specifier[0];
146}
147
148static void __devinit quirk_uli1575(struct pci_dev *dev)
149{
150 unsigned short temp;
151 struct pci_controller *hose = pci_bus_to_host(dev->bus);
152 unsigned char irq2pin[16], c;
153 unsigned long pirq_map_word = 0;
154 u32 irq;
155 int i;
156
157 /*
158 * ULI1575 interrupts route setup
159 */
160 memset(irq2pin, 0, 16); /* Initialize default value 0 */
161
162 /*
163 * PIRQA -> PIRQD mapping read from OF-tree
164 *
165 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
166 * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
167 */
168 for (i = 0; i < 4; i++){
169 irq = get_pci_irq_from_of(hose, 17, i + 1);
170 if (irq > 0 && irq < 16)
171 irq2pin[irq] = PIRQA + i;
172 else
173 printk(KERN_WARNING "ULI1575 device"
174 "(slot %d, pin %d) irq %d is invalid.\n",
175 17, i, irq);
176 }
177
178 /*
179 * PIRQE -> PIRQF mapping set manually
180 *
181 * IRQ pin IRQ#
182 * PIRQE ---- 9
183 * PIRQF ---- 10
184 * PIRQG ---- 11
185 * PIRQH ---- 12
186 */
187 for (i = 0; i < 4; i++) irq2pin[i + 9] = PIRQE + i;
188
189 /* Set IRQ-PIRQ Mapping to ULI1575 */
190 for (i = 0; i < 16; i++)
191 if (irq2pin[i])
192 pirq_map_word |= (uli1575_irq_route_table[i] & 0xf)
193 << ((irq2pin[i] - PIRQA) * 4);
194
195 /* ULI1575 IRQ mapping conf register default value is 0xb9317542 */
196 DBG("Setup ULI1575 IRQ mapping configuration register value = 0x%x\n",
197 pirq_map_word);
198 pci_write_config_dword(dev, 0x48, pirq_map_word);
199
200#define ULI1575_SET_DEV_IRQ(slot, pin, reg) \
201 do { \
202 int irq; \
203 irq = get_pci_irq_from_of(hose, slot, pin); \
204 if (irq > 0 && irq < 16) \
205 pci_write_config_byte(dev, reg, irq2pin[irq]); \
206 else \
207 printk(KERN_WARNING "ULI1575 device" \
208 "(slot %d, pin %d) irq %d is invalid.\n", \
209 slot, pin, irq); \
210 } while(0)
211
212 /* USB 1.1 OHCI controller 1, slot 28, pin 1 */
213 ULI1575_SET_DEV_IRQ(28, 1, 0x86);
214
215 /* USB 1.1 OHCI controller 2, slot 28, pin 2 */
216 ULI1575_SET_DEV_IRQ(28, 2, 0x87);
217
218 /* USB 1.1 OHCI controller 3, slot 28, pin 3 */
219 ULI1575_SET_DEV_IRQ(28, 3, 0x88);
220
221 /* USB 2.0 controller, slot 28, pin 4 */
222 irq = get_pci_irq_from_of(hose, 28, 4);
223 if (irq >= 0 && irq <=15)
224 pci_write_config_dword(dev, 0x74, uli1575_irq_route_table[irq]);
225
226 /* Audio controller, slot 29, pin 1 */
227 ULI1575_SET_DEV_IRQ(29, 1, 0x8a);
228
229 /* Modem controller, slot 29, pin 2 */
230 ULI1575_SET_DEV_IRQ(29, 2, 0x8b);
231
232 /* HD audio controller, slot 29, pin 3 */
233 ULI1575_SET_DEV_IRQ(29, 3, 0x8c);
234
235 /* SMB interrupt: slot 30, pin 1 */
236 ULI1575_SET_DEV_IRQ(30, 1, 0x8e);
237
238 /* PMU ACPI SCI interrupt: slot 30, pin 2 */
239 ULI1575_SET_DEV_IRQ(30, 2, 0x8f);
240
241 /* Serial ATA interrupt: slot 31, pin 1 */
242 ULI1575_SET_DEV_IRQ(31, 1, 0x8d);
243
244 /* Primary PATA IDE IRQ: 14
245 * Secondary PATA IDE IRQ: 15
246 */
247 pci_write_config_byte(dev, 0x44, 0x30 | uli1575_irq_route_table[14]);
248 pci_write_config_byte(dev, 0x75, uli1575_irq_route_table[15]);
249
250 /* Set IRQ14 and IRQ15 to legacy IRQs */
251 pci_read_config_word(dev, 0x46, &temp);
252 temp |= 0xc000;
253 pci_write_config_word(dev, 0x46, temp);
254
255 /* Set i8259 interrupt trigger
256 * IRQ 3: Level
257 * IRQ 4: Level
258 * IRQ 5: Level
259 * IRQ 6: Level
260 * IRQ 7: Level
261 * IRQ 9: Level
262 * IRQ 10: Level
263 * IRQ 11: Level
264 * IRQ 12: Level
265 * IRQ 14: Edge
266 * IRQ 15: Edge
267 */
268 outb(0xfa, 0x4d0);
269 outb(0x1e, 0x4d1);
270
271#undef ULI1575_SET_DEV_IRQ
272
273 /* Disable the HD interface and enable the AC97 interface. */
274 pci_read_config_byte(dev, 0xb8, &c);
275 c &= 0x7f;
276 pci_write_config_byte(dev, 0xb8, c);
277}
278
279static void __devinit quirk_uli5288(struct pci_dev *dev)
280{ 116{
281 unsigned char c; 117 struct device_node* node;
118 struct resource rsrc;
282 119
283 pci_read_config_byte(dev,0x83,&c); 120 node = (struct device_node *)hose->arch_data;
284 c |= 0x80; 121 of_address_to_resource(node, 0, &rsrc);
285 pci_write_config_byte(dev, 0x83, c);
286 122
287 pci_write_config_byte(dev, 0x09, 0x01); 123 if ((rsrc.start & 0xfffff) == 0x8000) {
288 pci_write_config_byte(dev, 0x0a, 0x06); 124 return uli_exclude_device(hose, bus, devfn);
289 125 }
290 pci_read_config_byte(dev,0x83,&c);
291 c &= 0x7f;
292 pci_write_config_byte(dev, 0x83, c);
293
294 pci_read_config_byte(dev,0x84,&c);
295 c |= 0x01;
296 pci_write_config_byte(dev, 0x84, c);
297}
298
299static void __devinit quirk_uli5229(struct pci_dev *dev)
300{
301 unsigned short temp;
302 pci_write_config_word(dev, 0x04, 0x0405);
303 dev->class &= ~0x5;
304 pci_read_config_word(dev, 0x4a, &temp);
305 temp |= 0x1000;
306 pci_write_config_word(dev, 0x4a, temp);
307}
308 126
309static void __devinit early_uli5249(struct pci_dev *dev) 127 return PCIBIOS_SUCCESSFUL;
310{
311 unsigned char temp;
312 pci_write_config_word(dev, 0x04, 0x0007);
313 pci_read_config_byte(dev, 0x7c, &temp);
314 pci_write_config_byte(dev, 0x7c, 0x80);
315 pci_write_config_byte(dev, 0x09, 0x01);
316 pci_write_config_byte(dev, 0x7c, temp);
317 dev->class |= 0x1;
318} 128}
319
320DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
321DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
322DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
323DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
324#endif /* CONFIG_PCI */ 129#endif /* CONFIG_PCI */
325 130
326 131
@@ -353,6 +158,9 @@ mpc86xx_hpcn_setup_arch(void)
353 else 158 else
354 fsl_add_bridge(np, 0); 159 fsl_add_bridge(np, 0);
355 } 160 }
161 uses_fsl_uli_m1575 = 1;
162 ppc_md.pci_exclude_device = mpc86xx_exclude_device;
163
356#endif 164#endif
357 165
358 printk("MPC86xx HPCN board from Freescale Semiconductor\n"); 166 printk("MPC86xx HPCN board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 932538a93c2b..cfc249741592 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -282,4 +282,12 @@ config AXON_RAM
282 minor numbers are available in /proc/devices, /proc/partitions or 282 minor numbers are available in /proc/devices, /proc/partitions or
283 in /sys/block/axonram?/dev. 283 in /sys/block/axonram?/dev.
284 284
285config FSL_ULI1575
286 bool
287 default n
288 help
289 Supports for the ULI1575 PCIe south bridge that exists on some
290 Freescale reference boards. The boards all use the ULI in pretty
291 much the same way.
292
285endmenu 293endmenu
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index d6e041a46d25..d44e832b01f2 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -1,3 +1,6 @@
1
2obj-$(CONFIG_FSL_ULI1575) += fsl_uli1575.o
3
1ifeq ($(CONFIG_PPC_MERGE),y) 4ifeq ($(CONFIG_PPC_MERGE),y)
2obj-$(CONFIG_PPC_PMAC) += powermac/ 5obj-$(CONFIG_PPC_PMAC) += powermac/
3else 6else
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index dd2c6688c8aa..027ac32cc636 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -45,6 +45,7 @@ asmlinkage long sys_spu_create(const char __user *name,
45 if (owner && try_module_get(owner)) { 45 if (owner && try_module_get(owner)) {
46 if (flags & SPU_CREATE_AFFINITY_SPU) { 46 if (flags & SPU_CREATE_AFFINITY_SPU) {
47 neighbor = fget_light(neighbor_fd, &fput_needed); 47 neighbor = fget_light(neighbor_fd, &fput_needed);
48 ret = -EBADF;
48 if (neighbor) { 49 if (neighbor) {
49 ret = spufs_calls.create_thread(name, flags, 50 ret = spufs_calls.create_thread(name, flags,
50 mode, neighbor); 51 mode, neighbor);
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
new file mode 100644
index 000000000000..afc9141be63e
--- /dev/null
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -0,0 +1,255 @@
1/*
2 * ULI M1575 setup code - specific to Freescale boards
3 *
4 * Copyright 2007 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/stddef.h>
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <linux/interrupt.h>
16#include <linux/mc146818rtc.h>
17
18#include <asm/system.h>
19#include <asm/pci-bridge.h>
20
21#define ULI_PIRQA 0x08
22#define ULI_PIRQB 0x09
23#define ULI_PIRQC 0x0a
24#define ULI_PIRQD 0x0b
25#define ULI_PIRQE 0x0c
26#define ULI_PIRQF 0x0d
27#define ULI_PIRQG 0x0e
28
29#define ULI_8259_NONE 0x00
30#define ULI_8259_IRQ1 0x08
31#define ULI_8259_IRQ3 0x02
32#define ULI_8259_IRQ4 0x04
33#define ULI_8259_IRQ5 0x05
34#define ULI_8259_IRQ6 0x07
35#define ULI_8259_IRQ7 0x06
36#define ULI_8259_IRQ9 0x01
37#define ULI_8259_IRQ10 0x03
38#define ULI_8259_IRQ11 0x09
39#define ULI_8259_IRQ12 0x0b
40#define ULI_8259_IRQ14 0x0d
41#define ULI_8259_IRQ15 0x0f
42
43u8 uli_pirq_to_irq[8] = {
44 ULI_8259_IRQ9, /* PIRQA */
45 ULI_8259_IRQ10, /* PIRQB */
46 ULI_8259_IRQ11, /* PIRQC */
47 ULI_8259_IRQ12, /* PIRQD */
48 ULI_8259_IRQ5, /* PIRQE */
49 ULI_8259_IRQ6, /* PIRQF */
50 ULI_8259_IRQ7, /* PIRQG */
51 ULI_8259_NONE, /* PIRQH */
52};
53
54/* set in board code if you want this quirks to do something */
55int uses_fsl_uli_m1575;
56
57/* Bridge */
58static void __devinit early_uli5249(struct pci_dev *dev)
59{
60 unsigned char temp;
61
62 if (!uses_fsl_uli_m1575)
63 return;
64
65 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_IO |
66 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
67
68 /* read/write lock */
69 pci_read_config_byte(dev, 0x7c, &temp);
70 pci_write_config_byte(dev, 0x7c, 0x80);
71
72 /* set as P2P bridge */
73 pci_write_config_byte(dev, PCI_CLASS_PROG, 0x01);
74 dev->class |= 0x1;
75
76 /* restore lock */
77 pci_write_config_byte(dev, 0x7c, temp);
78}
79
80
81static void __devinit quirk_uli1575(struct pci_dev *dev)
82{
83 int i;
84
85 if (!uses_fsl_uli_m1575)
86 return;
87
88 /*
89 * ULI1575 interrupts route setup
90 */
91
92 /* ULI1575 IRQ mapping conf register maps PIRQx to IRQn */
93 for (i = 0; i < 4; i++) {
94 u8 val = uli_pirq_to_irq[i*2] | (uli_pirq_to_irq[i*2+1] << 4);
95 pci_write_config_byte(dev, 0x48 + i, val);
96 }
97
98 /* USB 1.1 OHCI controller 1: dev 28, func 0 - IRQ12 */
99 pci_write_config_byte(dev, 0x86, ULI_PIRQD);
100
101 /* USB 1.1 OHCI controller 2: dev 28, func 1 - IRQ9 */
102 pci_write_config_byte(dev, 0x87, ULI_PIRQA);
103
104 /* USB 1.1 OHCI controller 3: dev 28, func 2 - IRQ10 */
105 pci_write_config_byte(dev, 0x88, ULI_PIRQB);
106
107 /* Lan controller: dev 27, func 0 - IRQ6 */
108 pci_write_config_byte(dev, 0x89, ULI_PIRQF);
109
110 /* AC97 Audio controller: dev 29, func 0 - IRQ6 */
111 pci_write_config_byte(dev, 0x8a, ULI_PIRQF);
112
113 /* Modem controller: dev 29, func 1 - IRQ6 */
114 pci_write_config_byte(dev, 0x8b, ULI_PIRQF);
115
116 /* HD Audio controller: dev 29, func 2 - IRQ6 */
117 pci_write_config_byte(dev, 0x8c, ULI_PIRQF);
118
119 /* SATA controller: dev 31, func 1 - IRQ5 */
120 pci_write_config_byte(dev, 0x8d, ULI_PIRQE);
121
122 /* SMB interrupt: dev 30, func 1 - IRQ7 */
123 pci_write_config_byte(dev, 0x8e, ULI_PIRQG);
124
125 /* PMU ACPI SCI interrupt: dev 30, func 2 - IRQ7 */
126 pci_write_config_byte(dev, 0x8f, ULI_PIRQG);
127
128 /* USB 2.0 controller: dev 28, func 3 */
129 pci_write_config_byte(dev, 0x74, ULI_8259_IRQ11);
130
131 /* Primary PATA IDE IRQ: 14
132 * Secondary PATA IDE IRQ: 15
133 */
134 pci_write_config_byte(dev, 0x44, 0x30 | ULI_8259_IRQ14);
135 pci_write_config_byte(dev, 0x75, ULI_8259_IRQ15);
136}
137
138static void __devinit quirk_final_uli1575(struct pci_dev *dev)
139{
140 /* Set i8259 interrupt trigger
141 * IRQ 3: Level
142 * IRQ 4: Level
143 * IRQ 5: Level
144 * IRQ 6: Level
145 * IRQ 7: Level
146 * IRQ 9: Level
147 * IRQ 10: Level
148 * IRQ 11: Level
149 * IRQ 12: Level
150 * IRQ 14: Edge
151 * IRQ 15: Edge
152 */
153 if (!uses_fsl_uli_m1575)
154 return;
155
156 outb(0xfa, 0x4d0);
157 outb(0x1e, 0x4d1);
158
159 /* setup RTC */
160 CMOS_WRITE(RTC_SET, RTC_CONTROL);
161 CMOS_WRITE(RTC_24H, RTC_CONTROL);
162
163 /* ensure month, date, and week alarm fields are ignored */
164 CMOS_WRITE(0, RTC_VALID);
165
166 outb_p(0x7c, 0x72);
167 outb_p(RTC_ALARM_DONT_CARE, 0x73);
168
169 outb_p(0x7d, 0x72);
170 outb_p(RTC_ALARM_DONT_CARE, 0x73);
171}
172
173/* SATA */
174static void __devinit quirk_uli5288(struct pci_dev *dev)
175{
176 unsigned char c;
177 unsigned int d;
178
179 if (!uses_fsl_uli_m1575)
180 return;
181
182 /* read/write lock */
183 pci_read_config_byte(dev, 0x83, &c);
184 pci_write_config_byte(dev, 0x83, c|0x80);
185
186 pci_read_config_dword(dev, PCI_CLASS_REVISION, &d);
187 d = (d & 0xff) | (PCI_CLASS_STORAGE_SATA_AHCI << 8);
188 pci_write_config_dword(dev, PCI_CLASS_REVISION, d);
189
190 /* restore lock */
191 pci_write_config_byte(dev, 0x83, c);
192
193 /* disable emulated PATA mode enabled */
194 pci_read_config_byte(dev, 0x84, &c);
195 pci_write_config_byte(dev, 0x84, c & ~0x01);
196}
197
198/* PATA */
199static void __devinit quirk_uli5229(struct pci_dev *dev)
200{
201 unsigned short temp;
202
203 if (!uses_fsl_uli_m1575)
204 return;
205
206 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE |
207 PCI_COMMAND_MASTER | PCI_COMMAND_IO);
208
209 /* Enable Native IRQ 14/15 */
210 pci_read_config_word(dev, 0x4a, &temp);
211 pci_write_config_word(dev, 0x4a, temp | 0x1000);
212}
213
214/* We have to do a dummy read on the P2P for the RTC to work, WTF */
215static void __devinit quirk_final_uli5249(struct pci_dev *dev)
216{
217 int i;
218 u8 *dummy;
219 struct pci_bus *bus = dev->bus;
220
221 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
222 if ((bus->resource[i]) &&
223 (bus->resource[i]->flags & IORESOURCE_MEM)) {
224 dummy = ioremap(bus->resource[i]->start, 0x4);
225 if (dummy) {
226 in_8(dummy);
227 iounmap(dummy);
228 }
229 break;
230 }
231 }
232}
233
234DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
235DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
236DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
237DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
238DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
239DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575);
240
241int uli_exclude_device(struct pci_controller *hose,
242 u_char bus, u_char devfn)
243{
244 if (bus == (hose->first_busno + 2)) {
245 /* exclude Modem controller */
246 if ((PCI_SLOT(devfn) == 29) && (PCI_FUNC(devfn) == 1))
247 return PCIBIOS_DEVICE_NOT_FOUND;
248
249 /* exclude HD Audio controller */
250 if ((PCI_SLOT(devfn) == 29) && (PCI_FUNC(devfn) == 2))
251 return PCIBIOS_DEVICE_NOT_FOUND;
252 }
253
254 return PCIBIOS_SUCCESSFUL;
255}
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index e23a5a874ad3..ce15cada88d4 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -372,7 +372,7 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
372 notify_event->dev_type == repo->dev_type) { 372 notify_event->dev_type == repo->dev_type) {
373 pr_debug("%s:%u: device ready: dev_id %u\n", __func__, 373 pr_debug("%s:%u: device ready: dev_id %u\n", __func__,
374 __LINE__, repo->dev_id); 374 __LINE__, repo->dev_id);
375 result = 0; 375 error = 0;
376 break; 376 break;
377 } 377 }
378 378
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 9fb0ce5c7176..114c90f8f560 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -251,6 +251,8 @@ DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8568E, quirk_fsl_pcie_transpare
251DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8568, quirk_fsl_pcie_transparent); 251DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8568, quirk_fsl_pcie_transparent);
252DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567E, quirk_fsl_pcie_transparent); 252DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567E, quirk_fsl_pcie_transparent);
253DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567, quirk_fsl_pcie_transparent); 253DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567, quirk_fsl_pcie_transparent);
254DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8533E, quirk_fsl_pcie_transparent);
255DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8533, quirk_fsl_pcie_transparent);
254DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544E, quirk_fsl_pcie_transparent); 256DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544E, quirk_fsl_pcie_transparent);
255DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544, quirk_fsl_pcie_transparent); 257DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544, quirk_fsl_pcie_transparent);
256DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_transparent); 258DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_transparent);
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 727453d3e8b9..1cf29c9d4408 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/of_platform.h>
25#include <linux/phy.h> 26#include <linux/phy.h>
26#include <linux/fsl_devices.h> 27#include <linux/fsl_devices.h>
27#include <linux/fs_enet_pd.h> 28#include <linux/fs_enet_pd.h>
diff --git a/arch/powerpc/sysdev/rtc_cmos_setup.c b/arch/powerpc/sysdev/rtc_cmos_setup.c
index e276048b8c5f..0c9ac7ee08fb 100644
--- a/arch/powerpc/sysdev/rtc_cmos_setup.c
+++ b/arch/powerpc/sysdev/rtc_cmos_setup.c
@@ -20,14 +20,16 @@ static int __init add_rtc(void)
20{ 20{
21 struct device_node *np; 21 struct device_node *np;
22 struct platform_device *pd; 22 struct platform_device *pd;
23 struct resource res; 23 struct resource res[2];
24 int ret; 24 int ret;
25 25
26 memset(&res, 0, sizeof(res));
27
26 np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00"); 28 np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00");
27 if (!np) 29 if (!np)
28 return -ENODEV; 30 return -ENODEV;
29 31
30 ret = of_address_to_resource(np, 0, &res); 32 ret = of_address_to_resource(np, 0, &res[0]);
31 of_node_put(np); 33 of_node_put(np);
32 if (ret) 34 if (ret)
33 return ret; 35 return ret;
@@ -36,11 +38,18 @@ static int __init add_rtc(void)
36 * RTC_PORT(x) is hardcoded in asm/mc146818rtc.h. Verify that the 38 * RTC_PORT(x) is hardcoded in asm/mc146818rtc.h. Verify that the
37 * address provided by the device node matches. 39 * address provided by the device node matches.
38 */ 40 */
39 if (res.start != RTC_PORT(0)) 41 if (res[0].start != RTC_PORT(0))
40 return -EINVAL; 42 return -EINVAL;
41 43
44 /* Use a fixed interrupt value of 8 since on PPC if we are using this
45 * its off an i8259 which we ensure has interrupt numbers 0..15. */
46 res[1].start = 8;
47 res[1].end = 8;
48 res[1].flags = IORESOURCE_IRQ;
49
42 pd = platform_device_register_simple("rtc_cmos", -1, 50 pd = platform_device_register_simple("rtc_cmos", -1,
43 &res, 1); 51 &res[0], 2);
52
44 if (IS_ERR(pd)) 53 if (IS_ERR(pd))
45 return PTR_ERR(pd); 54 return PTR_ERR(pd);
46 55
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 0da55368655c..a22e1f4d94c8 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -237,9 +237,19 @@ _GLOBAL(_tlbie)
237 mfspr r4,SPRN_MMUCR 237 mfspr r4,SPRN_MMUCR
238 mfspr r5,SPRN_PID /* Get PID */ 238 mfspr r5,SPRN_PID /* Get PID */
239 rlwimi r4,r5,0,24,31 /* Set TID */ 239 rlwimi r4,r5,0,24,31 /* Set TID */
240 mtspr SPRN_MMUCR,r4
241 240
241 /* We have to run the search with interrupts disabled, even critical
242 * and debug interrupts (in fact the only critical exceptions we have
243 * are debug and machine check). Otherwise an interrupt which causes
244 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
245 mfmsr r5
246 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
247 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
248 andc r6,r5,r6
249 mtmsr r6
250 mtspr SPRN_MMUCR,r4
242 tlbsx. r3, 0, r3 251 tlbsx. r3, 0, r3
252 mtmsr r5
243 bne 10f 253 bne 10f
244 sync 254 sync
245 /* There are only 64 TLB entries, so r3 < 64, 255 /* There are only 64 TLB entries, so r3 < 64,
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index ad4ca75c0f04..5245717295b8 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -60,17 +60,28 @@ static void hypfs_add_dentry(struct dentry *dentry)
60 hypfs_last_dentry = dentry; 60 hypfs_last_dentry = dentry;
61} 61}
62 62
63static inline int hypfs_positive(struct dentry *dentry)
64{
65 return dentry->d_inode && !d_unhashed(dentry);
66}
67
63static void hypfs_remove(struct dentry *dentry) 68static void hypfs_remove(struct dentry *dentry)
64{ 69{
65 struct dentry *parent; 70 struct dentry *parent;
66 71
67 parent = dentry->d_parent; 72 parent = dentry->d_parent;
68 if (S_ISDIR(dentry->d_inode->i_mode)) 73 if (!parent || !parent->d_inode)
69 simple_rmdir(parent->d_inode, dentry); 74 return;
70 else 75 mutex_lock(&parent->d_inode->i_mutex);
71 simple_unlink(parent->d_inode, dentry); 76 if (hypfs_positive(dentry)) {
77 if (S_ISDIR(dentry->d_inode->i_mode))
78 simple_rmdir(parent->d_inode, dentry);
79 else
80 simple_unlink(parent->d_inode, dentry);
81 }
72 d_delete(dentry); 82 d_delete(dentry);
73 dput(dentry); 83 dput(dentry);
84 mutex_unlock(&parent->d_inode->i_mutex);
74} 85}
75 86
76static void hypfs_delete_tree(struct dentry *root) 87static void hypfs_delete_tree(struct dentry *root)
@@ -315,6 +326,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
315 } 326 }
316 hypfs_update_update(sb); 327 hypfs_update_update(sb);
317 sb->s_root = root_dentry; 328 sb->s_root = root_dentry;
329 printk(KERN_INFO "hypfs: Hypervisor filesystem mounted\n");
318 return 0; 330 return 0;
319 331
320err_tree: 332err_tree:
@@ -356,13 +368,17 @@ static struct dentry *hypfs_create_file(struct super_block *sb,
356 qname.name = name; 368 qname.name = name;
357 qname.len = strlen(name); 369 qname.len = strlen(name);
358 qname.hash = full_name_hash(name, qname.len); 370 qname.hash = full_name_hash(name, qname.len);
371 mutex_lock(&parent->d_inode->i_mutex);
359 dentry = lookup_one_len(name, parent, strlen(name)); 372 dentry = lookup_one_len(name, parent, strlen(name));
360 if (IS_ERR(dentry)) 373 if (IS_ERR(dentry)) {
361 return ERR_PTR(-ENOMEM); 374 dentry = ERR_PTR(-ENOMEM);
375 goto fail;
376 }
362 inode = hypfs_make_inode(sb, mode); 377 inode = hypfs_make_inode(sb, mode);
363 if (!inode) { 378 if (!inode) {
364 dput(dentry); 379 dput(dentry);
365 return ERR_PTR(-ENOMEM); 380 dentry = ERR_PTR(-ENOMEM);
381 goto fail;
366 } 382 }
367 if (mode & S_IFREG) { 383 if (mode & S_IFREG) {
368 inode->i_fop = &hypfs_file_ops; 384 inode->i_fop = &hypfs_file_ops;
@@ -379,6 +395,8 @@ static struct dentry *hypfs_create_file(struct super_block *sb,
379 inode->i_private = data; 395 inode->i_private = data;
380 d_instantiate(dentry, inode); 396 d_instantiate(dentry, inode);
381 dget(dentry); 397 dget(dentry);
398fail:
399 mutex_unlock(&parent->d_inode->i_mutex);
382 return dentry; 400 return dentry;
383} 401}
384 402
@@ -391,7 +409,6 @@ struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent,
391 if (IS_ERR(dentry)) 409 if (IS_ERR(dentry))
392 return dentry; 410 return dentry;
393 hypfs_add_dentry(dentry); 411 hypfs_add_dentry(dentry);
394 parent->d_inode->i_nlink++;
395 return dentry; 412 return dentry;
396} 413}
397 414
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 3195d375bd51..56cb71007cd9 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -6,7 +6,7 @@ EXTRA_AFLAGS := -traditional
6 6
7obj-y := bitmap.o traps.o time.o process.o base.o early.o \ 7obj-y := bitmap.o traps.o time.o process.o base.o early.o \
8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ 8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
9 semaphore.o s390_ext.o debug.o irq.o ipl.o dis.o 9 semaphore.o s390_ext.o debug.o irq.o ipl.o dis.o diag.o
10 10
11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
diff --git a/arch/s390/kernel/diag.c b/arch/s390/kernel/diag.c
new file mode 100644
index 000000000000..c032d11da8a1
--- /dev/null
+++ b/arch/s390/kernel/diag.c
@@ -0,0 +1,102 @@
1/*
2 * Implementation of s390 diagnose codes
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */
7
8#include <linux/module.h>
9#include <asm/diag.h>
10
11/*
12 * Diagnose 10: Release pages
13 */
14void diag10(unsigned long addr)
15{
16 if (addr >= 0x7ff00000)
17 return;
18 asm volatile(
19#ifdef CONFIG_64BIT
20 " sam31\n"
21 " diag %0,%0,0x10\n"
22 "0: sam64\n"
23#else
24 " diag %0,%0,0x10\n"
25 "0:\n"
26#endif
27 EX_TABLE(0b, 0b)
28 : : "a" (addr));
29}
30EXPORT_SYMBOL(diag10);
31
32/*
33 * Diagnose 14: Input spool file manipulation
34 */
35int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode)
36{
37 register unsigned long _ry1 asm("2") = ry1;
38 register unsigned long _ry2 asm("3") = subcode;
39 int rc = 0;
40
41 asm volatile(
42#ifdef CONFIG_64BIT
43 " sam31\n"
44 " diag %2,2,0x14\n"
45 " sam64\n"
46#else
47 " diag %2,2,0x14\n"
48#endif
49 " ipm %0\n"
50 " srl %0,28\n"
51 : "=d" (rc), "+d" (_ry2)
52 : "d" (rx), "d" (_ry1)
53 : "cc");
54
55 return rc;
56}
57EXPORT_SYMBOL(diag14);
58
59/*
60 * Diagnose 210: Get information about a virtual device
61 */
62int diag210(struct diag210 *addr)
63{
64 /*
65 * diag 210 needs its data below the 2GB border, so we
66 * use a static data area to be sure
67 */
68 static struct diag210 diag210_tmp;
69 static DEFINE_SPINLOCK(diag210_lock);
70 unsigned long flags;
71 int ccode;
72
73 spin_lock_irqsave(&diag210_lock, flags);
74 diag210_tmp = *addr;
75
76#ifdef CONFIG_64BIT
77 asm volatile(
78 " lhi %0,-1\n"
79 " sam31\n"
80 " diag %1,0,0x210\n"
81 "0: ipm %0\n"
82 " srl %0,28\n"
83 "1: sam64\n"
84 EX_TABLE(0b, 1b)
85 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
86#else
87 asm volatile(
88 " lhi %0,-1\n"
89 " diag %1,0,0x210\n"
90 "0: ipm %0\n"
91 " srl %0,28\n"
92 "1:\n"
93 EX_TABLE(0b, 1b)
94 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
95#endif
96
97 *addr = diag210_tmp;
98 spin_unlock_irqrestore(&diag210_lock, flags);
99
100 return ccode;
101}
102EXPORT_SYMBOL(diag210);
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index d3057318f2bf..50d2235df732 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -577,7 +577,7 @@ static struct insn opcode_b2[] = {
577 { "esta", 0x4a, INSTR_RRE_RR }, 577 { "esta", 0x4a, INSTR_RRE_RR },
578 { "lura", 0x4b, INSTR_RRE_RR }, 578 { "lura", 0x4b, INSTR_RRE_RR },
579 { "tar", 0x4c, INSTR_RRE_AR }, 579 { "tar", 0x4c, INSTR_RRE_AR },
580 { "cpya", INSTR_RRE_AA }, 580 { "cpya", 0x4d, INSTR_RRE_AA },
581 { "sar", 0x4e, INSTR_RRE_AR }, 581 { "sar", 0x4e, INSTR_RRE_AR },
582 { "ear", 0x4f, INSTR_RRE_RA }, 582 { "ear", 0x4f, INSTR_RRE_RA },
583 { "csp", 0x50, INSTR_RRE_RR }, 583 { "csp", 0x50, INSTR_RRE_RR },
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 358d2bbbc481..e40373d9fbce 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -85,7 +85,7 @@ void __kprobes get_instruction_type(struct arch_specific_insn *ainsn)
85 ainsn->reg = (*ainsn->insn & 0xf0) >> 4; 85 ainsn->reg = (*ainsn->insn & 0xf0) >> 4;
86 86
87 /* save the instruction length (pop 5-5) in bytes */ 87 /* save the instruction length (pop 5-5) in bytes */
88 switch (*(__u8 *) (ainsn->insn) >> 4) { 88 switch (*(__u8 *) (ainsn->insn) >> 6) {
89 case 0: 89 case 0:
90 ainsn->ilen = 2; 90 ainsn->ilen = 2;
91 break; 91 break;
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c
index 90b5ef529eb7..7234c737f825 100644
--- a/arch/s390/kernel/s390_ksyms.c
+++ b/arch/s390/kernel/s390_ksyms.c
@@ -25,7 +25,6 @@ EXPORT_SYMBOL(_oi_bitmap);
25EXPORT_SYMBOL(_ni_bitmap); 25EXPORT_SYMBOL(_ni_bitmap);
26EXPORT_SYMBOL(_zb_findmap); 26EXPORT_SYMBOL(_zb_findmap);
27EXPORT_SYMBOL(_sb_findmap); 27EXPORT_SYMBOL(_sb_findmap);
28EXPORT_SYMBOL(diag10);
29 28
30/* 29/*
31 * semaphore ops 30 * semaphore ops
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index c5b2f4f078bc..fabc50adc46a 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/pgalloc.h> 21#include <asm/pgalloc.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/diag.h>
23 24
24static char *sender = "VMRMSVM"; 25static char *sender = "VMRMSVM";
25module_param(sender, charp, 0400); 26module_param(sender, charp, 0400);
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 9098531a2671..3a25bbf2eb0a 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -42,23 +42,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); 42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
43char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); 43char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
44 44
45void diag10(unsigned long addr)
46{
47 if (addr >= 0x7ff00000)
48 return;
49 asm volatile(
50#ifdef CONFIG_64BIT
51 " sam31\n"
52 " diag %0,%0,0x10\n"
53 "0: sam64\n"
54#else
55 " diag %0,%0,0x10\n"
56 "0:\n"
57#endif
58 EX_TABLE(0b,0b)
59 : : "a" (addr));
60}
61
62void show_mem(void) 45void show_mem(void)
63{ 46{
64 int i, total = 0, reserved = 0; 47 int i, total = 0, reserved = 0;
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 3d211aa33cd8..97ac58682d0f 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -34,6 +34,8 @@ isa-y := $(isa-y)-nofpu
34endif 34endif
35endif 35endif
36 36
37isa-y := $(isa-y)-up
38
37cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,) 39cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,)
38cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \ 40cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \
39 $(call cc-option,-m2a-nofpu,) 41 $(call cc-option,-m2a-nofpu,)
@@ -46,7 +48,20 @@ cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
46cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb 48cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
47cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml 49cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
48 50
49cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) -ffreestanding 51#
52# -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
53# support it, while -Wa,-dsp by itself limits the range of usable opcodes
54# on certain CPU subtypes. Try the ISA variant first, and if that fails,
55# fall back on -Wa,-dsp for the old binutils versions. Even without DSP
56# opcodes, we always want the best ISA tuning the version of binutils
57# will provide.
58#
59isaflags-y := $(call as-option,-Wa$(comma)-isa=$(isa-y),)
60
61isaflags-$(CONFIG_SH_DSP) := \
62 $(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp)
63
64cflags-y += $(isaflags-y) -ffreestanding
50 65
51cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \ 66cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
52 $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g') 67 $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
index 6e4e96541358..dab193293f20 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
@@ -41,3 +41,8 @@ static int __init sh4202_devices_setup(void)
41 ARRAY_SIZE(sh4202_devices)); 41 ARRAY_SIZE(sh4202_devices));
42} 42}
43__initcall(sh4202_devices_setup); 43__initcall(sh4202_devices_setup);
44
45void __init plat_irq_setup(void)
46{
47 /* do nothing - all IRL interrupts are handled by the board code */
48}
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
index 9833493d8867..80b637c30203 100644
--- a/arch/sh/kernel/early_printk.c
+++ b/arch/sh/kernel/early_printk.c
@@ -76,7 +76,7 @@ static void scif_sercon_putc(int c)
76 sci_in(&scif_port, SCxSR); 76 sci_in(&scif_port, SCxSR);
77 sci_out(&scif_port, SCxSR, 0xf3 & ~(0x20 | 0x40)); 77 sci_out(&scif_port, SCxSR, 0xf3 & ~(0x20 | 0x40));
78 78
79 while ((sci_in(&scif_port, SCxSR) & 0x40) == 0); 79 while ((sci_in(&scif_port, SCxSR) & 0x40) == 0)
80 ; 80 ;
81 81
82 if (c == '\n') 82 if (c == '\n')
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c
index 23c5948f0124..129b2cfd18a8 100644
--- a/arch/sh/kernel/machvec.c
+++ b/arch/sh/kernel/machvec.c
@@ -91,6 +91,13 @@ void __init sh_mv_setup(void)
91 (unsigned long)&__machvec_start); 91 (unsigned long)&__machvec_start);
92 92
93 /* 93 /*
94 * Sanity check for machvec section alignment. Ensure
95 * __initmv hasn't been misused.
96 */
97 if (machvec_size % sizeof(struct sh_machine_vector))
98 panic("machvec misaligned, invalid __initmv use?");
99
100 /*
94 * If the machvec hasn't been preselected, use the first 101 * If the machvec hasn't been preselected, use the first
95 * vector (usually the only one) from .machvec.init. 102 * vector (usually the only one) from .machvec.init.
96 */ 103 */
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
index 891d1d46c902..f64a2d2416d4 100644
--- a/arch/sh/kernel/ptrace.c
+++ b/arch/sh/kernel/ptrace.c
@@ -93,6 +93,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
93 case PTRACE_PEEKTEXT: /* read word at location addr. */ 93 case PTRACE_PEEKTEXT: /* read word at location addr. */
94 case PTRACE_PEEKDATA: 94 case PTRACE_PEEKDATA:
95 ret = generic_ptrace_peekdata(child, addr, data); 95 ret = generic_ptrace_peekdata(child, addr, data);
96 break;
96 97
97 /* read the word at location addr in the USER area. */ 98 /* read the word at location addr in the USER area. */
98 case PTRACE_PEEKUSR: { 99 case PTRACE_PEEKUSR: {
diff --git a/arch/sh64/kernel/setup.c b/arch/sh64/kernel/setup.c
index 53e9d20a874a..2b7264c0c6f7 100644
--- a/arch/sh64/kernel/setup.c
+++ b/arch/sh64/kernel/setup.c
@@ -59,10 +59,6 @@
59#include <asm/setup.h> 59#include <asm/setup.h>
60#include <asm/smp.h> 60#include <asm/smp.h>
61 61
62#ifdef CONFIG_VT
63#include <linux/console.h>
64#endif
65
66struct screen_info screen_info; 62struct screen_info screen_info;
67 63
68#ifdef CONFIG_BLK_DEV_RAM 64#ifdef CONFIG_BLK_DEV_RAM
diff --git a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
index 0bb4a8f94276..79fc48cf54c6 100644
--- a/arch/sh64/kernel/signal.c
+++ b/arch/sh64/kernel/signal.c
@@ -25,7 +25,6 @@
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/unistd.h> 26#include <linux/unistd.h>
27#include <linux/stddef.h> 27#include <linux/stddef.h>
28#include <linux/personality.h>
29#include <asm/ucontext.h> 28#include <asm/ucontext.h>
30#include <asm/uaccess.h> 29#include <asm/uaccess.h>
31#include <asm/pgtable.h> 30#include <asm/pgtable.h>
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index ac352eb6dff3..e2d02fd13f35 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -238,6 +238,7 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
238 sd = &dev->ofdev.dev.archdata; 238 sd = &dev->ofdev.dev.archdata;
239 sd->prom_node = dp; 239 sd->prom_node = dp;
240 sd->op = &dev->ofdev; 240 sd->op = &dev->ofdev;
241 sd->iommu = dev->bus->ofdev.dev.parent->archdata.iommu;
241 242
242 dev->ofdev.node = dp; 243 dev->ofdev.node = dp;
243 dev->ofdev.dev.parent = &dev->bus->ofdev.dev; 244 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 4ccda77d08d6..7c89893b1fe8 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -66,7 +66,7 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus)
66 } 66 }
67 if(!xpt) panic("Cannot map External Page Table."); 67 if(!xpt) panic("Cannot map External Page Table.");
68 68
69 sbus->iommu = (struct iommu_struct *)iounit; 69 sbus->ofdev.dev.archdata.iommu = iounit;
70 iounit->page_table = xpt; 70 iounit->page_table = xpt;
71 spin_lock_init(&iounit->lock); 71 spin_lock_init(&iounit->lock);
72 72
@@ -127,7 +127,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus) 127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus)
128{ 128{
129 unsigned long ret, flags; 129 unsigned long ret, flags;
130 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 130 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
131 131
132 spin_lock_irqsave(&iounit->lock, flags); 132 spin_lock_irqsave(&iounit->lock, flags);
133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len); 133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len);
@@ -138,7 +138,7 @@ static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus
138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) 138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus)
139{ 139{
140 unsigned long flags; 140 unsigned long flags;
141 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 141 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
142 142
143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ 143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */
144 spin_lock_irqsave(&iounit->lock, flags); 144 spin_lock_irqsave(&iounit->lock, flags);
@@ -153,7 +153,7 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus
153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) 153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus)
154{ 154{
155 unsigned long flags; 155 unsigned long flags;
156 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 156 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
157 157
158 spin_lock_irqsave(&iounit->lock, flags); 158 spin_lock_irqsave(&iounit->lock, flags);
159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; 159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT;
@@ -168,7 +168,7 @@ static void iounit_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_
168{ 168{
169 unsigned long flags; 169 unsigned long flags;
170 unsigned long vaddr, len; 170 unsigned long vaddr, len;
171 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 171 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
172 172
173 spin_lock_irqsave(&iounit->lock, flags); 173 spin_lock_irqsave(&iounit->lock, flags);
174 while (sz != 0) { 174 while (sz != 0) {
@@ -211,7 +211,7 @@ static int iounit_map_dma_area(dma_addr_t *pba, unsigned long va, __u32 addr, in
211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); 211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
212 212
213 for_each_sbus(sbus) { 213 for_each_sbus(sbus) {
214 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 214 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
215 215
216 iopte = (iopte_t *)(iounit->page_table + i); 216 iopte = (iopte_t *)(iounit->page_table + i);
217 *iopte = MKIOPTE(__pa(page)); 217 *iopte = MKIOPTE(__pa(page));
@@ -235,7 +235,7 @@ static void iounit_unmap_dma_area(unsigned long addr, int len)
235static struct page *iounit_translate_dvma(unsigned long addr) 235static struct page *iounit_translate_dvma(unsigned long addr)
236{ 236{
237 struct sbus_bus *sbus = sbus_root; /* They are all the same */ 237 struct sbus_bus *sbus = sbus_root; /* They are all the same */
238 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 238 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
239 int i; 239 int i;
240 iopte_t *iopte; 240 iopte_t *iopte;
241 241
@@ -279,7 +279,7 @@ __u32 iounit_map_dma_init(struct sbus_bus *sbus, int size)
279 unsigned long rotor, scan, limit; 279 unsigned long rotor, scan, limit;
280 unsigned long flags; 280 unsigned long flags;
281 __u32 ret; 281 __u32 ret;
282 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 282 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
283 283
284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT; 284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT;
285 i = 0x0213; 285 i = 0x0213;
@@ -315,7 +315,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus) 315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus)
316{ 316{
317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT; 317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
318 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 318 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
319 319
320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK)); 320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK));
321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK); 321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK);
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index be042efd1ba4..52e907af9d29 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -132,7 +132,7 @@ iommu_init(int iommund, struct sbus_bus *sbus)
132 impl, vers, iommu->page_table, 132 impl, vers, iommu->page_table,
133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES); 133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);
134 134
135 sbus->iommu = iommu; 135 sbus->ofdev.dev.archdata.iommu = iommu;
136} 136}
137 137
138/* This begs to be btfixup-ed by srmmu. */ 138/* This begs to be btfixup-ed by srmmu. */
@@ -166,7 +166,7 @@ static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte)
166 166
167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus) 167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus)
168{ 168{
169 struct iommu_struct *iommu = sbus->iommu; 169 struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;
170 int ioptex; 170 int ioptex;
171 iopte_t *iopte, *iopte0; 171 iopte_t *iopte, *iopte0;
172 unsigned int busa, busa0; 172 unsigned int busa, busa0;
@@ -291,7 +291,7 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu
291 291
292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) 292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus)
293{ 293{
294 struct iommu_struct *iommu = sbus->iommu; 294 struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;
295 int ioptex; 295 int ioptex;
296 int i; 296 int i;
297 297
@@ -334,7 +334,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
334 unsigned long addr, int len) 334 unsigned long addr, int len)
335{ 335{
336 unsigned long page, end; 336 unsigned long page, end;
337 struct iommu_struct *iommu = sbus_root->iommu; 337 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
338 iopte_t *iopte = iommu->page_table; 338 iopte_t *iopte = iommu->page_table;
339 iopte_t *first; 339 iopte_t *first;
340 int ioptex; 340 int ioptex;
@@ -399,7 +399,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
399 399
400static void iommu_unmap_dma_area(unsigned long busa, int len) 400static void iommu_unmap_dma_area(unsigned long busa, int len)
401{ 401{
402 struct iommu_struct *iommu = sbus_root->iommu; 402 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
403 iopte_t *iopte = iommu->page_table; 403 iopte_t *iopte = iommu->page_table;
404 unsigned long end; 404 unsigned long end;
405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT; 405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT;
@@ -420,7 +420,7 @@ static void iommu_unmap_dma_area(unsigned long busa, int len)
420 420
421static struct page *iommu_translate_dvma(unsigned long busa) 421static struct page *iommu_translate_dvma(unsigned long busa)
422{ 422{
423 struct iommu_struct *iommu = sbus_root->iommu; 423 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
424 iopte_t *iopte = iommu->page_table; 424 iopte_t *iopte = iommu->page_table;
425 425
426 iopte += ((busa - iommu->start) >> PAGE_SHIFT); 426 iopte += ((busa - iommu->start) >> PAGE_SHIFT);
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 79d60d86f6f8..005a3e72d4f2 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -268,7 +268,6 @@ static inline void sun4c_init_clean_mmu(unsigned long kernel_end)
268 unsigned char savectx, ctx; 268 unsigned char savectx, ctx;
269 269
270 savectx = sun4c_get_context(); 270 savectx = sun4c_get_context();
271 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
272 for (ctx = 0; ctx < num_contexts; ctx++) { 271 for (ctx = 0; ctx < num_contexts; ctx++) {
273 sun4c_set_context(ctx); 272 sun4c_set_context(ctx);
274 for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE) 273 for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE)
@@ -2064,7 +2063,6 @@ void __init sun4c_paging_init(void)
2064 unsigned long end_pfn, pages_avail; 2063 unsigned long end_pfn, pages_avail;
2065 2064
2066 kernel_end = (unsigned long) &end; 2065 kernel_end = (unsigned long) &end;
2067 kernel_end += (SUN4C_REAL_PGDIR_SIZE * 4);
2068 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); 2066 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
2069 2067
2070 pages_avail = 0; 2068 pages_avail = 0;
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
index ac18bd8e273f..63144ad476f6 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc64/kernel/head.S
@@ -501,7 +501,7 @@ niagara_tlb_fixup:
501 cmp %g1, SUN4V_CHIP_NIAGARA1 501 cmp %g1, SUN4V_CHIP_NIAGARA1
502 be,pt %xcc, niagara_patch 502 be,pt %xcc, niagara_patch
503 cmp %g1, SUN4V_CHIP_NIAGARA2 503 cmp %g1, SUN4V_CHIP_NIAGARA2
504 be,pt %xcc, niagara_patch 504 be,pt %xcc, niagara2_patch
505 nop 505 nop
506 506
507 call generic_patch_copyops 507 call generic_patch_copyops
@@ -512,6 +512,15 @@ niagara_tlb_fixup:
512 nop 512 nop
513 513
514 ba,a,pt %xcc, 80f 514 ba,a,pt %xcc, 80f
515niagara2_patch:
516 call niagara2_patch_copyops
517 nop
518 call niagara_patch_bzero
519 nop
520 call niagara2_patch_pageops
521 nop
522
523 ba,a,pt %xcc, 80f
515 524
516niagara_patch: 525niagara_patch:
517 call niagara_patch_copyops 526 call niagara_patch_copyops
@@ -706,12 +715,13 @@ setup_trap_table:
706 715
707 membar #Sync 716 membar #Sync
708 717
718 BRANCH_IF_SUN4V(o2, 1f)
719
709 /* Kill PROM timer */ 720 /* Kill PROM timer */
710 sethi %hi(0x80000000), %o2 721 sethi %hi(0x80000000), %o2
711 sllx %o2, 32, %o2 722 sllx %o2, 32, %o2
712 wr %o2, 0, %tick_cmpr 723 wr %o2, 0, %tick_cmpr
713 724
714 BRANCH_IF_SUN4V(o2, 1f)
715 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f) 725 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
716 726
717 ba,pt %xcc, 2f 727 ba,pt %xcc, 2f
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index 95059c2ec414..9f22e4ff6015 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -9,6 +9,7 @@
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/miscdevice.h>
12 13
13#include <asm/hypervisor.h> 14#include <asm/hypervisor.h>
14#include <asm/mdesc.h> 15#include <asm/mdesc.h>
@@ -836,6 +837,43 @@ void __devinit mdesc_fill_in_cpu_data(cpumask_t mask)
836 mdesc_release(hp); 837 mdesc_release(hp);
837} 838}
838 839
840static ssize_t mdesc_read(struct file *file, char __user *buf,
841 size_t len, loff_t *offp)
842{
843 struct mdesc_handle *hp = mdesc_grab();
844 int err;
845
846 if (!hp)
847 return -ENODEV;
848
849 err = hp->handle_size;
850 if (len < hp->handle_size)
851 err = -EMSGSIZE;
852 else if (copy_to_user(buf, &hp->mdesc, hp->handle_size))
853 err = -EFAULT;
854 mdesc_release(hp);
855
856 return err;
857}
858
859static const struct file_operations mdesc_fops = {
860 .read = mdesc_read,
861 .owner = THIS_MODULE,
862};
863
864static struct miscdevice mdesc_misc = {
865 .minor = MISC_DYNAMIC_MINOR,
866 .name = "mdesc",
867 .fops = &mdesc_fops,
868};
869
870static int __init mdesc_misc_init(void)
871{
872 return misc_register(&mdesc_misc);
873}
874
875__initcall(mdesc_misc_init);
876
839void __init sun4v_mdesc_init(void) 877void __init sun4v_mdesc_init(void)
840{ 878{
841 struct mdesc_handle *hp; 879 struct mdesc_handle *hp;
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
index 9448595f9063..9533a25ce5d2 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc64/kernel/trampoline.S
@@ -95,14 +95,13 @@ spitfire_startup:
95 membar #Sync 95 membar #Sync
96 96
97startup_continue: 97startup_continue:
98 mov %o0, %l0
99 BRANCH_IF_SUN4V(g1, niagara_lock_tlb)
100
98 sethi %hi(0x80000000), %g2 101 sethi %hi(0x80000000), %g2
99 sllx %g2, 32, %g2 102 sllx %g2, 32, %g2
100 wr %g2, 0, %tick_cmpr 103 wr %g2, 0, %tick_cmpr
101 104
102 mov %o0, %l0
103
104 BRANCH_IF_SUN4V(g1, niagara_lock_tlb)
105
106 /* Call OBP by hand to lock KERNBASE into i/d tlbs. 105 /* Call OBP by hand to lock KERNBASE into i/d tlbs.
107 * We lock 2 consequetive entries if we are 'bigkernel'. 106 * We lock 2 consequetive entries if we are 'bigkernel'.
108 */ 107 */
diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile
index f95fbfa3eeb8..f095e13910bc 100644
--- a/arch/sparc64/lib/Makefile
+++ b/arch/sparc64/lib/Makefile
@@ -13,6 +13,8 @@ lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ 13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \
14 NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \ 14 NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \
15 NGpage.o NGbzero.o \ 15 NGpage.o NGbzero.o \
16 NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o NG2patch.o \
17 NG2page.o \
16 GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \ 18 GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \
17 GENpage.o GENbzero.o \ 19 GENpage.o GENbzero.o \
18 copy_in_user.o user_fixup.o memmove.o \ 20 copy_in_user.o user_fixup.o memmove.o \
diff --git a/arch/sparc64/lib/NG2copy_from_user.S b/arch/sparc64/lib/NG2copy_from_user.S
new file mode 100644
index 000000000000..c77ef5f22102
--- /dev/null
+++ b/arch/sparc64/lib/NG2copy_from_user.S
@@ -0,0 +1,40 @@
1/* NG2copy_from_user.S: Niagara-2 optimized copy from userspace.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#define EX_LD(x) \
798: x; \
8 .section .fixup; \
9 .align 4; \
1099: wr %g0, ASI_AIUS, %asi;\
11 retl; \
12 mov 1, %o0; \
13 .section __ex_table,"a";\
14 .align 4; \
15 .word 98b, 99b; \
16 .text; \
17 .align 4;
18
19#ifndef ASI_AIUS
20#define ASI_AIUS 0x11
21#endif
22
23#ifndef ASI_BLK_AIUS_4V
24#define ASI_BLK_AIUS_4V 0x17
25#endif
26
27#define FUNC_NAME NG2copy_from_user
28#define LOAD(type,addr,dest) type##a [addr] %asi, dest
29#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_AIUS_4V, dest
30#define EX_RETVAL(x) 0
31
32#ifdef __KERNEL__
33#define PREAMBLE \
34 rd %asi, %g1; \
35 cmp %g1, ASI_AIUS; \
36 bne,pn %icc, memcpy_user_stub; \
37 nop
38#endif
39
40#include "NG2memcpy.S"
diff --git a/arch/sparc64/lib/NG2copy_to_user.S b/arch/sparc64/lib/NG2copy_to_user.S
new file mode 100644
index 000000000000..4bd4093acbbd
--- /dev/null
+++ b/arch/sparc64/lib/NG2copy_to_user.S
@@ -0,0 +1,49 @@
1/* NG2copy_to_user.S: Niagara-2 optimized copy to userspace.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#define EX_ST(x) \
798: x; \
8 .section .fixup; \
9 .align 4; \
1099: wr %g0, ASI_AIUS, %asi;\
11 retl; \
12 mov 1, %o0; \
13 .section __ex_table,"a";\
14 .align 4; \
15 .word 98b, 99b; \
16 .text; \
17 .align 4;
18
19#ifndef ASI_AIUS
20#define ASI_AIUS 0x11
21#endif
22
23#ifndef ASI_BLK_AIUS_4V
24#define ASI_BLK_AIUS_4V 0x17
25#endif
26
27#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS
28#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23
29#endif
30
31#define FUNC_NAME NG2copy_to_user
32#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS
33#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS
34#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS_4V
35#define EX_RETVAL(x) 0
36
37#ifdef __KERNEL__
38 /* Writing to %asi is _expensive_ so we hardcode it.
39 * Reading %asi to check for KERNEL_DS is comparatively
40 * cheap.
41 */
42#define PREAMBLE \
43 rd %asi, %g1; \
44 cmp %g1, ASI_AIUS; \
45 bne,pn %icc, memcpy_user_stub; \
46 nop
47#endif
48
49#include "NG2memcpy.S"
diff --git a/arch/sparc64/lib/NG2memcpy.S b/arch/sparc64/lib/NG2memcpy.S
new file mode 100644
index 000000000000..0aed75653b50
--- /dev/null
+++ b/arch/sparc64/lib/NG2memcpy.S
@@ -0,0 +1,520 @@
1/* NG2memcpy.S: Niagara-2 optimized memcpy.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#ifdef __KERNEL__
7#include <asm/visasm.h>
8#include <asm/asi.h>
9#define GLOBAL_SPARE %g7
10#else
11#define ASI_PNF 0x82
12#define ASI_BLK_P 0xf0
13#define ASI_BLK_INIT_QUAD_LDD_P 0xe2
14#define FPRS_FEF 0x04
15#ifdef MEMCPY_DEBUG
16#define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs; \
17 clr %g1; clr %g2; clr %g3; subcc %g0, %g0, %g0;
18#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
19#else
20#define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs
21#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
22#endif
23#define GLOBAL_SPARE %g5
24#endif
25
26#ifndef STORE_ASI
27#ifndef SIMULATE_NIAGARA_ON_NON_NIAGARA
28#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_P
29#else
30#define STORE_ASI 0x80 /* ASI_P */
31#endif
32#endif
33
34#ifndef EX_LD
35#define EX_LD(x) x
36#endif
37
38#ifndef EX_ST
39#define EX_ST(x) x
40#endif
41
42#ifndef EX_RETVAL
43#define EX_RETVAL(x) x
44#endif
45
46#ifndef LOAD
47#define LOAD(type,addr,dest) type [addr], dest
48#endif
49
50#ifndef LOAD_BLK
51#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_P, dest
52#endif
53
54#ifndef STORE
55#ifndef MEMCPY_DEBUG
56#define STORE(type,src,addr) type src, [addr]
57#else
58#define STORE(type,src,addr) type##a src, [addr] 0x80
59#endif
60#endif
61
62#ifndef STORE_BLK
63#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_P
64#endif
65
66#ifndef STORE_INIT
67#define STORE_INIT(src,addr) stxa src, [addr] STORE_ASI
68#endif
69
70#ifndef FUNC_NAME
71#define FUNC_NAME NG2memcpy
72#endif
73
74#ifndef PREAMBLE
75#define PREAMBLE
76#endif
77
78#ifndef XCC
79#define XCC xcc
80#endif
81
82#define FREG_FROB(x0, x1, x2, x3, x4, x5, x6, x7, x8) \
83 faligndata %x0, %x1, %f0; \
84 faligndata %x1, %x2, %f2; \
85 faligndata %x2, %x3, %f4; \
86 faligndata %x3, %x4, %f6; \
87 faligndata %x4, %x5, %f8; \
88 faligndata %x5, %x6, %f10; \
89 faligndata %x6, %x7, %f12; \
90 faligndata %x7, %x8, %f14;
91
92#define FREG_MOVE_1(x0) \
93 fmovd %x0, %f0;
94#define FREG_MOVE_2(x0, x1) \
95 fmovd %x0, %f0; \
96 fmovd %x1, %f2;
97#define FREG_MOVE_3(x0, x1, x2) \
98 fmovd %x0, %f0; \
99 fmovd %x1, %f2; \
100 fmovd %x2, %f4;
101#define FREG_MOVE_4(x0, x1, x2, x3) \
102 fmovd %x0, %f0; \
103 fmovd %x1, %f2; \
104 fmovd %x2, %f4; \
105 fmovd %x3, %f6;
106#define FREG_MOVE_5(x0, x1, x2, x3, x4) \
107 fmovd %x0, %f0; \
108 fmovd %x1, %f2; \
109 fmovd %x2, %f4; \
110 fmovd %x3, %f6; \
111 fmovd %x4, %f8;
112#define FREG_MOVE_6(x0, x1, x2, x3, x4, x5) \
113 fmovd %x0, %f0; \
114 fmovd %x1, %f2; \
115 fmovd %x2, %f4; \
116 fmovd %x3, %f6; \
117 fmovd %x4, %f8; \
118 fmovd %x5, %f10;
119#define FREG_MOVE_7(x0, x1, x2, x3, x4, x5, x6) \
120 fmovd %x0, %f0; \
121 fmovd %x1, %f2; \
122 fmovd %x2, %f4; \
123 fmovd %x3, %f6; \
124 fmovd %x4, %f8; \
125 fmovd %x5, %f10; \
126 fmovd %x6, %f12;
127#define FREG_MOVE_8(x0, x1, x2, x3, x4, x5, x6, x7) \
128 fmovd %x0, %f0; \
129 fmovd %x1, %f2; \
130 fmovd %x2, %f4; \
131 fmovd %x3, %f6; \
132 fmovd %x4, %f8; \
133 fmovd %x5, %f10; \
134 fmovd %x6, %f12; \
135 fmovd %x7, %f14;
136#define FREG_LOAD_1(base, x0) \
137 EX_LD(LOAD(ldd, base + 0x00, %x0))
138#define FREG_LOAD_2(base, x0, x1) \
139 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
140 EX_LD(LOAD(ldd, base + 0x08, %x1));
141#define FREG_LOAD_3(base, x0, x1, x2) \
142 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
143 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
144 EX_LD(LOAD(ldd, base + 0x10, %x2));
145#define FREG_LOAD_4(base, x0, x1, x2, x3) \
146 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
147 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
148 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
149 EX_LD(LOAD(ldd, base + 0x18, %x3));
150#define FREG_LOAD_5(base, x0, x1, x2, x3, x4) \
151 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
152 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
153 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
154 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
155 EX_LD(LOAD(ldd, base + 0x20, %x4));
156#define FREG_LOAD_6(base, x0, x1, x2, x3, x4, x5) \
157 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
158 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
159 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
160 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
161 EX_LD(LOAD(ldd, base + 0x20, %x4)); \
162 EX_LD(LOAD(ldd, base + 0x28, %x5));
163#define FREG_LOAD_7(base, x0, x1, x2, x3, x4, x5, x6) \
164 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
165 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
166 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
167 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
168 EX_LD(LOAD(ldd, base + 0x20, %x4)); \
169 EX_LD(LOAD(ldd, base + 0x28, %x5)); \
170 EX_LD(LOAD(ldd, base + 0x30, %x6));
171
172 .register %g2,#scratch
173 .register %g3,#scratch
174
175 .text
176 .align 64
177
178 .globl FUNC_NAME
179 .type FUNC_NAME,#function
180FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
181 srlx %o2, 31, %g2
182 cmp %g2, 0
183 tne %xcc, 5
184 PREAMBLE
185 mov %o0, GLOBAL_SPARE
186 cmp %o2, 0
187 be,pn %XCC, 85f
188 or %o0, %o1, %o3
189 cmp %o2, 16
190 blu,a,pn %XCC, 80f
191 or %o3, %o2, %o3
192
193 /* 2 blocks (128 bytes) is the minimum we can do the block
194 * copy with. We need to ensure that we'll iterate at least
195 * once in the block copy loop. At worst we'll need to align
196 * the destination to a 64-byte boundary which can chew up
197 * to (64 - 1) bytes from the length before we perform the
198 * block copy loop.
199 *
200 * However, the cut-off point, performance wise, is around
201 * 4 64-byte blocks.
202 */
203 cmp %o2, (4 * 64)
204 blu,pt %XCC, 75f
205 andcc %o3, 0x7, %g0
206
207 /* %o0: dst
208 * %o1: src
209 * %o2: len (known to be >= 128)
210 *
211 * The block copy loops can use %o4, %g2, %g3 as
212 * temporaries while copying the data. %o5 must
213 * be preserved between VISEntryHalf and VISExitHalf
214 */
215
216 LOAD(prefetch, %o1 + 0x000, #one_read)
217 LOAD(prefetch, %o1 + 0x040, #one_read)
218 LOAD(prefetch, %o1 + 0x080, #one_read)
219
220 /* Align destination on 64-byte boundary. */
221 andcc %o0, (64 - 1), %o4
222 be,pt %XCC, 2f
223 sub %o4, 64, %o4
224 sub %g0, %o4, %o4 ! bytes to align dst
225 sub %o2, %o4, %o2
2261: subcc %o4, 1, %o4
227 EX_LD(LOAD(ldub, %o1, %g1))
228 EX_ST(STORE(stb, %g1, %o0))
229 add %o1, 1, %o1
230 bne,pt %XCC, 1b
231 add %o0, 1, %o0
232
2332:
234 /* Clobbers o5/g1/g2/g3/g7/icc/xcc. We must preserve
235 * o5 from here until we hit VISExitHalf.
236 */
237 VISEntryHalf
238
239 alignaddr %o1, %g0, %g0
240
241 add %o1, (64 - 1), %o4
242 andn %o4, (64 - 1), %o4
243 andn %o2, (64 - 1), %g1
244 sub %o2, %g1, %o2
245
246 and %o1, (64 - 1), %g2
247 add %o1, %g1, %o1
248 sub %o0, %o4, %g3
249 brz,pt %g2, 190f
250 cmp %g2, 32
251 blu,a 5f
252 cmp %g2, 16
253 cmp %g2, 48
254 blu,a 4f
255 cmp %g2, 40
256 cmp %g2, 56
257 blu 170f
258 nop
259 ba,a,pt %xcc, 180f
260
2614: /* 32 <= low bits < 48 */
262 blu 150f
263 nop
264 ba,a,pt %xcc, 160f
2655: /* 0 < low bits < 32 */
266 blu,a 6f
267 cmp %g2, 8
268 cmp %g2, 24
269 blu 130f
270 nop
271 ba,a,pt %xcc, 140f
2726: /* 0 < low bits < 16 */
273 bgeu 120f
274 nop
275 /* fall through for 0 < low bits < 8 */
276110: sub %o4, 64, %g2
277 EX_LD(LOAD_BLK(%g2, %f0))
2781: EX_ST(STORE_INIT(%g0, %o4 + %g3))
279 EX_LD(LOAD_BLK(%o4, %f16))
280 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f14, f16)
281 EX_ST(STORE_BLK(%f0, %o4 + %g3))
282 FREG_MOVE_8(f16, f18, f20, f22, f24, f26, f28, f30)
283 subcc %g1, 64, %g1
284 add %o4, 64, %o4
285 bne,pt %xcc, 1b
286 LOAD(prefetch, %o4 + 64, #one_read)
287 ba,pt %xcc, 195f
288 nop
289
290120: sub %o4, 56, %g2
291 FREG_LOAD_7(%g2, f0, f2, f4, f6, f8, f10, f12)
2921: EX_ST(STORE_INIT(%g0, %o4 + %g3))
293 EX_LD(LOAD_BLK(%o4, %f16))
294 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f16, f18)
295 EX_ST(STORE_BLK(%f0, %o4 + %g3))
296 FREG_MOVE_7(f18, f20, f22, f24, f26, f28, f30)
297 subcc %g1, 64, %g1
298 add %o4, 64, %o4
299 bne,pt %xcc, 1b
300 LOAD(prefetch, %o4 + 64, #one_read)
301 ba,pt %xcc, 195f
302 nop
303
304130: sub %o4, 48, %g2
305 FREG_LOAD_6(%g2, f0, f2, f4, f6, f8, f10)
3061: EX_ST(STORE_INIT(%g0, %o4 + %g3))
307 EX_LD(LOAD_BLK(%o4, %f16))
308 FREG_FROB(f0, f2, f4, f6, f8, f10, f16, f18, f20)
309 EX_ST(STORE_BLK(%f0, %o4 + %g3))
310 FREG_MOVE_6(f20, f22, f24, f26, f28, f30)
311 subcc %g1, 64, %g1
312 add %o4, 64, %o4
313 bne,pt %xcc, 1b
314 LOAD(prefetch, %o4 + 64, #one_read)
315 ba,pt %xcc, 195f
316 nop
317
318140: sub %o4, 40, %g2
319 FREG_LOAD_5(%g2, f0, f2, f4, f6, f8)
3201: EX_ST(STORE_INIT(%g0, %o4 + %g3))
321 EX_LD(LOAD_BLK(%o4, %f16))
322 FREG_FROB(f0, f2, f4, f6, f8, f16, f18, f20, f22)
323 EX_ST(STORE_BLK(%f0, %o4 + %g3))
324 FREG_MOVE_5(f22, f24, f26, f28, f30)
325 subcc %g1, 64, %g1
326 add %o4, 64, %o4
327 bne,pt %xcc, 1b
328 LOAD(prefetch, %o4 + 64, #one_read)
329 ba,pt %xcc, 195f
330 nop
331
332150: sub %o4, 32, %g2
333 FREG_LOAD_4(%g2, f0, f2, f4, f6)
3341: EX_ST(STORE_INIT(%g0, %o4 + %g3))
335 EX_LD(LOAD_BLK(%o4, %f16))
336 FREG_FROB(f0, f2, f4, f6, f16, f18, f20, f22, f24)
337 EX_ST(STORE_BLK(%f0, %o4 + %g3))
338 FREG_MOVE_4(f24, f26, f28, f30)
339 subcc %g1, 64, %g1
340 add %o4, 64, %o4
341 bne,pt %xcc, 1b
342 LOAD(prefetch, %o4 + 64, #one_read)
343 ba,pt %xcc, 195f
344 nop
345
346160: sub %o4, 24, %g2
347 FREG_LOAD_3(%g2, f0, f2, f4)
3481: EX_ST(STORE_INIT(%g0, %o4 + %g3))
349 EX_LD(LOAD_BLK(%o4, %f16))
350 FREG_FROB(f0, f2, f4, f16, f18, f20, f22, f24, f26)
351 EX_ST(STORE_BLK(%f0, %o4 + %g3))
352 FREG_MOVE_3(f26, f28, f30)
353 subcc %g1, 64, %g1
354 add %o4, 64, %o4
355 bne,pt %xcc, 1b
356 LOAD(prefetch, %o4 + 64, #one_read)
357 ba,pt %xcc, 195f
358 nop
359
360170: sub %o4, 16, %g2
361 FREG_LOAD_2(%g2, f0, f2)
3621: EX_ST(STORE_INIT(%g0, %o4 + %g3))
363 EX_LD(LOAD_BLK(%o4, %f16))
364 FREG_FROB(f0, f2, f16, f18, f20, f22, f24, f26, f28)
365 EX_ST(STORE_BLK(%f0, %o4 + %g3))
366 FREG_MOVE_2(f28, f30)
367 subcc %g1, 64, %g1
368 add %o4, 64, %o4
369 bne,pt %xcc, 1b
370 LOAD(prefetch, %o4 + 64, #one_read)
371 ba,pt %xcc, 195f
372 nop
373
374180: sub %o4, 8, %g2
375 FREG_LOAD_1(%g2, f0)
3761: EX_ST(STORE_INIT(%g0, %o4 + %g3))
377 EX_LD(LOAD_BLK(%o4, %f16))
378 FREG_FROB(f0, f16, f18, f20, f22, f24, f26, f28, f30)
379 EX_ST(STORE_BLK(%f0, %o4 + %g3))
380 FREG_MOVE_1(f30)
381 subcc %g1, 64, %g1
382 add %o4, 64, %o4
383 bne,pt %xcc, 1b
384 LOAD(prefetch, %o4 + 64, #one_read)
385 ba,pt %xcc, 195f
386 nop
387
388190:
3891: EX_ST(STORE_INIT(%g0, %o4 + %g3))
390 subcc %g1, 64, %g1
391 EX_LD(LOAD_BLK(%o4, %f0))
392 EX_ST(STORE_BLK(%f0, %o4 + %g3))
393 add %o4, 64, %o4
394 bne,pt %xcc, 1b
395 LOAD(prefetch, %o4 + 64, #one_read)
396
397195:
398 add %o4, %g3, %o0
399 membar #Sync
400
401 VISExitHalf
402
403 /* %o2 contains any final bytes still needed to be copied
404 * over. If anything is left, we copy it one byte at a time.
405 */
406 brz,pt %o2, 85f
407 sub %o0, %o1, %o3
408 ba,a,pt %XCC, 90f
409
410 .align 64
41175: /* 16 < len <= 64 */
412 bne,pn %XCC, 75f
413 sub %o0, %o1, %o3
414
41572:
416 andn %o2, 0xf, %o4
417 and %o2, 0xf, %o2
4181: subcc %o4, 0x10, %o4
419 EX_LD(LOAD(ldx, %o1, %o5))
420 add %o1, 0x08, %o1
421 EX_LD(LOAD(ldx, %o1, %g1))
422 sub %o1, 0x08, %o1
423 EX_ST(STORE(stx, %o5, %o1 + %o3))
424 add %o1, 0x8, %o1
425 EX_ST(STORE(stx, %g1, %o1 + %o3))
426 bgu,pt %XCC, 1b
427 add %o1, 0x8, %o1
42873: andcc %o2, 0x8, %g0
429 be,pt %XCC, 1f
430 nop
431 sub %o2, 0x8, %o2
432 EX_LD(LOAD(ldx, %o1, %o5))
433 EX_ST(STORE(stx, %o5, %o1 + %o3))
434 add %o1, 0x8, %o1
4351: andcc %o2, 0x4, %g0
436 be,pt %XCC, 1f
437 nop
438 sub %o2, 0x4, %o2
439 EX_LD(LOAD(lduw, %o1, %o5))
440 EX_ST(STORE(stw, %o5, %o1 + %o3))
441 add %o1, 0x4, %o1
4421: cmp %o2, 0
443 be,pt %XCC, 85f
444 nop
445 ba,pt %xcc, 90f
446 nop
447
44875:
449 andcc %o0, 0x7, %g1
450 sub %g1, 0x8, %g1
451 be,pn %icc, 2f
452 sub %g0, %g1, %g1
453 sub %o2, %g1, %o2
454
4551: subcc %g1, 1, %g1
456 EX_LD(LOAD(ldub, %o1, %o5))
457 EX_ST(STORE(stb, %o5, %o1 + %o3))
458 bgu,pt %icc, 1b
459 add %o1, 1, %o1
460
4612: add %o1, %o3, %o0
462 andcc %o1, 0x7, %g1
463 bne,pt %icc, 8f
464 sll %g1, 3, %g1
465
466 cmp %o2, 16
467 bgeu,pt %icc, 72b
468 nop
469 ba,a,pt %xcc, 73b
470
4718: mov 64, %o3
472 andn %o1, 0x7, %o1
473 EX_LD(LOAD(ldx, %o1, %g2))
474 sub %o3, %g1, %o3
475 andn %o2, 0x7, %o4
476 sllx %g2, %g1, %g2
4771: add %o1, 0x8, %o1
478 EX_LD(LOAD(ldx, %o1, %g3))
479 subcc %o4, 0x8, %o4
480 srlx %g3, %o3, %o5
481 or %o5, %g2, %o5
482 EX_ST(STORE(stx, %o5, %o0))
483 add %o0, 0x8, %o0
484 bgu,pt %icc, 1b
485 sllx %g3, %g1, %g2
486
487 srl %g1, 3, %g1
488 andcc %o2, 0x7, %o2
489 be,pn %icc, 85f
490 add %o1, %g1, %o1
491 ba,pt %xcc, 90f
492 sub %o0, %o1, %o3
493
494 .align 64
49580: /* 0 < len <= 16 */
496 andcc %o3, 0x3, %g0
497 bne,pn %XCC, 90f
498 sub %o0, %o1, %o3
499
5001:
501 subcc %o2, 4, %o2
502 EX_LD(LOAD(lduw, %o1, %g1))
503 EX_ST(STORE(stw, %g1, %o1 + %o3))
504 bgu,pt %XCC, 1b
505 add %o1, 4, %o1
506
50785: retl
508 mov EX_RETVAL(GLOBAL_SPARE), %o0
509
510 .align 32
51190:
512 subcc %o2, 1, %o2
513 EX_LD(LOAD(ldub, %o1, %g1))
514 EX_ST(STORE(stb, %g1, %o1 + %o3))
515 bgu,pt %XCC, 90b
516 add %o1, 1, %o1
517 retl
518 mov EX_RETVAL(GLOBAL_SPARE), %o0
519
520 .size FUNC_NAME, .-FUNC_NAME
diff --git a/arch/sparc64/lib/NG2page.S b/arch/sparc64/lib/NG2page.S
new file mode 100644
index 000000000000..73b6b7c72cbf
--- /dev/null
+++ b/arch/sparc64/lib/NG2page.S
@@ -0,0 +1,61 @@
1/* NG2page.S: Niagara-2 optimized clear and copy page.
2 *
3 * Copyright (C) 2007 (davem@davemloft.net)
4 */
5
6#include <asm/asi.h>
7#include <asm/page.h>
8#include <asm/visasm.h>
9
10 .text
11 .align 32
12
13 /* This is heavily simplified from the sun4u variants
14 * because Niagara-2 does not have any D-cache aliasing issues.
15 */
16NG2copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
17 prefetch [%o1 + 0x00], #one_read
18 prefetch [%o1 + 0x40], #one_read
19 VISEntryHalf
20 set PAGE_SIZE, %g7
21 sub %o0, %o1, %g3
221: stxa %g0, [%o1 + %g3] ASI_BLK_INIT_QUAD_LDD_P
23 subcc %g7, 64, %g7
24 ldda [%o1] ASI_BLK_P, %f0
25 stda %f0, [%o1 + %g3] ASI_BLK_P
26 add %o1, 64, %o1
27 bne,pt %xcc, 1b
28 prefetch [%o1 + 0x40], #one_read
29 membar #Sync
30 VISExitHalf
31 retl
32 nop
33
34#define BRANCH_ALWAYS 0x10680000
35#define NOP 0x01000000
36#define NG_DO_PATCH(OLD, NEW) \
37 sethi %hi(NEW), %g1; \
38 or %g1, %lo(NEW), %g1; \
39 sethi %hi(OLD), %g2; \
40 or %g2, %lo(OLD), %g2; \
41 sub %g1, %g2, %g1; \
42 sethi %hi(BRANCH_ALWAYS), %g3; \
43 sll %g1, 11, %g1; \
44 srl %g1, 11 + 2, %g1; \
45 or %g3, %lo(BRANCH_ALWAYS), %g3; \
46 or %g3, %g1, %g3; \
47 stw %g3, [%g2]; \
48 sethi %hi(NOP), %g3; \
49 or %g3, %lo(NOP), %g3; \
50 stw %g3, [%g2 + 0x4]; \
51 flush %g2;
52
53 .globl niagara2_patch_pageops
54 .type niagara2_patch_pageops,#function
55niagara2_patch_pageops:
56 NG_DO_PATCH(copy_user_page, NG2copy_user_page)
57 NG_DO_PATCH(_clear_page, NGclear_page)
58 NG_DO_PATCH(clear_user_page, NGclear_user_page)
59 retl
60 nop
61 .size niagara2_patch_pageops,.-niagara2_patch_pageops
diff --git a/arch/sparc64/lib/NG2patch.S b/arch/sparc64/lib/NG2patch.S
new file mode 100644
index 000000000000..28c36f06a6d1
--- /dev/null
+++ b/arch/sparc64/lib/NG2patch.S
@@ -0,0 +1,33 @@
1/* NG2patch.S: Patch Ultra-I routines with Niagara-2 variant.
2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */
5
6#define BRANCH_ALWAYS 0x10680000
7#define NOP 0x01000000
8#define NG_DO_PATCH(OLD, NEW) \
9 sethi %hi(NEW), %g1; \
10 or %g1, %lo(NEW), %g1; \
11 sethi %hi(OLD), %g2; \
12 or %g2, %lo(OLD), %g2; \
13 sub %g1, %g2, %g1; \
14 sethi %hi(BRANCH_ALWAYS), %g3; \
15 sll %g1, 11, %g1; \
16 srl %g1, 11 + 2, %g1; \
17 or %g3, %lo(BRANCH_ALWAYS), %g3; \
18 or %g3, %g1, %g3; \
19 stw %g3, [%g2]; \
20 sethi %hi(NOP), %g3; \
21 or %g3, %lo(NOP), %g3; \
22 stw %g3, [%g2 + 0x4]; \
23 flush %g2;
24
25 .globl niagara2_patch_copyops
26 .type niagara2_patch_copyops,#function
27niagara2_patch_copyops:
28 NG_DO_PATCH(memcpy, NG2memcpy)
29 NG_DO_PATCH(___copy_from_user, NG2copy_from_user)
30 NG_DO_PATCH(___copy_to_user, NG2copy_to_user)
31 retl
32 nop
33 .size niagara2_patch_copyops,.-niagara2_patch_copyops
diff --git a/arch/sparc64/lib/NGpage.S b/arch/sparc64/lib/NGpage.S
index 8ce3a0c9c537..428920de05ba 100644
--- a/arch/sparc64/lib/NGpage.S
+++ b/arch/sparc64/lib/NGpage.S
@@ -45,6 +45,7 @@ NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
45 retl 45 retl
46 nop 46 nop
47 47
48 .globl NGclear_page, NGclear_user_page
48NGclear_page: /* %o0=dest */ 49NGclear_page: /* %o0=dest */
49NGclear_user_page: /* %o0=dest, %o1=vaddr */ 50NGclear_user_page: /* %o0=dest, %o1=vaddr */
50 mov 8, %g1 51 mov 8, %g1
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index aff661fe2ee1..0eabe73c964d 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -612,6 +612,8 @@ static int ubd_open_dev(struct ubd *ubd_dev)
612 ubd_dev->fd = fd; 612 ubd_dev->fd = fd;
613 613
614 if(ubd_dev->cow.file != NULL){ 614 if(ubd_dev->cow.file != NULL){
615 blk_queue_max_sectors(ubd_dev->queue, 8 * sizeof(long));
616
615 err = -ENOMEM; 617 err = -ENOMEM;
616 ubd_dev->cow.bitmap = (void *) vmalloc(ubd_dev->cow.bitmap_len); 618 ubd_dev->cow.bitmap = (void *) vmalloc(ubd_dev->cow.bitmap_len);
617 if(ubd_dev->cow.bitmap == NULL){ 619 if(ubd_dev->cow.bitmap == NULL){
@@ -712,8 +714,6 @@ static int ubd_add(int n, char **error_out)
712 ubd_dev->queue->queuedata = ubd_dev; 714 ubd_dev->queue->queuedata = ubd_dev;
713 715
714 blk_queue_max_hw_segments(ubd_dev->queue, MAX_SG); 716 blk_queue_max_hw_segments(ubd_dev->queue, MAX_SG);
715 if(ubd_dev->cow.file != NULL)
716 blk_queue_max_sectors(ubd_dev->queue, 8 * sizeof(long));
717 err = ubd_disk_register(MAJOR_NR, ubd_dev->size, n, &ubd_gendisk[n]); 717 err = ubd_disk_register(MAJOR_NR, ubd_dev->size, n, &ubd_gendisk[n]);
718 if(err){ 718 if(err){
719 *error_out = "Failed to register device"; 719 *error_out = "Failed to register device";
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 128561d3e876..b024e4a86895 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -57,8 +57,8 @@ cflags-y += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
57cflags-y += -maccumulate-outgoing-args 57cflags-y += -maccumulate-outgoing-args
58 58
59# do binutils support CFI? 59# do binutils support CFI?
60cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 60cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
61AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 61AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
62 62
63# is .cfi_signal_frame supported too? 63# is .cfi_signal_frame supported too?
64cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 64cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index e89abcdbdde8..b6167fe3330e 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -345,8 +345,7 @@ NEXT_PAGE(level2_kernel_pgt)
345 /* 40MB kernel mapping. The kernel code cannot be bigger than that. 345 /* 40MB kernel mapping. The kernel code cannot be bigger than that.
346 When you change this change KERNEL_TEXT_SIZE in page.h too. */ 346 When you change this change KERNEL_TEXT_SIZE in page.h too. */
347 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ 347 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */
348 PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, 348 PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, KERNEL_TEXT_SIZE/PMD_SIZE)
349 KERNEL_TEXT_SIZE/PMD_SIZE)
350 /* Module mapping starts here */ 349 /* Module mapping starts here */
351 .fill (PTRS_PER_PMD - (KERNEL_TEXT_SIZE/PMD_SIZE)),8,0 350 .fill (PTRS_PER_PMD - (KERNEL_TEXT_SIZE/PMD_SIZE)),8,0
352 351
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index cb8ee9d02f86..0ec6d2ddb931 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -85,7 +85,7 @@ int __init check_nmi_watchdog (void)
85 int *counts; 85 int *counts;
86 int cpu; 86 int cpu;
87 87
88 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 88 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED))
89 return 0; 89 return 0;
90 90
91 if (!atomic_read(&nmi_active)) 91 if (!atomic_read(&nmi_active))
@@ -442,7 +442,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
442 if (!!old_state == !!nmi_watchdog_enabled) 442 if (!!old_state == !!nmi_watchdog_enabled)
443 return 0; 443 return 0;
444 444
445 if (atomic_read(&nmi_active) < 0) { 445 if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) {
446 printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 446 printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
447 return -EIO; 447 return -EIO;
448 } 448 }
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 05d745ede561..29711445c818 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -82,6 +82,10 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
82 if (dma_mask == 0) 82 if (dma_mask == 0)
83 dma_mask = DMA_32BIT_MASK; 83 dma_mask = DMA_32BIT_MASK;
84 84
85 /* Device not DMA able */
86 if (dev->dma_mask == NULL)
87 return NULL;
88
85 /* Don't invoke OOM killer */ 89 /* Don't invoke OOM killer */
86 gfp |= __GFP_NORETRY; 90 gfp |= __GFP_NORETRY;
87 91