diff options
80 files changed, 2320 insertions, 1107 deletions
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index cced73c58115..32b361f31c2c 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
| @@ -7,20 +7,83 @@ | |||
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
| 9 | */ | 9 | */ |
| 10 | #include <linux/clk.h> | ||
| 11 | #include <linux/etherdevice.h> | ||
| 10 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 13 | #include <linux/kernel.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | #include <linux/string.h> | ||
| 16 | #include <linux/types.h> | ||
| 11 | 17 | ||
| 18 | #include <asm/io.h> | ||
| 19 | #include <asm/setup.h> | ||
| 12 | #include <asm/arch/board.h> | 20 | #include <asm/arch/board.h> |
| 13 | #include <asm/arch/init.h> | 21 | #include <asm/arch/init.h> |
| 14 | 22 | ||
| 15 | struct eth_platform_data __initdata eth0_data = { | 23 | struct eth_addr { |
| 16 | .valid = 1, | 24 | u8 addr[6]; |
| 17 | .mii_phy_addr = 0x10, | ||
| 18 | .is_rmii = 0, | ||
| 19 | .hw_addr = { 0x6a, 0x87, 0x71, 0x14, 0xcd, 0xcb }, | ||
| 20 | }; | 25 | }; |
| 21 | 26 | ||
| 27 | static struct eth_addr __initdata hw_addr[2]; | ||
| 28 | |||
| 29 | static struct eth_platform_data __initdata eth_data[2]; | ||
| 22 | extern struct lcdc_platform_data atstk1000_fb0_data; | 30 | extern struct lcdc_platform_data atstk1000_fb0_data; |
| 23 | 31 | ||
| 32 | /* | ||
| 33 | * The next two functions should go away as the boot loader is | ||
| 34 | * supposed to initialize the macb address registers with a valid | ||
| 35 | * ethernet address. But we need to keep it around for a while until | ||
| 36 | * we can be reasonably sure the boot loader does this. | ||
| 37 | * | ||
| 38 | * The phy_id is ignored as the driver will probe for it. | ||
| 39 | */ | ||
| 40 | static int __init parse_tag_ethernet(struct tag *tag) | ||
| 41 | { | ||
| 42 | int i; | ||
| 43 | |||
| 44 | i = tag->u.ethernet.mac_index; | ||
| 45 | if (i < ARRAY_SIZE(hw_addr)) | ||
| 46 | memcpy(hw_addr[i].addr, tag->u.ethernet.hw_address, | ||
| 47 | sizeof(hw_addr[i].addr)); | ||
| 48 | |||
| 49 | return 0; | ||
| 50 | } | ||
| 51 | __tagtable(ATAG_ETHERNET, parse_tag_ethernet); | ||
| 52 | |||
| 53 | static void __init set_hw_addr(struct platform_device *pdev) | ||
| 54 | { | ||
| 55 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 56 | const u8 *addr; | ||
| 57 | void __iomem *regs; | ||
| 58 | struct clk *pclk; | ||
| 59 | |||
| 60 | if (!res) | ||
| 61 | return; | ||
| 62 | if (pdev->id >= ARRAY_SIZE(hw_addr)) | ||
| 63 | return; | ||
| 64 | |||
| 65 | addr = hw_addr[pdev->id].addr; | ||
| 66 | if (!is_valid_ether_addr(addr)) | ||
| 67 | return; | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Since this is board-specific code, we'll cheat and use the | ||
| 71 | * physical address directly as we happen to know that it's | ||
| 72 | * the same as the virtual address. | ||
| 73 | */ | ||
| 74 | regs = (void __iomem __force *)res->start; | ||
| 75 | pclk = clk_get(&pdev->dev, "pclk"); | ||
| 76 | if (!pclk) | ||
| 77 | return; | ||
| 78 | |||
| 79 | clk_enable(pclk); | ||
| 80 | __raw_writel((addr[3] << 24) | (addr[2] << 16) | ||
| 81 | | (addr[1] << 8) | addr[0], regs + 0x98); | ||
| 82 | __raw_writel((addr[5] << 8) | addr[4], regs + 0x9c); | ||
| 83 | clk_disable(pclk); | ||
| 84 | clk_put(pclk); | ||
| 85 | } | ||
| 86 | |||
| 24 | void __init setup_board(void) | 87 | void __init setup_board(void) |
| 25 | { | 88 | { |
| 26 | at32_map_usart(1, 0); /* /dev/ttyS0 */ | 89 | at32_map_usart(1, 0); /* /dev/ttyS0 */ |
| @@ -38,7 +101,8 @@ static int __init atstk1002_init(void) | |||
| 38 | at32_add_device_usart(1); | 101 | at32_add_device_usart(1); |
| 39 | at32_add_device_usart(2); | 102 | at32_add_device_usart(2); |
| 40 | 103 | ||
| 41 | at32_add_device_eth(0, ð0_data); | 104 | set_hw_addr(at32_add_device_eth(0, ð_data[0])); |
| 105 | |||
| 42 | at32_add_device_spi(0); | 106 | at32_add_device_spi(0); |
| 43 | at32_add_device_lcdc(0, &atstk1000_fb0_data); | 107 | at32_add_device_lcdc(0, &atstk1000_fb0_data); |
| 44 | 108 | ||
diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c index 372e3f8b2417..7c4c76114bba 100644 --- a/arch/avr32/kernel/avr32_ksyms.c +++ b/arch/avr32/kernel/avr32_ksyms.c | |||
| @@ -7,12 +7,12 @@ | |||
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
| 9 | */ | 9 | */ |
| 10 | #include <linux/delay.h> | ||
| 10 | #include <linux/io.h> | 11 | #include <linux/io.h> |
| 11 | #include <linux/module.h> | 12 | #include <linux/module.h> |
| 12 | 13 | ||
| 13 | #include <asm/checksum.h> | 14 | #include <asm/checksum.h> |
| 14 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
| 15 | #include <asm/delay.h> | ||
| 16 | 16 | ||
| 17 | /* | 17 | /* |
| 18 | * GCC functions | 18 | * GCC functions |
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c index 317dc50945f2..0b4325946a41 100644 --- a/arch/avr32/kernel/process.c +++ b/arch/avr32/kernel/process.c | |||
| @@ -38,6 +38,13 @@ void cpu_idle(void) | |||
| 38 | 38 | ||
| 39 | void machine_halt(void) | 39 | void machine_halt(void) |
| 40 | { | 40 | { |
| 41 | /* | ||
| 42 | * Enter Stop mode. The 32 kHz oscillator will keep running so | ||
| 43 | * the RTC will keep the time properly and the system will | ||
| 44 | * boot quickly. | ||
| 45 | */ | ||
| 46 | asm volatile("sleep 3\n\t" | ||
| 47 | "sub pc, -2"); | ||
| 41 | } | 48 | } |
| 42 | 49 | ||
| 43 | void machine_power_off(void) | 50 | void machine_power_off(void) |
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c index ea2d1ffee478..a34211601008 100644 --- a/arch/avr32/kernel/setup.c +++ b/arch/avr32/kernel/setup.c | |||
| @@ -229,30 +229,6 @@ static int __init parse_tag_rsvd_mem(struct tag *tag) | |||
| 229 | } | 229 | } |
| 230 | __tagtable(ATAG_RSVD_MEM, parse_tag_rsvd_mem); | 230 | __tagtable(ATAG_RSVD_MEM, parse_tag_rsvd_mem); |
| 231 | 231 | ||
| 232 | static int __init parse_tag_ethernet(struct tag *tag) | ||
| 233 | { | ||
| 234 | #if 0 | ||
| 235 | const struct platform_device *pdev; | ||
| 236 | |||
| 237 | /* | ||
| 238 | * We really need a bus type that supports "classes"...this | ||
| 239 | * will do for now (until we must handle other kinds of | ||
| 240 | * ethernet controllers) | ||
| 241 | */ | ||
| 242 | pdev = platform_get_device("macb", tag->u.ethernet.mac_index); | ||
| 243 | if (pdev && pdev->dev.platform_data) { | ||
| 244 | struct eth_platform_data *data = pdev->dev.platform_data; | ||
| 245 | |||
| 246 | data->valid = 1; | ||
| 247 | data->mii_phy_addr = tag->u.ethernet.mii_phy_addr; | ||
| 248 | memcpy(data->hw_addr, tag->u.ethernet.hw_address, | ||
| 249 | sizeof(data->hw_addr)); | ||
| 250 | } | ||
| 251 | #endif | ||
| 252 | return 0; | ||
| 253 | } | ||
| 254 | __tagtable(ATAG_ETHERNET, parse_tag_ethernet); | ||
| 255 | |||
| 256 | /* | 232 | /* |
| 257 | * Scan the tag table for this tag, and call its parse function. The | 233 | * Scan the tag table for this tag, and call its parse function. The |
| 258 | * tag table is built by the linker from all the __tagtable | 234 | * tag table is built by the linker from all the __tagtable |
diff --git a/arch/avr32/lib/delay.c b/arch/avr32/lib/delay.c index 462c8307b680..b3bc0b56e2c6 100644 --- a/arch/avr32/lib/delay.c +++ b/arch/avr32/lib/delay.c | |||
| @@ -12,9 +12,9 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/param.h> | ||
| 15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
| 16 | 17 | ||
| 17 | #include <asm/delay.h> | ||
| 18 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
| 19 | #include <asm/sysreg.h> | 19 | #include <asm/sysreg.h> |
| 20 | 20 | ||
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c index 7ff6ad8bab5f..48f4ef38c70e 100644 --- a/arch/avr32/mach-at32ap/at32ap7000.c +++ b/arch/avr32/mach-at32ap/at32ap7000.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | #include <asm/io.h> | 12 | #include <asm/io.h> |
| 13 | 13 | ||
| 14 | #include <asm/arch/at32ap7000.h> | ||
| 14 | #include <asm/arch/board.h> | 15 | #include <asm/arch/board.h> |
| 15 | #include <asm/arch/portmux.h> | 16 | #include <asm/arch/portmux.h> |
| 16 | #include <asm/arch/sm.h> | 17 | #include <asm/arch/sm.h> |
| @@ -57,6 +58,9 @@ static struct platform_device _name##_id##_device = { \ | |||
| 57 | .num_resources = ARRAY_SIZE(_name##_id##_resource), \ | 58 | .num_resources = ARRAY_SIZE(_name##_id##_resource), \ |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 61 | #define select_peripheral(pin, periph, flags) \ | ||
| 62 | at32_select_periph(GPIO_PIN_##pin, GPIO_##periph, flags) | ||
| 63 | |||
| 60 | #define DEV_CLK(_name, devname, bus, _index) \ | 64 | #define DEV_CLK(_name, devname, bus, _index) \ |
| 61 | static struct clk devname##_##_name = { \ | 65 | static struct clk devname##_##_name = { \ |
| 62 | .name = #_name, \ | 66 | .name = #_name, \ |
| @@ -67,18 +71,6 @@ static struct clk devname##_##_name = { \ | |||
| 67 | .index = _index, \ | 71 | .index = _index, \ |
| 68 | } | 72 | } |
| 69 | 73 | ||
| 70 | enum { | ||
| 71 | PIOA, | ||
| 72 | PIOB, | ||
| 73 | PIOC, | ||
| 74 | PIOD, | ||
| 75 | }; | ||
| 76 | |||
| 77 | enum { | ||
| 78 | FUNC_A, | ||
| 79 | FUNC_B, | ||
| 80 | }; | ||
| 81 | |||
| 82 | unsigned long at32ap7000_osc_rates[3] = { | 74 | unsigned long at32ap7000_osc_rates[3] = { |
| 83 | [0] = 32768, | 75 | [0] = 32768, |
| 84 | /* FIXME: these are ATSTK1002-specific */ | 76 | /* FIXME: these are ATSTK1002-specific */ |
| @@ -569,26 +561,26 @@ DEV_CLK(usart, atmel_usart3, pba, 6); | |||
| 569 | 561 | ||
| 570 | static inline void configure_usart0_pins(void) | 562 | static inline void configure_usart0_pins(void) |
| 571 | { | 563 | { |
| 572 | portmux_set_func(PIOA, 8, FUNC_B); /* RXD */ | 564 | select_peripheral(PA(8), PERIPH_B, 0); /* RXD */ |
| 573 | portmux_set_func(PIOA, 9, FUNC_B); /* TXD */ | 565 | select_peripheral(PA(9), PERIPH_B, 0); /* TXD */ |
| 574 | } | 566 | } |
| 575 | 567 | ||
| 576 | static inline void configure_usart1_pins(void) | 568 | static inline void configure_usart1_pins(void) |
| 577 | { | 569 | { |
| 578 | portmux_set_func(PIOA, 17, FUNC_A); /* RXD */ | 570 | select_peripheral(PA(17), PERIPH_A, 0); /* RXD */ |
| 579 | portmux_set_func(PIOA, 18, FUNC_A); /* TXD */ | 571 | select_peripheral(PA(18), PERIPH_A, 0); /* TXD */ |
| 580 | } | 572 | } |
| 581 | 573 | ||
| 582 | static inline void configure_usart2_pins(void) | 574 | static inline void configure_usart2_pins(void) |
| 583 | { | 575 | { |
| 584 | portmux_set_func(PIOB, 26, FUNC_B); /* RXD */ | 576 | select_peripheral(PB(26), PERIPH_B, 0); /* RXD */ |
| 585 | portmux_set_func(PIOB, 27, FUNC_B); /* TXD */ | 577 | select_peripheral(PB(27), PERIPH_B, 0); /* TXD */ |
| 586 | } | 578 | } |
| 587 | 579 | ||
| 588 | static inline void configure_usart3_pins(void) | 580 | static inline void configure_usart3_pins(void) |
| 589 | { | 581 | { |
| 590 | portmux_set_func(PIOB, 18, FUNC_B); /* RXD */ | 582 | select_peripheral(PB(18), PERIPH_B, 0); /* RXD */ |
| 591 | portmux_set_func(PIOB, 17, FUNC_B); /* TXD */ | 583 | select_peripheral(PB(17), PERIPH_B, 0); /* TXD */ |
| 592 | } | 584 | } |
| 593 | 585 | ||
| 594 | static struct platform_device *at32_usarts[4]; | 586 | static struct platform_device *at32_usarts[4]; |
| @@ -654,6 +646,15 @@ DEFINE_DEV_DATA(macb, 0); | |||
| 654 | DEV_CLK(hclk, macb0, hsb, 8); | 646 | DEV_CLK(hclk, macb0, hsb, 8); |
| 655 | DEV_CLK(pclk, macb0, pbb, 6); | 647 | DEV_CLK(pclk, macb0, pbb, 6); |
| 656 | 648 | ||
| 649 | static struct eth_platform_data macb1_data; | ||
| 650 | static struct resource macb1_resource[] = { | ||
| 651 | PBMEM(0xfff01c00), | ||
| 652 | IRQ(26), | ||
| 653 | }; | ||
| 654 | DEFINE_DEV_DATA(macb, 1); | ||
| 655 | DEV_CLK(hclk, macb1, hsb, 9); | ||
| 656 | DEV_CLK(pclk, macb1, pbb, 7); | ||
| 657 | |||
| 657 | struct platform_device *__init | 658 | struct platform_device *__init |
| 658 | at32_add_device_eth(unsigned int id, struct eth_platform_data *data) | 659 | at32_add_device_eth(unsigned int id, struct eth_platform_data *data) |
| 659 | { | 660 | { |
| @@ -663,27 +664,54 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data) | |||
| 663 | case 0: | 664 | case 0: |
| 664 | pdev = &macb0_device; | 665 | pdev = &macb0_device; |
| 665 | 666 | ||
| 666 | portmux_set_func(PIOC, 3, FUNC_A); /* TXD0 */ | 667 | select_peripheral(PC(3), PERIPH_A, 0); /* TXD0 */ |
| 667 | portmux_set_func(PIOC, 4, FUNC_A); /* TXD1 */ | 668 | select_peripheral(PC(4), PERIPH_A, 0); /* TXD1 */ |
| 668 | portmux_set_func(PIOC, 7, FUNC_A); /* TXEN */ | 669 | select_peripheral(PC(7), PERIPH_A, 0); /* TXEN */ |
| 669 | portmux_set_func(PIOC, 8, FUNC_A); /* TXCK */ | 670 | select_peripheral(PC(8), PERIPH_A, 0); /* TXCK */ |
| 670 | portmux_set_func(PIOC, 9, FUNC_A); /* RXD0 */ | 671 | select_peripheral(PC(9), PERIPH_A, 0); /* RXD0 */ |
| 671 | portmux_set_func(PIOC, 10, FUNC_A); /* RXD1 */ | 672 | select_peripheral(PC(10), PERIPH_A, 0); /* RXD1 */ |
| 672 | portmux_set_func(PIOC, 13, FUNC_A); /* RXER */ | 673 | select_peripheral(PC(13), PERIPH_A, 0); /* RXER */ |
| 673 | portmux_set_func(PIOC, 15, FUNC_A); /* RXDV */ | 674 | select_peripheral(PC(15), PERIPH_A, 0); /* RXDV */ |
| 674 | portmux_set_func(PIOC, 16, FUNC_A); /* MDC */ | 675 | select_peripheral(PC(16), PERIPH_A, 0); /* MDC */ |
| 675 | portmux_set_func(PIOC, 17, FUNC_A); /* MDIO */ | 676 | select_peripheral(PC(17), PERIPH_A, 0); /* MDIO */ |
| 677 | |||
| 678 | if (!data->is_rmii) { | ||
| 679 | select_peripheral(PC(0), PERIPH_A, 0); /* COL */ | ||
| 680 | select_peripheral(PC(1), PERIPH_A, 0); /* CRS */ | ||
| 681 | select_peripheral(PC(2), PERIPH_A, 0); /* TXER */ | ||
| 682 | select_peripheral(PC(5), PERIPH_A, 0); /* TXD2 */ | ||
| 683 | select_peripheral(PC(6), PERIPH_A, 0); /* TXD3 */ | ||
| 684 | select_peripheral(PC(11), PERIPH_A, 0); /* RXD2 */ | ||
| 685 | select_peripheral(PC(12), PERIPH_A, 0); /* RXD3 */ | ||
| 686 | select_peripheral(PC(14), PERIPH_A, 0); /* RXCK */ | ||
| 687 | select_peripheral(PC(18), PERIPH_A, 0); /* SPD */ | ||
| 688 | } | ||
| 689 | break; | ||
| 690 | |||
| 691 | case 1: | ||
| 692 | pdev = &macb1_device; | ||
| 693 | |||
| 694 | select_peripheral(PD(13), PERIPH_B, 0); /* TXD0 */ | ||
| 695 | select_peripheral(PD(14), PERIPH_B, 0); /* TXD1 */ | ||
| 696 | select_peripheral(PD(11), PERIPH_B, 0); /* TXEN */ | ||
| 697 | select_peripheral(PD(12), PERIPH_B, 0); /* TXCK */ | ||
| 698 | select_peripheral(PD(10), PERIPH_B, 0); /* RXD0 */ | ||
| 699 | select_peripheral(PD(6), PERIPH_B, 0); /* RXD1 */ | ||
| 700 | select_peripheral(PD(5), PERIPH_B, 0); /* RXER */ | ||
| 701 | select_peripheral(PD(4), PERIPH_B, 0); /* RXDV */ | ||
| 702 | select_peripheral(PD(3), PERIPH_B, 0); /* MDC */ | ||
| 703 | select_peripheral(PD(2), PERIPH_B, 0); /* MDIO */ | ||
| 676 | 704 | ||
| 677 | if (!data->is_rmii) { | 705 | if (!data->is_rmii) { |
| 678 | portmux_set_func(PIOC, 0, FUNC_A); /* COL */ | 706 | select_peripheral(PC(19), PERIPH_B, 0); /* COL */ |
| 679 | portmux_set_func(PIOC, 1, FUNC_A); /* CRS */ | 707 | select_peripheral(PC(23), PERIPH_B, 0); /* CRS */ |
| 680 | portmux_set_func(PIOC, 2, FUNC_A); /* TXER */ | 708 | select_peripheral(PC(26), PERIPH_B, 0); /* TXER */ |
| 681 | portmux_set_func(PIOC, 5, FUNC_A); /* TXD2 */ | 709 | select_peripheral(PC(27), PERIPH_B, 0); /* TXD2 */ |
| 682 | portmux_set_func(PIOC, 6, FUNC_A); /* TXD3 */ | 710 | select_peripheral(PC(28), PERIPH_B, 0); /* TXD3 */ |
| 683 | portmux_set_func(PIOC, 11, FUNC_A); /* RXD2 */ | 711 | select_peripheral(PC(29), PERIPH_B, 0); /* RXD2 */ |
| 684 | portmux_set_func(PIOC, 12, FUNC_A); /* RXD3 */ | 712 | select_peripheral(PC(30), PERIPH_B, 0); /* RXD3 */ |
| 685 | portmux_set_func(PIOC, 14, FUNC_A); /* RXCK */ | 713 | select_peripheral(PC(24), PERIPH_B, 0); /* RXCK */ |
| 686 | portmux_set_func(PIOC, 18, FUNC_A); /* SPD */ | 714 | select_peripheral(PD(15), PERIPH_B, 0); /* SPD */ |
| 687 | } | 715 | } |
| 688 | break; | 716 | break; |
| 689 | 717 | ||
| @@ -714,12 +742,12 @@ struct platform_device *__init at32_add_device_spi(unsigned int id) | |||
| 714 | switch (id) { | 742 | switch (id) { |
| 715 | case 0: | 743 | case 0: |
| 716 | pdev = &spi0_device; | 744 | pdev = &spi0_device; |
| 717 | portmux_set_func(PIOA, 0, FUNC_A); /* MISO */ | 745 | select_peripheral(PA(0), PERIPH_A, 0); /* MISO */ |
| 718 | portmux_set_func(PIOA, 1, FUNC_A); /* MOSI */ | 746 | select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */ |
| 719 | portmux_set_func(PIOA, 2, FUNC_A); /* SCK */ | 747 | select_peripheral(PA(2), PERIPH_A, 0); /* SCK */ |
| 720 | portmux_set_func(PIOA, 3, FUNC_A); /* NPCS0 */ | 748 | select_peripheral(PA(3), PERIPH_A, 0); /* NPCS0 */ |
| 721 | portmux_set_func(PIOA, 4, FUNC_A); /* NPCS1 */ | 749 | select_peripheral(PA(4), PERIPH_A, 0); /* NPCS1 */ |
| 722 | portmux_set_func(PIOA, 5, FUNC_A); /* NPCS2 */ | 750 | select_peripheral(PA(5), PERIPH_A, 0); /* NPCS2 */ |
| 723 | break; | 751 | break; |
| 724 | 752 | ||
| 725 | default: | 753 | default: |
| @@ -762,37 +790,37 @@ at32_add_device_lcdc(unsigned int id, struct lcdc_platform_data *data) | |||
| 762 | switch (id) { | 790 | switch (id) { |
| 763 | case 0: | 791 | case 0: |
| 764 | pdev = &lcdc0_device; | 792 | pdev = &lcdc0_device; |
| 765 | portmux_set_func(PIOC, 19, FUNC_A); /* CC */ | 793 | select_peripheral(PC(19), PERIPH_A, 0); /* CC */ |
| 766 | portmux_set_func(PIOC, 20, FUNC_A); /* HSYNC */ | 794 | select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ |
| 767 | portmux_set_func(PIOC, 21, FUNC_A); /* PCLK */ | 795 | select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ |
| 768 | portmux_set_func(PIOC, 22, FUNC_A); /* VSYNC */ | 796 | select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */ |
| 769 | portmux_set_func(PIOC, 23, FUNC_A); /* DVAL */ | 797 | select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */ |
| 770 | portmux_set_func(PIOC, 24, FUNC_A); /* MODE */ | 798 | select_peripheral(PC(24), PERIPH_A, 0); /* MODE */ |
| 771 | portmux_set_func(PIOC, 25, FUNC_A); /* PWR */ | 799 | select_peripheral(PC(25), PERIPH_A, 0); /* PWR */ |
| 772 | portmux_set_func(PIOC, 26, FUNC_A); /* DATA0 */ | 800 | select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */ |
| 773 | portmux_set_func(PIOC, 27, FUNC_A); /* DATA1 */ | 801 | select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */ |
| 774 | portmux_set_func(PIOC, 28, FUNC_A); /* DATA2 */ | 802 | select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */ |
| 775 | portmux_set_func(PIOC, 29, FUNC_A); /* DATA3 */ | 803 | select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */ |
| 776 | portmux_set_func(PIOC, 30, FUNC_A); /* DATA4 */ | 804 | select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */ |
| 777 | portmux_set_func(PIOC, 31, FUNC_A); /* DATA5 */ | 805 | select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */ |
| 778 | portmux_set_func(PIOD, 0, FUNC_A); /* DATA6 */ | 806 | select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */ |
| 779 | portmux_set_func(PIOD, 1, FUNC_A); /* DATA7 */ | 807 | select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */ |
| 780 | portmux_set_func(PIOD, 2, FUNC_A); /* DATA8 */ | 808 | select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */ |
| 781 | portmux_set_func(PIOD, 3, FUNC_A); /* DATA9 */ | 809 | select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */ |
| 782 | portmux_set_func(PIOD, 4, FUNC_A); /* DATA10 */ | 810 | select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */ |
| 783 | portmux_set_func(PIOD, 5, FUNC_A); /* DATA11 */ | 811 | select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */ |
| 784 | portmux_set_func(PIOD, 6, FUNC_A); /* DATA12 */ | 812 | select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */ |
| 785 | portmux_set_func(PIOD, 7, FUNC_A); /* DATA13 */ | 813 | select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */ |
| 786 | portmux_set_func(PIOD, 8, FUNC_A); /* DATA14 */ | 814 | select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */ |
| 787 | portmux_set_func(PIOD, 9, FUNC_A); /* DATA15 */ | 815 | select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */ |
| 788 | portmux_set_func(PIOD, 10, FUNC_A); /* DATA16 */ | 816 | select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */ |
| 789 | portmux_set_func(PIOD, 11, FUNC_A); /* DATA17 */ | 817 | select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */ |
| 790 | portmux_set_func(PIOD, 12, FUNC_A); /* DATA18 */ | 818 | select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */ |
| 791 | portmux_set_func(PIOD, 13, FUNC_A); /* DATA19 */ | 819 | select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */ |
| 792 | portmux_set_func(PIOD, 14, FUNC_A); /* DATA20 */ | 820 | select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */ |
| 793 | portmux_set_func(PIOD, 15, FUNC_A); /* DATA21 */ | 821 | select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */ |
| 794 | portmux_set_func(PIOD, 16, FUNC_A); /* DATA22 */ | 822 | select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ |
| 795 | portmux_set_func(PIOD, 17, FUNC_A); /* DATA23 */ | 823 | select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ |
| 796 | 824 | ||
| 797 | clk_set_parent(&lcdc0_pixclk, &pll0); | 825 | clk_set_parent(&lcdc0_pixclk, &pll0); |
| 798 | clk_set_rate(&lcdc0_pixclk, clk_get_rate(&pll0)); | 826 | clk_set_rate(&lcdc0_pixclk, clk_get_rate(&pll0)); |
| @@ -838,6 +866,8 @@ struct clk *at32_clock_list[] = { | |||
| 838 | &atmel_usart3_usart, | 866 | &atmel_usart3_usart, |
| 839 | &macb0_hclk, | 867 | &macb0_hclk, |
| 840 | &macb0_pclk, | 868 | &macb0_pclk, |
| 869 | &macb1_hclk, | ||
| 870 | &macb1_pclk, | ||
| 841 | &spi0_mck, | 871 | &spi0_mck, |
| 842 | &lcdc0_hclk, | 872 | &lcdc0_hclk, |
| 843 | &lcdc0_pixclk, | 873 | &lcdc0_pixclk, |
diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c index 4dff1f988900..b59272e81b9a 100644 --- a/arch/avr32/mach-at32ap/extint.c +++ b/arch/avr32/mach-at32ap/extint.c | |||
| @@ -49,12 +49,25 @@ static void eim_unmask_irq(unsigned int irq) | |||
| 49 | static int eim_set_irq_type(unsigned int irq, unsigned int flow_type) | 49 | static int eim_set_irq_type(unsigned int irq, unsigned int flow_type) |
| 50 | { | 50 | { |
| 51 | struct at32_sm *sm = get_irq_chip_data(irq); | 51 | struct at32_sm *sm = get_irq_chip_data(irq); |
| 52 | struct irq_desc *desc; | ||
| 52 | unsigned int i = irq - sm->eim_first_irq; | 53 | unsigned int i = irq - sm->eim_first_irq; |
| 53 | u32 mode, edge, level; | 54 | u32 mode, edge, level; |
| 54 | unsigned long flags; | 55 | unsigned long flags; |
| 55 | int ret = 0; | 56 | int ret = 0; |
| 56 | 57 | ||
| 57 | flow_type &= IRQ_TYPE_SENSE_MASK; | 58 | if (flow_type == IRQ_TYPE_NONE) |
| 59 | flow_type = IRQ_TYPE_LEVEL_LOW; | ||
| 60 | |||
| 61 | desc = &irq_desc[irq]; | ||
| 62 | desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); | ||
| 63 | desc->status |= flow_type & IRQ_TYPE_SENSE_MASK; | ||
| 64 | |||
| 65 | if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) { | ||
| 66 | desc->status |= IRQ_LEVEL; | ||
| 67 | set_irq_handler(irq, handle_level_irq); | ||
| 68 | } else { | ||
| 69 | set_irq_handler(irq, handle_edge_irq); | ||
| 70 | } | ||
| 58 | 71 | ||
| 59 | spin_lock_irqsave(&sm->lock, flags); | 72 | spin_lock_irqsave(&sm->lock, flags); |
| 60 | 73 | ||
| @@ -148,10 +161,15 @@ static int __init eim_init(void) | |||
| 148 | pattern = sm_readl(sm, EIM_MODE); | 161 | pattern = sm_readl(sm, EIM_MODE); |
| 149 | nr_irqs = fls(pattern); | 162 | nr_irqs = fls(pattern); |
| 150 | 163 | ||
| 164 | /* Trigger on falling edge unless overridden by driver */ | ||
| 165 | sm_writel(sm, EIM_MODE, 0UL); | ||
| 166 | sm_writel(sm, EIM_EDGE, 0UL); | ||
| 167 | |||
| 151 | sm->eim_chip = &eim_chip; | 168 | sm->eim_chip = &eim_chip; |
| 152 | 169 | ||
| 153 | for (i = 0; i < nr_irqs; i++) { | 170 | for (i = 0; i < nr_irqs; i++) { |
| 154 | set_irq_chip(sm->eim_first_irq + i, &eim_chip); | 171 | set_irq_chip_and_handler(sm->eim_first_irq + i, &eim_chip, |
| 172 | handle_edge_irq); | ||
| 155 | set_irq_chip_data(sm->eim_first_irq + i, sm); | 173 | set_irq_chip_data(sm->eim_first_irq + i, sm); |
| 156 | } | 174 | } |
| 157 | 175 | ||
diff --git a/arch/avr32/mach-at32ap/intc.c b/arch/avr32/mach-at32ap/intc.c index eb87a18ad7b2..dd5c009cf224 100644 --- a/arch/avr32/mach-at32ap/intc.c +++ b/arch/avr32/mach-at32ap/intc.c | |||
| @@ -136,3 +136,7 @@ fail: | |||
| 136 | panic("Interrupt controller initialization failed!\n"); | 136 | panic("Interrupt controller initialization failed!\n"); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | unsigned long intc_get_pending(int group) | ||
| 140 | { | ||
| 141 | return intc_readl(&intc0, INTREQ0 + 4 * group); | ||
| 142 | } | ||
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c index d3aabfca8598..f1280ed8ed6d 100644 --- a/arch/avr32/mach-at32ap/pio.c +++ b/arch/avr32/mach-at32ap/pio.c | |||
| @@ -25,27 +25,98 @@ struct pio_device { | |||
| 25 | void __iomem *regs; | 25 | void __iomem *regs; |
| 26 | const struct platform_device *pdev; | 26 | const struct platform_device *pdev; |
| 27 | struct clk *clk; | 27 | struct clk *clk; |
| 28 | u32 alloc_mask; | 28 | u32 pinmux_mask; |
| 29 | char name[32]; | 29 | char name[32]; |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | static struct pio_device pio_dev[MAX_NR_PIO_DEVICES]; | 32 | static struct pio_device pio_dev[MAX_NR_PIO_DEVICES]; |
| 33 | 33 | ||
| 34 | void portmux_set_func(unsigned int portmux_id, unsigned int pin_id, | 34 | static struct pio_device *gpio_to_pio(unsigned int gpio) |
| 35 | unsigned int function_id) | ||
| 36 | { | 35 | { |
| 37 | struct pio_device *pio; | 36 | struct pio_device *pio; |
| 38 | u32 mask = 1 << pin_id; | 37 | unsigned int index; |
| 39 | 38 | ||
| 40 | BUG_ON(portmux_id >= MAX_NR_PIO_DEVICES); | 39 | index = gpio >> 5; |
| 40 | if (index >= MAX_NR_PIO_DEVICES) | ||
| 41 | return NULL; | ||
| 42 | pio = &pio_dev[index]; | ||
| 43 | if (!pio->regs) | ||
| 44 | return NULL; | ||
| 41 | 45 | ||
| 42 | pio = &pio_dev[portmux_id]; | 46 | return pio; |
| 47 | } | ||
| 48 | |||
| 49 | /* Pin multiplexing API */ | ||
| 50 | |||
| 51 | void __init at32_select_periph(unsigned int pin, unsigned int periph, | ||
| 52 | unsigned long flags) | ||
| 53 | { | ||
| 54 | struct pio_device *pio; | ||
| 55 | unsigned int pin_index = pin & 0x1f; | ||
| 56 | u32 mask = 1 << pin_index; | ||
| 57 | |||
| 58 | pio = gpio_to_pio(pin); | ||
| 59 | if (unlikely(!pio)) { | ||
| 60 | printk("pio: invalid pin %u\n", pin); | ||
| 61 | goto fail; | ||
| 62 | } | ||
| 43 | 63 | ||
| 44 | if (function_id) | 64 | if (unlikely(test_and_set_bit(pin_index, &pio->pinmux_mask))) { |
| 65 | printk("%s: pin %u is busy\n", pio->name, pin_index); | ||
| 66 | goto fail; | ||
| 67 | } | ||
| 68 | |||
| 69 | pio_writel(pio, PUER, mask); | ||
| 70 | if (periph) | ||
| 45 | pio_writel(pio, BSR, mask); | 71 | pio_writel(pio, BSR, mask); |
| 46 | else | 72 | else |
| 47 | pio_writel(pio, ASR, mask); | 73 | pio_writel(pio, ASR, mask); |
| 74 | |||
| 48 | pio_writel(pio, PDR, mask); | 75 | pio_writel(pio, PDR, mask); |
| 76 | if (!(flags & AT32_GPIOF_PULLUP)) | ||
| 77 | pio_writel(pio, PUDR, mask); | ||
| 78 | |||
| 79 | return; | ||
| 80 | |||
| 81 | fail: | ||
| 82 | dump_stack(); | ||
| 83 | } | ||
| 84 | |||
| 85 | void __init at32_select_gpio(unsigned int pin, unsigned long flags) | ||
| 86 | { | ||
| 87 | struct pio_device *pio; | ||
| 88 | unsigned int pin_index = pin & 0x1f; | ||
| 89 | u32 mask = 1 << pin_index; | ||
| 90 | |||
| 91 | pio = gpio_to_pio(pin); | ||
| 92 | if (unlikely(!pio)) { | ||
| 93 | printk("pio: invalid pin %u\n", pin); | ||
| 94 | goto fail; | ||
| 95 | } | ||
| 96 | |||
| 97 | if (unlikely(test_and_set_bit(pin_index, &pio->pinmux_mask))) { | ||
| 98 | printk("%s: pin %u is busy\n", pio->name, pin_index); | ||
| 99 | goto fail; | ||
| 100 | } | ||
| 101 | |||
| 102 | pio_writel(pio, PUER, mask); | ||
| 103 | if (flags & AT32_GPIOF_HIGH) | ||
| 104 | pio_writel(pio, SODR, mask); | ||
| 105 | else | ||
| 106 | pio_writel(pio, CODR, mask); | ||
| 107 | if (flags & AT32_GPIOF_OUTPUT) | ||
| 108 | pio_writel(pio, OER, mask); | ||
| 109 | else | ||
| 110 | pio_writel(pio, ODR, mask); | ||
| 111 | |||
| 112 | pio_writel(pio, PER, mask); | ||
| 113 | if (!(flags & AT32_GPIOF_PULLUP)) | ||
| 114 | pio_writel(pio, PUDR, mask); | ||
| 115 | |||
| 116 | return; | ||
| 117 | |||
| 118 | fail: | ||
| 119 | dump_stack(); | ||
| 49 | } | 120 | } |
| 50 | 121 | ||
| 51 | static int __init pio_probe(struct platform_device *pdev) | 122 | static int __init pio_probe(struct platform_device *pdev) |
diff --git a/arch/avr32/mach-at32ap/sm.c b/arch/avr32/mach-at32ap/sm.c deleted file mode 100644 index 03306eb0345e..000000000000 --- a/arch/avr32/mach-at32ap/sm.c +++ /dev/null | |||
| @@ -1,289 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * System Manager driver for AT32AP CPUs | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006 Atmel Corporation | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include <linux/errno.h> | ||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/interrupt.h> | ||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/platform_device.h> | ||
| 16 | #include <linux/random.h> | ||
| 17 | #include <linux/spinlock.h> | ||
| 18 | |||
| 19 | #include <asm/intc.h> | ||
| 20 | #include <asm/io.h> | ||
| 21 | #include <asm/irq.h> | ||
| 22 | |||
| 23 | #include <asm/arch/sm.h> | ||
| 24 | |||
| 25 | #include "sm.h" | ||
| 26 | |||
| 27 | #define SM_EIM_IRQ_RESOURCE 1 | ||
| 28 | #define SM_PM_IRQ_RESOURCE 2 | ||
| 29 | #define SM_RTC_IRQ_RESOURCE 3 | ||
| 30 | |||
| 31 | #define to_eim(irqc) container_of(irqc, struct at32_sm, irqc) | ||
| 32 | |||
| 33 | struct at32_sm system_manager; | ||
| 34 | |||
| 35 | int __init at32_sm_init(void) | ||
| 36 | { | ||
| 37 | struct resource *regs; | ||
| 38 | struct at32_sm *sm = &system_manager; | ||
| 39 | int ret = -ENXIO; | ||
| 40 | |||
| 41 | regs = platform_get_resource(&at32_sm_device, IORESOURCE_MEM, 0); | ||
| 42 | if (!regs) | ||
| 43 | goto fail; | ||
| 44 | |||
| 45 | spin_lock_init(&sm->lock); | ||
| 46 | sm->pdev = &at32_sm_device; | ||
| 47 | |||
| 48 | ret = -ENOMEM; | ||
| 49 | sm->regs = ioremap(regs->start, regs->end - regs->start + 1); | ||
| 50 | if (!sm->regs) | ||
| 51 | goto fail; | ||
| 52 | |||
| 53 | return 0; | ||
| 54 | |||
| 55 | fail: | ||
| 56 | printk(KERN_ERR "Failed to initialize System Manager: %d\n", ret); | ||
| 57 | return ret; | ||
| 58 | } | ||
| 59 | |||
| 60 | /* | ||
| 61 | * External Interrupt Module (EIM). | ||
| 62 | * | ||
| 63 | * EIM gets level- or edge-triggered interrupts of either polarity | ||
| 64 | * from the outside and converts it to active-high level-triggered | ||
| 65 | * interrupts that the internal interrupt controller can handle. EIM | ||
| 66 | * also provides masking/unmasking of interrupts, as well as | ||
| 67 | * acknowledging of edge-triggered interrupts. | ||
| 68 | */ | ||
| 69 | |||
| 70 | static irqreturn_t spurious_eim_interrupt(int irq, void *dev_id, | ||
| 71 | struct pt_regs *regs) | ||
| 72 | { | ||
| 73 | printk(KERN_WARNING "Spurious EIM interrupt %d\n", irq); | ||
| 74 | disable_irq(irq); | ||
| 75 | return IRQ_NONE; | ||
| 76 | } | ||
| 77 | |||
| 78 | static struct irqaction eim_spurious_action = { | ||
| 79 | .handler = spurious_eim_interrupt, | ||
| 80 | }; | ||
| 81 | |||
| 82 | static irqreturn_t eim_handle_irq(int irq, void *dev_id, struct pt_regs *regs) | ||
| 83 | { | ||
| 84 | struct irq_controller * irqc = dev_id; | ||
| 85 | struct at32_sm *sm = to_eim(irqc); | ||
| 86 | unsigned long pending; | ||
| 87 | |||
| 88 | /* | ||
| 89 | * No need to disable interrupts globally. The interrupt | ||
| 90 | * level relevant to this group must be masked all the time, | ||
| 91 | * so we know that this particular EIM instance will not be | ||
| 92 | * re-entered. | ||
| 93 | */ | ||
| 94 | spin_lock(&sm->lock); | ||
| 95 | |||
| 96 | pending = intc_get_pending(sm->irqc.irq_group); | ||
| 97 | if (unlikely(!pending)) { | ||
| 98 | printk(KERN_ERR "EIM (group %u): No interrupts pending!\n", | ||
| 99 | sm->irqc.irq_group); | ||
| 100 | goto unlock; | ||
| 101 | } | ||
| 102 | |||
| 103 | do { | ||
| 104 | struct irqaction *action; | ||
| 105 | unsigned int i; | ||
| 106 | |||
| 107 | i = fls(pending) - 1; | ||
| 108 | pending &= ~(1 << i); | ||
| 109 | action = sm->action[i]; | ||
| 110 | |||
| 111 | /* Acknowledge the interrupt */ | ||
| 112 | sm_writel(sm, EIM_ICR, 1 << i); | ||
| 113 | |||
| 114 | spin_unlock(&sm->lock); | ||
| 115 | |||
| 116 | if (action->flags & SA_INTERRUPT) | ||
| 117 | local_irq_disable(); | ||
| 118 | action->handler(sm->irqc.first_irq + i, action->dev_id, regs); | ||
| 119 | local_irq_enable(); | ||
| 120 | spin_lock(&sm->lock); | ||
| 121 | if (action->flags & SA_SAMPLE_RANDOM) | ||
| 122 | add_interrupt_randomness(sm->irqc.first_irq + i); | ||
| 123 | } while (pending); | ||
| 124 | |||
| 125 | unlock: | ||
| 126 | spin_unlock(&sm->lock); | ||
| 127 | return IRQ_HANDLED; | ||
| 128 | } | ||
| 129 | |||
| 130 | static void eim_mask(struct irq_controller *irqc, unsigned int irq) | ||
| 131 | { | ||
| 132 | struct at32_sm *sm = to_eim(irqc); | ||
| 133 | unsigned int i; | ||
| 134 | |||
| 135 | i = irq - sm->irqc.first_irq; | ||
| 136 | sm_writel(sm, EIM_IDR, 1 << i); | ||
| 137 | } | ||
| 138 | |||
| 139 | static void eim_unmask(struct irq_controller *irqc, unsigned int irq) | ||
| 140 | { | ||
| 141 | struct at32_sm *sm = to_eim(irqc); | ||
| 142 | unsigned int i; | ||
| 143 | |||
| 144 | i = irq - sm->irqc.first_irq; | ||
| 145 | sm_writel(sm, EIM_IER, 1 << i); | ||
| 146 | } | ||
| 147 | |||
| 148 | static int eim_setup(struct irq_controller *irqc, unsigned int irq, | ||
| 149 | struct irqaction *action) | ||
| 150 | { | ||
| 151 | struct at32_sm *sm = to_eim(irqc); | ||
| 152 | sm->action[irq - sm->irqc.first_irq] = action; | ||
| 153 | /* Acknowledge earlier interrupts */ | ||
| 154 | sm_writel(sm, EIM_ICR, (1<<(irq - sm->irqc.first_irq))); | ||
| 155 | eim_unmask(irqc, irq); | ||
| 156 | return 0; | ||
| 157 | } | ||
| 158 | |||
| 159 | static void eim_free(struct irq_controller *irqc, unsigned int irq, | ||
| 160 | void *dev) | ||
| 161 | { | ||
| 162 | struct at32_sm *sm = to_eim(irqc); | ||
| 163 | eim_mask(irqc, irq); | ||
| 164 | sm->action[irq - sm->irqc.first_irq] = &eim_spurious_action; | ||
| 165 | } | ||
| 166 | |||
| 167 | static int eim_set_type(struct irq_controller *irqc, unsigned int irq, | ||
| 168 | unsigned int type) | ||
| 169 | { | ||
| 170 | struct at32_sm *sm = to_eim(irqc); | ||
| 171 | unsigned long flags; | ||
| 172 | u32 value, pattern; | ||
| 173 | |||
| 174 | spin_lock_irqsave(&sm->lock, flags); | ||
| 175 | |||
| 176 | pattern = 1 << (irq - sm->irqc.first_irq); | ||
| 177 | |||
| 178 | value = sm_readl(sm, EIM_MODE); | ||
| 179 | if (type & IRQ_TYPE_LEVEL) | ||
| 180 | value |= pattern; | ||
| 181 | else | ||
| 182 | value &= ~pattern; | ||
| 183 | sm_writel(sm, EIM_MODE, value); | ||
| 184 | value = sm_readl(sm, EIM_EDGE); | ||
| 185 | if (type & IRQ_EDGE_RISING) | ||
| 186 | value |= pattern; | ||
| 187 | else | ||
| 188 | value &= ~pattern; | ||
| 189 | sm_writel(sm, EIM_EDGE, value); | ||
| 190 | value = sm_readl(sm, EIM_LEVEL); | ||
| 191 | if (type & IRQ_LEVEL_HIGH) | ||
| 192 | value |= pattern; | ||
| 193 | else | ||
| 194 | value &= ~pattern; | ||
| 195 | sm_writel(sm, EIM_LEVEL, value); | ||
| 196 | |||
| 197 | spin_unlock_irqrestore(&sm->lock, flags); | ||
| 198 | |||
| 199 | return 0; | ||
| 200 | } | ||
| 201 | |||
| 202 | static unsigned int eim_get_type(struct irq_controller *irqc, | ||
| 203 | unsigned int irq) | ||
| 204 | { | ||
| 205 | struct at32_sm *sm = to_eim(irqc); | ||
| 206 | unsigned long flags; | ||
| 207 | unsigned int type = 0; | ||
| 208 | u32 mode, edge, level, pattern; | ||
| 209 | |||
| 210 | pattern = 1 << (irq - sm->irqc.first_irq); | ||
| 211 | |||
| 212 | spin_lock_irqsave(&sm->lock, flags); | ||
| 213 | mode = sm_readl(sm, EIM_MODE); | ||
| 214 | edge = sm_readl(sm, EIM_EDGE); | ||
| 215 | level = sm_readl(sm, EIM_LEVEL); | ||
| 216 | spin_unlock_irqrestore(&sm->lock, flags); | ||
| 217 | |||
| 218 | if (mode & pattern) | ||
| 219 | type |= IRQ_TYPE_LEVEL; | ||
| 220 | if (edge & pattern) | ||
| 221 | type |= IRQ_EDGE_RISING; | ||
| 222 | if (level & pattern) | ||
| 223 | type |= IRQ_LEVEL_HIGH; | ||
| 224 | |||
| 225 | return type; | ||
| 226 | } | ||
| 227 | |||
| 228 | static struct irq_controller_class eim_irq_class = { | ||
| 229 | .typename = "EIM", | ||
| 230 | .handle = eim_handle_irq, | ||
| 231 | .setup = eim_setup, | ||
| 232 | .free = eim_free, | ||
| 233 | .mask = eim_mask, | ||
| 234 | .unmask = eim_unmask, | ||
| 235 | .set_type = eim_set_type, | ||
| 236 | .get_type = eim_get_type, | ||
| 237 | }; | ||
| 238 | |||
| 239 | static int __init eim_init(void) | ||
| 240 | { | ||
| 241 | struct at32_sm *sm = &system_manager; | ||
| 242 | unsigned int i; | ||
| 243 | u32 pattern; | ||
| 244 | int ret; | ||
| 245 | |||
| 246 | /* | ||
| 247 | * The EIM is really the same module as SM, so register | ||
| 248 | * mapping, etc. has been taken care of already. | ||
| 249 | */ | ||
| 250 | |||
| 251 | /* | ||
| 252 | * Find out how many interrupt lines that are actually | ||
| 253 | * implemented in hardware. | ||
| 254 | */ | ||
| 255 | sm_writel(sm, EIM_IDR, ~0UL); | ||
| 256 | sm_writel(sm, EIM_MODE, ~0UL); | ||
| 257 | pattern = sm_readl(sm, EIM_MODE); | ||
| 258 | sm->irqc.nr_irqs = fls(pattern); | ||
| 259 | |||
| 260 | ret = -ENOMEM; | ||
| 261 | sm->action = kmalloc(sizeof(*sm->action) * sm->irqc.nr_irqs, | ||
| 262 | GFP_KERNEL); | ||
| 263 | if (!sm->action) | ||
| 264 | goto out; | ||
| 265 | |||
| 266 | for (i = 0; i < sm->irqc.nr_irqs; i++) | ||
| 267 | sm->action[i] = &eim_spurious_action; | ||
| 268 | |||
| 269 | spin_lock_init(&sm->lock); | ||
| 270 | sm->irqc.irq_group = sm->pdev->resource[SM_EIM_IRQ_RESOURCE].start; | ||
| 271 | sm->irqc.class = &eim_irq_class; | ||
| 272 | |||
| 273 | ret = intc_register_controller(&sm->irqc); | ||
| 274 | if (ret < 0) | ||
| 275 | goto out_free_actions; | ||
| 276 | |||
| 277 | printk("EIM: External Interrupt Module at 0x%p, IRQ group %u\n", | ||
| 278 | sm->regs, sm->irqc.irq_group); | ||
| 279 | printk("EIM: Handling %u external IRQs, starting with IRQ%u\n", | ||
| 280 | sm->irqc.nr_irqs, sm->irqc.first_irq); | ||
| 281 | |||
| 282 | return 0; | ||
| 283 | |||
| 284 | out_free_actions: | ||
| 285 | kfree(sm->action); | ||
| 286 | out: | ||
| 287 | return ret; | ||
| 288 | } | ||
| 289 | arch_initcall(eim_init); | ||
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig index 1f9300f37f52..96e941084c04 100644 --- a/arch/mips/configs/malta_defconfig +++ b/arch/mips/configs/malta_defconfig | |||
| @@ -644,7 +644,85 @@ CONFIG_CONNECTOR=m | |||
| 644 | # | 644 | # |
| 645 | # Memory Technology Devices (MTD) | 645 | # Memory Technology Devices (MTD) |
| 646 | # | 646 | # |
| 647 | # CONFIG_MTD is not set | 647 | CONFIG_MTD=y |
| 648 | # CONFIG_MTD_DEBUG is not set | ||
| 649 | # CONFIG_MTD_CONCAT is not set | ||
| 650 | CONFIG_MTD_PARTITIONS=y | ||
| 651 | # CONFIG_MTD_REDBOOT_PARTS is not set | ||
| 652 | # CONFIG_MTD_CMDLINE_PARTS is not set | ||
| 653 | |||
| 654 | # | ||
| 655 | # User Modules And Translation Layers | ||
| 656 | # | ||
| 657 | CONFIG_MTD_CHAR=y | ||
| 658 | CONFIG_MTD_BLOCK=y | ||
| 659 | # CONFIG_FTL is not set | ||
| 660 | # CONFIG_NFTL is not set | ||
| 661 | # CONFIG_INFTL is not set | ||
| 662 | # CONFIG_RFD_FTL is not set | ||
| 663 | # CONFIG_SSFDC is not set | ||
| 664 | |||
| 665 | # | ||
| 666 | # RAM/ROM/Flash chip drivers | ||
| 667 | # | ||
| 668 | CONFIG_MTD_CFI=y | ||
| 669 | # CONFIG_MTD_JEDECPROBE is not set | ||
| 670 | CONFIG_MTD_GEN_PROBE=y | ||
| 671 | # CONFIG_MTD_CFI_ADV_OPTIONS is not set | ||
| 672 | CONFIG_MTD_MAP_BANK_WIDTH_1=y | ||
| 673 | CONFIG_MTD_MAP_BANK_WIDTH_2=y | ||
| 674 | CONFIG_MTD_MAP_BANK_WIDTH_4=y | ||
| 675 | # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set | ||
| 676 | # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set | ||
| 677 | # CONFIG_MTD_MAP_BANK_WIDTH_32 is not set | ||
| 678 | CONFIG_MTD_CFI_I1=y | ||
| 679 | CONFIG_MTD_CFI_I2=y | ||
| 680 | # CONFIG_MTD_CFI_I4 is not set | ||
| 681 | # CONFIG_MTD_CFI_I8 is not set | ||
| 682 | CONFIG_MTD_CFI_INTELEXT=y | ||
| 683 | CONFIG_MTD_CFI_AMDSTD=y | ||
| 684 | CONFIG_MTD_CFI_STAA=y | ||
| 685 | CONFIG_MTD_CFI_UTIL=y | ||
| 686 | # CONFIG_MTD_RAM is not set | ||
| 687 | # CONFIG_MTD_ROM is not set | ||
| 688 | # CONFIG_MTD_ABSENT is not set | ||
| 689 | # CONFIG_MTD_OBSOLETE_CHIPS is not set | ||
| 690 | |||
| 691 | # | ||
| 692 | # Mapping drivers for chip access | ||
| 693 | # | ||
| 694 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | ||
| 695 | CONFIG_MTD_PHYSMAP=y | ||
| 696 | CONFIG_MTD_PHYSMAP_START=0x0 | ||
| 697 | CONFIG_MTD_PHYSMAP_LEN=0x0 | ||
| 698 | CONFIG_MTD_PHYSMAP_BANKWIDTH=0 | ||
| 699 | # CONFIG_MTD_PLATRAM is not set | ||
| 700 | |||
| 701 | # | ||
| 702 | # Self-contained MTD device drivers | ||
| 703 | # | ||
| 704 | # CONFIG_MTD_PMC551 is not set | ||
| 705 | # CONFIG_MTD_SLRAM is not set | ||
| 706 | # CONFIG_MTD_PHRAM is not set | ||
| 707 | # CONFIG_MTD_MTDRAM is not set | ||
| 708 | # CONFIG_MTD_BLOCK2MTD is not set | ||
| 709 | |||
| 710 | # | ||
| 711 | # Disk-On-Chip Device Drivers | ||
| 712 | # | ||
| 713 | # CONFIG_MTD_DOC2000 is not set | ||
| 714 | # CONFIG_MTD_DOC2001 is not set | ||
| 715 | # CONFIG_MTD_DOC2001PLUS is not set | ||
| 716 | |||
| 717 | # | ||
| 718 | # NAND Flash Device Drivers | ||
| 719 | # | ||
| 720 | # CONFIG_MTD_NAND is not set | ||
| 721 | |||
| 722 | # | ||
| 723 | # OneNAND Flash Device Drivers | ||
| 724 | # | ||
| 725 | # CONFIG_MTD_ONENAND is not set | ||
| 648 | 726 | ||
| 649 | # | 727 | # |
| 650 | # Parallel port support | 728 | # Parallel port support |
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 2f4508f55fca..cecff24cc972 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S | |||
| @@ -109,6 +109,10 @@ SECTIONS | |||
| 109 | .con_initcall.init : { *(.con_initcall.init) } | 109 | .con_initcall.init : { *(.con_initcall.init) } |
| 110 | __con_initcall_end = .; | 110 | __con_initcall_end = .; |
| 111 | SECURITY_INIT | 111 | SECURITY_INIT |
| 112 | /* .exit.text is discarded at runtime, not link time, to deal with | ||
| 113 | references from .rodata */ | ||
| 114 | .exit.text : { *(.exit.text) } | ||
| 115 | .exit.data : { *(.exit.data) } | ||
| 112 | . = ALIGN(_PAGE_SIZE); | 116 | . = ALIGN(_PAGE_SIZE); |
| 113 | __initramfs_start = .; | 117 | __initramfs_start = .; |
| 114 | .init.ramfs : { *(.init.ramfs) } | 118 | .init.ramfs : { *(.init.ramfs) } |
| @@ -136,8 +140,6 @@ SECTIONS | |||
| 136 | 140 | ||
| 137 | /* Sections to be discarded */ | 141 | /* Sections to be discarded */ |
| 138 | /DISCARD/ : { | 142 | /DISCARD/ : { |
| 139 | *(.exit.text) | ||
| 140 | *(.exit.data) | ||
| 141 | *(.exitcall.exit) | 143 | *(.exitcall.exit) |
| 142 | 144 | ||
| 143 | /* ABI crap starts here */ | 145 | /* ABI crap starts here */ |
diff --git a/arch/mips/mips-boards/malta/Makefile b/arch/mips/mips-boards/malta/Makefile index 77ee5c6d33c1..b662c75fb28e 100644 --- a/arch/mips/mips-boards/malta/Makefile +++ b/arch/mips/mips-boards/malta/Makefile | |||
| @@ -19,5 +19,5 @@ | |||
| 19 | # under Linux. | 19 | # under Linux. |
| 20 | # | 20 | # |
| 21 | 21 | ||
| 22 | obj-y := malta_int.o malta_setup.o | 22 | obj-y := malta_int.o malta_mtd.o malta_setup.o |
| 23 | obj-$(CONFIG_SMP) += malta_smp.o | 23 | obj-$(CONFIG_SMP) += malta_smp.o |
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c index 282f3e52eea3..56ea76679cd4 100644 --- a/arch/mips/mips-boards/malta/malta_setup.c +++ b/arch/mips/mips-boards/malta/malta_setup.c | |||
| @@ -21,13 +21,6 @@ | |||
| 21 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
| 22 | #include <linux/screen_info.h> | 22 | #include <linux/screen_info.h> |
| 23 | 23 | ||
| 24 | #ifdef CONFIG_MTD | ||
| 25 | #include <linux/mtd/partitions.h> | ||
| 26 | #include <linux/mtd/physmap.h> | ||
| 27 | #include <linux/mtd/mtd.h> | ||
| 28 | #include <linux/mtd/map.h> | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #include <asm/cpu.h> | 24 | #include <asm/cpu.h> |
| 32 | #include <asm/bootinfo.h> | 25 | #include <asm/bootinfo.h> |
| 33 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
| @@ -58,30 +51,6 @@ struct resource standard_io_resources[] = { | |||
| 58 | { .name = "dma2", .start = 0xc0, .end = 0xdf, .flags = IORESOURCE_BUSY }, | 51 | { .name = "dma2", .start = 0xc0, .end = 0xdf, .flags = IORESOURCE_BUSY }, |
| 59 | }; | 52 | }; |
| 60 | 53 | ||
| 61 | #ifdef CONFIG_MTD | ||
| 62 | static struct mtd_partition malta_mtd_partitions[] = { | ||
| 63 | { | ||
| 64 | .name = "YAMON", | ||
| 65 | .offset = 0x0, | ||
| 66 | .size = 0x100000, | ||
| 67 | .mask_flags = MTD_WRITEABLE | ||
| 68 | }, | ||
| 69 | { | ||
| 70 | .name = "User FS", | ||
| 71 | .offset = 0x100000, | ||
| 72 | .size = 0x2e0000 | ||
| 73 | }, | ||
| 74 | { | ||
| 75 | .name = "Board Config", | ||
| 76 | .offset = 0x3e0000, | ||
| 77 | .size = 0x020000, | ||
| 78 | .mask_flags = MTD_WRITEABLE | ||
| 79 | } | ||
| 80 | }; | ||
| 81 | |||
| 82 | #define number_partitions (sizeof(malta_mtd_partitions)/sizeof(struct mtd_partition)) | ||
| 83 | #endif | ||
| 84 | |||
| 85 | const char *get_system_type(void) | 54 | const char *get_system_type(void) |
| 86 | { | 55 | { |
| 87 | return "MIPS Malta"; | 56 | return "MIPS Malta"; |
| @@ -211,14 +180,6 @@ void __init plat_mem_setup(void) | |||
| 211 | #endif | 180 | #endif |
| 212 | #endif | 181 | #endif |
| 213 | 182 | ||
| 214 | #ifdef CONFIG_MTD | ||
| 215 | /* | ||
| 216 | * Support for MTD on Malta. Use the generic physmap driver | ||
| 217 | */ | ||
| 218 | physmap_configure(0x1e000000, 0x400000, 4, NULL); | ||
| 219 | physmap_set_partitions(malta_mtd_partitions, number_partitions); | ||
| 220 | #endif | ||
| 221 | |||
| 222 | mips_reboot_setup(); | 183 | mips_reboot_setup(); |
| 223 | 184 | ||
| 224 | board_time_init = mips_time_init; | 185 | board_time_init = mips_time_init; |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 9e29ba9205f0..ea2d15370bb7 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
| @@ -316,7 +316,7 @@ static int __init page_is_ram(unsigned long pagenr) | |||
| 316 | void __init paging_init(void) | 316 | void __init paging_init(void) |
| 317 | { | 317 | { |
| 318 | unsigned long zones_size[MAX_NR_ZONES] = { 0, }; | 318 | unsigned long zones_size[MAX_NR_ZONES] = { 0, }; |
| 319 | unsigned long max_dma, high, low; | 319 | unsigned long max_dma, low; |
| 320 | #ifndef CONFIG_FLATMEM | 320 | #ifndef CONFIG_FLATMEM |
| 321 | unsigned long zholes_size[MAX_NR_ZONES] = { 0, }; | 321 | unsigned long zholes_size[MAX_NR_ZONES] = { 0, }; |
| 322 | unsigned long i, j, pfn; | 322 | unsigned long i, j, pfn; |
| @@ -331,7 +331,6 @@ void __init paging_init(void) | |||
| 331 | 331 | ||
| 332 | max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; | 332 | max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; |
| 333 | low = max_low_pfn; | 333 | low = max_low_pfn; |
| 334 | high = highend_pfn; | ||
| 335 | 334 | ||
| 336 | #ifdef CONFIG_ISA | 335 | #ifdef CONFIG_ISA |
| 337 | if (low < max_dma) | 336 | if (low < max_dma) |
| @@ -344,13 +343,13 @@ void __init paging_init(void) | |||
| 344 | zones_size[ZONE_DMA] = low; | 343 | zones_size[ZONE_DMA] = low; |
| 345 | #endif | 344 | #endif |
| 346 | #ifdef CONFIG_HIGHMEM | 345 | #ifdef CONFIG_HIGHMEM |
| 347 | if (cpu_has_dc_aliases) { | 346 | zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn; |
| 348 | printk(KERN_WARNING "This processor doesn't support highmem."); | 347 | |
| 349 | if (high - low) | 348 | if (cpu_has_dc_aliases && zones_size[ZONE_HIGHMEM]) { |
| 350 | printk(" %ldk highmem ignored", high - low); | 349 | printk(KERN_WARNING "This processor doesn't support highmem." |
| 351 | printk("\n"); | 350 | " %ldk highmem ignored\n", zones_size[ZONE_HIGHMEM]); |
| 352 | } else | 351 | zones_size[ZONE_HIGHMEM] = 0; |
| 353 | zones_size[ZONE_HIGHMEM] = high - low; | 352 | } |
| 354 | #endif | 353 | #endif |
| 355 | 354 | ||
| 356 | #ifdef CONFIG_FLATMEM | 355 | #ifdef CONFIG_FLATMEM |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 56c3c4065eb0..8699dadcd096 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
| @@ -107,6 +107,11 @@ config AUDIT_ARCH | |||
| 107 | bool | 107 | bool |
| 108 | default y | 108 | default y |
| 109 | 109 | ||
| 110 | config GENERIC_BUG | ||
| 111 | bool | ||
| 112 | default y | ||
| 113 | depends on BUG | ||
| 114 | |||
| 110 | config DEFAULT_UIMAGE | 115 | config DEFAULT_UIMAGE |
| 111 | bool | 116 | bool |
| 112 | help | 117 | help |
| @@ -478,6 +483,7 @@ config PPC_MAPLE | |||
| 478 | select PPC_UDBG_16550 | 483 | select PPC_UDBG_16550 |
| 479 | select PPC_970_NAP | 484 | select PPC_970_NAP |
| 480 | select PPC_NATIVE | 485 | select PPC_NATIVE |
| 486 | select PPC_RTAS | ||
| 481 | default n | 487 | default n |
| 482 | help | 488 | help |
| 483 | This option enables support for the Maple 970FX Evaluation Board. | 489 | This option enables support for the Maple 970FX Evaluation Board. |
| @@ -714,7 +720,7 @@ config FORCE_MAX_ZONEORDER | |||
| 714 | 720 | ||
| 715 | config MATH_EMULATION | 721 | config MATH_EMULATION |
| 716 | bool "Math emulation" | 722 | bool "Math emulation" |
| 717 | depends on 4xx || 8xx || E200 || E500 | 723 | depends on 4xx || 8xx || E200 || PPC_83xx || E500 |
| 718 | ---help--- | 724 | ---help--- |
| 719 | Some PowerPC chips designed for embedded applications do not have | 725 | Some PowerPC chips designed for embedded applications do not have |
| 720 | a floating-point unit and therefore do not implement the | 726 | a floating-point unit and therefore do not implement the |
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig index f2d888e014a9..70ed61337f5c 100644 --- a/arch/powerpc/configs/ps3_defconfig +++ b/arch/powerpc/configs/ps3_defconfig | |||
| @@ -157,6 +157,7 @@ CONFIG_SPU_BASE=y | |||
| 157 | CONFIG_PS3_HTAB_SIZE=20 | 157 | CONFIG_PS3_HTAB_SIZE=20 |
| 158 | CONFIG_PS3_DYNAMIC_DMA=y | 158 | CONFIG_PS3_DYNAMIC_DMA=y |
| 159 | CONFIG_PS3_USE_LPAR_ADDR=y | 159 | CONFIG_PS3_USE_LPAR_ADDR=y |
| 160 | CONFIG_PS3_VUART=y | ||
| 160 | 161 | ||
| 161 | # | 162 | # |
| 162 | # Kernel options | 163 | # Kernel options |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 4fe53d08ab81..d2ded19e4064 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
| @@ -77,6 +77,7 @@ endif | |||
| 77 | 77 | ||
| 78 | ifeq ($(CONFIG_PPC_ISERIES),y) | 78 | ifeq ($(CONFIG_PPC_ISERIES),y) |
| 79 | extra-y += lparmap.s | 79 | extra-y += lparmap.s |
| 80 | $(obj)/head_64.o: $(obj)/lparmap.s | ||
| 80 | AFLAGS_head_64.o += -I$(obj) | 81 | AFLAGS_head_64.o += -I$(obj) |
| 81 | endif | 82 | endif |
| 82 | 83 | ||
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 9d1614c3ce67..b742013bb9da 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
| @@ -833,7 +833,7 @@ static struct cpu_spec cpu_specs[] = { | |||
| 833 | .pvr_mask = 0x7fff0000, | 833 | .pvr_mask = 0x7fff0000, |
| 834 | .pvr_value = 0x00840000, | 834 | .pvr_value = 0x00840000, |
| 835 | .cpu_name = "e300c2", | 835 | .cpu_name = "e300c2", |
| 836 | .cpu_features = CPU_FTRS_E300, | 836 | .cpu_features = CPU_FTRS_E300C2, |
| 837 | .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, | 837 | .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, |
| 838 | .icache_bsize = 32, | 838 | .icache_bsize = 32, |
| 839 | .dcache_bsize = 32, | 839 | .dcache_bsize = 32, |
| @@ -1136,8 +1136,7 @@ static struct cpu_spec cpu_specs[] = { | |||
| 1136 | .pvr_mask = 0xff000fff, | 1136 | .pvr_mask = 0xff000fff, |
| 1137 | .pvr_value = 0x53000890, | 1137 | .pvr_value = 0x53000890, |
| 1138 | .cpu_name = "440SPe Rev. A", | 1138 | .cpu_name = "440SPe Rev. A", |
| 1139 | .cpu_features = CPU_FTR_SPLIT_ID_CACHE | | 1139 | .cpu_features = CPU_FTRS_44X, |
| 1140 | CPU_FTR_USE_TB, | ||
| 1141 | .cpu_user_features = COMMON_USER_BOOKE, | 1140 | .cpu_user_features = COMMON_USER_BOOKE, |
| 1142 | .icache_bsize = 32, | 1141 | .icache_bsize = 32, |
| 1143 | .dcache_bsize = 32, | 1142 | .dcache_bsize = 32, |
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index d88e182e40b3..9417cf5b4b7e 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S | |||
| @@ -437,6 +437,13 @@ Alignment: | |||
| 437 | /* Floating-point unavailable */ | 437 | /* Floating-point unavailable */ |
| 438 | . = 0x800 | 438 | . = 0x800 |
| 439 | FPUnavailable: | 439 | FPUnavailable: |
| 440 | BEGIN_FTR_SECTION | ||
| 441 | /* | ||
| 442 | * Certain Freescale cores don't have a FPU and treat fp instructions | ||
| 443 | * as a FP Unavailable exception. Redirect to illegal/emulation handling. | ||
| 444 | */ | ||
| 445 | b ProgramCheck | ||
| 446 | END_FTR_SECTION_IFSET(CPU_FTR_FPU_UNAVAILABLE) | ||
| 440 | EXCEPTION_PROLOG | 447 | EXCEPTION_PROLOG |
| 441 | bne load_up_fpu /* if from user, just load it up */ | 448 | bne load_up_fpu /* if from user, just load it up */ |
| 442 | addi r3,r1,STACK_FRAME_OVERHEAD | 449 | addi r3,r1,STACK_FRAME_OVERHEAD |
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c index e2c3c6a85f33..8339fd609de0 100644 --- a/arch/powerpc/kernel/module_32.c +++ b/arch/powerpc/kernel/module_32.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/string.h> | 23 | #include <linux/string.h> |
| 24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
| 25 | #include <linux/cache.h> | 25 | #include <linux/cache.h> |
| 26 | #include <linux/bug.h> | ||
| 26 | 27 | ||
| 27 | #include "setup.h" | 28 | #include "setup.h" |
| 28 | 29 | ||
| @@ -290,23 +291,11 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
| 290 | struct module *me) | 291 | struct module *me) |
| 291 | { | 292 | { |
| 292 | const Elf_Shdr *sect; | 293 | const Elf_Shdr *sect; |
| 294 | int err; | ||
| 293 | 295 | ||
| 294 | me->arch.bug_table = NULL; | 296 | err = module_bug_finalize(hdr, sechdrs, me); |
| 295 | me->arch.num_bugs = 0; | 297 | if (err) /* never true, currently */ |
| 296 | 298 | return err; | |
| 297 | /* Find the __bug_table section, if present */ | ||
| 298 | sect = find_section(hdr, sechdrs, "__bug_table"); | ||
| 299 | if (sect != NULL) { | ||
| 300 | me->arch.bug_table = (void *) sect->sh_addr; | ||
| 301 | me->arch.num_bugs = sect->sh_size / sizeof(struct bug_entry); | ||
| 302 | } | ||
| 303 | |||
| 304 | /* | ||
| 305 | * Strictly speaking this should have a spinlock to protect against | ||
| 306 | * traversals, but since we only traverse on BUG()s, a spinlock | ||
| 307 | * could potentially lead to deadlock and thus be counter-productive. | ||
| 308 | */ | ||
| 309 | list_add(&me->arch.bug_list, &module_bug_list); | ||
| 310 | 299 | ||
| 311 | /* Apply feature fixups */ | 300 | /* Apply feature fixups */ |
| 312 | sect = find_section(hdr, sechdrs, "__ftr_fixup"); | 301 | sect = find_section(hdr, sechdrs, "__ftr_fixup"); |
| @@ -320,7 +309,7 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
| 320 | 309 | ||
| 321 | void module_arch_cleanup(struct module *mod) | 310 | void module_arch_cleanup(struct module *mod) |
| 322 | { | 311 | { |
| 323 | list_del(&mod->arch.bug_list); | 312 | module_bug_cleanup(mod); |
| 324 | } | 313 | } |
| 325 | 314 | ||
| 326 | struct bug_entry *module_find_bug(unsigned long bugaddr) | 315 | struct bug_entry *module_find_bug(unsigned long bugaddr) |
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 8dd1f0aae5d6..75c7c4f19280 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/moduleloader.h> | 20 | #include <linux/moduleloader.h> |
| 21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
| 22 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
| 23 | #include <linux/bug.h> | ||
| 23 | #include <asm/module.h> | 24 | #include <asm/module.h> |
| 24 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
| 25 | #include <asm/firmware.h> | 26 | #include <asm/firmware.h> |
| @@ -439,23 +440,11 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
| 439 | const Elf_Shdr *sechdrs, struct module *me) | 440 | const Elf_Shdr *sechdrs, struct module *me) |
| 440 | { | 441 | { |
| 441 | const Elf_Shdr *sect; | 442 | const Elf_Shdr *sect; |
| 443 | int err; | ||
| 442 | 444 | ||
| 443 | me->arch.bug_table = NULL; | 445 | err = module_bug_finalize(hdr, sechdrs, me); |
| 444 | me->arch.num_bugs = 0; | 446 | if (err) |
| 445 | 447 | return err; | |
| 446 | /* Find the __bug_table section, if present */ | ||
| 447 | sect = find_section(hdr, sechdrs, "__bug_table"); | ||
| 448 | if (sect != NULL) { | ||
| 449 | me->arch.bug_table = (void *) sect->sh_addr; | ||
| 450 | me->arch.num_bugs = sect->sh_size / sizeof(struct bug_entry); | ||
| 451 | } | ||
| 452 | |||
| 453 | /* | ||
| 454 | * Strictly speaking this should have a spinlock to protect against | ||
| 455 | * traversals, but since we only traverse on BUG()s, a spinlock | ||
| 456 | * could potentially lead to deadlock and thus be counter-productive. | ||
| 457 | */ | ||
| 458 | list_add(&me->arch.bug_list, &module_bug_list); | ||
| 459 | 448 | ||
| 460 | /* Apply feature fixups */ | 449 | /* Apply feature fixups */ |
| 461 | sect = find_section(hdr, sechdrs, "__ftr_fixup"); | 450 | sect = find_section(hdr, sechdrs, "__ftr_fixup"); |
| @@ -475,7 +464,7 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
| 475 | 464 | ||
| 476 | void module_arch_cleanup(struct module *mod) | 465 | void module_arch_cleanup(struct module *mod) |
| 477 | { | 466 | { |
| 478 | list_del(&mod->arch.bug_list); | 467 | module_bug_cleanup(mod); |
| 479 | } | 468 | } |
| 480 | 469 | ||
| 481 | struct bug_entry *module_find_bug(unsigned long bugaddr) | 470 | struct bug_entry *module_find_bug(unsigned long bugaddr) |
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c index 8a06724e029e..e921514e655b 100644 --- a/arch/powerpc/kernel/of_device.c +++ b/arch/powerpc/kernel/of_device.c | |||
| @@ -109,9 +109,7 @@ int of_device_register(struct of_device *ofdev) | |||
| 109 | if (rc) | 109 | if (rc) |
| 110 | return rc; | 110 | return rc; |
| 111 | 111 | ||
| 112 | device_create_file(&ofdev->dev, &dev_attr_devspec); | 112 | return device_create_file(&ofdev->dev, &dev_attr_devspec); |
| 113 | |||
| 114 | return 0; | ||
| 115 | } | 113 | } |
| 116 | 114 | ||
| 117 | void of_device_unregister(struct of_device *ofdev) | 115 | void of_device_unregister(struct of_device *ofdev) |
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c index b3189d0161b8..3002ea3a61a2 100644 --- a/arch/powerpc/kernel/of_platform.c +++ b/arch/powerpc/kernel/of_platform.c | |||
| @@ -169,7 +169,7 @@ static void of_platform_make_bus_id(struct of_device *dev) | |||
| 169 | char *name = dev->dev.bus_id; | 169 | char *name = dev->dev.bus_id; |
| 170 | const u32 *reg; | 170 | const u32 *reg; |
| 171 | u64 addr; | 171 | u64 addr; |
| 172 | long magic; | 172 | int magic; |
| 173 | 173 | ||
| 174 | /* | 174 | /* |
| 175 | * If it's a DCR based device, use 'd' for native DCRs | 175 | * If it's a DCR based device, use 'd' for native DCRs |
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 2f54cd81dea5..8336deafc624 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c | |||
| @@ -736,25 +736,51 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
| 736 | return NULL; | 736 | return NULL; |
| 737 | } | 737 | } |
| 738 | 738 | ||
| 739 | static int | 739 | static struct device_node *scan_OF_for_pci_dev(struct device_node *parent, |
| 740 | scan_OF_pci_childs_iterator(struct device_node* node, void* data) | 740 | unsigned int devfn) |
| 741 | { | 741 | { |
| 742 | const unsigned int *reg; | 742 | struct device_node *np = NULL; |
| 743 | u8* fdata = (u8*)data; | 743 | const u32 *reg; |
| 744 | 744 | unsigned int psize; | |
| 745 | reg = get_property(node, "reg", NULL); | 745 | |
| 746 | if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] | 746 | while ((np = of_get_next_child(parent, np)) != NULL) { |
| 747 | && ((reg[0] >> 16) & 0xff) == fdata[0]) | 747 | reg = get_property(np, "reg", &psize); |
| 748 | return 1; | 748 | if (reg == NULL || psize < 4) |
| 749 | return 0; | 749 | continue; |
| 750 | if (((reg[0] >> 8) & 0xff) == devfn) | ||
| 751 | return np; | ||
| 752 | } | ||
| 753 | return NULL; | ||
| 750 | } | 754 | } |
| 751 | 755 | ||
| 752 | static struct device_node* | 756 | |
| 753 | scan_OF_childs_for_device(struct device_node* node, u8 bus, u8 dev_fn) | 757 | static struct device_node *scan_OF_for_pci_bus(struct pci_bus *bus) |
| 754 | { | 758 | { |
| 755 | u8 filter_data[2] = {bus, dev_fn}; | 759 | struct device_node *parent, *np; |
| 760 | |||
| 761 | /* Are we a root bus ? */ | ||
| 762 | if (bus->self == NULL || bus->parent == NULL) { | ||
| 763 | struct pci_controller *hose = pci_bus_to_hose(bus->number); | ||
| 764 | if (hose == NULL) | ||
| 765 | return NULL; | ||
| 766 | return of_node_get(hose->arch_data); | ||
| 767 | } | ||
| 768 | |||
| 769 | /* not a root bus, we need to get our parent */ | ||
| 770 | parent = scan_OF_for_pci_bus(bus->parent); | ||
| 771 | if (parent == NULL) | ||
| 772 | return NULL; | ||
| 773 | |||
| 774 | /* now iterate for children for a match */ | ||
| 775 | np = scan_OF_for_pci_dev(parent, bus->self->devfn); | ||
| 776 | of_node_put(parent); | ||
| 756 | 777 | ||
| 757 | return scan_OF_pci_childs(node, scan_OF_pci_childs_iterator, filter_data); | 778 | /* sanity check */ |
| 779 | if (strcmp(np->type, "pci") != 0) | ||
| 780 | printk(KERN_WARNING "pci: wrong type \"%s\" for bridge %s\n", | ||
| 781 | np->type, np->full_name); | ||
| 782 | |||
| 783 | return np; | ||
| 758 | } | 784 | } |
| 759 | 785 | ||
| 760 | /* | 786 | /* |
| @@ -763,43 +789,25 @@ scan_OF_childs_for_device(struct device_node* node, u8 bus, u8 dev_fn) | |||
| 763 | struct device_node * | 789 | struct device_node * |
| 764 | pci_busdev_to_OF_node(struct pci_bus *bus, int devfn) | 790 | pci_busdev_to_OF_node(struct pci_bus *bus, int devfn) |
| 765 | { | 791 | { |
| 766 | struct pci_controller *hose; | 792 | struct device_node *parent, *np; |
| 767 | struct device_node *node; | ||
| 768 | int busnr; | ||
| 769 | 793 | ||
| 770 | if (!have_of) | 794 | if (!have_of) |
| 771 | return NULL; | 795 | return NULL; |
| 772 | |||
| 773 | /* Lookup the hose */ | ||
| 774 | busnr = bus->number; | ||
| 775 | hose = pci_bus_to_hose(busnr); | ||
| 776 | if (!hose) | ||
| 777 | return NULL; | ||
| 778 | 796 | ||
| 779 | /* Check it has an OF node associated */ | 797 | DBG("pci_busdev_to_OF_node(%d,0x%x)\n", bus->number, devfn); |
| 780 | node = (struct device_node *) hose->arch_data; | 798 | parent = scan_OF_for_pci_bus(bus); |
| 781 | if (!node) | 799 | if (parent == NULL) |
| 782 | return NULL; | 800 | return NULL; |
| 783 | 801 | DBG(" parent is %s\n", parent ? parent->full_name : "<NULL>"); | |
| 784 | /* Fixup bus number according to what OF think it is. */ | 802 | np = scan_OF_for_pci_dev(parent, devfn); |
| 785 | #ifdef CONFIG_PPC_PMAC | 803 | of_node_put(parent); |
| 786 | /* The G5 need a special case here. Basically, we don't remap all | 804 | DBG(" result is %s\n", np ? np->full_name : "<NULL>"); |
| 787 | * busses on it so we don't create the pci-OF-map. However, we do | 805 | |
| 788 | * remap the AGP bus and so have to deal with it. A future better | 806 | /* XXX most callers don't release the returned node |
| 789 | * fix has to be done by making the remapping per-host and always | 807 | * mostly because ppc64 doesn't increase the refcount, |
| 790 | * filling the pci_to_OF map. --BenH | 808 | * we need to fix that. |
| 791 | */ | 809 | */ |
| 792 | if (machine_is(powermac) && busnr >= 0xf0) | 810 | return np; |
| 793 | busnr -= 0xf0; | ||
| 794 | else | ||
| 795 | #endif | ||
| 796 | if (pci_to_OF_bus_map) | ||
| 797 | busnr = pci_to_OF_bus_map[busnr]; | ||
| 798 | if (busnr == 0xff) | ||
| 799 | return NULL; | ||
| 800 | |||
| 801 | /* Now, lookup childs of the hose */ | ||
| 802 | return scan_OF_childs_for_device(node->child, busnr, devfn); | ||
| 803 | } | 811 | } |
| 804 | EXPORT_SYMBOL(pci_busdev_to_OF_node); | 812 | EXPORT_SYMBOL(pci_busdev_to_OF_node); |
| 805 | 813 | ||
| @@ -1544,7 +1552,7 @@ pci_resource_to_bus(struct pci_dev *pdev, struct resource *res) | |||
| 1544 | 1552 | ||
| 1545 | 1553 | ||
| 1546 | static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | 1554 | static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, |
| 1547 | unsigned long *offset, | 1555 | resource_size_t *offset, |
| 1548 | enum pci_mmap_state mmap_state) | 1556 | enum pci_mmap_state mmap_state) |
| 1549 | { | 1557 | { |
| 1550 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | 1558 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); |
| @@ -1556,7 +1564,9 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
| 1556 | 1564 | ||
| 1557 | /* If memory, add on the PCI bridge address offset */ | 1565 | /* If memory, add on the PCI bridge address offset */ |
| 1558 | if (mmap_state == pci_mmap_mem) { | 1566 | if (mmap_state == pci_mmap_mem) { |
| 1567 | #if 0 /* See comment in pci_resource_to_user() for why this is disabled */ | ||
| 1559 | *offset += hose->pci_mem_offset; | 1568 | *offset += hose->pci_mem_offset; |
| 1569 | #endif | ||
| 1560 | res_bit = IORESOURCE_MEM; | 1570 | res_bit = IORESOURCE_MEM; |
| 1561 | } else { | 1571 | } else { |
| 1562 | io_offset = hose->io_base_virt - (void __iomem *)_IO_BASE; | 1572 | io_offset = hose->io_base_virt - (void __iomem *)_IO_BASE; |
| @@ -1624,9 +1634,6 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp, | |||
| 1624 | else | 1634 | else |
| 1625 | prot |= _PAGE_GUARDED; | 1635 | prot |= _PAGE_GUARDED; |
| 1626 | 1636 | ||
| 1627 | printk("PCI map for %s:%llx, prot: %lx\n", pci_name(dev), | ||
| 1628 | (unsigned long long)rp->start, prot); | ||
| 1629 | |||
| 1630 | return __pgprot(prot); | 1637 | return __pgprot(prot); |
| 1631 | } | 1638 | } |
| 1632 | 1639 | ||
| @@ -1695,7 +1702,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
| 1695 | enum pci_mmap_state mmap_state, | 1702 | enum pci_mmap_state mmap_state, |
| 1696 | int write_combine) | 1703 | int write_combine) |
| 1697 | { | 1704 | { |
| 1698 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | 1705 | resource_size_t offset = vma->vm_pgoff << PAGE_SHIFT; |
| 1699 | struct resource *rp; | 1706 | struct resource *rp; |
| 1700 | int ret; | 1707 | int ret; |
| 1701 | 1708 | ||
| @@ -1808,22 +1815,42 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar, | |||
| 1808 | resource_size_t *start, resource_size_t *end) | 1815 | resource_size_t *start, resource_size_t *end) |
| 1809 | { | 1816 | { |
| 1810 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | 1817 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); |
| 1811 | unsigned long offset = 0; | 1818 | resource_size_t offset = 0; |
| 1812 | 1819 | ||
| 1813 | if (hose == NULL) | 1820 | if (hose == NULL) |
| 1814 | return; | 1821 | return; |
| 1815 | 1822 | ||
| 1816 | if (rsrc->flags & IORESOURCE_IO) | 1823 | if (rsrc->flags & IORESOURCE_IO) |
| 1817 | offset = (void __iomem *)_IO_BASE - hose->io_base_virt | 1824 | offset = (unsigned long)hose->io_base_virt - _IO_BASE; |
| 1818 | + hose->io_base_phys; | 1825 | |
| 1826 | /* We pass a fully fixed up address to userland for MMIO instead of | ||
| 1827 | * a BAR value because X is lame and expects to be able to use that | ||
| 1828 | * to pass to /dev/mem ! | ||
| 1829 | * | ||
| 1830 | * That means that we'll have potentially 64 bits values where some | ||
| 1831 | * userland apps only expect 32 (like X itself since it thinks only | ||
| 1832 | * Sparc has 64 bits MMIO) but if we don't do that, we break it on | ||
| 1833 | * 32 bits CHRPs :-( | ||
| 1834 | * | ||
| 1835 | * Hopefully, the sysfs insterface is immune to that gunk. Once X | ||
| 1836 | * has been fixed (and the fix spread enough), we can re-enable the | ||
| 1837 | * 2 lines below and pass down a BAR value to userland. In that case | ||
| 1838 | * we'll also have to re-enable the matching code in | ||
| 1839 | * __pci_mmap_make_offset(). | ||
| 1840 | * | ||
| 1841 | * BenH. | ||
| 1842 | */ | ||
| 1843 | #if 0 | ||
| 1844 | else if (rsrc->flags & IORESOURCE_MEM) | ||
| 1845 | offset = hose->pci_mem_offset; | ||
| 1846 | #endif | ||
| 1819 | 1847 | ||
| 1820 | *start = rsrc->start + offset; | 1848 | *start = rsrc->start - offset; |
| 1821 | *end = rsrc->end + offset; | 1849 | *end = rsrc->end - offset; |
| 1822 | } | 1850 | } |
| 1823 | 1851 | ||
| 1824 | void __init | 1852 | void __init pci_init_resource(struct resource *res, resource_size_t start, |
| 1825 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, | 1853 | resource_size_t end, int flags, char *name) |
| 1826 | int flags, char *name) | ||
| 1827 | { | 1854 | { |
| 1828 | res->start = start; | 1855 | res->start = start; |
| 1829 | res->end = end; | 1856 | res->end = end; |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 6fa9a0a5c8db..a6b7692c7269 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
| @@ -682,7 +682,7 @@ int pci_proc_domain(struct pci_bus *bus) | |||
| 682 | * Returns negative error code on failure, zero on success. | 682 | * Returns negative error code on failure, zero on success. |
| 683 | */ | 683 | */ |
| 684 | static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | 684 | static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, |
| 685 | unsigned long *offset, | 685 | resource_size_t *offset, |
| 686 | enum pci_mmap_state mmap_state) | 686 | enum pci_mmap_state mmap_state) |
| 687 | { | 687 | { |
| 688 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | 688 | struct pci_controller *hose = pci_bus_to_host(dev->bus); |
| @@ -694,7 +694,9 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
| 694 | 694 | ||
| 695 | /* If memory, add on the PCI bridge address offset */ | 695 | /* If memory, add on the PCI bridge address offset */ |
| 696 | if (mmap_state == pci_mmap_mem) { | 696 | if (mmap_state == pci_mmap_mem) { |
| 697 | #if 0 /* See comment in pci_resource_to_user() for why this is disabled */ | ||
| 697 | *offset += hose->pci_mem_offset; | 698 | *offset += hose->pci_mem_offset; |
| 699 | #endif | ||
| 698 | res_bit = IORESOURCE_MEM; | 700 | res_bit = IORESOURCE_MEM; |
| 699 | } else { | 701 | } else { |
| 700 | io_offset = (unsigned long)hose->io_base_virt - pci_io_base; | 702 | io_offset = (unsigned long)hose->io_base_virt - pci_io_base; |
| @@ -762,9 +764,6 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp, | |||
| 762 | else | 764 | else |
| 763 | prot |= _PAGE_GUARDED; | 765 | prot |= _PAGE_GUARDED; |
| 764 | 766 | ||
| 765 | printk(KERN_DEBUG "PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start, | ||
| 766 | prot); | ||
| 767 | |||
| 768 | return __pgprot(prot); | 767 | return __pgprot(prot); |
| 769 | } | 768 | } |
| 770 | 769 | ||
| @@ -832,7 +831,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file, | |||
| 832 | int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | 831 | int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
| 833 | enum pci_mmap_state mmap_state, int write_combine) | 832 | enum pci_mmap_state mmap_state, int write_combine) |
| 834 | { | 833 | { |
| 835 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | 834 | resource_size_t offset = vma->vm_pgoff << PAGE_SHIFT; |
| 836 | struct resource *rp; | 835 | struct resource *rp; |
| 837 | int ret; | 836 | int ret; |
| 838 | 837 | ||
| @@ -1333,20 +1332,41 @@ EXPORT_SYMBOL(pci_read_irq_line); | |||
| 1333 | 1332 | ||
| 1334 | void pci_resource_to_user(const struct pci_dev *dev, int bar, | 1333 | void pci_resource_to_user(const struct pci_dev *dev, int bar, |
| 1335 | const struct resource *rsrc, | 1334 | const struct resource *rsrc, |
| 1336 | u64 *start, u64 *end) | 1335 | resource_size_t *start, resource_size_t *end) |
| 1337 | { | 1336 | { |
| 1338 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | 1337 | struct pci_controller *hose = pci_bus_to_host(dev->bus); |
| 1339 | unsigned long offset = 0; | 1338 | resource_size_t offset = 0; |
| 1340 | 1339 | ||
| 1341 | if (hose == NULL) | 1340 | if (hose == NULL) |
| 1342 | return; | 1341 | return; |
| 1343 | 1342 | ||
| 1344 | if (rsrc->flags & IORESOURCE_IO) | 1343 | if (rsrc->flags & IORESOURCE_IO) |
| 1345 | offset = pci_io_base - (unsigned long)hose->io_base_virt + | 1344 | offset = (unsigned long)hose->io_base_virt - pci_io_base; |
| 1346 | hose->io_base_phys; | 1345 | |
| 1346 | /* We pass a fully fixed up address to userland for MMIO instead of | ||
| 1347 | * a BAR value because X is lame and expects to be able to use that | ||
| 1348 | * to pass to /dev/mem ! | ||
| 1349 | * | ||
| 1350 | * That means that we'll have potentially 64 bits values where some | ||
| 1351 | * userland apps only expect 32 (like X itself since it thinks only | ||
| 1352 | * Sparc has 64 bits MMIO) but if we don't do that, we break it on | ||
| 1353 | * 32 bits CHRPs :-( | ||
| 1354 | * | ||
| 1355 | * Hopefully, the sysfs insterface is immune to that gunk. Once X | ||
| 1356 | * has been fixed (and the fix spread enough), we can re-enable the | ||
| 1357 | * 2 lines below and pass down a BAR value to userland. In that case | ||
| 1358 | * we'll also have to re-enable the matching code in | ||
| 1359 | * __pci_mmap_make_offset(). | ||
| 1360 | * | ||
| 1361 | * BenH. | ||
| 1362 | */ | ||
| 1363 | #if 0 | ||
| 1364 | else if (rsrc->flags & IORESOURCE_MEM) | ||
| 1365 | offset = hose->pci_mem_offset; | ||
| 1366 | #endif | ||
| 1347 | 1367 | ||
| 1348 | *start = rsrc->start + offset; | 1368 | *start = rsrc->start - offset; |
| 1349 | *end = rsrc->end + offset; | 1369 | *end = rsrc->end - offset; |
| 1350 | } | 1370 | } |
| 1351 | 1371 | ||
| 1352 | struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node) | 1372 | struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node) |
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 9179f0739ea2..95776b6af4e2 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
| @@ -208,7 +208,7 @@ EXPORT_SYMBOL(mmu_hash_lock); /* For MOL */ | |||
| 208 | extern long *intercept_table; | 208 | extern long *intercept_table; |
| 209 | EXPORT_SYMBOL(intercept_table); | 209 | EXPORT_SYMBOL(intercept_table); |
| 210 | #endif /* CONFIG_PPC_STD_MMU_32 */ | 210 | #endif /* CONFIG_PPC_STD_MMU_32 */ |
| 211 | #if defined(CONFIG_40x) || defined(CONFIG_BOOKE) | 211 | #ifdef CONFIG_PPC_DCR_NATIVE |
| 212 | EXPORT_SYMBOL(__mtdcr); | 212 | EXPORT_SYMBOL(__mtdcr); |
| 213 | EXPORT_SYMBOL(__mfdcr); | 213 | EXPORT_SYMBOL(__mfdcr); |
| 214 | #endif | 214 | #endif |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index c18dbe77fdc2..1fc732a552db 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
| @@ -804,6 +804,56 @@ static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) | |||
| 804 | return of_read_ulong(p, s); | 804 | return of_read_ulong(p, s); |
| 805 | } | 805 | } |
| 806 | 806 | ||
| 807 | #ifdef CONFIG_PPC_PSERIES | ||
| 808 | /* | ||
| 809 | * Interpret the ibm,dynamic-memory property in the | ||
| 810 | * /ibm,dynamic-reconfiguration-memory node. | ||
| 811 | * This contains a list of memory blocks along with NUMA affinity | ||
| 812 | * information. | ||
| 813 | */ | ||
| 814 | static int __init early_init_dt_scan_drconf_memory(unsigned long node) | ||
| 815 | { | ||
| 816 | cell_t *dm, *ls; | ||
| 817 | unsigned long l, n; | ||
| 818 | unsigned long base, size, lmb_size, flags; | ||
| 819 | |||
| 820 | ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l); | ||
| 821 | if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t)) | ||
| 822 | return 0; | ||
| 823 | lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls); | ||
| 824 | |||
| 825 | dm = (cell_t *)of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l); | ||
| 826 | if (dm == NULL || l < sizeof(cell_t)) | ||
| 827 | return 0; | ||
| 828 | |||
| 829 | n = *dm++; /* number of entries */ | ||
| 830 | if (l < (n * (dt_root_addr_cells + 4) + 1) * sizeof(cell_t)) | ||
| 831 | return 0; | ||
| 832 | |||
| 833 | for (; n != 0; --n) { | ||
| 834 | base = dt_mem_next_cell(dt_root_addr_cells, &dm); | ||
| 835 | flags = dm[3]; | ||
| 836 | /* skip DRC index, pad, assoc. list index, flags */ | ||
| 837 | dm += 4; | ||
| 838 | /* skip this block if the reserved bit is set in flags (0x80) | ||
| 839 | or if the block is not assigned to this partition (0x8) */ | ||
| 840 | if ((flags & 0x80) || !(flags & 0x8)) | ||
| 841 | continue; | ||
| 842 | size = lmb_size; | ||
| 843 | if (iommu_is_off) { | ||
| 844 | if (base >= 0x80000000ul) | ||
| 845 | continue; | ||
| 846 | if ((base + size) > 0x80000000ul) | ||
| 847 | size = 0x80000000ul - base; | ||
| 848 | } | ||
| 849 | lmb_add(base, size); | ||
| 850 | } | ||
| 851 | lmb_dump_all(); | ||
| 852 | return 0; | ||
| 853 | } | ||
| 854 | #else | ||
| 855 | #define early_init_dt_scan_drconf_memory(node) 0 | ||
| 856 | #endif /* CONFIG_PPC_PSERIES */ | ||
| 807 | 857 | ||
| 808 | static int __init early_init_dt_scan_memory(unsigned long node, | 858 | static int __init early_init_dt_scan_memory(unsigned long node, |
| 809 | const char *uname, int depth, void *data) | 859 | const char *uname, int depth, void *data) |
| @@ -812,6 +862,11 @@ static int __init early_init_dt_scan_memory(unsigned long node, | |||
| 812 | cell_t *reg, *endp; | 862 | cell_t *reg, *endp; |
| 813 | unsigned long l; | 863 | unsigned long l; |
| 814 | 864 | ||
| 865 | /* Look for the ibm,dynamic-reconfiguration-memory node */ | ||
| 866 | if (depth == 1 && | ||
| 867 | strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0) | ||
| 868 | return early_init_dt_scan_drconf_memory(node); | ||
| 869 | |||
| 815 | /* We are scanning "memory" nodes only */ | 870 | /* We are scanning "memory" nodes only */ |
| 816 | if (type == NULL) { | 871 | if (type == NULL) { |
| 817 | /* | 872 | /* |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 46cf32670ddb..520ef42f642e 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
| @@ -679,7 +679,7 @@ static unsigned char ibm_architecture_vec[] = { | |||
| 679 | /* option vector 5: PAPR/OF options */ | 679 | /* option vector 5: PAPR/OF options */ |
| 680 | 3 - 2, /* length */ | 680 | 3 - 2, /* length */ |
| 681 | 0, /* don't ignore, don't halt */ | 681 | 0, /* don't ignore, don't halt */ |
| 682 | OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES, | 682 | OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY, |
| 683 | }; | 683 | }; |
| 684 | 684 | ||
| 685 | /* Old method - ELF header with PT_NOTE sections */ | 685 | /* Old method - ELF header with PT_NOTE sections */ |
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 387ed0d9ad61..76b5d7ebdcc6 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
| @@ -303,6 +303,12 @@ int rtas_token(const char *service) | |||
| 303 | } | 303 | } |
| 304 | EXPORT_SYMBOL(rtas_token); | 304 | EXPORT_SYMBOL(rtas_token); |
| 305 | 305 | ||
| 306 | int rtas_service_present(const char *service) | ||
| 307 | { | ||
| 308 | return rtas_token(service) != RTAS_UNKNOWN_SERVICE; | ||
| 309 | } | ||
| 310 | EXPORT_SYMBOL(rtas_service_present); | ||
| 311 | |||
| 306 | #ifdef CONFIG_RTAS_ERROR_LOGGING | 312 | #ifdef CONFIG_RTAS_ERROR_LOGGING |
| 307 | /* | 313 | /* |
| 308 | * Return the firmware-specified size of the error log buffer | 314 | * Return the firmware-specified size of the error log buffer |
| @@ -810,32 +816,6 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs) | |||
| 810 | return 0; | 816 | return 0; |
| 811 | } | 817 | } |
| 812 | 818 | ||
| 813 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 814 | /* This version can't take the spinlock, because it never returns */ | ||
| 815 | static struct rtas_args rtas_stop_self_args = { | ||
| 816 | /* The token is initialized for real in setup_system() */ | ||
| 817 | .token = RTAS_UNKNOWN_SERVICE, | ||
| 818 | .nargs = 0, | ||
| 819 | .nret = 1, | ||
| 820 | .rets = &rtas_stop_self_args.args[0], | ||
| 821 | }; | ||
| 822 | |||
| 823 | void rtas_stop_self(void) | ||
| 824 | { | ||
| 825 | struct rtas_args *rtas_args = &rtas_stop_self_args; | ||
| 826 | |||
| 827 | local_irq_disable(); | ||
| 828 | |||
| 829 | BUG_ON(rtas_args->token == RTAS_UNKNOWN_SERVICE); | ||
| 830 | |||
| 831 | printk("cpu %u (hwid %u) Ready to die...\n", | ||
| 832 | smp_processor_id(), hard_smp_processor_id()); | ||
| 833 | enter_rtas(__pa(rtas_args)); | ||
| 834 | |||
| 835 | panic("Alas, I survived.\n"); | ||
| 836 | } | ||
| 837 | #endif | ||
| 838 | |||
| 839 | /* | 819 | /* |
| 840 | * Call early during boot, before mem init or bootmem, to retrieve the RTAS | 820 | * Call early during boot, before mem init or bootmem, to retrieve the RTAS |
| 841 | * informations from the device-tree and allocate the RMO buffer for userland | 821 | * informations from the device-tree and allocate the RMO buffer for userland |
| @@ -880,9 +860,6 @@ void __init rtas_initialize(void) | |||
| 880 | #endif | 860 | #endif |
| 881 | rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region); | 861 | rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region); |
| 882 | 862 | ||
| 883 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 884 | rtas_stop_self_args.token = rtas_token("stop-self"); | ||
| 885 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
| 886 | #ifdef CONFIG_RTAS_ERROR_LOGGING | 863 | #ifdef CONFIG_RTAS_ERROR_LOGGING |
| 887 | rtas_last_error_token = rtas_token("rtas-last-error"); | 864 | rtas_last_error_token = rtas_token("rtas-last-error"); |
| 888 | #endif | 865 | #endif |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 63ed265b7f09..400ab2b946e7 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
| @@ -181,6 +181,8 @@ SYSFS_PMCSETUP(pmc6, SPRN_PMC6); | |||
| 181 | SYSFS_PMCSETUP(pmc7, SPRN_PMC7); | 181 | SYSFS_PMCSETUP(pmc7, SPRN_PMC7); |
| 182 | SYSFS_PMCSETUP(pmc8, SPRN_PMC8); | 182 | SYSFS_PMCSETUP(pmc8, SPRN_PMC8); |
| 183 | SYSFS_PMCSETUP(purr, SPRN_PURR); | 183 | SYSFS_PMCSETUP(purr, SPRN_PURR); |
| 184 | SYSFS_PMCSETUP(spurr, SPRN_SPURR); | ||
| 185 | SYSFS_PMCSETUP(dscr, SPRN_DSCR); | ||
| 184 | 186 | ||
| 185 | static SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0); | 187 | static SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0); |
| 186 | static SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1); | 188 | static SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1); |
| @@ -194,6 +196,8 @@ static SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6); | |||
| 194 | static SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7); | 196 | static SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7); |
| 195 | static SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8); | 197 | static SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8); |
| 196 | static SYSDEV_ATTR(purr, 0600, show_purr, NULL); | 198 | static SYSDEV_ATTR(purr, 0600, show_purr, NULL); |
| 199 | static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); | ||
| 200 | static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); | ||
| 197 | 201 | ||
| 198 | static void register_cpu_online(unsigned int cpu) | 202 | static void register_cpu_online(unsigned int cpu) |
| 199 | { | 203 | { |
| @@ -231,6 +235,12 @@ static void register_cpu_online(unsigned int cpu) | |||
| 231 | 235 | ||
| 232 | if (cpu_has_feature(CPU_FTR_PURR)) | 236 | if (cpu_has_feature(CPU_FTR_PURR)) |
| 233 | sysdev_create_file(s, &attr_purr); | 237 | sysdev_create_file(s, &attr_purr); |
| 238 | |||
| 239 | if (cpu_has_feature(CPU_FTR_SPURR)) | ||
| 240 | sysdev_create_file(s, &attr_spurr); | ||
| 241 | |||
| 242 | if (cpu_has_feature(CPU_FTR_DSCR)) | ||
| 243 | sysdev_create_file(s, &attr_dscr); | ||
| 234 | } | 244 | } |
| 235 | 245 | ||
| 236 | #ifdef CONFIG_HOTPLUG_CPU | 246 | #ifdef CONFIG_HOTPLUG_CPU |
| @@ -272,6 +282,12 @@ static void unregister_cpu_online(unsigned int cpu) | |||
| 272 | 282 | ||
| 273 | if (cpu_has_feature(CPU_FTR_PURR)) | 283 | if (cpu_has_feature(CPU_FTR_PURR)) |
| 274 | sysdev_remove_file(s, &attr_purr); | 284 | sysdev_remove_file(s, &attr_purr); |
| 285 | |||
| 286 | if (cpu_has_feature(CPU_FTR_SPURR)) | ||
| 287 | sysdev_remove_file(s, &attr_spurr); | ||
| 288 | |||
| 289 | if (cpu_has_feature(CPU_FTR_DSCR)) | ||
| 290 | sysdev_remove_file(s, &attr_dscr); | ||
| 275 | } | 291 | } |
| 276 | #endif /* CONFIG_HOTPLUG_CPU */ | 292 | #endif /* CONFIG_HOTPLUG_CPU */ |
| 277 | 293 | ||
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 0d4e203fa7a0..535f50665647 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/kprobes.h> | 32 | #include <linux/kprobes.h> |
| 33 | #include <linux/kexec.h> | 33 | #include <linux/kexec.h> |
| 34 | #include <linux/backlight.h> | 34 | #include <linux/backlight.h> |
| 35 | #include <linux/bug.h> | ||
| 35 | 36 | ||
| 36 | #include <asm/kdebug.h> | 37 | #include <asm/kdebug.h> |
| 37 | #include <asm/pgtable.h> | 38 | #include <asm/pgtable.h> |
| @@ -727,54 +728,9 @@ static int emulate_instruction(struct pt_regs *regs) | |||
| 727 | return -EINVAL; | 728 | return -EINVAL; |
| 728 | } | 729 | } |
| 729 | 730 | ||
| 730 | /* | 731 | int is_valid_bugaddr(unsigned long addr) |
| 731 | * Look through the list of trap instructions that are used for BUG(), | ||
| 732 | * BUG_ON() and WARN_ON() and see if we hit one. At this point we know | ||
| 733 | * that the exception was caused by a trap instruction of some kind. | ||
| 734 | * Returns 1 if we should continue (i.e. it was a WARN_ON) or 0 | ||
| 735 | * otherwise. | ||
| 736 | */ | ||
| 737 | extern struct bug_entry __start___bug_table[], __stop___bug_table[]; | ||
| 738 | |||
| 739 | #ifndef CONFIG_MODULES | ||
| 740 | #define module_find_bug(x) NULL | ||
| 741 | #endif | ||
| 742 | |||
| 743 | struct bug_entry *find_bug(unsigned long bugaddr) | ||
| 744 | { | 732 | { |
| 745 | struct bug_entry *bug; | 733 | return is_kernel_addr(addr); |
| 746 | |||
| 747 | for (bug = __start___bug_table; bug < __stop___bug_table; ++bug) | ||
| 748 | if (bugaddr == bug->bug_addr) | ||
| 749 | return bug; | ||
| 750 | return module_find_bug(bugaddr); | ||
| 751 | } | ||
| 752 | |||
| 753 | static int check_bug_trap(struct pt_regs *regs) | ||
| 754 | { | ||
| 755 | struct bug_entry *bug; | ||
| 756 | unsigned long addr; | ||
| 757 | |||
| 758 | if (regs->msr & MSR_PR) | ||
| 759 | return 0; /* not in kernel */ | ||
| 760 | addr = regs->nip; /* address of trap instruction */ | ||
| 761 | if (addr < PAGE_OFFSET) | ||
| 762 | return 0; | ||
| 763 | bug = find_bug(regs->nip); | ||
| 764 | if (bug == NULL) | ||
| 765 | return 0; | ||
| 766 | if (bug->line & BUG_WARNING_TRAP) { | ||
| 767 | /* this is a WARN_ON rather than BUG/BUG_ON */ | ||
| 768 | printk(KERN_ERR "Badness in %s at %s:%ld\n", | ||
| 769 | bug->function, bug->file, | ||
| 770 | bug->line & ~BUG_WARNING_TRAP); | ||
| 771 | dump_stack(); | ||
| 772 | return 1; | ||
| 773 | } | ||
| 774 | printk(KERN_CRIT "kernel BUG in %s at %s:%ld!\n", | ||
| 775 | bug->function, bug->file, bug->line); | ||
| 776 | |||
| 777 | return 0; | ||
| 778 | } | 734 | } |
| 779 | 735 | ||
| 780 | void __kprobes program_check_exception(struct pt_regs *regs) | 736 | void __kprobes program_check_exception(struct pt_regs *regs) |
| @@ -782,6 +738,8 @@ void __kprobes program_check_exception(struct pt_regs *regs) | |||
| 782 | unsigned int reason = get_reason(regs); | 738 | unsigned int reason = get_reason(regs); |
| 783 | extern int do_mathemu(struct pt_regs *regs); | 739 | extern int do_mathemu(struct pt_regs *regs); |
| 784 | 740 | ||
| 741 | /* We can now get here via a FP Unavailable exception if the core | ||
| 742 | * has no FPU, in that case no reason flags will be set */ | ||
| 785 | #ifdef CONFIG_MATH_EMULATION | 743 | #ifdef CONFIG_MATH_EMULATION |
| 786 | /* (reason & REASON_ILLEGAL) would be the obvious thing here, | 744 | /* (reason & REASON_ILLEGAL) would be the obvious thing here, |
| 787 | * but there seems to be a hardware bug on the 405GP (RevD) | 745 | * but there seems to be a hardware bug on the 405GP (RevD) |
| @@ -808,7 +766,9 @@ void __kprobes program_check_exception(struct pt_regs *regs) | |||
| 808 | return; | 766 | return; |
| 809 | if (debugger_bpt(regs)) | 767 | if (debugger_bpt(regs)) |
| 810 | return; | 768 | return; |
| 811 | if (check_bug_trap(regs)) { | 769 | |
| 770 | if (!(regs->msr & MSR_PR) && /* not user-mode */ | ||
| 771 | report_bug(regs->nip) == BUG_TRAP_TYPE_WARN) { | ||
| 812 | regs->nip += 4; | 772 | regs->nip += 4; |
| 813 | return; | 773 | return; |
| 814 | } | 774 | } |
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 04b98671a060..04b8e71bf5b0 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S | |||
| @@ -62,11 +62,7 @@ SECTIONS | |||
| 62 | __stop___ex_table = .; | 62 | __stop___ex_table = .; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | __bug_table : { | 65 | BUG_TABLE |
| 66 | __start___bug_table = .; | ||
| 67 | *(__bug_table) | ||
| 68 | __stop___bug_table = .; | ||
| 69 | } | ||
| 70 | 66 | ||
| 71 | /* | 67 | /* |
| 72 | * Init sections discarded at runtime | 68 | * Init sections discarded at runtime |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 9da01dc8cfd9..262790910ff2 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
| @@ -295,6 +295,63 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start, | |||
| 295 | return lmb_end_of_DRAM() - start; | 295 | return lmb_end_of_DRAM() - start; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | /* | ||
| 299 | * Extract NUMA information from the ibm,dynamic-reconfiguration-memory | ||
| 300 | * node. This assumes n_mem_{addr,size}_cells have been set. | ||
| 301 | */ | ||
| 302 | static void __init parse_drconf_memory(struct device_node *memory) | ||
| 303 | { | ||
| 304 | const unsigned int *lm, *dm, *aa; | ||
| 305 | unsigned int ls, ld, la; | ||
| 306 | unsigned int n, aam, aalen; | ||
| 307 | unsigned long lmb_size, size; | ||
| 308 | int nid, default_nid = 0; | ||
| 309 | unsigned int start, ai, flags; | ||
| 310 | |||
| 311 | lm = get_property(memory, "ibm,lmb-size", &ls); | ||
| 312 | dm = get_property(memory, "ibm,dynamic-memory", &ld); | ||
| 313 | aa = get_property(memory, "ibm,associativity-lookup-arrays", &la); | ||
| 314 | if (!lm || !dm || !aa || | ||
| 315 | ls < sizeof(unsigned int) || ld < sizeof(unsigned int) || | ||
| 316 | la < 2 * sizeof(unsigned int)) | ||
| 317 | return; | ||
| 318 | |||
| 319 | lmb_size = read_n_cells(n_mem_size_cells, &lm); | ||
| 320 | n = *dm++; /* number of LMBs */ | ||
| 321 | aam = *aa++; /* number of associativity lists */ | ||
| 322 | aalen = *aa++; /* length of each associativity list */ | ||
| 323 | if (ld < (n * (n_mem_addr_cells + 4) + 1) * sizeof(unsigned int) || | ||
| 324 | la < (aam * aalen + 2) * sizeof(unsigned int)) | ||
| 325 | return; | ||
| 326 | |||
| 327 | for (; n != 0; --n) { | ||
| 328 | start = read_n_cells(n_mem_addr_cells, &dm); | ||
| 329 | ai = dm[2]; | ||
| 330 | flags = dm[3]; | ||
| 331 | dm += 4; | ||
| 332 | /* 0x80 == reserved, 0x8 = assigned to us */ | ||
| 333 | if ((flags & 0x80) || !(flags & 0x8)) | ||
| 334 | continue; | ||
| 335 | nid = default_nid; | ||
| 336 | /* flags & 0x40 means associativity index is invalid */ | ||
| 337 | if (min_common_depth > 0 && min_common_depth <= aalen && | ||
| 338 | (flags & 0x40) == 0 && ai < aam) { | ||
| 339 | /* this is like of_node_to_nid_single */ | ||
| 340 | nid = aa[ai * aalen + min_common_depth - 1]; | ||
| 341 | if (nid == 0xffff || nid >= MAX_NUMNODES) | ||
| 342 | nid = default_nid; | ||
| 343 | } | ||
| 344 | node_set_online(nid); | ||
| 345 | |||
| 346 | size = numa_enforce_memory_limit(start, lmb_size); | ||
| 347 | if (!size) | ||
| 348 | continue; | ||
| 349 | |||
| 350 | add_active_range(nid, start >> PAGE_SHIFT, | ||
| 351 | (start >> PAGE_SHIFT) + (size >> PAGE_SHIFT)); | ||
| 352 | } | ||
| 353 | } | ||
| 354 | |||
| 298 | static int __init parse_numa_properties(void) | 355 | static int __init parse_numa_properties(void) |
| 299 | { | 356 | { |
| 300 | struct device_node *cpu = NULL; | 357 | struct device_node *cpu = NULL; |
| @@ -385,6 +442,14 @@ new_range: | |||
| 385 | goto new_range; | 442 | goto new_range; |
| 386 | } | 443 | } |
| 387 | 444 | ||
| 445 | /* | ||
| 446 | * Now do the same thing for each LMB listed in the ibm,dynamic-memory | ||
| 447 | * property in the ibm,dynamic-reconfiguration-memory node. | ||
| 448 | */ | ||
| 449 | memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); | ||
| 450 | if (memory) | ||
| 451 | parse_drconf_memory(memory); | ||
| 452 | |||
| 388 | return 0; | 453 | return 0; |
| 389 | } | 454 | } |
| 390 | 455 | ||
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c index a375c15b4315..eaff71e74fb0 100644 --- a/arch/powerpc/platforms/52xx/lite5200.c +++ b/arch/powerpc/platforms/52xx/lite5200.c | |||
| @@ -40,8 +40,6 @@ | |||
| 40 | #include <asm/prom.h> | 40 | #include <asm/prom.h> |
| 41 | #include <asm/udbg.h> | 41 | #include <asm/udbg.h> |
| 42 | #include <sysdev/fsl_soc.h> | 42 | #include <sysdev/fsl_soc.h> |
| 43 | #include <asm/qe.h> | ||
| 44 | #include <asm/qe_ic.h> | ||
| 45 | #include <asm/of_platform.h> | 43 | #include <asm/of_platform.h> |
| 46 | 44 | ||
| 47 | #include <asm/mpc52xx.h> | 45 | #include <asm/mpc52xx.h> |
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c index 616a0a3fd0e2..70e0d968d30f 100644 --- a/arch/powerpc/platforms/cell/cbe_thermal.c +++ b/arch/powerpc/platforms/cell/cbe_thermal.c | |||
| @@ -115,6 +115,7 @@ static struct sysdev_attribute attr_spu_temperature = { | |||
| 115 | 115 | ||
| 116 | static struct attribute *spu_attributes[] = { | 116 | static struct attribute *spu_attributes[] = { |
| 117 | &attr_spu_temperature.attr, | 117 | &attr_spu_temperature.attr, |
| 118 | NULL, | ||
| 118 | }; | 119 | }; |
| 119 | 120 | ||
| 120 | static struct attribute_group spu_attribute_group = { | 121 | static struct attribute_group spu_attribute_group = { |
| @@ -135,6 +136,7 @@ static struct sysdev_attribute attr_ppe_temperature1 = { | |||
| 135 | static struct attribute *ppe_attributes[] = { | 136 | static struct attribute *ppe_attributes[] = { |
| 136 | &attr_ppe_temperature0.attr, | 137 | &attr_ppe_temperature0.attr, |
| 137 | &attr_ppe_temperature1.attr, | 138 | &attr_ppe_temperature1.attr, |
| 139 | NULL, | ||
| 138 | }; | 140 | }; |
| 139 | 141 | ||
| 140 | static struct attribute_group ppe_attribute_group = { | 142 | static struct attribute_group ppe_attribute_group = { |
diff --git a/arch/powerpc/platforms/cell/pmu.c b/arch/powerpc/platforms/cell/pmu.c index 99c612025e8f..d04ae1671e6c 100644 --- a/arch/powerpc/platforms/cell/pmu.c +++ b/arch/powerpc/platforms/cell/pmu.c | |||
| @@ -382,11 +382,14 @@ static irqreturn_t cbe_pm_irq(int irq, void *dev_id) | |||
| 382 | return IRQ_HANDLED; | 382 | return IRQ_HANDLED; |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | int __init cbe_init_pm_irq(void) | 385 | static int __init cbe_init_pm_irq(void) |
| 386 | { | 386 | { |
| 387 | unsigned int irq; | 387 | unsigned int irq; |
| 388 | int rc, node; | 388 | int rc, node; |
| 389 | 389 | ||
| 390 | if (!machine_is(cell)) | ||
| 391 | return 0; | ||
| 392 | |||
| 390 | for_each_node(node) { | 393 | for_each_node(node) { |
| 391 | irq = irq_create_mapping(NULL, IIC_IRQ_IOEX_PMI | | 394 | irq = irq_create_mapping(NULL, IIC_IRQ_IOEX_PMI | |
| 392 | (node << IIC_IRQ_NODE_SHIFT)); | 395 | (node << IIC_IRQ_NODE_SHIFT)); |
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index 26945c491f6b..725e19561159 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c | |||
| @@ -147,7 +147,7 @@ static int spufs_arch_notes_size(void) | |||
| 147 | struct fdtable *fdt = files_fdtable(current->files); | 147 | struct fdtable *fdt = files_fdtable(current->files); |
| 148 | int size = 0, fd; | 148 | int size = 0, fd; |
| 149 | 149 | ||
| 150 | for (fd = 0; fd < fdt->max_fdset && fd < fdt->max_fds; fd++) { | 150 | for (fd = 0; fd < fdt->max_fds; fd++) { |
| 151 | if (FD_ISSET(fd, fdt->open_fds)) { | 151 | if (FD_ISSET(fd, fdt->open_fds)) { |
| 152 | struct file *file = fcheck(fd); | 152 | struct file *file = fcheck(fd); |
| 153 | 153 | ||
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c index 3a32deda765d..3f6a69f67195 100644 --- a/arch/powerpc/platforms/maple/pci.c +++ b/arch/powerpc/platforms/maple/pci.c | |||
| @@ -562,7 +562,7 @@ void __init maple_pci_init(void) | |||
| 562 | for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) { | 562 | for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) { |
| 563 | if (np->name == NULL) | 563 | if (np->name == NULL) |
| 564 | continue; | 564 | continue; |
| 565 | if (strcmp(np->name, "pci") == 0) { | 565 | if (!strcmp(np->name, "pci") || !strcmp(np->name, "pcie")) { |
| 566 | if (add_bridge(np) == 0) | 566 | if (add_bridge(np) == 0) |
| 567 | of_node_get(np); | 567 | of_node_get(np); |
| 568 | } | 568 | } |
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index 094989d50bab..f12d5c69e74d 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | #include <asm/of_device.h> | 60 | #include <asm/of_device.h> |
| 61 | #include <asm/lmb.h> | 61 | #include <asm/lmb.h> |
| 62 | #include <asm/mpic.h> | 62 | #include <asm/mpic.h> |
| 63 | #include <asm/rtas.h> | ||
| 63 | #include <asm/udbg.h> | 64 | #include <asm/udbg.h> |
| 64 | 65 | ||
| 65 | #include "maple.h" | 66 | #include "maple.h" |
| @@ -166,6 +167,16 @@ struct smp_ops_t maple_smp_ops = { | |||
| 166 | }; | 167 | }; |
| 167 | #endif /* CONFIG_SMP */ | 168 | #endif /* CONFIG_SMP */ |
| 168 | 169 | ||
| 170 | static void __init maple_use_rtas_reboot_and_halt_if_present(void) | ||
| 171 | { | ||
| 172 | if (rtas_service_present("system-reboot") && | ||
| 173 | rtas_service_present("power-off")) { | ||
| 174 | ppc_md.restart = rtas_restart; | ||
| 175 | ppc_md.power_off = rtas_power_off; | ||
| 176 | ppc_md.halt = rtas_halt; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | |||
| 169 | void __init maple_setup_arch(void) | 180 | void __init maple_setup_arch(void) |
| 170 | { | 181 | { |
| 171 | /* init to some ~sane value until calibrate_delay() runs */ | 182 | /* init to some ~sane value until calibrate_delay() runs */ |
| @@ -181,6 +192,7 @@ void __init maple_setup_arch(void) | |||
| 181 | #ifdef CONFIG_DUMMY_CONSOLE | 192 | #ifdef CONFIG_DUMMY_CONSOLE |
| 182 | conswitchp = &dummy_con; | 193 | conswitchp = &dummy_con; |
| 183 | #endif | 194 | #endif |
| 195 | maple_use_rtas_reboot_and_halt_if_present(); | ||
| 184 | 196 | ||
| 185 | printk(KERN_DEBUG "Using native/NAP idle loop\n"); | 197 | printk(KERN_DEBUG "Using native/NAP idle loop\n"); |
| 186 | } | 198 | } |
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig index 451bfcd5502e..de52ec4e9e58 100644 --- a/arch/powerpc/platforms/ps3/Kconfig +++ b/arch/powerpc/platforms/ps3/Kconfig | |||
| @@ -40,4 +40,15 @@ config PS3_USE_LPAR_ADDR | |||
| 40 | 40 | ||
| 41 | If you have any doubt, choose the default y. | 41 | If you have any doubt, choose the default y. |
| 42 | 42 | ||
| 43 | config PS3_VUART | ||
| 44 | depends on PPC_PS3 | ||
| 45 | bool "PS3 Virtual UART support" | ||
| 46 | default y | ||
| 47 | help | ||
| 48 | Include support for the PS3 Virtual UART. | ||
| 49 | |||
| 50 | This support is required for several system services | ||
| 51 | including the System Manager and AV Settings. In | ||
| 52 | general, all users will say Y. | ||
| 53 | |||
| 43 | endmenu | 54 | endmenu |
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 997243a91be8..69590fbf83da 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile | |||
| @@ -10,6 +10,8 @@ obj-$(CONFIG_XICS) += xics.o | |||
| 10 | obj-$(CONFIG_SCANLOG) += scanlog.o | 10 | obj-$(CONFIG_SCANLOG) += scanlog.o |
| 11 | obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o | 11 | obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o |
| 12 | 12 | ||
| 13 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o | ||
| 14 | |||
| 13 | obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o | 15 | obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o |
| 14 | obj-$(CONFIG_HVCS) += hvcserver.o | 16 | obj-$(CONFIG_HVCS) += hvcserver.o |
| 15 | obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o | 17 | obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o |
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 3c2d63ebf787..da6e5362e7cd 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
| @@ -337,6 +337,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) | |||
| 337 | printk (KERN_ERR "EEH: Device driver ignored %d bad reads, panicing\n", | 337 | printk (KERN_ERR "EEH: Device driver ignored %d bad reads, panicing\n", |
| 338 | pdn->eeh_check_count); | 338 | pdn->eeh_check_count); |
| 339 | dump_stack(); | 339 | dump_stack(); |
| 340 | msleep(5000); | ||
| 340 | 341 | ||
| 341 | /* re-read the slot reset state */ | 342 | /* re-read the slot reset state */ |
| 342 | if (read_slot_reset_state(pdn, rets) != 0) | 343 | if (read_slot_reset_state(pdn, rets) != 0) |
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c index c2bc9904f1cb..cbd6b0711ab4 100644 --- a/arch/powerpc/platforms/pseries/eeh_driver.c +++ b/arch/powerpc/platforms/pseries/eeh_driver.c | |||
| @@ -170,14 +170,19 @@ static void eeh_report_reset(struct pci_dev *dev, void *userdata) | |||
| 170 | static void eeh_report_resume(struct pci_dev *dev, void *userdata) | 170 | static void eeh_report_resume(struct pci_dev *dev, void *userdata) |
| 171 | { | 171 | { |
| 172 | struct pci_driver *driver = dev->driver; | 172 | struct pci_driver *driver = dev->driver; |
| 173 | struct device_node *dn = pci_device_to_OF_node(dev); | ||
| 173 | 174 | ||
| 174 | dev->error_state = pci_channel_io_normal; | 175 | dev->error_state = pci_channel_io_normal; |
| 175 | 176 | ||
| 176 | if (!driver) | 177 | if (!driver) |
| 177 | return; | 178 | return; |
| 178 | if (!driver->err_handler) | 179 | |
| 179 | return; | 180 | if ((PCI_DN(dn)->eeh_mode) & EEH_MODE_IRQ_DISABLED) { |
| 180 | if (!driver->err_handler->resume) | 181 | PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED; |
| 182 | enable_irq(dev->irq); | ||
| 183 | } | ||
| 184 | if (!driver->err_handler || | ||
| 185 | !driver->err_handler->resume) | ||
| 181 | return; | 186 | return; |
| 182 | 187 | ||
| 183 | driver->err_handler->resume(dev); | 188 | driver->err_handler->resume(dev); |
| @@ -407,6 +412,8 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
| 407 | 412 | ||
| 408 | if (rc) | 413 | if (rc) |
| 409 | result = PCI_ERS_RESULT_NEED_RESET; | 414 | result = PCI_ERS_RESULT_NEED_RESET; |
| 415 | else | ||
| 416 | result = PCI_ERS_RESULT_RECOVERED; | ||
| 410 | } | 417 | } |
| 411 | 418 | ||
| 412 | /* If any device has a hard failure, then shut off everything. */ | 419 | /* If any device has a hard failure, then shut off everything. */ |
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c new file mode 100644 index 000000000000..f460b9cbfd46 --- /dev/null +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c | |||
| @@ -0,0 +1,275 @@ | |||
| 1 | /* | ||
| 2 | * pseries CPU Hotplug infrastructure. | ||
| 3 | * | ||
| 4 | * Split out from arch/powerpc/platforms/pseries/setup.c | ||
| 5 | * arch/powerpc/kernel/rtas.c, and arch/powerpc/platforms/pseries/smp.c | ||
| 6 | * | ||
| 7 | * Peter Bergner, IBM March 2001. | ||
| 8 | * Copyright (C) 2001 IBM. | ||
| 9 | * Dave Engebretsen, Peter Bergner, and | ||
| 10 | * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com | ||
| 11 | * Plus various changes from other IBM teams... | ||
| 12 | * | ||
| 13 | * Copyright (C) 2006 Michael Ellerman, IBM Corporation | ||
| 14 | * | ||
| 15 | * This program is free software; you can redistribute it and/or | ||
| 16 | * modify it under the terms of the GNU General Public License | ||
| 17 | * as published by the Free Software Foundation; either version | ||
| 18 | * 2 of the License, or (at your option) any later version. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <linux/kernel.h> | ||
| 22 | #include <linux/delay.h> | ||
| 23 | #include <linux/cpu.h> | ||
| 24 | #include <asm/system.h> | ||
| 25 | #include <asm/prom.h> | ||
| 26 | #include <asm/rtas.h> | ||
| 27 | #include <asm/firmware.h> | ||
| 28 | #include <asm/machdep.h> | ||
| 29 | #include <asm/vdso_datapage.h> | ||
| 30 | #include <asm/pSeries_reconfig.h> | ||
| 31 | #include "xics.h" | ||
| 32 | |||
| 33 | /* This version can't take the spinlock, because it never returns */ | ||
| 34 | static struct rtas_args rtas_stop_self_args = { | ||
| 35 | .token = RTAS_UNKNOWN_SERVICE, | ||
| 36 | .nargs = 0, | ||
| 37 | .nret = 1, | ||
| 38 | .rets = &rtas_stop_self_args.args[0], | ||
| 39 | }; | ||
| 40 | |||
| 41 | static void rtas_stop_self(void) | ||
| 42 | { | ||
| 43 | struct rtas_args *args = &rtas_stop_self_args; | ||
| 44 | |||
| 45 | local_irq_disable(); | ||
| 46 | |||
| 47 | BUG_ON(args->token == RTAS_UNKNOWN_SERVICE); | ||
| 48 | |||
| 49 | printk("cpu %u (hwid %u) Ready to die...\n", | ||
| 50 | smp_processor_id(), hard_smp_processor_id()); | ||
| 51 | enter_rtas(__pa(args)); | ||
| 52 | |||
| 53 | panic("Alas, I survived.\n"); | ||
| 54 | } | ||
| 55 | |||
| 56 | static void pseries_mach_cpu_die(void) | ||
| 57 | { | ||
| 58 | local_irq_disable(); | ||
| 59 | idle_task_exit(); | ||
| 60 | xics_teardown_cpu(0); | ||
| 61 | rtas_stop_self(); | ||
| 62 | /* Should never get here... */ | ||
| 63 | BUG(); | ||
| 64 | for(;;); | ||
| 65 | } | ||
| 66 | |||
| 67 | static int qcss_tok; /* query-cpu-stopped-state token */ | ||
| 68 | |||
| 69 | /* Get state of physical CPU. | ||
| 70 | * Return codes: | ||
| 71 | * 0 - The processor is in the RTAS stopped state | ||
| 72 | * 1 - stop-self is in progress | ||
| 73 | * 2 - The processor is not in the RTAS stopped state | ||
| 74 | * -1 - Hardware Error | ||
| 75 | * -2 - Hardware Busy, Try again later. | ||
| 76 | */ | ||
| 77 | static int query_cpu_stopped(unsigned int pcpu) | ||
| 78 | { | ||
| 79 | int cpu_status, status; | ||
| 80 | |||
| 81 | status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu); | ||
| 82 | if (status != 0) { | ||
| 83 | printk(KERN_ERR | ||
| 84 | "RTAS query-cpu-stopped-state failed: %i\n", status); | ||
| 85 | return status; | ||
| 86 | } | ||
| 87 | |||
| 88 | return cpu_status; | ||
| 89 | } | ||
| 90 | |||
| 91 | static int pseries_cpu_disable(void) | ||
| 92 | { | ||
| 93 | int cpu = smp_processor_id(); | ||
| 94 | |||
| 95 | cpu_clear(cpu, cpu_online_map); | ||
| 96 | vdso_data->processorCount--; | ||
| 97 | |||
| 98 | /*fix boot_cpuid here*/ | ||
| 99 | if (cpu == boot_cpuid) | ||
| 100 | boot_cpuid = any_online_cpu(cpu_online_map); | ||
| 101 | |||
| 102 | /* FIXME: abstract this to not be platform specific later on */ | ||
| 103 | xics_migrate_irqs_away(); | ||
| 104 | return 0; | ||
| 105 | } | ||
| 106 | |||
| 107 | static void pseries_cpu_die(unsigned int cpu) | ||
| 108 | { | ||
| 109 | int tries; | ||
| 110 | int cpu_status; | ||
| 111 | unsigned int pcpu = get_hard_smp_processor_id(cpu); | ||
| 112 | |||
| 113 | for (tries = 0; tries < 25; tries++) { | ||
| 114 | cpu_status = query_cpu_stopped(pcpu); | ||
| 115 | if (cpu_status == 0 || cpu_status == -1) | ||
| 116 | break; | ||
| 117 | msleep(200); | ||
| 118 | } | ||
| 119 | if (cpu_status != 0) { | ||
| 120 | printk("Querying DEAD? cpu %i (%i) shows %i\n", | ||
| 121 | cpu, pcpu, cpu_status); | ||
| 122 | } | ||
| 123 | |||
| 124 | /* Isolation and deallocation are definatly done by | ||
| 125 | * drslot_chrp_cpu. If they were not they would be | ||
| 126 | * done here. Change isolate state to Isolate and | ||
| 127 | * change allocation-state to Unusable. | ||
| 128 | */ | ||
| 129 | paca[cpu].cpu_start = 0; | ||
| 130 | } | ||
| 131 | |||
| 132 | /* | ||
| 133 | * Update cpu_present_map and paca(s) for a new cpu node. The wrinkle | ||
| 134 | * here is that a cpu device node may represent up to two logical cpus | ||
| 135 | * in the SMT case. We must honor the assumption in other code that | ||
| 136 | * the logical ids for sibling SMT threads x and y are adjacent, such | ||
| 137 | * that x^1 == y and y^1 == x. | ||
| 138 | */ | ||
| 139 | static int pseries_add_processor(struct device_node *np) | ||
| 140 | { | ||
| 141 | unsigned int cpu; | ||
| 142 | cpumask_t candidate_map, tmp = CPU_MASK_NONE; | ||
| 143 | int err = -ENOSPC, len, nthreads, i; | ||
| 144 | const u32 *intserv; | ||
| 145 | |||
| 146 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); | ||
| 147 | if (!intserv) | ||
| 148 | return 0; | ||
| 149 | |||
| 150 | nthreads = len / sizeof(u32); | ||
| 151 | for (i = 0; i < nthreads; i++) | ||
| 152 | cpu_set(i, tmp); | ||
| 153 | |||
| 154 | lock_cpu_hotplug(); | ||
| 155 | |||
| 156 | BUG_ON(!cpus_subset(cpu_present_map, cpu_possible_map)); | ||
| 157 | |||
| 158 | /* Get a bitmap of unoccupied slots. */ | ||
| 159 | cpus_xor(candidate_map, cpu_possible_map, cpu_present_map); | ||
| 160 | if (cpus_empty(candidate_map)) { | ||
| 161 | /* If we get here, it most likely means that NR_CPUS is | ||
| 162 | * less than the partition's max processors setting. | ||
| 163 | */ | ||
| 164 | printk(KERN_ERR "Cannot add cpu %s; this system configuration" | ||
| 165 | " supports %d logical cpus.\n", np->full_name, | ||
| 166 | cpus_weight(cpu_possible_map)); | ||
| 167 | goto out_unlock; | ||
| 168 | } | ||
| 169 | |||
| 170 | while (!cpus_empty(tmp)) | ||
| 171 | if (cpus_subset(tmp, candidate_map)) | ||
| 172 | /* Found a range where we can insert the new cpu(s) */ | ||
| 173 | break; | ||
| 174 | else | ||
| 175 | cpus_shift_left(tmp, tmp, nthreads); | ||
| 176 | |||
| 177 | if (cpus_empty(tmp)) { | ||
| 178 | printk(KERN_ERR "Unable to find space in cpu_present_map for" | ||
| 179 | " processor %s with %d thread(s)\n", np->name, | ||
| 180 | nthreads); | ||
| 181 | goto out_unlock; | ||
| 182 | } | ||
| 183 | |||
| 184 | for_each_cpu_mask(cpu, tmp) { | ||
| 185 | BUG_ON(cpu_isset(cpu, cpu_present_map)); | ||
| 186 | cpu_set(cpu, cpu_present_map); | ||
| 187 | set_hard_smp_processor_id(cpu, *intserv++); | ||
| 188 | } | ||
| 189 | err = 0; | ||
| 190 | out_unlock: | ||
| 191 | unlock_cpu_hotplug(); | ||
| 192 | return err; | ||
| 193 | } | ||
| 194 | |||
| 195 | /* | ||
| 196 | * Update the present map for a cpu node which is going away, and set | ||
| 197 | * the hard id in the paca(s) to -1 to be consistent with boot time | ||
| 198 | * convention for non-present cpus. | ||
| 199 | */ | ||
| 200 | static void pseries_remove_processor(struct device_node *np) | ||
| 201 | { | ||
| 202 | unsigned int cpu; | ||
| 203 | int len, nthreads, i; | ||
| 204 | const u32 *intserv; | ||
| 205 | |||
| 206 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); | ||
| 207 | if (!intserv) | ||
| 208 | return; | ||
| 209 | |||
| 210 | nthreads = len / sizeof(u32); | ||
| 211 | |||
| 212 | lock_cpu_hotplug(); | ||
| 213 | for (i = 0; i < nthreads; i++) { | ||
| 214 | for_each_present_cpu(cpu) { | ||
| 215 | if (get_hard_smp_processor_id(cpu) != intserv[i]) | ||
| 216 | continue; | ||
| 217 | BUG_ON(cpu_online(cpu)); | ||
| 218 | cpu_clear(cpu, cpu_present_map); | ||
| 219 | set_hard_smp_processor_id(cpu, -1); | ||
| 220 | break; | ||
| 221 | } | ||
| 222 | if (cpu == NR_CPUS) | ||
| 223 | printk(KERN_WARNING "Could not find cpu to remove " | ||
| 224 | "with physical id 0x%x\n", intserv[i]); | ||
| 225 | } | ||
| 226 | unlock_cpu_hotplug(); | ||
| 227 | } | ||
| 228 | |||
| 229 | static int pseries_smp_notifier(struct notifier_block *nb, | ||
| 230 | unsigned long action, void *node) | ||
| 231 | { | ||
| 232 | int err = NOTIFY_OK; | ||
| 233 | |||
| 234 | switch (action) { | ||
| 235 | case PSERIES_RECONFIG_ADD: | ||
| 236 | if (pseries_add_processor(node)) | ||
| 237 | err = NOTIFY_BAD; | ||
| 238 | break; | ||
| 239 | case PSERIES_RECONFIG_REMOVE: | ||
| 240 | pseries_remove_processor(node); | ||
| 241 | break; | ||
| 242 | default: | ||
| 243 | err = NOTIFY_DONE; | ||
| 244 | break; | ||
| 245 | } | ||
| 246 | return err; | ||
| 247 | } | ||
| 248 | |||
| 249 | static struct notifier_block pseries_smp_nb = { | ||
| 250 | .notifier_call = pseries_smp_notifier, | ||
| 251 | }; | ||
| 252 | |||
| 253 | static int __init pseries_cpu_hotplug_init(void) | ||
| 254 | { | ||
| 255 | rtas_stop_self_args.token = rtas_token("stop-self"); | ||
| 256 | qcss_tok = rtas_token("query-cpu-stopped-state"); | ||
| 257 | |||
| 258 | if (rtas_stop_self_args.token == RTAS_UNKNOWN_SERVICE || | ||
| 259 | qcss_tok == RTAS_UNKNOWN_SERVICE) { | ||
| 260 | printk(KERN_INFO "CPU Hotplug not supported by firmware " | ||
| 261 | "- disabling.\n"); | ||
| 262 | return 0; | ||
| 263 | } | ||
| 264 | |||
| 265 | ppc_md.cpu_die = pseries_mach_cpu_die; | ||
| 266 | smp_ops->cpu_disable = pseries_cpu_disable; | ||
| 267 | smp_ops->cpu_die = pseries_cpu_die; | ||
| 268 | |||
| 269 | /* Processors can be added/removed only on LPAR */ | ||
| 270 | if (firmware_has_feature(FW_FEATURE_LPAR)) | ||
| 271 | pSeries_reconfig_notifier_register(&pseries_smp_nb); | ||
| 272 | |||
| 273 | return 0; | ||
| 274 | } | ||
| 275 | arch_initcall(pseries_cpu_hotplug_init); | ||
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 0dc2548ca9bc..042ecae107ac 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
| @@ -347,21 +347,6 @@ static int __init pSeries_init_panel(void) | |||
| 347 | } | 347 | } |
| 348 | arch_initcall(pSeries_init_panel); | 348 | arch_initcall(pSeries_init_panel); |
| 349 | 349 | ||
| 350 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 351 | static void pSeries_mach_cpu_die(void) | ||
| 352 | { | ||
| 353 | local_irq_disable(); | ||
| 354 | idle_task_exit(); | ||
| 355 | xics_teardown_cpu(0); | ||
| 356 | rtas_stop_self(); | ||
| 357 | /* Should never get here... */ | ||
| 358 | BUG(); | ||
| 359 | for(;;); | ||
| 360 | } | ||
| 361 | #else | ||
| 362 | #define pSeries_mach_cpu_die NULL | ||
| 363 | #endif | ||
| 364 | |||
| 365 | static int pseries_set_dabr(unsigned long dabr) | 350 | static int pseries_set_dabr(unsigned long dabr) |
| 366 | { | 351 | { |
| 367 | return plpar_hcall_norets(H_SET_DABR, dabr); | 352 | return plpar_hcall_norets(H_SET_DABR, dabr); |
| @@ -437,19 +422,14 @@ static int __init pSeries_probe_hypertas(unsigned long node, | |||
| 437 | if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL) | 422 | if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL) |
| 438 | powerpc_firmware_features |= FW_FEATURE_LPAR; | 423 | powerpc_firmware_features |= FW_FEATURE_LPAR; |
| 439 | 424 | ||
| 440 | if (firmware_has_feature(FW_FEATURE_LPAR)) | ||
| 441 | hpte_init_lpar(); | ||
| 442 | else | ||
| 443 | hpte_init_native(); | ||
| 444 | |||
| 445 | return 1; | 425 | return 1; |
| 446 | } | 426 | } |
| 447 | 427 | ||
| 448 | static int __init pSeries_probe(void) | 428 | static int __init pSeries_probe(void) |
| 449 | { | 429 | { |
| 450 | unsigned long root = of_get_flat_dt_root(); | 430 | unsigned long root = of_get_flat_dt_root(); |
| 451 | char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(), | 431 | char *dtype = of_get_flat_dt_prop(root, "device_type", NULL); |
| 452 | "device_type", NULL); | 432 | |
| 453 | if (dtype == NULL) | 433 | if (dtype == NULL) |
| 454 | return 0; | 434 | return 0; |
| 455 | if (strcmp(dtype, "chrp")) | 435 | if (strcmp(dtype, "chrp")) |
| @@ -467,6 +447,11 @@ static int __init pSeries_probe(void) | |||
| 467 | /* Now try to figure out if we are running on LPAR */ | 447 | /* Now try to figure out if we are running on LPAR */ |
| 468 | of_scan_flat_dt(pSeries_probe_hypertas, NULL); | 448 | of_scan_flat_dt(pSeries_probe_hypertas, NULL); |
| 469 | 449 | ||
| 450 | if (firmware_has_feature(FW_FEATURE_LPAR)) | ||
| 451 | hpte_init_lpar(); | ||
| 452 | else | ||
| 453 | hpte_init_native(); | ||
| 454 | |||
| 470 | DBG("Machine is%s LPAR !\n", | 455 | DBG("Machine is%s LPAR !\n", |
| 471 | (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not"); | 456 | (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not"); |
| 472 | 457 | ||
| @@ -561,7 +546,6 @@ define_machine(pseries) { | |||
| 561 | .power_off = rtas_power_off, | 546 | .power_off = rtas_power_off, |
| 562 | .halt = rtas_halt, | 547 | .halt = rtas_halt, |
| 563 | .panic = rtas_os_term, | 548 | .panic = rtas_os_term, |
| 564 | .cpu_die = pSeries_mach_cpu_die, | ||
| 565 | .get_boot_time = rtas_get_boot_time, | 549 | .get_boot_time = rtas_get_boot_time, |
| 566 | .get_rtc_time = rtas_get_rtc_time, | 550 | .get_rtc_time = rtas_get_rtc_time, |
| 567 | .set_rtc_time = rtas_set_rtc_time, | 551 | .set_rtc_time = rtas_set_rtc_time, |
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c index c6624b8a0e77..4408518eaebe 100644 --- a/arch/powerpc/platforms/pseries/smp.c +++ b/arch/powerpc/platforms/pseries/smp.c | |||
| @@ -64,197 +64,6 @@ static cpumask_t of_spin_map; | |||
| 64 | 64 | ||
| 65 | extern void generic_secondary_smp_init(unsigned long); | 65 | extern void generic_secondary_smp_init(unsigned long); |
| 66 | 66 | ||
| 67 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 68 | |||
| 69 | /* Get state of physical CPU. | ||
| 70 | * Return codes: | ||
| 71 | * 0 - The processor is in the RTAS stopped state | ||
| 72 | * 1 - stop-self is in progress | ||
| 73 | * 2 - The processor is not in the RTAS stopped state | ||
| 74 | * -1 - Hardware Error | ||
| 75 | * -2 - Hardware Busy, Try again later. | ||
| 76 | */ | ||
| 77 | static int query_cpu_stopped(unsigned int pcpu) | ||
| 78 | { | ||
| 79 | int cpu_status; | ||
| 80 | int status, qcss_tok; | ||
| 81 | |||
| 82 | qcss_tok = rtas_token("query-cpu-stopped-state"); | ||
| 83 | if (qcss_tok == RTAS_UNKNOWN_SERVICE) | ||
| 84 | return -1; | ||
| 85 | status = rtas_call(qcss_tok, 1, 2, &cpu_status, pcpu); | ||
| 86 | if (status != 0) { | ||
| 87 | printk(KERN_ERR | ||
| 88 | "RTAS query-cpu-stopped-state failed: %i\n", status); | ||
| 89 | return status; | ||
| 90 | } | ||
| 91 | |||
| 92 | return cpu_status; | ||
| 93 | } | ||
| 94 | |||
| 95 | static int pSeries_cpu_disable(void) | ||
| 96 | { | ||
| 97 | int cpu = smp_processor_id(); | ||
| 98 | |||
| 99 | cpu_clear(cpu, cpu_online_map); | ||
| 100 | vdso_data->processorCount--; | ||
| 101 | |||
| 102 | /*fix boot_cpuid here*/ | ||
| 103 | if (cpu == boot_cpuid) | ||
| 104 | boot_cpuid = any_online_cpu(cpu_online_map); | ||
| 105 | |||
| 106 | /* FIXME: abstract this to not be platform specific later on */ | ||
| 107 | xics_migrate_irqs_away(); | ||
| 108 | return 0; | ||
| 109 | } | ||
| 110 | |||
| 111 | static void pSeries_cpu_die(unsigned int cpu) | ||
| 112 | { | ||
| 113 | int tries; | ||
| 114 | int cpu_status; | ||
| 115 | unsigned int pcpu = get_hard_smp_processor_id(cpu); | ||
| 116 | |||
| 117 | for (tries = 0; tries < 25; tries++) { | ||
| 118 | cpu_status = query_cpu_stopped(pcpu); | ||
| 119 | if (cpu_status == 0 || cpu_status == -1) | ||
| 120 | break; | ||
| 121 | msleep(200); | ||
| 122 | } | ||
| 123 | if (cpu_status != 0) { | ||
| 124 | printk("Querying DEAD? cpu %i (%i) shows %i\n", | ||
| 125 | cpu, pcpu, cpu_status); | ||
| 126 | } | ||
| 127 | |||
| 128 | /* Isolation and deallocation are definatly done by | ||
| 129 | * drslot_chrp_cpu. If they were not they would be | ||
| 130 | * done here. Change isolate state to Isolate and | ||
| 131 | * change allocation-state to Unusable. | ||
| 132 | */ | ||
| 133 | paca[cpu].cpu_start = 0; | ||
| 134 | } | ||
| 135 | |||
| 136 | /* | ||
| 137 | * Update cpu_present_map and paca(s) for a new cpu node. The wrinkle | ||
| 138 | * here is that a cpu device node may represent up to two logical cpus | ||
| 139 | * in the SMT case. We must honor the assumption in other code that | ||
| 140 | * the logical ids for sibling SMT threads x and y are adjacent, such | ||
| 141 | * that x^1 == y and y^1 == x. | ||
| 142 | */ | ||
| 143 | static int pSeries_add_processor(struct device_node *np) | ||
| 144 | { | ||
| 145 | unsigned int cpu; | ||
| 146 | cpumask_t candidate_map, tmp = CPU_MASK_NONE; | ||
| 147 | int err = -ENOSPC, len, nthreads, i; | ||
| 148 | const u32 *intserv; | ||
| 149 | |||
| 150 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); | ||
| 151 | if (!intserv) | ||
| 152 | return 0; | ||
| 153 | |||
| 154 | nthreads = len / sizeof(u32); | ||
| 155 | for (i = 0; i < nthreads; i++) | ||
| 156 | cpu_set(i, tmp); | ||
| 157 | |||
| 158 | lock_cpu_hotplug(); | ||
| 159 | |||
| 160 | BUG_ON(!cpus_subset(cpu_present_map, cpu_possible_map)); | ||
| 161 | |||
| 162 | /* Get a bitmap of unoccupied slots. */ | ||
| 163 | cpus_xor(candidate_map, cpu_possible_map, cpu_present_map); | ||
| 164 | if (cpus_empty(candidate_map)) { | ||
| 165 | /* If we get here, it most likely means that NR_CPUS is | ||
| 166 | * less than the partition's max processors setting. | ||
| 167 | */ | ||
| 168 | printk(KERN_ERR "Cannot add cpu %s; this system configuration" | ||
| 169 | " supports %d logical cpus.\n", np->full_name, | ||
| 170 | cpus_weight(cpu_possible_map)); | ||
| 171 | goto out_unlock; | ||
| 172 | } | ||
| 173 | |||
| 174 | while (!cpus_empty(tmp)) | ||
| 175 | if (cpus_subset(tmp, candidate_map)) | ||
| 176 | /* Found a range where we can insert the new cpu(s) */ | ||
| 177 | break; | ||
| 178 | else | ||
| 179 | cpus_shift_left(tmp, tmp, nthreads); | ||
| 180 | |||
| 181 | if (cpus_empty(tmp)) { | ||
| 182 | printk(KERN_ERR "Unable to find space in cpu_present_map for" | ||
| 183 | " processor %s with %d thread(s)\n", np->name, | ||
| 184 | nthreads); | ||
| 185 | goto out_unlock; | ||
| 186 | } | ||
| 187 | |||
| 188 | for_each_cpu_mask(cpu, tmp) { | ||
| 189 | BUG_ON(cpu_isset(cpu, cpu_present_map)); | ||
| 190 | cpu_set(cpu, cpu_present_map); | ||
| 191 | set_hard_smp_processor_id(cpu, *intserv++); | ||
| 192 | } | ||
| 193 | err = 0; | ||
| 194 | out_unlock: | ||
| 195 | unlock_cpu_hotplug(); | ||
| 196 | return err; | ||
| 197 | } | ||
| 198 | |||
| 199 | /* | ||
| 200 | * Update the present map for a cpu node which is going away, and set | ||
| 201 | * the hard id in the paca(s) to -1 to be consistent with boot time | ||
| 202 | * convention for non-present cpus. | ||
| 203 | */ | ||
| 204 | static void pSeries_remove_processor(struct device_node *np) | ||
| 205 | { | ||
| 206 | unsigned int cpu; | ||
| 207 | int len, nthreads, i; | ||
| 208 | const u32 *intserv; | ||
| 209 | |||
| 210 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); | ||
| 211 | if (!intserv) | ||
| 212 | return; | ||
| 213 | |||
| 214 | nthreads = len / sizeof(u32); | ||
| 215 | |||
| 216 | lock_cpu_hotplug(); | ||
| 217 | for (i = 0; i < nthreads; i++) { | ||
| 218 | for_each_present_cpu(cpu) { | ||
| 219 | if (get_hard_smp_processor_id(cpu) != intserv[i]) | ||
| 220 | continue; | ||
| 221 | BUG_ON(cpu_online(cpu)); | ||
| 222 | cpu_clear(cpu, cpu_present_map); | ||
| 223 | set_hard_smp_processor_id(cpu, -1); | ||
| 224 | break; | ||
| 225 | } | ||
| 226 | if (cpu == NR_CPUS) | ||
| 227 | printk(KERN_WARNING "Could not find cpu to remove " | ||
| 228 | "with physical id 0x%x\n", intserv[i]); | ||
| 229 | } | ||
| 230 | unlock_cpu_hotplug(); | ||
| 231 | } | ||
| 232 | |||
| 233 | static int pSeries_smp_notifier(struct notifier_block *nb, unsigned long action, void *node) | ||
| 234 | { | ||
| 235 | int err = NOTIFY_OK; | ||
| 236 | |||
| 237 | switch (action) { | ||
| 238 | case PSERIES_RECONFIG_ADD: | ||
| 239 | if (pSeries_add_processor(node)) | ||
| 240 | err = NOTIFY_BAD; | ||
| 241 | break; | ||
| 242 | case PSERIES_RECONFIG_REMOVE: | ||
| 243 | pSeries_remove_processor(node); | ||
| 244 | break; | ||
| 245 | default: | ||
| 246 | err = NOTIFY_DONE; | ||
| 247 | break; | ||
| 248 | } | ||
| 249 | return err; | ||
| 250 | } | ||
| 251 | |||
| 252 | static struct notifier_block pSeries_smp_nb = { | ||
| 253 | .notifier_call = pSeries_smp_notifier, | ||
| 254 | }; | ||
| 255 | |||
| 256 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
| 257 | |||
| 258 | /** | 67 | /** |
| 259 | * smp_startup_cpu() - start the given cpu | 68 | * smp_startup_cpu() - start the given cpu |
| 260 | * | 69 | * |
| @@ -422,15 +231,6 @@ static void __init smp_init_pseries(void) | |||
| 422 | 231 | ||
| 423 | DBG(" -> smp_init_pSeries()\n"); | 232 | DBG(" -> smp_init_pSeries()\n"); |
| 424 | 233 | ||
| 425 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 426 | smp_ops->cpu_disable = pSeries_cpu_disable; | ||
| 427 | smp_ops->cpu_die = pSeries_cpu_die; | ||
| 428 | |||
| 429 | /* Processors can be added/removed only on LPAR */ | ||
| 430 | if (firmware_has_feature(FW_FEATURE_LPAR)) | ||
| 431 | pSeries_reconfig_notifier_register(&pSeries_smp_nb); | ||
| 432 | #endif | ||
| 433 | |||
| 434 | /* Mark threads which are still spinning in hold loops. */ | 234 | /* Mark threads which are still spinning in hold loops. */ |
| 435 | if (cpu_has_feature(CPU_FTR_SMT)) { | 235 | if (cpu_has_feature(CPU_FTR_SMT)) { |
| 436 | for_each_present_cpu(i) { | 236 | for_each_present_cpu(i) { |
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index 6cc34597a620..04d4917eb303 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile | |||
| @@ -5,7 +5,8 @@ endif | |||
| 5 | obj-$(CONFIG_MPIC) += mpic.o | 5 | obj-$(CONFIG_MPIC) += mpic.o |
| 6 | obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o | 6 | obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o |
| 7 | obj-$(CONFIG_PPC_MPC106) += grackle.o | 7 | obj-$(CONFIG_PPC_MPC106) += grackle.o |
| 8 | obj-$(CONFIG_PPC_DCR) += dcr.o dcr-low.o | 8 | obj-$(CONFIG_PPC_DCR) += dcr.o |
| 9 | obj-$(CONFIG_PPC_DCR_NATIVE) += dcr-low.o | ||
| 9 | obj-$(CONFIG_U3_DART) += dart_iommu.o | 10 | obj-$(CONFIG_U3_DART) += dart_iommu.o |
| 10 | obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o | 11 | obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o |
| 11 | obj-$(CONFIG_FSL_SOC) += fsl_soc.o | 12 | obj-$(CONFIG_FSL_SOC) += fsl_soc.o |
diff --git a/arch/powerpc/sysdev/dcr.S b/arch/powerpc/sysdev/dcr.S deleted file mode 100644 index 2078f39e2f17..000000000000 --- a/arch/powerpc/sysdev/dcr.S +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * "Indirect" DCR access | ||
| 3 | * | ||
| 4 | * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 9 | * option) any later version. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <asm/ppc_asm.h> | ||
| 13 | #include <asm/processor.h> | ||
| 14 | |||
| 15 | #define DCR_ACCESS_PROLOG(table) \ | ||
| 16 | rlwinm r3,r3,4,18,27; \ | ||
| 17 | lis r5,table@h; \ | ||
| 18 | ori r5,r5,table@l; \ | ||
| 19 | add r3,r3,r5; \ | ||
| 20 | mtctr r3; \ | ||
| 21 | bctr | ||
| 22 | |||
| 23 | _GLOBAL(__mfdcr) | ||
| 24 | DCR_ACCESS_PROLOG(__mfdcr_table) | ||
| 25 | |||
| 26 | _GLOBAL(__mtdcr) | ||
| 27 | DCR_ACCESS_PROLOG(__mtdcr_table) | ||
| 28 | |||
| 29 | __mfdcr_table: | ||
| 30 | mfdcr r3,0; blr | ||
| 31 | __mtdcr_table: | ||
| 32 | mtdcr 0,r4; blr | ||
| 33 | |||
| 34 | dcr = 1 | ||
| 35 | .rept 1023 | ||
| 36 | mfdcr r3,dcr; blr | ||
| 37 | mtdcr dcr,r4; blr | ||
| 38 | dcr = dcr + 1 | ||
| 39 | .endr | ||
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c index 6995f51b9488..74e48d94f27c 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c | |||
| @@ -223,23 +223,15 @@ static void qe_ic_mask_irq(unsigned int virq) | |||
| 223 | qe_ic_write(qe_ic->regs, qe_ic_info[src].mask_reg, | 223 | qe_ic_write(qe_ic->regs, qe_ic_info[src].mask_reg, |
| 224 | temp & ~qe_ic_info[src].mask); | 224 | temp & ~qe_ic_info[src].mask); |
| 225 | 225 | ||
| 226 | spin_unlock_irqrestore(&qe_ic_lock, flags); | 226 | /* Flush the above write before enabling interrupts; otherwise, |
| 227 | } | 227 | * spurious interrupts will sometimes happen. To be 100% sure |
| 228 | 228 | * that the write has reached the device before interrupts are | |
| 229 | static void qe_ic_mask_irq_and_ack(unsigned int virq) | 229 | * enabled, the mask register would have to be read back; however, |
| 230 | { | 230 | * this is not required for correctness, only to avoid wasting |
| 231 | struct qe_ic *qe_ic = qe_ic_from_irq(virq); | 231 | * time on a large number of spurious interrupts. In testing, |
| 232 | unsigned int src = virq_to_hw(virq); | 232 | * a sync reduced the observed spurious interrupts to zero. |
| 233 | unsigned long flags; | 233 | */ |
| 234 | u32 temp; | 234 | mb(); |
| 235 | |||
| 236 | spin_lock_irqsave(&qe_ic_lock, flags); | ||
| 237 | |||
| 238 | temp = qe_ic_read(qe_ic->regs, qe_ic_info[src].mask_reg); | ||
| 239 | qe_ic_write(qe_ic->regs, qe_ic_info[src].mask_reg, | ||
| 240 | temp & ~qe_ic_info[src].mask); | ||
| 241 | |||
| 242 | /* There is nothing to do for ack here, ack is handled in ISR */ | ||
| 243 | 235 | ||
| 244 | spin_unlock_irqrestore(&qe_ic_lock, flags); | 236 | spin_unlock_irqrestore(&qe_ic_lock, flags); |
| 245 | } | 237 | } |
| @@ -248,7 +240,7 @@ static struct irq_chip qe_ic_irq_chip = { | |||
| 248 | .typename = " QEIC ", | 240 | .typename = " QEIC ", |
| 249 | .unmask = qe_ic_unmask_irq, | 241 | .unmask = qe_ic_unmask_irq, |
| 250 | .mask = qe_ic_mask_irq, | 242 | .mask = qe_ic_mask_irq, |
| 251 | .mask_ack = qe_ic_mask_irq_and_ack, | 243 | .mask_ack = qe_ic_mask_irq, |
| 252 | }; | 244 | }; |
| 253 | 245 | ||
| 254 | static int qe_ic_host_match(struct irq_host *h, struct device_node *node) | 246 | static int qe_ic_host_match(struct irq_host *h, struct device_node *node) |
| @@ -331,34 +323,22 @@ unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic) | |||
| 331 | return irq_linear_revmap(qe_ic->irqhost, irq); | 323 | return irq_linear_revmap(qe_ic->irqhost, irq); |
| 332 | } | 324 | } |
| 333 | 325 | ||
| 334 | /* FIXME: We mask all the QE Low interrupts while handling. We should | ||
| 335 | * let other interrupt come in, but BAD interrupts are generated */ | ||
| 336 | void fastcall qe_ic_cascade_low(unsigned int irq, struct irq_desc *desc) | 326 | void fastcall qe_ic_cascade_low(unsigned int irq, struct irq_desc *desc) |
| 337 | { | 327 | { |
| 338 | struct qe_ic *qe_ic = desc->handler_data; | 328 | struct qe_ic *qe_ic = desc->handler_data; |
| 339 | struct irq_chip *chip = irq_desc[irq].chip; | ||
| 340 | |||
| 341 | unsigned int cascade_irq = qe_ic_get_low_irq(qe_ic); | 329 | unsigned int cascade_irq = qe_ic_get_low_irq(qe_ic); |
| 342 | 330 | ||
| 343 | chip->mask_ack(irq); | ||
| 344 | if (cascade_irq != NO_IRQ) | 331 | if (cascade_irq != NO_IRQ) |
| 345 | generic_handle_irq(cascade_irq); | 332 | generic_handle_irq(cascade_irq); |
| 346 | chip->unmask(irq); | ||
| 347 | } | 333 | } |
| 348 | 334 | ||
| 349 | /* FIXME: We mask all the QE High interrupts while handling. We should | ||
| 350 | * let other interrupt come in, but BAD interrupts are generated */ | ||
| 351 | void fastcall qe_ic_cascade_high(unsigned int irq, struct irq_desc *desc) | 335 | void fastcall qe_ic_cascade_high(unsigned int irq, struct irq_desc *desc) |
| 352 | { | 336 | { |
| 353 | struct qe_ic *qe_ic = desc->handler_data; | 337 | struct qe_ic *qe_ic = desc->handler_data; |
| 354 | struct irq_chip *chip = irq_desc[irq].chip; | ||
| 355 | |||
| 356 | unsigned int cascade_irq = qe_ic_get_high_irq(qe_ic); | 338 | unsigned int cascade_irq = qe_ic_get_high_irq(qe_ic); |
| 357 | 339 | ||
| 358 | chip->mask_ack(irq); | ||
| 359 | if (cascade_irq != NO_IRQ) | 340 | if (cascade_irq != NO_IRQ) |
| 360 | generic_handle_irq(cascade_irq); | 341 | generic_handle_irq(cascade_irq); |
| 361 | chip->unmask(irq); | ||
| 362 | } | 342 | } |
| 363 | 343 | ||
| 364 | void __init qe_ic_init(struct device_node *node, unsigned int flags) | 344 | void __init qe_ic_init(struct device_node *node, unsigned int flags) |
diff --git a/arch/powerpc/sysdev/rom.c b/arch/powerpc/sysdev/rom.c index bf5b3f10e6c6..c855a3b298a3 100644 --- a/arch/powerpc/sysdev/rom.c +++ b/arch/powerpc/sysdev/rom.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
| 11 | #include <asm/of_device.h> | 11 | #include <asm/of_device.h> |
| 12 | #include <asm/of_platform.h> | ||
| 12 | 13 | ||
| 13 | static int __init powerpc_flash_init(void) | 14 | static int __init powerpc_flash_init(void) |
| 14 | { | 15 | { |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index a34ed49e0356..77540a2f7704 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/sysrq.h> | 22 | #include <linux/sysrq.h> |
| 23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
| 25 | #include <linux/bug.h> | ||
| 25 | 26 | ||
| 26 | #include <asm/ptrace.h> | 27 | #include <asm/ptrace.h> |
| 27 | #include <asm/string.h> | 28 | #include <asm/string.h> |
| @@ -35,7 +36,6 @@ | |||
| 35 | #include <asm/cputable.h> | 36 | #include <asm/cputable.h> |
| 36 | #include <asm/rtas.h> | 37 | #include <asm/rtas.h> |
| 37 | #include <asm/sstep.h> | 38 | #include <asm/sstep.h> |
| 38 | #include <asm/bug.h> | ||
| 39 | #include <asm/irq_regs.h> | 39 | #include <asm/irq_regs.h> |
| 40 | #include <asm/spu.h> | 40 | #include <asm/spu.h> |
| 41 | #include <asm/spu_priv1.h> | 41 | #include <asm/spu_priv1.h> |
| @@ -1346,7 +1346,7 @@ static void backtrace(struct pt_regs *excp) | |||
| 1346 | 1346 | ||
| 1347 | static void print_bug_trap(struct pt_regs *regs) | 1347 | static void print_bug_trap(struct pt_regs *regs) |
| 1348 | { | 1348 | { |
| 1349 | struct bug_entry *bug; | 1349 | const struct bug_entry *bug; |
| 1350 | unsigned long addr; | 1350 | unsigned long addr; |
| 1351 | 1351 | ||
| 1352 | if (regs->msr & MSR_PR) | 1352 | if (regs->msr & MSR_PR) |
| @@ -1357,11 +1357,11 @@ static void print_bug_trap(struct pt_regs *regs) | |||
| 1357 | bug = find_bug(regs->nip); | 1357 | bug = find_bug(regs->nip); |
| 1358 | if (bug == NULL) | 1358 | if (bug == NULL) |
| 1359 | return; | 1359 | return; |
| 1360 | if (bug->line & BUG_WARNING_TRAP) | 1360 | if (is_warning_bug(bug)) |
| 1361 | return; | 1361 | return; |
| 1362 | 1362 | ||
| 1363 | printf("kernel BUG in %s at %s:%d!\n", | 1363 | printf("kernel BUG at %s:%u!\n", |
| 1364 | bug->function, bug->file, (unsigned int)bug->line); | 1364 | bug->file, bug->line); |
| 1365 | } | 1365 | } |
| 1366 | 1366 | ||
| 1367 | void excprint(struct pt_regs *fp) | 1367 | void excprint(struct pt_regs *fp) |
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index 63808e01cb0b..5e723c4c2571 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c | |||
| @@ -879,7 +879,7 @@ pci_resource_to_bus(struct pci_dev *pdev, struct resource *res) | |||
| 879 | 879 | ||
| 880 | 880 | ||
| 881 | static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | 881 | static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, |
| 882 | unsigned long *offset, | 882 | resource_size_t *offset, |
| 883 | enum pci_mmap_state mmap_state) | 883 | enum pci_mmap_state mmap_state) |
| 884 | { | 884 | { |
| 885 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | 885 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); |
| @@ -891,7 +891,9 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
| 891 | 891 | ||
| 892 | /* If memory, add on the PCI bridge address offset */ | 892 | /* If memory, add on the PCI bridge address offset */ |
| 893 | if (mmap_state == pci_mmap_mem) { | 893 | if (mmap_state == pci_mmap_mem) { |
| 894 | #if 0 /* See comment in pci_resource_to_user() for why this is disabled */ | ||
| 894 | *offset += hose->pci_mem_offset; | 895 | *offset += hose->pci_mem_offset; |
| 896 | #endif | ||
| 895 | res_bit = IORESOURCE_MEM; | 897 | res_bit = IORESOURCE_MEM; |
| 896 | } else { | 898 | } else { |
| 897 | io_offset = hose->io_base_virt - ___IO_BASE; | 899 | io_offset = hose->io_base_virt - ___IO_BASE; |
| @@ -1030,7 +1032,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
| 1030 | enum pci_mmap_state mmap_state, | 1032 | enum pci_mmap_state mmap_state, |
| 1031 | int write_combine) | 1033 | int write_combine) |
| 1032 | { | 1034 | { |
| 1033 | unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; | 1035 | resource_size_t offset = vma->vm_pgoff << PAGE_SHIFT; |
| 1034 | struct resource *rp; | 1036 | struct resource *rp; |
| 1035 | int ret; | 1037 | int ret; |
| 1036 | 1038 | ||
| @@ -1132,21 +1134,42 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar, | |||
| 1132 | resource_size_t *start, resource_size_t *end) | 1134 | resource_size_t *start, resource_size_t *end) |
| 1133 | { | 1135 | { |
| 1134 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | 1136 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); |
| 1135 | unsigned long offset = 0; | 1137 | resource_size_t offset = 0; |
| 1136 | 1138 | ||
| 1137 | if (hose == NULL) | 1139 | if (hose == NULL) |
| 1138 | return; | 1140 | return; |
| 1139 | 1141 | ||
| 1140 | if (rsrc->flags & IORESOURCE_IO) | 1142 | if (rsrc->flags & IORESOURCE_IO) |
| 1141 | offset = ___IO_BASE - hose->io_base_virt + hose->io_base_phys; | 1143 | offset = (unsigned long)hose->io_base_virt - _IO_BASE; |
| 1144 | |||
| 1145 | /* We pass a fully fixed up address to userland for MMIO instead of | ||
| 1146 | * a BAR value because X is lame and expects to be able to use that | ||
| 1147 | * to pass to /dev/mem ! | ||
| 1148 | * | ||
| 1149 | * That means that we'll have potentially 64 bits values where some | ||
| 1150 | * userland apps only expect 32 (like X itself since it thinks only | ||
| 1151 | * Sparc has 64 bits MMIO) but if we don't do that, we break it on | ||
| 1152 | * 32 bits CHRPs :-( | ||
| 1153 | * | ||
| 1154 | * Hopefully, the sysfs insterface is immune to that gunk. Once X | ||
| 1155 | * has been fixed (and the fix spread enough), we can re-enable the | ||
| 1156 | * 2 lines below and pass down a BAR value to userland. In that case | ||
| 1157 | * we'll also have to re-enable the matching code in | ||
| 1158 | * __pci_mmap_make_offset(). | ||
| 1159 | * | ||
| 1160 | * BenH. | ||
| 1161 | */ | ||
| 1162 | #if 0 | ||
| 1163 | else if (rsrc->flags & IORESOURCE_MEM) | ||
| 1164 | offset = hose->pci_mem_offset; | ||
| 1165 | #endif | ||
| 1142 | 1166 | ||
| 1143 | *start = rsrc->start + offset; | 1167 | *start = rsrc->start - offset; |
| 1144 | *end = rsrc->end + offset; | 1168 | *end = rsrc->end - offset; |
| 1145 | } | 1169 | } |
| 1146 | 1170 | ||
| 1147 | void __init | 1171 | void __init pci_init_resource(struct resource *res, resource_size_t start, |
| 1148 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, | 1172 | resource_size_t end, int flags, char *name) |
| 1149 | int flags, char *name) | ||
| 1150 | { | 1173 | { |
| 1151 | res->start = start; | 1174 | res->start = start; |
| 1152 | res->end = end; | 1175 | res->end = end; |
diff --git a/drivers/ps3/Makefile b/drivers/ps3/Makefile index b52d547b7a78..8433eb7562cb 100644 --- a/drivers/ps3/Makefile +++ b/drivers/ps3/Makefile | |||
| @@ -1 +1,2 @@ | |||
| 1 | obj-y += system-bus.o | 1 | obj-y += system-bus.o |
| 2 | obj-$(CONFIG_PS3_VUART) += vuart.o | ||
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c new file mode 100644 index 000000000000..6974f65bcda5 --- /dev/null +++ b/drivers/ps3/vuart.c | |||
| @@ -0,0 +1,965 @@ | |||
| 1 | /* | ||
| 2 | * PS3 virtual uart | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006 Sony Computer Entertainment Inc. | ||
| 5 | * Copyright 2006 Sony Corp. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; version 2 of the License. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <linux/kernel.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | #include <linux/interrupt.h> | ||
| 24 | #include <asm/ps3.h> | ||
| 25 | |||
| 26 | #include <asm/lv1call.h> | ||
| 27 | #include <asm/bitops.h> | ||
| 28 | |||
| 29 | #include "vuart.h" | ||
| 30 | |||
| 31 | MODULE_AUTHOR("Sony Corporation"); | ||
| 32 | MODULE_LICENSE("GPL v2"); | ||
| 33 | MODULE_DESCRIPTION("ps3 vuart"); | ||
| 34 | |||
| 35 | /** | ||
| 36 | * vuart - An inter-partition data link service. | ||
| 37 | * port 0: PS3 AV Settings. | ||
| 38 | * port 2: PS3 System Manager. | ||
| 39 | * | ||
| 40 | * The vuart provides a bi-directional byte stream data link between logical | ||
| 41 | * partitions. Its primary role is as a communications link between the guest | ||
| 42 | * OS and the system policy module. The current HV does not support any | ||
| 43 | * connections other than those listed. | ||
| 44 | */ | ||
| 45 | |||
| 46 | enum {PORT_COUNT = 3,}; | ||
| 47 | |||
| 48 | enum vuart_param { | ||
| 49 | PARAM_TX_TRIGGER = 0, | ||
| 50 | PARAM_RX_TRIGGER = 1, | ||
| 51 | PARAM_INTERRUPT_MASK = 2, | ||
| 52 | PARAM_RX_BUF_SIZE = 3, /* read only */ | ||
| 53 | PARAM_RX_BYTES = 4, /* read only */ | ||
| 54 | PARAM_TX_BUF_SIZE = 5, /* read only */ | ||
| 55 | PARAM_TX_BYTES = 6, /* read only */ | ||
| 56 | PARAM_INTERRUPT_STATUS = 7, /* read only */ | ||
| 57 | }; | ||
| 58 | |||
| 59 | enum vuart_interrupt_bit { | ||
| 60 | INTERRUPT_BIT_TX = 0, | ||
| 61 | INTERRUPT_BIT_RX = 1, | ||
| 62 | INTERRUPT_BIT_DISCONNECT = 2, | ||
| 63 | }; | ||
| 64 | |||
| 65 | enum vuart_interrupt_mask { | ||
| 66 | INTERRUPT_MASK_TX = 1, | ||
| 67 | INTERRUPT_MASK_RX = 2, | ||
| 68 | INTERRUPT_MASK_DISCONNECT = 4, | ||
| 69 | }; | ||
| 70 | |||
| 71 | /** | ||
| 72 | * struct ports_bmp - bitmap indicating ports needing service. | ||
| 73 | * | ||
| 74 | * A 256 bit read only bitmap indicating ports needing service. Do not write | ||
| 75 | * to these bits. Must not cross a page boundary. | ||
| 76 | */ | ||
| 77 | |||
| 78 | struct ports_bmp { | ||
| 79 | u64 status; | ||
| 80 | u64 unused[3]; | ||
| 81 | } __attribute__ ((aligned (32))); | ||
| 82 | |||
| 83 | /* redefine dev_dbg to do a syntax check */ | ||
| 84 | |||
| 85 | #if !defined(DEBUG) | ||
| 86 | #undef dev_dbg | ||
| 87 | static inline int __attribute__ ((format (printf, 2, 3))) dev_dbg( | ||
| 88 | const struct device *_dev, const char *fmt, ...) {return 0;} | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #define dump_ports_bmp(_b) _dump_ports_bmp(_b, __func__, __LINE__) | ||
| 92 | static void __attribute__ ((unused)) _dump_ports_bmp( | ||
| 93 | const struct ports_bmp* bmp, const char* func, int line) | ||
| 94 | { | ||
| 95 | pr_debug("%s:%d: ports_bmp: %016lxh\n", func, line, bmp->status); | ||
| 96 | } | ||
| 97 | |||
| 98 | static int ps3_vuart_match_id_to_port(enum ps3_match_id match_id, | ||
| 99 | unsigned int *port_number) | ||
| 100 | { | ||
| 101 | switch(match_id) { | ||
| 102 | case PS3_MATCH_ID_AV_SETTINGS: | ||
| 103 | *port_number = 0; | ||
| 104 | return 0; | ||
| 105 | case PS3_MATCH_ID_SYSTEM_MANAGER: | ||
| 106 | *port_number = 2; | ||
| 107 | return 0; | ||
| 108 | default: | ||
| 109 | WARN_ON(1); | ||
| 110 | *port_number = UINT_MAX; | ||
| 111 | return -EINVAL; | ||
| 112 | }; | ||
| 113 | } | ||
| 114 | |||
| 115 | #define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__) | ||
| 116 | static void __attribute__ ((unused)) _dump_port_params(unsigned int port_number, | ||
| 117 | const char* func, int line) | ||
| 118 | { | ||
| 119 | #if defined(DEBUG) | ||
| 120 | static const char *strings[] = { | ||
| 121 | "tx_trigger ", | ||
| 122 | "rx_trigger ", | ||
| 123 | "interrupt_mask ", | ||
| 124 | "rx_buf_size ", | ||
| 125 | "rx_bytes ", | ||
| 126 | "tx_buf_size ", | ||
| 127 | "tx_bytes ", | ||
| 128 | "interrupt_status", | ||
| 129 | }; | ||
| 130 | int result; | ||
| 131 | unsigned int i; | ||
| 132 | u64 value; | ||
| 133 | |||
| 134 | for (i = 0; i < ARRAY_SIZE(strings); i++) { | ||
| 135 | result = lv1_get_virtual_uart_param(port_number, i, &value); | ||
| 136 | |||
| 137 | if (result) { | ||
| 138 | pr_debug("%s:%d: port_%u: %s failed: %s\n", func, line, | ||
| 139 | port_number, strings[i], ps3_result(result)); | ||
| 140 | continue; | ||
| 141 | } | ||
| 142 | pr_debug("%s:%d: port_%u: %s = %lxh\n", | ||
| 143 | func, line, port_number, strings[i], value); | ||
| 144 | } | ||
| 145 | #endif | ||
| 146 | } | ||
| 147 | |||
| 148 | struct vuart_triggers { | ||
| 149 | unsigned long rx; | ||
| 150 | unsigned long tx; | ||
| 151 | }; | ||
| 152 | |||
| 153 | int ps3_vuart_get_triggers(struct ps3_vuart_port_device *dev, | ||
| 154 | struct vuart_triggers *trig) | ||
| 155 | { | ||
| 156 | int result; | ||
| 157 | unsigned long size; | ||
| 158 | unsigned long val; | ||
| 159 | |||
| 160 | result = lv1_get_virtual_uart_param(dev->port_number, | ||
| 161 | PARAM_TX_TRIGGER, &trig->tx); | ||
| 162 | |||
| 163 | if (result) { | ||
| 164 | dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n", | ||
| 165 | __func__, __LINE__, ps3_result(result)); | ||
| 166 | return result; | ||
| 167 | } | ||
| 168 | |||
| 169 | result = lv1_get_virtual_uart_param(dev->port_number, | ||
| 170 | PARAM_RX_BUF_SIZE, &size); | ||
| 171 | |||
| 172 | if (result) { | ||
| 173 | dev_dbg(&dev->core, "%s:%d: tx_buf_size failed: %s\n", | ||
| 174 | __func__, __LINE__, ps3_result(result)); | ||
| 175 | return result; | ||
| 176 | } | ||
| 177 | |||
| 178 | result = lv1_get_virtual_uart_param(dev->port_number, | ||
| 179 | PARAM_RX_TRIGGER, &val); | ||
| 180 | |||
| 181 | if (result) { | ||
| 182 | dev_dbg(&dev->core, "%s:%d: rx_trigger failed: %s\n", | ||
| 183 | __func__, __LINE__, ps3_result(result)); | ||
| 184 | return result; | ||
| 185 | } | ||
| 186 | |||
| 187 | trig->rx = size - val; | ||
| 188 | |||
| 189 | dev_dbg(&dev->core, "%s:%d: tx %lxh, rx %lxh\n", __func__, __LINE__, | ||
| 190 | trig->tx, trig->rx); | ||
| 191 | |||
| 192 | return result; | ||
| 193 | } | ||
| 194 | |||
| 195 | int ps3_vuart_set_triggers(struct ps3_vuart_port_device *dev, unsigned int tx, | ||
| 196 | unsigned int rx) | ||
| 197 | { | ||
| 198 | int result; | ||
| 199 | unsigned long size; | ||
| 200 | |||
| 201 | result = lv1_set_virtual_uart_param(dev->port_number, | ||
| 202 | PARAM_TX_TRIGGER, tx); | ||
| 203 | |||
| 204 | if (result) { | ||
| 205 | dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n", | ||
| 206 | __func__, __LINE__, ps3_result(result)); | ||
| 207 | return result; | ||
| 208 | } | ||
| 209 | |||
| 210 | result = lv1_get_virtual_uart_param(dev->port_number, | ||
| 211 | PARAM_RX_BUF_SIZE, &size); | ||
| 212 | |||
| 213 | if (result) { | ||
| 214 | dev_dbg(&dev->core, "%s:%d: tx_buf_size failed: %s\n", | ||
| 215 | __func__, __LINE__, ps3_result(result)); | ||
| 216 | return result; | ||
| 217 | } | ||
| 218 | |||
| 219 | result = lv1_set_virtual_uart_param(dev->port_number, | ||
| 220 | PARAM_RX_TRIGGER, size - rx); | ||
| 221 | |||
| 222 | if (result) { | ||
| 223 | dev_dbg(&dev->core, "%s:%d: rx_trigger failed: %s\n", | ||
| 224 | __func__, __LINE__, ps3_result(result)); | ||
| 225 | return result; | ||
| 226 | } | ||
| 227 | |||
| 228 | dev_dbg(&dev->core, "%s:%d: tx %xh, rx %xh\n", __func__, __LINE__, | ||
| 229 | tx, rx); | ||
| 230 | |||
| 231 | return result; | ||
| 232 | } | ||
| 233 | |||
| 234 | static int ps3_vuart_get_rx_bytes_waiting(struct ps3_vuart_port_device *dev, | ||
| 235 | unsigned long *bytes_waiting) | ||
| 236 | { | ||
| 237 | int result = lv1_get_virtual_uart_param(dev->port_number, | ||
| 238 | PARAM_RX_BYTES, bytes_waiting); | ||
| 239 | |||
| 240 | if (result) | ||
| 241 | dev_dbg(&dev->core, "%s:%d: rx_bytes failed: %s\n", | ||
| 242 | __func__, __LINE__, ps3_result(result)); | ||
| 243 | |||
| 244 | dev_dbg(&dev->core, "%s:%d: %lxh\n", __func__, __LINE__, | ||
| 245 | *bytes_waiting); | ||
| 246 | return result; | ||
| 247 | } | ||
| 248 | |||
| 249 | static int ps3_vuart_set_interrupt_mask(struct ps3_vuart_port_device *dev, | ||
| 250 | unsigned long mask) | ||
| 251 | { | ||
| 252 | int result; | ||
| 253 | |||
| 254 | dev_dbg(&dev->core, "%s:%d: %lxh\n", __func__, __LINE__, mask); | ||
| 255 | |||
| 256 | dev->interrupt_mask = mask; | ||
| 257 | |||
| 258 | result = lv1_set_virtual_uart_param(dev->port_number, | ||
| 259 | PARAM_INTERRUPT_MASK, dev->interrupt_mask); | ||
| 260 | |||
| 261 | if (result) | ||
| 262 | dev_dbg(&dev->core, "%s:%d: interrupt_mask failed: %s\n", | ||
| 263 | __func__, __LINE__, ps3_result(result)); | ||
| 264 | |||
| 265 | return result; | ||
| 266 | } | ||
| 267 | |||
| 268 | static int ps3_vuart_get_interrupt_mask(struct ps3_vuart_port_device *dev, | ||
| 269 | unsigned long *status) | ||
| 270 | { | ||
| 271 | int result = lv1_get_virtual_uart_param(dev->port_number, | ||
| 272 | PARAM_INTERRUPT_STATUS, status); | ||
| 273 | |||
| 274 | if (result) | ||
| 275 | dev_dbg(&dev->core, "%s:%d: interrupt_status failed: %s\n", | ||
| 276 | __func__, __LINE__, ps3_result(result)); | ||
| 277 | |||
| 278 | dev_dbg(&dev->core, "%s:%d: m %lxh, s %lxh, m&s %lxh\n", | ||
| 279 | __func__, __LINE__, dev->interrupt_mask, *status, | ||
| 280 | dev->interrupt_mask & *status); | ||
| 281 | |||
| 282 | return result; | ||
| 283 | } | ||
| 284 | |||
| 285 | int ps3_vuart_enable_interrupt_tx(struct ps3_vuart_port_device *dev) | ||
| 286 | { | ||
| 287 | return (dev->interrupt_mask & INTERRUPT_MASK_TX) ? 0 | ||
| 288 | : ps3_vuart_set_interrupt_mask(dev, dev->interrupt_mask | ||
| 289 | | INTERRUPT_MASK_TX); | ||
| 290 | } | ||
| 291 | |||
| 292 | int ps3_vuart_enable_interrupt_rx(struct ps3_vuart_port_device *dev) | ||
| 293 | { | ||
| 294 | return (dev->interrupt_mask & INTERRUPT_MASK_RX) ? 0 | ||
| 295 | : ps3_vuart_set_interrupt_mask(dev, dev->interrupt_mask | ||
| 296 | | INTERRUPT_MASK_RX); | ||
| 297 | } | ||
| 298 | |||
| 299 | int ps3_vuart_enable_interrupt_disconnect(struct ps3_vuart_port_device *dev) | ||
| 300 | { | ||
| 301 | return (dev->interrupt_mask & INTERRUPT_MASK_DISCONNECT) ? 0 | ||
| 302 | : ps3_vuart_set_interrupt_mask(dev, dev->interrupt_mask | ||
| 303 | | INTERRUPT_MASK_DISCONNECT); | ||
| 304 | } | ||
| 305 | |||
| 306 | int ps3_vuart_disable_interrupt_tx(struct ps3_vuart_port_device *dev) | ||
| 307 | { | ||
| 308 | return (dev->interrupt_mask & INTERRUPT_MASK_TX) | ||
| 309 | ? ps3_vuart_set_interrupt_mask(dev, dev->interrupt_mask | ||
| 310 | & ~INTERRUPT_MASK_TX) : 0; | ||
| 311 | } | ||
| 312 | |||
| 313 | int ps3_vuart_disable_interrupt_rx(struct ps3_vuart_port_device *dev) | ||
| 314 | { | ||
| 315 | return (dev->interrupt_mask & INTERRUPT_MASK_RX) | ||
| 316 | ? ps3_vuart_set_interrupt_mask(dev, dev->interrupt_mask | ||
| 317 | & ~INTERRUPT_MASK_RX) : 0; | ||
| 318 | } | ||
| 319 | |||
| 320 | int ps3_vuart_disable_interrupt_disconnect(struct ps3_vuart_port_device *dev) | ||
| 321 | { | ||
| 322 | return (dev->interrupt_mask & INTERRUPT_MASK_DISCONNECT) | ||
| 323 | ? ps3_vuart_set_interrupt_mask(dev, dev->interrupt_mask | ||
| 324 | & ~INTERRUPT_MASK_DISCONNECT) : 0; | ||
| 325 | } | ||
| 326 | |||
| 327 | /** | ||
| 328 | * ps3_vuart_raw_write - Low level write helper. | ||
| 329 | * | ||
| 330 | * Do not call ps3_vuart_raw_write directly, use ps3_vuart_write. | ||
| 331 | */ | ||
| 332 | |||
| 333 | static int ps3_vuart_raw_write(struct ps3_vuart_port_device *dev, | ||
| 334 | const void* buf, unsigned int bytes, unsigned long *bytes_written) | ||
| 335 | { | ||
| 336 | int result; | ||
| 337 | |||
| 338 | dev_dbg(&dev->core, "%s:%d: %xh\n", __func__, __LINE__, bytes); | ||
| 339 | |||
| 340 | result = lv1_write_virtual_uart(dev->port_number, | ||
| 341 | ps3_mm_phys_to_lpar(__pa(buf)), bytes, bytes_written); | ||
| 342 | |||
| 343 | if (result) { | ||
| 344 | dev_dbg(&dev->core, "%s:%d: lv1_write_virtual_uart failed: " | ||
| 345 | "%s\n", __func__, __LINE__, ps3_result(result)); | ||
| 346 | return result; | ||
| 347 | } | ||
| 348 | |||
| 349 | dev->stats.bytes_written += *bytes_written; | ||
| 350 | |||
| 351 | dev_dbg(&dev->core, "%s:%d: wrote %lxh/%xh=>%lxh\n", __func__, | ||
| 352 | __LINE__, *bytes_written, bytes, dev->stats.bytes_written); | ||
| 353 | |||
| 354 | return result; | ||
| 355 | } | ||
| 356 | |||
| 357 | /** | ||
| 358 | * ps3_vuart_raw_read - Low level read helper. | ||
| 359 | * | ||
| 360 | * Do not call ps3_vuart_raw_read directly, use ps3_vuart_read. | ||
| 361 | */ | ||
| 362 | |||
| 363 | static int ps3_vuart_raw_read(struct ps3_vuart_port_device *dev, void* buf, | ||
| 364 | unsigned int bytes, unsigned long *bytes_read) | ||
| 365 | { | ||
| 366 | int result; | ||
| 367 | |||
| 368 | dev_dbg(&dev->core, "%s:%d: %xh\n", __func__, __LINE__, bytes); | ||
| 369 | |||
| 370 | result = lv1_read_virtual_uart(dev->port_number, | ||
| 371 | ps3_mm_phys_to_lpar(__pa(buf)), bytes, bytes_read); | ||
| 372 | |||
| 373 | if (result) { | ||
| 374 | dev_dbg(&dev->core, "%s:%d: lv1_read_virtual_uart failed: %s\n", | ||
| 375 | __func__, __LINE__, ps3_result(result)); | ||
| 376 | return result; | ||
| 377 | } | ||
| 378 | |||
| 379 | dev->stats.bytes_read += *bytes_read; | ||
| 380 | |||
| 381 | dev_dbg(&dev->core, "%s:%d: read %lxh/%xh=>%lxh\n", __func__, __LINE__, | ||
| 382 | *bytes_read, bytes, dev->stats.bytes_read); | ||
| 383 | |||
| 384 | return result; | ||
| 385 | } | ||
| 386 | |||
| 387 | /** | ||
| 388 | * struct list_buffer - An element for a port device fifo buffer list. | ||
| 389 | */ | ||
| 390 | |||
| 391 | struct list_buffer { | ||
| 392 | struct list_head link; | ||
| 393 | const unsigned char *head; | ||
| 394 | const unsigned char *tail; | ||
| 395 | unsigned long dbg_number; | ||
| 396 | unsigned char data[]; | ||
| 397 | }; | ||
| 398 | |||
| 399 | /** | ||
| 400 | * ps3_vuart_write - the entry point for writing data to a port | ||
| 401 | * | ||
| 402 | * If the port is idle on entry as much of the incoming data is written to | ||
| 403 | * the port as the port will accept. Otherwise a list buffer is created | ||
| 404 | * and any remaning incoming data is copied to that buffer. The buffer is | ||
| 405 | * then enqueued for transmision via the transmit interrupt. | ||
| 406 | */ | ||
| 407 | |||
| 408 | int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf, | ||
| 409 | unsigned int bytes) | ||
| 410 | { | ||
| 411 | static unsigned long dbg_number; | ||
| 412 | int result; | ||
| 413 | unsigned long flags; | ||
| 414 | struct list_buffer *lb; | ||
| 415 | |||
| 416 | dev_dbg(&dev->core, "%s:%d: %u(%xh) bytes\n", __func__, __LINE__, | ||
| 417 | bytes, bytes); | ||
| 418 | |||
| 419 | spin_lock_irqsave(&dev->tx_list.lock, flags); | ||
| 420 | |||
| 421 | if (list_empty(&dev->tx_list.head)) { | ||
| 422 | unsigned long bytes_written; | ||
| 423 | |||
| 424 | result = ps3_vuart_raw_write(dev, buf, bytes, &bytes_written); | ||
| 425 | |||
| 426 | spin_unlock_irqrestore(&dev->tx_list.lock, flags); | ||
| 427 | |||
| 428 | if (result) { | ||
| 429 | dev_dbg(&dev->core, | ||
| 430 | "%s:%d: ps3_vuart_raw_write failed\n", | ||
| 431 | __func__, __LINE__); | ||
| 432 | return result; | ||
| 433 | } | ||
| 434 | |||
| 435 | if (bytes_written == bytes) { | ||
| 436 | dev_dbg(&dev->core, "%s:%d: wrote %xh bytes\n", | ||
| 437 | __func__, __LINE__, bytes); | ||
| 438 | return 0; | ||
| 439 | } | ||
| 440 | |||
| 441 | bytes -= bytes_written; | ||
| 442 | buf += bytes_written; | ||
| 443 | } else | ||
| 444 | spin_unlock_irqrestore(&dev->tx_list.lock, flags); | ||
| 445 | |||
| 446 | lb = kmalloc(sizeof(struct list_buffer) + bytes, GFP_KERNEL); | ||
| 447 | |||
| 448 | if (!lb) { | ||
| 449 | return -ENOMEM; | ||
| 450 | } | ||
| 451 | |||
| 452 | memcpy(lb->data, buf, bytes); | ||
| 453 | lb->head = lb->data; | ||
| 454 | lb->tail = lb->data + bytes; | ||
| 455 | lb->dbg_number = ++dbg_number; | ||
| 456 | |||
| 457 | spin_lock_irqsave(&dev->tx_list.lock, flags); | ||
| 458 | list_add_tail(&lb->link, &dev->tx_list.head); | ||
| 459 | ps3_vuart_enable_interrupt_tx(dev); | ||
| 460 | spin_unlock_irqrestore(&dev->tx_list.lock, flags); | ||
| 461 | |||
| 462 | dev_dbg(&dev->core, "%s:%d: queued buf_%lu, %xh bytes\n", | ||
| 463 | __func__, __LINE__, lb->dbg_number, bytes); | ||
| 464 | |||
| 465 | return 0; | ||
| 466 | } | ||
| 467 | |||
| 468 | /** | ||
| 469 | * ps3_vuart_read - the entry point for reading data from a port | ||
| 470 | * | ||
| 471 | * If enough bytes to satisfy the request are held in the buffer list those | ||
| 472 | * bytes are dequeued and copied to the caller's buffer. Emptied list buffers | ||
| 473 | * are retiered. If the request cannot be statified by bytes held in the list | ||
| 474 | * buffers -EAGAIN is returned. | ||
| 475 | */ | ||
| 476 | |||
| 477 | int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf, | ||
| 478 | unsigned int bytes) | ||
| 479 | { | ||
| 480 | unsigned long flags; | ||
| 481 | struct list_buffer *lb, *n; | ||
| 482 | unsigned long bytes_read; | ||
| 483 | |||
| 484 | dev_dbg(&dev->core, "%s:%d: %u(%xh) bytes\n", __func__, __LINE__, | ||
| 485 | bytes, bytes); | ||
| 486 | |||
| 487 | spin_lock_irqsave(&dev->rx_list.lock, flags); | ||
| 488 | |||
| 489 | if (dev->rx_list.bytes_held < bytes) { | ||
| 490 | spin_unlock_irqrestore(&dev->rx_list.lock, flags); | ||
| 491 | dev_dbg(&dev->core, "%s:%d: starved for %lxh bytes\n", | ||
| 492 | __func__, __LINE__, bytes - dev->rx_list.bytes_held); | ||
| 493 | return -EAGAIN; | ||
| 494 | } | ||
| 495 | |||
| 496 | list_for_each_entry_safe(lb, n, &dev->rx_list.head, link) { | ||
| 497 | bytes_read = min((unsigned int)(lb->tail - lb->head), bytes); | ||
| 498 | |||
| 499 | memcpy(buf, lb->head, bytes_read); | ||
| 500 | buf += bytes_read; | ||
| 501 | bytes -= bytes_read; | ||
| 502 | dev->rx_list.bytes_held -= bytes_read; | ||
| 503 | |||
| 504 | if (bytes_read < lb->tail - lb->head) { | ||
| 505 | lb->head += bytes_read; | ||
| 506 | spin_unlock_irqrestore(&dev->rx_list.lock, flags); | ||
| 507 | |||
| 508 | dev_dbg(&dev->core, | ||
| 509 | "%s:%d: dequeued buf_%lu, %lxh bytes\n", | ||
| 510 | __func__, __LINE__, lb->dbg_number, bytes_read); | ||
| 511 | return 0; | ||
| 512 | } | ||
| 513 | |||
| 514 | dev_dbg(&dev->core, "%s:%d free buf_%lu\n", __func__, __LINE__, | ||
| 515 | lb->dbg_number); | ||
| 516 | |||
| 517 | list_del(&lb->link); | ||
| 518 | kfree(lb); | ||
| 519 | } | ||
| 520 | spin_unlock_irqrestore(&dev->rx_list.lock, flags); | ||
| 521 | |||
| 522 | dev_dbg(&dev->core, "%s:%d: dequeued buf_%lu, %xh bytes\n", | ||
| 523 | __func__, __LINE__, lb->dbg_number, bytes); | ||
| 524 | |||
| 525 | return 0; | ||
| 526 | } | ||
| 527 | |||
| 528 | /** | ||
| 529 | * ps3_vuart_handle_interrupt_tx - third stage transmit interrupt handler | ||
| 530 | * | ||
| 531 | * Services the transmit interrupt for the port. Writes as much data from the | ||
| 532 | * buffer list as the port will accept. Retires any emptied list buffers and | ||
| 533 | * adjusts the final list buffer state for a partial write. | ||
| 534 | */ | ||
| 535 | |||
| 536 | static int ps3_vuart_handle_interrupt_tx(struct ps3_vuart_port_device *dev) | ||
| 537 | { | ||
| 538 | int result = 0; | ||
| 539 | unsigned long flags; | ||
| 540 | struct list_buffer *lb, *n; | ||
| 541 | unsigned long bytes_total = 0; | ||
| 542 | |||
| 543 | dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__); | ||
| 544 | |||
| 545 | spin_lock_irqsave(&dev->tx_list.lock, flags); | ||
| 546 | |||
| 547 | list_for_each_entry_safe(lb, n, &dev->tx_list.head, link) { | ||
| 548 | |||
| 549 | unsigned long bytes_written; | ||
| 550 | |||
| 551 | result = ps3_vuart_raw_write(dev, lb->head, lb->tail - lb->head, | ||
| 552 | &bytes_written); | ||
| 553 | |||
| 554 | if (result) { | ||
| 555 | dev_dbg(&dev->core, | ||
| 556 | "%s:%d: ps3_vuart_raw_write failed\n", | ||
| 557 | __func__, __LINE__); | ||
| 558 | break; | ||
| 559 | } | ||
| 560 | |||
| 561 | bytes_total += bytes_written; | ||
| 562 | |||
| 563 | if (bytes_written < lb->tail - lb->head) { | ||
| 564 | lb->head += bytes_written; | ||
| 565 | dev_dbg(&dev->core, | ||
| 566 | "%s:%d cleared buf_%lu, %lxh bytes\n", | ||
| 567 | __func__, __LINE__, lb->dbg_number, | ||
| 568 | bytes_written); | ||
| 569 | goto port_full; | ||
| 570 | } | ||
| 571 | |||
| 572 | dev_dbg(&dev->core, "%s:%d free buf_%lu\n", __func__, __LINE__, | ||
| 573 | lb->dbg_number); | ||
| 574 | |||
| 575 | list_del(&lb->link); | ||
| 576 | kfree(lb); | ||
| 577 | } | ||
| 578 | |||
| 579 | ps3_vuart_disable_interrupt_tx(dev); | ||
| 580 | port_full: | ||
| 581 | spin_unlock_irqrestore(&dev->tx_list.lock, flags); | ||
| 582 | dev_dbg(&dev->core, "%s:%d wrote %lxh bytes total\n", | ||
| 583 | __func__, __LINE__, bytes_total); | ||
| 584 | return result; | ||
| 585 | } | ||
| 586 | |||
| 587 | /** | ||
| 588 | * ps3_vuart_handle_interrupt_rx - third stage receive interrupt handler | ||
| 589 | * | ||
| 590 | * Services the receive interrupt for the port. Creates a list buffer and | ||
| 591 | * copies all waiting port data to that buffer and enqueues the buffer in the | ||
| 592 | * buffer list. Buffer list data is dequeued via ps3_vuart_read. | ||
| 593 | */ | ||
| 594 | |||
| 595 | static int ps3_vuart_handle_interrupt_rx(struct ps3_vuart_port_device *dev) | ||
| 596 | { | ||
| 597 | static unsigned long dbg_number; | ||
| 598 | int result = 0; | ||
| 599 | unsigned long flags; | ||
| 600 | struct list_buffer *lb; | ||
| 601 | unsigned long bytes; | ||
| 602 | |||
| 603 | dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__); | ||
| 604 | |||
| 605 | result = ps3_vuart_get_rx_bytes_waiting(dev, &bytes); | ||
| 606 | |||
| 607 | if (result) | ||
| 608 | return -EIO; | ||
| 609 | |||
| 610 | BUG_ON(!bytes); | ||
| 611 | |||
| 612 | /* add some extra space for recently arrived data */ | ||
| 613 | |||
| 614 | bytes += 128; | ||
| 615 | |||
| 616 | lb = kmalloc(sizeof(struct list_buffer) + bytes, GFP_ATOMIC); | ||
| 617 | |||
| 618 | if (!lb) | ||
| 619 | return -ENOMEM; | ||
| 620 | |||
| 621 | ps3_vuart_raw_read(dev, lb->data, bytes, &bytes); | ||
| 622 | |||
| 623 | lb->head = lb->data; | ||
| 624 | lb->tail = lb->data + bytes; | ||
| 625 | lb->dbg_number = ++dbg_number; | ||
| 626 | |||
| 627 | spin_lock_irqsave(&dev->rx_list.lock, flags); | ||
| 628 | list_add_tail(&lb->link, &dev->rx_list.head); | ||
| 629 | dev->rx_list.bytes_held += bytes; | ||
| 630 | spin_unlock_irqrestore(&dev->rx_list.lock, flags); | ||
| 631 | |||
| 632 | dev_dbg(&dev->core, "%s:%d: queued buf_%lu, %lxh bytes\n", | ||
| 633 | __func__, __LINE__, lb->dbg_number, bytes); | ||
| 634 | |||
| 635 | return 0; | ||
| 636 | } | ||
| 637 | |||
| 638 | static int ps3_vuart_handle_interrupt_disconnect( | ||
| 639 | struct ps3_vuart_port_device *dev) | ||
| 640 | { | ||
| 641 | dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__); | ||
| 642 | BUG_ON("no support"); | ||
| 643 | return -1; | ||
| 644 | } | ||
| 645 | |||
| 646 | /** | ||
| 647 | * ps3_vuart_handle_port_interrupt - second stage interrupt handler | ||
| 648 | * | ||
| 649 | * Services any pending interrupt types for the port. Passes control to the | ||
| 650 | * third stage type specific interrupt handler. Returns control to the first | ||
| 651 | * stage handler after one iteration. | ||
| 652 | */ | ||
| 653 | |||
| 654 | static int ps3_vuart_handle_port_interrupt(struct ps3_vuart_port_device *dev) | ||
| 655 | { | ||
| 656 | int result; | ||
| 657 | unsigned long status; | ||
| 658 | |||
| 659 | result = ps3_vuart_get_interrupt_mask(dev, &status); | ||
| 660 | |||
| 661 | if (result) | ||
| 662 | return result; | ||
| 663 | |||
| 664 | dev_dbg(&dev->core, "%s:%d: status: %lxh\n", __func__, __LINE__, | ||
| 665 | status); | ||
| 666 | |||
| 667 | if (status & INTERRUPT_MASK_DISCONNECT) { | ||
| 668 | dev->stats.disconnect_interrupts++; | ||
| 669 | result = ps3_vuart_handle_interrupt_disconnect(dev); | ||
| 670 | if (result) | ||
| 671 | ps3_vuart_disable_interrupt_disconnect(dev); | ||
| 672 | } | ||
| 673 | |||
| 674 | if (status & INTERRUPT_MASK_TX) { | ||
| 675 | dev->stats.tx_interrupts++; | ||
| 676 | result = ps3_vuart_handle_interrupt_tx(dev); | ||
| 677 | if (result) | ||
| 678 | ps3_vuart_disable_interrupt_tx(dev); | ||
| 679 | } | ||
| 680 | |||
| 681 | if (status & INTERRUPT_MASK_RX) { | ||
| 682 | dev->stats.rx_interrupts++; | ||
| 683 | result = ps3_vuart_handle_interrupt_rx(dev); | ||
| 684 | if (result) | ||
| 685 | ps3_vuart_disable_interrupt_rx(dev); | ||
| 686 | } | ||
| 687 | |||
| 688 | return 0; | ||
| 689 | } | ||
| 690 | |||
| 691 | struct vuart_private { | ||
| 692 | unsigned int in_use; | ||
| 693 | unsigned int virq; | ||
| 694 | struct ps3_vuart_port_device *devices[PORT_COUNT]; | ||
| 695 | const struct ports_bmp bmp; | ||
| 696 | }; | ||
| 697 | |||
| 698 | /** | ||
| 699 | * ps3_vuart_irq_handler - first stage interrupt handler | ||
| 700 | * | ||
| 701 | * Loops finding any interrupting port and its associated instance data. | ||
| 702 | * Passes control to the second stage port specific interrupt handler. Loops | ||
| 703 | * until all outstanding interrupts are serviced. | ||
| 704 | */ | ||
| 705 | |||
| 706 | static irqreturn_t ps3_vuart_irq_handler(int irq, void *_private) | ||
| 707 | { | ||
| 708 | struct vuart_private *private; | ||
| 709 | |||
| 710 | BUG_ON(!_private); | ||
| 711 | private = (struct vuart_private *)_private; | ||
| 712 | |||
| 713 | while (1) { | ||
| 714 | unsigned int port; | ||
| 715 | |||
| 716 | dump_ports_bmp(&private->bmp); | ||
| 717 | |||
| 718 | port = (BITS_PER_LONG - 1) - __ilog2(private->bmp.status); | ||
| 719 | |||
| 720 | if (port == BITS_PER_LONG) | ||
| 721 | break; | ||
| 722 | |||
| 723 | BUG_ON(port >= PORT_COUNT); | ||
| 724 | BUG_ON(!private->devices[port]); | ||
| 725 | |||
| 726 | ps3_vuart_handle_port_interrupt(private->devices[port]); | ||
| 727 | } | ||
| 728 | |||
| 729 | return IRQ_HANDLED; | ||
| 730 | } | ||
| 731 | |||
| 732 | static int ps3_vuart_match(struct device *_dev, struct device_driver *_drv) | ||
| 733 | { | ||
| 734 | int result; | ||
| 735 | struct ps3_vuart_port_driver *drv = to_ps3_vuart_port_driver(_drv); | ||
| 736 | struct ps3_vuart_port_device *dev = to_ps3_vuart_port_device(_dev); | ||
| 737 | |||
| 738 | result = dev->match_id == drv->match_id; | ||
| 739 | |||
| 740 | dev_info(&dev->core, "%s:%d: dev=%u(%s), drv=%u(%s): %s\n", __func__, | ||
| 741 | __LINE__, dev->match_id, dev->core.bus_id, drv->match_id, | ||
| 742 | drv->core.name, (result ? "match" : "miss")); | ||
| 743 | |||
| 744 | return result; | ||
| 745 | } | ||
| 746 | |||
| 747 | static struct vuart_private vuart_private; | ||
| 748 | |||
| 749 | static int ps3_vuart_probe(struct device *_dev) | ||
| 750 | { | ||
| 751 | int result; | ||
| 752 | unsigned long tmp; | ||
| 753 | struct ps3_vuart_port_device *dev = to_ps3_vuart_port_device(_dev); | ||
| 754 | struct ps3_vuart_port_driver *drv = | ||
| 755 | to_ps3_vuart_port_driver(_dev->driver); | ||
| 756 | |||
| 757 | dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__); | ||
| 758 | |||
| 759 | BUG_ON(!drv); | ||
| 760 | |||
| 761 | result = ps3_vuart_match_id_to_port(dev->match_id, &dev->port_number); | ||
| 762 | |||
| 763 | if (result) { | ||
| 764 | dev_dbg(&dev->core, "%s:%d: unknown match_id (%d)\n", | ||
| 765 | __func__, __LINE__, dev->match_id); | ||
| 766 | result = -EINVAL; | ||
| 767 | goto fail_match; | ||
| 768 | } | ||
| 769 | |||
| 770 | if (vuart_private.devices[dev->port_number]) { | ||
| 771 | dev_dbg(&dev->core, "%s:%d: port busy (%d)\n", __func__, | ||
| 772 | __LINE__, dev->port_number); | ||
| 773 | result = -EBUSY; | ||
| 774 | goto fail_match; | ||
| 775 | } | ||
| 776 | |||
| 777 | vuart_private.devices[dev->port_number] = dev; | ||
| 778 | |||
| 779 | INIT_LIST_HEAD(&dev->tx_list.head); | ||
| 780 | spin_lock_init(&dev->tx_list.lock); | ||
| 781 | INIT_LIST_HEAD(&dev->rx_list.head); | ||
| 782 | spin_lock_init(&dev->rx_list.lock); | ||
| 783 | |||
| 784 | vuart_private.in_use++; | ||
| 785 | if (vuart_private.in_use == 1) { | ||
| 786 | result = ps3_alloc_vuart_irq((void*)&vuart_private.bmp.status, | ||
| 787 | &vuart_private.virq); | ||
| 788 | |||
| 789 | if (result) { | ||
| 790 | dev_dbg(&dev->core, | ||
| 791 | "%s:%d: ps3_alloc_vuart_irq failed (%d)\n", | ||
| 792 | __func__, __LINE__, result); | ||
| 793 | result = -EPERM; | ||
| 794 | goto fail_alloc_irq; | ||
| 795 | } | ||
| 796 | |||
| 797 | result = request_irq(vuart_private.virq, ps3_vuart_irq_handler, | ||
| 798 | IRQF_DISABLED, "vuart", &vuart_private); | ||
| 799 | |||
| 800 | if (result) { | ||
| 801 | dev_info(&dev->core, "%s:%d: request_irq failed (%d)\n", | ||
| 802 | __func__, __LINE__, result); | ||
| 803 | goto fail_request_irq; | ||
| 804 | } | ||
| 805 | } | ||
| 806 | |||
| 807 | ps3_vuart_set_interrupt_mask(dev, INTERRUPT_MASK_RX); | ||
| 808 | |||
| 809 | /* clear stale pending interrupts */ | ||
| 810 | ps3_vuart_get_interrupt_mask(dev, &tmp); | ||
| 811 | |||
| 812 | ps3_vuart_set_triggers(dev, 1, 1); | ||
| 813 | |||
| 814 | if (drv->probe) | ||
| 815 | result = drv->probe(dev); | ||
| 816 | else { | ||
| 817 | result = 0; | ||
| 818 | dev_info(&dev->core, "%s:%d: no probe method\n", __func__, | ||
| 819 | __LINE__); | ||
| 820 | } | ||
| 821 | |||
| 822 | if (result) { | ||
| 823 | dev_dbg(&dev->core, "%s:%d: drv->probe failed\n", | ||
| 824 | __func__, __LINE__); | ||
| 825 | goto fail_probe; | ||
| 826 | } | ||
| 827 | |||
| 828 | return result; | ||
| 829 | |||
| 830 | fail_probe: | ||
| 831 | fail_request_irq: | ||
| 832 | vuart_private.in_use--; | ||
| 833 | if (!vuart_private.in_use) { | ||
| 834 | ps3_free_vuart_irq(vuart_private.virq); | ||
| 835 | vuart_private.virq = NO_IRQ; | ||
| 836 | } | ||
| 837 | fail_alloc_irq: | ||
| 838 | fail_match: | ||
| 839 | dev_dbg(&dev->core, "%s:%d failed\n", __func__, __LINE__); | ||
| 840 | return result; | ||
| 841 | } | ||
| 842 | |||
| 843 | static int ps3_vuart_remove(struct device *_dev) | ||
| 844 | { | ||
| 845 | struct ps3_vuart_port_device *dev = to_ps3_vuart_port_device(_dev); | ||
| 846 | struct ps3_vuart_port_driver *drv = | ||
| 847 | to_ps3_vuart_port_driver(_dev->driver); | ||
| 848 | |||
| 849 | dev_dbg(&dev->core, "%s:%d: %s\n", __func__, __LINE__, | ||
| 850 | dev->core.bus_id); | ||
| 851 | |||
| 852 | BUG_ON(vuart_private.in_use < 1); | ||
| 853 | |||
| 854 | if (drv->remove) | ||
| 855 | drv->remove(dev); | ||
| 856 | else | ||
| 857 | dev_dbg(&dev->core, "%s:%d: %s no remove method\n", __func__, | ||
| 858 | __LINE__, dev->core.bus_id); | ||
| 859 | |||
| 860 | vuart_private.in_use--; | ||
| 861 | |||
| 862 | if (!vuart_private.in_use) { | ||
| 863 | free_irq(vuart_private.virq, &vuart_private); | ||
| 864 | ps3_free_vuart_irq(vuart_private.virq); | ||
| 865 | vuart_private.virq = NO_IRQ; | ||
| 866 | } | ||
| 867 | return 0; | ||
| 868 | } | ||
| 869 | |||
| 870 | /** | ||
| 871 | * ps3_vuart - The vuart instance. | ||
| 872 | * | ||
| 873 | * The vuart is managed as a bus that port devices connect to. | ||
| 874 | */ | ||
| 875 | |||
| 876 | struct bus_type ps3_vuart = { | ||
| 877 | .name = "ps3_vuart", | ||
| 878 | .match = ps3_vuart_match, | ||
| 879 | .probe = ps3_vuart_probe, | ||
| 880 | .remove = ps3_vuart_remove, | ||
| 881 | }; | ||
| 882 | |||
| 883 | int __init ps3_vuart_init(void) | ||
| 884 | { | ||
| 885 | int result; | ||
| 886 | |||
| 887 | pr_debug("%s:%d:\n", __func__, __LINE__); | ||
| 888 | result = bus_register(&ps3_vuart); | ||
| 889 | BUG_ON(result); | ||
| 890 | return result; | ||
| 891 | } | ||
| 892 | |||
| 893 | void __exit ps3_vuart_exit(void) | ||
| 894 | { | ||
| 895 | pr_debug("%s:%d:\n", __func__, __LINE__); | ||
| 896 | bus_unregister(&ps3_vuart); | ||
| 897 | } | ||
| 898 | |||
| 899 | core_initcall(ps3_vuart_init); | ||
| 900 | module_exit(ps3_vuart_exit); | ||
| 901 | |||
| 902 | /** | ||
| 903 | * ps3_vuart_port_release_device - Remove a vuart port device. | ||
| 904 | */ | ||
| 905 | |||
| 906 | static void ps3_vuart_port_release_device(struct device *_dev) | ||
| 907 | { | ||
| 908 | struct ps3_vuart_port_device *dev = to_ps3_vuart_port_device(_dev); | ||
| 909 | #if defined(DEBUG) | ||
| 910 | memset(dev, 0xad, sizeof(struct ps3_vuart_port_device)); | ||
| 911 | #endif | ||
| 912 | kfree(dev); | ||
| 913 | } | ||
| 914 | |||
| 915 | /** | ||
| 916 | * ps3_vuart_port_device_register - Add a vuart port device. | ||
| 917 | */ | ||
| 918 | |||
| 919 | int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev) | ||
| 920 | { | ||
| 921 | int result; | ||
| 922 | static unsigned int dev_count = 1; | ||
| 923 | |||
| 924 | dev->core.parent = NULL; | ||
| 925 | dev->core.bus = &ps3_vuart; | ||
| 926 | dev->core.release = ps3_vuart_port_release_device; | ||
| 927 | |||
| 928 | snprintf(dev->core.bus_id, sizeof(dev->core.bus_id), "vuart_%02x", | ||
| 929 | dev_count++); | ||
| 930 | |||
| 931 | dev_dbg(&dev->core, "%s:%d register\n", __func__, __LINE__); | ||
| 932 | |||
| 933 | result = device_register(&dev->core); | ||
| 934 | |||
| 935 | return result; | ||
| 936 | } | ||
| 937 | |||
| 938 | EXPORT_SYMBOL_GPL(ps3_vuart_port_device_register); | ||
| 939 | |||
| 940 | /** | ||
| 941 | * ps3_vuart_port_driver_register - Add a vuart port device driver. | ||
| 942 | */ | ||
| 943 | |||
| 944 | int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv) | ||
| 945 | { | ||
| 946 | int result; | ||
| 947 | |||
| 948 | pr_debug("%s:%d: (%s)\n", __func__, __LINE__, drv->core.name); | ||
| 949 | drv->core.bus = &ps3_vuart; | ||
| 950 | result = driver_register(&drv->core); | ||
| 951 | return result; | ||
| 952 | } | ||
| 953 | |||
| 954 | EXPORT_SYMBOL_GPL(ps3_vuart_port_driver_register); | ||
| 955 | |||
| 956 | /** | ||
| 957 | * ps3_vuart_port_driver_unregister - Remove a vuart port device driver. | ||
| 958 | */ | ||
| 959 | |||
| 960 | void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv) | ||
| 961 | { | ||
| 962 | driver_unregister(&drv->core); | ||
| 963 | } | ||
| 964 | |||
| 965 | EXPORT_SYMBOL_GPL(ps3_vuart_port_driver_unregister); | ||
diff --git a/drivers/ps3/vuart.h b/drivers/ps3/vuart.h new file mode 100644 index 000000000000..28fd89f0c8aa --- /dev/null +++ b/drivers/ps3/vuart.h | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | /* | ||
| 2 | * PS3 virtual uart | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006 Sony Computer Entertainment Inc. | ||
| 5 | * Copyright 2006 Sony Corp. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; version 2 of the License. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #if !defined(_PS3_VUART_H) | ||
| 22 | #define _PS3_VUART_H | ||
| 23 | |||
| 24 | struct ps3_vuart_stats { | ||
| 25 | unsigned long bytes_written; | ||
| 26 | unsigned long bytes_read; | ||
| 27 | unsigned long tx_interrupts; | ||
| 28 | unsigned long rx_interrupts; | ||
| 29 | unsigned long disconnect_interrupts; | ||
| 30 | }; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * struct ps3_vuart_port_device - a device on a vuart port | ||
| 34 | */ | ||
| 35 | |||
| 36 | struct ps3_vuart_port_device { | ||
| 37 | enum ps3_match_id match_id; | ||
| 38 | struct device core; | ||
| 39 | |||
| 40 | /* private driver variables */ | ||
| 41 | unsigned int port_number; | ||
| 42 | unsigned long interrupt_mask; | ||
| 43 | struct { | ||
| 44 | spinlock_t lock; | ||
| 45 | struct list_head head; | ||
| 46 | } tx_list; | ||
| 47 | struct { | ||
| 48 | unsigned long bytes_held; | ||
| 49 | spinlock_t lock; | ||
| 50 | struct list_head head; | ||
| 51 | } rx_list; | ||
| 52 | struct ps3_vuart_stats stats; | ||
| 53 | }; | ||
| 54 | |||
| 55 | /** | ||
| 56 | * struct ps3_vuart_port_driver - a driver for a device on a vuart port | ||
| 57 | */ | ||
| 58 | |||
| 59 | struct ps3_vuart_port_driver { | ||
| 60 | enum ps3_match_id match_id; | ||
| 61 | struct device_driver core; | ||
| 62 | int (*probe)(struct ps3_vuart_port_device *); | ||
| 63 | int (*remove)(struct ps3_vuart_port_device *); | ||
| 64 | int (*tx_event)(struct ps3_vuart_port_device *dev); | ||
| 65 | int (*rx_event)(struct ps3_vuart_port_device *dev); | ||
| 66 | int (*disconnect_event)(struct ps3_vuart_port_device *dev); | ||
| 67 | /* int (*suspend)(struct ps3_vuart_port_device *, pm_message_t); */ | ||
| 68 | /* int (*resume)(struct ps3_vuart_port_device *); */ | ||
| 69 | }; | ||
| 70 | |||
| 71 | int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev); | ||
| 72 | int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv); | ||
| 73 | void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv); | ||
| 74 | int ps3_vuart_write(struct ps3_vuart_port_device *dev, | ||
| 75 | const void* buf, unsigned int bytes); | ||
| 76 | int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf, | ||
| 77 | unsigned int bytes); | ||
| 78 | static inline struct ps3_vuart_port_driver *to_ps3_vuart_port_driver( | ||
| 79 | struct device_driver *_drv) | ||
| 80 | { | ||
| 81 | return container_of(_drv, struct ps3_vuart_port_driver, core); | ||
| 82 | } | ||
| 83 | static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device( | ||
| 84 | struct device *_dev) | ||
| 85 | { | ||
| 86 | return container_of(_dev, struct ps3_vuart_port_device, core); | ||
| 87 | } | ||
| 88 | |||
| 89 | int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf, | ||
| 90 | unsigned int bytes); | ||
| 91 | int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf, | ||
| 92 | unsigned int bytes); | ||
| 93 | |||
| 94 | #endif | ||
diff --git a/include/asm-avr32/arch-at32ap/at32ap7000.h b/include/asm-avr32/arch-at32ap/at32ap7000.h new file mode 100644 index 000000000000..ba85e04553d4 --- /dev/null +++ b/include/asm-avr32/arch-at32ap/at32ap7000.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* | ||
| 2 | * Pin definitions for AT32AP7000. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006 Atmel Corporation | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | #ifndef __ASM_ARCH_AT32AP7000_H__ | ||
| 11 | #define __ASM_ARCH_AT32AP7000_H__ | ||
| 12 | |||
| 13 | #define GPIO_PERIPH_A 0 | ||
| 14 | #define GPIO_PERIPH_B 1 | ||
| 15 | |||
| 16 | #define NR_GPIO_CONTROLLERS 4 | ||
| 17 | |||
| 18 | /* | ||
| 19 | * Pin numbers identifying specific GPIO pins on the chip. They can | ||
| 20 | * also be converted to IRQ numbers by passing them through | ||
| 21 | * gpio_to_irq(). | ||
| 22 | */ | ||
| 23 | #define GPIO_PIOA_BASE (0) | ||
| 24 | #define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) | ||
| 25 | #define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) | ||
| 26 | #define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) | ||
| 27 | |||
| 28 | #define GPIO_PIN_PA(N) (GPIO_PIOA_BASE + (N)) | ||
| 29 | #define GPIO_PIN_PB(N) (GPIO_PIOB_BASE + (N)) | ||
| 30 | #define GPIO_PIN_PC(N) (GPIO_PIOC_BASE + (N)) | ||
| 31 | #define GPIO_PIN_PD(N) (GPIO_PIOD_BASE + (N)) | ||
| 32 | |||
| 33 | #endif /* __ASM_ARCH_AT32AP7000_H__ */ | ||
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h index a39b3e999f18..b120ee030c86 100644 --- a/include/asm-avr32/arch-at32ap/board.h +++ b/include/asm-avr32/arch-at32ap/board.h | |||
| @@ -21,10 +21,7 @@ void at32_map_usart(unsigned int hw_id, unsigned int line); | |||
| 21 | struct platform_device *at32_add_device_usart(unsigned int id); | 21 | struct platform_device *at32_add_device_usart(unsigned int id); |
| 22 | 22 | ||
| 23 | struct eth_platform_data { | 23 | struct eth_platform_data { |
| 24 | u8 valid; | ||
| 25 | u8 mii_phy_addr; | ||
| 26 | u8 is_rmii; | 24 | u8 is_rmii; |
| 27 | u8 hw_addr[6]; | ||
| 28 | }; | 25 | }; |
| 29 | struct platform_device * | 26 | struct platform_device * |
| 30 | at32_add_device_eth(unsigned int id, struct eth_platform_data *data); | 27 | at32_add_device_eth(unsigned int id, struct eth_platform_data *data); |
diff --git a/include/asm-avr32/arch-at32ap/portmux.h b/include/asm-avr32/arch-at32ap/portmux.h index 4d50421262a1..83c690571322 100644 --- a/include/asm-avr32/arch-at32ap/portmux.h +++ b/include/asm-avr32/arch-at32ap/portmux.h | |||
| @@ -7,10 +7,20 @@ | |||
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
| 9 | */ | 9 | */ |
| 10 | #ifndef __ASM_AVR32_AT32_PORTMUX_H__ | 10 | #ifndef __ASM_ARCH_PORTMUX_H__ |
| 11 | #define __ASM_AVR32_AT32_PORTMUX_H__ | 11 | #define __ASM_ARCH_PORTMUX_H__ |
| 12 | 12 | ||
| 13 | void portmux_set_func(unsigned int portmux_id, unsigned int pin_id, | 13 | /* |
| 14 | unsigned int function_id); | 14 | * Set up pin multiplexing, called from board init only. |
| 15 | * | ||
| 16 | * The following flags determine the initial state of the pin. | ||
| 17 | */ | ||
| 18 | #define AT32_GPIOF_PULLUP 0x00000001 /* Enable pull-up */ | ||
| 19 | #define AT32_GPIOF_OUTPUT 0x00000002 /* Enable output driver */ | ||
| 20 | #define AT32_GPIOF_HIGH 0x00000004 /* Set output high */ | ||
| 21 | |||
| 22 | void at32_select_periph(unsigned int pin, unsigned int periph, | ||
| 23 | unsigned long flags); | ||
| 24 | void at32_select_gpio(unsigned int pin, unsigned long flags); | ||
| 15 | 25 | ||
| 16 | #endif /* __ASM_AVR32_AT32_PORTMUX_H__ */ | 26 | #endif /* __ASM_ARCH_PORTMUX_H__ */ |
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h index 0580b5d62bba..5c01e27f0b41 100644 --- a/include/asm-avr32/dma-mapping.h +++ b/include/asm-avr32/dma-mapping.h | |||
| @@ -109,7 +109,7 @@ static inline dma_addr_t | |||
| 109 | dma_map_single(struct device *dev, void *cpu_addr, size_t size, | 109 | dma_map_single(struct device *dev, void *cpu_addr, size_t size, |
| 110 | enum dma_data_direction direction) | 110 | enum dma_data_direction direction) |
| 111 | { | 111 | { |
| 112 | dma_cache_sync(cpu_addr, size, direction); | 112 | dma_cache_sync(dev, cpu_addr, size, direction); |
| 113 | return virt_to_bus(cpu_addr); | 113 | return virt_to_bus(cpu_addr); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| @@ -211,7 +211,7 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
| 211 | 211 | ||
| 212 | sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset; | 212 | sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset; |
| 213 | virt = page_address(sg[i].page) + sg[i].offset; | 213 | virt = page_address(sg[i].page) + sg[i].offset; |
| 214 | dma_cache_sync(virt, sg[i].length, direction); | 214 | dma_cache_sync(dev, virt, sg[i].length, direction); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | return nents; | 217 | return nents; |
| @@ -256,14 +256,14 @@ static inline void | |||
| 256 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, | 256 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, |
| 257 | size_t size, enum dma_data_direction direction) | 257 | size_t size, enum dma_data_direction direction) |
| 258 | { | 258 | { |
| 259 | dma_cache_sync(bus_to_virt(dma_handle), size, direction); | 259 | dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | static inline void | 262 | static inline void |
| 263 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, | 263 | dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, |
| 264 | size_t size, enum dma_data_direction direction) | 264 | size_t size, enum dma_data_direction direction) |
| 265 | { | 265 | { |
| 266 | dma_cache_sync(bus_to_virt(dma_handle), size, direction); | 266 | dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | /** | 269 | /** |
| @@ -286,7 +286,7 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, | |||
| 286 | int i; | 286 | int i; |
| 287 | 287 | ||
| 288 | for (i = 0; i < nents; i++) { | 288 | for (i = 0; i < nents; i++) { |
| 289 | dma_cache_sync(page_address(sg[i].page) + sg[i].offset, | 289 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, |
| 290 | sg[i].length, direction); | 290 | sg[i].length, direction); |
| 291 | } | 291 | } |
| 292 | } | 292 | } |
| @@ -298,7 +298,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | |||
| 298 | int i; | 298 | int i; |
| 299 | 299 | ||
| 300 | for (i = 0; i < nents; i++) { | 300 | for (i = 0; i < nents; i++) { |
| 301 | dma_cache_sync(page_address(sg[i].page) + sg[i].offset, | 301 | dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, |
| 302 | sg[i].length, direction); | 302 | sg[i].length, direction); |
| 303 | } | 303 | } |
| 304 | } | 304 | } |
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h index 55a0152feb08..432653d7ae09 100644 --- a/include/asm-mips/compat.h +++ b/include/asm-mips/compat.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
| 7 | #include <asm/page.h> | 7 | #include <asm/page.h> |
| 8 | #include <asm/ptrace.h> | ||
| 8 | 9 | ||
| 9 | #define COMPAT_USER_HZ 100 | 10 | #define COMPAT_USER_HZ 100 |
| 10 | 11 | ||
diff --git a/include/asm-mips/mach-ip27/irq.h b/include/asm-mips/mach-ip27/irq.h index 806213ce31b6..25f0c3f39adf 100644 --- a/include/asm-mips/mach-ip27/irq.h +++ b/include/asm-mips/mach-ip27/irq.h | |||
| @@ -10,8 +10,6 @@ | |||
| 10 | #ifndef __ASM_MACH_IP27_IRQ_H | 10 | #ifndef __ASM_MACH_IP27_IRQ_H |
| 11 | #define __ASM_MACH_IP27_IRQ_H | 11 | #define __ASM_MACH_IP27_IRQ_H |
| 12 | 12 | ||
| 13 | #include <asm/sn/arch.h> | ||
| 14 | |||
| 15 | /* | 13 | /* |
| 16 | * A hardwired interrupt number is completly stupid for this system - a | 14 | * A hardwired interrupt number is completly stupid for this system - a |
| 17 | * large configuration might have thousands if not tenthousands of | 15 | * large configuration might have thousands if not tenthousands of |
diff --git a/include/asm-mips/mach-ip27/topology.h b/include/asm-mips/mach-ip27/topology.h index a13b715fd9ca..44790fdc5d00 100644 --- a/include/asm-mips/mach-ip27/topology.h +++ b/include/asm-mips/mach-ip27/topology.h | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | #ifndef _ASM_MACH_TOPOLOGY_H | 1 | #ifndef _ASM_MACH_TOPOLOGY_H |
| 2 | #define _ASM_MACH_TOPOLOGY_H 1 | 2 | #define _ASM_MACH_TOPOLOGY_H 1 |
| 3 | 3 | ||
| 4 | #include <asm/sn/arch.h> | ||
| 5 | #include <asm/sn/hub.h> | 4 | #include <asm/sn/hub.h> |
| 6 | #include <asm/mmzone.h> | 5 | #include <asm/mmzone.h> |
| 7 | 6 | ||
diff --git a/include/asm-mips/sn/arch.h b/include/asm-mips/sn/arch.h index 51174af6ac52..da523de628be 100644 --- a/include/asm-mips/sn/arch.h +++ b/include/asm-mips/sn/arch.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #endif | 18 | #endif |
| 19 | 19 | ||
| 20 | typedef u64 hubreg_t; | 20 | typedef u64 hubreg_t; |
| 21 | typedef u64 nic_t; | ||
| 22 | 21 | ||
| 23 | #define cputonasid(cpu) (cpu_data[(cpu)].p_nasid) | 22 | #define cputonasid(cpu) (cpu_data[(cpu)].p_nasid) |
| 24 | #define cputoslice(cpu) (cpu_data[(cpu)].p_slice) | 23 | #define cputoslice(cpu) (cpu_data[(cpu)].p_slice) |
diff --git a/include/asm-mips/sn/klconfig.h b/include/asm-mips/sn/klconfig.h index 15d70ca56187..82aeb9e322db 100644 --- a/include/asm-mips/sn/klconfig.h +++ b/include/asm-mips/sn/klconfig.h | |||
| @@ -61,6 +61,8 @@ | |||
| 61 | #endif /* CONFIG_SGI_IP35 */ | 61 | #endif /* CONFIG_SGI_IP35 */ |
| 62 | #endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */ | 62 | #endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */ |
| 63 | 63 | ||
| 64 | typedef u64 nic_t; | ||
| 65 | |||
| 64 | #define KLCFGINFO_MAGIC 0xbeedbabe | 66 | #define KLCFGINFO_MAGIC 0xbeedbabe |
| 65 | 67 | ||
| 66 | typedef s32 klconf_off_t; | 68 | typedef s32 klconf_off_t; |
diff --git a/include/asm-powerpc/Kbuild b/include/asm-powerpc/Kbuild index 1e637381c118..703970fb0ec0 100644 --- a/include/asm-powerpc/Kbuild +++ b/include/asm-powerpc/Kbuild | |||
| @@ -17,7 +17,6 @@ header-y += ipc.h | |||
| 17 | header-y += poll.h | 17 | header-y += poll.h |
| 18 | header-y += shmparam.h | 18 | header-y += shmparam.h |
| 19 | header-y += sockios.h | 19 | header-y += sockios.h |
| 20 | header-y += spu_info.h | ||
| 21 | header-y += ucontext.h | 20 | header-y += ucontext.h |
| 22 | header-y += ioctl.h | 21 | header-y += ioctl.h |
| 23 | header-y += linkage.h | 22 | header-y += linkage.h |
| @@ -37,6 +36,7 @@ unifdef-y += posix_types.h | |||
| 37 | unifdef-y += ptrace.h | 36 | unifdef-y += ptrace.h |
| 38 | unifdef-y += seccomp.h | 37 | unifdef-y += seccomp.h |
| 39 | unifdef-y += signal.h | 38 | unifdef-y += signal.h |
| 39 | unifdef-y += spu_info.h | ||
| 40 | unifdef-y += termios.h | 40 | unifdef-y += termios.h |
| 41 | unifdef-y += types.h | 41 | unifdef-y += types.h |
| 42 | unifdef-y += unistd.h | 42 | unifdef-y += unistd.h |
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h index 978b2c7e84ea..709568879f73 100644 --- a/include/asm-powerpc/bug.h +++ b/include/asm-powerpc/bug.h | |||
| @@ -13,36 +13,39 @@ | |||
| 13 | 13 | ||
| 14 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
| 15 | 15 | ||
| 16 | struct bug_entry { | ||
| 17 | unsigned long bug_addr; | ||
| 18 | long line; | ||
| 19 | const char *file; | ||
| 20 | const char *function; | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct bug_entry *find_bug(unsigned long bugaddr); | ||
| 24 | |||
| 25 | /* | ||
| 26 | * If this bit is set in the line number it means that the trap | ||
| 27 | * is for WARN_ON rather than BUG or BUG_ON. | ||
| 28 | */ | ||
| 29 | #define BUG_WARNING_TRAP 0x1000000 | ||
| 30 | |||
| 31 | #ifdef CONFIG_BUG | 16 | #ifdef CONFIG_BUG |
| 32 | 17 | ||
| 18 | /* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and | ||
| 19 | sizeof(struct bug_entry), respectively */ | ||
| 20 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
| 21 | #define _EMIT_BUG_ENTRY \ | ||
| 22 | ".section __bug_table,\"a\"\n" \ | ||
| 23 | "2:\t" PPC_LONG "1b, %0\n" \ | ||
| 24 | "\t.short %1, %2\n" \ | ||
| 25 | ".org 2b+%3\n" \ | ||
| 26 | ".previous\n" | ||
| 27 | #else | ||
| 28 | #define _EMIT_BUG_ENTRY \ | ||
| 29 | ".section __bug_table,\"a\"\n" \ | ||
| 30 | "2:\t" PPC_LONG "1b\n" \ | ||
| 31 | "\t.short %2\n" \ | ||
| 32 | ".org 2b+%3\n" \ | ||
| 33 | ".previous\n" | ||
| 34 | #endif | ||
| 35 | |||
| 33 | /* | 36 | /* |
| 34 | * BUG_ON() and WARN_ON() do their best to cooperate with compile-time | 37 | * BUG_ON() and WARN_ON() do their best to cooperate with compile-time |
| 35 | * optimisations. However depending on the complexity of the condition | 38 | * optimisations. However depending on the complexity of the condition |
| 36 | * some compiler versions may not produce optimal results. | 39 | * some compiler versions may not produce optimal results. |
| 37 | */ | 40 | */ |
| 38 | 41 | ||
| 39 | #define BUG() do { \ | 42 | #define BUG() do { \ |
| 40 | __asm__ __volatile__( \ | 43 | __asm__ __volatile__( \ |
| 41 | "1: twi 31,0,0\n" \ | 44 | "1: twi 31,0,0\n" \ |
| 42 | ".section __bug_table,\"a\"\n" \ | 45 | _EMIT_BUG_ENTRY \ |
| 43 | "\t"PPC_LONG" 1b,%0,%1,%2\n" \ | 46 | : : "i" (__FILE__), "i" (__LINE__), \ |
| 44 | ".previous" \ | 47 | "i" (0), "i" (sizeof(struct bug_entry))); \ |
| 45 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ | 48 | for(;;) ; \ |
| 46 | } while (0) | 49 | } while (0) |
| 47 | 50 | ||
| 48 | #define BUG_ON(x) do { \ | 51 | #define BUG_ON(x) do { \ |
| @@ -51,23 +54,21 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
| 51 | BUG(); \ | 54 | BUG(); \ |
| 52 | } else { \ | 55 | } else { \ |
| 53 | __asm__ __volatile__( \ | 56 | __asm__ __volatile__( \ |
| 54 | "1: "PPC_TLNEI" %0,0\n" \ | 57 | "1: "PPC_TLNEI" %4,0\n" \ |
| 55 | ".section __bug_table,\"a\"\n" \ | 58 | _EMIT_BUG_ENTRY \ |
| 56 | "\t"PPC_LONG" 1b,%1,%2,%3\n" \ | 59 | : : "i" (__FILE__), "i" (__LINE__), "i" (0), \ |
| 57 | ".previous" \ | 60 | "i" (sizeof(struct bug_entry)), \ |
| 58 | : : "r" ((long)(x)), "i" (__LINE__), \ | 61 | "r" ((long)(x))); \ |
| 59 | "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
| 60 | } \ | 62 | } \ |
| 61 | } while (0) | 63 | } while (0) |
| 62 | 64 | ||
| 63 | #define __WARN() do { \ | 65 | #define __WARN() do { \ |
| 64 | __asm__ __volatile__( \ | 66 | __asm__ __volatile__( \ |
| 65 | "1: twi 31,0,0\n" \ | 67 | "1: twi 31,0,0\n" \ |
| 66 | ".section __bug_table,\"a\"\n" \ | 68 | _EMIT_BUG_ENTRY \ |
| 67 | "\t"PPC_LONG" 1b,%0,%1,%2\n" \ | 69 | : : "i" (__FILE__), "i" (__LINE__), \ |
| 68 | ".previous" \ | 70 | "i" (BUGFLAG_WARNING), \ |
| 69 | : : "i" (__LINE__ + BUG_WARNING_TRAP), \ | 71 | "i" (sizeof(struct bug_entry))); \ |
| 70 | "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
| 71 | } while (0) | 72 | } while (0) |
| 72 | 73 | ||
| 73 | #define WARN_ON(x) ({ \ | 74 | #define WARN_ON(x) ({ \ |
| @@ -77,13 +78,12 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
| 77 | __WARN(); \ | 78 | __WARN(); \ |
| 78 | } else { \ | 79 | } else { \ |
| 79 | __asm__ __volatile__( \ | 80 | __asm__ __volatile__( \ |
| 80 | "1: "PPC_TLNEI" %0,0\n" \ | 81 | "1: "PPC_TLNEI" %4,0\n" \ |
| 81 | ".section __bug_table,\"a\"\n" \ | 82 | _EMIT_BUG_ENTRY \ |
| 82 | "\t"PPC_LONG" 1b,%1,%2,%3\n" \ | 83 | : : "i" (__FILE__), "i" (__LINE__), \ |
| 83 | ".previous" \ | 84 | "i" (BUGFLAG_WARNING), \ |
| 84 | : : "r" (__ret_warn_on), \ | 85 | "i" (sizeof(struct bug_entry)), \ |
| 85 | "i" (__LINE__ + BUG_WARNING_TRAP), \ | 86 | "r" (__ret_warn_on)); \ |
| 86 | "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
| 87 | } \ | 87 | } \ |
| 88 | unlikely(__ret_warn_on); \ | 88 | unlikely(__ret_warn_on); \ |
| 89 | }) | 89 | }) |
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index 6fe5c9d4ca3b..7384b8086b75 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h | |||
| @@ -126,6 +126,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start, | |||
| 126 | #define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000) | 126 | #define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000) |
| 127 | #define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000) | 127 | #define CPU_FTR_PPC_LE ASM_CONST(0x0000000000200000) |
| 128 | #define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000) | 128 | #define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000) |
| 129 | #define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000) | ||
| 129 | 130 | ||
| 130 | /* | 131 | /* |
| 131 | * Add the 64-bit processor unique features in the top half of the word; | 132 | * Add the 64-bit processor unique features in the top half of the word; |
| @@ -152,6 +153,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start, | |||
| 152 | #define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000) | 153 | #define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000) |
| 153 | #define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000) | 154 | #define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000) |
| 154 | #define CPU_FTR_SPURR LONG_ASM_CONST(0x0001000000000000) | 155 | #define CPU_FTR_SPURR LONG_ASM_CONST(0x0001000000000000) |
| 156 | #define CPU_FTR_DSCR LONG_ASM_CONST(0x0002000000000000) | ||
| 155 | 157 | ||
| 156 | #ifndef __ASSEMBLY__ | 158 | #ifndef __ASSEMBLY__ |
| 157 | 159 | ||
| @@ -295,6 +297,9 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start, | |||
| 295 | #define CPU_FTRS_E300 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ | 297 | #define CPU_FTRS_E300 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ |
| 296 | CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \ | 298 | CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \ |
| 297 | CPU_FTR_COMMON) | 299 | CPU_FTR_COMMON) |
| 300 | #define CPU_FTRS_E300C2 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ | ||
| 301 | CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \ | ||
| 302 | CPU_FTR_COMMON | CPU_FTR_FPU_UNAVAILABLE) | ||
| 298 | #define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ | 303 | #define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ |
| 299 | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE) | 304 | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE) |
| 300 | #define CPU_FTRS_8XX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB) | 305 | #define CPU_FTRS_8XX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB) |
| @@ -330,13 +335,14 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start, | |||
| 330 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 335 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
| 331 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 336 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
| 332 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ | 337 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ |
| 333 | CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE) | 338 | CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ |
| 339 | CPU_FTR_DSCR) | ||
| 334 | #define CPU_FTRS_POWER6X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | 340 | #define CPU_FTRS_POWER6X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ |
| 335 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 341 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
| 336 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 342 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
| 337 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ | 343 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ |
| 338 | CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | \ | 344 | CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | \ |
| 339 | CPU_FTR_SPURR | CPU_FTR_REAL_LE) | 345 | CPU_FTR_SPURR | CPU_FTR_REAL_LE | CPU_FTR_DSCR) |
| 340 | #define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | 346 | #define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ |
| 341 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 347 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
| 342 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 348 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
| @@ -364,7 +370,8 @@ enum { | |||
| 364 | CPU_FTRS_7450_21 | CPU_FTRS_7450_23 | CPU_FTRS_7455_1 | | 370 | CPU_FTRS_7450_21 | CPU_FTRS_7450_23 | CPU_FTRS_7455_1 | |
| 365 | CPU_FTRS_7455_20 | CPU_FTRS_7455 | CPU_FTRS_7447_10 | | 371 | CPU_FTRS_7455_20 | CPU_FTRS_7455 | CPU_FTRS_7447_10 | |
| 366 | CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX | | 372 | CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX | |
| 367 | CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_CLASSIC32 | | 373 | CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_E300C2 | |
| 374 | CPU_FTRS_CLASSIC32 | | ||
| 368 | #else | 375 | #else |
| 369 | CPU_FTRS_GENERIC_32 | | 376 | CPU_FTRS_GENERIC_32 | |
| 370 | #endif | 377 | #endif |
| @@ -403,7 +410,8 @@ enum { | |||
| 403 | CPU_FTRS_7450_21 & CPU_FTRS_7450_23 & CPU_FTRS_7455_1 & | 410 | CPU_FTRS_7450_21 & CPU_FTRS_7450_23 & CPU_FTRS_7455_1 & |
| 404 | CPU_FTRS_7455_20 & CPU_FTRS_7455 & CPU_FTRS_7447_10 & | 411 | CPU_FTRS_7455_20 & CPU_FTRS_7455 & CPU_FTRS_7447_10 & |
| 405 | CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX & | 412 | CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX & |
| 406 | CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_CLASSIC32 & | 413 | CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_E300C2 & |
| 414 | CPU_FTRS_CLASSIC32 & | ||
| 407 | #else | 415 | #else |
| 408 | CPU_FTRS_GENERIC_32 & | 416 | CPU_FTRS_GENERIC_32 & |
| 409 | #endif | 417 | #endif |
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h index fd4a5f5e33d1..d7a1bc1551c6 100644 --- a/include/asm-powerpc/dcr-native.h +++ b/include/asm-powerpc/dcr-native.h | |||
| @@ -20,8 +20,7 @@ | |||
| 20 | #ifndef _ASM_POWERPC_DCR_NATIVE_H | 20 | #ifndef _ASM_POWERPC_DCR_NATIVE_H |
| 21 | #define _ASM_POWERPC_DCR_NATIVE_H | 21 | #define _ASM_POWERPC_DCR_NATIVE_H |
| 22 | #ifdef __KERNEL__ | 22 | #ifdef __KERNEL__ |
| 23 | 23 | #ifndef __ASSEMBLY__ | |
| 24 | #include <asm/reg.h> | ||
| 25 | 24 | ||
| 26 | typedef struct {} dcr_host_t; | 25 | typedef struct {} dcr_host_t; |
| 27 | 26 | ||
| @@ -32,7 +31,41 @@ typedef struct {} dcr_host_t; | |||
| 32 | #define dcr_read(host, dcr_n) mfdcr(dcr_n) | 31 | #define dcr_read(host, dcr_n) mfdcr(dcr_n) |
| 33 | #define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value) | 32 | #define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value) |
| 34 | 33 | ||
| 34 | /* Device Control Registers */ | ||
| 35 | void __mtdcr(int reg, unsigned int val); | ||
| 36 | unsigned int __mfdcr(int reg); | ||
| 37 | #define mfdcr(rn) \ | ||
| 38 | ({unsigned int rval; \ | ||
| 39 | if (__builtin_constant_p(rn)) \ | ||
| 40 | asm volatile("mfdcr %0," __stringify(rn) \ | ||
| 41 | : "=r" (rval)); \ | ||
| 42 | else \ | ||
| 43 | rval = __mfdcr(rn); \ | ||
| 44 | rval;}) | ||
| 45 | |||
| 46 | #define mtdcr(rn, v) \ | ||
| 47 | do { \ | ||
| 48 | if (__builtin_constant_p(rn)) \ | ||
| 49 | asm volatile("mtdcr " __stringify(rn) ",%0" \ | ||
| 50 | : : "r" (v)); \ | ||
| 51 | else \ | ||
| 52 | __mtdcr(rn, v); \ | ||
| 53 | } while (0) | ||
| 54 | |||
| 55 | /* R/W of indirect DCRs make use of standard naming conventions for DCRs */ | ||
| 56 | #define mfdcri(base, reg) \ | ||
| 57 | ({ \ | ||
| 58 | mtdcr(base ## _CFGADDR, base ## _ ## reg); \ | ||
| 59 | mfdcr(base ## _CFGDATA); \ | ||
| 60 | }) | ||
| 61 | |||
| 62 | #define mtdcri(base, reg, data) \ | ||
| 63 | do { \ | ||
| 64 | mtdcr(base ## _CFGADDR, base ## _ ## reg); \ | ||
| 65 | mtdcr(base ## _CFGDATA, data); \ | ||
| 66 | } while (0) | ||
| 35 | 67 | ||
| 68 | #endif /* __ASSEMBLY__ */ | ||
| 36 | #endif /* __KERNEL__ */ | 69 | #endif /* __KERNEL__ */ |
| 37 | #endif /* _ASM_POWERPC_DCR_NATIVE_H */ | 70 | #endif /* _ASM_POWERPC_DCR_NATIVE_H */ |
| 38 | 71 | ||
diff --git a/include/asm-powerpc/dcr.h b/include/asm-powerpc/dcr.h index 473f2c7fd892..b66c5e6941f0 100644 --- a/include/asm-powerpc/dcr.h +++ b/include/asm-powerpc/dcr.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #ifndef _ASM_POWERPC_DCR_H | 20 | #ifndef _ASM_POWERPC_DCR_H |
| 21 | #define _ASM_POWERPC_DCR_H | 21 | #define _ASM_POWERPC_DCR_H |
| 22 | #ifdef __KERNEL__ | 22 | #ifdef __KERNEL__ |
| 23 | #ifdef CONFIG_PPC_DCR | ||
| 23 | 24 | ||
| 24 | #ifdef CONFIG_PPC_DCR_NATIVE | 25 | #ifdef CONFIG_PPC_DCR_NATIVE |
| 25 | #include <asm/dcr-native.h> | 26 | #include <asm/dcr-native.h> |
| @@ -38,5 +39,6 @@ extern unsigned int dcr_resource_len(struct device_node *np, | |||
| 38 | unsigned int index); | 39 | unsigned int index); |
| 39 | #endif /* CONFIG_PPC_MERGE */ | 40 | #endif /* CONFIG_PPC_MERGE */ |
| 40 | 41 | ||
| 42 | #endif /* CONFIG_PPC_DCR */ | ||
| 41 | #endif /* __KERNEL__ */ | 43 | #endif /* __KERNEL__ */ |
| 42 | #endif /* _ASM_POWERPC_DCR_H */ | 44 | #endif /* _ASM_POWERPC_DCR_H */ |
diff --git a/include/asm-powerpc/hw_irq.h b/include/asm-powerpc/hw_irq.h index d604863d72fb..9e4dd98eb220 100644 --- a/include/asm-powerpc/hw_irq.h +++ b/include/asm-powerpc/hw_irq.h | |||
| @@ -107,25 +107,6 @@ static inline void local_irq_save_ptr(unsigned long *flags) | |||
| 107 | 107 | ||
| 108 | #endif /* CONFIG_PPC64 */ | 108 | #endif /* CONFIG_PPC64 */ |
| 109 | 109 | ||
| 110 | #define mask_irq(irq) \ | ||
| 111 | ({ \ | ||
| 112 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
| 113 | if (desc->chip && desc->chip->disable) \ | ||
| 114 | desc->chip->disable(irq); \ | ||
| 115 | }) | ||
| 116 | #define unmask_irq(irq) \ | ||
| 117 | ({ \ | ||
| 118 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
| 119 | if (desc->chip && desc->chip->enable) \ | ||
| 120 | desc->chip->enable(irq); \ | ||
| 121 | }) | ||
| 122 | #define ack_irq(irq) \ | ||
| 123 | ({ \ | ||
| 124 | irq_desc_t *desc = get_irq_desc(irq); \ | ||
| 125 | if (desc->chip && desc->chip->ack) \ | ||
| 126 | desc->chip->ack(irq); \ | ||
| 127 | }) | ||
| 128 | |||
| 129 | /* | 110 | /* |
| 130 | * interrupt-retrigger: should we handle this via lost interrupts and IPIs | 111 | * interrupt-retrigger: should we handle this via lost interrupts and IPIs |
| 131 | * or should we not care like we do now ? --BenH. | 112 | * or should we not care like we do now ? --BenH. |
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h index 584fabfb4f08..e5f14b13ccf0 100644 --- a/include/asm-powerpc/module.h +++ b/include/asm-powerpc/module.h | |||
| @@ -46,8 +46,6 @@ struct mod_arch_specific { | |||
| 46 | unsigned int num_bugs; | 46 | unsigned int num_bugs; |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | extern struct bug_entry *module_find_bug(unsigned long bugaddr); | ||
| 50 | |||
| 51 | /* | 49 | /* |
| 52 | * Select ELF headers. | 50 | * Select ELF headers. |
| 53 | * Make empty section for module_frob_arch_sections to expand. | 51 | * Make empty section for module_frob_arch_sections to expand. |
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h index 7bb7f9009806..cb02c9d1ef93 100644 --- a/include/asm-powerpc/pci-bridge.h +++ b/include/asm-powerpc/pci-bridge.h | |||
| @@ -31,12 +31,12 @@ struct pci_controller { | |||
| 31 | int last_busno; | 31 | int last_busno; |
| 32 | 32 | ||
| 33 | void __iomem *io_base_virt; | 33 | void __iomem *io_base_virt; |
| 34 | unsigned long io_base_phys; | 34 | resource_size_t io_base_phys; |
| 35 | 35 | ||
| 36 | /* Some machines have a non 1:1 mapping of | 36 | /* Some machines have a non 1:1 mapping of |
| 37 | * the PCI memory space in the CPU bus space | 37 | * the PCI memory space in the CPU bus space |
| 38 | */ | 38 | */ |
| 39 | unsigned long pci_mem_offset; | 39 | resource_size_t pci_mem_offset; |
| 40 | unsigned long pci_io_size; | 40 | unsigned long pci_io_size; |
| 41 | 41 | ||
| 42 | struct pci_ops *ops; | 42 | struct pci_ops *ops; |
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h index 16f13319c769..ac656ee6bb19 100644 --- a/include/asm-powerpc/pci.h +++ b/include/asm-powerpc/pci.h | |||
| @@ -143,8 +143,13 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, | |||
| 143 | /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ | 143 | /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ |
| 144 | #define HAVE_PCI_MMAP 1 | 144 | #define HAVE_PCI_MMAP 1 |
| 145 | 145 | ||
| 146 | #ifdef CONFIG_PPC64 | 146 | #if defined(CONFIG_PPC64) || defined(CONFIG_NOT_COHERENT_CACHE) |
| 147 | /* pci_unmap_{single,page} is not a nop, thus... */ | 147 | /* |
| 148 | * For 64-bit kernels, pci_unmap_{single,page} is not a nop. | ||
| 149 | * For 32-bit non-coherent kernels, pci_dma_sync_single_for_cpu() and | ||
| 150 | * so on are not nops. | ||
| 151 | * and thus... | ||
| 152 | */ | ||
| 148 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ | 153 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ |
| 149 | dma_addr_t ADDR_NAME; | 154 | dma_addr_t ADDR_NAME; |
| 150 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ | 155 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ |
| @@ -158,6 +163,20 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, | |||
| 158 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ | 163 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ |
| 159 | (((PTR)->LEN_NAME) = (VAL)) | 164 | (((PTR)->LEN_NAME) = (VAL)) |
| 160 | 165 | ||
| 166 | #else /* 32-bit && coherent */ | ||
| 167 | |||
| 168 | /* pci_unmap_{page,single} is a nop so... */ | ||
| 169 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | ||
| 170 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | ||
| 171 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) | ||
| 172 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
| 173 | #define pci_unmap_len(PTR, LEN_NAME) (0) | ||
| 174 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
| 175 | |||
| 176 | #endif /* CONFIG_PPC64 || CONFIG_NOT_COHERENT_CACHE */ | ||
| 177 | |||
| 178 | #ifdef CONFIG_PPC64 | ||
| 179 | |||
| 161 | /* The PCI address space does not equal the physical memory address | 180 | /* The PCI address space does not equal the physical memory address |
| 162 | * space (we have an IOMMU). The IDE and SCSI device layers use | 181 | * space (we have an IOMMU). The IDE and SCSI device layers use |
| 163 | * this boolean for bounce buffer decisions. | 182 | * this boolean for bounce buffer decisions. |
| @@ -172,16 +191,8 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, | |||
| 172 | */ | 191 | */ |
| 173 | #define PCI_DMA_BUS_IS_PHYS (1) | 192 | #define PCI_DMA_BUS_IS_PHYS (1) |
| 174 | 193 | ||
| 175 | /* pci_unmap_{page,single} is a nop so... */ | ||
| 176 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | ||
| 177 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | ||
| 178 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) | ||
| 179 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) | ||
| 180 | #define pci_unmap_len(PTR, LEN_NAME) (0) | ||
| 181 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | ||
| 182 | |||
| 183 | #endif /* CONFIG_PPC64 */ | 194 | #endif /* CONFIG_PPC64 */ |
| 184 | 195 | ||
| 185 | extern void pcibios_resource_to_bus(struct pci_dev *dev, | 196 | extern void pcibios_resource_to_bus(struct pci_dev *dev, |
| 186 | struct pci_bus_region *region, | 197 | struct pci_bus_region *region, |
| 187 | struct resource *res); | 198 | struct resource *res); |
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h index 6faae7b14d55..a3631b15754c 100644 --- a/include/asm-powerpc/reg.h +++ b/include/asm-powerpc/reg.h | |||
| @@ -143,6 +143,7 @@ | |||
| 143 | 143 | ||
| 144 | /* Special Purpose Registers (SPRNs)*/ | 144 | /* Special Purpose Registers (SPRNs)*/ |
| 145 | #define SPRN_CTR 0x009 /* Count Register */ | 145 | #define SPRN_CTR 0x009 /* Count Register */ |
| 146 | #define SPRN_DSCR 0x11 | ||
| 146 | #define SPRN_CTRLF 0x088 | 147 | #define SPRN_CTRLF 0x088 |
| 147 | #define SPRN_CTRLT 0x098 | 148 | #define SPRN_CTRLT 0x098 |
| 148 | #define CTRL_CT 0xc0000000 /* current thread */ | 149 | #define CTRL_CT 0xc0000000 /* current thread */ |
| @@ -163,6 +164,7 @@ | |||
| 163 | #define SPRN_TBRU 0x10D /* Time Base Read Upper Register (user, R/O) */ | 164 | #define SPRN_TBRU 0x10D /* Time Base Read Upper Register (user, R/O) */ |
| 164 | #define SPRN_TBWL 0x11C /* Time Base Lower Register (super, R/W) */ | 165 | #define SPRN_TBWL 0x11C /* Time Base Lower Register (super, R/W) */ |
| 165 | #define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */ | 166 | #define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */ |
| 167 | #define SPRN_SPURR 0x134 /* Scaled PURR */ | ||
| 166 | #define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */ | 168 | #define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */ |
| 167 | #define SPRN_DBAT0L 0x219 /* Data BAT 0 Lower Register */ | 169 | #define SPRN_DBAT0L 0x219 /* Data BAT 0 Lower Register */ |
| 168 | #define SPRN_DBAT0U 0x218 /* Data BAT 0 Upper Register */ | 170 | #define SPRN_DBAT0U 0x218 /* Data BAT 0 Upper Register */ |
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h index 5a0c136c0416..8eaa7b28d9d0 100644 --- a/include/asm-powerpc/rtas.h +++ b/include/asm-powerpc/rtas.h | |||
| @@ -159,6 +159,7 @@ extern struct rtas_t rtas; | |||
| 159 | 159 | ||
| 160 | extern void enter_rtas(unsigned long); | 160 | extern void enter_rtas(unsigned long); |
| 161 | extern int rtas_token(const char *service); | 161 | extern int rtas_token(const char *service); |
| 162 | extern int rtas_service_present(const char *service); | ||
| 162 | extern int rtas_call(int token, int, int, int *, ...); | 163 | extern int rtas_call(int token, int, int, int *, ...); |
| 163 | extern void rtas_restart(char *cmd); | 164 | extern void rtas_restart(char *cmd); |
| 164 | extern void rtas_power_off(void); | 165 | extern void rtas_power_off(void); |
| @@ -221,8 +222,6 @@ extern int rtas_get_error_log_max(void); | |||
| 221 | extern spinlock_t rtas_data_buf_lock; | 222 | extern spinlock_t rtas_data_buf_lock; |
| 222 | extern char rtas_data_buf[RTAS_DATA_BUF_SIZE]; | 223 | extern char rtas_data_buf[RTAS_DATA_BUF_SIZE]; |
| 223 | 224 | ||
| 224 | extern void rtas_stop_self(void); | ||
| 225 | |||
| 226 | /* RMO buffer reserved for user-space RTAS use */ | 225 | /* RMO buffer reserved for user-space RTAS use */ |
| 227 | extern unsigned long rtas_rmo_buf; | 226 | extern unsigned long rtas_rmo_buf; |
| 228 | 227 | ||
diff --git a/include/asm-ppc/pci-bridge.h b/include/asm-ppc/pci-bridge.h index 6c955d0c1ef0..4d35b844bc58 100644 --- a/include/asm-ppc/pci-bridge.h +++ b/include/asm-ppc/pci-bridge.h | |||
| @@ -20,8 +20,8 @@ extern unsigned long pci_bus_mem_base_phys(unsigned int bus); | |||
| 20 | extern struct pci_controller* pcibios_alloc_controller(void); | 20 | extern struct pci_controller* pcibios_alloc_controller(void); |
| 21 | 21 | ||
| 22 | /* Helper function for setting up resources */ | 22 | /* Helper function for setting up resources */ |
| 23 | extern void pci_init_resource(struct resource *res, unsigned long start, | 23 | extern void pci_init_resource(struct resource *res, resource_size_t start, |
| 24 | unsigned long end, int flags, char *name); | 24 | resource_size_t end, int flags, char *name); |
| 25 | 25 | ||
| 26 | /* Get the PCI host controller for a bus */ | 26 | /* Get the PCI host controller for a bus */ |
| 27 | extern struct pci_controller* pci_bus_to_hose(int bus); | 27 | extern struct pci_controller* pci_bus_to_hose(int bus); |
| @@ -50,12 +50,12 @@ struct pci_controller { | |||
| 50 | int bus_offset; | 50 | int bus_offset; |
| 51 | 51 | ||
| 52 | void __iomem *io_base_virt; | 52 | void __iomem *io_base_virt; |
| 53 | unsigned long io_base_phys; | 53 | resource_size_t io_base_phys; |
| 54 | 54 | ||
| 55 | /* Some machines (PReP) have a non 1:1 mapping of | 55 | /* Some machines (PReP) have a non 1:1 mapping of |
| 56 | * the PCI memory space in the CPU bus space | 56 | * the PCI memory space in the CPU bus space |
| 57 | */ | 57 | */ |
| 58 | unsigned long pci_mem_offset; | 58 | resource_size_t pci_mem_offset; |
| 59 | 59 | ||
| 60 | struct pci_ops *ops; | 60 | struct pci_ops *ops; |
| 61 | volatile unsigned int __iomem *cfg_addr; | 61 | volatile unsigned int __iomem *cfg_addr; |
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h index 11ffaaa5da16..9d162028dab9 100644 --- a/include/asm-ppc/pci.h +++ b/include/asm-ppc/pci.h | |||
| @@ -61,6 +61,27 @@ extern unsigned long pci_bus_to_phys(unsigned int ba, int busnr); | |||
| 61 | */ | 61 | */ |
| 62 | #define PCI_DMA_BUS_IS_PHYS (1) | 62 | #define PCI_DMA_BUS_IS_PHYS (1) |
| 63 | 63 | ||
| 64 | #ifdef CONFIG_NOT_COHERENT_CACHE | ||
| 65 | /* | ||
| 66 | * pci_unmap_{page,single} are NOPs but pci_dma_sync_single_for_cpu() | ||
| 67 | * and so on are not, so... | ||
| 68 | */ | ||
| 69 | |||
| 70 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ | ||
| 71 | dma_addr_t ADDR_NAME; | ||
| 72 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ | ||
| 73 | __u32 LEN_NAME; | ||
| 74 | #define pci_unmap_addr(PTR, ADDR_NAME) \ | ||
| 75 | ((PTR)->ADDR_NAME) | ||
| 76 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \ | ||
| 77 | (((PTR)->ADDR_NAME) = (VAL)) | ||
| 78 | #define pci_unmap_len(PTR, LEN_NAME) \ | ||
| 79 | ((PTR)->LEN_NAME) | ||
| 80 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ | ||
| 81 | (((PTR)->LEN_NAME) = (VAL)) | ||
| 82 | |||
| 83 | #else /* coherent */ | ||
| 84 | |||
| 64 | /* pci_unmap_{page,single} is a nop so... */ | 85 | /* pci_unmap_{page,single} is a nop so... */ |
| 65 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | 86 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) |
| 66 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) | 87 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) |
| @@ -69,6 +90,8 @@ extern unsigned long pci_bus_to_phys(unsigned int ba, int busnr); | |||
| 69 | #define pci_unmap_len(PTR, LEN_NAME) (0) | 90 | #define pci_unmap_len(PTR, LEN_NAME) (0) |
| 70 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) | 91 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) |
| 71 | 92 | ||
| 93 | #endif /* CONFIG_NOT_COHERENT_CACHE */ | ||
| 94 | |||
| 72 | #ifdef CONFIG_PCI | 95 | #ifdef CONFIG_PCI |
| 73 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | 96 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
| 74 | enum pci_dma_burst_strategy *strat, | 97 | enum pci_dma_burst_strategy *strat, |
diff --git a/include/asm-ppc/reg_booke.h b/include/asm-ppc/reg_booke.h index 602fbadeaf48..a263fc1e65c4 100644 --- a/include/asm-ppc/reg_booke.h +++ b/include/asm-ppc/reg_booke.h | |||
| @@ -9,41 +9,9 @@ | |||
| 9 | #ifndef __ASM_PPC_REG_BOOKE_H__ | 9 | #ifndef __ASM_PPC_REG_BOOKE_H__ |
| 10 | #define __ASM_PPC_REG_BOOKE_H__ | 10 | #define __ASM_PPC_REG_BOOKE_H__ |
| 11 | 11 | ||
| 12 | #ifndef __ASSEMBLY__ | 12 | #include <asm/dcr.h> |
| 13 | /* Device Control Registers */ | ||
| 14 | void __mtdcr(int reg, unsigned int val); | ||
| 15 | unsigned int __mfdcr(int reg); | ||
| 16 | #define mfdcr(rn) \ | ||
| 17 | ({unsigned int rval; \ | ||
| 18 | if (__builtin_constant_p(rn)) \ | ||
| 19 | asm volatile("mfdcr %0," __stringify(rn) \ | ||
| 20 | : "=r" (rval)); \ | ||
| 21 | else \ | ||
| 22 | rval = __mfdcr(rn); \ | ||
| 23 | rval;}) | ||
| 24 | |||
| 25 | #define mtdcr(rn, v) \ | ||
| 26 | do { \ | ||
| 27 | if (__builtin_constant_p(rn)) \ | ||
| 28 | asm volatile("mtdcr " __stringify(rn) ",%0" \ | ||
| 29 | : : "r" (v)); \ | ||
| 30 | else \ | ||
| 31 | __mtdcr(rn, v); \ | ||
| 32 | } while (0) | ||
| 33 | |||
| 34 | /* R/W of indirect DCRs make use of standard naming conventions for DCRs */ | ||
| 35 | #define mfdcri(base, reg) \ | ||
| 36 | ({ \ | ||
| 37 | mtdcr(base ## _CFGADDR, base ## _ ## reg); \ | ||
| 38 | mfdcr(base ## _CFGDATA); \ | ||
| 39 | }) | ||
| 40 | |||
| 41 | #define mtdcri(base, reg, data) \ | ||
| 42 | do { \ | ||
| 43 | mtdcr(base ## _CFGADDR, base ## _ ## reg); \ | ||
| 44 | mtdcr(base ## _CFGDATA, data); \ | ||
| 45 | } while (0) | ||
| 46 | 13 | ||
| 14 | #ifndef __ASSEMBLY__ | ||
| 47 | /* Performance Monitor Registers */ | 15 | /* Performance Monitor Registers */ |
| 48 | #define mfpmr(rn) ({unsigned int rval; \ | 16 | #define mfpmr(rn) ({unsigned int rval; \ |
| 49 | asm volatile("mfpmr %0," __stringify(rn) \ | 17 | asm volatile("mfpmr %0," __stringify(rn) \ |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 3da29e2d524a..abb64c437f6f 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #define _FSL_DEVICE_H_ | 19 | #define _FSL_DEVICE_H_ |
| 20 | 20 | ||
| 21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 22 | #include <linux/phy.h> | ||
| 22 | 23 | ||
| 23 | /* | 24 | /* |
| 24 | * Some conventions on how we handle peripherals on Freescale chips | 25 | * Some conventions on how we handle peripherals on Freescale chips |
