diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-12-22 15:25:34 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-12-22 15:25:34 -0500 |
| commit | 2af10844eb6ed104f9505bf3a7ba3ceb02264f31 (patch) | |
| tree | 8a00024ff525b22379ea90a78ac3222db5a73062 /arch | |
| parent | 73bc7d315f56e260071bdb5f15e25b53bddc1402 (diff) | |
| parent | 90a8a73c06cc32b609a880d48449d7083327e11a (diff) | |
USB: Merge 2.6.37-rc5 into usb-next
This is to resolve the conflict in the file,
drivers/usb/gadget/composite.c that was due to a revert in Linus's tree
needed for the 2.6.37 release.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
68 files changed, 713 insertions, 373 deletions
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 62d686f0b426..d13add71f72a 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
| @@ -65,7 +65,7 @@ obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o | |||
| 65 | obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o | 65 | obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o |
| 66 | obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o | 66 | obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o |
| 67 | obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o | 67 | obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o |
| 68 | obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o | 68 | obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o |
| 69 | 69 | ||
| 70 | # AT91SAM9260/AT91SAM9G20 board-specific support | 70 | # AT91SAM9260/AT91SAM9G20 board-specific support |
| 71 | obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o | 71 | obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o |
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c index bba5a560e02b..feb65787c30b 100644 --- a/arch/arm/mach-at91/board-pcontrol-g20.c +++ b/arch/arm/mach-at91/board-pcontrol-g20.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | #include <mach/board.h> | 32 | #include <mach/board.h> |
| 33 | #include <mach/at91sam9_smc.h> | 33 | #include <mach/at91sam9_smc.h> |
| 34 | #include <mach/stamp9g20.h> | ||
| 34 | 35 | ||
| 35 | #include "sam9_smc.h" | 36 | #include "sam9_smc.h" |
| 36 | #include "generic.h" | 37 | #include "generic.h" |
| @@ -38,11 +39,7 @@ | |||
| 38 | 39 | ||
| 39 | static void __init pcontrol_g20_map_io(void) | 40 | static void __init pcontrol_g20_map_io(void) |
| 40 | { | 41 | { |
| 41 | /* Initialize processor: 18.432 MHz crystal */ | 42 | stamp9g20_map_io(); |
| 42 | at91sam9260_initialize(18432000); | ||
| 43 | |||
| 44 | /* DGBU on ttyS0. (Rx, Tx) only TTL -> JTAG connector X7 17,19 ) */ | ||
| 45 | at91_register_uart(0, 0, 0); | ||
| 46 | 43 | ||
| 47 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) piggyback A2 */ | 44 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) piggyback A2 */ |
| 48 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | 45 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS |
| @@ -54,9 +51,6 @@ static void __init pcontrol_g20_map_io(void) | |||
| 54 | 51 | ||
| 55 | /* USART2 on ttyS3. (Rx, Tx) 9bit-Bus Multidrop-mode X4 */ | 52 | /* USART2 on ttyS3. (Rx, Tx) 9bit-Bus Multidrop-mode X4 */ |
| 56 | at91_register_uart(AT91SAM9260_ID_US4, 3, 0); | 53 | at91_register_uart(AT91SAM9260_ID_US4, 3, 0); |
| 57 | |||
| 58 | /* set serial console to ttyS0 (ie, DBGU) */ | ||
| 59 | at91_set_serial_console(0); | ||
| 60 | } | 54 | } |
| 61 | 55 | ||
| 62 | 56 | ||
| @@ -66,38 +60,6 @@ static void __init init_irq(void) | |||
| 66 | } | 60 | } |
| 67 | 61 | ||
| 68 | 62 | ||
| 69 | /* | ||
| 70 | * NAND flash 512MiB 1,8V 8-bit, sector size 128 KiB | ||
| 71 | */ | ||
| 72 | static struct atmel_nand_data __initdata nand_data = { | ||
| 73 | .ale = 21, | ||
| 74 | .cle = 22, | ||
| 75 | .rdy_pin = AT91_PIN_PC13, | ||
| 76 | .enable_pin = AT91_PIN_PC14, | ||
| 77 | }; | ||
| 78 | |||
| 79 | /* | ||
| 80 | * Bus timings; unit = 7.57ns | ||
| 81 | */ | ||
| 82 | static struct sam9_smc_config __initdata nand_smc_config = { | ||
| 83 | .ncs_read_setup = 0, | ||
| 84 | .nrd_setup = 2, | ||
| 85 | .ncs_write_setup = 0, | ||
| 86 | .nwe_setup = 2, | ||
| 87 | |||
| 88 | .ncs_read_pulse = 4, | ||
| 89 | .nrd_pulse = 4, | ||
| 90 | .ncs_write_pulse = 4, | ||
| 91 | .nwe_pulse = 4, | ||
| 92 | |||
| 93 | .read_cycle = 7, | ||
| 94 | .write_cycle = 7, | ||
| 95 | |||
| 96 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | ||
| 97 | | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | ||
| 98 | .tdf_cycles = 3, | ||
| 99 | }; | ||
| 100 | |||
| 101 | static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { { | 63 | static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { { |
| 102 | .ncs_read_setup = 16, | 64 | .ncs_read_setup = 16, |
| 103 | .nrd_setup = 18, | 65 | .nrd_setup = 18, |
| @@ -138,14 +100,6 @@ static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { { | |||
| 138 | .tdf_cycles = 1, | 100 | .tdf_cycles = 1, |
| 139 | } }; | 101 | } }; |
| 140 | 102 | ||
| 141 | static void __init add_device_nand(void) | ||
| 142 | { | ||
| 143 | /* configure chip-select 3 (NAND) */ | ||
| 144 | sam9_smc_configure(3, &nand_smc_config); | ||
| 145 | at91_add_device_nand(&nand_data); | ||
| 146 | } | ||
| 147 | |||
| 148 | |||
| 149 | static void __init add_device_pcontrol(void) | 103 | static void __init add_device_pcontrol(void) |
| 150 | { | 104 | { |
| 151 | /* configure chip-select 4 (IO compatible to 8051 X4 ) */ | 105 | /* configure chip-select 4 (IO compatible to 8051 X4 ) */ |
| @@ -156,23 +110,6 @@ static void __init add_device_pcontrol(void) | |||
| 156 | 110 | ||
| 157 | 111 | ||
| 158 | /* | 112 | /* |
| 159 | * MCI (SD/MMC) | ||
| 160 | * det_pin, wp_pin and vcc_pin are not connected | ||
| 161 | */ | ||
| 162 | #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) | ||
| 163 | static struct mci_platform_data __initdata mmc_data = { | ||
| 164 | .slot[0] = { | ||
| 165 | .bus_width = 4, | ||
| 166 | }, | ||
| 167 | }; | ||
| 168 | #else | ||
| 169 | static struct at91_mmc_data __initdata mmc_data = { | ||
| 170 | .wire4 = 1, | ||
| 171 | }; | ||
| 172 | #endif | ||
| 173 | |||
| 174 | |||
| 175 | /* | ||
| 176 | * USB Host port | 113 | * USB Host port |
| 177 | */ | 114 | */ |
| 178 | static struct at91_usbh_data __initdata usbh_data = { | 115 | static struct at91_usbh_data __initdata usbh_data = { |
| @@ -265,42 +202,13 @@ static struct spi_board_info pcontrol_g20_spi_devices[] = { | |||
| 265 | }; | 202 | }; |
| 266 | 203 | ||
| 267 | 204 | ||
| 268 | /* | ||
| 269 | * Dallas 1-Wire DS2431 | ||
| 270 | */ | ||
| 271 | static struct w1_gpio_platform_data w1_gpio_pdata = { | ||
| 272 | .pin = AT91_PIN_PA29, | ||
| 273 | .is_open_drain = 1, | ||
| 274 | }; | ||
| 275 | |||
| 276 | static struct platform_device w1_device = { | ||
| 277 | .name = "w1-gpio", | ||
| 278 | .id = -1, | ||
| 279 | .dev.platform_data = &w1_gpio_pdata, | ||
| 280 | }; | ||
| 281 | |||
| 282 | static void add_wire1(void) | ||
| 283 | { | ||
| 284 | at91_set_GPIO_periph(w1_gpio_pdata.pin, 1); | ||
| 285 | at91_set_multi_drive(w1_gpio_pdata.pin, 1); | ||
| 286 | platform_device_register(&w1_device); | ||
| 287 | } | ||
| 288 | |||
| 289 | |||
| 290 | static void __init pcontrol_g20_board_init(void) | 205 | static void __init pcontrol_g20_board_init(void) |
| 291 | { | 206 | { |
| 292 | at91_add_device_serial(); | 207 | stamp9g20_board_init(); |
| 293 | add_device_nand(); | ||
| 294 | #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) | ||
| 295 | at91_add_device_mci(0, &mmc_data); | ||
| 296 | #else | ||
| 297 | at91_add_device_mmc(0, &mmc_data); | ||
| 298 | #endif | ||
| 299 | at91_add_device_usbh(&usbh_data); | 208 | at91_add_device_usbh(&usbh_data); |
| 300 | at91_add_device_eth(&macb_data); | 209 | at91_add_device_eth(&macb_data); |
| 301 | at91_add_device_i2c(pcontrol_g20_i2c_devices, | 210 | at91_add_device_i2c(pcontrol_g20_i2c_devices, |
| 302 | ARRAY_SIZE(pcontrol_g20_i2c_devices)); | 211 | ARRAY_SIZE(pcontrol_g20_i2c_devices)); |
| 303 | add_wire1(); | ||
| 304 | add_device_pcontrol(); | 212 | add_device_pcontrol(); |
| 305 | at91_add_device_spi(pcontrol_g20_spi_devices, | 213 | at91_add_device_spi(pcontrol_g20_spi_devices, |
| 306 | ARRAY_SIZE(pcontrol_g20_spi_devices)); | 214 | ARRAY_SIZE(pcontrol_g20_spi_devices)); |
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c index 5206eef4a67e..f8902b118960 100644 --- a/arch/arm/mach-at91/board-stamp9g20.c +++ b/arch/arm/mach-at91/board-stamp9g20.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | #include "generic.h" | 32 | #include "generic.h" |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | static void __init portuxg20_map_io(void) | 35 | void __init stamp9g20_map_io(void) |
| 36 | { | 36 | { |
| 37 | /* Initialize processor: 18.432 MHz crystal */ | 37 | /* Initialize processor: 18.432 MHz crystal */ |
| 38 | at91sam9260_initialize(18432000); | 38 | at91sam9260_initialize(18432000); |
| @@ -40,6 +40,24 @@ static void __init portuxg20_map_io(void) | |||
| 40 | /* DGBU on ttyS0. (Rx & Tx only) */ | 40 | /* DGBU on ttyS0. (Rx & Tx only) */ |
| 41 | at91_register_uart(0, 0, 0); | 41 | at91_register_uart(0, 0, 0); |
| 42 | 42 | ||
| 43 | /* set serial console to ttyS0 (ie, DBGU) */ | ||
| 44 | at91_set_serial_console(0); | ||
| 45 | } | ||
| 46 | |||
| 47 | static void __init stamp9g20evb_map_io(void) | ||
| 48 | { | ||
| 49 | stamp9g20_map_io(); | ||
| 50 | |||
| 51 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | ||
| 52 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | ||
| 53 | | ATMEL_UART_DTR | ATMEL_UART_DSR | ||
| 54 | | ATMEL_UART_DCD | ATMEL_UART_RI); | ||
| 55 | } | ||
| 56 | |||
| 57 | static void __init portuxg20_map_io(void) | ||
| 58 | { | ||
| 59 | stamp9g20_map_io(); | ||
| 60 | |||
| 43 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | 61 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ |
| 44 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | 62 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS |
| 45 | | ATMEL_UART_DTR | ATMEL_UART_DSR | 63 | | ATMEL_UART_DTR | ATMEL_UART_DSR |
| @@ -56,26 +74,6 @@ static void __init portuxg20_map_io(void) | |||
| 56 | 74 | ||
| 57 | /* USART5 on ttyS6. (Rx, Tx only) */ | 75 | /* USART5 on ttyS6. (Rx, Tx only) */ |
| 58 | at91_register_uart(AT91SAM9260_ID_US5, 6, 0); | 76 | at91_register_uart(AT91SAM9260_ID_US5, 6, 0); |
| 59 | |||
| 60 | /* set serial console to ttyS0 (ie, DBGU) */ | ||
| 61 | at91_set_serial_console(0); | ||
| 62 | } | ||
| 63 | |||
| 64 | static void __init stamp9g20_map_io(void) | ||
| 65 | { | ||
| 66 | /* Initialize processor: 18.432 MHz crystal */ | ||
| 67 | at91sam9260_initialize(18432000); | ||
| 68 | |||
| 69 | /* DGBU on ttyS0. (Rx & Tx only) */ | ||
| 70 | at91_register_uart(0, 0, 0); | ||
| 71 | |||
| 72 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | ||
| 73 | at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | ||
| 74 | | ATMEL_UART_DTR | ATMEL_UART_DSR | ||
| 75 | | ATMEL_UART_DCD | ATMEL_UART_RI); | ||
| 76 | |||
| 77 | /* set serial console to ttyS0 (ie, DBGU) */ | ||
| 78 | at91_set_serial_console(0); | ||
| 79 | } | 77 | } |
| 80 | 78 | ||
| 81 | static void __init init_irq(void) | 79 | static void __init init_irq(void) |
| @@ -156,7 +154,7 @@ static struct at91_udc_data __initdata portuxg20_udc_data = { | |||
| 156 | .pullup_pin = 0, /* pull-up driven by UDC */ | 154 | .pullup_pin = 0, /* pull-up driven by UDC */ |
| 157 | }; | 155 | }; |
| 158 | 156 | ||
| 159 | static struct at91_udc_data __initdata stamp9g20_udc_data = { | 157 | static struct at91_udc_data __initdata stamp9g20evb_udc_data = { |
| 160 | .vbus_pin = AT91_PIN_PA22, | 158 | .vbus_pin = AT91_PIN_PA22, |
| 161 | .pullup_pin = 0, /* pull-up driven by UDC */ | 159 | .pullup_pin = 0, /* pull-up driven by UDC */ |
| 162 | }; | 160 | }; |
| @@ -190,7 +188,7 @@ static struct gpio_led portuxg20_leds[] = { | |||
| 190 | } | 188 | } |
| 191 | }; | 189 | }; |
| 192 | 190 | ||
| 193 | static struct gpio_led stamp9g20_leds[] = { | 191 | static struct gpio_led stamp9g20evb_leds[] = { |
| 194 | { | 192 | { |
| 195 | .name = "D8", | 193 | .name = "D8", |
| 196 | .gpio = AT91_PIN_PB18, | 194 | .gpio = AT91_PIN_PB18, |
| @@ -250,7 +248,7 @@ void add_w1(void) | |||
| 250 | } | 248 | } |
| 251 | 249 | ||
| 252 | 250 | ||
| 253 | static void __init generic_board_init(void) | 251 | void __init stamp9g20_board_init(void) |
| 254 | { | 252 | { |
| 255 | /* Serial */ | 253 | /* Serial */ |
| 256 | at91_add_device_serial(); | 254 | at91_add_device_serial(); |
| @@ -262,34 +260,40 @@ static void __init generic_board_init(void) | |||
| 262 | #else | 260 | #else |
| 263 | at91_add_device_mmc(0, &mmc_data); | 261 | at91_add_device_mmc(0, &mmc_data); |
| 264 | #endif | 262 | #endif |
| 265 | /* USB Host */ | ||
| 266 | at91_add_device_usbh(&usbh_data); | ||
| 267 | /* Ethernet */ | ||
| 268 | at91_add_device_eth(&macb_data); | ||
| 269 | /* I2C */ | ||
| 270 | at91_add_device_i2c(NULL, 0); | ||
| 271 | /* W1 */ | 263 | /* W1 */ |
| 272 | add_w1(); | 264 | add_w1(); |
| 273 | } | 265 | } |
| 274 | 266 | ||
| 275 | static void __init portuxg20_board_init(void) | 267 | static void __init portuxg20_board_init(void) |
| 276 | { | 268 | { |
| 277 | generic_board_init(); | 269 | stamp9g20_board_init(); |
| 278 | /* SPI */ | 270 | /* USB Host */ |
| 279 | at91_add_device_spi(portuxg20_spi_devices, ARRAY_SIZE(portuxg20_spi_devices)); | 271 | at91_add_device_usbh(&usbh_data); |
| 280 | /* USB Device */ | 272 | /* USB Device */ |
| 281 | at91_add_device_udc(&portuxg20_udc_data); | 273 | at91_add_device_udc(&portuxg20_udc_data); |
| 274 | /* Ethernet */ | ||
| 275 | at91_add_device_eth(&macb_data); | ||
| 276 | /* I2C */ | ||
| 277 | at91_add_device_i2c(NULL, 0); | ||
| 278 | /* SPI */ | ||
| 279 | at91_add_device_spi(portuxg20_spi_devices, ARRAY_SIZE(portuxg20_spi_devices)); | ||
| 282 | /* LEDs */ | 280 | /* LEDs */ |
| 283 | at91_gpio_leds(portuxg20_leds, ARRAY_SIZE(portuxg20_leds)); | 281 | at91_gpio_leds(portuxg20_leds, ARRAY_SIZE(portuxg20_leds)); |
| 284 | } | 282 | } |
| 285 | 283 | ||
| 286 | static void __init stamp9g20_board_init(void) | 284 | static void __init stamp9g20evb_board_init(void) |
| 287 | { | 285 | { |
| 288 | generic_board_init(); | 286 | stamp9g20_board_init(); |
| 287 | /* USB Host */ | ||
| 288 | at91_add_device_usbh(&usbh_data); | ||
| 289 | /* USB Device */ | 289 | /* USB Device */ |
| 290 | at91_add_device_udc(&stamp9g20_udc_data); | 290 | at91_add_device_udc(&stamp9g20evb_udc_data); |
| 291 | /* Ethernet */ | ||
| 292 | at91_add_device_eth(&macb_data); | ||
| 293 | /* I2C */ | ||
| 294 | at91_add_device_i2c(NULL, 0); | ||
| 291 | /* LEDs */ | 295 | /* LEDs */ |
| 292 | at91_gpio_leds(stamp9g20_leds, ARRAY_SIZE(stamp9g20_leds)); | 296 | at91_gpio_leds(stamp9g20evb_leds, ARRAY_SIZE(stamp9g20evb_leds)); |
| 293 | } | 297 | } |
| 294 | 298 | ||
| 295 | MACHINE_START(PORTUXG20, "taskit PortuxG20") | 299 | MACHINE_START(PORTUXG20, "taskit PortuxG20") |
| @@ -305,7 +309,7 @@ MACHINE_START(STAMP9G20, "taskit Stamp9G20") | |||
| 305 | /* Maintainer: taskit GmbH */ | 309 | /* Maintainer: taskit GmbH */ |
| 306 | .boot_params = AT91_SDRAM_BASE + 0x100, | 310 | .boot_params = AT91_SDRAM_BASE + 0x100, |
| 307 | .timer = &at91sam926x_timer, | 311 | .timer = &at91sam926x_timer, |
| 308 | .map_io = stamp9g20_map_io, | 312 | .map_io = stamp9g20evb_map_io, |
| 309 | .init_irq = init_irq, | 313 | .init_irq = init_irq, |
| 310 | .init_machine = stamp9g20_board_init, | 314 | .init_machine = stamp9g20evb_board_init, |
| 311 | MACHINE_END | 315 | MACHINE_END |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index 7525cee3983f..9113da6845f1 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
| @@ -658,7 +658,7 @@ static void __init at91_upll_usbfs_clock_init(unsigned long main_clock) | |||
| 658 | /* Now set uhpck values */ | 658 | /* Now set uhpck values */ |
| 659 | uhpck.parent = &utmi_clk; | 659 | uhpck.parent = &utmi_clk; |
| 660 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; | 660 | uhpck.pmc_mask = AT91SAM926x_PMC_UHP; |
| 661 | uhpck.rate_hz = utmi_clk.parent->rate_hz; | 661 | uhpck.rate_hz = utmi_clk.rate_hz; |
| 662 | uhpck.rate_hz /= 1 + ((at91_sys_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); | 662 | uhpck.rate_hz /= 1 + ((at91_sys_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); |
| 663 | } | 663 | } |
| 664 | 664 | ||
diff --git a/arch/arm/mach-at91/include/mach/stamp9g20.h b/arch/arm/mach-at91/include/mach/stamp9g20.h new file mode 100644 index 000000000000..6120f9c46d59 --- /dev/null +++ b/arch/arm/mach-at91/include/mach/stamp9g20.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #ifndef __MACH_STAMP9G20_H | ||
| 2 | #define __MACH_STAMP9G20_H | ||
| 3 | |||
| 4 | void stamp9g20_map_io(void); | ||
| 5 | void stamp9g20_board_init(void); | ||
| 6 | |||
| 7 | #endif | ||
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig index fa2e5bffbb8e..6983cb4d4cae 100644 --- a/arch/arm/mach-s3c2412/Kconfig +++ b/arch/arm/mach-s3c2412/Kconfig | |||
| @@ -28,9 +28,16 @@ config S3C2412_DMA | |||
| 28 | 28 | ||
| 29 | config S3C2412_PM | 29 | config S3C2412_PM |
| 30 | bool | 30 | bool |
| 31 | select S3C2412_PM_SLEEP | ||
| 31 | help | 32 | help |
| 32 | Internal config node to apply S3C2412 power management | 33 | Internal config node to apply S3C2412 power management |
| 33 | 34 | ||
| 35 | config S3C2412_PM_SLEEP | ||
| 36 | bool | ||
| 37 | help | ||
| 38 | Internal config node to apply sleep for S3C2412 power management. | ||
| 39 | Can be selected by another SoCs with similar sleep procedure. | ||
| 40 | |||
| 34 | # Note, the S3C2412 IOtiming support is in plat-s3c24xx | 41 | # Note, the S3C2412 IOtiming support is in plat-s3c24xx |
| 35 | 42 | ||
| 36 | config S3C2412_CPUFREQ | 43 | config S3C2412_CPUFREQ |
diff --git a/arch/arm/mach-s3c2412/Makefile b/arch/arm/mach-s3c2412/Makefile index 530ec46cbaea..6c48a91ea39e 100644 --- a/arch/arm/mach-s3c2412/Makefile +++ b/arch/arm/mach-s3c2412/Makefile | |||
| @@ -14,7 +14,8 @@ obj-$(CONFIG_CPU_S3C2412) += irq.o | |||
| 14 | obj-$(CONFIG_CPU_S3C2412) += clock.o | 14 | obj-$(CONFIG_CPU_S3C2412) += clock.o |
| 15 | obj-$(CONFIG_CPU_S3C2412) += gpio.o | 15 | obj-$(CONFIG_CPU_S3C2412) += gpio.o |
| 16 | obj-$(CONFIG_S3C2412_DMA) += dma.o | 16 | obj-$(CONFIG_S3C2412_DMA) += dma.o |
| 17 | obj-$(CONFIG_S3C2412_PM) += pm.o sleep.o | 17 | obj-$(CONFIG_S3C2412_PM) += pm.o |
| 18 | obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep.o | ||
| 18 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpu-freq.o | 19 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpu-freq.o |
| 19 | 20 | ||
| 20 | # Machine support | 21 | # Machine support |
diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig index 27b3e7c9d613..df8d14974c90 100644 --- a/arch/arm/mach-s3c2416/Kconfig +++ b/arch/arm/mach-s3c2416/Kconfig | |||
| @@ -27,6 +27,7 @@ config S3C2416_DMA | |||
| 27 | 27 | ||
| 28 | config S3C2416_PM | 28 | config S3C2416_PM |
| 29 | bool | 29 | bool |
| 30 | select S3C2412_PM_SLEEP | ||
| 30 | help | 31 | help |
| 31 | Internal config node to apply S3C2416 power management | 32 | Internal config node to apply S3C2416 power management |
| 32 | 33 | ||
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c index 28677caf3613..461aa035afc0 100644 --- a/arch/arm/mach-s5pv210/mach-aquila.c +++ b/arch/arm/mach-s5pv210/mach-aquila.c | |||
| @@ -378,6 +378,12 @@ static struct max8998_regulator_data aquila_regulators[] = { | |||
| 378 | static struct max8998_platform_data aquila_max8998_pdata = { | 378 | static struct max8998_platform_data aquila_max8998_pdata = { |
| 379 | .num_regulators = ARRAY_SIZE(aquila_regulators), | 379 | .num_regulators = ARRAY_SIZE(aquila_regulators), |
| 380 | .regulators = aquila_regulators, | 380 | .regulators = aquila_regulators, |
| 381 | .buck1_set1 = S5PV210_GPH0(3), | ||
| 382 | .buck1_set2 = S5PV210_GPH0(4), | ||
| 383 | .buck2_set3 = S5PV210_GPH0(5), | ||
| 384 | .buck1_max_voltage1 = 1200000, | ||
| 385 | .buck1_max_voltage2 = 1200000, | ||
| 386 | .buck2_max_voltage = 1200000, | ||
| 381 | }; | 387 | }; |
| 382 | #endif | 388 | #endif |
| 383 | 389 | ||
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index b1dcf964a768..e22d5112fd44 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c | |||
| @@ -518,6 +518,12 @@ static struct max8998_regulator_data goni_regulators[] = { | |||
| 518 | static struct max8998_platform_data goni_max8998_pdata = { | 518 | static struct max8998_platform_data goni_max8998_pdata = { |
| 519 | .num_regulators = ARRAY_SIZE(goni_regulators), | 519 | .num_regulators = ARRAY_SIZE(goni_regulators), |
| 520 | .regulators = goni_regulators, | 520 | .regulators = goni_regulators, |
| 521 | .buck1_set1 = S5PV210_GPH0(3), | ||
| 522 | .buck1_set2 = S5PV210_GPH0(4), | ||
| 523 | .buck2_set3 = S5PV210_GPH0(5), | ||
| 524 | .buck1_max_voltage1 = 1200000, | ||
| 525 | .buck1_max_voltage2 = 1200000, | ||
| 526 | .buck2_max_voltage = 1200000, | ||
| 521 | }; | 527 | }; |
| 522 | #endif | 528 | #endif |
| 523 | 529 | ||
diff --git a/arch/arm/mach-shmobile/include/mach/entry-macro.S b/arch/arm/mach-shmobile/include/mach/entry-macro.S index a285d13c7416..f428c4db2b60 100644 --- a/arch/arm/mach-shmobile/include/mach/entry-macro.S +++ b/arch/arm/mach-shmobile/include/mach/entry-macro.S | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2010 Magnus Damm | ||
| 2 | * Copyright (C) 2008 Renesas Solutions Corp. | 3 | * Copyright (C) 2008 Renesas Solutions Corp. |
| 3 | * | 4 | * |
| 4 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
| @@ -14,24 +15,45 @@ | |||
| 14 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | */ | 17 | */ |
| 17 | #include <mach/hardware.h> | ||
| 18 | #include <mach/irqs.h> | 18 | #include <mach/irqs.h> |
| 19 | 19 | ||
| 20 | #define INTCA_BASE 0xe6980000 | ||
| 21 | #define INTFLGA_OFFS 0x00000018 /* accept pending interrupt */ | ||
| 22 | #define INTEVTA_OFFS 0x00000020 /* vector number of accepted interrupt */ | ||
| 23 | #define INTLVLA_OFFS 0x00000030 /* priority level of accepted interrupt */ | ||
| 24 | #define INTLVLB_OFFS 0x00000034 /* previous priority level */ | ||
| 25 | |||
| 20 | .macro disable_fiq | 26 | .macro disable_fiq |
| 21 | .endm | 27 | .endm |
| 22 | 28 | ||
| 23 | .macro get_irqnr_preamble, base, tmp | 29 | .macro get_irqnr_preamble, base, tmp |
| 24 | ldr \base, =INTFLGA | 30 | ldr \base, =INTCA_BASE |
| 25 | .endm | 31 | .endm |
| 26 | 32 | ||
| 27 | .macro arch_ret_to_user, tmp1, tmp2 | 33 | .macro arch_ret_to_user, tmp1, tmp2 |
| 28 | .endm | 34 | .endm |
| 29 | 35 | ||
| 30 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | 36 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp |
| 31 | ldr \irqnr, [\base] | 37 | /* The single INTFLGA read access below results in the following: |
| 38 | * | ||
| 39 | * 1. INTLVLB is updated with old priority value from INTLVLA | ||
| 40 | * 2. Highest priority interrupt is accepted | ||
| 41 | * 3. INTLVLA is updated to contain priority of accepted interrupt | ||
| 42 | * 4. Accepted interrupt vector is stored in INTFLGA and INTEVTA | ||
| 43 | */ | ||
| 44 | ldr \irqnr, [\base, #INTFLGA_OFFS] | ||
| 45 | |||
| 46 | /* Restore INTLVLA with the value saved in INTLVLB. | ||
| 47 | * This is required to support interrupt priorities properly. | ||
| 48 | */ | ||
| 49 | ldrb \tmp, [\base, #INTLVLB_OFFS] | ||
| 50 | strb \tmp, [\base, #INTLVLA_OFFS] | ||
| 51 | |||
| 52 | /* Handle invalid vector number case */ | ||
| 32 | cmp \irqnr, #0 | 53 | cmp \irqnr, #0 |
| 33 | beq 1000f | 54 | beq 1000f |
| 34 | /* intevt to irq number */ | 55 | |
| 56 | /* Convert vector to irq number, same as the evt2irq() macro */ | ||
| 35 | lsr \irqnr, \irqnr, #0x5 | 57 | lsr \irqnr, \irqnr, #0x5 |
| 36 | subs \irqnr, \irqnr, #16 | 58 | subs \irqnr, \irqnr, #16 |
| 37 | 59 | ||
diff --git a/arch/arm/mach-shmobile/include/mach/vmalloc.h b/arch/arm/mach-shmobile/include/mach/vmalloc.h index 4aecf6e3a859..2b8fd8b942fe 100644 --- a/arch/arm/mach-shmobile/include/mach/vmalloc.h +++ b/arch/arm/mach-shmobile/include/mach/vmalloc.h | |||
| @@ -2,6 +2,6 @@ | |||
| 2 | #define __ASM_MACH_VMALLOC_H | 2 | #define __ASM_MACH_VMALLOC_H |
| 3 | 3 | ||
| 4 | /* Vmalloc at ... - 0xe5ffffff */ | 4 | /* Vmalloc at ... - 0xe5ffffff */ |
| 5 | #define VMALLOC_END 0xe6000000 | 5 | #define VMALLOC_END 0xe6000000UL |
| 6 | 6 | ||
| 7 | #endif /* __ASM_MACH_VMALLOC_H */ | 7 | #endif /* __ASM_MACH_VMALLOC_H */ |
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig index 5a27b1b538f2..eb105e61c746 100644 --- a/arch/arm/plat-s3c24xx/Kconfig +++ b/arch/arm/plat-s3c24xx/Kconfig | |||
| @@ -8,7 +8,7 @@ config PLAT_S3C24XX | |||
| 8 | default y | 8 | default y |
| 9 | select NO_IOPORT | 9 | select NO_IOPORT |
| 10 | select ARCH_REQUIRE_GPIOLIB | 10 | select ARCH_REQUIRE_GPIOLIB |
| 11 | select S3C_DEVICE_NAND | 11 | select S3C_DEV_NAND |
| 12 | select S3C_GPIO_CFG_S3C24XX | 12 | select S3C_GPIO_CFG_S3C24XX |
| 13 | help | 13 | help |
| 14 | Base platform code for any Samsung S3C24XX device | 14 | Base platform code for any Samsung S3C24XX device |
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/mm/sc-mips.c b/arch/mips/mm/sc-mips.c index 505fecad4684..9cca8de00545 100644 --- a/arch/mips/mm/sc-mips.c +++ b/arch/mips/mm/sc-mips.c | |||
| @@ -68,6 +68,9 @@ static struct bcache_ops mips_sc_ops = { | |||
| 68 | */ | 68 | */ |
| 69 | static inline int mips_sc_is_activated(struct cpuinfo_mips *c) | 69 | static inline int mips_sc_is_activated(struct cpuinfo_mips *c) |
| 70 | { | 70 | { |
| 71 | unsigned int config2 = read_c0_config2(); | ||
| 72 | unsigned int tmp; | ||
| 73 | |||
| 71 | /* Check the bypass bit (L2B) */ | 74 | /* Check the bypass bit (L2B) */ |
| 72 | switch (c->cputype) { | 75 | switch (c->cputype) { |
| 73 | case CPU_34K: | 76 | case CPU_34K: |
| @@ -83,6 +86,7 @@ static inline int mips_sc_is_activated(struct cpuinfo_mips *c) | |||
| 83 | c->scache.linesz = 2 << tmp; | 86 | c->scache.linesz = 2 << tmp; |
| 84 | else | 87 | else |
| 85 | return 0; | 88 | return 0; |
| 89 | return 1; | ||
| 86 | } | 90 | } |
| 87 | 91 | ||
| 88 | static inline int __init mips_sc_probe(void) | 92 | static inline int __init mips_sc_probe(void) |
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/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c index f860a340acc9..75da468090b9 100644 --- a/arch/mn10300/kernel/time.c +++ b/arch/mn10300/kernel/time.c | |||
| @@ -40,21 +40,17 @@ unsigned long long sched_clock(void) | |||
| 40 | unsigned long long ll; | 40 | unsigned long long ll; |
| 41 | unsigned l[2]; | 41 | unsigned l[2]; |
| 42 | } tsc64, result; | 42 | } tsc64, result; |
| 43 | unsigned long tsc, tmp; | 43 | unsigned long tmp; |
| 44 | unsigned product[3]; /* 96-bit intermediate value */ | 44 | unsigned product[3]; /* 96-bit intermediate value */ |
| 45 | 45 | ||
| 46 | /* cnt32_to_63() is not safe with preemption */ | 46 | /* cnt32_to_63() is not safe with preemption */ |
| 47 | preempt_disable(); | 47 | preempt_disable(); |
| 48 | 48 | ||
| 49 | /* read the TSC value | 49 | /* expand the tsc to 64-bits. |
| 50 | */ | ||
| 51 | tsc = get_cycles(); | ||
| 52 | |||
| 53 | /* expand to 64-bits. | ||
| 54 | * - sched_clock() must be called once a minute or better or the | 50 | * - sched_clock() must be called once a minute or better or the |
| 55 | * following will go horribly wrong - see cnt32_to_63() | 51 | * following will go horribly wrong - see cnt32_to_63() |
| 56 | */ | 52 | */ |
| 57 | tsc64.ll = cnt32_to_63(tsc) & 0x7fffffffffffffffULL; | 53 | tsc64.ll = cnt32_to_63(get_cycles()) & 0x7fffffffffffffffULL; |
| 58 | 54 | ||
| 59 | preempt_enable(); | 55 | preempt_enable(); |
| 60 | 56 | ||
diff --git a/arch/tile/include/asm/signal.h b/arch/tile/include/asm/signal.h index c1ee1d61d44c..81d92a45cd4b 100644 --- a/arch/tile/include/asm/signal.h +++ b/arch/tile/include/asm/signal.h | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | 26 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
| 27 | struct pt_regs; | 27 | struct pt_regs; |
| 28 | int restore_sigcontext(struct pt_regs *, struct sigcontext __user *, long *); | 28 | int restore_sigcontext(struct pt_regs *, struct sigcontext __user *); |
| 29 | int setup_sigcontext(struct sigcontext __user *, struct pt_regs *); | 29 | int setup_sigcontext(struct sigcontext __user *, struct pt_regs *); |
| 30 | void do_signal(struct pt_regs *regs); | 30 | void do_signal(struct pt_regs *regs); |
| 31 | #endif | 31 | #endif |
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index 543d6a33aa26..dbb0dfc7bece 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
| @@ -290,12 +290,12 @@ long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, | |||
| 290 | return ret; | 290 | return ret; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | /* The assembly shim for this function arranges to ignore the return value. */ | ||
| 293 | long compat_sys_rt_sigreturn(struct pt_regs *regs) | 294 | long compat_sys_rt_sigreturn(struct pt_regs *regs) |
| 294 | { | 295 | { |
| 295 | struct compat_rt_sigframe __user *frame = | 296 | struct compat_rt_sigframe __user *frame = |
| 296 | (struct compat_rt_sigframe __user *) compat_ptr(regs->sp); | 297 | (struct compat_rt_sigframe __user *) compat_ptr(regs->sp); |
| 297 | sigset_t set; | 298 | sigset_t set; |
| 298 | long r0; | ||
| 299 | 299 | ||
| 300 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 300 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 301 | goto badframe; | 301 | goto badframe; |
| @@ -308,13 +308,13 @@ long compat_sys_rt_sigreturn(struct pt_regs *regs) | |||
| 308 | recalc_sigpending(); | 308 | recalc_sigpending(); |
| 309 | spin_unlock_irq(¤t->sighand->siglock); | 309 | spin_unlock_irq(¤t->sighand->siglock); |
| 310 | 310 | ||
| 311 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) | 311 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
| 312 | goto badframe; | 312 | goto badframe; |
| 313 | 313 | ||
| 314 | if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL, regs) != 0) | 314 | if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL, regs) != 0) |
| 315 | goto badframe; | 315 | goto badframe; |
| 316 | 316 | ||
| 317 | return r0; | 317 | return 0; |
| 318 | 318 | ||
| 319 | badframe: | 319 | badframe: |
| 320 | force_sig(SIGSEGV, current); | 320 | force_sig(SIGSEGV, current); |
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S index f5821626247f..5eed4a02bf62 100644 --- a/arch/tile/kernel/intvec_32.S +++ b/arch/tile/kernel/intvec_32.S | |||
| @@ -1342,8 +1342,8 @@ handle_syscall: | |||
| 1342 | lw r20, r20 | 1342 | lw r20, r20 |
| 1343 | 1343 | ||
| 1344 | /* Jump to syscall handler. */ | 1344 | /* Jump to syscall handler. */ |
| 1345 | jalr r20; .Lhandle_syscall_link: | 1345 | jalr r20 |
| 1346 | FEEDBACK_REENTER(handle_syscall) | 1346 | .Lhandle_syscall_link: /* value of "lr" after "jalr r20" above */ |
| 1347 | 1347 | ||
| 1348 | /* | 1348 | /* |
| 1349 | * Write our r0 onto the stack so it gets restored instead | 1349 | * Write our r0 onto the stack so it gets restored instead |
| @@ -1352,6 +1352,9 @@ handle_syscall: | |||
| 1352 | PTREGS_PTR(r29, PTREGS_OFFSET_REG(0)) | 1352 | PTREGS_PTR(r29, PTREGS_OFFSET_REG(0)) |
| 1353 | sw r29, r0 | 1353 | sw r29, r0 |
| 1354 | 1354 | ||
| 1355 | .Lsyscall_sigreturn_skip: | ||
| 1356 | FEEDBACK_REENTER(handle_syscall) | ||
| 1357 | |||
| 1355 | /* Do syscall trace again, if requested. */ | 1358 | /* Do syscall trace again, if requested. */ |
| 1356 | lw r30, r31 | 1359 | lw r30, r31 |
| 1357 | andi r30, r30, _TIF_SYSCALL_TRACE | 1360 | andi r30, r30, _TIF_SYSCALL_TRACE |
| @@ -1536,9 +1539,24 @@ STD_ENTRY_LOCAL(bad_intr) | |||
| 1536 | }; \ | 1539 | }; \ |
| 1537 | STD_ENDPROC(_##x) | 1540 | STD_ENDPROC(_##x) |
| 1538 | 1541 | ||
| 1542 | /* | ||
| 1543 | * Special-case sigreturn to not write r0 to the stack on return. | ||
| 1544 | * This is technically more efficient, but it also avoids difficulties | ||
| 1545 | * in the 64-bit OS when handling 32-bit compat code, since we must not | ||
| 1546 | * sign-extend r0 for the sigreturn return-value case. | ||
| 1547 | */ | ||
| 1548 | #define PTREGS_SYSCALL_SIGRETURN(x, reg) \ | ||
| 1549 | STD_ENTRY(_##x); \ | ||
| 1550 | addli lr, lr, .Lsyscall_sigreturn_skip - .Lhandle_syscall_link; \ | ||
| 1551 | { \ | ||
| 1552 | PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \ | ||
| 1553 | j x \ | ||
| 1554 | }; \ | ||
| 1555 | STD_ENDPROC(_##x) | ||
| 1556 | |||
| 1539 | PTREGS_SYSCALL(sys_execve, r3) | 1557 | PTREGS_SYSCALL(sys_execve, r3) |
| 1540 | PTREGS_SYSCALL(sys_sigaltstack, r2) | 1558 | PTREGS_SYSCALL(sys_sigaltstack, r2) |
| 1541 | PTREGS_SYSCALL(sys_rt_sigreturn, r0) | 1559 | PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0) |
| 1542 | PTREGS_SYSCALL(sys_cmpxchg_badaddr, r1) | 1560 | PTREGS_SYSCALL(sys_cmpxchg_badaddr, r1) |
| 1543 | 1561 | ||
| 1544 | /* Save additional callee-saves to pt_regs, put address in r4 and jump. */ | 1562 | /* Save additional callee-saves to pt_regs, put address in r4 and jump. */ |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index 8430f45daea6..e90eb53173b0 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
| @@ -212,6 +212,13 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
| 212 | childregs->sp = sp; /* override with new user stack pointer */ | 212 | childregs->sp = sp; /* override with new user stack pointer */ |
| 213 | 213 | ||
| 214 | /* | 214 | /* |
| 215 | * If CLONE_SETTLS is set, set "tp" in the new task to "r4", | ||
| 216 | * which is passed in as arg #5 to sys_clone(). | ||
| 217 | */ | ||
| 218 | if (clone_flags & CLONE_SETTLS) | ||
| 219 | childregs->tp = regs->regs[4]; | ||
| 220 | |||
| 221 | /* | ||
| 215 | * Copy the callee-saved registers from the passed pt_regs struct | 222 | * Copy the callee-saved registers from the passed pt_regs struct |
| 216 | * into the context-switch callee-saved registers area. | 223 | * into the context-switch callee-saved registers area. |
| 217 | * This way when we start the interrupt-return sequence, the | 224 | * This way when we start the interrupt-return sequence, the |
| @@ -539,6 +546,7 @@ struct task_struct *__sched _switch_to(struct task_struct *prev, | |||
| 539 | return __switch_to(prev, next, next_current_ksp0(next)); | 546 | return __switch_to(prev, next, next_current_ksp0(next)); |
| 540 | } | 547 | } |
| 541 | 548 | ||
| 549 | /* Note there is an implicit fifth argument if (clone_flags & CLONE_SETTLS). */ | ||
| 542 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, | 550 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, |
| 543 | void __user *, parent_tidptr, void __user *, child_tidptr, | 551 | void __user *, parent_tidptr, void __user *, child_tidptr, |
| 544 | struct pt_regs *, regs) | 552 | struct pt_regs *, regs) |
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c index 757407e36696..1260321155f1 100644 --- a/arch/tile/kernel/signal.c +++ b/arch/tile/kernel/signal.c | |||
| @@ -52,7 +52,7 @@ SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss, | |||
| 52 | */ | 52 | */ |
| 53 | 53 | ||
| 54 | int restore_sigcontext(struct pt_regs *regs, | 54 | int restore_sigcontext(struct pt_regs *regs, |
| 55 | struct sigcontext __user *sc, long *pr0) | 55 | struct sigcontext __user *sc) |
| 56 | { | 56 | { |
| 57 | int err = 0; | 57 | int err = 0; |
| 58 | int i; | 58 | int i; |
| @@ -75,17 +75,15 @@ int restore_sigcontext(struct pt_regs *regs, | |||
| 75 | 75 | ||
| 76 | regs->faultnum = INT_SWINT_1_SIGRETURN; | 76 | regs->faultnum = INT_SWINT_1_SIGRETURN; |
| 77 | 77 | ||
| 78 | err |= __get_user(*pr0, &sc->gregs[0]); | ||
| 79 | return err; | 78 | return err; |
| 80 | } | 79 | } |
| 81 | 80 | ||
| 82 | /* sigreturn() returns long since it restores r0 in the interrupted code. */ | 81 | /* The assembly shim for this function arranges to ignore the return value. */ |
| 83 | SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) | 82 | SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) |
| 84 | { | 83 | { |
| 85 | struct rt_sigframe __user *frame = | 84 | struct rt_sigframe __user *frame = |
| 86 | (struct rt_sigframe __user *)(regs->sp); | 85 | (struct rt_sigframe __user *)(regs->sp); |
| 87 | sigset_t set; | 86 | sigset_t set; |
| 88 | long r0; | ||
| 89 | 87 | ||
| 90 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 88 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 91 | goto badframe; | 89 | goto badframe; |
| @@ -98,13 +96,13 @@ SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) | |||
| 98 | recalc_sigpending(); | 96 | recalc_sigpending(); |
| 99 | spin_unlock_irq(¤t->sighand->siglock); | 97 | spin_unlock_irq(¤t->sighand->siglock); |
| 100 | 98 | ||
| 101 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) | 99 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
| 102 | goto badframe; | 100 | goto badframe; |
| 103 | 101 | ||
| 104 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT) | 102 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT) |
| 105 | goto badframe; | 103 | goto badframe; |
| 106 | 104 | ||
| 107 | return r0; | 105 | return 0; |
| 108 | 106 | ||
| 109 | badframe: | 107 | badframe: |
| 110 | force_sig(SIGSEGV, current); | 108 | force_sig(SIGSEGV, current); |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 23f315c9f215..325c05294fc4 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
| @@ -355,7 +355,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap, | |||
| 355 | if (heap > 0x3fffffffffffUL) | 355 | if (heap > 0x3fffffffffffUL) |
| 356 | error("Destination address too large"); | 356 | error("Destination address too large"); |
| 357 | #else | 357 | #else |
| 358 | if (heap > ((-__PAGE_OFFSET-(512<<20)-1) & 0x7fffffff)) | 358 | if (heap > ((-__PAGE_OFFSET-(128<<20)-1) & 0x7fffffff)) |
| 359 | error("Destination address too large"); | 359 | error("Destination address too large"); |
| 360 | #endif | 360 | #endif |
| 361 | #ifndef CONFIG_RELOCATABLE | 361 | #ifndef CONFIG_RELOCATABLE |
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h index 5be1542fbfaf..e99d55d74df5 100644 --- a/arch/x86/include/asm/e820.h +++ b/arch/x86/include/asm/e820.h | |||
| @@ -72,6 +72,9 @@ struct e820map { | |||
| 72 | #define BIOS_BEGIN 0x000a0000 | 72 | #define BIOS_BEGIN 0x000a0000 |
| 73 | #define BIOS_END 0x00100000 | 73 | #define BIOS_END 0x00100000 |
| 74 | 74 | ||
| 75 | #define BIOS_ROM_BASE 0xffe00000 | ||
| 76 | #define BIOS_ROM_END 0xffffffff | ||
| 77 | |||
| 75 | #ifdef __KERNEL__ | 78 | #ifdef __KERNEL__ |
| 76 | /* see comment in arch/x86/kernel/e820.c */ | 79 | /* see comment in arch/x86/kernel/e820.c */ |
| 77 | extern struct e820map e820; | 80 | extern struct e820map e820; |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 9e6fe391094e..f702f82aa1eb 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
| @@ -79,7 +79,7 @@ | |||
| 79 | #define KVM_NUM_MMU_PAGES (1 << KVM_MMU_HASH_SHIFT) | 79 | #define KVM_NUM_MMU_PAGES (1 << KVM_MMU_HASH_SHIFT) |
| 80 | #define KVM_MIN_FREE_MMU_PAGES 5 | 80 | #define KVM_MIN_FREE_MMU_PAGES 5 |
| 81 | #define KVM_REFILL_PAGES 25 | 81 | #define KVM_REFILL_PAGES 25 |
| 82 | #define KVM_MAX_CPUID_ENTRIES 40 | 82 | #define KVM_MAX_CPUID_ENTRIES 80 |
| 83 | #define KVM_NR_FIXED_MTRR_REGION 88 | 83 | #define KVM_NR_FIXED_MTRR_REGION 88 |
| 84 | #define KVM_NR_VAR_MTRR 8 | 84 | #define KVM_NR_VAR_MTRR 8 |
| 85 | 85 | ||
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 9e13763b6092..1e994754d323 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
| @@ -45,6 +45,7 @@ obj-y += pci-dma.o quirks.o i8237.o topology.o kdebugfs.o | |||
| 45 | obj-y += alternative.o i8253.o pci-nommu.o hw_breakpoint.o | 45 | obj-y += alternative.o i8253.o pci-nommu.o hw_breakpoint.o |
| 46 | obj-y += tsc.o io_delay.o rtc.o | 46 | obj-y += tsc.o io_delay.o rtc.o |
| 47 | obj-y += pci-iommu_table.o | 47 | obj-y += pci-iommu_table.o |
| 48 | obj-y += resource.o | ||
| 48 | 49 | ||
| 49 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o | 50 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o |
| 50 | obj-y += process.o | 51 | obj-y += process.o |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 3f838d537392..78218135b48e 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
| @@ -1389,6 +1389,14 @@ void __cpuinit end_local_APIC_setup(void) | |||
| 1389 | 1389 | ||
| 1390 | setup_apic_nmi_watchdog(NULL); | 1390 | setup_apic_nmi_watchdog(NULL); |
| 1391 | apic_pm_activate(); | 1391 | apic_pm_activate(); |
| 1392 | |||
| 1393 | /* | ||
| 1394 | * Now that local APIC setup is completed for BP, configure the fault | ||
| 1395 | * handling for interrupt remapping. | ||
| 1396 | */ | ||
| 1397 | if (!smp_processor_id() && intr_remapping_enabled) | ||
| 1398 | enable_drhd_fault_handling(); | ||
| 1399 | |||
| 1392 | } | 1400 | } |
| 1393 | 1401 | ||
| 1394 | #ifdef CONFIG_X86_X2APIC | 1402 | #ifdef CONFIG_X86_X2APIC |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 7cc0a721f628..fadcd743a74f 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
| @@ -2430,13 +2430,12 @@ static void ack_apic_level(struct irq_data *data) | |||
| 2430 | { | 2430 | { |
| 2431 | struct irq_cfg *cfg = data->chip_data; | 2431 | struct irq_cfg *cfg = data->chip_data; |
| 2432 | int i, do_unmask_irq = 0, irq = data->irq; | 2432 | int i, do_unmask_irq = 0, irq = data->irq; |
| 2433 | struct irq_desc *desc = irq_to_desc(irq); | ||
| 2434 | unsigned long v; | 2433 | unsigned long v; |
| 2435 | 2434 | ||
| 2436 | irq_complete_move(cfg); | 2435 | irq_complete_move(cfg); |
| 2437 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 2436 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
| 2438 | /* If we are moving the irq we need to mask it */ | 2437 | /* If we are moving the irq we need to mask it */ |
| 2439 | if (unlikely(desc->status & IRQ_MOVE_PENDING)) { | 2438 | if (unlikely(irq_to_desc(irq)->status & IRQ_MOVE_PENDING)) { |
| 2440 | do_unmask_irq = 1; | 2439 | do_unmask_irq = 1; |
| 2441 | mask_ioapic(cfg); | 2440 | mask_ioapic(cfg); |
| 2442 | } | 2441 | } |
| @@ -3413,6 +3412,7 @@ dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask, | |||
| 3413 | msg.data |= MSI_DATA_VECTOR(cfg->vector); | 3412 | msg.data |= MSI_DATA_VECTOR(cfg->vector); |
| 3414 | msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; | 3413 | msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; |
| 3415 | msg.address_lo |= MSI_ADDR_DEST_ID(dest); | 3414 | msg.address_lo |= MSI_ADDR_DEST_ID(dest); |
| 3415 | msg.address_hi = MSI_ADDR_BASE_HI | MSI_ADDR_EXT_DEST_ID(dest); | ||
| 3416 | 3416 | ||
| 3417 | dmar_msi_write(irq, &msg); | 3417 | dmar_msi_write(irq, &msg); |
| 3418 | 3418 | ||
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index f9e4e6a54073..d8c4a6feb286 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
| @@ -79,13 +79,6 @@ void __init default_setup_apic_routing(void) | |||
| 79 | /* need to update phys_pkg_id */ | 79 | /* need to update phys_pkg_id */ |
| 80 | apic->phys_pkg_id = apicid_phys_pkg_id; | 80 | apic->phys_pkg_id = apicid_phys_pkg_id; |
| 81 | } | 81 | } |
| 82 | |||
| 83 | /* | ||
| 84 | * Now that apic routing model is selected, configure the | ||
| 85 | * fault handling for intr remapping. | ||
| 86 | */ | ||
| 87 | if (intr_remapping_enabled) | ||
| 88 | enable_drhd_fault_handling(); | ||
| 89 | } | 82 | } |
| 90 | 83 | ||
| 91 | /* Same for both flat and physical. */ | 84 | /* Same for both flat and physical. */ |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index bcece91dd311..c0dbd9ac24f0 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
| @@ -60,16 +60,18 @@ | |||
| 60 | #define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD) | 60 | #define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD) |
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | /* Number of possible pages in the lowmem region */ | ||
| 64 | LOWMEM_PAGES = (((1<<32) - __PAGE_OFFSET) >> PAGE_SHIFT) | ||
| 65 | |||
| 63 | /* Enough space to fit pagetables for the low memory linear map */ | 66 | /* Enough space to fit pagetables for the low memory linear map */ |
| 64 | MAPPING_BEYOND_END = \ | 67 | MAPPING_BEYOND_END = PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT |
| 65 | PAGE_TABLE_SIZE(((1<<32) - __PAGE_OFFSET) >> PAGE_SHIFT) << PAGE_SHIFT | ||
| 66 | 68 | ||
| 67 | /* | 69 | /* |
| 68 | * Worst-case size of the kernel mapping we need to make: | 70 | * Worst-case size of the kernel mapping we need to make: |
| 69 | * the worst-case size of the kernel itself, plus the extra we need | 71 | * a relocatable kernel can live anywhere in lowmem, so we need to be able |
| 70 | * to map for the linear map. | 72 | * to map all of lowmem. |
| 71 | */ | 73 | */ |
| 72 | KERNEL_PAGES = (KERNEL_IMAGE_SIZE + MAPPING_BEYOND_END)>>PAGE_SHIFT | 74 | KERNEL_PAGES = LOWMEM_PAGES |
| 73 | 75 | ||
| 74 | INIT_MAP_SIZE = PAGE_TABLE_SIZE(KERNEL_PAGES) * PAGE_SIZE_asm | 76 | INIT_MAP_SIZE = PAGE_TABLE_SIZE(KERNEL_PAGES) * PAGE_SIZE_asm |
| 75 | RESERVE_BRK(pagetables, INIT_MAP_SIZE) | 77 | RESERVE_BRK(pagetables, INIT_MAP_SIZE) |
| @@ -620,13 +622,13 @@ ENTRY(initial_code) | |||
| 620 | __PAGE_ALIGNED_BSS | 622 | __PAGE_ALIGNED_BSS |
| 621 | .align PAGE_SIZE_asm | 623 | .align PAGE_SIZE_asm |
| 622 | #ifdef CONFIG_X86_PAE | 624 | #ifdef CONFIG_X86_PAE |
| 623 | initial_pg_pmd: | 625 | ENTRY(initial_pg_pmd) |
| 624 | .fill 1024*KPMDS,4,0 | 626 | .fill 1024*KPMDS,4,0 |
| 625 | #else | 627 | #else |
| 626 | ENTRY(initial_page_table) | 628 | ENTRY(initial_page_table) |
| 627 | .fill 1024,4,0 | 629 | .fill 1024,4,0 |
| 628 | #endif | 630 | #endif |
| 629 | initial_pg_fixmap: | 631 | ENTRY(initial_pg_fixmap) |
| 630 | .fill 1024,4,0 | 632 | .fill 1024,4,0 |
| 631 | ENTRY(empty_zero_page) | 633 | ENTRY(empty_zero_page) |
| 632 | .fill 4096,1,0 | 634 | .fill 4096,1,0 |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index ae03cab4352e..4ff5968f12d2 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
| @@ -27,6 +27,9 @@ | |||
| 27 | #define HPET_DEV_FSB_CAP 0x1000 | 27 | #define HPET_DEV_FSB_CAP 0x1000 |
| 28 | #define HPET_DEV_PERI_CAP 0x2000 | 28 | #define HPET_DEV_PERI_CAP 0x2000 |
| 29 | 29 | ||
| 30 | #define HPET_MIN_CYCLES 128 | ||
| 31 | #define HPET_MIN_PROG_DELTA (HPET_MIN_CYCLES + (HPET_MIN_CYCLES >> 1)) | ||
| 32 | |||
| 30 | #define EVT_TO_HPET_DEV(evt) container_of(evt, struct hpet_dev, evt) | 33 | #define EVT_TO_HPET_DEV(evt) container_of(evt, struct hpet_dev, evt) |
| 31 | 34 | ||
| 32 | /* | 35 | /* |
| @@ -299,8 +302,9 @@ static void hpet_legacy_clockevent_register(void) | |||
| 299 | /* Calculate the min / max delta */ | 302 | /* Calculate the min / max delta */ |
| 300 | hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF, | 303 | hpet_clockevent.max_delta_ns = clockevent_delta2ns(0x7FFFFFFF, |
| 301 | &hpet_clockevent); | 304 | &hpet_clockevent); |
| 302 | /* 5 usec minimum reprogramming delta. */ | 305 | /* Setup minimum reprogramming delta. */ |
| 303 | hpet_clockevent.min_delta_ns = 5000; | 306 | hpet_clockevent.min_delta_ns = clockevent_delta2ns(HPET_MIN_PROG_DELTA, |
| 307 | &hpet_clockevent); | ||
| 304 | 308 | ||
| 305 | /* | 309 | /* |
| 306 | * Start hpet with the boot cpu mask and make it | 310 | * Start hpet with the boot cpu mask and make it |
| @@ -393,22 +397,24 @@ static int hpet_next_event(unsigned long delta, | |||
| 393 | * the wraparound into account) nor a simple count down event | 397 | * the wraparound into account) nor a simple count down event |
| 394 | * mode. Further the write to the comparator register is | 398 | * mode. Further the write to the comparator register is |
| 395 | * delayed internally up to two HPET clock cycles in certain | 399 | * delayed internally up to two HPET clock cycles in certain |
| 396 | * chipsets (ATI, ICH9,10). We worked around that by reading | 400 | * chipsets (ATI, ICH9,10). Some newer AMD chipsets have even |
| 397 | * back the compare register, but that required another | 401 | * longer delays. We worked around that by reading back the |
| 398 | * workaround for ICH9,10 chips where the first readout after | 402 | * compare register, but that required another workaround for |
| 399 | * write can return the old stale value. We already have a | 403 | * ICH9,10 chips where the first readout after write can |
| 400 | * minimum delta of 5us enforced, but a NMI or SMI hitting | 404 | * return the old stale value. We already had a minimum |
| 405 | * programming delta of 5us enforced, but a NMI or SMI hitting | ||
| 401 | * between the counter readout and the comparator write can | 406 | * between the counter readout and the comparator write can |
| 402 | * move us behind that point easily. Now instead of reading | 407 | * move us behind that point easily. Now instead of reading |
| 403 | * the compare register back several times, we make the ETIME | 408 | * the compare register back several times, we make the ETIME |
| 404 | * decision based on the following: Return ETIME if the | 409 | * decision based on the following: Return ETIME if the |
| 405 | * counter value after the write is less than 8 HPET cycles | 410 | * counter value after the write is less than HPET_MIN_CYCLES |
| 406 | * away from the event or if the counter is already ahead of | 411 | * away from the event or if the counter is already ahead of |
| 407 | * the event. | 412 | * the event. The minimum programming delta for the generic |
| 413 | * clockevents code is set to 1.5 * HPET_MIN_CYCLES. | ||
| 408 | */ | 414 | */ |
| 409 | res = (s32)(cnt - hpet_readl(HPET_COUNTER)); | 415 | res = (s32)(cnt - hpet_readl(HPET_COUNTER)); |
| 410 | 416 | ||
| 411 | return res < 8 ? -ETIME : 0; | 417 | return res < HPET_MIN_CYCLES ? -ETIME : 0; |
| 412 | } | 418 | } |
| 413 | 419 | ||
| 414 | static void hpet_legacy_set_mode(enum clock_event_mode mode, | 420 | static void hpet_legacy_set_mode(enum clock_event_mode mode, |
diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c new file mode 100644 index 000000000000..2a26819bb6a8 --- /dev/null +++ b/arch/x86/kernel/resource.c | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #include <linux/ioport.h> | ||
| 2 | #include <asm/e820.h> | ||
| 3 | |||
| 4 | static void resource_clip(struct resource *res, resource_size_t start, | ||
| 5 | resource_size_t end) | ||
| 6 | { | ||
| 7 | resource_size_t low = 0, high = 0; | ||
| 8 | |||
| 9 | if (res->end < start || res->start > end) | ||
| 10 | return; /* no conflict */ | ||
| 11 | |||
| 12 | if (res->start < start) | ||
| 13 | low = start - res->start; | ||
| 14 | |||
| 15 | if (res->end > end) | ||
| 16 | high = res->end - end; | ||
| 17 | |||
| 18 | /* Keep the area above or below the conflict, whichever is larger */ | ||
| 19 | if (low > high) | ||
| 20 | res->end = start - 1; | ||
| 21 | else | ||
| 22 | res->start = end + 1; | ||
| 23 | } | ||
| 24 | |||
| 25 | static void remove_e820_regions(struct resource *avail) | ||
| 26 | { | ||
| 27 | int i; | ||
| 28 | struct e820entry *entry; | ||
| 29 | |||
| 30 | for (i = 0; i < e820.nr_map; i++) { | ||
| 31 | entry = &e820.map[i]; | ||
| 32 | |||
| 33 | resource_clip(avail, entry->addr, | ||
| 34 | entry->addr + entry->size - 1); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | void arch_remove_reservations(struct resource *avail) | ||
| 39 | { | ||
| 40 | /* Trim out BIOS areas (low 1MB and high 2MB) and E820 regions */ | ||
| 41 | if (avail->flags & IORESOURCE_MEM) { | ||
| 42 | if (avail->start < BIOS_END) | ||
| 43 | avail->start = BIOS_END; | ||
| 44 | resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END); | ||
| 45 | |||
| 46 | remove_e820_regions(avail); | ||
| 47 | } | ||
| 48 | } | ||
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 21c6746338af..85268f8eadf6 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
| @@ -769,7 +769,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 769 | 769 | ||
| 770 | x86_init.oem.arch_setup(); | 770 | x86_init.oem.arch_setup(); |
| 771 | 771 | ||
| 772 | resource_alloc_from_bottom = 0; | ||
| 773 | iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1; | 772 | iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1; |
| 774 | setup_memory_map(); | 773 | setup_memory_map(); |
| 775 | parse_setup_data(); | 774 | parse_setup_data(); |
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 9c253bd65e24..547128546cc3 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
| @@ -394,7 +394,8 @@ static void __init setup_xstate_init(void) | |||
| 394 | * Setup init_xstate_buf to represent the init state of | 394 | * Setup init_xstate_buf to represent the init state of |
| 395 | * all the features managed by the xsave | 395 | * all the features managed by the xsave |
| 396 | */ | 396 | */ |
| 397 | init_xstate_buf = alloc_bootmem(xstate_size); | 397 | init_xstate_buf = alloc_bootmem_align(xstate_size, |
| 398 | __alignof__(struct xsave_struct)); | ||
| 398 | init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT; | 399 | init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT; |
| 399 | 400 | ||
| 400 | clts(); | 401 | clts(); |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1ca12298ffc7..b81a9b7c2ca4 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -3494,6 +3494,10 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu) | |||
| 3494 | static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) | 3494 | static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) |
| 3495 | { | 3495 | { |
| 3496 | switch (func) { | 3496 | switch (func) { |
| 3497 | case 0x00000001: | ||
| 3498 | /* Mask out xsave bit as long as it is not supported by SVM */ | ||
| 3499 | entry->ecx &= ~(bit(X86_FEATURE_XSAVE)); | ||
| 3500 | break; | ||
| 3497 | case 0x80000001: | 3501 | case 0x80000001: |
| 3498 | if (nested) | 3502 | if (nested) |
| 3499 | entry->ecx |= (1 << 2); /* Set SVM bit */ | 3503 | entry->ecx |= (1 << 2); /* Set SVM bit */ |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ff21fdda0c53..81fcbe9515c5 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
| @@ -4227,11 +4227,6 @@ static int vmx_get_lpage_level(void) | |||
| 4227 | return PT_PDPE_LEVEL; | 4227 | return PT_PDPE_LEVEL; |
| 4228 | } | 4228 | } |
| 4229 | 4229 | ||
| 4230 | static inline u32 bit(int bitno) | ||
| 4231 | { | ||
| 4232 | return 1 << (bitno & 31); | ||
| 4233 | } | ||
| 4234 | |||
| 4235 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) | 4230 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) |
| 4236 | { | 4231 | { |
| 4237 | struct kvm_cpuid_entry2 *best; | 4232 | struct kvm_cpuid_entry2 *best; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index cdac9e592aa5..b989e1f1e5d3 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -155,11 +155,6 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
| 155 | 155 | ||
| 156 | u64 __read_mostly host_xcr0; | 156 | u64 __read_mostly host_xcr0; |
| 157 | 157 | ||
| 158 | static inline u32 bit(int bitno) | ||
| 159 | { | ||
| 160 | return 1 << (bitno & 31); | ||
| 161 | } | ||
| 162 | |||
| 163 | static void kvm_on_user_return(struct user_return_notifier *urn) | 158 | static void kvm_on_user_return(struct user_return_notifier *urn) |
| 164 | { | 159 | { |
| 165 | unsigned slot; | 160 | unsigned slot; |
| @@ -4569,9 +4564,11 @@ static void kvm_timer_init(void) | |||
| 4569 | #ifdef CONFIG_CPU_FREQ | 4564 | #ifdef CONFIG_CPU_FREQ |
| 4570 | struct cpufreq_policy policy; | 4565 | struct cpufreq_policy policy; |
| 4571 | memset(&policy, 0, sizeof(policy)); | 4566 | memset(&policy, 0, sizeof(policy)); |
| 4572 | cpufreq_get_policy(&policy, get_cpu()); | 4567 | cpu = get_cpu(); |
| 4568 | cpufreq_get_policy(&policy, cpu); | ||
| 4573 | if (policy.cpuinfo.max_freq) | 4569 | if (policy.cpuinfo.max_freq) |
| 4574 | max_tsc_khz = policy.cpuinfo.max_freq; | 4570 | max_tsc_khz = policy.cpuinfo.max_freq; |
| 4571 | put_cpu(); | ||
| 4575 | #endif | 4572 | #endif |
| 4576 | cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block, | 4573 | cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block, |
| 4577 | CPUFREQ_TRANSITION_NOTIFIER); | 4574 | CPUFREQ_TRANSITION_NOTIFIER); |
| @@ -5522,6 +5519,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | |||
| 5522 | 5519 | ||
| 5523 | mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4; | 5520 | mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4; |
| 5524 | kvm_x86_ops->set_cr4(vcpu, sregs->cr4); | 5521 | kvm_x86_ops->set_cr4(vcpu, sregs->cr4); |
| 5522 | if (sregs->cr4 & X86_CR4_OSXSAVE) | ||
| 5523 | update_cpuid(vcpu); | ||
| 5525 | if (!is_long_mode(vcpu) && is_pae(vcpu)) { | 5524 | if (!is_long_mode(vcpu) && is_pae(vcpu)) { |
| 5526 | load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3); | 5525 | load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3); |
| 5527 | mmu_reset_needed = 1; | 5526 | mmu_reset_needed = 1; |
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 2cea414489f3..c600da830ce0 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h | |||
| @@ -70,6 +70,11 @@ static inline int is_paging(struct kvm_vcpu *vcpu) | |||
| 70 | return kvm_read_cr0_bits(vcpu, X86_CR0_PG); | 70 | return kvm_read_cr0_bits(vcpu, X86_CR0_PG); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | static inline u32 bit(int bitno) | ||
| 74 | { | ||
| 75 | return 1 << (bitno & 31); | ||
| 76 | } | ||
| 77 | |||
| 73 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); | 78 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); |
| 74 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); | 79 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); |
| 75 | int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq); | 80 | int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq); |
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 73b1e1a1f489..4996cf5f73a0 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
| @@ -531,7 +531,10 @@ static void lguest_write_cr3(unsigned long cr3) | |||
| 531 | { | 531 | { |
| 532 | lguest_data.pgdir = cr3; | 532 | lguest_data.pgdir = cr3; |
| 533 | lazy_hcall1(LHCALL_NEW_PGTABLE, cr3); | 533 | lazy_hcall1(LHCALL_NEW_PGTABLE, cr3); |
| 534 | cr3_changed = true; | 534 | |
| 535 | /* These two page tables are simple, linear, and used during boot */ | ||
| 536 | if (cr3 != __pa(swapper_pg_dir) && cr3 != __pa(initial_page_table)) | ||
| 537 | cr3_changed = true; | ||
| 535 | } | 538 | } |
| 536 | 539 | ||
| 537 | static unsigned long lguest_read_cr3(void) | 540 | static unsigned long lguest_read_cr3(void) |
| @@ -703,9 +706,9 @@ static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval) | |||
| 703 | * to forget all of them. Fortunately, this is very rare. | 706 | * to forget all of them. Fortunately, this is very rare. |
| 704 | * | 707 | * |
| 705 | * ... except in early boot when the kernel sets up the initial pagetables, | 708 | * ... except in early boot when the kernel sets up the initial pagetables, |
| 706 | * which makes booting astonishingly slow: 1.83 seconds! So we don't even tell | 709 | * which makes booting astonishingly slow: 48 seconds! So we don't even tell |
| 707 | * the Host anything changed until we've done the first page table switch, | 710 | * the Host anything changed until we've done the first real page table switch, |
| 708 | * which brings boot back to 0.25 seconds. | 711 | * which brings boot back to 4.3 seconds. |
| 709 | */ | 712 | */ |
| 710 | static void lguest_set_pte(pte_t *ptep, pte_t pteval) | 713 | static void lguest_set_pte(pte_t *ptep, pte_t pteval) |
| 711 | { | 714 | { |
| @@ -1002,7 +1005,7 @@ static void lguest_time_init(void) | |||
| 1002 | clockevents_register_device(&lguest_clockevent); | 1005 | clockevents_register_device(&lguest_clockevent); |
| 1003 | 1006 | ||
| 1004 | /* Finally, we unblock the timer interrupt. */ | 1007 | /* Finally, we unblock the timer interrupt. */ |
| 1005 | enable_lguest_irq(0); | 1008 | clear_bit(0, lguest_data.blocked_interrupts); |
| 1006 | } | 1009 | } |
| 1007 | 1010 | ||
| 1008 | /* | 1011 | /* |
| @@ -1349,9 +1352,6 @@ __init void lguest_init(void) | |||
| 1349 | */ | 1352 | */ |
| 1350 | switch_to_new_gdt(0); | 1353 | switch_to_new_gdt(0); |
| 1351 | 1354 | ||
| 1352 | /* We actually boot with all memory mapped, but let's say 128MB. */ | ||
| 1353 | max_pfn_mapped = (128*1024*1024) >> PAGE_SHIFT; | ||
| 1354 | |||
| 1355 | /* | 1355 | /* |
| 1356 | * The Host<->Guest Switcher lives at the top of our address space, and | 1356 | * The Host<->Guest Switcher lives at the top of our address space, and |
| 1357 | * the Host told us how big it is when we made LGUEST_INIT hypercall: | 1357 | * the Host told us how big it is when we made LGUEST_INIT hypercall: |
diff --git a/arch/x86/lguest/i386_head.S b/arch/x86/lguest/i386_head.S index 4f420c2f2d55..e7d5382ef263 100644 --- a/arch/x86/lguest/i386_head.S +++ b/arch/x86/lguest/i386_head.S | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <asm/asm-offsets.h> | 4 | #include <asm/asm-offsets.h> |
| 5 | #include <asm/thread_info.h> | 5 | #include <asm/thread_info.h> |
| 6 | #include <asm/processor-flags.h> | 6 | #include <asm/processor-flags.h> |
| 7 | #include <asm/pgtable.h> | ||
| 7 | 8 | ||
| 8 | /*G:020 | 9 | /*G:020 |
| 9 | * Our story starts with the kernel booting into startup_32 in | 10 | * Our story starts with the kernel booting into startup_32 in |
| @@ -37,9 +38,113 @@ ENTRY(lguest_entry) | |||
| 37 | /* Set up the initial stack so we can run C code. */ | 38 | /* Set up the initial stack so we can run C code. */ |
| 38 | movl $(init_thread_union+THREAD_SIZE),%esp | 39 | movl $(init_thread_union+THREAD_SIZE),%esp |
| 39 | 40 | ||
| 41 | call init_pagetables | ||
| 42 | |||
| 40 | /* Jumps are relative: we're running __PAGE_OFFSET too low. */ | 43 | /* Jumps are relative: we're running __PAGE_OFFSET too low. */ |
| 41 | jmp lguest_init+__PAGE_OFFSET | 44 | jmp lguest_init+__PAGE_OFFSET |
| 42 | 45 | ||
| 46 | /* | ||
| 47 | * Initialize page tables. This creates a PDE and a set of page | ||
| 48 | * tables, which are located immediately beyond __brk_base. The variable | ||
| 49 | * _brk_end is set up to point to the first "safe" location. | ||
| 50 | * Mappings are created both at virtual address 0 (identity mapping) | ||
| 51 | * and PAGE_OFFSET for up to _end. | ||
| 52 | * | ||
| 53 | * FIXME: This code is taken verbatim from arch/x86/kernel/head_32.S: they | ||
| 54 | * don't have a stack at this point, so we can't just use call and ret. | ||
| 55 | */ | ||
| 56 | init_pagetables: | ||
| 57 | #if PTRS_PER_PMD > 1 | ||
| 58 | #define PAGE_TABLE_SIZE(pages) (((pages) / PTRS_PER_PMD) + PTRS_PER_PGD) | ||
| 59 | #else | ||
| 60 | #define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD) | ||
| 61 | #endif | ||
| 62 | #define pa(X) ((X) - __PAGE_OFFSET) | ||
| 63 | |||
| 64 | /* Enough space to fit pagetables for the low memory linear map */ | ||
| 65 | MAPPING_BEYOND_END = \ | ||
| 66 | PAGE_TABLE_SIZE(((1<<32) - __PAGE_OFFSET) >> PAGE_SHIFT) << PAGE_SHIFT | ||
| 67 | #ifdef CONFIG_X86_PAE | ||
| 68 | |||
| 69 | /* | ||
| 70 | * In PAE mode initial_page_table is statically defined to contain | ||
| 71 | * enough entries to cover the VMSPLIT option (that is the top 1, 2 or 3 | ||
| 72 | * entries). The identity mapping is handled by pointing two PGD entries | ||
| 73 | * to the first kernel PMD. | ||
| 74 | * | ||
| 75 | * Note the upper half of each PMD or PTE are always zero at this stage. | ||
| 76 | */ | ||
| 77 | |||
| 78 | #define KPMDS (((-__PAGE_OFFSET) >> 30) & 3) /* Number of kernel PMDs */ | ||
| 79 | |||
| 80 | xorl %ebx,%ebx /* %ebx is kept at zero */ | ||
| 81 | |||
| 82 | movl $pa(__brk_base), %edi | ||
| 83 | movl $pa(initial_pg_pmd), %edx | ||
| 84 | movl $PTE_IDENT_ATTR, %eax | ||
| 85 | 10: | ||
| 86 | leal PDE_IDENT_ATTR(%edi),%ecx /* Create PMD entry */ | ||
| 87 | movl %ecx,(%edx) /* Store PMD entry */ | ||
| 88 | /* Upper half already zero */ | ||
| 89 | addl $8,%edx | ||
| 90 | movl $512,%ecx | ||
| 91 | 11: | ||
| 92 | stosl | ||
| 93 | xchgl %eax,%ebx | ||
| 94 | stosl | ||
| 95 | xchgl %eax,%ebx | ||
| 96 | addl $0x1000,%eax | ||
| 97 | loop 11b | ||
| 98 | |||
| 99 | /* | ||
| 100 | * End condition: we must map up to the end + MAPPING_BEYOND_END. | ||
| 101 | */ | ||
| 102 | movl $pa(_end) + MAPPING_BEYOND_END + PTE_IDENT_ATTR, %ebp | ||
| 103 | cmpl %ebp,%eax | ||
| 104 | jb 10b | ||
| 105 | 1: | ||
| 106 | addl $__PAGE_OFFSET, %edi | ||
| 107 | movl %edi, pa(_brk_end) | ||
| 108 | shrl $12, %eax | ||
| 109 | movl %eax, pa(max_pfn_mapped) | ||
| 110 | |||
| 111 | /* Do early initialization of the fixmap area */ | ||
| 112 | movl $pa(initial_pg_fixmap)+PDE_IDENT_ATTR,%eax | ||
| 113 | movl %eax,pa(initial_pg_pmd+0x1000*KPMDS-8) | ||
| 114 | #else /* Not PAE */ | ||
| 115 | |||
| 116 | page_pde_offset = (__PAGE_OFFSET >> 20); | ||
| 117 | |||
| 118 | movl $pa(__brk_base), %edi | ||
| 119 | movl $pa(initial_page_table), %edx | ||
| 120 | movl $PTE_IDENT_ATTR, %eax | ||
| 121 | 10: | ||
| 122 | leal PDE_IDENT_ATTR(%edi),%ecx /* Create PDE entry */ | ||
| 123 | movl %ecx,(%edx) /* Store identity PDE entry */ | ||
| 124 | movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ | ||
| 125 | addl $4,%edx | ||
| 126 | movl $1024, %ecx | ||
| 127 | 11: | ||
| 128 | stosl | ||
| 129 | addl $0x1000,%eax | ||
| 130 | loop 11b | ||
| 131 | /* | ||
| 132 | * End condition: we must map up to the end + MAPPING_BEYOND_END. | ||
| 133 | */ | ||
| 134 | movl $pa(_end) + MAPPING_BEYOND_END + PTE_IDENT_ATTR, %ebp | ||
| 135 | cmpl %ebp,%eax | ||
| 136 | jb 10b | ||
| 137 | addl $__PAGE_OFFSET, %edi | ||
| 138 | movl %edi, pa(_brk_end) | ||
| 139 | shrl $12, %eax | ||
| 140 | movl %eax, pa(max_pfn_mapped) | ||
| 141 | |||
| 142 | /* Do early initialization of the fixmap area */ | ||
| 143 | movl $pa(initial_pg_fixmap)+PDE_IDENT_ATTR,%eax | ||
| 144 | movl %eax,pa(initial_page_table+0xffc) | ||
| 145 | #endif | ||
| 146 | ret | ||
| 147 | |||
| 43 | /*G:055 | 148 | /*G:055 |
| 44 | * We create a macro which puts the assembler code between lgstart_ and lgend_ | 149 | * We create a macro which puts the assembler code between lgstart_ and lgend_ |
| 45 | * markers. These templates are put in the .text section: they can't be | 150 | * markers. These templates are put in the .text section: they can't be |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index c4bb261c106e..b1805b78842f 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
| @@ -65,21 +65,13 @@ pcibios_align_resource(void *data, const struct resource *res, | |||
| 65 | resource_size_t size, resource_size_t align) | 65 | resource_size_t size, resource_size_t align) |
| 66 | { | 66 | { |
| 67 | struct pci_dev *dev = data; | 67 | struct pci_dev *dev = data; |
| 68 | resource_size_t start = round_down(res->end - size + 1, align); | 68 | resource_size_t start = res->start; |
| 69 | 69 | ||
| 70 | if (res->flags & IORESOURCE_IO) { | 70 | if (res->flags & IORESOURCE_IO) { |
| 71 | 71 | if (skip_isa_ioresource_align(dev)) | |
| 72 | /* | 72 | return start; |
| 73 | * If we're avoiding ISA aliases, the largest contiguous I/O | 73 | if (start & 0x300) |
| 74 | * port space is 256 bytes. Clearing bits 9 and 10 preserves | 74 | start = (start + 0x3ff) & ~0x3ff; |
| 75 | * all 256-byte and smaller alignments, so the result will | ||
| 76 | * still be correctly aligned. | ||
| 77 | */ | ||
| 78 | if (!skip_isa_ioresource_align(dev)) | ||
| 79 | start &= ~0x300; | ||
| 80 | } else if (res->flags & IORESOURCE_MEM) { | ||
| 81 | if (start < BIOS_END) | ||
| 82 | start = res->end; /* fail; no space */ | ||
| 83 | } | 75 | } |
| 84 | return start; | 76 | return start; |
| 85 | } | 77 | } |
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index 4a2afa1bac51..b6552b189bcd 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile | |||
| @@ -25,7 +25,7 @@ targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) | |||
| 25 | 25 | ||
| 26 | export CPPFLAGS_vdso.lds += -P -C | 26 | export CPPFLAGS_vdso.lds += -P -C |
| 27 | 27 | ||
| 28 | VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \ | 28 | VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ |
| 29 | -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 | 29 | -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 |
| 30 | 30 | ||
| 31 | $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so | 31 | $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so |
| @@ -69,7 +69,7 @@ vdso32.so-$(VDSO32-y) += sysenter | |||
| 69 | vdso32-images = $(vdso32.so-y:%=vdso32-%.so) | 69 | vdso32-images = $(vdso32.so-y:%=vdso32-%.so) |
| 70 | 70 | ||
| 71 | CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) | 71 | CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) |
| 72 | VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1 | 72 | VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-soname=linux-gate.so.1 |
| 73 | 73 | ||
| 74 | # This makes sure the $(obj) subdirectory exists even though vdso32/ | 74 | # This makes sure the $(obj) subdirectory exists even though vdso32/ |
| 75 | # is not a kbuild sub-make subdirectory. | 75 | # is not a kbuild sub-make subdirectory. |
