Commit 56d18e99 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus

* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
  MIPS: Return ENOSYS from sys32_syscall on 64bit kernels like elsewhere.
  MIPS: 64-bit: vmsplice needs to use the compat wrapper for o32 and N32.
  MIPS: o32: Fix number of arguments to splice(2).
  MIPS: Malta: Consolidate platform device code.
  MIPS: IP22, Fulong, Malta: Update defconfigs.
  MIPS: Malta: Add back RTC support
  MIPS: Fix potential DOS by untrusted user app.
parents 1cb434b2 c6cb4df9
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -262,14 +262,11 @@ bad_alignment: ...@@ -262,14 +262,11 @@ bad_alignment:
LEAF(sys_syscall) LEAF(sys_syscall)
subu t0, a0, __NR_O32_Linux # check syscall number subu t0, a0, __NR_O32_Linux # check syscall number
sltiu v0, t0, __NR_O32_Linux_syscalls + 1 sltiu v0, t0, __NR_O32_Linux_syscalls + 1
beqz t0, einval # do not recurse
sll t1, t0, 3 sll t1, t0, 3
beqz v0, einval beqz v0, einval
lw t2, sys_call_table(t1) # syscall routine lw t2, sys_call_table(t1) # syscall routine
li v1, 4000 - __NR_O32_Linux # index of sys_syscall
beq t0, v1, einval # do not recurse
/* Some syscalls like execve get their arguments from struct pt_regs /* Some syscalls like execve get their arguments from struct pt_regs
and claim zero arguments in the syscall table. Thus we have to and claim zero arguments in the syscall table. Thus we have to
assume the worst case and shuffle around all potential arguments. assume the worst case and shuffle around all potential arguments.
...@@ -627,7 +624,7 @@ einval: li v0, -ENOSYS ...@@ -627,7 +624,7 @@ einval: li v0, -ENOSYS
sys sys_pselect6 6 sys sys_pselect6 6
sys sys_ppoll 5 sys sys_ppoll 5
sys sys_unshare 1 sys sys_unshare 1
sys sys_splice 4 sys sys_splice 6
sys sys_sync_file_range 7 /* 4305 */ sys sys_sync_file_range 7 /* 4305 */
sys sys_tee 4 sys sys_tee 4
sys sys_vmsplice 4 sys sys_vmsplice 4
......
...@@ -390,7 +390,7 @@ EXPORT(sysn32_call_table) ...@@ -390,7 +390,7 @@ EXPORT(sysn32_call_table)
PTR sys_splice PTR sys_splice
PTR sys_sync_file_range PTR sys_sync_file_range
PTR sys_tee PTR sys_tee
PTR sys_vmsplice /* 6270 */ PTR compat_sys_vmsplice /* 6270 */
PTR sys_move_pages PTR sys_move_pages
PTR compat_sys_set_robust_list PTR compat_sys_set_robust_list
PTR compat_sys_get_robust_list PTR compat_sys_get_robust_list
......
...@@ -174,14 +174,12 @@ not_o32_scall: ...@@ -174,14 +174,12 @@ not_o32_scall:
END(handle_sys) END(handle_sys)
LEAF(sys32_syscall) LEAF(sys32_syscall)
sltu v0, a0, __NR_O32_Linux + __NR_O32_Linux_syscalls + 1 subu t0, a0, __NR_O32_Linux # check syscall number
sltiu v0, t0, __NR_O32_Linux_syscalls + 1
beqz t0, einval # do not recurse
dsll t1, t0, 3
beqz v0, einval beqz v0, einval
ld t2, sys_call_table(t1) # syscall routine
dsll v0, a0, 3
ld t2, (sys_call_table - (__NR_O32_Linux * 8))(v0)
li v1, 4000 # indirect syscall number
beq a0, v1, einval # do not recurse
move a0, a1 # shift argument registers move a0, a1 # shift argument registers
move a1, a2 move a1, a2
...@@ -198,7 +196,7 @@ LEAF(sys32_syscall) ...@@ -198,7 +196,7 @@ LEAF(sys32_syscall)
jr t2 jr t2
/* Unreached */ /* Unreached */
einval: li v0, -EINVAL einval: li v0, -ENOSYS
jr ra jr ra
END(sys32_syscall) END(sys32_syscall)
...@@ -512,7 +510,7 @@ sys_call_table: ...@@ -512,7 +510,7 @@ sys_call_table:
PTR sys_splice PTR sys_splice
PTR sys32_sync_file_range /* 4305 */ PTR sys32_sync_file_range /* 4305 */
PTR sys_tee PTR sys_tee
PTR sys_vmsplice PTR compat_sys_vmsplice
PTR compat_sys_move_pages PTR compat_sys_move_pages
PTR compat_sys_set_robust_list PTR compat_sys_set_robust_list
PTR compat_sys_get_robust_list /* 4310 */ PTR compat_sys_get_robust_list /* 4310 */
......
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
# #
obj-y := malta-amon.o malta-cmdline.o \ obj-y := malta-amon.o malta-cmdline.o \
malta-display.o malta-init.o malta-int.o \ malta-display.o malta-init.o malta-int.o \
malta-memory.o malta-mtd.o \ malta-memory.o malta-platform.o \
malta-platform.o malta-reset.o \ malta-reset.o malta-setup.o malta-time.o
malta-setup.o malta-time.o
obj-$(CONFIG_EARLY_PRINTK) += malta-console.o obj-$(CONFIG_EARLY_PRINTK) += malta-console.o
obj-$(CONFIG_PCI) += malta-pci.o obj-$(CONFIG_PCI) += malta-pci.o
......
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2006 MIPS Technologies, Inc.
* written by Ralf Baechle <ralf@linux-mips.org>
*/
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <mtd/mtd-abi.h>
static struct mtd_partition malta_mtd_partitions[] = {
{
.name = "YAMON",
.offset = 0x0,
.size = 0x100000,
.mask_flags = MTD_WRITEABLE
}, {
.name = "User FS",
.offset = 0x100000,
.size = 0x2e0000
}, {
.name = "Board Config",
.offset = 0x3e0000,
.size = 0x020000,
.mask_flags = MTD_WRITEABLE
}
};
static struct physmap_flash_data malta_flash_data = {
.width = 4,
.nr_parts = ARRAY_SIZE(malta_mtd_partitions),
.parts = malta_mtd_partitions
};
static struct resource malta_flash_resource = {
.start = 0x1e000000,
.end = 0x1e3fffff,
.flags = IORESOURCE_MEM
};
static struct platform_device malta_flash = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &malta_flash_data,
},
.num_resources = 1,
.resource = &malta_flash_resource,
};
static int __init malta_mtd_init(void)
{
platform_device_register(&malta_flash);
return 0;
}
module_init(malta_mtd_init)
...@@ -3,10 +3,14 @@ ...@@ -3,10 +3,14 @@
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
* *
* Copyright (C) 2007 MIPS Technologies, Inc. * Copyright (C) 2006, 07 MIPS Technologies, Inc.
* written by Ralf Baechle (ralf@linux-mips.org) * written by Ralf Baechle (ralf@linux-mips.org)
* written by Ralf Baechle <ralf@linux-mips.org>
* *
* Probe driver for the Malta's UART ports: * Copyright (C) 2008 Wind River Systems, Inc.
* updated by Tiejun Chen <tiejun.chen@windriver.com>
*
* 1. Probe driver for the Malta's UART ports:
* *
* o 2 ports in the SMC SuperIO * o 2 ports in the SMC SuperIO
* o 1 port in the CBUS UART, a discrete 16550 which normally is only used * o 1 port in the CBUS UART, a discrete 16550 which normally is only used
...@@ -14,10 +18,17 @@ ...@@ -14,10 +18,17 @@
* *
* We don't use 8250_platform.c on Malta as it would result in the CBUS * We don't use 8250_platform.c on Malta as it would result in the CBUS
* UART becoming ttyS0. * UART becoming ttyS0.
*
* 2. Register RTC-CMOS platform device on Malta.
*/ */
#include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/mc146818rtc.h>
#include <linux/module.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/platform_device.h>
#include <mtd/mtd-abi.h>
#define SMC_PORT(base, int) \ #define SMC_PORT(base, int) \
{ \ { \
...@@ -45,21 +56,93 @@ static struct plat_serial8250_port uart8250_data[] = { ...@@ -45,21 +56,93 @@ static struct plat_serial8250_port uart8250_data[] = {
{ }, { },
}; };
static struct platform_device uart8250_device = { static struct platform_device malta_uart8250_device = {
.name = "serial8250", .name = "serial8250",
.id = PLAT8250_DEV_PLATFORM2, .id = PLAT8250_DEV_PLATFORM,
.dev = { .dev = {
.platform_data = uart8250_data, .platform_data = uart8250_data,
}, },
}; };
static int __init uart8250_init(void) struct resource malta_rtc_resources[] = {
{
.start = RTC_PORT(0),
.end = RTC_PORT(7),
.flags = IORESOURCE_IO,
}, {
.start = RTC_IRQ,
.end = RTC_IRQ,
.flags = IORESOURCE_IRQ,
}
};
static struct platform_device malta_rtc_device = {
.name = "rtc_cmos",
.id = -1,
.resource = malta_rtc_resources,
.num_resources = ARRAY_SIZE(malta_rtc_resources),
};
static struct mtd_partition malta_mtd_partitions[] = {
{
.name = "YAMON",
.offset = 0x0,
.size = 0x100000,
.mask_flags = MTD_WRITEABLE
}, {
.name = "User FS",
.offset = 0x100000,
.size = 0x2e0000
}, {
.name = "Board Config",
.offset = 0x3e0000,
.size = 0x020000,
.mask_flags = MTD_WRITEABLE
}
};
static struct physmap_flash_data malta_flash_data = {
.width = 4,
.nr_parts = ARRAY_SIZE(malta_mtd_partitions),
.parts = malta_mtd_partitions
};
static struct resource malta_flash_resource = {
.start = 0x1e000000,
.end = 0x1e3fffff,
.flags = IORESOURCE_MEM
};
static struct platform_device malta_flash_device = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &malta_flash_data,
},
.num_resources = 1,
.resource = &malta_flash_resource,
};
static struct platform_device *malta_devices[] __initdata = {
&malta_uart8250_device,
&malta_rtc_device,
&malta_flash_device,
};
static int __init malta_add_devices(void)
{ {
return platform_device_register(&uart8250_device); int err;
}
err = platform_add_devices(malta_devices, ARRAY_SIZE(malta_devices));
if (err)
return err;
module_init(uart8250_init); /*
* Set RTC to BCD mode to support current alarm code.
*/
CMOS_WRITE(CMOS_READ(RTC_CONTROL) & ~RTC_DM_BINARY, RTC_CONTROL);
return 0;
}
MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>"); device_initcall(malta_add_devices);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("8250 UART probe driver for the Malta CBUS UART");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment