aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Kconfig4
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c104
-rw-r--r--arch/sh/drivers/dma/dma-g2.c4
-rw-r--r--arch/sh/drivers/dma/dmabrg.c4
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.c15
-rw-r--r--arch/sh/include/asm/io.h25
-rw-r--r--arch/sh/include/asm/unistd.h37
-rw-r--r--arch/sh/include/asm/unistd_32.h102
-rw-r--r--arch/sh/include/asm/unistd_64.h106
-rw-r--r--arch/sh/include/cpu-sh4/cpu/dma-register.h32
-rw-r--r--arch/sh/include/mach-common/mach/mangle-port.h49
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c20
-rw-r--r--arch/sh/kernel/cpufreq.c121
-rw-r--r--arch/sh/kernel/signal_32.c35
-rw-r--r--arch/sh/kernel/signal_64.c40
-rw-r--r--arch/sh/kernel/syscalls_32.S8
-rw-r--r--arch/sh/kernel/syscalls_64.S8
17 files changed, 383 insertions, 331 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index b190eb17a75b..ff9e033ce626 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -5,6 +5,7 @@ config SUPERH
5 select HAVE_IDE if HAS_IOPORT 5 select HAVE_IDE if HAS_IOPORT
6 select HAVE_MEMBLOCK 6 select HAVE_MEMBLOCK
7 select HAVE_MEMBLOCK_NODE_MAP 7 select HAVE_MEMBLOCK_NODE_MAP
8 select ARCH_DISCARD_MEMBLOCK
8 select HAVE_OPROFILE 9 select HAVE_OPROFILE
9 select HAVE_GENERIC_DMA_COHERENT 10 select HAVE_GENERIC_DMA_COHERENT
10 select HAVE_ARCH_TRACEHOOK 11 select HAVE_ARCH_TRACEHOOK
@@ -161,6 +162,9 @@ config NO_IOPORT
161config IO_TRAPPED 162config IO_TRAPPED
162 bool 163 bool
163 164
165config SWAP_IO_SPACE
166 bool
167
164config DMA_COHERENT 168config DMA_COHERENT
165 bool 169 bool
166 170
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index e5ac12b2ce65..d12fe9ddf3da 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -522,11 +522,18 @@ static void sdhi0_set_pwr(struct platform_device *pdev, int state)
522 gpio_set_value(GPIO_PTB6, state); 522 gpio_set_value(GPIO_PTB6, state);
523} 523}
524 524
525static int sdhi0_get_cd(struct platform_device *pdev)
526{
527 return !gpio_get_value(GPIO_PTY7);
528}
529
525static struct sh_mobile_sdhi_info sdhi0_info = { 530static struct sh_mobile_sdhi_info sdhi0_info = {
526 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 531 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
527 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 532 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
528 .set_pwr = sdhi0_set_pwr, 533 .set_pwr = sdhi0_set_pwr,
529 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD, 534 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
535 MMC_CAP_NEEDS_POLL,
536 .get_cd = sdhi0_get_cd,
530}; 537};
531 538
532static struct resource sdhi0_resources[] = { 539static struct resource sdhi0_resources[] = {
@@ -559,11 +566,18 @@ static void sdhi1_set_pwr(struct platform_device *pdev, int state)
559 gpio_set_value(GPIO_PTB7, state); 566 gpio_set_value(GPIO_PTB7, state);
560} 567}
561 568
569static int sdhi1_get_cd(struct platform_device *pdev)
570{
571 return !gpio_get_value(GPIO_PTW7);
572}
573
562static struct sh_mobile_sdhi_info sdhi1_info = { 574static struct sh_mobile_sdhi_info sdhi1_info = {
563 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 575 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
564 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 576 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
565 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD, 577 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
578 MMC_CAP_NEEDS_POLL,
566 .set_pwr = sdhi1_set_pwr, 579 .set_pwr = sdhi1_set_pwr,
580 .get_cd = sdhi1_get_cd,
567}; 581};
568 582
569static struct resource sdhi1_resources[] = { 583static struct resource sdhi1_resources[] = {
@@ -1001,6 +1015,7 @@ extern char ecovec24_sdram_leave_end;
1001static int __init arch_setup(void) 1015static int __init arch_setup(void)
1002{ 1016{
1003 struct clk *clk; 1017 struct clk *clk;
1018 bool cn12_enabled = false;
1004 1019
1005 /* register board specific self-refresh code */ 1020 /* register board specific self-refresh code */
1006 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF | 1021 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF |
@@ -1201,9 +1216,13 @@ static int __init arch_setup(void)
1201 gpio_direction_input(GPIO_PTR5); 1216 gpio_direction_input(GPIO_PTR5);
1202 gpio_direction_input(GPIO_PTR6); 1217 gpio_direction_input(GPIO_PTR6);
1203 1218
1219 /* SD-card slot CN11 */
1220 /* Card-detect, used on CN11, either with SDHI0 or with SPI */
1221 gpio_request(GPIO_PTY7, NULL);
1222 gpio_direction_input(GPIO_PTY7);
1223
1204#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) 1224#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
1205 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */ 1225 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
1206 gpio_request(GPIO_FN_SDHI0CD, NULL);
1207 gpio_request(GPIO_FN_SDHI0WP, NULL); 1226 gpio_request(GPIO_FN_SDHI0WP, NULL);
1208 gpio_request(GPIO_FN_SDHI0CMD, NULL); 1227 gpio_request(GPIO_FN_SDHI0CMD, NULL);
1209 gpio_request(GPIO_FN_SDHI0CLK, NULL); 1228 gpio_request(GPIO_FN_SDHI0CLK, NULL);
@@ -1213,23 +1232,6 @@ static int __init arch_setup(void)
1213 gpio_request(GPIO_FN_SDHI0D0, NULL); 1232 gpio_request(GPIO_FN_SDHI0D0, NULL);
1214 gpio_request(GPIO_PTB6, NULL); 1233 gpio_request(GPIO_PTB6, NULL);
1215 gpio_direction_output(GPIO_PTB6, 0); 1234 gpio_direction_output(GPIO_PTB6, 0);
1216
1217#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1218 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
1219 gpio_request(GPIO_FN_SDHI1CD, NULL);
1220 gpio_request(GPIO_FN_SDHI1WP, NULL);
1221 gpio_request(GPIO_FN_SDHI1CMD, NULL);
1222 gpio_request(GPIO_FN_SDHI1CLK, NULL);
1223 gpio_request(GPIO_FN_SDHI1D3, NULL);
1224 gpio_request(GPIO_FN_SDHI1D2, NULL);
1225 gpio_request(GPIO_FN_SDHI1D1, NULL);
1226 gpio_request(GPIO_FN_SDHI1D0, NULL);
1227 gpio_request(GPIO_PTB7, NULL);
1228 gpio_direction_output(GPIO_PTB7, 0);
1229
1230 /* I/O buffer drive ability is high for SDHI1 */
1231 __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
1232#endif /* CONFIG_MMC_SH_MMCIF */
1233#else 1235#else
1234 /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */ 1236 /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
1235 gpio_request(GPIO_FN_MSIOF0_TXD, NULL); 1237 gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
@@ -1241,12 +1243,51 @@ static int __init arch_setup(void)
1241 gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */ 1243 gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
1242 gpio_request(GPIO_PTY6, NULL); /* write protect */ 1244 gpio_request(GPIO_PTY6, NULL); /* write protect */
1243 gpio_direction_input(GPIO_PTY6); 1245 gpio_direction_input(GPIO_PTY6);
1244 gpio_request(GPIO_PTY7, NULL); /* card detect */
1245 gpio_direction_input(GPIO_PTY7);
1246 1246
1247 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); 1247 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
1248#endif 1248#endif
1249 1249
1250 /* MMC/SD-card slot CN12 */
1251#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
1252 /* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
1253 gpio_request(GPIO_FN_MMC_D7, NULL);
1254 gpio_request(GPIO_FN_MMC_D6, NULL);
1255 gpio_request(GPIO_FN_MMC_D5, NULL);
1256 gpio_request(GPIO_FN_MMC_D4, NULL);
1257 gpio_request(GPIO_FN_MMC_D3, NULL);
1258 gpio_request(GPIO_FN_MMC_D2, NULL);
1259 gpio_request(GPIO_FN_MMC_D1, NULL);
1260 gpio_request(GPIO_FN_MMC_D0, NULL);
1261 gpio_request(GPIO_FN_MMC_CLK, NULL);
1262 gpio_request(GPIO_FN_MMC_CMD, NULL);
1263 gpio_request(GPIO_PTB7, NULL);
1264 gpio_direction_output(GPIO_PTB7, 0);
1265
1266 cn12_enabled = true;
1267#elif defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
1268 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
1269 gpio_request(GPIO_FN_SDHI1WP, NULL);
1270 gpio_request(GPIO_FN_SDHI1CMD, NULL);
1271 gpio_request(GPIO_FN_SDHI1CLK, NULL);
1272 gpio_request(GPIO_FN_SDHI1D3, NULL);
1273 gpio_request(GPIO_FN_SDHI1D2, NULL);
1274 gpio_request(GPIO_FN_SDHI1D1, NULL);
1275 gpio_request(GPIO_FN_SDHI1D0, NULL);
1276 gpio_request(GPIO_PTB7, NULL);
1277 gpio_direction_output(GPIO_PTB7, 0);
1278
1279 /* Card-detect, used on CN12 with SDHI1 */
1280 gpio_request(GPIO_PTW7, NULL);
1281 gpio_direction_input(GPIO_PTW7);
1282
1283 cn12_enabled = true;
1284#endif
1285
1286 if (cn12_enabled)
1287 /* I/O buffer drive ability is high for CN12 */
1288 __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000,
1289 IODRIVEA);
1290
1250 /* enable Video */ 1291 /* enable Video */
1251 gpio_request(GPIO_PTU2, NULL); 1292 gpio_request(GPIO_PTU2, NULL);
1252 gpio_direction_output(GPIO_PTU2, 1); 1293 gpio_direction_output(GPIO_PTU2, 1);
@@ -1305,25 +1346,6 @@ static int __init arch_setup(void)
1305 gpio_request(GPIO_PTU5, NULL); 1346 gpio_request(GPIO_PTU5, NULL);
1306 gpio_direction_output(GPIO_PTU5, 0); 1347 gpio_direction_output(GPIO_PTU5, 0);
1307 1348
1308#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
1309 /* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
1310 gpio_request(GPIO_FN_MMC_D7, NULL);
1311 gpio_request(GPIO_FN_MMC_D6, NULL);
1312 gpio_request(GPIO_FN_MMC_D5, NULL);
1313 gpio_request(GPIO_FN_MMC_D4, NULL);
1314 gpio_request(GPIO_FN_MMC_D3, NULL);
1315 gpio_request(GPIO_FN_MMC_D2, NULL);
1316 gpio_request(GPIO_FN_MMC_D1, NULL);
1317 gpio_request(GPIO_FN_MMC_D0, NULL);
1318 gpio_request(GPIO_FN_MMC_CLK, NULL);
1319 gpio_request(GPIO_FN_MMC_CMD, NULL);
1320 gpio_request(GPIO_PTB7, NULL);
1321 gpio_direction_output(GPIO_PTB7, 0);
1322
1323 /* I/O buffer drive ability is high for MMCIF */
1324 __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
1325#endif
1326
1327 /* enable I2C device */ 1349 /* enable I2C device */
1328 i2c_register_board_info(0, i2c0_devices, 1350 i2c_register_board_info(0, i2c0_devices,
1329 ARRAY_SIZE(i2c0_devices)); 1351 ARRAY_SIZE(i2c0_devices));
diff --git a/arch/sh/drivers/dma/dma-g2.c b/arch/sh/drivers/dma/dma-g2.c
index be9ca7ca0ce4..e1ab6eb3c04b 100644
--- a/arch/sh/drivers/dma/dma-g2.c
+++ b/arch/sh/drivers/dma/dma-g2.c
@@ -181,14 +181,14 @@ static int __init g2_dma_init(void)
181 181
182 ret = register_dmac(&g2_dma_info); 182 ret = register_dmac(&g2_dma_info);
183 if (unlikely(ret != 0)) 183 if (unlikely(ret != 0))
184 free_irq(HW_EVENT_G2_DMA, 0); 184 free_irq(HW_EVENT_G2_DMA, &g2_dma_info);
185 185
186 return ret; 186 return ret;
187} 187}
188 188
189static void __exit g2_dma_exit(void) 189static void __exit g2_dma_exit(void)
190{ 190{
191 free_irq(HW_EVENT_G2_DMA, 0); 191 free_irq(HW_EVENT_G2_DMA, &g2_dma_info);
192 unregister_dmac(&g2_dma_info); 192 unregister_dmac(&g2_dma_info);
193} 193}
194 194
diff --git a/arch/sh/drivers/dma/dmabrg.c b/arch/sh/drivers/dma/dmabrg.c
index 3d66a32ce610..c0dd904483c7 100644
--- a/arch/sh/drivers/dma/dmabrg.c
+++ b/arch/sh/drivers/dma/dmabrg.c
@@ -189,8 +189,8 @@ static int __init dmabrg_init(void)
189 if (ret == 0) 189 if (ret == 0)
190 return ret; 190 return ret;
191 191
192 free_irq(DMABRGI1, 0); 192 free_irq(DMABRGI1, NULL);
193out1: free_irq(DMABRGI0, 0); 193out1: free_irq(DMABRGI0, NULL);
194out0: kfree(dmabrg_handlers); 194out0: kfree(dmabrg_handlers);
195 return ret; 195 return ret;
196} 196}
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index fb8f14990743..5a6dab6e27d9 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -21,6 +21,13 @@
21#include <asm/mmu.h> 21#include <asm/mmu.h>
22#include <asm/sizes.h> 22#include <asm/sizes.h>
23 23
24#if defined(CONFIG_CPU_BIG_ENDIAN)
25# define PCICR_ENDIANNESS SH4_PCICR_BSWP
26#else
27# define PCICR_ENDIANNESS 0
28#endif
29
30
24static struct resource sh7785_pci_resources[] = { 31static struct resource sh7785_pci_resources[] = {
25 { 32 {
26 .name = "PCI IO", 33 .name = "PCI IO",
@@ -254,7 +261,7 @@ static int __init sh7780_pci_init(void)
254 __raw_writel(PCIECR_ENBL, PCIECR); 261 __raw_writel(PCIECR_ENBL, PCIECR);
255 262
256 /* Reset */ 263 /* Reset */
257 __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_PRST, 264 __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_PRST | PCICR_ENDIANNESS,
258 chan->reg_base + SH4_PCICR); 265 chan->reg_base + SH4_PCICR);
259 266
260 /* 267 /*
@@ -290,7 +297,8 @@ static int __init sh7780_pci_init(void)
290 * Now throw it in to register initialization mode and 297 * Now throw it in to register initialization mode and
291 * start the real work. 298 * start the real work.
292 */ 299 */
293 __raw_writel(SH4_PCICR_PREFIX, chan->reg_base + SH4_PCICR); 300 __raw_writel(SH4_PCICR_PREFIX | PCICR_ENDIANNESS,
301 chan->reg_base + SH4_PCICR);
294 302
295 memphys = __pa(memory_start); 303 memphys = __pa(memory_start);
296 memsize = roundup_pow_of_two(memory_end - memory_start); 304 memsize = roundup_pow_of_two(memory_end - memory_start);
@@ -380,7 +388,8 @@ static int __init sh7780_pci_init(void)
380 * Initialization mode complete, release the control register and 388 * Initialization mode complete, release the control register and
381 * enable round robin mode to stop device overruns/starvation. 389 * enable round robin mode to stop device overruns/starvation.
382 */ 390 */
383 __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO, 391 __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO |
392 PCICR_ENDIANNESS,
384 chan->reg_base + SH4_PCICR); 393 chan->reg_base + SH4_PCICR);
385 394
386 ret = register_pci_controller(chan); 395 ret = register_pci_controller(chan);
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 35fc8b077cb1..ec464a6b95fe 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -23,6 +23,7 @@
23#define __IO_PREFIX generic 23#define __IO_PREFIX generic
24#include <asm/io_generic.h> 24#include <asm/io_generic.h>
25#include <asm/io_trapped.h> 25#include <asm/io_trapped.h>
26#include <mach/mangle-port.h>
26 27
27#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v)) 28#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v))
28#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v)) 29#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v))
@@ -34,21 +35,15 @@
34#define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a)) 35#define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a))
35#define __raw_readq(a) (__chk_io_ptr(a), *(volatile u64 __force *)(a)) 36#define __raw_readq(a) (__chk_io_ptr(a), *(volatile u64 __force *)(a))
36 37
37#define readb_relaxed(c) ({ u8 __v = __raw_readb(c); __v; }) 38#define readb_relaxed(c) ({ u8 __v = ioswabb(__raw_readb(c)); __v; })
38#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16) \ 39#define readw_relaxed(c) ({ u16 __v = ioswabw(__raw_readw(c)); __v; })
39 __raw_readw(c)); __v; }) 40#define readl_relaxed(c) ({ u32 __v = ioswabl(__raw_readl(c)); __v; })
40#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32) \ 41#define readq_relaxed(c) ({ u64 __v = ioswabq(__raw_readq(c)); __v; })
41 __raw_readl(c)); __v; }) 42
42#define readq_relaxed(c) ({ u64 __v = le64_to_cpu((__force __le64) \ 43#define writeb_relaxed(v,c) ((void)__raw_writeb((__force u8)ioswabb(v),c))
43 __raw_readq(c)); __v; }) 44#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)ioswabw(v),c))
44 45#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
45#define writeb_relaxed(v,c) ((void)__raw_writeb(v,c)) 46#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)ioswabq(v),c))
46#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
47 cpu_to_le16(v),c))
48#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
49 cpu_to_le32(v),c))
50#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64) \
51 cpu_to_le64(v),c))
52 47
53#define readb(a) ({ u8 r_ = readb_relaxed(a); rmb(); r_; }) 48#define readb(a) ({ u8 r_ = readb_relaxed(a); rmb(); r_; })
54#define readw(a) ({ u16 r_ = readw_relaxed(a); rmb(); r_; }) 49#define readw(a) ({ u16 r_ = readw_relaxed(a); rmb(); r_; })
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 65be656ead7d..a42a5610a36a 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -1,9 +1,46 @@
1#ifdef __KERNEL__ 1#ifdef __KERNEL__
2# ifdef CONFIG_SUPERH32 2# ifdef CONFIG_SUPERH32
3
3# include "unistd_32.h" 4# include "unistd_32.h"
5# define __ARCH_WANT_SYS_RT_SIGSUSPEND
6
4# else 7# else
5# include "unistd_64.h" 8# include "unistd_64.h"
6# endif 9# endif
10
11# define __ARCH_WANT_IPC_PARSE_VERSION
12# define __ARCH_WANT_OLD_READDIR
13# define __ARCH_WANT_OLD_STAT
14# define __ARCH_WANT_STAT64
15# define __ARCH_WANT_SYS_ALARM
16# define __ARCH_WANT_SYS_GETHOSTNAME
17# define __ARCH_WANT_SYS_IPC
18# define __ARCH_WANT_SYS_PAUSE
19# define __ARCH_WANT_SYS_SGETMASK
20# define __ARCH_WANT_SYS_SIGNAL
21# define __ARCH_WANT_SYS_TIME
22# define __ARCH_WANT_SYS_UTIME
23# define __ARCH_WANT_SYS_WAITPID
24# define __ARCH_WANT_SYS_SOCKETCALL
25# define __ARCH_WANT_SYS_FADVISE64
26# define __ARCH_WANT_SYS_GETPGRP
27# define __ARCH_WANT_SYS_LLSEEK
28# define __ARCH_WANT_SYS_NICE
29# define __ARCH_WANT_SYS_OLD_GETRLIMIT
30# define __ARCH_WANT_SYS_OLD_UNAME
31# define __ARCH_WANT_SYS_OLDUMOUNT
32# define __ARCH_WANT_SYS_SIGPENDING
33# define __ARCH_WANT_SYS_SIGPROCMASK
34# define __ARCH_WANT_SYS_RT_SIGACTION
35
36/*
37 * "Conditional" syscalls
38 *
39 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
40 * but it doesn't work on all toolchains, so we just do it by hand
41 */
42# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
43
7#else 44#else
8# ifdef __SH5__ 45# ifdef __SH5__
9# include "unistd_64.h" 46# include "unistd_64.h"
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index 152b8627a184..72fd1e061006 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -1,5 +1,5 @@
1#ifndef __ASM_SH_UNISTD_H 1#ifndef __ASM_SH_UNISTD_32_H
2#define __ASM_SH_UNISTD_H 2#define __ASM_SH_UNISTD_32_H
3 3
4/* 4/*
5 * Copyright (C) 1999 Niibe Yutaka 5 * Copyright (C) 1999 Niibe Yutaka
@@ -26,7 +26,7 @@
26#define __NR_mknod 14 26#define __NR_mknod 14
27#define __NR_chmod 15 27#define __NR_chmod 15
28#define __NR_lchown 16 28#define __NR_lchown 16
29#define __NR_break 17 29 /* 17 was sys_break */
30#define __NR_oldstat 18 30#define __NR_oldstat 18
31#define __NR_lseek 19 31#define __NR_lseek 19
32#define __NR_getpid 20 32#define __NR_getpid 20
@@ -40,11 +40,11 @@
40#define __NR_oldfstat 28 40#define __NR_oldfstat 28
41#define __NR_pause 29 41#define __NR_pause 29
42#define __NR_utime 30 42#define __NR_utime 30
43#define __NR_stty 31 43 /* 31 was sys_stty */
44#define __NR_gtty 32 44 /* 32 was sys_gtty */
45#define __NR_access 33 45#define __NR_access 33
46#define __NR_nice 34 46#define __NR_nice 34
47#define __NR_ftime 35 47 /* 35 was sys_ftime */
48#define __NR_sync 36 48#define __NR_sync 36
49#define __NR_kill 37 49#define __NR_kill 37
50#define __NR_rename 38 50#define __NR_rename 38
@@ -53,7 +53,7 @@
53#define __NR_dup 41 53#define __NR_dup 41
54#define __NR_pipe 42 54#define __NR_pipe 42
55#define __NR_times 43 55#define __NR_times 43
56#define __NR_prof 44 56 /* 44 was sys_prof */
57#define __NR_brk 45 57#define __NR_brk 45
58#define __NR_setgid 46 58#define __NR_setgid 46
59#define __NR_getgid 47 59#define __NR_getgid 47
@@ -62,13 +62,13 @@
62#define __NR_getegid 50 62#define __NR_getegid 50
63#define __NR_acct 51 63#define __NR_acct 51
64#define __NR_umount2 52 64#define __NR_umount2 52
65#define __NR_lock 53 65 /* 53 was sys_lock */
66#define __NR_ioctl 54 66#define __NR_ioctl 54
67#define __NR_fcntl 55 67#define __NR_fcntl 55
68#define __NR_mpx 56 68 /* 56 was sys_mpx */
69#define __NR_setpgid 57 69#define __NR_setpgid 57
70#define __NR_ulimit 58 70 /* 58 was sys_ulimit */
71#define __NR_oldolduname 59 71 /* 59 was sys_olduname */
72#define __NR_umask 60 72#define __NR_umask 60
73#define __NR_chroot 61 73#define __NR_chroot 61
74#define __NR_ustat 62 74#define __NR_ustat 62
@@ -91,7 +91,7 @@
91#define __NR_settimeofday 79 91#define __NR_settimeofday 79
92#define __NR_getgroups 80 92#define __NR_getgroups 80
93#define __NR_setgroups 81 93#define __NR_setgroups 81
94#define __NR_select 82 94 /* 82 was sys_oldselect */
95#define __NR_symlink 83 95#define __NR_symlink 83
96#define __NR_oldlstat 84 96#define __NR_oldlstat 84
97#define __NR_readlink 85 97#define __NR_readlink 85
@@ -107,10 +107,10 @@
107#define __NR_fchown 95 107#define __NR_fchown 95
108#define __NR_getpriority 96 108#define __NR_getpriority 96
109#define __NR_setpriority 97 109#define __NR_setpriority 97
110#define __NR_profil 98 110 /* 98 was sys_profil */
111#define __NR_statfs 99 111#define __NR_statfs 99
112#define __NR_fstatfs 100 112#define __NR_fstatfs 100
113#define __NR_ioperm 101 113 /* 101 was sys_ioperm */
114#define __NR_socketcall 102 114#define __NR_socketcall 102
115#define __NR_syslog 103 115#define __NR_syslog 103
116#define __NR_setitimer 104 116#define __NR_setitimer 104
@@ -119,10 +119,10 @@
119#define __NR_lstat 107 119#define __NR_lstat 107
120#define __NR_fstat 108 120#define __NR_fstat 108
121#define __NR_olduname 109 121#define __NR_olduname 109
122#define __NR_iopl 110 122 /* 110 was sys_iopl */
123#define __NR_vhangup 111 123#define __NR_vhangup 111
124#define __NR_idle 112 124 /* 112 was sys_idle */
125#define __NR_vm86old 113 125 /* 113 was sys_vm86old */
126#define __NR_wait4 114 126#define __NR_wait4 114
127#define __NR_swapoff 115 127#define __NR_swapoff 115
128#define __NR_sysinfo 116 128#define __NR_sysinfo 116
@@ -136,17 +136,17 @@
136#define __NR_adjtimex 124 136#define __NR_adjtimex 124
137#define __NR_mprotect 125 137#define __NR_mprotect 125
138#define __NR_sigprocmask 126 138#define __NR_sigprocmask 126
139#define __NR_create_module 127 139 /* 127 was sys_create_module */
140#define __NR_init_module 128 140#define __NR_init_module 128
141#define __NR_delete_module 129 141#define __NR_delete_module 129
142#define __NR_get_kernel_syms 130 142 /* 130 was sys_get_kernel_syms */
143#define __NR_quotactl 131 143#define __NR_quotactl 131
144#define __NR_getpgid 132 144#define __NR_getpgid 132
145#define __NR_fchdir 133 145#define __NR_fchdir 133
146#define __NR_bdflush 134 146#define __NR_bdflush 134
147#define __NR_sysfs 135 147#define __NR_sysfs 135
148#define __NR_personality 136 148#define __NR_personality 136
149#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ 149 /* 137 was sys_afs_syscall */
150#define __NR_setfsuid 138 150#define __NR_setfsuid 138
151#define __NR_setfsgid 139 151#define __NR_setfsgid 139
152#define __NR__llseek 140 152#define __NR__llseek 140
@@ -175,8 +175,8 @@
175#define __NR_mremap 163 175#define __NR_mremap 163
176#define __NR_setresuid 164 176#define __NR_setresuid 164
177#define __NR_getresuid 165 177#define __NR_getresuid 165
178#define __NR_vm86 166 178 /* 166 was sys_vm86 */
179#define __NR_query_module 167 179 /* 167 was sys_query_module */
180#define __NR_poll 168 180#define __NR_poll 168
181#define __NR_nfsservctl 169 181#define __NR_nfsservctl 169
182#define __NR_setresgid 170 182#define __NR_setresgid 170
@@ -197,8 +197,8 @@
197#define __NR_capset 185 197#define __NR_capset 185
198#define __NR_sigaltstack 186 198#define __NR_sigaltstack 186
199#define __NR_sendfile 187 199#define __NR_sendfile 187
200#define __NR_streams1 188 /* some people actually want it */ 200 /* 188 reserved for sys_getpmsg */
201#define __NR_streams2 189 /* some people actually want it */ 201 /* 189 reserved for sys_putpmsg */
202#define __NR_vfork 190 202#define __NR_vfork 190
203#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ 203#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
204#define __NR_mmap2 192 204#define __NR_mmap2 192
@@ -231,7 +231,8 @@
231#define __NR_madvise 219 231#define __NR_madvise 219
232#define __NR_getdents64 220 232#define __NR_getdents64 220
233#define __NR_fcntl64 221 233#define __NR_fcntl64 221
234/* 223 is unused */ 234 /* 222 is reserved for tux */
235 /* 223 is unused */
235#define __NR_gettid 224 236#define __NR_gettid 224
236#define __NR_readahead 225 237#define __NR_readahead 225
237#define __NR_setxattr 226 238#define __NR_setxattr 226
@@ -251,15 +252,15 @@
251#define __NR_futex 240 252#define __NR_futex 240
252#define __NR_sched_setaffinity 241 253#define __NR_sched_setaffinity 241
253#define __NR_sched_getaffinity 242 254#define __NR_sched_getaffinity 242
254#define __NR_set_thread_area 243 255 /* 243 is reserved for set_thread_area */
255#define __NR_get_thread_area 244 256 /* 244 is reserved for get_thread_area */
256#define __NR_io_setup 245 257#define __NR_io_setup 245
257#define __NR_io_destroy 246 258#define __NR_io_destroy 246
258#define __NR_io_getevents 247 259#define __NR_io_getevents 247
259#define __NR_io_submit 248 260#define __NR_io_submit 248
260#define __NR_io_cancel 249 261#define __NR_io_cancel 249
261#define __NR_fadvise64 250 262#define __NR_fadvise64 250
262 263 /* 251 is unused */
263#define __NR_exit_group 252 264#define __NR_exit_group 252
264#define __NR_lookup_dcookie 253 265#define __NR_lookup_dcookie 253
265#define __NR_epoll_create 254 266#define __NR_epoll_create 254
@@ -281,7 +282,7 @@
281#define __NR_tgkill 270 282#define __NR_tgkill 270
282#define __NR_utimes 271 283#define __NR_utimes 271
283#define __NR_fadvise64_64 272 284#define __NR_fadvise64_64 272
284#define __NR_vserver 273 285 /* 273 is reserved for vserver */
285#define __NR_mbind 274 286#define __NR_mbind 274
286#define __NR_get_mempolicy 275 287#define __NR_get_mempolicy 275
287#define __NR_set_mempolicy 276 288#define __NR_set_mempolicy 276
@@ -301,7 +302,7 @@
301#define __NR_inotify_init 290 302#define __NR_inotify_init 290
302#define __NR_inotify_add_watch 291 303#define __NR_inotify_add_watch 291
303#define __NR_inotify_rm_watch 292 304#define __NR_inotify_rm_watch 292
304/* 293 is unused */ 305 /* 293 is unused */
305#define __NR_migrate_pages 294 306#define __NR_migrate_pages 294
306#define __NR_openat 295 307#define __NR_openat 295
307#define __NR_mkdirat 296 308#define __NR_mkdirat 296
@@ -380,43 +381,4 @@
380 381
381#define NR_syscalls 367 382#define NR_syscalls 367
382 383
383#ifdef __KERNEL__ 384#endif /* __ASM_SH_UNISTD_32_H */
384
385#define __ARCH_WANT_IPC_PARSE_VERSION
386#define __ARCH_WANT_OLD_READDIR
387#define __ARCH_WANT_OLD_STAT
388#define __ARCH_WANT_STAT64
389#define __ARCH_WANT_SYS_ALARM
390#define __ARCH_WANT_SYS_GETHOSTNAME
391#define __ARCH_WANT_SYS_IPC
392#define __ARCH_WANT_SYS_PAUSE
393#define __ARCH_WANT_SYS_SGETMASK
394#define __ARCH_WANT_SYS_SIGNAL
395#define __ARCH_WANT_SYS_TIME
396#define __ARCH_WANT_SYS_UTIME
397#define __ARCH_WANT_SYS_WAITPID
398#define __ARCH_WANT_SYS_SOCKETCALL
399#define __ARCH_WANT_SYS_FADVISE64
400#define __ARCH_WANT_SYS_GETPGRP
401#define __ARCH_WANT_SYS_LLSEEK
402#define __ARCH_WANT_SYS_NICE
403#define __ARCH_WANT_SYS_OLD_GETRLIMIT
404#define __ARCH_WANT_SYS_OLD_UNAME
405#define __ARCH_WANT_SYS_OLDUMOUNT
406#define __ARCH_WANT_SYS_SIGPENDING
407#define __ARCH_WANT_SYS_SIGPROCMASK
408#define __ARCH_WANT_SYS_RT_SIGACTION
409#define __ARCH_WANT_SYS_RT_SIGSUSPEND
410
411/*
412 * "Conditional" syscalls
413 *
414 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
415 * but it doesn't work on all toolchains, so we just do it by hand
416 */
417#ifndef cond_syscall
418#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
419#endif
420
421#endif /* __KERNEL__ */
422#endif /* __ASM_SH_UNISTD_H */
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index c330c23db5a0..a28edc329692 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -31,7 +31,7 @@
31#define __NR_mknod 14 31#define __NR_mknod 14
32#define __NR_chmod 15 32#define __NR_chmod 15
33#define __NR_lchown 16 33#define __NR_lchown 16
34#define __NR_break 17 34 /* 17 was sys_break */
35#define __NR_oldstat 18 35#define __NR_oldstat 18
36#define __NR_lseek 19 36#define __NR_lseek 19
37#define __NR_getpid 20 37#define __NR_getpid 20
@@ -45,11 +45,11 @@
45#define __NR_oldfstat 28 45#define __NR_oldfstat 28
46#define __NR_pause 29 46#define __NR_pause 29
47#define __NR_utime 30 47#define __NR_utime 30
48#define __NR_stty 31 48 /* 31 was sys_stty */
49#define __NR_gtty 32 49 /* 32 was sys_gtty */
50#define __NR_access 33 50#define __NR_access 33
51#define __NR_nice 34 51#define __NR_nice 34
52#define __NR_ftime 35 52 /* 35 was sys_ftime */
53#define __NR_sync 36 53#define __NR_sync 36
54#define __NR_kill 37 54#define __NR_kill 37
55#define __NR_rename 38 55#define __NR_rename 38
@@ -58,7 +58,7 @@
58#define __NR_dup 41 58#define __NR_dup 41
59#define __NR_pipe 42 59#define __NR_pipe 42
60#define __NR_times 43 60#define __NR_times 43
61#define __NR_prof 44 61 /* 44 was sys_prof */
62#define __NR_brk 45 62#define __NR_brk 45
63#define __NR_setgid 46 63#define __NR_setgid 46
64#define __NR_getgid 47 64#define __NR_getgid 47
@@ -67,13 +67,13 @@
67#define __NR_getegid 50 67#define __NR_getegid 50
68#define __NR_acct 51 68#define __NR_acct 51
69#define __NR_umount2 52 69#define __NR_umount2 52
70#define __NR_lock 53 70 /* 53 was sys_lock */
71#define __NR_ioctl 54 71#define __NR_ioctl 54
72#define __NR_fcntl 55 72#define __NR_fcntl 55
73#define __NR_mpx 56 73 /* 56 was sys_mpx */
74#define __NR_setpgid 57 74#define __NR_setpgid 57
75#define __NR_ulimit 58 75 /* 58 was sys_ulimit */
76#define __NR_oldolduname 59 76 /* 59 was sys_olduname */
77#define __NR_umask 60 77#define __NR_umask 60
78#define __NR_chroot 61 78#define __NR_chroot 61
79#define __NR_ustat 62 79#define __NR_ustat 62
@@ -96,7 +96,7 @@
96#define __NR_settimeofday 79 96#define __NR_settimeofday 79
97#define __NR_getgroups 80 97#define __NR_getgroups 80
98#define __NR_setgroups 81 98#define __NR_setgroups 81
99#define __NR_select 82 99 /* 82 was sys_select */
100#define __NR_symlink 83 100#define __NR_symlink 83
101#define __NR_oldlstat 84 101#define __NR_oldlstat 84
102#define __NR_readlink 85 102#define __NR_readlink 85
@@ -112,10 +112,10 @@
112#define __NR_fchown 95 112#define __NR_fchown 95
113#define __NR_getpriority 96 113#define __NR_getpriority 96
114#define __NR_setpriority 97 114#define __NR_setpriority 97
115#define __NR_profil 98 115 /* 98 was sys_profil */
116#define __NR_statfs 99 116#define __NR_statfs 99
117#define __NR_fstatfs 100 117#define __NR_fstatfs 100
118#define __NR_ioperm 101 118 /* 101 was sys_ioperm */
119#define __NR_socketcall 102 /* old implementation of socket systemcall */ 119#define __NR_socketcall 102 /* old implementation of socket systemcall */
120#define __NR_syslog 103 120#define __NR_syslog 103
121#define __NR_setitimer 104 121#define __NR_setitimer 104
@@ -124,10 +124,10 @@
124#define __NR_lstat 107 124#define __NR_lstat 107
125#define __NR_fstat 108 125#define __NR_fstat 108
126#define __NR_olduname 109 126#define __NR_olduname 109
127#define __NR_iopl 110 127 /* 110 was sys_iopl */
128#define __NR_vhangup 111 128#define __NR_vhangup 111
129#define __NR_idle 112 129 /* 112 was sys_idle */
130#define __NR_vm86old 113 130 /* 113 was sys_vm86old */
131#define __NR_wait4 114 131#define __NR_wait4 114
132#define __NR_swapoff 115 132#define __NR_swapoff 115
133#define __NR_sysinfo 116 133#define __NR_sysinfo 116
@@ -141,17 +141,17 @@
141#define __NR_adjtimex 124 141#define __NR_adjtimex 124
142#define __NR_mprotect 125 142#define __NR_mprotect 125
143#define __NR_sigprocmask 126 143#define __NR_sigprocmask 126
144#define __NR_create_module 127 144 /* 127 was sys_create_module */
145#define __NR_init_module 128 145#define __NR_init_module 128
146#define __NR_delete_module 129 146#define __NR_delete_module 129
147#define __NR_get_kernel_syms 130 147 /* 130 was sys_get_kernel_syms */
148#define __NR_quotactl 131 148#define __NR_quotactl 131
149#define __NR_getpgid 132 149#define __NR_getpgid 132
150#define __NR_fchdir 133 150#define __NR_fchdir 133
151#define __NR_bdflush 134 151#define __NR_bdflush 134
152#define __NR_sysfs 135 152#define __NR_sysfs 135
153#define __NR_personality 136 153#define __NR_personality 136
154#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ 154 /* 137 was sys_afs_syscall */
155#define __NR_setfsuid 138 155#define __NR_setfsuid 138
156#define __NR_setfsgid 139 156#define __NR_setfsgid 139
157#define __NR__llseek 140 157#define __NR__llseek 140
@@ -180,8 +180,8 @@
180#define __NR_mremap 163 180#define __NR_mremap 163
181#define __NR_setresuid 164 181#define __NR_setresuid 164
182#define __NR_getresuid 165 182#define __NR_getresuid 165
183#define __NR_vm86 166 183 /* 166 was sys_vm86 */
184#define __NR_query_module 167 184 /* 167 was sys_query_module */
185#define __NR_poll 168 185#define __NR_poll 168
186#define __NR_nfsservctl 169 186#define __NR_nfsservctl 169
187#define __NR_setresgid 170 187#define __NR_setresgid 170
@@ -202,8 +202,8 @@
202#define __NR_capset 185 202#define __NR_capset 185
203#define __NR_sigaltstack 186 203#define __NR_sigaltstack 186
204#define __NR_sendfile 187 204#define __NR_sendfile 187
205#define __NR_streams1 188 /* some people actually want it */ 205 /* 188 reserved for getpmsg */
206#define __NR_streams2 189 /* some people actually want it */ 206 /* 189 reserved for putpmsg */
207#define __NR_vfork 190 207#define __NR_vfork 190
208#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ 208#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
209#define __NR_mmap2 192 209#define __NR_mmap2 192
@@ -262,16 +262,15 @@
262#define __NR_msgrcv 241 262#define __NR_msgrcv 241
263#define __NR_msgget 242 263#define __NR_msgget 242
264#define __NR_msgctl 243 264#define __NR_msgctl 243
265#if 0 265#define __NR_shmat 244
266#define __NR_shmatcall 244
267#endif
268#define __NR_shmdt 245 266#define __NR_shmdt 245
269#define __NR_shmget 246 267#define __NR_shmget 246
270#define __NR_shmctl 247 268#define __NR_shmctl 247
271 269
272#define __NR_getdents64 248 270#define __NR_getdents64 248
273#define __NR_fcntl64 249 271#define __NR_fcntl64 249
274/* 223 is unused */ 272 /* 250 is reserved for tux */
273 /* 251 is unused */
275#define __NR_gettid 252 274#define __NR_gettid 252
276#define __NR_readahead 253 275#define __NR_readahead 253
277#define __NR_setxattr 254 276#define __NR_setxattr 254
@@ -291,14 +290,15 @@
291#define __NR_futex 268 290#define __NR_futex 268
292#define __NR_sched_setaffinity 269 291#define __NR_sched_setaffinity 269
293#define __NR_sched_getaffinity 270 292#define __NR_sched_getaffinity 270
294#define __NR_set_thread_area 271 293 /* 271 is reserved for set_thread_area */
295#define __NR_get_thread_area 272 294 /* 272 is reserved for get_thread_area */
296#define __NR_io_setup 273 295#define __NR_io_setup 273
297#define __NR_io_destroy 274 296#define __NR_io_destroy 274
298#define __NR_io_getevents 275 297#define __NR_io_getevents 275
299#define __NR_io_submit 276 298#define __NR_io_submit 276
300#define __NR_io_cancel 277 299#define __NR_io_cancel 277
301#define __NR_fadvise64 278 300#define __NR_fadvise64 278
301 /* 279 is unused */
302#define __NR_exit_group 280 302#define __NR_exit_group 280
303 303
304#define __NR_lookup_dcookie 281 304#define __NR_lookup_dcookie 281
@@ -321,17 +321,17 @@
321#define __NR_tgkill 298 321#define __NR_tgkill 298
322#define __NR_utimes 299 322#define __NR_utimes 299
323#define __NR_fadvise64_64 300 323#define __NR_fadvise64_64 300
324#define __NR_vserver 301 324 /* 301 is reserved for vserver */
325#define __NR_mbind 302 325 /* 302 is reserved for mbind */
326#define __NR_get_mempolicy 303 326 /* 303 is reserved for get_mempolicy */
327#define __NR_set_mempolicy 304 327 /* 304 is reserved for set_mempolicy */
328#define __NR_mq_open 305 328#define __NR_mq_open 305
329#define __NR_mq_unlink (__NR_mq_open+1) 329#define __NR_mq_unlink (__NR_mq_open+1)
330#define __NR_mq_timedsend (__NR_mq_open+2) 330#define __NR_mq_timedsend (__NR_mq_open+2)
331#define __NR_mq_timedreceive (__NR_mq_open+3) 331#define __NR_mq_timedreceive (__NR_mq_open+3)
332#define __NR_mq_notify (__NR_mq_open+4) 332#define __NR_mq_notify (__NR_mq_open+4)
333#define __NR_mq_getsetattr (__NR_mq_open+5) 333#define __NR_mq_getsetattr (__NR_mq_open+5)
334#define __NR_kexec_load 311 334 /* 311 is reserved for kexec */
335#define __NR_waitid 312 335#define __NR_waitid 312
336#define __NR_add_key 313 336#define __NR_add_key 313
337#define __NR_request_key 314 337#define __NR_request_key 314
@@ -341,7 +341,7 @@
341#define __NR_inotify_init 318 341#define __NR_inotify_init 318
342#define __NR_inotify_add_watch 319 342#define __NR_inotify_add_watch 319
343#define __NR_inotify_rm_watch 320 343#define __NR_inotify_rm_watch 320
344/* 321 is unused */ 344 /* 321 is unused */
345#define __NR_migrate_pages 322 345#define __NR_migrate_pages 322
346#define __NR_openat 323 346#define __NR_openat 323
347#define __NR_mkdirat 324 347#define __NR_mkdirat 324
@@ -399,44 +399,6 @@
399#define __NR_process_vm_readv 376 399#define __NR_process_vm_readv 376
400#define __NR_process_vm_writev 377 400#define __NR_process_vm_writev 377
401 401
402#ifdef __KERNEL__
403
404#define NR_syscalls 378 402#define NR_syscalls 378
405 403
406#define __ARCH_WANT_IPC_PARSE_VERSION
407#define __ARCH_WANT_OLD_READDIR
408#define __ARCH_WANT_OLD_STAT
409#define __ARCH_WANT_STAT64
410#define __ARCH_WANT_SYS_ALARM
411#define __ARCH_WANT_SYS_GETHOSTNAME
412#define __ARCH_WANT_SYS_IPC
413#define __ARCH_WANT_SYS_PAUSE
414#define __ARCH_WANT_SYS_SGETMASK
415#define __ARCH_WANT_SYS_SIGNAL
416#define __ARCH_WANT_SYS_TIME
417#define __ARCH_WANT_SYS_UTIME
418#define __ARCH_WANT_SYS_WAITPID
419#define __ARCH_WANT_SYS_SOCKETCALL
420#define __ARCH_WANT_SYS_FADVISE64
421#define __ARCH_WANT_SYS_GETPGRP
422#define __ARCH_WANT_SYS_LLSEEK
423#define __ARCH_WANT_SYS_NICE
424#define __ARCH_WANT_SYS_OLD_GETRLIMIT
425#define __ARCH_WANT_SYS_OLD_UNAME
426#define __ARCH_WANT_SYS_OLDUMOUNT
427#define __ARCH_WANT_SYS_SIGPENDING
428#define __ARCH_WANT_SYS_SIGPROCMASK
429#define __ARCH_WANT_SYS_RT_SIGACTION
430
431/*
432 * "Conditional" syscalls
433 *
434 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
435 * but it doesn't work on all toolchains, so we just do it by hand
436 */
437#ifndef cond_syscall
438#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
439#endif
440
441#endif /* __KERNEL__ */
442#endif /* __ASM_SH_UNISTD_64_H */ 404#endif /* __ASM_SH_UNISTD_64_H */
diff --git a/arch/sh/include/cpu-sh4/cpu/dma-register.h b/arch/sh/include/cpu-sh4/cpu/dma-register.h
index 18fa80aba15e..02788b6a03b7 100644
--- a/arch/sh/include/cpu-sh4/cpu/dma-register.h
+++ b/arch/sh/include/cpu-sh4/cpu/dma-register.h
@@ -16,45 +16,29 @@
16 16
17#define DMAOR_INIT DMAOR_DME 17#define DMAOR_INIT DMAOR_DME
18 18
19#if defined(CONFIG_CPU_SUBTYPE_SH7343) || \ 19#if defined(CONFIG_CPU_SUBTYPE_SH7343)
20 defined(CONFIG_CPU_SUBTYPE_SH7730)
21#define CHCR_TS_LOW_MASK 0x00000018 20#define CHCR_TS_LOW_MASK 0x00000018
22#define CHCR_TS_LOW_SHIFT 3 21#define CHCR_TS_LOW_SHIFT 3
23#define CHCR_TS_HIGH_MASK 0 22#define CHCR_TS_HIGH_MASK 0
24#define CHCR_TS_HIGH_SHIFT 0 23#define CHCR_TS_HIGH_SHIFT 0
25#elif defined(CONFIG_CPU_SUBTYPE_SH7722) || \ 24#elif defined(CONFIG_CPU_SUBTYPE_SH7722) || \
25 defined(CONFIG_CPU_SUBTYPE_SH7723) || \
26 defined(CONFIG_CPU_SUBTYPE_SH7724) || \ 26 defined(CONFIG_CPU_SUBTYPE_SH7724) || \
27 defined(CONFIG_CPU_SUBTYPE_SH7730) || \
27 defined(CONFIG_CPU_SUBTYPE_SH7786) 28 defined(CONFIG_CPU_SUBTYPE_SH7786)
28#define CHCR_TS_LOW_MASK 0x00000018 29#define CHCR_TS_LOW_MASK 0x00000018
29#define CHCR_TS_LOW_SHIFT 3 30#define CHCR_TS_LOW_SHIFT 3
30#define CHCR_TS_HIGH_MASK 0x00300000 31#define CHCR_TS_HIGH_MASK 0x00300000
31#define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */ 32#define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */
32#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \ 33#elif defined(CONFIG_CPU_SUBTYPE_SH7757) || \
33 defined(CONFIG_CPU_SUBTYPE_SH7764) 34 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
34#define CHCR_TS_LOW_MASK 0x00000018 35 defined(CONFIG_CPU_SUBTYPE_SH7764) || \
35#define CHCR_TS_LOW_SHIFT 3 36 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
36#define CHCR_TS_HIGH_MASK 0 37 defined(CONFIG_CPU_SUBTYPE_SH7785)
37#define CHCR_TS_HIGH_SHIFT 0
38#elif defined(CONFIG_CPU_SUBTYPE_SH7723)
39#define CHCR_TS_LOW_MASK 0x00000018
40#define CHCR_TS_LOW_SHIFT 3
41#define CHCR_TS_HIGH_MASK 0
42#define CHCR_TS_HIGH_SHIFT 0
43#elif defined(CONFIG_CPU_SUBTYPE_SH7757)
44#define CHCR_TS_LOW_MASK 0x00000018 38#define CHCR_TS_LOW_MASK 0x00000018
45#define CHCR_TS_LOW_SHIFT 3 39#define CHCR_TS_LOW_SHIFT 3
46#define CHCR_TS_HIGH_MASK 0x00100000 40#define CHCR_TS_HIGH_MASK 0x00100000
47#define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */ 41#define CHCR_TS_HIGH_SHIFT (20 - 2) /* 2 bits for shifted low TS */
48#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
49#define CHCR_TS_LOW_MASK 0x00000018
50#define CHCR_TS_LOW_SHIFT 3
51#define CHCR_TS_HIGH_MASK 0
52#define CHCR_TS_HIGH_SHIFT 0
53#else /* SH7785 */
54#define CHCR_TS_LOW_MASK 0x00000018
55#define CHCR_TS_LOW_SHIFT 3
56#define CHCR_TS_HIGH_MASK 0
57#define CHCR_TS_HIGH_SHIFT 0
58#endif 42#endif
59 43
60/* Transmit sizes and respective CHCR register values */ 44/* Transmit sizes and respective CHCR register values */
diff --git a/arch/sh/include/mach-common/mach/mangle-port.h b/arch/sh/include/mach-common/mach/mangle-port.h
new file mode 100644
index 000000000000..4ca1769a0f12
--- /dev/null
+++ b/arch/sh/include/mach-common/mach/mangle-port.h
@@ -0,0 +1,49 @@
1/*
2 * SH version cribbed from the MIPS copy:
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2003, 2004 Ralf Baechle
9 */
10#ifndef __MACH_COMMON_MANGLE_PORT_H
11#define __MACH_COMMON_MANGLE_PORT_H
12
13/*
14 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
15 * less sane hardware forces software to fiddle with this...
16 *
17 * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
18 * you can't have the numerical value of data and byte addresses within
19 * multibyte quantities both preserved at the same time. Hence two
20 * variations of functions: non-prefixed ones that preserve the value
21 * and prefixed ones that preserve byte addresses. The latters are
22 * typically used for moving raw data between a peripheral and memory (cf.
23 * string I/O functions), hence the "__mem_" prefix.
24 */
25#if defined(CONFIG_SWAP_IO_SPACE)
26
27# define ioswabb(x) (x)
28# define __mem_ioswabb(x) (x)
29# define ioswabw(x) le16_to_cpu(x)
30# define __mem_ioswabw(x) (x)
31# define ioswabl(x) le32_to_cpu(x)
32# define __mem_ioswabl(x) (x)
33# define ioswabq(x) le64_to_cpu(x)
34# define __mem_ioswabq(x) (x)
35
36#else
37
38# define ioswabb(x) (x)
39# define __mem_ioswabb(x) (x)
40# define ioswabw(x) (x)
41# define __mem_ioswabw(x) cpu_to_le16(x)
42# define ioswabl(x) (x)
43# define __mem_ioswabl(x) cpu_to_le32(x)
44# define ioswabq(x) (x)
45# define __mem_ioswabq(x) cpu_to_le32(x)
46
47#endif
48
49#endif /* __MACH_COMMON_MANGLE_PORT_H */
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 2875e8be4f72..c8836cffa216 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -680,6 +680,25 @@ static struct platform_device spi1_device = {
680 .resource = spi1_resources, 680 .resource = spi1_resources,
681}; 681};
682 682
683static struct resource rspi_resources[] = {
684 {
685 .start = 0xfe480000,
686 .end = 0xfe4800ff,
687 .flags = IORESOURCE_MEM,
688 },
689 {
690 .start = 220,
691 .flags = IORESOURCE_IRQ,
692 },
693};
694
695static struct platform_device rspi_device = {
696 .name = "rspi",
697 .id = 2,
698 .num_resources = ARRAY_SIZE(rspi_resources),
699 .resource = rspi_resources,
700};
701
683static struct resource usb_ehci_resources[] = { 702static struct resource usb_ehci_resources[] = {
684 [0] = { 703 [0] = {
685 .start = 0xfe4f1000, 704 .start = 0xfe4f1000,
@@ -740,6 +759,7 @@ static struct platform_device *sh7757_devices[] __initdata = {
740 &dma3_device, 759 &dma3_device,
741 &spi0_device, 760 &spi0_device,
742 &spi1_device, 761 &spi1_device,
762 &rspi_device,
743 &usb_ehci_device, 763 &usb_ehci_device,
744 &usb_ohci_device, 764 &usb_ohci_device,
745}; 765};
diff --git a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c
index 0fffacea6ed9..e68b45b6f3f9 100644
--- a/arch/sh/kernel/cpufreq.c
+++ b/arch/sh/kernel/cpufreq.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * cpufreq driver for the SuperH processors. 4 * cpufreq driver for the SuperH processors.
5 * 5 *
6 * Copyright (C) 2002 - 2007 Paul Mundt 6 * Copyright (C) 2002 - 2012 Paul Mundt
7 * Copyright (C) 2002 M. R. Brown 7 * Copyright (C) 2002 M. R. Brown
8 * 8 *
9 * Clock framework bits from arch/avr32/mach-at32ap/cpufreq.c 9 * Clock framework bits from arch/avr32/mach-at32ap/cpufreq.c
@@ -14,6 +14,8 @@
14 * License. See the file "COPYING" in the main directory of this archive 14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details. 15 * for more details.
16 */ 16 */
17#define pr_fmt(fmt) "cpufreq: " fmt
18
17#include <linux/types.h> 19#include <linux/types.h>
18#include <linux/cpufreq.h> 20#include <linux/cpufreq.h>
19#include <linux/kernel.h> 21#include <linux/kernel.h>
@@ -21,15 +23,18 @@
21#include <linux/init.h> 23#include <linux/init.h>
22#include <linux/err.h> 24#include <linux/err.h>
23#include <linux/cpumask.h> 25#include <linux/cpumask.h>
26#include <linux/cpu.h>
24#include <linux/smp.h> 27#include <linux/smp.h>
25#include <linux/sched.h> /* set_cpus_allowed() */ 28#include <linux/sched.h> /* set_cpus_allowed() */
26#include <linux/clk.h> 29#include <linux/clk.h>
30#include <linux/percpu.h>
31#include <linux/sh_clk.h>
27 32
28static struct clk *cpuclk; 33static DEFINE_PER_CPU(struct clk, sh_cpuclk);
29 34
30static unsigned int sh_cpufreq_get(unsigned int cpu) 35static unsigned int sh_cpufreq_get(unsigned int cpu)
31{ 36{
32 return (clk_get_rate(cpuclk) + 500) / 1000; 37 return (clk_get_rate(&per_cpu(sh_cpuclk, cpu)) + 500) / 1000;
33} 38}
34 39
35/* 40/*
@@ -40,8 +45,10 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
40 unsigned int relation) 45 unsigned int relation)
41{ 46{
42 unsigned int cpu = policy->cpu; 47 unsigned int cpu = policy->cpu;
48 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
43 cpumask_t cpus_allowed; 49 cpumask_t cpus_allowed;
44 struct cpufreq_freqs freqs; 50 struct cpufreq_freqs freqs;
51 struct device *dev;
45 long freq; 52 long freq;
46 53
47 if (!cpu_online(cpu)) 54 if (!cpu_online(cpu))
@@ -52,13 +59,15 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
52 59
53 BUG_ON(smp_processor_id() != cpu); 60 BUG_ON(smp_processor_id() != cpu);
54 61
62 dev = get_cpu_device(cpu);
63
55 /* Convert target_freq from kHz to Hz */ 64 /* Convert target_freq from kHz to Hz */
56 freq = clk_round_rate(cpuclk, target_freq * 1000); 65 freq = clk_round_rate(cpuclk, target_freq * 1000);
57 66
58 if (freq < (policy->min * 1000) || freq > (policy->max * 1000)) 67 if (freq < (policy->min * 1000) || freq > (policy->max * 1000))
59 return -EINVAL; 68 return -EINVAL;
60 69
61 pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000); 70 dev_dbg(dev, "requested frequency %u Hz\n", target_freq * 1000);
62 71
63 freqs.cpu = cpu; 72 freqs.cpu = cpu;
64 freqs.old = sh_cpufreq_get(cpu); 73 freqs.old = sh_cpufreq_get(cpu);
@@ -70,78 +79,112 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
70 clk_set_rate(cpuclk, freq); 79 clk_set_rate(cpuclk, freq);
71 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 80 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
72 81
73 pr_debug("cpufreq: set frequency %lu Hz\n", freq); 82 dev_dbg(dev, "set frequency %lu Hz\n", freq);
83
84 return 0;
85}
86
87static int sh_cpufreq_verify(struct cpufreq_policy *policy)
88{
89 struct clk *cpuclk = &per_cpu(sh_cpuclk, policy->cpu);
90 struct cpufreq_frequency_table *freq_table;
91
92 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;
93 if (freq_table)
94 return cpufreq_frequency_table_verify(policy, freq_table);
95
96 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
97 policy->cpuinfo.max_freq);
98
99 policy->min = (clk_round_rate(cpuclk, 1) + 500) / 1000;
100 policy->max = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
101
102 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
103 policy->cpuinfo.max_freq);
74 104
75 return 0; 105 return 0;
76} 106}
77 107
78static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy) 108static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
79{ 109{
80 if (!cpu_online(policy->cpu)) 110 unsigned int cpu = policy->cpu;
111 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
112 struct cpufreq_frequency_table *freq_table;
113 struct device *dev;
114
115 if (!cpu_online(cpu))
81 return -ENODEV; 116 return -ENODEV;
82 117
83 cpuclk = clk_get(NULL, "cpu_clk"); 118 dev = get_cpu_device(cpu);
119
120 cpuclk = clk_get(dev, "cpu_clk");
84 if (IS_ERR(cpuclk)) { 121 if (IS_ERR(cpuclk)) {
85 printk(KERN_ERR "cpufreq: couldn't get CPU#%d clk\n", 122 dev_err(dev, "couldn't get CPU clk\n");
86 policy->cpu);
87 return PTR_ERR(cpuclk); 123 return PTR_ERR(cpuclk);
88 } 124 }
89 125
90 /* cpuinfo and default policy values */ 126 policy->cur = policy->min = policy->max = sh_cpufreq_get(cpu);
91 policy->cpuinfo.min_freq = (clk_round_rate(cpuclk, 1) + 500) / 1000;
92 policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
93 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
94 127
95 policy->cur = sh_cpufreq_get(policy->cpu); 128 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;
96 policy->min = policy->cpuinfo.min_freq; 129 if (freq_table) {
97 policy->max = policy->cpuinfo.max_freq; 130 int result;
98 131
99 /* 132 result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
100 * Catch the cases where the clock framework hasn't been wired up 133 if (!result)
101 * properly to support scaling. 134 cpufreq_frequency_table_get_attr(freq_table, cpu);
102 */ 135 } else {
103 if (unlikely(policy->min == policy->max)) { 136 dev_notice(dev, "no frequency table found, falling back "
104 printk(KERN_ERR "cpufreq: clock framework rate rounding " 137 "to rate rounding.\n");
105 "not supported on CPU#%d.\n", policy->cpu);
106 138
107 clk_put(cpuclk); 139 policy->cpuinfo.min_freq =
108 return -EINVAL; 140 (clk_round_rate(cpuclk, 1) + 500) / 1000;
141 policy->cpuinfo.max_freq =
142 (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
109 } 143 }
110 144
111 printk(KERN_INFO "cpufreq: CPU#%d Frequencies - Minimum %u.%03u MHz, " 145 policy->min = policy->cpuinfo.min_freq;
146 policy->max = policy->cpuinfo.max_freq;
147
148 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
149
150 dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, "
112 "Maximum %u.%03u MHz.\n", 151 "Maximum %u.%03u MHz.\n",
113 policy->cpu, policy->min / 1000, policy->min % 1000, 152 policy->min / 1000, policy->min % 1000,
114 policy->max / 1000, policy->max % 1000); 153 policy->max / 1000, policy->max % 1000);
115 154
116 return 0; 155 return 0;
117} 156}
118 157
119static int sh_cpufreq_verify(struct cpufreq_policy *policy) 158static int sh_cpufreq_cpu_exit(struct cpufreq_policy *policy)
120{ 159{
121 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, 160 unsigned int cpu = policy->cpu;
122 policy->cpuinfo.max_freq); 161 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
123 return 0;
124}
125 162
126static int sh_cpufreq_exit(struct cpufreq_policy *policy) 163 cpufreq_frequency_table_put_attr(cpu);
127{
128 clk_put(cpuclk); 164 clk_put(cpuclk);
165
129 return 0; 166 return 0;
130} 167}
131 168
169static struct freq_attr *sh_freq_attr[] = {
170 &cpufreq_freq_attr_scaling_available_freqs,
171 NULL,
172};
173
132static struct cpufreq_driver sh_cpufreq_driver = { 174static struct cpufreq_driver sh_cpufreq_driver = {
133 .owner = THIS_MODULE, 175 .owner = THIS_MODULE,
134 .name = "sh", 176 .name = "sh",
135 .init = sh_cpufreq_cpu_init,
136 .verify = sh_cpufreq_verify,
137 .target = sh_cpufreq_target,
138 .get = sh_cpufreq_get, 177 .get = sh_cpufreq_get,
139 .exit = sh_cpufreq_exit, 178 .target = sh_cpufreq_target,
179 .verify = sh_cpufreq_verify,
180 .init = sh_cpufreq_cpu_init,
181 .exit = sh_cpufreq_cpu_exit,
182 .attr = sh_freq_attr,
140}; 183};
141 184
142static int __init sh_cpufreq_module_init(void) 185static int __init sh_cpufreq_module_init(void)
143{ 186{
144 printk(KERN_INFO "cpufreq: SuperH CPU frequency driver.\n"); 187 pr_notice("SuperH CPU frequency driver.\n");
145 return cpufreq_register_driver(&sh_cpufreq_driver); 188 return cpufreq_register_driver(&sh_cpufreq_driver);
146} 189}
147 190
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 0bc58866add1..5901fba3176e 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -57,12 +57,13 @@ sys_sigsuspend(old_sigset_t mask,
57 unsigned long r5, unsigned long r6, unsigned long r7, 57 unsigned long r5, unsigned long r6, unsigned long r7,
58 struct pt_regs __regs) 58 struct pt_regs __regs)
59{ 59{
60 mask &= _BLOCKABLE; 60 sigset_t blocked;
61 spin_lock_irq(&current->sighand->siglock); 61
62 current->saved_sigmask = current->blocked; 62 current->saved_sigmask = current->blocked;
63 siginitset(&current->blocked, mask); 63
64 recalc_sigpending(); 64 mask &= _BLOCKABLE;
65 spin_unlock_irq(&current->sighand->siglock); 65 siginitset(&blocked, mask);
66 set_current_blocked(&blocked);
66 67
67 current->state = TASK_INTERRUPTIBLE; 68 current->state = TASK_INTERRUPTIBLE;
68 schedule(); 69 schedule();
@@ -239,11 +240,7 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
239 goto badframe; 240 goto badframe;
240 241
241 sigdelsetmask(&set, ~_BLOCKABLE); 242 sigdelsetmask(&set, ~_BLOCKABLE);
242 243 set_current_blocked(&set);
243 spin_lock_irq(&current->sighand->siglock);
244 current->blocked = set;
245 recalc_sigpending();
246 spin_unlock_irq(&current->sighand->siglock);
247 244
248 if (restore_sigcontext(regs, &frame->sc, &r0)) 245 if (restore_sigcontext(regs, &frame->sc, &r0))
249 goto badframe; 246 goto badframe;
@@ -273,10 +270,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
273 goto badframe; 270 goto badframe;
274 271
275 sigdelsetmask(&set, ~_BLOCKABLE); 272 sigdelsetmask(&set, ~_BLOCKABLE);
276 spin_lock_irq(&current->sighand->siglock); 273 set_current_blocked(&set);
277 current->blocked = set;
278 recalc_sigpending();
279 spin_unlock_irq(&current->sighand->siglock);
280 274
281 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) 275 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
282 goto badframe; 276 goto badframe;
@@ -547,17 +541,8 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
547 else 541 else
548 ret = setup_frame(sig, ka, oldset, regs); 542 ret = setup_frame(sig, ka, oldset, regs);
549 543
550 if (ka->sa.sa_flags & SA_ONESHOT) 544 if (ret == 0)
551 ka->sa.sa_handler = SIG_DFL; 545 block_sigmask(ka, sig);
552
553 if (ret == 0) {
554 spin_lock_irq(&current->sighand->siglock);
555 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
556 if (!(ka->sa.sa_flags & SA_NODEFER))
557 sigaddset(&current->blocked,sig);
558 recalc_sigpending();
559 spin_unlock_irq(&current->sighand->siglock);
560 }
561 546
562 return ret; 547 return ret;
563} 548}
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index 6b5603fe274b..3c9a6f7dcdce 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -159,14 +159,13 @@ sys_sigsuspend(old_sigset_t mask,
159 unsigned long r6, unsigned long r7, 159 unsigned long r6, unsigned long r7,
160 struct pt_regs * regs) 160 struct pt_regs * regs)
161{ 161{
162 sigset_t saveset; 162 sigset_t saveset, blocked;
163 163
164 mask &= _BLOCKABLE;
165 spin_lock_irq(&current->sighand->siglock);
166 saveset = current->blocked; 164 saveset = current->blocked;
167 siginitset(&current->blocked, mask); 165
168 recalc_sigpending(); 166 mask &= _BLOCKABLE;
169 spin_unlock_irq(&current->sighand->siglock); 167 siginitset(&blocked, mask);
168 set_current_blocked(&blocked);
170 169
171 REF_REG_RET = -EINTR; 170 REF_REG_RET = -EINTR;
172 while (1) { 171 while (1) {
@@ -198,11 +197,8 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
198 if (copy_from_user(&newset, unewset, sizeof(newset))) 197 if (copy_from_user(&newset, unewset, sizeof(newset)))
199 return -EFAULT; 198 return -EFAULT;
200 sigdelsetmask(&newset, ~_BLOCKABLE); 199 sigdelsetmask(&newset, ~_BLOCKABLE);
201 spin_lock_irq(&current->sighand->siglock);
202 saveset = current->blocked; 200 saveset = current->blocked;
203 current->blocked = newset; 201 set_current_blocked(&newset);
204 recalc_sigpending();
205 spin_unlock_irq(&current->sighand->siglock);
206 202
207 REF_REG_RET = -EINTR; 203 REF_REG_RET = -EINTR;
208 while (1) { 204 while (1) {
@@ -408,11 +404,7 @@ asmlinkage int sys_sigreturn(unsigned long r2, unsigned long r3,
408 goto badframe; 404 goto badframe;
409 405
410 sigdelsetmask(&set, ~_BLOCKABLE); 406 sigdelsetmask(&set, ~_BLOCKABLE);
411 407 set_current_blocked(&set);
412 spin_lock_irq(&current->sighand->siglock);
413 current->blocked = set;
414 recalc_sigpending();
415 spin_unlock_irq(&current->sighand->siglock);
416 408
417 if (restore_sigcontext(regs, &frame->sc, &ret)) 409 if (restore_sigcontext(regs, &frame->sc, &ret))
418 goto badframe; 410 goto badframe;
@@ -445,10 +437,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3,
445 goto badframe; 437 goto badframe;
446 438
447 sigdelsetmask(&set, ~_BLOCKABLE); 439 sigdelsetmask(&set, ~_BLOCKABLE);
448 spin_lock_irq(&current->sighand->siglock); 440 set_current_blocked(&set);
449 current->blocked = set;
450 recalc_sigpending();
451 spin_unlock_irq(&current->sighand->siglock);
452 441
453 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ret)) 442 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ret))
454 goto badframe; 443 goto badframe;
@@ -734,17 +723,8 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
734 else 723 else
735 ret = setup_frame(sig, ka, oldset, regs); 724 ret = setup_frame(sig, ka, oldset, regs);
736 725
737 if (ka->sa.sa_flags & SA_ONESHOT) 726 if (ret == 0)
738 ka->sa.sa_handler = SIG_DFL; 727 block_sigmask(ka, sig);
739
740 if (ret == 0) {
741 spin_lock_irq(&current->sighand->siglock);
742 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
743 if (!(ka->sa.sa_flags & SA_NODEFER))
744 sigaddset(&current->blocked,sig);
745 recalc_sigpending();
746 spin_unlock_irq(&current->sighand->siglock);
747 }
748 728
749 return ret; 729 return ret;
750} 730}
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index ee56a9b1a981..4b68f0f79761 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -204,8 +204,8 @@ ENTRY(sys_call_table)
204 .long sys_capset /* 185 */ 204 .long sys_capset /* 185 */
205 .long sys_sigaltstack 205 .long sys_sigaltstack
206 .long sys_sendfile 206 .long sys_sendfile
207 .long sys_ni_syscall /* streams1 */ 207 .long sys_ni_syscall /* getpmsg */
208 .long sys_ni_syscall /* streams2 */ 208 .long sys_ni_syscall /* putpmsg */
209 .long sys_vfork /* 190 */ 209 .long sys_vfork /* 190 */
210 .long sys_getrlimit 210 .long sys_getrlimit
211 .long sys_mmap2 211 .long sys_mmap2
@@ -259,8 +259,8 @@ ENTRY(sys_call_table)
259 .long sys_futex /* 240 */ 259 .long sys_futex /* 240 */
260 .long sys_sched_setaffinity 260 .long sys_sched_setaffinity
261 .long sys_sched_getaffinity 261 .long sys_sched_getaffinity
262 .long sys_ni_syscall 262 .long sys_ni_syscall /* reserved for set_thread_area */
263 .long sys_ni_syscall 263 .long sys_ni_syscall /* reserved for get_thread_area */
264 .long sys_io_setup /* 245 */ 264 .long sys_io_setup /* 245 */
265 .long sys_io_destroy 265 .long sys_io_destroy
266 .long sys_io_getevents 266 .long sys_io_getevents
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 9af7de26fb71..0956345b36ef 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -208,8 +208,8 @@ sys_call_table:
208 .long sys_capset /* 185 */ 208 .long sys_capset /* 185 */
209 .long sys_sigaltstack 209 .long sys_sigaltstack
210 .long sys_sendfile 210 .long sys_sendfile
211 .long sys_ni_syscall /* streams1 */ 211 .long sys_ni_syscall /* getpmsg */
212 .long sys_ni_syscall /* streams2 */ 212 .long sys_ni_syscall /* putpmsg */
213 .long sys_vfork /* 190 */ 213 .long sys_vfork /* 190 */
214 .long sys_getrlimit 214 .long sys_getrlimit
215 .long sys_mmap2 215 .long sys_mmap2
@@ -296,8 +296,8 @@ sys_call_table:
296 .long sys_futex 296 .long sys_futex
297 .long sys_sched_setaffinity 297 .long sys_sched_setaffinity
298 .long sys_sched_getaffinity /* 270 */ 298 .long sys_sched_getaffinity /* 270 */
299 .long sys_ni_syscall 299 .long sys_ni_syscall /* reserved for set_thread_area */
300 .long sys_ni_syscall 300 .long sys_ni_syscall /* reserved for get_thread_area */
301 .long sys_io_setup 301 .long sys_io_setup
302 .long sys_io_destroy 302 .long sys_io_destroy
303 .long sys_io_getevents /* 275 */ 303 .long sys_io_getevents /* 275 */