diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-16 18:45:25 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-16 18:45:25 -0500 |
| commit | 68a4ec9c03461e94a9577cf499069621bb074833 (patch) | |
| tree | 1af5ab4f50f30539d1773b8f7d04557769070ec6 | |
| parent | b3444d164be8f977f4133ef0c6f4a18f2741373f (diff) | |
| parent | c9bace7ca1e2aeb95754ebc92c8f88a9f215691d (diff) | |
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()
...
29 files changed, 350 insertions, 152 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 67a2fa2caa49..0a9b5b8b2a19 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -19,6 +19,8 @@ config MIPS | |||
| 19 | select GENERIC_ATOMIC64 if !64BIT | 19 | select GENERIC_ATOMIC64 if !64BIT |
| 20 | select HAVE_DMA_ATTRS | 20 | select HAVE_DMA_ATTRS |
| 21 | select HAVE_DMA_API_DEBUG | 21 | select HAVE_DMA_API_DEBUG |
| 22 | select HAVE_GENERIC_HARDIRQS | ||
| 23 | select GENERIC_IRQ_PROBE | ||
| 22 | 24 | ||
| 23 | menu "Machine selection" | 25 | menu "Machine selection" |
| 24 | 26 | ||
| @@ -1664,6 +1666,28 @@ config PAGE_SIZE_64KB | |||
| 1664 | 1666 | ||
| 1665 | endchoice | 1667 | endchoice |
| 1666 | 1668 | ||
| 1669 | config FORCE_MAX_ZONEORDER | ||
| 1670 | int "Maximum zone order" | ||
| 1671 | range 13 64 if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_32KB | ||
| 1672 | default "13" if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_32KB | ||
| 1673 | range 12 64 if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_16KB | ||
| 1674 | default "12" if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_16KB | ||
| 1675 | range 11 64 | ||
| 1676 | default "11" | ||
| 1677 | help | ||
| 1678 | The kernel memory allocator divides physically contiguous memory | ||
| 1679 | blocks into "zones", where each zone is a power of two number of | ||
| 1680 | pages. This option selects the largest power of two that the kernel | ||
| 1681 | keeps in the memory allocator. If you need to allocate very large | ||
| 1682 | blocks of physically contiguous memory, then you may need to | ||
| 1683 | increase this value. | ||
| 1684 | |||
| 1685 | This config option is actually maximum order plus one. For example, | ||
| 1686 | a value of 11 means that the largest free memory block is 2^10 pages. | ||
| 1687 | |||
| 1688 | The page size is not necessarily 4KB. Keep this in mind | ||
| 1689 | when choosing a value for this option. | ||
| 1690 | |||
| 1667 | config BOARD_SCACHE | 1691 | config BOARD_SCACHE |
| 1668 | bool | 1692 | bool |
| 1669 | 1693 | ||
| @@ -1922,20 +1946,6 @@ config CPU_R4400_WORKAROUNDS | |||
| 1922 | bool | 1946 | bool |
| 1923 | 1947 | ||
| 1924 | # | 1948 | # |
| 1925 | # Use the generic interrupt handling code in kernel/irq/: | ||
| 1926 | # | ||
| 1927 | config GENERIC_HARDIRQS | ||
| 1928 | bool | ||
| 1929 | default y | ||
| 1930 | |||
| 1931 | config GENERIC_IRQ_PROBE | ||
| 1932 | bool | ||
| 1933 | default y | ||
| 1934 | |||
| 1935 | config IRQ_PER_CPU | ||
| 1936 | bool | ||
| 1937 | |||
| 1938 | # | ||
| 1939 | # - Highmem only makes sense for the 32-bit kernel. | 1949 | # - Highmem only makes sense for the 32-bit kernel. |
| 1940 | # - The current highmem code will only work properly on physically indexed | 1950 | # - The current highmem code will only work properly on physically indexed |
| 1941 | # caches such as R3000, SB1, R7000 or those that look like they're virtually | 1951 | # caches such as R3000, SB1, R7000 or those that look like they're virtually |
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 3691630931d6..9e7814db3d03 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | static void alchemy_8250_pm(struct uart_port *port, unsigned int state, | 27 | static void alchemy_8250_pm(struct uart_port *port, unsigned int state, |
| 28 | unsigned int old_state) | 28 | unsigned int old_state) |
| 29 | { | 29 | { |
| 30 | #ifdef CONFIG_SERIAL_8250 | ||
| 30 | switch (state) { | 31 | switch (state) { |
| 31 | case 0: | 32 | case 0: |
| 32 | if ((__raw_readl(port->membase + UART_MOD_CNTRL) & 3) != 3) { | 33 | 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 | serial8250_do_pm(port, state, old_state); | 50 | serial8250_do_pm(port, state, old_state); |
| 50 | break; | 51 | break; |
| 51 | } | 52 | } |
| 53 | #endif | ||
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | #define PORT(_base, _irq) \ | 56 | #define PORT(_base, _irq) \ |
diff --git a/arch/mips/alchemy/devboards/prom.c b/arch/mips/alchemy/devboards/prom.c index b30df5c97ad3..baeb21385058 100644 --- a/arch/mips/alchemy/devboards/prom.c +++ b/arch/mips/alchemy/devboards/prom.c | |||
| @@ -54,10 +54,9 @@ void __init prom_init(void) | |||
| 54 | 54 | ||
| 55 | prom_init_cmdline(); | 55 | prom_init_cmdline(); |
| 56 | memsize_str = prom_getenv("memsize"); | 56 | memsize_str = prom_getenv("memsize"); |
| 57 | if (!memsize_str) | 57 | if (!memsize_str || strict_strtoul(memsize_str, 0, &memsize)) |
| 58 | memsize = ALCHEMY_BOARD_DEFAULT_MEMSIZE; | 58 | memsize = ALCHEMY_BOARD_DEFAULT_MEMSIZE; |
| 59 | else | 59 | |
| 60 | strict_strtoul(memsize_str, 0, &memsize); | ||
| 61 | add_memory_region(0, memsize, BOOT_MEM_RAM); | 60 | add_memory_region(0, memsize, BOOT_MEM_RAM); |
| 62 | } | 61 | } |
| 63 | 62 | ||
diff --git a/arch/mips/ar7/clock.c b/arch/mips/ar7/clock.c index fc0e7154e8d6..2ca4ada1c291 100644 --- a/arch/mips/ar7/clock.c +++ b/arch/mips/ar7/clock.c | |||
| @@ -239,12 +239,12 @@ static void tnetd7300_set_clock(u32 shift, struct tnetd7300_clock *clock, | |||
| 239 | calculate(base_clock, frequency, &prediv, &postdiv, &mul); | 239 | calculate(base_clock, frequency, &prediv, &postdiv, &mul); |
| 240 | 240 | ||
| 241 | writel(((prediv - 1) << PREDIV_SHIFT) | (postdiv - 1), &clock->ctrl); | 241 | writel(((prediv - 1) << PREDIV_SHIFT) | (postdiv - 1), &clock->ctrl); |
| 242 | msleep(1); | 242 | mdelay(1); |
| 243 | writel(4, &clock->pll); | 243 | writel(4, &clock->pll); |
| 244 | while (readl(&clock->pll) & PLL_STATUS) | 244 | while (readl(&clock->pll) & PLL_STATUS) |
| 245 | ; | 245 | ; |
| 246 | writel(((mul - 1) << MUL_SHIFT) | (0xff << 3) | 0x0e, &clock->pll); | 246 | writel(((mul - 1) << MUL_SHIFT) | (0xff << 3) | 0x0e, &clock->pll); |
| 247 | msleep(75); | 247 | mdelay(75); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | static void __init tnetd7300_init_clocks(void) | 250 | static void __init tnetd7300_init_clocks(void) |
| @@ -456,7 +456,7 @@ void clk_put(struct clk *clk) | |||
| 456 | } | 456 | } |
| 457 | EXPORT_SYMBOL(clk_put); | 457 | EXPORT_SYMBOL(clk_put); |
| 458 | 458 | ||
| 459 | int __init ar7_init_clocks(void) | 459 | void __init ar7_init_clocks(void) |
| 460 | { | 460 | { |
| 461 | switch (ar7_chip_id()) { | 461 | switch (ar7_chip_id()) { |
| 462 | case AR7_CHIP_7100: | 462 | case AR7_CHIP_7100: |
| @@ -472,7 +472,4 @@ int __init ar7_init_clocks(void) | |||
| 472 | } | 472 | } |
| 473 | /* adjust vbus clock rate */ | 473 | /* adjust vbus clock rate */ |
| 474 | vbus_clk.rate = bus_clk.rate / 2; | 474 | vbus_clk.rate = bus_clk.rate / 2; |
| 475 | |||
| 476 | return 0; | ||
| 477 | } | 475 | } |
| 478 | arch_initcall(ar7_init_clocks); | ||
diff --git a/arch/mips/ar7/time.c b/arch/mips/ar7/time.c index 5fb8a0134085..22c93213b233 100644 --- a/arch/mips/ar7/time.c +++ b/arch/mips/ar7/time.c | |||
| @@ -30,6 +30,9 @@ void __init plat_time_init(void) | |||
| 30 | { | 30 | { |
| 31 | struct clk *cpu_clk; | 31 | struct clk *cpu_clk; |
| 32 | 32 | ||
| 33 | /* Initialize ar7 clocks so the CPU clock frequency is correct */ | ||
| 34 | ar7_init_clocks(); | ||
| 35 | |||
| 33 | cpu_clk = clk_get(NULL, "cpu"); | 36 | cpu_clk = clk_get(NULL, "cpu"); |
| 34 | if (IS_ERR(cpu_clk)) { | 37 | if (IS_ERR(cpu_clk)) { |
| 35 | printk(KERN_ERR "unable to get cpu clock\n"); | 38 | printk(KERN_ERR "unable to get cpu clock\n"); |
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index b1aee33efd11..c95f90bf734c 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <asm/reboot.h> | 32 | #include <asm/reboot.h> |
| 33 | #include <asm/time.h> | 33 | #include <asm/time.h> |
| 34 | #include <bcm47xx.h> | 34 | #include <bcm47xx.h> |
| 35 | #include <asm/fw/cfe/cfe_api.h> | ||
| 36 | #include <asm/mach-bcm47xx/nvram.h> | 35 | #include <asm/mach-bcm47xx/nvram.h> |
| 37 | 36 | ||
| 38 | struct ssb_bus ssb_bcm47xx; | 37 | struct ssb_bus ssb_bcm47xx; |
| @@ -57,68 +56,112 @@ static void bcm47xx_machine_halt(void) | |||
| 57 | cpu_relax(); | 56 | cpu_relax(); |
| 58 | } | 57 | } |
| 59 | 58 | ||
| 60 | static void str2eaddr(char *str, char *dest) | 59 | #define READ_FROM_NVRAM(_outvar, name, buf) \ |
| 61 | { | 60 | if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\ |
| 62 | int i = 0; | 61 | sprom->_outvar = simple_strtoul(buf, NULL, 0); |
| 63 | 62 | ||
| 64 | if (str == NULL) { | 63 | static void bcm47xx_fill_sprom(struct ssb_sprom *sprom) |
| 65 | memset(dest, 0, 6); | 64 | { |
| 66 | return; | 65 | char buf[100]; |
| 66 | u32 boardflags; | ||
| 67 | |||
| 68 | memset(sprom, 0, sizeof(struct ssb_sprom)); | ||
| 69 | |||
| 70 | sprom->revision = 1; /* Fallback: Old hardware does not define this. */ | ||
| 71 | READ_FROM_NVRAM(revision, "sromrev", buf); | ||
| 72 | if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0) | ||
| 73 | nvram_parse_macaddr(buf, sprom->il0mac); | ||
| 74 | if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0) | ||
| 75 | nvram_parse_macaddr(buf, sprom->et0mac); | ||
| 76 | if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0) | ||
| 77 | nvram_parse_macaddr(buf, sprom->et1mac); | ||
| 78 | READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf); | ||
| 79 | READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf); | ||
| 80 | READ_FROM_NVRAM(et0mdcport, "et0mdcport", buf); | ||
| 81 | READ_FROM_NVRAM(et1mdcport, "et1mdcport", buf); | ||
| 82 | READ_FROM_NVRAM(board_rev, "boardrev", buf); | ||
| 83 | READ_FROM_NVRAM(country_code, "ccode", buf); | ||
| 84 | READ_FROM_NVRAM(ant_available_a, "aa5g", buf); | ||
| 85 | READ_FROM_NVRAM(ant_available_bg, "aa2g", buf); | ||
| 86 | READ_FROM_NVRAM(pa0b0, "pa0b0", buf); | ||
| 87 | READ_FROM_NVRAM(pa0b1, "pa0b1", buf); | ||
| 88 | READ_FROM_NVRAM(pa0b2, "pa0b2", buf); | ||
| 89 | READ_FROM_NVRAM(pa1b0, "pa1b0", buf); | ||
| 90 | READ_FROM_NVRAM(pa1b1, "pa1b1", buf); | ||
| 91 | READ_FROM_NVRAM(pa1b2, "pa1b2", buf); | ||
| 92 | READ_FROM_NVRAM(pa1lob0, "pa1lob0", buf); | ||
| 93 | READ_FROM_NVRAM(pa1lob2, "pa1lob1", buf); | ||
| 94 | READ_FROM_NVRAM(pa1lob1, "pa1lob2", buf); | ||
| 95 | READ_FROM_NVRAM(pa1hib0, "pa1hib0", buf); | ||
| 96 | READ_FROM_NVRAM(pa1hib2, "pa1hib1", buf); | ||
| 97 | READ_FROM_NVRAM(pa1hib1, "pa1hib2", buf); | ||
| 98 | READ_FROM_NVRAM(gpio0, "wl0gpio0", buf); | ||
| 99 | READ_FROM_NVRAM(gpio1, "wl0gpio1", buf); | ||
| 100 | READ_FROM_NVRAM(gpio2, "wl0gpio2", buf); | ||
| 101 | READ_FROM_NVRAM(gpio3, "wl0gpio3", buf); | ||
| 102 | READ_FROM_NVRAM(maxpwr_bg, "pa0maxpwr", buf); | ||
| 103 | READ_FROM_NVRAM(maxpwr_al, "pa1lomaxpwr", buf); | ||
| 104 | READ_FROM_NVRAM(maxpwr_a, "pa1maxpwr", buf); | ||
| 105 | READ_FROM_NVRAM(maxpwr_ah, "pa1himaxpwr", buf); | ||
| 106 | READ_FROM_NVRAM(itssi_a, "pa1itssit", buf); | ||
| 107 | READ_FROM_NVRAM(itssi_bg, "pa0itssit", buf); | ||
| 108 | READ_FROM_NVRAM(tri2g, "tri2g", buf); | ||
| 109 | READ_FROM_NVRAM(tri5gl, "tri5gl", buf); | ||
| 110 | READ_FROM_NVRAM(tri5g, "tri5g", buf); | ||
| 111 | READ_FROM_NVRAM(tri5gh, "tri5gh", buf); | ||
| 112 | READ_FROM_NVRAM(rxpo2g, "rxpo2g", buf); | ||
| 113 | READ_FROM_NVRAM(rxpo5g, "rxpo5g", buf); | ||
| 114 | READ_FROM_NVRAM(rssisav2g, "rssisav2g", buf); | ||
| 115 | READ_FROM_NVRAM(rssismc2g, "rssismc2g", buf); | ||
| 116 | READ_FROM_NVRAM(rssismf2g, "rssismf2g", buf); | ||
| 117 | READ_FROM_NVRAM(bxa2g, "bxa2g", buf); | ||
| 118 | READ_FROM_NVRAM(rssisav5g, "rssisav5g", buf); | ||
| 119 | READ_FROM_NVRAM(rssismc5g, "rssismc5g", buf); | ||
| 120 | READ_FROM_NVRAM(rssismf5g, "rssismf5g", buf); | ||
| 121 | READ_FROM_NVRAM(bxa5g, "bxa5g", buf); | ||
| 122 | READ_FROM_NVRAM(cck2gpo, "cck2gpo", buf); | ||
| 123 | READ_FROM_NVRAM(ofdm2gpo, "ofdm2gpo", buf); | ||
| 124 | READ_FROM_NVRAM(ofdm5glpo, "ofdm5glpo", buf); | ||
| 125 | READ_FROM_NVRAM(ofdm5gpo, "ofdm5gpo", buf); | ||
| 126 | READ_FROM_NVRAM(ofdm5ghpo, "ofdm5ghpo", buf); | ||
| 127 | |||
| 128 | if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0) { | ||
| 129 | boardflags = simple_strtoul(buf, NULL, 0); | ||
| 130 | if (boardflags) { | ||
| 131 | sprom->boardflags_lo = (boardflags & 0x0000FFFFU); | ||
| 132 | sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16; | ||
| 133 | } | ||
| 67 | } | 134 | } |
| 68 | 135 | if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0) { | |
| 69 | for (;;) { | 136 | boardflags = simple_strtoul(buf, NULL, 0); |
| 70 | dest[i++] = (char) simple_strtoul(str, NULL, 16); | 137 | if (boardflags) { |
| 71 | str += 2; | 138 | sprom->boardflags2_lo = (boardflags & 0x0000FFFFU); |
| 72 | if (!*str++ || i == 6) | 139 | sprom->boardflags2_hi = (boardflags & 0xFFFF0000U) >> 16; |
| 73 | break; | 140 | } |
| 74 | } | 141 | } |
| 75 | } | 142 | } |
| 76 | 143 | ||
| 77 | static int bcm47xx_get_invariants(struct ssb_bus *bus, | 144 | static int bcm47xx_get_invariants(struct ssb_bus *bus, |
| 78 | struct ssb_init_invariants *iv) | 145 | struct ssb_init_invariants *iv) |
| 79 | { | 146 | { |
| 80 | char buf[100]; | 147 | char buf[20]; |
| 81 | 148 | ||
| 82 | /* Fill boardinfo structure */ | 149 | /* Fill boardinfo structure */ |
| 83 | memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); | 150 | memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); |
| 84 | 151 | ||
| 85 | if (cfe_getenv("boardvendor", buf, sizeof(buf)) >= 0 || | 152 | if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0) |
| 86 | nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0) | 153 | iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0); |
| 87 | iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); | 154 | else |
| 88 | if (cfe_getenv("boardtype", buf, sizeof(buf)) >= 0 || | 155 | iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM; |
| 89 | nvram_getenv("boardtype", buf, sizeof(buf)) >= 0) | 156 | if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0) |
| 90 | iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); | 157 | iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); |
| 91 | if (cfe_getenv("boardrev", buf, sizeof(buf)) >= 0 || | 158 | if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0) |
| 92 | nvram_getenv("boardrev", buf, sizeof(buf)) >= 0) | ||
| 93 | iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0); | 159 | iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0); |
| 94 | 160 | ||
| 95 | /* Fill sprom structure */ | 161 | bcm47xx_fill_sprom(&iv->sprom); |
| 96 | memset(&(iv->sprom), 0, sizeof(struct ssb_sprom)); | ||
| 97 | iv->sprom.revision = 3; | ||
| 98 | |||
| 99 | if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0 || | ||
| 100 | nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0) | ||
| 101 | str2eaddr(buf, iv->sprom.et0mac); | ||
| 102 | 162 | ||
| 103 | if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0 || | 163 | if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0) |
| 104 | nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0) | 164 | iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10); |
| 105 | str2eaddr(buf, iv->sprom.et1mac); | ||
| 106 | |||
| 107 | if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0 || | ||
| 108 | nvram_getenv("et0phyaddr", buf, sizeof(buf)) >= 0) | ||
| 109 | iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 0); | ||
| 110 | |||
| 111 | if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0 || | ||
| 112 | nvram_getenv("et1phyaddr", buf, sizeof(buf)) >= 0) | ||
| 113 | iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 0); | ||
| 114 | |||
| 115 | if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0 || | ||
| 116 | nvram_getenv("et0mdcport", buf, sizeof(buf)) >= 0) | ||
| 117 | iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10); | ||
| 118 | |||
| 119 | if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0 || | ||
| 120 | nvram_getenv("et1mdcport", buf, sizeof(buf)) >= 0) | ||
| 121 | iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10); | ||
| 122 | 165 | ||
| 123 | return 0; | 166 | return 0; |
| 124 | } | 167 | } |
| @@ -126,12 +169,28 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus, | |||
| 126 | void __init plat_mem_setup(void) | 169 | void __init plat_mem_setup(void) |
| 127 | { | 170 | { |
| 128 | int err; | 171 | int err; |
| 172 | char buf[100]; | ||
| 173 | struct ssb_mipscore *mcore; | ||
| 129 | 174 | ||
| 130 | err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, | 175 | err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, |
| 131 | bcm47xx_get_invariants); | 176 | bcm47xx_get_invariants); |
| 132 | if (err) | 177 | if (err) |
| 133 | panic("Failed to initialize SSB bus (err %d)\n", err); | 178 | panic("Failed to initialize SSB bus (err %d)\n", err); |
| 134 | 179 | ||
| 180 | mcore = &ssb_bcm47xx.mipscore; | ||
| 181 | if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) { | ||
| 182 | if (strstr(buf, "console=ttyS1")) { | ||
| 183 | struct ssb_serial_port port; | ||
| 184 | |||
| 185 | printk(KERN_DEBUG "Swapping serial ports!\n"); | ||
| 186 | /* swap serial ports */ | ||
| 187 | memcpy(&port, &mcore->serial_ports[0], sizeof(port)); | ||
| 188 | memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], | ||
| 189 | sizeof(port)); | ||
| 190 | memcpy(&mcore->serial_ports[1], &port, sizeof(port)); | ||
| 191 | } | ||
| 192 | } | ||
| 193 | |||
| 135 | _machine_restart = bcm47xx_machine_restart; | 194 | _machine_restart = bcm47xx_machine_restart; |
| 136 | _machine_halt = bcm47xx_machine_halt; | 195 | _machine_halt = bcm47xx_machine_halt; |
| 137 | pm_power_off = bcm47xx_machine_halt; | 196 | pm_power_off = bcm47xx_machine_halt; |
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h index 06d59dcbe243..86877539c6e8 100644 --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h | |||
| @@ -111,8 +111,8 @@ | |||
| 111 | * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM | 111 | * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM |
| 112 | */ | 112 | */ |
| 113 | 113 | ||
| 114 | #define PRID_IMP_BMIPS4KC 0x4000 | 114 | #define PRID_IMP_BMIPS32_REV4 0x4000 |
| 115 | #define PRID_IMP_BMIPS32 0x8000 | 115 | #define PRID_IMP_BMIPS32_REV8 0x8000 |
| 116 | #define PRID_IMP_BMIPS3300 0x9000 | 116 | #define PRID_IMP_BMIPS3300 0x9000 |
| 117 | #define PRID_IMP_BMIPS3300_ALT 0x9100 | 117 | #define PRID_IMP_BMIPS3300_ALT 0x9100 |
| 118 | #define PRID_IMP_BMIPS3300_BUG 0x0000 | 118 | #define PRID_IMP_BMIPS3300_BUG 0x0000 |
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h index fd1d39eb7431..455c0ac7d4ea 100644 --- a/arch/mips/include/asm/elf.h +++ b/arch/mips/include/asm/elf.h | |||
| @@ -249,7 +249,8 @@ extern struct mips_abi mips_abi_n32; | |||
| 249 | 249 | ||
| 250 | #define SET_PERSONALITY(ex) \ | 250 | #define SET_PERSONALITY(ex) \ |
| 251 | do { \ | 251 | do { \ |
| 252 | set_personality(PER_LINUX); \ | 252 | if (personality(current->personality) != PER_LINUX) \ |
| 253 | set_personality(PER_LINUX); \ | ||
| 253 | \ | 254 | \ |
| 254 | current->thread.abi = &mips_abi; \ | 255 | current->thread.abi = &mips_abi; \ |
| 255 | } while (0) | 256 | } while (0) |
| @@ -296,6 +297,8 @@ do { \ | |||
| 296 | 297 | ||
| 297 | #define SET_PERSONALITY(ex) \ | 298 | #define SET_PERSONALITY(ex) \ |
| 298 | do { \ | 299 | do { \ |
| 300 | unsigned int p; \ | ||
| 301 | \ | ||
| 299 | clear_thread_flag(TIF_32BIT_REGS); \ | 302 | clear_thread_flag(TIF_32BIT_REGS); \ |
| 300 | clear_thread_flag(TIF_32BIT_ADDR); \ | 303 | clear_thread_flag(TIF_32BIT_ADDR); \ |
| 301 | \ | 304 | \ |
| @@ -304,7 +307,8 @@ do { \ | |||
| 304 | else \ | 307 | else \ |
| 305 | current->thread.abi = &mips_abi; \ | 308 | current->thread.abi = &mips_abi; \ |
| 306 | \ | 309 | \ |
| 307 | if (current->personality != PER_LINUX32) \ | 310 | p = personality(current->personality); \ |
| 311 | if (p != PER_LINUX32 && p != PER_LINUX) \ | ||
| 308 | set_personality(PER_LINUX); \ | 312 | set_personality(PER_LINUX); \ |
| 309 | } while (0) | 313 | } while (0) |
| 310 | 314 | ||
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index c98bf514ec7d..5b017f23e243 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h | |||
| @@ -329,10 +329,14 @@ static inline void pfx##write##bwlq(type val, \ | |||
| 329 | "dsrl32 %L0, %L0, 0" "\n\t" \ | 329 | "dsrl32 %L0, %L0, 0" "\n\t" \ |
| 330 | "dsll32 %M0, %M0, 0" "\n\t" \ | 330 | "dsll32 %M0, %M0, 0" "\n\t" \ |
| 331 | "or %L0, %L0, %M0" "\n\t" \ | 331 | "or %L0, %L0, %M0" "\n\t" \ |
| 332 | ".set push" "\n\t" \ | ||
| 333 | ".set noreorder" "\n\t" \ | ||
| 334 | ".set nomacro" "\n\t" \ | ||
| 332 | "sd %L0, %2" "\n\t" \ | 335 | "sd %L0, %2" "\n\t" \ |
| 336 | ".set pop" "\n\t" \ | ||
| 333 | ".set mips0" "\n" \ | 337 | ".set mips0" "\n" \ |
| 334 | : "=r" (__tmp) \ | 338 | : "=r" (__tmp) \ |
| 335 | : "0" (__val), "m" (*__mem)); \ | 339 | : "0" (__val), "R" (*__mem)); \ |
| 336 | if (irq) \ | 340 | if (irq) \ |
| 337 | local_irq_restore(__flags); \ | 341 | local_irq_restore(__flags); \ |
| 338 | } else \ | 342 | } else \ |
| @@ -355,12 +359,16 @@ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \ | |||
| 355 | local_irq_save(__flags); \ | 359 | local_irq_save(__flags); \ |
| 356 | __asm__ __volatile__( \ | 360 | __asm__ __volatile__( \ |
| 357 | ".set mips3" "\t\t# __readq" "\n\t" \ | 361 | ".set mips3" "\t\t# __readq" "\n\t" \ |
| 362 | ".set push" "\n\t" \ | ||
| 363 | ".set noreorder" "\n\t" \ | ||
| 364 | ".set nomacro" "\n\t" \ | ||
| 358 | "ld %L0, %1" "\n\t" \ | 365 | "ld %L0, %1" "\n\t" \ |
| 366 | ".set pop" "\n\t" \ | ||
| 359 | "dsra32 %M0, %L0, 0" "\n\t" \ | 367 | "dsra32 %M0, %L0, 0" "\n\t" \ |
| 360 | "sll %L0, %L0, 0" "\n\t" \ | 368 | "sll %L0, %L0, 0" "\n\t" \ |
| 361 | ".set mips0" "\n" \ | 369 | ".set mips0" "\n" \ |
| 362 | : "=r" (__val) \ | 370 | : "=r" (__val) \ |
| 363 | : "m" (*__mem)); \ | 371 | : "R" (*__mem)); \ |
| 364 | if (irq) \ | 372 | if (irq) \ |
| 365 | local_irq_restore(__flags); \ | 373 | local_irq_restore(__flags); \ |
| 366 | } else { \ | 374 | } else { \ |
diff --git a/arch/mips/include/asm/mach-ar7/ar7.h b/arch/mips/include/asm/mach-ar7/ar7.h index 7919d76186bf..07d3fadb2443 100644 --- a/arch/mips/include/asm/mach-ar7/ar7.h +++ b/arch/mips/include/asm/mach-ar7/ar7.h | |||
| @@ -201,7 +201,6 @@ static inline void ar7_device_off(u32 bit) | |||
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | int __init ar7_gpio_init(void); | 203 | int __init ar7_gpio_init(void); |
| 204 | 204 | void __init ar7_init_clocks(void); | |
| 205 | int __init ar7_gpio_init(void); | ||
| 206 | 205 | ||
| 207 | #endif /* __AR7_H__ */ | 206 | #endif /* __AR7_H__ */ |
diff --git a/arch/mips/include/asm/mach-bcm47xx/nvram.h b/arch/mips/include/asm/mach-bcm47xx/nvram.h index c58ebd8bc155..9759588ba3cf 100644 --- a/arch/mips/include/asm/mach-bcm47xx/nvram.h +++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define __NVRAM_H | 12 | #define __NVRAM_H |
| 13 | 13 | ||
| 14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/kernel.h> | ||
| 15 | 16 | ||
| 16 | struct nvram_header { | 17 | struct nvram_header { |
| 17 | u32 magic; | 18 | u32 magic; |
| @@ -36,4 +37,10 @@ struct nvram_header { | |||
| 36 | 37 | ||
| 37 | extern int nvram_getenv(char *name, char *val, size_t val_len); | 38 | extern int nvram_getenv(char *name, char *val, size_t val_len); |
| 38 | 39 | ||
| 40 | static inline void nvram_parse_macaddr(char *buf, u8 *macaddr) | ||
| 41 | { | ||
| 42 | sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1], | ||
| 43 | &macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]); | ||
| 44 | } | ||
| 45 | |||
| 39 | #endif | 46 | #endif |
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c index 5742bb4d78f4..5c0a3575877c 100644 --- a/arch/mips/jz4740/board-qi_lb60.c +++ b/arch/mips/jz4740/board-qi_lb60.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * | 5 | * |
| 6 | * Copyright (c) 2009 Qi Hardware inc., | 6 | * Copyright (c) 2009 Qi Hardware inc., |
| 7 | * Author: Xiangfu Liu <xiangfu@qi-hardware.com> | 7 | * Author: Xiangfu Liu <xiangfu@qi-hardware.com> |
| 8 | * Copyright 2010, Lars-Petrer Clausen <lars@metafoo.de> | 8 | * Copyright 2010, Lars-Peter Clausen <lars@metafoo.de> |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 or later | 11 | * 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 | QI_LB60_GPIO_KEYIN(3), | 235 | QI_LB60_GPIO_KEYIN(3), |
| 236 | QI_LB60_GPIO_KEYIN(4), | 236 | QI_LB60_GPIO_KEYIN(4), |
| 237 | QI_LB60_GPIO_KEYIN(5), | 237 | QI_LB60_GPIO_KEYIN(5), |
| 238 | QI_LB60_GPIO_KEYIN(7), | 238 | QI_LB60_GPIO_KEYIN(6), |
| 239 | QI_LB60_GPIO_KEYIN8, | 239 | QI_LB60_GPIO_KEYIN8, |
| 240 | }; | 240 | }; |
| 241 | 241 | ||
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c index 95bc2b5b14f1..1cc9e544d16b 100644 --- a/arch/mips/jz4740/platform.c +++ b/arch/mips/jz4740/platform.c | |||
| @@ -208,7 +208,7 @@ struct platform_device jz4740_i2s_device = { | |||
| 208 | 208 | ||
| 209 | /* PCM */ | 209 | /* PCM */ |
| 210 | struct platform_device jz4740_pcm_device = { | 210 | struct platform_device jz4740_pcm_device = { |
| 211 | .name = "jz4740-pcm", | 211 | .name = "jz4740-pcm-audio", |
| 212 | .id = -1, | 212 | .id = -1, |
| 213 | }; | 213 | }; |
| 214 | 214 | ||
diff --git a/arch/mips/jz4740/prom.c b/arch/mips/jz4740/prom.c index cfeac15eb2e4..4a70407f55bb 100644 --- a/arch/mips/jz4740/prom.c +++ b/arch/mips/jz4740/prom.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | #include <asm/bootinfo.h> | 23 | #include <asm/bootinfo.h> |
| 24 | #include <asm/mach-jz4740/base.h> | 24 | #include <asm/mach-jz4740/base.h> |
| 25 | 25 | ||
| 26 | void jz4740_init_cmdline(int argc, char *argv[]) | 26 | static __init void jz4740_init_cmdline(int argc, char *argv[]) |
| 27 | { | 27 | { |
| 28 | unsigned int count = COMMAND_LINE_SIZE - 1; | 28 | unsigned int count = COMMAND_LINE_SIZE - 1; |
| 29 | int i; | 29 | int i; |
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c index 2f4d7a99bcc2..98c5a9737c14 100644 --- a/arch/mips/kernel/cevt-r4k.c +++ b/arch/mips/kernel/cevt-r4k.c | |||
| @@ -32,7 +32,7 @@ static int mips_next_event(unsigned long delta, | |||
| 32 | cnt = read_c0_count(); | 32 | cnt = read_c0_count(); |
| 33 | cnt += delta; | 33 | cnt += delta; |
| 34 | write_c0_compare(cnt); | 34 | write_c0_compare(cnt); |
| 35 | res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0; | 35 | res = ((int)(read_c0_count() - cnt) >= 0) ? -ETIME : 0; |
| 36 | return res; | 36 | return res; |
| 37 | } | 37 | } |
| 38 | 38 | ||
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 71620e19827a..68dae7b6b5db 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
| @@ -905,7 +905,8 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) | |||
| 905 | { | 905 | { |
| 906 | decode_configs(c); | 906 | decode_configs(c); |
| 907 | switch (c->processor_id & 0xff00) { | 907 | switch (c->processor_id & 0xff00) { |
| 908 | case PRID_IMP_BMIPS32: | 908 | case PRID_IMP_BMIPS32_REV4: |
| 909 | case PRID_IMP_BMIPS32_REV8: | ||
| 909 | c->cputype = CPU_BMIPS32; | 910 | c->cputype = CPU_BMIPS32; |
| 910 | __cpu_name[cpu] = "Broadcom BMIPS32"; | 911 | __cpu_name[cpu] = "Broadcom BMIPS32"; |
| 911 | break; | 912 | break; |
| @@ -933,10 +934,6 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) | |||
| 933 | __cpu_name[cpu] = "Broadcom BMIPS5000"; | 934 | __cpu_name[cpu] = "Broadcom BMIPS5000"; |
| 934 | c->options |= MIPS_CPU_ULRI; | 935 | c->options |= MIPS_CPU_ULRI; |
| 935 | break; | 936 | break; |
| 936 | case PRID_IMP_BMIPS4KC: | ||
| 937 | c->cputype = CPU_4KC; | ||
| 938 | __cpu_name[cpu] = "MIPS 4Kc"; | ||
| 939 | break; | ||
| 940 | } | 937 | } |
| 941 | } | 938 | } |
| 942 | 939 | ||
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 6343b4a5b835..876a75cc376f 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
| @@ -251,14 +251,15 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz, | |||
| 251 | 251 | ||
| 252 | SYSCALL_DEFINE1(32_personality, unsigned long, personality) | 252 | SYSCALL_DEFINE1(32_personality, unsigned long, personality) |
| 253 | { | 253 | { |
| 254 | unsigned int p = personality & 0xffffffff; | ||
| 254 | int ret; | 255 | int ret; |
| 255 | personality &= 0xffffffff; | 256 | |
| 256 | if (personality(current->personality) == PER_LINUX32 && | 257 | if (personality(current->personality) == PER_LINUX32 && |
| 257 | personality == PER_LINUX) | 258 | personality(p) == PER_LINUX) |
| 258 | personality = PER_LINUX32; | 259 | p = (p & ~PER_MASK) | PER_LINUX32; |
| 259 | ret = sys_personality(personality); | 260 | ret = sys_personality(p); |
| 260 | if (ret == PER_LINUX32) | 261 | if (ret != -1 && personality(ret) == PER_LINUX32) |
| 261 | ret = PER_LINUX; | 262 | ret = (ret & ~PER_MASK) | PER_LINUX; |
| 262 | return ret; | 263 | return ret; |
| 263 | } | 264 | } |
| 264 | 265 | ||
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 99960940d4a4..ae167df73ddd 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
| @@ -142,7 +142,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
| 142 | childregs->regs[7] = 0; /* Clear error flag */ | 142 | childregs->regs[7] = 0; /* Clear error flag */ |
| 143 | 143 | ||
| 144 | childregs->regs[2] = 0; /* Child gets zero as return value */ | 144 | childregs->regs[2] = 0; /* Child gets zero as return value */ |
| 145 | regs->regs[2] = p->pid; | ||
| 146 | 145 | ||
| 147 | if (childregs->cp0_status & ST0_CU0) { | 146 | if (childregs->cp0_status & ST0_CU0) { |
| 148 | childregs->regs[28] = (unsigned long) ti; | 147 | childregs->regs[28] = (unsigned long) ti; |
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c index e000b278f024..9dbe58368953 100644 --- a/arch/mips/kernel/prom.c +++ b/arch/mips/kernel/prom.c | |||
| @@ -100,7 +100,7 @@ void __init device_tree_init(void) | |||
| 100 | return; | 100 | return; |
| 101 | 101 | ||
| 102 | base = virt_to_phys((void *)initial_boot_params); | 102 | base = virt_to_phys((void *)initial_boot_params); |
| 103 | size = initial_boot_params->totalsize; | 103 | size = be32_to_cpu(initial_boot_params->totalsize); |
| 104 | 104 | ||
| 105 | /* Before we do anything, lets reserve the dt blob */ | 105 | /* Before we do anything, lets reserve the dt blob */ |
| 106 | reserve_mem_mach(base, size); | 106 | reserve_mem_mach(base, size); |
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c index 43e7cdc5ded2..c0e81418ba21 100644 --- a/arch/mips/kernel/smp-mt.c +++ b/arch/mips/kernel/smp-mt.c | |||
| @@ -153,7 +153,7 @@ static void __cpuinit vsmp_init_secondary(void) | |||
| 153 | { | 153 | { |
| 154 | extern int gic_present; | 154 | extern int gic_present; |
| 155 | 155 | ||
| 156 | /* This is Malta specific: IPI,performance and timer inetrrupts */ | 156 | /* This is Malta specific: IPI,performance and timer interrupts */ |
| 157 | if (gic_present) | 157 | if (gic_present) |
| 158 | change_c0_status(ST0_IM, STATUSF_IP3 | STATUSF_IP4 | | 158 | change_c0_status(ST0_IM, STATUSF_IP3 | STATUSF_IP4 | |
| 159 | STATUSF_IP6 | STATUSF_IP7); | 159 | STATUSF_IP6 | STATUSF_IP7); |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 8e9fbe75894e..e97104302541 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
| @@ -83,7 +83,8 @@ extern asmlinkage void handle_mcheck(void); | |||
| 83 | extern asmlinkage void handle_reserved(void); | 83 | extern asmlinkage void handle_reserved(void); |
| 84 | 84 | ||
| 85 | extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, | 85 | extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, |
| 86 | struct mips_fpu_struct *ctx, int has_fpu); | 86 | struct mips_fpu_struct *ctx, int has_fpu, |
| 87 | void *__user *fault_addr); | ||
| 87 | 88 | ||
| 88 | void (*board_be_init)(void); | 89 | void (*board_be_init)(void); |
| 89 | int (*board_be_handler)(struct pt_regs *regs, int is_fixup); | 90 | int (*board_be_handler)(struct pt_regs *regs, int is_fixup); |
| @@ -661,12 +662,36 @@ asmlinkage void do_ov(struct pt_regs *regs) | |||
| 661 | force_sig_info(SIGFPE, &info, current); | 662 | force_sig_info(SIGFPE, &info, current); |
| 662 | } | 663 | } |
| 663 | 664 | ||
| 665 | static int process_fpemu_return(int sig, void __user *fault_addr) | ||
| 666 | { | ||
| 667 | if (sig == SIGSEGV || sig == SIGBUS) { | ||
| 668 | struct siginfo si = {0}; | ||
| 669 | si.si_addr = fault_addr; | ||
| 670 | si.si_signo = sig; | ||
| 671 | if (sig == SIGSEGV) { | ||
| 672 | if (find_vma(current->mm, (unsigned long)fault_addr)) | ||
| 673 | si.si_code = SEGV_ACCERR; | ||
| 674 | else | ||
| 675 | si.si_code = SEGV_MAPERR; | ||
| 676 | } else { | ||
| 677 | si.si_code = BUS_ADRERR; | ||
| 678 | } | ||
| 679 | force_sig_info(sig, &si, current); | ||
| 680 | return 1; | ||
| 681 | } else if (sig) { | ||
| 682 | force_sig(sig, current); | ||
| 683 | return 1; | ||
| 684 | } else { | ||
| 685 | return 0; | ||
| 686 | } | ||
| 687 | } | ||
| 688 | |||
| 664 | /* | 689 | /* |
| 665 | * XXX Delayed fp exceptions when doing a lazy ctx switch XXX | 690 | * XXX Delayed fp exceptions when doing a lazy ctx switch XXX |
| 666 | */ | 691 | */ |
| 667 | asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) | 692 | asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) |
| 668 | { | 693 | { |
| 669 | siginfo_t info; | 694 | siginfo_t info = {0}; |
| 670 | 695 | ||
| 671 | if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs), SIGFPE) | 696 | if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs), SIGFPE) |
| 672 | == NOTIFY_STOP) | 697 | == NOTIFY_STOP) |
| @@ -675,6 +700,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) | |||
| 675 | 700 | ||
| 676 | if (fcr31 & FPU_CSR_UNI_X) { | 701 | if (fcr31 & FPU_CSR_UNI_X) { |
| 677 | int sig; | 702 | int sig; |
| 703 | void __user *fault_addr = NULL; | ||
| 678 | 704 | ||
| 679 | /* | 705 | /* |
| 680 | * Unimplemented operation exception. If we've got the full | 706 | * 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 | lose_fpu(1); | 716 | lose_fpu(1); |
| 691 | 717 | ||
| 692 | /* Run the emulator */ | 718 | /* Run the emulator */ |
| 693 | sig = fpu_emulator_cop1Handler(regs, ¤t->thread.fpu, 1); | 719 | sig = fpu_emulator_cop1Handler(regs, ¤t->thread.fpu, 1, |
| 720 | &fault_addr); | ||
| 694 | 721 | ||
| 695 | /* | 722 | /* |
| 696 | * We can't allow the emulated instruction to leave any of | 723 | * 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 | own_fpu(1); /* Using the FPU again. */ | 729 | own_fpu(1); /* Using the FPU again. */ |
| 703 | 730 | ||
| 704 | /* If something went wrong, signal */ | 731 | /* If something went wrong, signal */ |
| 705 | if (sig) | 732 | process_fpemu_return(sig, fault_addr); |
| 706 | force_sig(sig, current); | ||
| 707 | 733 | ||
| 708 | return; | 734 | return; |
| 709 | } else if (fcr31 & FPU_CSR_INV_X) | 735 | } else if (fcr31 & FPU_CSR_INV_X) |
| @@ -996,11 +1022,11 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
| 996 | 1022 | ||
| 997 | if (!raw_cpu_has_fpu) { | 1023 | if (!raw_cpu_has_fpu) { |
| 998 | int sig; | 1024 | int sig; |
| 1025 | void __user *fault_addr = NULL; | ||
| 999 | sig = fpu_emulator_cop1Handler(regs, | 1026 | sig = fpu_emulator_cop1Handler(regs, |
| 1000 | ¤t->thread.fpu, 0); | 1027 | ¤t->thread.fpu, |
| 1001 | if (sig) | 1028 | 0, &fault_addr); |
| 1002 | force_sig(sig, current); | 1029 | if (!process_fpemu_return(sig, fault_addr)) |
| 1003 | else | ||
| 1004 | mt_ase_fp_affinity(); | 1030 | mt_ase_fp_affinity(); |
| 1005 | } | 1031 | } |
| 1006 | 1032 | ||
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 3eb3cde2f661..6a1fdfef8fde 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
| @@ -1092,6 +1092,10 @@ static int vpe_open(struct inode *inode, struct file *filp) | |||
| 1092 | 1092 | ||
| 1093 | /* this of-course trashes what was there before... */ | 1093 | /* this of-course trashes what was there before... */ |
| 1094 | v->pbuffer = vmalloc(P_SIZE); | 1094 | v->pbuffer = vmalloc(P_SIZE); |
| 1095 | if (!v->pbuffer) { | ||
| 1096 | pr_warning("VPE loader: unable to allocate memory\n"); | ||
| 1097 | return -ENOMEM; | ||
| 1098 | } | ||
| 1095 | v->plen = P_SIZE; | 1099 | v->plen = P_SIZE; |
| 1096 | v->load_addr = NULL; | 1100 | v->load_addr = NULL; |
| 1097 | v->len = 0; | 1101 | v->len = 0; |
| @@ -1149,10 +1153,9 @@ static int vpe_release(struct inode *inode, struct file *filp) | |||
| 1149 | if (ret < 0) | 1153 | if (ret < 0) |
| 1150 | v->shared_ptr = NULL; | 1154 | v->shared_ptr = NULL; |
| 1151 | 1155 | ||
| 1152 | // cleanup any temp buffers | 1156 | vfree(v->pbuffer); |
| 1153 | if (v->pbuffer) | ||
| 1154 | vfree(v->pbuffer); | ||
| 1155 | v->plen = 0; | 1157 | v->plen = 0; |
| 1158 | |||
| 1156 | return ret; | 1159 | return ret; |
| 1157 | } | 1160 | } |
| 1158 | 1161 | ||
| @@ -1169,11 +1172,6 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, | |||
| 1169 | if (v == NULL) | 1172 | if (v == NULL) |
| 1170 | return -ENODEV; | 1173 | return -ENODEV; |
| 1171 | 1174 | ||
| 1172 | if (v->pbuffer == NULL) { | ||
| 1173 | printk(KERN_ERR "VPE loader: no buffer for program\n"); | ||
| 1174 | return -ENOMEM; | ||
| 1175 | } | ||
| 1176 | |||
| 1177 | if ((count + v->len) > v->plen) { | 1175 | if ((count + v->len) > v->plen) { |
| 1178 | printk(KERN_WARNING | 1176 | printk(KERN_WARNING |
| 1179 | "VPE loader: elf size too big. Perhaps strip uneeded symbols\n"); | 1177 | "VPE loader: elf size too big. Perhaps strip uneeded symbols\n"); |
diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S index 77dc3b20110a..606c8a9efe3b 100644 --- a/arch/mips/lib/memset.S +++ b/arch/mips/lib/memset.S | |||
| @@ -161,16 +161,16 @@ FEXPORT(__bzero) | |||
| 161 | 161 | ||
| 162 | .Lfwd_fixup: | 162 | .Lfwd_fixup: |
| 163 | PTR_L t0, TI_TASK($28) | 163 | PTR_L t0, TI_TASK($28) |
| 164 | LONG_L t0, THREAD_BUADDR(t0) | ||
| 165 | andi a2, 0x3f | 164 | andi a2, 0x3f |
| 165 | LONG_L t0, THREAD_BUADDR(t0) | ||
| 166 | LONG_ADDU a2, t1 | 166 | LONG_ADDU a2, t1 |
| 167 | jr ra | 167 | jr ra |
| 168 | LONG_SUBU a2, t0 | 168 | LONG_SUBU a2, t0 |
| 169 | 169 | ||
| 170 | .Lpartial_fixup: | 170 | .Lpartial_fixup: |
| 171 | PTR_L t0, TI_TASK($28) | 171 | PTR_L t0, TI_TASK($28) |
| 172 | LONG_L t0, THREAD_BUADDR(t0) | ||
| 173 | andi a2, LONGMASK | 172 | andi a2, LONGMASK |
| 173 | LONG_L t0, THREAD_BUADDR(t0) | ||
| 174 | LONG_ADDU a2, t1 | 174 | LONG_ADDU a2, t1 |
| 175 | jr ra | 175 | jr ra |
| 176 | LONG_SUBU a2, t0 | 176 | LONG_SUBU a2, t0 |
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c index ae4cff97a56c..11b193f848f8 100644 --- a/arch/mips/loongson/common/env.c +++ b/arch/mips/loongson/common/env.c | |||
| @@ -29,9 +29,9 @@ unsigned long memsize, highmemsize; | |||
| 29 | 29 | ||
| 30 | #define parse_even_earlier(res, option, p) \ | 30 | #define parse_even_earlier(res, option, p) \ |
| 31 | do { \ | 31 | do { \ |
| 32 | int ret; \ | ||
| 32 | if (strncmp(option, (char *)p, strlen(option)) == 0) \ | 33 | if (strncmp(option, (char *)p, strlen(option)) == 0) \ |
| 33 | strict_strtol((char *)p + strlen(option"="), \ | 34 | ret = strict_strtol((char *)p + strlen(option"="), 10, &res); \ |
| 34 | 10, &res); \ | ||
| 35 | } while (0) | 35 | } while (0) |
| 36 | 36 | ||
| 37 | void __init prom_init_env(void) | 37 | void __init prom_init_env(void) |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index b2ad1b0910ff..d32cb0503110 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
| @@ -64,7 +64,7 @@ static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *, | |||
| 64 | 64 | ||
| 65 | #if __mips >= 4 && __mips != 32 | 65 | #if __mips >= 4 && __mips != 32 |
| 66 | static int fpux_emu(struct pt_regs *, | 66 | static int fpux_emu(struct pt_regs *, |
| 67 | struct mips_fpu_struct *, mips_instruction); | 67 | struct mips_fpu_struct *, mips_instruction, void *__user *); |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | /* Further private data for which no space exists in mips_fpu_struct */ | 70 | /* 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 | * Two instructions if the instruction is in a branch delay slot. | 208 | * Two instructions if the instruction is in a branch delay slot. |
| 209 | */ | 209 | */ |
| 210 | 210 | ||
| 211 | static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | 211 | static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx, |
| 212 | void *__user *fault_addr) | ||
| 212 | { | 213 | { |
| 213 | mips_instruction ir; | 214 | mips_instruction ir; |
| 214 | unsigned long emulpc, contpc; | 215 | unsigned long emulpc, contpc; |
| 215 | unsigned int cond; | 216 | unsigned int cond; |
| 216 | 217 | ||
| 217 | if (get_user(ir, (mips_instruction __user *) xcp->cp0_epc)) { | 218 | if (!access_ok(VERIFY_READ, xcp->cp0_epc, sizeof(mips_instruction))) { |
| 218 | MIPS_FPU_EMU_INC_STATS(errors); | 219 | MIPS_FPU_EMU_INC_STATS(errors); |
| 220 | *fault_addr = (mips_instruction __user *)xcp->cp0_epc; | ||
| 219 | return SIGBUS; | 221 | return SIGBUS; |
| 220 | } | 222 | } |
| 223 | if (__get_user(ir, (mips_instruction __user *) xcp->cp0_epc)) { | ||
| 224 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 225 | *fault_addr = (mips_instruction __user *)xcp->cp0_epc; | ||
| 226 | return SIGSEGV; | ||
| 227 | } | ||
| 221 | 228 | ||
| 222 | /* XXX NEC Vr54xx bug workaround */ | 229 | /* XXX NEC Vr54xx bug workaround */ |
| 223 | if ((xcp->cp0_cause & CAUSEF_BD) && !isBranchInstr(&ir)) | 230 | 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 | #endif | 252 | #endif |
| 246 | return SIGILL; | 253 | return SIGILL; |
| 247 | } | 254 | } |
| 248 | if (get_user(ir, (mips_instruction __user *) emulpc)) { | 255 | if (!access_ok(VERIFY_READ, emulpc, sizeof(mips_instruction))) { |
| 249 | MIPS_FPU_EMU_INC_STATS(errors); | 256 | MIPS_FPU_EMU_INC_STATS(errors); |
| 257 | *fault_addr = (mips_instruction __user *)emulpc; | ||
| 250 | return SIGBUS; | 258 | return SIGBUS; |
| 251 | } | 259 | } |
| 260 | if (__get_user(ir, (mips_instruction __user *) emulpc)) { | ||
| 261 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 262 | *fault_addr = (mips_instruction __user *)emulpc; | ||
| 263 | return SIGSEGV; | ||
| 264 | } | ||
| 252 | /* __compute_return_epc() will have updated cp0_epc */ | 265 | /* __compute_return_epc() will have updated cp0_epc */ |
| 253 | contpc = xcp->cp0_epc; | 266 | contpc = xcp->cp0_epc; |
| 254 | /* In order not to confuse ptrace() et al, tweak context */ | 267 | /* 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 | u64 val; | 282 | u64 val; |
| 270 | 283 | ||
| 271 | MIPS_FPU_EMU_INC_STATS(loads); | 284 | MIPS_FPU_EMU_INC_STATS(loads); |
| 272 | if (get_user(val, va)) { | 285 | |
| 286 | if (!access_ok(VERIFY_READ, va, sizeof(u64))) { | ||
| 273 | MIPS_FPU_EMU_INC_STATS(errors); | 287 | MIPS_FPU_EMU_INC_STATS(errors); |
| 288 | *fault_addr = va; | ||
| 274 | return SIGBUS; | 289 | return SIGBUS; |
| 275 | } | 290 | } |
| 291 | if (__get_user(val, va)) { | ||
| 292 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 293 | *fault_addr = va; | ||
| 294 | return SIGSEGV; | ||
| 295 | } | ||
| 276 | DITOREG(val, MIPSInst_RT(ir)); | 296 | DITOREG(val, MIPSInst_RT(ir)); |
| 277 | break; | 297 | break; |
| 278 | } | 298 | } |
| @@ -284,10 +304,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | |||
| 284 | 304 | ||
| 285 | MIPS_FPU_EMU_INC_STATS(stores); | 305 | MIPS_FPU_EMU_INC_STATS(stores); |
| 286 | DIFROMREG(val, MIPSInst_RT(ir)); | 306 | DIFROMREG(val, MIPSInst_RT(ir)); |
| 287 | if (put_user(val, va)) { | 307 | if (!access_ok(VERIFY_WRITE, va, sizeof(u64))) { |
| 288 | MIPS_FPU_EMU_INC_STATS(errors); | 308 | MIPS_FPU_EMU_INC_STATS(errors); |
| 309 | *fault_addr = va; | ||
| 289 | return SIGBUS; | 310 | return SIGBUS; |
| 290 | } | 311 | } |
| 312 | if (__put_user(val, va)) { | ||
| 313 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 314 | *fault_addr = va; | ||
| 315 | return SIGSEGV; | ||
| 316 | } | ||
| 291 | break; | 317 | break; |
| 292 | } | 318 | } |
| 293 | 319 | ||
| @@ -297,10 +323,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | |||
| 297 | u32 val; | 323 | u32 val; |
| 298 | 324 | ||
| 299 | MIPS_FPU_EMU_INC_STATS(loads); | 325 | MIPS_FPU_EMU_INC_STATS(loads); |
| 300 | if (get_user(val, va)) { | 326 | if (!access_ok(VERIFY_READ, va, sizeof(u32))) { |
| 301 | MIPS_FPU_EMU_INC_STATS(errors); | 327 | MIPS_FPU_EMU_INC_STATS(errors); |
| 328 | *fault_addr = va; | ||
| 302 | return SIGBUS; | 329 | return SIGBUS; |
| 303 | } | 330 | } |
| 331 | if (__get_user(val, va)) { | ||
| 332 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 333 | *fault_addr = va; | ||
| 334 | return SIGSEGV; | ||
| 335 | } | ||
| 304 | SITOREG(val, MIPSInst_RT(ir)); | 336 | SITOREG(val, MIPSInst_RT(ir)); |
| 305 | break; | 337 | break; |
| 306 | } | 338 | } |
| @@ -312,10 +344,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | |||
| 312 | 344 | ||
| 313 | MIPS_FPU_EMU_INC_STATS(stores); | 345 | MIPS_FPU_EMU_INC_STATS(stores); |
| 314 | SIFROMREG(val, MIPSInst_RT(ir)); | 346 | SIFROMREG(val, MIPSInst_RT(ir)); |
| 315 | if (put_user(val, va)) { | 347 | if (!access_ok(VERIFY_WRITE, va, sizeof(u32))) { |
| 316 | MIPS_FPU_EMU_INC_STATS(errors); | 348 | MIPS_FPU_EMU_INC_STATS(errors); |
| 349 | *fault_addr = va; | ||
| 317 | return SIGBUS; | 350 | return SIGBUS; |
| 318 | } | 351 | } |
| 352 | if (__put_user(val, va)) { | ||
| 353 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 354 | *fault_addr = va; | ||
| 355 | return SIGSEGV; | ||
| 356 | } | ||
| 319 | break; | 357 | break; |
| 320 | } | 358 | } |
| 321 | 359 | ||
| @@ -440,11 +478,18 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | |||
| 440 | contpc = (xcp->cp0_epc + | 478 | contpc = (xcp->cp0_epc + |
| 441 | (MIPSInst_SIMM(ir) << 2)); | 479 | (MIPSInst_SIMM(ir) << 2)); |
| 442 | 480 | ||
| 443 | if (get_user(ir, | 481 | if (!access_ok(VERIFY_READ, xcp->cp0_epc, |
| 444 | (mips_instruction __user *) xcp->cp0_epc)) { | 482 | sizeof(mips_instruction))) { |
| 445 | MIPS_FPU_EMU_INC_STATS(errors); | 483 | MIPS_FPU_EMU_INC_STATS(errors); |
| 484 | *fault_addr = (mips_instruction __user *)xcp->cp0_epc; | ||
| 446 | return SIGBUS; | 485 | return SIGBUS; |
| 447 | } | 486 | } |
| 487 | if (__get_user(ir, | ||
| 488 | (mips_instruction __user *) xcp->cp0_epc)) { | ||
| 489 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 490 | *fault_addr = (mips_instruction __user *)xcp->cp0_epc; | ||
| 491 | return SIGSEGV; | ||
| 492 | } | ||
| 448 | 493 | ||
| 449 | switch (MIPSInst_OPCODE(ir)) { | 494 | switch (MIPSInst_OPCODE(ir)) { |
| 450 | case lwc1_op: | 495 | case lwc1_op: |
| @@ -506,9 +551,8 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | |||
| 506 | 551 | ||
| 507 | #if __mips >= 4 && __mips != 32 | 552 | #if __mips >= 4 && __mips != 32 |
| 508 | case cop1x_op:{ | 553 | case cop1x_op:{ |
| 509 | int sig; | 554 | int sig = fpux_emu(xcp, ctx, ir, fault_addr); |
| 510 | 555 | if (sig) | |
| 511 | if ((sig = fpux_emu(xcp, ctx, ir))) | ||
| 512 | return sig; | 556 | return sig; |
| 513 | break; | 557 | break; |
| 514 | } | 558 | } |
| @@ -604,7 +648,7 @@ DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg); | |||
| 604 | DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg); | 648 | DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg); |
| 605 | 649 | ||
| 606 | static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | 650 | static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, |
| 607 | mips_instruction ir) | 651 | mips_instruction ir, void *__user *fault_addr) |
| 608 | { | 652 | { |
| 609 | unsigned rcsr = 0; /* resulting csr */ | 653 | unsigned rcsr = 0; /* resulting csr */ |
| 610 | 654 | ||
| @@ -624,10 +668,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
| 624 | xcp->regs[MIPSInst_FT(ir)]); | 668 | xcp->regs[MIPSInst_FT(ir)]); |
| 625 | 669 | ||
| 626 | MIPS_FPU_EMU_INC_STATS(loads); | 670 | MIPS_FPU_EMU_INC_STATS(loads); |
| 627 | if (get_user(val, va)) { | 671 | if (!access_ok(VERIFY_READ, va, sizeof(u32))) { |
| 628 | MIPS_FPU_EMU_INC_STATS(errors); | 672 | MIPS_FPU_EMU_INC_STATS(errors); |
| 673 | *fault_addr = va; | ||
| 629 | return SIGBUS; | 674 | return SIGBUS; |
| 630 | } | 675 | } |
| 676 | if (__get_user(val, va)) { | ||
| 677 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 678 | *fault_addr = va; | ||
| 679 | return SIGSEGV; | ||
| 680 | } | ||
| 631 | SITOREG(val, MIPSInst_FD(ir)); | 681 | SITOREG(val, MIPSInst_FD(ir)); |
| 632 | break; | 682 | break; |
| 633 | 683 | ||
| @@ -638,10 +688,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
| 638 | MIPS_FPU_EMU_INC_STATS(stores); | 688 | MIPS_FPU_EMU_INC_STATS(stores); |
| 639 | 689 | ||
| 640 | SIFROMREG(val, MIPSInst_FS(ir)); | 690 | SIFROMREG(val, MIPSInst_FS(ir)); |
| 641 | if (put_user(val, va)) { | 691 | if (!access_ok(VERIFY_WRITE, va, sizeof(u32))) { |
| 642 | MIPS_FPU_EMU_INC_STATS(errors); | 692 | MIPS_FPU_EMU_INC_STATS(errors); |
| 693 | *fault_addr = va; | ||
| 643 | return SIGBUS; | 694 | return SIGBUS; |
| 644 | } | 695 | } |
| 696 | if (put_user(val, va)) { | ||
| 697 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 698 | *fault_addr = va; | ||
| 699 | return SIGSEGV; | ||
| 700 | } | ||
| 645 | break; | 701 | break; |
| 646 | 702 | ||
| 647 | case madd_s_op: | 703 | case madd_s_op: |
| @@ -701,10 +757,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
| 701 | xcp->regs[MIPSInst_FT(ir)]); | 757 | xcp->regs[MIPSInst_FT(ir)]); |
| 702 | 758 | ||
| 703 | MIPS_FPU_EMU_INC_STATS(loads); | 759 | MIPS_FPU_EMU_INC_STATS(loads); |
| 704 | if (get_user(val, va)) { | 760 | if (!access_ok(VERIFY_READ, va, sizeof(u64))) { |
| 705 | MIPS_FPU_EMU_INC_STATS(errors); | 761 | MIPS_FPU_EMU_INC_STATS(errors); |
| 762 | *fault_addr = va; | ||
| 706 | return SIGBUS; | 763 | return SIGBUS; |
| 707 | } | 764 | } |
| 765 | if (__get_user(val, va)) { | ||
| 766 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 767 | *fault_addr = va; | ||
| 768 | return SIGSEGV; | ||
| 769 | } | ||
| 708 | DITOREG(val, MIPSInst_FD(ir)); | 770 | DITOREG(val, MIPSInst_FD(ir)); |
| 709 | break; | 771 | break; |
| 710 | 772 | ||
| @@ -714,10 +776,16 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
| 714 | 776 | ||
| 715 | MIPS_FPU_EMU_INC_STATS(stores); | 777 | MIPS_FPU_EMU_INC_STATS(stores); |
| 716 | DIFROMREG(val, MIPSInst_FS(ir)); | 778 | DIFROMREG(val, MIPSInst_FS(ir)); |
| 717 | if (put_user(val, va)) { | 779 | if (!access_ok(VERIFY_WRITE, va, sizeof(u64))) { |
| 718 | MIPS_FPU_EMU_INC_STATS(errors); | 780 | MIPS_FPU_EMU_INC_STATS(errors); |
| 781 | *fault_addr = va; | ||
| 719 | return SIGBUS; | 782 | return SIGBUS; |
| 720 | } | 783 | } |
| 784 | if (__put_user(val, va)) { | ||
| 785 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 786 | *fault_addr = va; | ||
| 787 | return SIGSEGV; | ||
| 788 | } | ||
| 721 | break; | 789 | break; |
| 722 | 790 | ||
| 723 | case madd_d_op: | 791 | case madd_d_op: |
| @@ -1242,7 +1310,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
| 1242 | } | 1310 | } |
| 1243 | 1311 | ||
| 1244 | int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | 1312 | int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, |
| 1245 | int has_fpu) | 1313 | int has_fpu, void *__user *fault_addr) |
| 1246 | { | 1314 | { |
| 1247 | unsigned long oldepc, prevepc; | 1315 | unsigned long oldepc, prevepc; |
| 1248 | mips_instruction insn; | 1316 | mips_instruction insn; |
| @@ -1252,10 +1320,16 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
| 1252 | do { | 1320 | do { |
| 1253 | prevepc = xcp->cp0_epc; | 1321 | prevepc = xcp->cp0_epc; |
| 1254 | 1322 | ||
| 1255 | if (get_user(insn, (mips_instruction __user *) xcp->cp0_epc)) { | 1323 | if (!access_ok(VERIFY_READ, xcp->cp0_epc, sizeof(mips_instruction))) { |
| 1256 | MIPS_FPU_EMU_INC_STATS(errors); | 1324 | MIPS_FPU_EMU_INC_STATS(errors); |
| 1325 | *fault_addr = (mips_instruction __user *)xcp->cp0_epc; | ||
| 1257 | return SIGBUS; | 1326 | return SIGBUS; |
| 1258 | } | 1327 | } |
| 1328 | if (__get_user(insn, (mips_instruction __user *) xcp->cp0_epc)) { | ||
| 1329 | MIPS_FPU_EMU_INC_STATS(errors); | ||
| 1330 | *fault_addr = (mips_instruction __user *)xcp->cp0_epc; | ||
| 1331 | return SIGSEGV; | ||
| 1332 | } | ||
| 1259 | if (insn == 0) | 1333 | if (insn == 0) |
| 1260 | xcp->cp0_epc += 4; /* skip nops */ | 1334 | xcp->cp0_epc += 4; /* skip nops */ |
| 1261 | else { | 1335 | else { |
| @@ -1267,7 +1341,7 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
| 1267 | */ | 1341 | */ |
| 1268 | /* convert to ieee library modes */ | 1342 | /* convert to ieee library modes */ |
| 1269 | ieee754_csr.rm = ieee_rm[ieee754_csr.rm]; | 1343 | ieee754_csr.rm = ieee_rm[ieee754_csr.rm]; |
| 1270 | sig = cop1Emulate(xcp, ctx); | 1344 | sig = cop1Emulate(xcp, ctx, fault_addr); |
| 1271 | /* revert to mips rounding mode */ | 1345 | /* revert to mips rounding mode */ |
| 1272 | ieee754_csr.rm = mips_rm[ieee754_csr.rm]; | 1346 | ieee754_csr.rm = mips_rm[ieee754_csr.rm]; |
| 1273 | } | 1347 | } |
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index 4fc1a0fbe007..21ea14efb837 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
| @@ -288,7 +288,7 @@ int mips_dma_supported(struct device *dev, u64 mask) | |||
| 288 | return plat_dma_supported(dev, mask); | 288 | return plat_dma_supported(dev, mask); |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 291 | void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
| 292 | enum dma_data_direction direction) | 292 | enum dma_data_direction direction) |
| 293 | { | 293 | { |
| 294 | BUG_ON(direction == DMA_NONE); | 294 | BUG_ON(direction == DMA_NONE); |
| @@ -298,6 +298,8 @@ void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size, | |||
| 298 | __dma_sync((unsigned long)vaddr, size, direction); | 298 | __dma_sync((unsigned long)vaddr, size, direction); |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | EXPORT_SYMBOL(dma_cache_sync); | ||
| 302 | |||
| 301 | static struct dma_map_ops mips_default_dma_map_ops = { | 303 | static struct dma_map_ops mips_default_dma_map_ops = { |
| 302 | .alloc_coherent = mips_dma_alloc_coherent, | 304 | .alloc_coherent = mips_dma_alloc_coherent, |
| 303 | .free_coherent = mips_dma_free_coherent, | 305 | .free_coherent = mips_dma_free_coherent, |
diff --git a/arch/mips/pmc-sierra/yosemite/py-console.c b/arch/mips/pmc-sierra/yosemite/py-console.c index b7f1d9c4a8a3..434d7b1a8c6a 100644 --- a/arch/mips/pmc-sierra/yosemite/py-console.c +++ b/arch/mips/pmc-sierra/yosemite/py-console.c | |||
| @@ -65,11 +65,15 @@ static unsigned char readb_outer_space(unsigned long long phys) | |||
| 65 | 65 | ||
| 66 | __asm__ __volatile__ ( | 66 | __asm__ __volatile__ ( |
| 67 | " .set mips3 \n" | 67 | " .set mips3 \n" |
| 68 | " .set push \n" | ||
| 69 | " .set noreorder \n" | ||
| 70 | " .set nomacro \n" | ||
| 68 | " ld %0, %1 \n" | 71 | " ld %0, %1 \n" |
| 72 | " .set pop \n" | ||
| 69 | " lbu %0, (%0) \n" | 73 | " lbu %0, (%0) \n" |
| 70 | " .set mips0 \n" | 74 | " .set mips0 \n" |
| 71 | : "=r" (res) | 75 | : "=r" (res) |
| 72 | : "m" (vaddr)); | 76 | : "R" (vaddr)); |
| 73 | 77 | ||
| 74 | write_c0_status(sr); | 78 | write_c0_status(sr); |
| 75 | ssnop_4(); | 79 | ssnop_4(); |
| @@ -89,11 +93,15 @@ static void writeb_outer_space(unsigned long long phys, unsigned char c) | |||
| 89 | 93 | ||
| 90 | __asm__ __volatile__ ( | 94 | __asm__ __volatile__ ( |
| 91 | " .set mips3 \n" | 95 | " .set mips3 \n" |
| 96 | " .set push \n" | ||
| 97 | " .set noreorder \n" | ||
| 98 | " .set nomacro \n" | ||
| 92 | " ld %0, %1 \n" | 99 | " ld %0, %1 \n" |
| 100 | " .set pop \n" | ||
| 93 | " sb %2, (%0) \n" | 101 | " sb %2, (%0) \n" |
| 94 | " .set mips0 \n" | 102 | " .set mips0 \n" |
| 95 | : "=&r" (tmp) | 103 | : "=&r" (tmp) |
| 96 | : "m" (vaddr), "r" (c)); | 104 | : "R" (vaddr), "r" (c)); |
| 97 | 105 | ||
| 98 | write_c0_status(sr); | 106 | write_c0_status(sr); |
| 99 | ssnop_4(); | 107 | ssnop_4(); |
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c index c308989fc464..41707a245dea 100644 --- a/arch/mips/sibyte/swarm/setup.c +++ b/arch/mips/sibyte/swarm/setup.c | |||
| @@ -82,7 +82,7 @@ int swarm_be_handler(struct pt_regs *regs, int is_fixup) | |||
| 82 | enum swarm_rtc_type { | 82 | enum swarm_rtc_type { |
| 83 | RTC_NONE, | 83 | RTC_NONE, |
| 84 | RTC_XICOR, | 84 | RTC_XICOR, |
| 85 | RTC_M4LT81 | 85 | RTC_M41T81, |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | enum swarm_rtc_type swarm_rtc_type; | 88 | enum swarm_rtc_type swarm_rtc_type; |
| @@ -96,7 +96,7 @@ void read_persistent_clock(struct timespec *ts) | |||
| 96 | sec = xicor_get_time(); | 96 | sec = xicor_get_time(); |
| 97 | break; | 97 | break; |
| 98 | 98 | ||
| 99 | case RTC_M4LT81: | 99 | case RTC_M41T81: |
| 100 | sec = m41t81_get_time(); | 100 | sec = m41t81_get_time(); |
| 101 | break; | 101 | break; |
| 102 | 102 | ||
| @@ -115,7 +115,7 @@ int rtc_mips_set_time(unsigned long sec) | |||
| 115 | case RTC_XICOR: | 115 | case RTC_XICOR: |
| 116 | return xicor_set_time(sec); | 116 | return xicor_set_time(sec); |
| 117 | 117 | ||
| 118 | case RTC_M4LT81: | 118 | case RTC_M41T81: |
| 119 | return m41t81_set_time(sec); | 119 | return m41t81_set_time(sec); |
| 120 | 120 | ||
| 121 | case RTC_NONE: | 121 | case RTC_NONE: |
| @@ -141,7 +141,7 @@ void __init plat_mem_setup(void) | |||
| 141 | if (xicor_probe()) | 141 | if (xicor_probe()) |
| 142 | swarm_rtc_type = RTC_XICOR; | 142 | swarm_rtc_type = RTC_XICOR; |
| 143 | if (m41t81_probe()) | 143 | if (m41t81_probe()) |
| 144 | swarm_rtc_type = RTC_M4LT81; | 144 | swarm_rtc_type = RTC_M41T81; |
| 145 | 145 | ||
| 146 | #ifdef CONFIG_VT | 146 | #ifdef CONFIG_VT |
| 147 | screen_info = (struct screen_info) { | 147 | screen_info = (struct screen_info) { |
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h index 942e38736901..eba52a100533 100644 --- a/include/linux/ssb/ssb_driver_gige.h +++ b/include/linux/ssb/ssb_driver_gige.h | |||
| @@ -96,16 +96,21 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev) | |||
| 96 | return 0; | 96 | return 0; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | extern char * nvram_get(const char *name); | 99 | #ifdef CONFIG_BCM47XX |
| 100 | #include <asm/mach-bcm47xx/nvram.h> | ||
| 100 | /* Get the device MAC address */ | 101 | /* Get the device MAC address */ |
| 101 | static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) | 102 | static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) |
| 102 | { | 103 | { |
| 103 | #ifdef CONFIG_BCM47XX | 104 | char buf[20]; |
| 104 | char *res = nvram_get("et0macaddr"); | 105 | if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0) |
| 105 | if (res) | 106 | return; |
| 106 | memcpy(macaddr, res, 6); | 107 | nvram_parse_macaddr(buf, macaddr); |
| 107 | #endif | ||
| 108 | } | 108 | } |
| 109 | #else | ||
| 110 | static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) | ||
| 111 | { | ||
| 112 | } | ||
| 113 | #endif | ||
| 109 | 114 | ||
| 110 | extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, | 115 | extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, |
| 111 | struct pci_dev *pdev); | 116 | struct pci_dev *pdev); |
