Commit 68a4ec9c authored by Linus Torvalds's avatar Linus Torvalds

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

* 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus: (28 commits)
  MIPS: Add a CONFIG_FORCE_MAX_ZONEORDER Kconfig option.
  MIPS: LD/SD o32 macro GAS fix update
  MIPS: Alchemy: fix build with SERIAL_8250=n
  MIPS: Rename mips_dma_cache_sync back to dma_cache_sync
  MIPS: MT: Fix typo in comment.
  SSB: Fix nvram_get on BCM47xx platform
  MIPS: BCM47xx: Swap serial console if ttyS1 was specified.
  MIPS: BCM47xx: Use sscanf for parsing mac address
  MIPS: BCM47xx: Fill values for b43 into SSB sprom
  MIPS: BCM47xx: Do not read config from CFE
  MIPS: FDT size is a be32
  MIPS: Fix CP0 COUNTER clockevent race
  MIPS: Fix regression on BCM4710 processor detection
  MIPS: JZ4740: Fix pcm device name
  MIPS: Separate two consecutive loads in memset.S
  MIPS: Send proper signal and siginfo on FP emulator faults.
  MIPS: AR7: Fix loops per jiffies on TNETD7200 devices
  MIPS: AR7: Fix double ar7_gpio_init declaration
  MIPS: Rework GENERIC_HARDIRQS Kconfig.
  MIPS: Alchemy: Add return value check for strict_strtoul()
  ...
