Skip to content

Commit

Permalink
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
Linus Torvalds committed Dec 5, 2008
2 parents 1cb434b + c6cb4df commit 56d18e9
Show file tree
Hide file tree
Showing 9 changed files with 1,405 additions and 865 deletions.
921 changes: 537 additions & 384 deletions arch/mips/configs/fulong_defconfig

Large diffs are not rendered by default.

518 changes: 339 additions & 179 deletions arch/mips/configs/ip22_defconfig

Large diffs are not rendered by default.

631 changes: 422 additions & 209 deletions arch/mips/configs/malta_defconfig

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions arch/mips/kernel/scall32-o32.S
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,11 @@ bad_alignment:
LEAF(sys_syscall)
subu t0, a0, __NR_O32_Linux # check syscall number
sltiu v0, t0, __NR_O32_Linux_syscalls + 1
beqz t0, einval # do not recurse
sll t1, t0, 3
beqz v0, einval

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
and claim zero arguments in the syscall table. Thus we have to
assume the worst case and shuffle around all potential arguments.
Expand Down Expand Up @@ -627,7 +624,7 @@ einval: li v0, -ENOSYS
sys sys_pselect6 6
sys sys_ppoll 5
sys sys_unshare 1
sys sys_splice 4
sys sys_splice 6
sys sys_sync_file_range 7 /* 4305 */
sys sys_tee 4
sys sys_vmsplice 4
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/scall64-n32.S
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ EXPORT(sysn32_call_table)
PTR sys_splice
PTR sys_sync_file_range
PTR sys_tee
PTR sys_vmsplice /* 6270 */
PTR compat_sys_vmsplice /* 6270 */
PTR sys_move_pages
PTR compat_sys_set_robust_list
PTR compat_sys_get_robust_list
Expand Down
16 changes: 7 additions & 9 deletions arch/mips/kernel/scall64-o32.S
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,12 @@ not_o32_scall:
END(handle_sys)

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

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
ld t2, sys_call_table(t1) # syscall routine

move a0, a1 # shift argument registers
move a1, a2
Expand All @@ -198,7 +196,7 @@ LEAF(sys32_syscall)
jr t2
/* Unreached */

einval: li v0, -EINVAL
einval: li v0, -ENOSYS
jr ra
END(sys32_syscall)

Expand Down Expand Up @@ -512,7 +510,7 @@ sys_call_table:
PTR sys_splice
PTR sys32_sync_file_range /* 4305 */
PTR sys_tee
PTR sys_vmsplice
PTR compat_sys_vmsplice
PTR compat_sys_move_pages
PTR compat_sys_set_robust_list
PTR compat_sys_get_robust_list /* 4310 */
Expand Down
5 changes: 2 additions & 3 deletions arch/mips/mti-malta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
#
obj-y := malta-amon.o malta-cmdline.o \
malta-display.o malta-init.o malta-int.o \
malta-memory.o malta-mtd.o \
malta-platform.o malta-reset.o \
malta-setup.o malta-time.o
malta-memory.o malta-platform.o \
malta-reset.o malta-setup.o malta-time.o

obj-$(CONFIG_EARLY_PRINTK) += malta-console.o
obj-$(CONFIG_PCI) += malta-pci.o
Expand Down
63 changes: 0 additions & 63 deletions arch/mips/mti-malta/malta-mtd.c

This file was deleted.

107 changes: 95 additions & 12 deletions arch/mips/mti-malta/malta-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,32 @@
* License. See the file "COPYING" in the main directory of this archive
* 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>
*
* 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 1 port in the CBUS UART, a discrete 16550 which normally is only used
* for bringups.
*
* We don't use 8250_platform.c on Malta as it would result in the CBUS
* UART becoming ttyS0.
*
* 2. Register RTC-CMOS platform device on Malta.
*/
#include <linux/module.h>
#include <linux/init.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) \
{ \
Expand Down Expand Up @@ -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",
.id = PLAT8250_DEV_PLATFORM2,
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.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;

module_init(uart8250_init);
err = platform_add_devices(malta_devices, ARRAY_SIZE(malta_devices));
if (err)
return err;

/*
* 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>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("8250 UART probe driver for the Malta CBUS UART");
device_initcall(malta_add_devices);

0 comments on commit 56d18e9

Please sign in to comment.