parents b3444d16 c9bace7c
...@@ -19,6 +19,8 @@ config MIPS ...@@ -19,6 +19,8 @@ config MIPS
select GENERIC_ATOMIC64 if !64BIT select GENERIC_ATOMIC64 if !64BIT
select HAVE_DMA_ATTRS select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG select HAVE_DMA_API_DEBUG
select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_PROBE
menu "Machine selection" menu "Machine selection"
...@@ -1664,6 +1666,28 @@ config PAGE_SIZE_64KB ...@@ -1664,6 +1666,28 @@ config PAGE_SIZE_64KB
endchoice endchoice
config FORCE_MAX_ZONEORDER
int "Maximum zone order"
range 13 64 if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_32KB
default "13" if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_32KB
range 12 64 if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_16KB
default "12" if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_16KB
range 11 64
default "11"
help
The kernel memory allocator divides physically contiguous memory
blocks into "zones", where each zone is a power of two number of
pages. This option selects the largest power of two that the kernel
keeps in the memory allocator. If you need to allocate very large
blocks of physically contiguous memory, then you may need to
increase this value.
This config option is actually maximum order plus one. For example,
a value of 11 means that the largest free memory block is 2^10 pages.
The page size is not necessarily 4KB. Keep this in mind
when choosing a value for this option.
config BOARD_SCACHE config BOARD_SCACHE
bool bool
...@@ -1921,20 +1945,6 @@ config CPU_R4000_WORKAROUNDS ...@@ -1921,20 +1945,6 @@ config CPU_R4000_WORKAROUNDS
config CPU_R4400_WORKAROUNDS config CPU_R4400_WORKAROUNDS
bool bool
#
# Use the generic interrupt handling code in kernel/irq/:
#
config GENERIC_HARDIRQS
bool
default y
config GENERIC_IRQ_PROBE
bool
default y
config IRQ_PER_CPU
bool
# #
# - Highmem only makes sense for the 32-bit kernel. # - Highmem only makes sense for the 32-bit kernel.
# - The current highmem code will only work properly on physically indexed # - The current highmem code will only work properly on physically indexed
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
static void alchemy_8250_pm(struct uart_port *port, unsigned int state, static void alchemy_8250_pm(struct uart_port *port, unsigned int state,
unsigned int old_state) unsigned int old_state)
{ {
#ifdef CONFIG_SERIAL_8250
switch (state) { switch (state) {
case 0: case 0:
if ((__raw_readl(port->membase + UART_MOD_CNTRL) & 3) != 3) { if ((__raw_readl(port->membase + UART_MOD_CNTRL) & 3) != 3) {
...@@ -49,6 +50,7 @@ static void alchemy_8250_pm(struct uart_port *port, unsigned int state, ...@@ -49,6 +50,7 @@ static void alchemy_8250_pm(struct uart_port *port, unsigned int state,
serial8250_do_pm(port, state, old_state); serial8250_do_pm(port, state, old_state);
break; break;
} }
#endif
} }
#define PORT(_base, _irq) \ #define PORT(_base, _irq) \
......
...@@ -54,10 +54,9 @@ void __init prom_init(void) ...@@ -54,10 +54,9 @@ void __init prom_init(void)
prom_init_cmdline(); prom_init_cmdline();
memsize_str = prom_getenv("memsize"); memsize_str = prom_getenv("memsize");
if (!memsize_str) if (!memsize_str || strict_strtoul(memsize_str, 0, &memsize))
memsize = ALCHEMY_BOARD_DEFAULT_MEMSIZE; memsize = ALCHEMY_BOARD_DEFAULT_MEMSIZE;
else
strict_strtoul(memsize_str, 0, &memsize);
add_memory_region(0, memsize, BOOT_MEM_RAM); add_memory_region(0, memsize, BOOT_MEM_RAM);
} }
......
...@@ -239,12 +239,12 @@ static void tnetd7300_set_clock(u32 shift, struct tnetd7300_clock *clock, ...@@ -239,12 +239,12 @@ static void tnetd7300_set_clock(u32 shift, struct tnetd7300_clock *clock,
calculate(base_clock, frequency, &prediv, &postdiv, &mul); calculate(base_clock, frequency, &prediv, &postdiv, &mul);
writel(((prediv - 1) << PREDIV_SHIFT) | (postdiv - 1), &clock->ctrl); writel(((prediv - 1) << PREDIV_SHIFT) | (postdiv - 1), &clock->ctrl);
msleep(1); mdelay(1);
writel(4, &clock->pll); writel(4, &clock->pll);
while (readl(&clock->pll) & PLL_STATUS) while (readl(&clock->pll) & PLL_STATUS)
; ;
writel(((mul - 1) << MUL_SHIFT) | (0xff << 3) | 0x0e, &clock->pll); writel(((mul - 1) << MUL_SHIFT) | (0xff << 3) | 0x0e, &clock->pll);
msleep(75); mdelay(75);
} }
static void __init tnetd7300_init_clocks(void) static void __init tnetd7300_init_clocks(void)
...@@ -456,7 +456,7 @@ void clk_put(struct clk *clk) ...@@ -456,7 +456,7 @@ void clk_put(struct clk *clk)
} }
EXPORT_SYMBOL(clk_put); EXPORT_SYMBOL(clk_put);
int __init ar7_init_clocks(void) void __init ar7_init_clocks(void)
{ {
switch (ar7_chip_id()) { switch (ar7_chip_id()) {
case AR7_CHIP_7100: case AR7_CHIP_7100:
...@@ -472,7 +472,4 @@ int __init ar7_init_clocks(void) ...@@ -472,7 +472,4 @@ int __init ar7_init_clocks(void)
} }
/* adjust vbus clock rate */ /* adjust vbus clock rate */
vbus_clk.rate = bus_clk.rate / 2; vbus_clk.rate = bus_clk.rate / 2;
return 0;
} }
arch_initcall(ar7_init_clocks);
...@@ -30,6 +30,9 @@ void __init plat_time_init(void) ...@@ -30,6 +30,9 @@ void __init plat_time_init(void)
{ {
struct clk *cpu_clk; struct clk *cpu_clk;
/* Initialize ar7 clocks so the CPU clock frequency is correct */
ar7_init_clocks();
cpu_clk = clk_get(NULL, "cpu"); cpu_clk = clk_get(NULL, "cpu");
if (IS_ERR(cpu_clk)) { if (IS_ERR(cpu_clk)) {
printk(KERN_ERR "unable to get cpu clock\n"); printk(KERN_ERR "unable to get cpu clock\n");
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/time.h> #include <asm/time.h>
#include <bcm47xx.h> #include <bcm47xx.h>
#include <asm/fw/cfe/cfe_api.h>
#include <asm/mach-bcm47xx/nvram.h> #include <asm/mach-bcm47xx/nvram.h>
struct ssb_bus ssb_bcm47xx; struct ssb_bus ssb_bcm47xx;
...@@ -57,68 +56,112 @@ static void bcm47xx_machine_halt(void) ...@@ -57,68 +56,112 @@ static void bcm47xx_machine_halt(void)
cpu_relax(); cpu_relax();
} }
static void str2eaddr(char *str, char *dest) #define READ_FROM_NVRAM(_outvar, name, buf) \
{ if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\
int i = 0; sprom->_outvar = simple_strtoul(buf, NULL, 0);
if (str == NULL) { static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
memset(dest, 0, 6); {
return; char buf[100];
u32 boardflags;
memset(sprom, 0, sizeof(struct ssb_sprom));
sprom->revision = 1; /* Fallback: Old hardware does not define this. */
READ_FROM_NVRAM(revision, "sromrev", buf);
if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0)
nvram_parse_macaddr(buf, sprom->il0mac);
if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
nvram_parse_macaddr(buf, sprom->et0mac);
if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
nvram_parse_macaddr(buf, sprom->et1mac);
READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf);
READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf);
READ_FROM_NVRAM(et0mdcport, "et0mdcport", buf);
READ_FROM_NVRAM(et1mdcport, "et1mdcport", buf);
READ_FROM_NVRAM(board_rev, "boardrev", buf);
READ_FROM_NVRAM(country_code, "ccode", buf);
READ_FROM_NVRAM(ant_available_a, "aa5g", buf);
READ_FROM_NVRAM(ant_available_bg, "aa2g", buf);
READ_FROM_NVRAM(pa0b0, "pa0b0", buf);
READ_FROM_NVRAM(pa0b1, "pa0b1", buf);
READ_FROM_NVRAM(pa0b2, "pa0b2", buf);
READ_FROM_NVRAM(pa1b0, "pa1b0", buf);
READ_FROM_NVRAM(pa1b1, "pa1b1", buf);
READ_FROM_NVRAM(pa1b2, "pa1b2", buf);
READ_FROM_NVRAM(pa1lob0, "pa1lob0", buf);
READ_FROM_NVRAM(pa1lob2, "pa1lob1", buf);
READ_FROM_NVRAM(pa1lob1, "pa1lob2", buf);
READ_FROM_NVRAM(pa1hib0, "pa1hib0", buf);
READ_FROM_NVRAM(pa1hib2, "pa1hib1", buf);
READ_FROM_NVRAM(pa1hib1, "pa1hib2", buf);
READ_FROM_NVRAM(gpio0, "wl0gpio0", buf);
READ_FROM_NVRAM(gpio1, "wl0gpio1", buf);
READ_FROM_NVRAM(gpio2, "wl0gpio2", buf);
READ_FROM_NVRAM(gpio3, "wl0gpio3", buf);
READ_FROM_NVRAM(maxpwr_bg, "pa0maxpwr", buf);
READ_FROM_NVRAM(maxpwr_al, "pa1lomaxpwr", buf);
READ_FROM_NVRAM(maxpwr_a, "pa1maxpwr", buf);
READ_FROM_NVRAM(maxpwr_ah, "pa1himaxpwr", buf);
READ_FROM_NVRAM(itssi_a, "pa1itssit", buf);
READ_FROM_NVRAM(itssi_bg, "pa0itssit", buf);
READ_FROM_NVRAM(tri2g, "tri2g", buf);
READ_FROM_NVRAM(tri5gl, "tri5gl", buf);
READ_FROM_NVRAM(tri5g, "tri5g", buf);
READ_FROM_NVRAM(tri5gh, "tri5gh", buf);
READ_FROM_NVRAM(rxpo2g, "rxpo2g", buf);
READ_FROM_NVRAM(rxpo5g, "rxpo5g", buf);
READ_FROM_NVRAM(rssisav2g, "rssisav2g", buf);
READ_FROM_NVRAM(rssismc2g, "rssismc2g", buf);
READ_FROM_NVRAM(rssismf2g, "rssismf2g", buf);
READ_FROM_NVRAM(bxa2g, "bxa2g", buf);
READ_FROM_NVRAM(rssisav5g, "rssisav5g", buf);
READ_FROM_NVRAM(rssismc5g, "rssismc5g", buf);
READ_FROM_NVRAM(rssismf5g, "rssismf5g", buf);
READ_FROM_NVRAM(bxa5g, "bxa5g", buf);
READ_FROM_NVRAM(cck2gpo, "cck2gpo", buf);
READ_FROM_NVRAM(ofdm2gpo, "ofdm2gpo", buf);
READ_FROM_NVRAM(ofdm5glpo, "ofdm5glpo", buf);
READ_FROM_NVRAM(ofdm5gpo, "ofdm5gpo", buf);
READ_FROM_NVRAM(ofdm5ghpo, "ofdm5ghpo", buf);
if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0) {
boardflags = simple_strtoul(buf, NULL, 0);
if (boardflags) {
sprom->boardflags_lo = (boardflags & 0x0000FFFFU);
sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16;
}
}
if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0) {
boardflags = simple_strtoul(buf, NULL, 0);
if (boardflags) {
sprom->boardflags2_lo = (boardflags & 0x0000FFFFU);
sprom->boardflags2_hi = (boardflags & 0xFFFF0000U) >> 16;
} }
for (;;) {
dest[i++] = (char) simple_strtoul(str, NULL, 16);
str += 2;
if (!*str++ || i == 6)
break;
} }
} }
static int bcm47xx_get_invariants(struct ssb_bus *bus, static int bcm47xx_get_invariants(struct ssb_bus *bus,
struct ssb_init_invariants *iv) struct ssb_init_invariants *iv)
{ {
char buf[100]; char buf[20];
/* Fill boardinfo structure */ /* Fill boardinfo structure */
memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0 || if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0) iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0);
else
iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0 || if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0 ||
nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0); iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
/* Fill sprom structure */ bcm47xx_fill_sprom(&iv->sprom);
memset(&(iv->sprom), 0, sizeof(struct ssb_sprom));
iv->sprom.revision = 3;
if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0 ||
nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
str2eaddr(buf, iv->sprom.et0mac);
if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0 || if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0) iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
str2eaddr(buf, iv->sprom.et1mac);
if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 ||
nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 0);
if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 ||
nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 0);
if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0 ||
nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0 ||
nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
return 0; return 0;
} }
...@@ -126,12 +169,28 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus, ...@@ -126,12 +169,28 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
void __init plat_mem_setup(void) void __init plat_mem_setup(void)
{ {
int err; int err;
char buf[100];
struct ssb_mipscore *mcore;
err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
bcm47xx_get_invariants); bcm47xx_get_invariants);
if (err) if (err)
panic("Failed to initialize SSB bus (err %d)\n", err); panic("Failed to initialize SSB bus (err %d)\n", err);
mcore = &ssb_bcm47xx.mipscore;
if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
if (strstr(buf, "console=ttyS1")) {
struct ssb_serial_port port;
printk(KERN_DEBUG "Swapping serial ports!\n");
/* swap serial ports */
memcpy(&port, &mcore->serial_ports[0], sizeof(port));
memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
sizeof(port));
memcpy(&mcore->serial_ports[1], &port, sizeof(port));
}
}
_machine_restart = bcm47xx_machine_restart; _machine_restart = bcm47xx_machine_restart;
_machine_halt = bcm47xx_machine_halt; _machine_halt = bcm47xx_machine_halt;
pm_power_off = bcm47xx_machine_halt; pm_power_off = bcm47xx_machine_halt;
......
...@@ -111,8 +111,8 @@ ...@@ -111,8 +111,8 @@
* These are the PRID's for when 23:16 == PRID_COMP_BROADCOM * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
*/ */
#define PRID_IMP_BMIPS4KC 0x4000 #define PRID_IMP_BMIPS32_REV4 0x4000
#define PRID_IMP_BMIPS32 0x8000 #define PRID_IMP_BMIPS32_REV8 0x8000
#define PRID_IMP_BMIPS3300 0x9000 #define PRID_IMP_BMIPS3300 0x9000
#define PRID_IMP_BMIPS3300_ALT 0x9100 #define PRID_IMP_BMIPS3300_ALT 0x9100
#define PRID_IMP_BMIPS3300_BUG 0x0000 #define PRID_IMP_BMIPS3300_BUG 0x0000
......
...@@ -249,6 +249,7 @@ extern struct mips_abi mips_abi_n32; ...@@ -249,6 +249,7 @@ extern struct mips_abi mips_abi_n32;
#define SET_PERSONALITY(ex) \ #define SET_PERSONALITY(ex) \
do { \ do { \
if (personality(current->personality) != PER_LINUX) \
set_personality(PER_LINUX); \ set_personality(PER_LINUX); \
\ \
current->thread.abi = &mips_abi; \ current->thread.abi = &mips_abi; \
...@@ -296,6 +297,8 @@ do { \ ...@@ -296,6 +297,8 @@ do { \
#define SET_PERSONALITY(ex) \ #define SET_PERSONALITY(ex) \
do { \ do { \
unsigned int p; \
\
clear_thread_flag(TIF_32BIT_REGS); \ clear_thread_flag(TIF_32BIT_REGS); \
clear_thread_flag(TIF_32BIT_ADDR); \ clear_thread_flag(TIF_32BIT_ADDR); \
\ \
...@@ -304,7 +307,8 @@ do { \ ...@@ -304,7 +307,8 @@ do { \
else \ else \
current->thread.abi = &mips_abi; \ current->thread.abi = &mips_abi; \
\ \
if (current->personality != PER_LINUX32) \ p = personality(current->personality); \
if (p != PER_LINUX32 && p != PER_LINUX) \
set_personality(PER_LINUX); \ set_personality(PER_LINUX); \
} while (0) } while (0)
......
...@@ -329,10 +329,14 @@ static inline void pfx##write##bwlq(type val, \ ...@@ -329,10 +329,14 @@ static inline void pfx##write##bwlq(type val, \
"dsrl32 %L0, %L0, 0" "\n\t" \ "dsrl32 %L0, %L0, 0" "\n\t" \
"dsll32 %M0, %M0, 0" "\n\t" \ "dsll32 %M0, %M0, 0" "\n\t" \
"or %L0, %L0, %M0" "\n\t" \ "or %L0, %L0, %M0" "\n\t" \
".set push" "\n\t" \
".set noreorder" "\n\t" \
".set nomacro" "\n\t" \
"sd %L0, %2" "\n\t" \ "sd %L0, %2" "\n\t" \
".set pop" "\n\t" \
".set mips0" "\n" \ ".set mips0" "\n" \
: "=r" (__tmp) \ : "=r" (__tmp) \
: "0" (__val), "m" (*__mem)); \ : "0" (__val), "R" (*__mem)); \
if (irq) \ if (irq) \
local_irq_restore(__flags); \ local_irq_restore(__flags); \
} else \ } else \
...@@ -355,12 +359,16 @@ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \ ...@@ -355,12 +359,16 @@ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
local_irq_save(__flags); \ local_irq_save(__flags); \
__asm__ __volatile__( \ __asm__ __volatile__( \
".set mips3" "\t\t# __readq" "\n\t" \ ".set mips3" "\t\t# __readq" "\n\t" \
".set push" "\n\t" \
".set noreorder" "\n\t" \
".set nomacro" "\n\t" \
"ld %L0, %1" "\n\t" \ "ld %L0, %1" "\n\t" \
".set pop" "\n\t" \
"dsra32 %M0, %L0, 0" "\n\t" \ "dsra32 %M0, %L0, 0" "\n\t" \
"sll %L0, %L0, 0" "\n\t" \ "sll %L0, %L0, 0" "\n\t" \
".set mips0" "\n" \ ".set mips0" "\n" \
: "=r" (__val) \ : "=r" (__val) \
: "m" (*__mem)); \ : "R" (*__mem)); \
if (irq) \ if (irq) \
local_irq_restore(__flags); \ local_irq_restore(__flags); \
} else { \ } else { \
......
...@@ -201,7 +201,6 @@ static inline void ar7_device_off(u32 bit) ...@@ -201,7 +201,6 @@ static inline void ar7_device_off(u32 bit)
} }
int __init ar7_gpio_init(void); int __init ar7_gpio_init(void);
void __init ar7_init_clocks(void);
int __init ar7_gpio_init(void);
#endif /* __AR7_H__ */ #endif /* __AR7_H__ */
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#define __NVRAM_H #define __NVRAM_H
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h>
struct nvram_header { struct nvram_header {
u32 magic; u32 magic;
...@@ -36,4 +37,10 @@ struct nvram_header { ...@@ -36,4 +37,10 @@ struct nvram_header {
extern int nvram_getenv(char *name, char *val, size_t val_len); extern int nvram_getenv(char *name, char *val, size_t val_len);
static inline void nvram_parse_macaddr(char *buf, u8 *macaddr)
{
sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1],
&macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
}
#endif #endif
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 2009 Qi Hardware inc., * Copyright (c) 2009 Qi Hardware inc.,
* Author: Xiangfu Liu <xiangfu@qi-hardware.com> * Author: Xiangfu Liu <xiangfu@qi-hardware.com>
* Copyright 2010, Lars-Petrer Clausen <lars@metafoo.de> * Copyright 2010, Lars-Peter Clausen <lars@metafoo.de>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 or later * it under the terms of the GNU General Public License version 2 or later
...@@ -235,7 +235,7 @@ static const unsigned int qi_lb60_keypad_rows[] = { ...@@ -235,7 +235,7 @@ static const unsigned int qi_lb60_keypad_rows[] = {
QI_LB60_GPIO_KEYIN(3), QI_LB60_GPIO_KEYIN(3),
QI_LB60_GPIO_KEYIN(4), QI_LB60_GPIO_KEYIN(4),
QI_LB60_GPIO_KEYIN(5), QI_LB60_GPIO_KEYIN(5),
QI_LB60_GPIO_KEYIN(7), QI_LB60_GPIO_KEYIN(6),
QI_LB60_GPIO_KEYIN8, QI_LB60_GPIO_KEYIN8,
}; };
......
...@@ -208,7 +208,7 @@ struct platform_device jz4740_i2s_device = { ...@@ -208,7 +208,7 @@ struct platform_device jz4740_i2s_device = {
/* PCM */ /* PCM */
struct platform_device jz4740_pcm_device = { struct platform_device jz4740_pcm_device = {
.name = "jz4740-pcm", .name = "jz4740-pcm-audio",
.id = -1, .id = -1,
}; };
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/mach-jz4740/base.h> #include <asm/mach-jz4740/base.h>
void jz4740_init_cmdline(int argc, char *argv[]) static __init void jz4740_init_cmdline(int argc, char *argv[])
{ {
unsigned int count = COMMAND_LINE_SIZE - 1; unsigned int count = COMMAND_LINE_SIZE - 1;
int i; int i;
......
...@@ -32,7 +32,7 @@ static int mips_next_event(unsigned long delta, ...@@ -32,7 +32,7 @@ static int mips_next_event(unsigned long delta,
cnt = read_c0_count(); cnt = read_c0_count();
cnt += delta; cnt += delta;
write_c0_compare(cnt); write_c0_compare(cnt);
res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0; res = ((int)(read_c0_count() - cnt) >= 0) ? -ETIME : 0;
return res; return res;
} }
......
...@@ -905,7 +905,8 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) ...@@ -905,7 +905,8 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
{ {
decode_configs(c); decode_configs(c);
switch (c->processor_id & 0xff00) { switch (c->processor_id & 0xff00) {
case PRID_IMP_BMIPS32: case PRID_IMP_BMIPS32_REV4:
case PRID_IMP_BMIPS32_REV8:
c->cputype = CPU_BMIPS32; c->cputype = CPU_BMIPS32;
__cpu_name[cpu] = "Broadcom BMIPS32"; __cpu_name[cpu] = "Broadcom BMIPS32";
break; break;
...@@ -933,10 +934,6 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) ...@@ -933,10 +934,6 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
__cpu_name[cpu] = "Broadcom BMIPS5000"; __cpu_name[cpu] = "Broadcom BMIPS5000";
c->options |= MIPS_CPU_ULRI; c->options |= MIPS_CPU_ULRI;
break; break;
case PRID_IMP_BMIPS4KC:
c->cputype = CPU_4KC;
__cpu_name[cpu] = "MIPS 4Kc";
break;
} }
} }
......
...@@ -251,14 +251,15 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz, ...@@ -251,14 +251,15 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
SYSCALL_DEFINE1(32_personality, unsigned long, personality) SYSCALL_DEFINE1(32_personality, unsigned long, personality)
{ {
unsigned int p = personality & 0xffffffff;
int ret; int ret;
personality &= 0xffffffff;
if (personality(current->personality) == PER_LINUX32 && if (personality(current->personality) == PER_LINUX32 &&
personality == PER_LINUX) personality(p) == PER_LINUX)
personality = PER_LINUX32; p = (p & ~PER_MASK) | PER_LINUX32;
ret = sys_personality(personality); ret = sys_personality(p);
if (ret == PER_LINUX32) if (ret != -1 && personality(ret) == PER_LINUX32)
ret = PER_LINUX; ret = (ret & ~PER_MASK) | PER_LINUX;
return ret; return ret;
} }
......
...@@ -142,7 +142,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ...@@ -142,7 +142,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
childregs->regs[7] = 0; /* Clear error flag */ childregs->regs[7] = 0; /* Clear error flag */
childregs->regs[2] = 0; /* Child gets zero as return value */ childregs->regs[2] = 0; /* Child gets zero as return value */
regs->regs[2] = p->pid;
if (childregs->cp0_status & ST0_CU0) { if (childregs->cp0_status & ST0_CU0) {
childregs->regs[28] = (unsigned long) ti; childregs->regs[28] = (unsigned long) ti;
......
...@@ -100,7 +100,7 @@ void __init device_tree_init(void) ...@@ -100,7 +100,7 @@ void __init device_tree_init(void)
return; return;
base = virt_to_phys((void *)initial_boot_params); base = virt_to_phys((void *)initial_boot_params);
size = initial_boot_params->totalsize; size = be32_to_cpu(initial_boot_params->totalsize);
/* Before we do anything, lets reserve the dt blob */ /* Before we do anything, lets reserve the dt blob */
reserve_mem_mach(base, size); reserve_mem_mach(base, size);
......
...@@ -153,7 +153,7 @@ static void __cpuinit vsmp_init_secondary(void) ...@@ -153,7 +153,7 @@ static void __cpuinit vsmp_init_secondary(void)
{ {
extern int gic_present; extern int gic_present;
/* This is Malta specific: IPI,performance and timer inetrrupts */ /* This is Malta specific: IPI,performance and timer interrupts */
if (gic_present) if (gic_present)
change_c0_status(ST0_IM, STATUSF_IP3 | STATUSF_IP4 | change_c0_status(ST0_IM, STATUSF_IP3 | STATUSF_IP4 |
STATUSF_IP6 | STATUSF_IP7); STATUSF_IP6 | STATUSF_IP7);
......
...@@ -83,7 +83,8 @@ extern asmlinkage void handle_mcheck(void); ...@@ -83,7 +83,8 @@ extern asmlinkage void handle_mcheck(void);
extern asmlinkage void handle_reserved(void); extern asmlinkage void handle_reserved(void);
extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
struct mips_fpu_struct *ctx, int has_fpu); struct mips_fpu_struct *ctx, int has_fpu,
void *__user *fault_addr);
void (*board_be_init)(void); void (*board_be_init)(void);
int (*board_be_handler)(struct pt_regs *regs, int is_fixup); int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
...@@ -661,12 +662,36 @@ asmlinkage void do_ov(struct pt_regs *regs) ...@@ -661,12 +662,36 @@ asmlinkage void do_ov(struct pt_regs *regs)
force_sig_info(SIGFPE, &info, current); force_sig_info(SIGFPE, &info, current);
} }
static int process_fpemu_return(int sig, void __user *fault_addr)
{
if (sig == SIGSEGV || sig == SIGBUS) {
struct siginfo si = {0};
si.si_addr = fault_addr;
si.si_signo = sig;
if (sig == SIGSEGV) {
if (find_vma(current->mm, (unsigned long)fault_addr))
si.si_code = SEGV_ACCERR;
else
si.si_code = SEGV_MAPERR;
} else {
si.si_code = BUS_ADRERR;
}
force_sig_info(sig, &si, current);
return 1;
} else if (sig) {
force_sig(sig, current);
return 1;
} else {
return 0;
}
}
/* /*
* XXX Delayed fp exceptions when doing a lazy ctx switch XXX * XXX Delayed fp exceptions when doing a lazy ctx switch XXX
*/ */
asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
{ {
siginfo_t info; siginfo_t info = {0};
if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs), SIGFPE) if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs), SIGFPE)
== NOTIFY_STOP) == NOTIFY_STOP)
...@@ -675,6 +700,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) ...@@ -675,6 +700,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
if (fcr31 & FPU_CSR_UNI_X) { if (fcr31 & FPU_CSR_UNI_X) {
int sig; int sig;
void __user *fault_addr = NULL;
/* /*
* Unimplemented operation exception. If we've got the full * Unimplemented operation exception. If we've got the full
...@@ -690,7 +716,8 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) ...@@ -690,7 +716,8 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
lose_fpu(1); lose_fpu(1);
/* Run the emulator */ /* Run the emulator */
sig = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1); sig = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1,
&fault_addr);
/* /*
* We can't allow the emulated instruction to leave any of * We can't allow the emulated instruction to leave any of
...@@ -702,8 +729,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) ...@@ -702,8 +729,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
own_fpu(1); /* Using the FPU again. */ own_fpu(1); /* Using the FPU again. */
/* If something went wrong, signal */ /* If something went wrong, signal */
if (sig) process_fpemu_return(sig, fault_addr);
force_sig(sig, current);
return; return;
} else if (fcr31 & FPU_CSR_INV_X) } else if (fcr31 & FPU_CSR_INV_X)
...@@ -996,11 +1022,11 @@ asmlinkage void do_cpu(struct pt_regs *regs) ...@@ -996,11 +1022,11 @@ asmlinkage void do_cpu(struct pt_regs *regs)
if (!raw_cpu_has_fpu) { if (!raw_cpu_has_fpu) {
int sig; int sig;
void __user *fault_addr = NULL;
sig = fpu_emulator_cop1Handler(regs, sig = fpu_emulator_cop1Handler(regs,
&current->thread.fpu, 0); &current->thread.fpu,
if (sig) 0, &fault_addr);
force_sig(sig, current); if (!process_fpemu_return(sig, fault_addr))
else
mt_ase_fp_affinity(); mt_ase_fp_affinity();
} }
......
...@@ -1092,6 +1092,10 @@ static int vpe_open(struct inode *inode, struct file *filp) ...@@ -1092,6 +1092,10 @@ static int vpe_open(struct inode *inode, struct file *filp)
/* this of-course trashes what was there before... */ /* this of-course trashes what was there before... */
v->pbuffer = vmalloc(P_SIZE); v->pbuffer = vmalloc(P_SIZE);
if (!v->pbuffer) {
pr_warning("VPE loader: unable to allocate memory\n");
return -ENOMEM;
}
v->plen = P_SIZE; v->plen = P_SIZE;
v->load_addr = NULL; v->load_addr = NULL;
v->len = 0; v->len = 0;
...@@ -1149,10 +1153,9 @@ static int vpe_release(struct inode *inode, struct file *filp) ...@@ -1149,10 +1153,9 @@ static int vpe_release(struct inode *inode, struct file *filp)
if (ret < 0) if (ret < 0)
v->shared_ptr = NULL; v->shared_ptr = NULL;
// cleanup any temp buffers
if (v->pbuffer)
vfree(v->pbuffer); vfree(v->pbuffer);
v->plen = 0; v->plen = 0;
return ret; return ret;
} }
...@@ -1169,11 +1172,6 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, ...@@ -1169,11 +1172,6 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer,
if (v == NULL) if (v == NULL)
return -ENODEV; return -ENODEV;
if (v->pbuffer == NULL) {
printk(KERN_ERR "VPE loader: no buffer for program\n");
return -ENOMEM;
}
if ((count + v->len) > v->plen) { if ((count + v->len) > v->plen) {
printk(KERN_WARNING printk(KERN_WARNING
"VPE loader: elf size too big. Perhaps strip uneeded symbols\n"); "VPE loader: elf size too big. Perhaps strip uneeded symbols\n");
......
...@@ -161,16 +161,16 @@ FEXPORT(__bzero) ...@@ -161,16 +161,16 @@ FEXPORT(__bzero)
.Lfwd_fixup: .Lfwd_fixup:
PTR_L t0, TI_TASK($28) PTR_L t0, TI_TASK($28)
LONG_L t0, THREAD_BUADDR(t0)
andi a2, 0x3f andi a2, 0x3f
LONG_L t0, THREAD_BUADDR(t0)
LONG_ADDU a2, t1 LONG_ADDU a2, t1
jr ra jr ra
LONG_SUBU a2, t0 LONG_SUBU a2, t0
.Lpartial_fixup: .Lpartial_fixup:
PTR_L t0, TI_TASK($28) PTR_L t0, TI_TASK($28)
LONG_L t0, THREAD_BUADDR(t0)
andi a2, LONGMASK andi a2, LONGMASK
LONG_L t0, THREAD_BUADDR(t0)
LONG_ADDU a2, t1 LONG_ADDU a2, t1
jr ra jr ra
LONG_SUBU a2, t0 LONG_SUBU a2, t0
......
...@@ -29,9 +29,9 @@ unsigned long memsize, highmemsize; ...@@ -29,9 +29,9 @@ unsigned long memsize, highmemsize;
#define parse_even_earlier(res, option, p) \ #define parse_even_earlier(res, option, p) \
do { \ do { \
int ret; \
if (strncmp(option, (char *)p, strlen(option)) == 0) \ if (strncmp(option, (char *)p, strlen(option)) == 0) \
strict_strtol((char *)p + strlen(option"="), \ ret = strict_strtol((char *)p + strlen(option"="), 10, &res); \
10, &res); \
} while (0) } while (0)
void __init prom_init_env(void) void __init prom_init_env(void)
......
...@@ -64,7 +64,7 @@ static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *, ...@@ -64,7 +64,7 @@ static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
#if __mips >= 4 && __mips != 32 #if __mips >= 4 && __mips != 32
static int fpux_emu(struct pt_regs *, static int fpux_emu(struct pt_regs *,
struct mips_fpu_struct *, mips_instruction); struct mips_fpu_struct *, mips_instruction, void *__user *);
#endif #endif
/* Further private data for which no space exists in mips_fpu_struct */ /* Further private data for which no space exists in mips_fpu_struct */
...@@ -208,16 +208,23 @@ static inline int cop1_64bit(struct pt_regs *xcp) ...@@ -208,16 +208,23 @@ static inline int cop1_64bit(struct pt_regs *xcp)
* Two instructions if the instruction is in a branch delay slot. * Two instructions if the instruction is in a branch delay slot.
*/ */
static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
void *__user *fault_addr)
{ {
mips_instruction ir; mips_instruction ir;
unsigned long emulpc, contpc; unsigned long emulpc, contpc;
unsigned int cond; unsigned int cond;
if (get_user(ir, (mips_instruction __user *) xcp->cp0_epc)) { if (!access_ok(VERIFY_READ, xcp->cp0_epc, sizeof(mips_instruction))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = (mips_instruction __user *)xcp->cp0_epc;
return SIGBUS; return SIGBUS;
} }
if (__get_user(ir, (mips_instruction __user *) xcp->cp0_epc)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = (mips_instruction __user *)xcp->cp0_epc;
return SIGSEGV;
}
/* XXX NEC Vr54xx bug workaround */ /* XXX NEC Vr54xx bug workaround */
if ((xcp->cp0_cause & CAUSEF_BD) && !isBranchInstr(&ir)) if ((xcp->cp0_cause & CAUSEF_BD) && !isBranchInstr(&ir))
...@@ -245,10 +252,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) ...@@ -245,10 +252,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
#endif #endif
return SIGILL; return SIGILL;
} }
if (get_user(ir, (mips_instruction __user *) emulpc)) { if (!access_ok(VERIFY_READ, emulpc, sizeof(mips_instruction))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = (mips_instruction __user *)emulpc;
return SIGBUS; return SIGBUS;
} }
if (__get_user(ir, (mips_instruction __user *) emulpc)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = (mips_instruction __user *)emulpc;
return SIGSEGV;
}
/* __compute_return_epc() will have updated cp0_epc */ /* __compute_return_epc() will have updated cp0_epc */
contpc = xcp->cp0_epc; contpc = xcp->cp0_epc;
/* In order not to confuse ptrace() et al, tweak context */ /* In order not to confuse ptrace() et al, tweak context */
...@@ -269,10 +282,17 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) ...@@ -269,10 +282,17 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
u64 val; u64 val;
MIPS_FPU_EMU_INC_STATS(loads); MIPS_FPU_EMU_INC_STATS(loads);
if (get_user(val, va)) {
if (!access_ok(VERIFY_READ, va, sizeof(u64))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGBUS; return SIGBUS;
} }
if (__get_user(val, va)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGSEGV;
}
DITOREG(val, MIPSInst_RT(ir)); DITOREG(val, MIPSInst_RT(ir));
break; break;
} }
...@@ -284,10 +304,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) ...@@ -284,10 +304,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
MIPS_FPU_EMU_INC_STATS(stores); MIPS_FPU_EMU_INC_STATS(stores);
DIFROMREG(val, MIPSInst_RT(ir)); DIFROMREG(val, MIPSInst_RT(ir));
if (put_user(val, va)) { if (!access_ok(VERIFY_WRITE, va, sizeof(u64))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGBUS; return SIGBUS;
} }
if (__put_user(val, va)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGSEGV;
}
break; break;
} }
...@@ -297,10 +323,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) ...@@ -297,10 +323,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
u32 val; u32 val;
MIPS_FPU_EMU_INC_STATS(loads); MIPS_FPU_EMU_INC_STATS(loads);
if (get_user(val, va)) { if (!access_ok(VERIFY_READ, va, sizeof(u32))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGBUS; return SIGBUS;
} }
if (__get_user(val, va)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGSEGV;
}
SITOREG(val, MIPSInst_RT(ir)); SITOREG(val, MIPSInst_RT(ir));
break; break;
} }
...@@ -312,10 +344,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) ...@@ -312,10 +344,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
MIPS_FPU_EMU_INC_STATS(stores); MIPS_FPU_EMU_INC_STATS(stores);
SIFROMREG(val, MIPSInst_RT(ir)); SIFROMREG(val, MIPSInst_RT(ir));
if (put_user(val, va)) { if (!access_ok(VERIFY_WRITE, va, sizeof(u32))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGBUS; return SIGBUS;
} }
if (__put_user(val, va)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGSEGV;
}
break; break;
} }
...@@ -440,11 +478,18 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) ...@@ -440,11 +478,18 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
contpc = (xcp->cp0_epc + contpc = (xcp->cp0_epc +
(MIPSInst_SIMM(ir) << 2)); (MIPSInst_SIMM(ir) << 2));
if (get_user(ir, if (!access_ok(VERIFY_READ, xcp->cp0_epc,
(mips_instruction __user *) xcp->cp0_epc)) { sizeof(mips_instruction))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = (mips_instruction __user *)xcp->cp0_epc;
return SIGBUS; return SIGBUS;
} }
if (__get_user(ir,
(mips_instruction __user *) xcp->cp0_epc)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = (mips_instruction __user *)xcp->cp0_epc;
return SIGSEGV;
}
switch (MIPSInst_OPCODE(ir)) { switch (MIPSInst_OPCODE(ir)) {
case lwc1_op: case lwc1_op:
...@@ -506,9 +551,8 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) ...@@ -506,9 +551,8 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
#if __mips >= 4 && __mips != 32 #if __mips >= 4 && __mips != 32
case cop1x_op:{ case cop1x_op:{
int sig; int sig = fpux_emu(xcp, ctx, ir, fault_addr);
if (sig)
if ((sig = fpux_emu(xcp, ctx, ir)))
return sig; return sig;
break; break;
} }
...@@ -604,7 +648,7 @@ DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg); ...@@ -604,7 +648,7 @@ DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg);
DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg); DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg);
static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
mips_instruction ir) mips_instruction ir, void *__user *fault_addr)
{ {
unsigned rcsr = 0; /* resulting csr */ unsigned rcsr = 0; /* resulting csr */
...@@ -624,10 +668,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ...@@ -624,10 +668,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
xcp->regs[MIPSInst_FT(ir)]); xcp->regs[MIPSInst_FT(ir)]);
MIPS_FPU_EMU_INC_STATS(loads); MIPS_FPU_EMU_INC_STATS(loads);
if (get_user(val, va)) { if (!access_ok(VERIFY_READ, va, sizeof(u32))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGBUS; return SIGBUS;
} }
if (__get_user(val, va)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGSEGV;
}
SITOREG(val, MIPSInst_FD(ir)); SITOREG(val, MIPSInst_FD(ir));
break; break;
...@@ -638,10 +688,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ...@@ -638,10 +688,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
MIPS_FPU_EMU_INC_STATS(stores); MIPS_FPU_EMU_INC_STATS(stores);
SIFROMREG(val, MIPSInst_FS(ir)); SIFROMREG(val, MIPSInst_FS(ir));
if (put_user(val, va)) { if (!access_ok(VERIFY_WRITE, va, sizeof(u32))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGBUS; return SIGBUS;
} }
if (put_user(val, va)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGSEGV;
}
break; break;
case madd_s_op: case madd_s_op:
...@@ -701,10 +757,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ...@@ -701,10 +757,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
xcp->regs[MIPSInst_FT(ir)]); xcp->regs[MIPSInst_FT(ir)]);
MIPS_FPU_EMU_INC_STATS(loads); MIPS_FPU_EMU_INC_STATS(loads);
if (get_user(val, va)) { if (!access_ok(VERIFY_READ, va, sizeof(u64))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGBUS; return SIGBUS;
} }
if (__get_user(val, va)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGSEGV;
}
DITOREG(val, MIPSInst_FD(ir)); DITOREG(val, MIPSInst_FD(ir));
break; break;
...@@ -714,10 +776,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ...@@ -714,10 +776,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
MIPS_FPU_EMU_INC_STATS(stores); MIPS_FPU_EMU_INC_STATS(stores);
DIFROMREG(val, MIPSInst_FS(ir)); DIFROMREG(val, MIPSInst_FS(ir));
if (put_user(val, va)) { if (!access_ok(VERIFY_WRITE, va, sizeof(u64))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGBUS; return SIGBUS;
} }
if (__put_user(val, va)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = va;
return SIGSEGV;
}
break; break;
case madd_d_op: case madd_d_op:
...@@ -1242,7 +1310,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ...@@ -1242,7 +1310,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
} }
int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
int has_fpu) int has_fpu, void *__user *fault_addr)
{ {
unsigned long oldepc, prevepc; unsigned long oldepc, prevepc;
mips_instruction insn; mips_instruction insn;
...@@ -1252,10 +1320,16 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ...@@ -1252,10 +1320,16 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
do { do {
prevepc = xcp->cp0_epc; prevepc = xcp->cp0_epc;
if (get_user(insn, (mips_instruction __user *) xcp->cp0_epc)) { if (!access_ok(VERIFY_READ, xcp->cp0_epc, sizeof(mips_instruction))) {
MIPS_FPU_EMU_INC_STATS(errors); MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = (mips_instruction __user *)xcp->cp0_epc;
return SIGBUS; return SIGBUS;
} }
if (__get_user(insn, (mips_instruction __user *) xcp->cp0_epc)) {
MIPS_FPU_EMU_INC_STATS(errors);
*fault_addr = (mips_instruction __user *)xcp->cp0_epc;
return SIGSEGV;
}
if (insn == 0) if (insn == 0)
xcp->cp0_epc += 4; /* skip nops */ xcp->cp0_epc += 4; /* skip nops */
else { else {
...@@ -1267,7 +1341,7 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, ...@@ -1267,7 +1341,7 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
*/ */
/* convert to ieee library modes */ /* convert to ieee library modes */
ieee754_csr.rm = ieee_rm[ieee754_csr.rm]; ieee754_csr.rm = ieee_rm[ieee754_csr.rm];
sig = cop1Emulate(xcp, ctx); sig = cop1Emulate(xcp, ctx, fault_addr);
/* revert to mips rounding mode */ /* revert to mips rounding mode */
ieee754_csr.rm = mips_rm[ieee754_csr.rm]; ieee754_csr.rm = mips_rm[ieee754_csr.rm];
} }
......
...@@ -288,7 +288,7 @@ int mips_dma_supported(struct device *dev, u64 mask) ...@@ -288,7 +288,7 @@ int mips_dma_supported(struct device *dev, u64 mask)
return plat_dma_supported(dev, mask); return plat_dma_supported(dev, mask);
} }
void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size, void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction direction) enum dma_data_direction direction)
{ {
BUG_ON(direction == DMA_NONE); BUG_ON(direction == DMA_NONE);
...@@ -298,6 +298,8 @@ void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size, ...@@ -298,6 +298,8 @@ void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
__dma_sync((unsigned long)vaddr, size, direction); __dma_sync((unsigned long)vaddr, size, direction);
} }
EXPORT_SYMBOL(dma_cache_sync);
static struct dma_map_ops mips_default_dma_map_ops = { static struct dma_map_ops mips_default_dma_map_ops = {
.alloc_coherent = mips_dma_alloc_coherent, .alloc_coherent = mips_dma_alloc_coherent,
.free_coherent = mips_dma_free_coherent, .free_coherent = mips_dma_free_coherent,
......
...@@ -65,11 +65,15 @@ static unsigned char readb_outer_space(unsigned long long phys) ...@@ -65,11 +65,15 @@ static unsigned char readb_outer_space(unsigned long long phys)
__asm__ __volatile__ ( __asm__ __volatile__ (
" .set mips3 \n" " .set mips3 \n"
" .set push \n"
" .set noreorder \n"
" .set nomacro \n"
" ld %0, %1 \n" " ld %0, %1 \n"
" .set pop \n"
" lbu %0, (%0) \n" " lbu %0, (%0) \n"
" .set mips0 \n" " .set mips0 \n"
: "=r" (res) : "=r" (res)
: "m" (vaddr)); : "R" (vaddr));
write_c0_status(sr); write_c0_status(sr);
ssnop_4(); ssnop_4();
...@@ -89,11 +93,15 @@ static void writeb_outer_space(unsigned long long phys, unsigned char c) ...@@ -89,11 +93,15 @@ static void writeb_outer_space(unsigned long long phys, unsigned char c)
__asm__ __volatile__ ( __asm__ __volatile__ (
" .set mips3 \n" " .set mips3 \n"
" .set push \n"
" .set noreorder \n"
" .set nomacro \n"
" ld %0, %1 \n" " ld %0, %1 \n"
" .set pop \n"
" sb %2, (%0) \n" " sb %2, (%0) \n"
" .set mips0 \n" " .set mips0 \n"
: "=&r" (tmp) : "=&r" (tmp)
: "m" (vaddr), "r" (c)); : "R" (vaddr), "r" (c));
write_c0_status(sr); write_c0_status(sr);
ssnop_4(); ssnop_4();
......
...@@ -82,7 +82,7 @@ int swarm_be_handler(struct pt_regs *regs, int is_fixup) ...@@ -82,7 +82,7 @@ int swarm_be_handler(struct pt_regs *regs, int is_fixup)
enum swarm_rtc_type { enum swarm_rtc_type {
RTC_NONE, RTC_NONE,
RTC_XICOR, RTC_XICOR,
RTC_M4LT81 RTC_M41T81,
}; };
enum swarm_rtc_type swarm_rtc_type; enum swarm_rtc_type swarm_rtc_type;
...@@ -96,7 +96,7 @@ void read_persistent_clock(struct timespec *ts) ...@@ -96,7 +96,7 @@ void read_persistent_clock(struct timespec *ts)
sec = xicor_get_time(); sec = xicor_get_time();
break; break;
case RTC_M4LT81: case RTC_M41T81:
sec = m41t81_get_time(); sec = m41t81_get_time();
break; break;
...@@ -115,7 +115,7 @@ int rtc_mips_set_time(unsigned long sec) ...@@ -115,7 +115,7 @@ int rtc_mips_set_time(unsigned long sec)
case RTC_XICOR: case RTC_XICOR:
return xicor_set_time(sec); return xicor_set_time(sec);
case RTC_M4LT81: case RTC_M41T81:
return m41t81_set_time(sec); return m41t81_set_time(sec);
case RTC_NONE: case RTC_NONE:
...@@ -141,7 +141,7 @@ void __init plat_mem_setup(void) ...@@ -141,7 +141,7 @@ void __init plat_mem_setup(void)
if (xicor_probe()) if (xicor_probe())
swarm_rtc_type = RTC_XICOR; swarm_rtc_type = RTC_XICOR;
if (m41t81_probe()) if (m41t81_probe())
swarm_rtc_type = RTC_M4LT81; swarm_rtc_type = RTC_M41T81;
#ifdef CONFIG_VT #ifdef CONFIG_VT
screen_info = (struct screen_info) { screen_info = (struct screen_info) {
......
...@@ -96,16 +96,21 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev) ...@@ -96,16 +96,21 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
return 0; return 0;
} }
extern char * nvram_get(const char *name); #ifdef CONFIG_BCM47XX
#include <asm/mach-bcm47xx/nvram.h>
/* Get the device MAC address */ /* Get the device MAC address */
static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
{ {
#ifdef CONFIG_BCM47XX char buf[20];
char *res = nvram_get("et0macaddr"); if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
if (res) return;
memcpy(macaddr, res, 6); nvram_parse_macaddr(buf, macaddr);
#endif
} }
#else
static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
{
}
#endif
extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
struct pci_dev *pdev); struct pci_dev *pdev);
......
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