diff options
120 files changed, 726 insertions, 2892 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 50fb3ae5f313..931e6e40c08b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2780,14 +2780,7 @@ S: Maintained | |||
2780 | UltraSPARC (sparc64): | 2780 | UltraSPARC (sparc64): |
2781 | P: David S. Miller | 2781 | P: David S. Miller |
2782 | M: davem@davemloft.net | 2782 | M: davem@davemloft.net |
2783 | P: Eddie C. Dost | ||
2784 | M: ecd@brainaid.de | ||
2785 | P: Jakub Jelinek | ||
2786 | M: jj@sunsite.ms.mff.cuni.cz | ||
2787 | P: Anton Blanchard | ||
2788 | M: anton@samba.org | ||
2789 | L: sparclinux@vger.kernel.org | 2783 | L: sparclinux@vger.kernel.org |
2790 | L: ultralinux@vger.kernel.org | ||
2791 | T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git | 2784 | T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git |
2792 | S: Maintained | 2785 | S: Maintained |
2793 | 2786 | ||
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c index be769ef326a2..424e9257c9a0 100644 --- a/arch/ia64/hp/sim/simeth.c +++ b/arch/ia64/hp/sim/simeth.c | |||
@@ -87,7 +87,7 @@ static int simeth_debug; /* set to 1 to get debug information */ | |||
87 | */ | 87 | */ |
88 | static struct notifier_block simeth_dev_notifier = { | 88 | static struct notifier_block simeth_dev_notifier = { |
89 | simeth_device_event, | 89 | simeth_device_event, |
90 | 0 | 90 | NULL |
91 | }; | 91 | }; |
92 | 92 | ||
93 | 93 | ||
diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c index 8f0a16a79a67..bb87682bbb1b 100644 --- a/arch/ia64/hp/sim/simscsi.c +++ b/arch/ia64/hp/sim/simscsi.c | |||
@@ -103,7 +103,7 @@ simscsi_interrupt (unsigned long val) | |||
103 | 103 | ||
104 | while ((sc = queue[rd].sc) != 0) { | 104 | while ((sc = queue[rd].sc) != 0) { |
105 | atomic_dec(&num_reqs); | 105 | atomic_dec(&num_reqs); |
106 | queue[rd].sc = 0; | 106 | queue[rd].sc = NULL; |
107 | if (DBG) | 107 | if (DBG) |
108 | printk("simscsi_interrupt: done with %ld\n", sc->serial_number); | 108 | printk("simscsi_interrupt: done with %ld\n", sc->serial_number); |
109 | (*sc->scsi_done)(sc); | 109 | (*sc->scsi_done)(sc); |
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 5095778be53c..caab986af70c 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c | |||
@@ -92,7 +92,7 @@ static struct serial_uart_config uart_config[] = { | |||
92 | { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO | | 92 | { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO | |
93 | UART_STARTECH }, | 93 | UART_STARTECH }, |
94 | { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO}, | 94 | { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO}, |
95 | { 0, 0} | 95 | { NULL, 0} |
96 | }; | 96 | }; |
97 | 97 | ||
98 | struct tty_driver *hp_simserial_driver; | 98 | struct tty_driver *hp_simserial_driver; |
@@ -555,7 +555,7 @@ static void shutdown(struct async_struct * info) | |||
555 | 555 | ||
556 | if (info->xmit.buf) { | 556 | if (info->xmit.buf) { |
557 | free_page((unsigned long) info->xmit.buf); | 557 | free_page((unsigned long) info->xmit.buf); |
558 | info->xmit.buf = 0; | 558 | info->xmit.buf = NULL; |
559 | } | 559 | } |
560 | 560 | ||
561 | if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); | 561 | if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); |
@@ -628,7 +628,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
628 | if (tty->driver->flush_buffer) tty->driver->flush_buffer(tty); | 628 | if (tty->driver->flush_buffer) tty->driver->flush_buffer(tty); |
629 | if (tty->ldisc.flush_buffer) tty->ldisc.flush_buffer(tty); | 629 | if (tty->ldisc.flush_buffer) tty->ldisc.flush_buffer(tty); |
630 | info->event = 0; | 630 | info->event = 0; |
631 | info->tty = 0; | 631 | info->tty = NULL; |
632 | if (info->blocked_open) { | 632 | if (info->blocked_open) { |
633 | if (info->close_delay) | 633 | if (info->close_delay) |
634 | schedule_timeout_interruptible(info->close_delay); | 634 | schedule_timeout_interruptible(info->close_delay); |
@@ -668,7 +668,7 @@ static void rs_hangup(struct tty_struct *tty) | |||
668 | info->event = 0; | 668 | info->event = 0; |
669 | state->count = 0; | 669 | state->count = 0; |
670 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 670 | info->flags &= ~ASYNC_NORMAL_ACTIVE; |
671 | info->tty = 0; | 671 | info->tty = NULL; |
672 | wake_up_interruptible(&info->open_wait); | 672 | wake_up_interruptible(&info->open_wait); |
673 | } | 673 | } |
674 | 674 | ||
@@ -769,7 +769,7 @@ startup(struct async_struct *info) | |||
769 | /* | 769 | /* |
770 | * Insert serial port into IRQ chain. | 770 | * Insert serial port into IRQ chain. |
771 | */ | 771 | */ |
772 | info->prev_port = 0; | 772 | info->prev_port = NULL; |
773 | info->next_port = IRQ_ports[state->irq]; | 773 | info->next_port = IRQ_ports[state->irq]; |
774 | if (info->next_port) | 774 | if (info->next_port) |
775 | info->next_port->prev_port = info; | 775 | info->next_port->prev_port = info; |
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_ate.c b/arch/ia64/sn/pci/pcibr/pcibr_ate.c index 5eb1e1e078b4..935029fc400d 100644 --- a/arch/ia64/sn/pci/pcibr/pcibr_ate.c +++ b/arch/ia64/sn/pci/pcibr/pcibr_ate.c | |||
@@ -126,7 +126,7 @@ int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count) | |||
126 | * Setup an Address Translation Entry as specified. Use either the Bridge | 126 | * Setup an Address Translation Entry as specified. Use either the Bridge |
127 | * internal maps or the external map RAM, as appropriate. | 127 | * internal maps or the external map RAM, as appropriate. |
128 | */ | 128 | */ |
129 | static inline u64 *pcibr_ate_addr(struct pcibus_info *pcibus_info, | 129 | static inline u64 __iomem *pcibr_ate_addr(struct pcibus_info *pcibus_info, |
130 | int ate_index) | 130 | int ate_index) |
131 | { | 131 | { |
132 | if (ate_index < pcibus_info->pbi_int_ate_size) { | 132 | if (ate_index < pcibus_info->pbi_int_ate_size) { |
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c index 0e81f68aaf8e..46e16dcf5971 100644 --- a/arch/ia64/sn/pci/tioce_provider.c +++ b/arch/ia64/sn/pci/tioce_provider.c | |||
@@ -53,7 +53,7 @@ | |||
53 | */ | 53 | */ |
54 | 54 | ||
55 | static void inline | 55 | static void inline |
56 | tioce_mmr_war_pre(struct tioce_kernel *kern, void *mmr_addr) | 56 | tioce_mmr_war_pre(struct tioce_kernel *kern, void __iomem *mmr_addr) |
57 | { | 57 | { |
58 | u64 mmr_base; | 58 | u64 mmr_base; |
59 | u64 mmr_offset; | 59 | u64 mmr_offset; |
@@ -62,7 +62,7 @@ tioce_mmr_war_pre(struct tioce_kernel *kern, void *mmr_addr) | |||
62 | return; | 62 | return; |
63 | 63 | ||
64 | mmr_base = kern->ce_common->ce_pcibus.bs_base; | 64 | mmr_base = kern->ce_common->ce_pcibus.bs_base; |
65 | mmr_offset = (u64)mmr_addr - mmr_base; | 65 | mmr_offset = (unsigned long)mmr_addr - mmr_base; |
66 | 66 | ||
67 | if (mmr_offset < 0x45000) { | 67 | if (mmr_offset < 0x45000) { |
68 | u64 mmr_war_offset; | 68 | u64 mmr_war_offset; |
@@ -79,7 +79,7 @@ tioce_mmr_war_pre(struct tioce_kernel *kern, void *mmr_addr) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | static void inline | 81 | static void inline |
82 | tioce_mmr_war_post(struct tioce_kernel *kern, void *mmr_addr) | 82 | tioce_mmr_war_post(struct tioce_kernel *kern, void __iomem *mmr_addr) |
83 | { | 83 | { |
84 | u64 mmr_base; | 84 | u64 mmr_base; |
85 | u64 mmr_offset; | 85 | u64 mmr_offset; |
@@ -88,7 +88,7 @@ tioce_mmr_war_post(struct tioce_kernel *kern, void *mmr_addr) | |||
88 | return; | 88 | return; |
89 | 89 | ||
90 | mmr_base = kern->ce_common->ce_pcibus.bs_base; | 90 | mmr_base = kern->ce_common->ce_pcibus.bs_base; |
91 | mmr_offset = (u64)mmr_addr - mmr_base; | 91 | mmr_offset = (unsigned long)mmr_addr - mmr_base; |
92 | 92 | ||
93 | if (mmr_offset < 0x45000) { | 93 | if (mmr_offset < 0x45000) { |
94 | if (mmr_offset == 0x100) | 94 | if (mmr_offset == 0x100) |
@@ -223,7 +223,7 @@ tioce_dma_d64(unsigned long ct_addr, int dma_flags) | |||
223 | * @pci_dev. | 223 | * @pci_dev. |
224 | */ | 224 | */ |
225 | static inline void | 225 | static inline void |
226 | pcidev_to_tioce(struct pci_dev *pdev, struct tioce **base, | 226 | pcidev_to_tioce(struct pci_dev *pdev, struct tioce __iomem **base, |
227 | struct tioce_kernel **kernel, int *port) | 227 | struct tioce_kernel **kernel, int *port) |
228 | { | 228 | { |
229 | struct pcidev_info *pcidev_info; | 229 | struct pcidev_info *pcidev_info; |
@@ -235,7 +235,7 @@ pcidev_to_tioce(struct pci_dev *pdev, struct tioce **base, | |||
235 | ce_kernel = (struct tioce_kernel *)ce_common->ce_kernel_private; | 235 | ce_kernel = (struct tioce_kernel *)ce_common->ce_kernel_private; |
236 | 236 | ||
237 | if (base) | 237 | if (base) |
238 | *base = (struct tioce *)ce_common->ce_pcibus.bs_base; | 238 | *base = (struct tioce __iomem *)ce_common->ce_pcibus.bs_base; |
239 | if (kernel) | 239 | if (kernel) |
240 | *kernel = ce_kernel; | 240 | *kernel = ce_kernel; |
241 | 241 | ||
@@ -275,13 +275,13 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port, | |||
275 | u64 pagesize; | 275 | u64 pagesize; |
276 | int msi_capable, msi_wanted; | 276 | int msi_capable, msi_wanted; |
277 | u64 *ate_shadow; | 277 | u64 *ate_shadow; |
278 | u64 *ate_reg; | 278 | u64 __iomem *ate_reg; |
279 | u64 addr; | 279 | u64 addr; |
280 | struct tioce *ce_mmr; | 280 | struct tioce __iomem *ce_mmr; |
281 | u64 bus_base; | 281 | u64 bus_base; |
282 | struct tioce_dmamap *map; | 282 | struct tioce_dmamap *map; |
283 | 283 | ||
284 | ce_mmr = (struct tioce *)ce_kern->ce_common->ce_pcibus.bs_base; | 284 | ce_mmr = (struct tioce __iomem *)ce_kern->ce_common->ce_pcibus.bs_base; |
285 | 285 | ||
286 | switch (type) { | 286 | switch (type) { |
287 | case TIOCE_ATE_M32: | 287 | case TIOCE_ATE_M32: |
@@ -386,7 +386,7 @@ tioce_dma_d32(struct pci_dev *pdev, u64 ct_addr, int dma_flags) | |||
386 | { | 386 | { |
387 | int dma_ok; | 387 | int dma_ok; |
388 | int port; | 388 | int port; |
389 | struct tioce *ce_mmr; | 389 | struct tioce __iomem *ce_mmr; |
390 | struct tioce_kernel *ce_kern; | 390 | struct tioce_kernel *ce_kern; |
391 | u64 ct_upper; | 391 | u64 ct_upper; |
392 | u64 ct_lower; | 392 | u64 ct_lower; |
@@ -461,7 +461,7 @@ tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir) | |||
461 | int i; | 461 | int i; |
462 | int port; | 462 | int port; |
463 | struct tioce_kernel *ce_kern; | 463 | struct tioce_kernel *ce_kern; |
464 | struct tioce *ce_mmr; | 464 | struct tioce __iomem *ce_mmr; |
465 | unsigned long flags; | 465 | unsigned long flags; |
466 | 466 | ||
467 | bus_addr = tioce_dma_barrier(bus_addr, 0); | 467 | bus_addr = tioce_dma_barrier(bus_addr, 0); |
@@ -700,9 +700,9 @@ static void | |||
700 | tioce_reserve_m32(struct tioce_kernel *ce_kern, u64 base, u64 limit) | 700 | tioce_reserve_m32(struct tioce_kernel *ce_kern, u64 base, u64 limit) |
701 | { | 701 | { |
702 | int ate_index, last_ate, ps; | 702 | int ate_index, last_ate, ps; |
703 | struct tioce *ce_mmr; | 703 | struct tioce __iomem *ce_mmr; |
704 | 704 | ||
705 | ce_mmr = (struct tioce *)ce_kern->ce_common->ce_pcibus.bs_base; | 705 | ce_mmr = (struct tioce __iomem *)ce_kern->ce_common->ce_pcibus.bs_base; |
706 | ps = ce_kern->ce_ate3240_pagesize; | 706 | ps = ce_kern->ce_ate3240_pagesize; |
707 | ate_index = ATE_PAGE(base, ps); | 707 | ate_index = ATE_PAGE(base, ps); |
708 | last_ate = ate_index + ATE_NPAGES(base, limit-base+1, ps) - 1; | 708 | last_ate = ate_index + ATE_NPAGES(base, limit-base+1, ps) - 1; |
@@ -736,7 +736,7 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
736 | int dev; | 736 | int dev; |
737 | u32 tmp; | 737 | u32 tmp; |
738 | unsigned int seg, bus; | 738 | unsigned int seg, bus; |
739 | struct tioce *tioce_mmr; | 739 | struct tioce __iomem *tioce_mmr; |
740 | struct tioce_kernel *tioce_kern; | 740 | struct tioce_kernel *tioce_kern; |
741 | 741 | ||
742 | tioce_kern = kzalloc(sizeof(struct tioce_kernel), GFP_KERNEL); | 742 | tioce_kern = kzalloc(sizeof(struct tioce_kernel), GFP_KERNEL); |
@@ -767,7 +767,7 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
767 | * the ate's. | 767 | * the ate's. |
768 | */ | 768 | */ |
769 | 769 | ||
770 | tioce_mmr = (struct tioce *)tioce_common->ce_pcibus.bs_base; | 770 | tioce_mmr = (struct tioce __iomem *)tioce_common->ce_pcibus.bs_base; |
771 | tioce_mmr_clri(tioce_kern, &tioce_mmr->ce_ure_page_map, | 771 | tioce_mmr_clri(tioce_kern, &tioce_mmr->ce_ure_page_map, |
772 | CE_URE_PAGESIZE_MASK); | 772 | CE_URE_PAGESIZE_MASK); |
773 | tioce_mmr_seti(tioce_kern, &tioce_mmr->ce_ure_page_map, | 773 | tioce_mmr_seti(tioce_kern, &tioce_mmr->ce_ure_page_map, |
@@ -858,7 +858,7 @@ tioce_force_interrupt(struct sn_irq_info *sn_irq_info) | |||
858 | struct pcidev_info *pcidev_info; | 858 | struct pcidev_info *pcidev_info; |
859 | struct tioce_common *ce_common; | 859 | struct tioce_common *ce_common; |
860 | struct tioce_kernel *ce_kern; | 860 | struct tioce_kernel *ce_kern; |
861 | struct tioce *ce_mmr; | 861 | struct tioce __iomem *ce_mmr; |
862 | u64 force_int_val; | 862 | u64 force_int_val; |
863 | 863 | ||
864 | if (!sn_irq_info->irq_bridge) | 864 | if (!sn_irq_info->irq_bridge) |
@@ -872,7 +872,7 @@ tioce_force_interrupt(struct sn_irq_info *sn_irq_info) | |||
872 | return; | 872 | return; |
873 | 873 | ||
874 | ce_common = (struct tioce_common *)pcidev_info->pdi_pcibus_info; | 874 | ce_common = (struct tioce_common *)pcidev_info->pdi_pcibus_info; |
875 | ce_mmr = (struct tioce *)ce_common->ce_pcibus.bs_base; | 875 | ce_mmr = (struct tioce __iomem *)ce_common->ce_pcibus.bs_base; |
876 | ce_kern = (struct tioce_kernel *)ce_common->ce_kernel_private; | 876 | ce_kern = (struct tioce_kernel *)ce_common->ce_kernel_private; |
877 | 877 | ||
878 | /* | 878 | /* |
@@ -953,7 +953,7 @@ tioce_target_interrupt(struct sn_irq_info *sn_irq_info) | |||
953 | struct pcidev_info *pcidev_info; | 953 | struct pcidev_info *pcidev_info; |
954 | struct tioce_common *ce_common; | 954 | struct tioce_common *ce_common; |
955 | struct tioce_kernel *ce_kern; | 955 | struct tioce_kernel *ce_kern; |
956 | struct tioce *ce_mmr; | 956 | struct tioce __iomem *ce_mmr; |
957 | int bit; | 957 | int bit; |
958 | u64 vector; | 958 | u64 vector; |
959 | 959 | ||
@@ -962,7 +962,7 @@ tioce_target_interrupt(struct sn_irq_info *sn_irq_info) | |||
962 | return; | 962 | return; |
963 | 963 | ||
964 | ce_common = (struct tioce_common *)pcidev_info->pdi_pcibus_info; | 964 | ce_common = (struct tioce_common *)pcidev_info->pdi_pcibus_info; |
965 | ce_mmr = (struct tioce *)ce_common->ce_pcibus.bs_base; | 965 | ce_mmr = (struct tioce __iomem *)ce_common->ce_pcibus.bs_base; |
966 | ce_kern = (struct tioce_kernel *)ce_common->ce_kernel_private; | 966 | ce_kern = (struct tioce_kernel *)ce_common->ce_kernel_private; |
967 | 967 | ||
968 | bit = sn_irq_info->irq_int_bit; | 968 | bit = sn_irq_info->irq_int_bit; |
@@ -994,7 +994,7 @@ tioce_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont | |||
994 | cnodeid_t my_cnode, mem_cnode; | 994 | cnodeid_t my_cnode, mem_cnode; |
995 | struct tioce_common *tioce_common; | 995 | struct tioce_common *tioce_common; |
996 | struct tioce_kernel *tioce_kern; | 996 | struct tioce_kernel *tioce_kern; |
997 | struct tioce *tioce_mmr; | 997 | struct tioce __iomem *tioce_mmr; |
998 | 998 | ||
999 | /* | 999 | /* |
1000 | * Allocate kernel bus soft and copy from prom. | 1000 | * Allocate kernel bus soft and copy from prom. |
@@ -1018,7 +1018,7 @@ tioce_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont | |||
1018 | * interrupt handler. | 1018 | * interrupt handler. |
1019 | */ | 1019 | */ |
1020 | 1020 | ||
1021 | tioce_mmr = (struct tioce *)tioce_common->ce_pcibus.bs_base; | 1021 | tioce_mmr = (struct tioce __iomem *)tioce_common->ce_pcibus.bs_base; |
1022 | tioce_mmr_seti(tioce_kern, &tioce_mmr->ce_adm_int_status_alias, ~0ULL); | 1022 | tioce_mmr_seti(tioce_kern, &tioce_mmr->ce_adm_int_status_alias, ~0ULL); |
1023 | tioce_mmr_seti(tioce_kern, &tioce_mmr->ce_adm_error_summary_alias, | 1023 | tioce_mmr_seti(tioce_kern, &tioce_mmr->ce_adm_error_summary_alias, |
1024 | ~0ULL); | 1024 | ~0ULL); |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 731b942a824b..14af6cce2fa2 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1010,11 +1010,6 @@ endchoice | |||
1010 | config ARC32 | 1010 | config ARC32 |
1011 | bool | 1011 | bool |
1012 | 1012 | ||
1013 | config AU1X00_USB_DEVICE | ||
1014 | bool | ||
1015 | depends on MIPS_PB1500 || MIPS_PB1100 || MIPS_PB1000 | ||
1016 | default n | ||
1017 | |||
1018 | config BOOT_ELF32 | 1013 | config BOOT_ELF32 |
1019 | bool | 1014 | bool |
1020 | 1015 | ||
diff --git a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile index bf682f50b859..4c35525edb4f 100644 --- a/arch/mips/au1000/common/Makefile +++ b/arch/mips/au1000/common/Makefile | |||
@@ -10,6 +10,5 @@ obj-y += prom.o irq.o puts.o time.o reset.o \ | |||
10 | au1xxx_irqmap.o clocks.o platform.o power.o setup.o \ | 10 | au1xxx_irqmap.o clocks.o platform.o power.o setup.o \ |
11 | sleeper.o cputable.o dma.o dbdma.o gpio.o | 11 | sleeper.o cputable.o dma.o dbdma.o gpio.o |
12 | 12 | ||
13 | obj-$(CONFIG_AU1X00_USB_DEVICE) += usbdev.o | ||
14 | obj-$(CONFIG_KGDB) += dbg_io.o | 13 | obj-$(CONFIG_KGDB) += dbg_io.o |
15 | obj-$(CONFIG_PCI) += pci.o | 14 | obj-$(CONFIG_PCI) += pci.o |
diff --git a/arch/mips/au1000/common/usbdev.c b/arch/mips/au1000/common/usbdev.c deleted file mode 100644 index 70dc82e536cd..000000000000 --- a/arch/mips/au1000/common/usbdev.c +++ /dev/null | |||
@@ -1,1552 +0,0 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Au1000 USB Device-Side (device layer) | ||
4 | * | ||
5 | * Copyright 2001-2002 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * stevel@mvista.com or source@mvista.com | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/ioport.h> | ||
31 | #include <linux/sched.h> | ||
32 | #include <linux/signal.h> | ||
33 | #include <linux/errno.h> | ||
34 | #include <linux/poll.h> | ||
35 | #include <linux/init.h> | ||
36 | #include <linux/slab.h> | ||
37 | #include <linux/fcntl.h> | ||
38 | #include <linux/module.h> | ||
39 | #include <linux/spinlock.h> | ||
40 | #include <linux/list.h> | ||
41 | #include <linux/smp_lock.h> | ||
42 | #define DEBUG | ||
43 | #include <linux/usb.h> | ||
44 | |||
45 | #include <asm/io.h> | ||
46 | #include <asm/uaccess.h> | ||
47 | #include <asm/irq.h> | ||
48 | #include <asm/mipsregs.h> | ||
49 | #include <asm/au1000.h> | ||
50 | #include <asm/au1000_dma.h> | ||
51 | #include <asm/au1000_usbdev.h> | ||
52 | |||
53 | #ifdef DEBUG | ||
54 | #undef VDEBUG | ||
55 | #ifdef VDEBUG | ||
56 | #define vdbg(fmt, arg...) printk(KERN_DEBUG __FILE__ ": " fmt "\n" , ## arg) | ||
57 | #else | ||
58 | #define vdbg(fmt, arg...) do {} while (0) | ||
59 | #endif | ||
60 | #else | ||
61 | #define vdbg(fmt, arg...) do {} while (0) | ||
62 | #endif | ||
63 | |||
64 | #define ALLOC_FLAGS (in_interrupt () ? GFP_ATOMIC : GFP_KERNEL) | ||
65 | |||
66 | #define EP_FIFO_DEPTH 8 | ||
67 | |||
68 | typedef enum { | ||
69 | SETUP_STAGE = 0, | ||
70 | DATA_STAGE, | ||
71 | STATUS_STAGE | ||
72 | } ep0_stage_t; | ||
73 | |||
74 | typedef struct { | ||
75 | int read_fifo; | ||
76 | int write_fifo; | ||
77 | int ctrl_stat; | ||
78 | int read_fifo_status; | ||
79 | int write_fifo_status; | ||
80 | } endpoint_reg_t; | ||
81 | |||
82 | typedef struct { | ||
83 | usbdev_pkt_t *head; | ||
84 | usbdev_pkt_t *tail; | ||
85 | int count; | ||
86 | } pkt_list_t; | ||
87 | |||
88 | typedef struct { | ||
89 | int active; | ||
90 | struct usb_endpoint_descriptor *desc; | ||
91 | endpoint_reg_t *reg; | ||
92 | /* Only one of these are used, unless this is the control ep */ | ||
93 | pkt_list_t inlist; | ||
94 | pkt_list_t outlist; | ||
95 | unsigned int indma, outdma; /* DMA channel numbers for IN, OUT */ | ||
96 | /* following are extracted from endpoint descriptor for easy access */ | ||
97 | int max_pkt_size; | ||
98 | int type; | ||
99 | int direction; | ||
100 | /* WE assign endpoint addresses! */ | ||
101 | int address; | ||
102 | spinlock_t lock; | ||
103 | } endpoint_t; | ||
104 | |||
105 | |||
106 | static struct usb_dev { | ||
107 | endpoint_t ep[6]; | ||
108 | ep0_stage_t ep0_stage; | ||
109 | |||
110 | struct usb_device_descriptor * dev_desc; | ||
111 | struct usb_interface_descriptor* if_desc; | ||
112 | struct usb_config_descriptor * conf_desc; | ||
113 | u8 * full_conf_desc; | ||
114 | struct usb_string_descriptor * str_desc[6]; | ||
115 | |||
116 | /* callback to function layer */ | ||
117 | void (*func_cb)(usbdev_cb_type_t type, unsigned long arg, | ||
118 | void *cb_data); | ||
119 | void* cb_data; | ||
120 | |||
121 | usbdev_state_t state; // device state | ||
122 | int suspended; // suspended flag | ||
123 | int address; // device address | ||
124 | int interface; | ||
125 | int num_ep; | ||
126 | u8 alternate_setting; | ||
127 | u8 configuration; // configuration value | ||
128 | int remote_wakeup_en; | ||
129 | } usbdev; | ||
130 | |||
131 | |||
132 | static endpoint_reg_t ep_reg[] = { | ||
133 | // FIFO's 0 and 1 are EP0 default control | ||
134 | {USBD_EP0RD, USBD_EP0WR, USBD_EP0CS, USBD_EP0RDSTAT, USBD_EP0WRSTAT }, | ||
135 | {0}, | ||
136 | // FIFO 2 is EP2, IN | ||
137 | { -1, USBD_EP2WR, USBD_EP2CS, -1, USBD_EP2WRSTAT }, | ||
138 | // FIFO 3 is EP3, IN | ||
139 | { -1, USBD_EP3WR, USBD_EP3CS, -1, USBD_EP3WRSTAT }, | ||
140 | // FIFO 4 is EP4, OUT | ||
141 | {USBD_EP4RD, -1, USBD_EP4CS, USBD_EP4RDSTAT, -1 }, | ||
142 | // FIFO 5 is EP5, OUT | ||
143 | {USBD_EP5RD, -1, USBD_EP5CS, USBD_EP5RDSTAT, -1 } | ||
144 | }; | ||
145 | |||
146 | static struct { | ||
147 | unsigned int id; | ||
148 | const char *str; | ||
149 | } ep_dma_id[] = { | ||
150 | { DMA_ID_USBDEV_EP0_TX, "USBDev EP0 IN" }, | ||
151 | { DMA_ID_USBDEV_EP0_RX, "USBDev EP0 OUT" }, | ||
152 | { DMA_ID_USBDEV_EP2_TX, "USBDev EP2 IN" }, | ||
153 | { DMA_ID_USBDEV_EP3_TX, "USBDev EP3 IN" }, | ||
154 | { DMA_ID_USBDEV_EP4_RX, "USBDev EP4 OUT" }, | ||
155 | { DMA_ID_USBDEV_EP5_RX, "USBDev EP5 OUT" } | ||
156 | }; | ||
157 | |||
158 | #define DIR_OUT 0 | ||
159 | #define DIR_IN (1<<3) | ||
160 | |||
161 | #define CONTROL_EP USB_ENDPOINT_XFER_CONTROL | ||
162 | #define BULK_EP USB_ENDPOINT_XFER_BULK | ||
163 | |||
164 | static inline endpoint_t * | ||
165 | epaddr_to_ep(struct usb_dev* dev, int ep_addr) | ||
166 | { | ||
167 | if (ep_addr >= 0 && ep_addr < 2) | ||
168 | return &dev->ep[0]; | ||
169 | if (ep_addr < 6) | ||
170 | return &dev->ep[ep_addr]; | ||
171 | return NULL; | ||
172 | } | ||
173 | |||
174 | static const char* std_req_name[] = { | ||
175 | "GET_STATUS", | ||
176 | "CLEAR_FEATURE", | ||
177 | "RESERVED", | ||
178 | "SET_FEATURE", | ||
179 | "RESERVED", | ||
180 | "SET_ADDRESS", | ||
181 | "GET_DESCRIPTOR", | ||
182 | "SET_DESCRIPTOR", | ||
183 | "GET_CONFIGURATION", | ||
184 | "SET_CONFIGURATION", | ||
185 | "GET_INTERFACE", | ||
186 | "SET_INTERFACE", | ||
187 | "SYNCH_FRAME" | ||
188 | }; | ||
189 | |||
190 | static inline const char* | ||
191 | get_std_req_name(int req) | ||
192 | { | ||
193 | return (req >= 0 && req <= 12) ? std_req_name[req] : "UNKNOWN"; | ||
194 | } | ||
195 | |||
196 | #if 0 | ||
197 | static void | ||
198 | dump_setup(struct usb_ctrlrequest* s) | ||
199 | { | ||
200 | dbg("%s: requesttype=%d", __FUNCTION__, s->requesttype); | ||
201 | dbg("%s: request=%d %s", __FUNCTION__, s->request, | ||
202 | get_std_req_name(s->request)); | ||
203 | dbg("%s: value=0x%04x", __FUNCTION__, s->wValue); | ||
204 | dbg("%s: index=%d", __FUNCTION__, s->index); | ||
205 | dbg("%s: length=%d", __FUNCTION__, s->length); | ||
206 | } | ||
207 | #endif | ||
208 | |||
209 | static inline usbdev_pkt_t * | ||
210 | alloc_packet(endpoint_t * ep, int data_size, void* data) | ||
211 | { | ||
212 | usbdev_pkt_t* pkt = kmalloc(sizeof(usbdev_pkt_t) + data_size, | ||
213 | ALLOC_FLAGS); | ||
214 | if (!pkt) | ||
215 | return NULL; | ||
216 | pkt->ep_addr = ep->address; | ||
217 | pkt->size = data_size; | ||
218 | pkt->status = 0; | ||
219 | pkt->next = NULL; | ||
220 | if (data) | ||
221 | memcpy(pkt->payload, data, data_size); | ||
222 | |||
223 | return pkt; | ||
224 | } | ||
225 | |||
226 | |||
227 | /* | ||
228 | * Link a packet to the tail of the enpoint's packet list. | ||
229 | * EP spinlock must be held when calling. | ||
230 | */ | ||
231 | static void | ||
232 | link_tail(endpoint_t * ep, pkt_list_t * list, usbdev_pkt_t * pkt) | ||
233 | { | ||
234 | if (!list->tail) { | ||
235 | list->head = list->tail = pkt; | ||
236 | list->count = 1; | ||
237 | } else { | ||
238 | list->tail->next = pkt; | ||
239 | list->tail = pkt; | ||
240 | list->count++; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | /* | ||
245 | * Unlink and return a packet from the head of the given packet | ||
246 | * list. It is the responsibility of the caller to free the packet. | ||
247 | * EP spinlock must be held when calling. | ||
248 | */ | ||
249 | static usbdev_pkt_t * | ||
250 | unlink_head(pkt_list_t * list) | ||
251 | { | ||
252 | usbdev_pkt_t *pkt; | ||
253 | |||
254 | pkt = list->head; | ||
255 | if (!pkt || !list->count) { | ||
256 | return NULL; | ||
257 | } | ||
258 | |||
259 | list->head = pkt->next; | ||
260 | if (!list->head) { | ||
261 | list->head = list->tail = NULL; | ||
262 | list->count = 0; | ||
263 | } else | ||
264 | list->count--; | ||
265 | |||
266 | return pkt; | ||
267 | } | ||
268 | |||
269 | /* | ||
270 | * Create and attach a new packet to the tail of the enpoint's | ||
271 | * packet list. EP spinlock must be held when calling. | ||
272 | */ | ||
273 | static usbdev_pkt_t * | ||
274 | add_packet(endpoint_t * ep, pkt_list_t * list, int size) | ||
275 | { | ||
276 | usbdev_pkt_t *pkt = alloc_packet(ep, size, NULL); | ||
277 | if (!pkt) | ||
278 | return NULL; | ||
279 | |||
280 | link_tail(ep, list, pkt); | ||
281 | return pkt; | ||
282 | } | ||
283 | |||
284 | |||
285 | /* | ||
286 | * Unlink and free a packet from the head of the enpoint's | ||
287 | * packet list. EP spinlock must be held when calling. | ||
288 | */ | ||
289 | static inline void | ||
290 | free_packet(pkt_list_t * list) | ||
291 | { | ||
292 | kfree(unlink_head(list)); | ||
293 | } | ||
294 | |||
295 | /* EP spinlock must be held when calling. */ | ||
296 | static inline void | ||
297 | flush_pkt_list(pkt_list_t * list) | ||
298 | { | ||
299 | while (list->count) | ||
300 | free_packet(list); | ||
301 | } | ||
302 | |||
303 | /* EP spinlock must be held when calling */ | ||
304 | static inline void | ||
305 | flush_write_fifo(endpoint_t * ep) | ||
306 | { | ||
307 | if (ep->reg->write_fifo_status >= 0) { | ||
308 | au_writel(USBDEV_FSTAT_FLUSH | USBDEV_FSTAT_UF | | ||
309 | USBDEV_FSTAT_OF, | ||
310 | ep->reg->write_fifo_status); | ||
311 | //udelay(100); | ||
312 | //au_writel(USBDEV_FSTAT_UF | USBDEV_FSTAT_OF, | ||
313 | // ep->reg->write_fifo_status); | ||
314 | } | ||
315 | } | ||
316 | |||
317 | /* EP spinlock must be held when calling */ | ||
318 | static inline void | ||
319 | flush_read_fifo(endpoint_t * ep) | ||
320 | { | ||
321 | if (ep->reg->read_fifo_status >= 0) { | ||
322 | au_writel(USBDEV_FSTAT_FLUSH | USBDEV_FSTAT_UF | | ||
323 | USBDEV_FSTAT_OF, | ||
324 | ep->reg->read_fifo_status); | ||
325 | //udelay(100); | ||
326 | //au_writel(USBDEV_FSTAT_UF | USBDEV_FSTAT_OF, | ||
327 | // ep->reg->read_fifo_status); | ||
328 | } | ||
329 | } | ||
330 | |||
331 | |||
332 | /* EP spinlock must be held when calling. */ | ||
333 | static void | ||
334 | endpoint_flush(endpoint_t * ep) | ||
335 | { | ||
336 | // First, flush all packets | ||
337 | flush_pkt_list(&ep->inlist); | ||
338 | flush_pkt_list(&ep->outlist); | ||
339 | |||
340 | // Now flush the endpoint's h/w FIFO(s) | ||
341 | flush_write_fifo(ep); | ||
342 | flush_read_fifo(ep); | ||
343 | } | ||
344 | |||
345 | /* EP spinlock must be held when calling. */ | ||
346 | static void | ||
347 | endpoint_stall(endpoint_t * ep) | ||
348 | { | ||
349 | u32 cs; | ||
350 | |||
351 | warn("%s", __FUNCTION__); | ||
352 | |||
353 | cs = au_readl(ep->reg->ctrl_stat) | USBDEV_CS_STALL; | ||
354 | au_writel(cs, ep->reg->ctrl_stat); | ||
355 | } | ||
356 | |||
357 | /* EP spinlock must be held when calling. */ | ||
358 | static void | ||
359 | endpoint_unstall(endpoint_t * ep) | ||
360 | { | ||
361 | u32 cs; | ||
362 | |||
363 | warn("%s", __FUNCTION__); | ||
364 | |||
365 | cs = au_readl(ep->reg->ctrl_stat) & ~USBDEV_CS_STALL; | ||
366 | au_writel(cs, ep->reg->ctrl_stat); | ||
367 | } | ||
368 | |||
369 | static void | ||
370 | endpoint_reset_datatoggle(endpoint_t * ep) | ||
371 | { | ||
372 | // FIXME: is this possible? | ||
373 | } | ||
374 | |||
375 | |||
376 | /* EP spinlock must be held when calling. */ | ||
377 | static int | ||
378 | endpoint_fifo_read(endpoint_t * ep) | ||
379 | { | ||
380 | int read_count = 0; | ||
381 | u8 *bufptr; | ||
382 | usbdev_pkt_t *pkt = ep->outlist.tail; | ||
383 | |||
384 | if (!pkt) | ||
385 | return -EINVAL; | ||
386 | |||
387 | bufptr = &pkt->payload[pkt->size]; | ||
388 | while (au_readl(ep->reg->read_fifo_status) & USBDEV_FSTAT_FCNT_MASK) { | ||
389 | *bufptr++ = au_readl(ep->reg->read_fifo) & 0xff; | ||
390 | read_count++; | ||
391 | pkt->size++; | ||
392 | } | ||
393 | |||
394 | return read_count; | ||
395 | } | ||
396 | |||
397 | #if 0 | ||
398 | /* EP spinlock must be held when calling. */ | ||
399 | static int | ||
400 | endpoint_fifo_write(endpoint_t * ep, int index) | ||
401 | { | ||
402 | int write_count = 0; | ||
403 | u8 *bufptr; | ||
404 | usbdev_pkt_t *pkt = ep->inlist.head; | ||
405 | |||
406 | if (!pkt) | ||
407 | return -EINVAL; | ||
408 | |||
409 | bufptr = &pkt->payload[index]; | ||
410 | while ((au_readl(ep->reg->write_fifo_status) & | ||
411 | USBDEV_FSTAT_FCNT_MASK) < EP_FIFO_DEPTH) { | ||
412 | if (bufptr < pkt->payload + pkt->size) { | ||
413 | au_writel(*bufptr++, ep->reg->write_fifo); | ||
414 | write_count++; | ||
415 | } else { | ||
416 | break; | ||
417 | } | ||
418 | } | ||
419 | |||
420 | return write_count; | ||
421 | } | ||
422 | #endif | ||
423 | |||
424 | /* | ||
425 | * This routine is called to restart transmission of a packet. | ||
426 | * The endpoint's TSIZE must be set to the new packet's size, | ||
427 | * and DMA to the write FIFO needs to be restarted. | ||
428 | * EP spinlock must be held when calling. | ||
429 | */ | ||
430 | static void | ||
431 | kickstart_send_packet(endpoint_t * ep) | ||
432 | { | ||
433 | u32 cs; | ||
434 | usbdev_pkt_t *pkt = ep->inlist.head; | ||
435 | |||
436 | vdbg("%s: ep%d, pkt=%p", __FUNCTION__, ep->address, pkt); | ||
437 | |||
438 | if (!pkt) { | ||
439 | err("%s: head=NULL! list->count=%d", __FUNCTION__, | ||
440 | ep->inlist.count); | ||
441 | return; | ||
442 | } | ||
443 | |||
444 | dma_cache_wback_inv((unsigned long)pkt->payload, pkt->size); | ||
445 | |||
446 | /* | ||
447 | * make sure FIFO is empty | ||
448 | */ | ||
449 | flush_write_fifo(ep); | ||
450 | |||
451 | cs = au_readl(ep->reg->ctrl_stat) & USBDEV_CS_STALL; | ||
452 | cs |= (pkt->size << USBDEV_CS_TSIZE_BIT); | ||
453 | au_writel(cs, ep->reg->ctrl_stat); | ||
454 | |||
455 | if (get_dma_active_buffer(ep->indma) == 1) { | ||
456 | set_dma_count1(ep->indma, pkt->size); | ||
457 | set_dma_addr1(ep->indma, virt_to_phys(pkt->payload)); | ||
458 | enable_dma_buffer1(ep->indma); // reenable | ||
459 | } else { | ||
460 | set_dma_count0(ep->indma, pkt->size); | ||
461 | set_dma_addr0(ep->indma, virt_to_phys(pkt->payload)); | ||
462 | enable_dma_buffer0(ep->indma); // reenable | ||
463 | } | ||
464 | if (dma_halted(ep->indma)) | ||
465 | start_dma(ep->indma); | ||
466 | } | ||
467 | |||
468 | |||
469 | /* | ||
470 | * This routine is called when a packet in the inlist has been | ||
471 | * completed. Frees the completed packet and starts sending the | ||
472 | * next. EP spinlock must be held when calling. | ||
473 | */ | ||
474 | static usbdev_pkt_t * | ||
475 | send_packet_complete(endpoint_t * ep) | ||
476 | { | ||
477 | usbdev_pkt_t *pkt = unlink_head(&ep->inlist); | ||
478 | |||
479 | if (pkt) { | ||
480 | pkt->status = | ||
481 | (au_readl(ep->reg->ctrl_stat) & USBDEV_CS_NAK) ? | ||
482 | PKT_STATUS_NAK : PKT_STATUS_ACK; | ||
483 | |||
484 | vdbg("%s: ep%d, %s pkt=%p, list count=%d", __FUNCTION__, | ||
485 | ep->address, (pkt->status & PKT_STATUS_NAK) ? | ||
486 | "NAK" : "ACK", pkt, ep->inlist.count); | ||
487 | } | ||
488 | |||
489 | /* | ||
490 | * The write fifo should already be drained if things are | ||
491 | * working right, but flush it anyway just in case. | ||
492 | */ | ||
493 | flush_write_fifo(ep); | ||
494 | |||
495 | // begin transmitting next packet in the inlist | ||
496 | if (ep->inlist.count) { | ||
497 | kickstart_send_packet(ep); | ||
498 | } | ||
499 | |||
500 | return pkt; | ||
501 | } | ||
502 | |||
503 | /* | ||
504 | * Add a new packet to the tail of the given ep's packet | ||
505 | * inlist. The transmit complete interrupt frees packets from | ||
506 | * the head of this list. EP spinlock must be held when calling. | ||
507 | */ | ||
508 | static int | ||
509 | send_packet(struct usb_dev* dev, usbdev_pkt_t *pkt, int async) | ||
510 | { | ||
511 | pkt_list_t *list; | ||
512 | endpoint_t* ep; | ||
513 | |||
514 | if (!pkt || !(ep = epaddr_to_ep(dev, pkt->ep_addr))) | ||
515 | return -EINVAL; | ||
516 | |||
517 | if (!pkt->size) | ||
518 | return 0; | ||
519 | |||
520 | list = &ep->inlist; | ||
521 | |||
522 | if (!async && list->count) { | ||
523 | halt_dma(ep->indma); | ||
524 | flush_pkt_list(list); | ||
525 | } | ||
526 | |||
527 | link_tail(ep, list, pkt); | ||
528 | |||
529 | vdbg("%s: ep%d, pkt=%p, size=%d, list count=%d", __FUNCTION__, | ||
530 | ep->address, pkt, pkt->size, list->count); | ||
531 | |||
532 | if (list->count == 1) { | ||
533 | /* | ||
534 | * if the packet count is one, it means the list was empty, | ||
535 | * and no more data will go out this ep until we kick-start | ||
536 | * it again. | ||
537 | */ | ||
538 | kickstart_send_packet(ep); | ||
539 | } | ||
540 | |||
541 | return pkt->size; | ||
542 | } | ||
543 | |||
544 | /* | ||
545 | * This routine is called to restart reception of a packet. | ||
546 | * EP spinlock must be held when calling. | ||
547 | */ | ||
548 | static void | ||
549 | kickstart_receive_packet(endpoint_t * ep) | ||
550 | { | ||
551 | usbdev_pkt_t *pkt; | ||
552 | |||
553 | // get and link a new packet for next reception | ||
554 | if (!(pkt = add_packet(ep, &ep->outlist, ep->max_pkt_size))) { | ||
555 | err("%s: could not alloc new packet", __FUNCTION__); | ||
556 | return; | ||
557 | } | ||
558 | |||
559 | if (get_dma_active_buffer(ep->outdma) == 1) { | ||
560 | clear_dma_done1(ep->outdma); | ||
561 | set_dma_count1(ep->outdma, ep->max_pkt_size); | ||
562 | set_dma_count0(ep->outdma, 0); | ||
563 | set_dma_addr1(ep->outdma, virt_to_phys(pkt->payload)); | ||
564 | enable_dma_buffer1(ep->outdma); // reenable | ||
565 | } else { | ||
566 | clear_dma_done0(ep->outdma); | ||
567 | set_dma_count0(ep->outdma, ep->max_pkt_size); | ||
568 | set_dma_count1(ep->outdma, 0); | ||
569 | set_dma_addr0(ep->outdma, virt_to_phys(pkt->payload)); | ||
570 | enable_dma_buffer0(ep->outdma); // reenable | ||
571 | } | ||
572 | if (dma_halted(ep->outdma)) | ||
573 | start_dma(ep->outdma); | ||
574 | } | ||
575 | |||
576 | |||
577 | /* | ||
578 | * This routine is called when a packet in the outlist has been | ||
579 | * completed (received) and we need to prepare for a new packet | ||
580 | * to be received. Halts DMA and computes the packet size from the | ||
581 | * remaining DMA counter. Then prepares a new packet for reception | ||
582 | * and restarts DMA. FIXME: what if another packet comes in | ||
583 | * on top of the completed packet? Counter would be wrong. | ||
584 | * EP spinlock must be held when calling. | ||
585 | */ | ||
586 | static usbdev_pkt_t * | ||
587 | receive_packet_complete(endpoint_t * ep) | ||
588 | { | ||
589 | usbdev_pkt_t *pkt = ep->outlist.tail; | ||
590 | u32 cs; | ||
591 | |||
592 | halt_dma(ep->outdma); | ||
593 | |||
594 | cs = au_readl(ep->reg->ctrl_stat); | ||
595 | |||
596 | if (!pkt) | ||
597 | return NULL; | ||
598 | |||
599 | pkt->size = ep->max_pkt_size - get_dma_residue(ep->outdma); | ||
600 | if (pkt->size) | ||
601 | dma_cache_inv((unsigned long)pkt->payload, pkt->size); | ||
602 | /* | ||
603 | * need to pull out any remaining bytes in the FIFO. | ||
604 | */ | ||
605 | endpoint_fifo_read(ep); | ||
606 | /* | ||
607 | * should be drained now, but flush anyway just in case. | ||
608 | */ | ||
609 | flush_read_fifo(ep); | ||
610 | |||
611 | pkt->status = (cs & USBDEV_CS_NAK) ? PKT_STATUS_NAK : PKT_STATUS_ACK; | ||
612 | if (ep->address == 0 && (cs & USBDEV_CS_SU)) | ||
613 | pkt->status |= PKT_STATUS_SU; | ||
614 | |||
615 | vdbg("%s: ep%d, %s pkt=%p, size=%d", __FUNCTION__, | ||
616 | ep->address, (pkt->status & PKT_STATUS_NAK) ? | ||
617 | "NAK" : "ACK", pkt, pkt->size); | ||
618 | |||
619 | kickstart_receive_packet(ep); | ||
620 | |||
621 | return pkt; | ||
622 | } | ||
623 | |||
624 | |||
625 | /* | ||
626 | **************************************************************************** | ||
627 | * Here starts the standard device request handlers. They are | ||
628 | * all called by do_setup() via a table of function pointers. | ||
629 | **************************************************************************** | ||
630 | */ | ||
631 | |||
632 | static ep0_stage_t | ||
633 | do_get_status(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
634 | { | ||
635 | switch (setup->bRequestType) { | ||
636 | case 0x80: // Device | ||
637 | // FIXME: send device status | ||
638 | break; | ||
639 | case 0x81: // Interface | ||
640 | // FIXME: send interface status | ||
641 | break; | ||
642 | case 0x82: // End Point | ||
643 | // FIXME: send endpoint status | ||
644 | break; | ||
645 | default: | ||
646 | // Invalid Command | ||
647 | endpoint_stall(&dev->ep[0]); // Stall End Point 0 | ||
648 | break; | ||
649 | } | ||
650 | |||
651 | return STATUS_STAGE; | ||
652 | } | ||
653 | |||
654 | static ep0_stage_t | ||
655 | do_clear_feature(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
656 | { | ||
657 | switch (setup->bRequestType) { | ||
658 | case 0x00: // Device | ||
659 | if ((le16_to_cpu(setup->wValue) & 0xff) == 1) | ||
660 | dev->remote_wakeup_en = 0; | ||
661 | else | ||
662 | endpoint_stall(&dev->ep[0]); | ||
663 | break; | ||
664 | case 0x02: // End Point | ||
665 | if ((le16_to_cpu(setup->wValue) & 0xff) == 0) { | ||
666 | endpoint_t *ep = | ||
667 | epaddr_to_ep(dev, | ||
668 | le16_to_cpu(setup->wIndex) & 0xff); | ||
669 | |||
670 | endpoint_unstall(ep); | ||
671 | endpoint_reset_datatoggle(ep); | ||
672 | } else | ||
673 | endpoint_stall(&dev->ep[0]); | ||
674 | break; | ||
675 | } | ||
676 | |||
677 | return SETUP_STAGE; | ||
678 | } | ||
679 | |||
680 | static ep0_stage_t | ||
681 | do_reserved(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
682 | { | ||
683 | // Invalid request, stall End Point 0 | ||
684 | endpoint_stall(&dev->ep[0]); | ||
685 | return SETUP_STAGE; | ||
686 | } | ||
687 | |||
688 | static ep0_stage_t | ||
689 | do_set_feature(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
690 | { | ||
691 | switch (setup->bRequestType) { | ||
692 | case 0x00: // Device | ||
693 | if ((le16_to_cpu(setup->wValue) & 0xff) == 1) | ||
694 | dev->remote_wakeup_en = 1; | ||
695 | else | ||
696 | endpoint_stall(&dev->ep[0]); | ||
697 | break; | ||
698 | case 0x02: // End Point | ||
699 | if ((le16_to_cpu(setup->wValue) & 0xff) == 0) { | ||
700 | endpoint_t *ep = | ||
701 | epaddr_to_ep(dev, | ||
702 | le16_to_cpu(setup->wIndex) & 0xff); | ||
703 | |||
704 | endpoint_stall(ep); | ||
705 | } else | ||
706 | endpoint_stall(&dev->ep[0]); | ||
707 | break; | ||
708 | } | ||
709 | |||
710 | return SETUP_STAGE; | ||
711 | } | ||
712 | |||
713 | static ep0_stage_t | ||
714 | do_set_address(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
715 | { | ||
716 | int new_state = dev->state; | ||
717 | int new_addr = le16_to_cpu(setup->wValue); | ||
718 | |||
719 | dbg("%s: our address=%d", __FUNCTION__, new_addr); | ||
720 | |||
721 | if (new_addr > 127) { | ||
722 | // usb spec doesn't tell us what to do, so just go to | ||
723 | // default state | ||
724 | new_state = DEFAULT; | ||
725 | dev->address = 0; | ||
726 | } else if (dev->address != new_addr) { | ||
727 | dev->address = new_addr; | ||
728 | new_state = ADDRESS; | ||
729 | } | ||
730 | |||
731 | if (dev->state != new_state) { | ||
732 | dev->state = new_state; | ||
733 | /* inform function layer of usbdev state change */ | ||
734 | dev->func_cb(CB_NEW_STATE, dev->state, dev->cb_data); | ||
735 | } | ||
736 | |||
737 | return SETUP_STAGE; | ||
738 | } | ||
739 | |||
740 | static ep0_stage_t | ||
741 | do_get_descriptor(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
742 | { | ||
743 | int strnum, desc_len = le16_to_cpu(setup->wLength); | ||
744 | |||
745 | switch (le16_to_cpu(setup->wValue) >> 8) { | ||
746 | case USB_DT_DEVICE: | ||
747 | // send device descriptor! | ||
748 | desc_len = desc_len > dev->dev_desc->bLength ? | ||
749 | dev->dev_desc->bLength : desc_len; | ||
750 | dbg("sending device desc, size=%d", desc_len); | ||
751 | send_packet(dev, alloc_packet(&dev->ep[0], desc_len, | ||
752 | dev->dev_desc), 0); | ||
753 | break; | ||
754 | case USB_DT_CONFIG: | ||
755 | // If the config descr index in low-byte of | ||
756 | // setup->wValue is valid, send config descr, | ||
757 | // otherwise stall ep0. | ||
758 | if ((le16_to_cpu(setup->wValue) & 0xff) == 0) { | ||
759 | // send config descriptor! | ||
760 | if (desc_len <= USB_DT_CONFIG_SIZE) { | ||
761 | dbg("sending partial config desc, size=%d", | ||
762 | desc_len); | ||
763 | send_packet(dev, | ||
764 | alloc_packet(&dev->ep[0], | ||
765 | desc_len, | ||
766 | dev->conf_desc), | ||
767 | 0); | ||
768 | } else { | ||
769 | int len = le16_to_cpu(dev->conf_desc->wTotalLength); | ||
770 | dbg("sending whole config desc," | ||
771 | " size=%d, our size=%d", desc_len, len); | ||
772 | desc_len = desc_len > len ? len : desc_len; | ||
773 | send_packet(dev, | ||
774 | alloc_packet(&dev->ep[0], | ||
775 | desc_len, | ||
776 | dev->full_conf_desc), | ||
777 | 0); | ||
778 | } | ||
779 | } else | ||
780 | endpoint_stall(&dev->ep[0]); | ||
781 | break; | ||
782 | case USB_DT_STRING: | ||
783 | // If the string descr index in low-byte of setup->wValue | ||
784 | // is valid, send string descr, otherwise stall ep0. | ||
785 | strnum = le16_to_cpu(setup->wValue) & 0xff; | ||
786 | if (strnum >= 0 && strnum < 6) { | ||
787 | struct usb_string_descriptor *desc = | ||
788 | dev->str_desc[strnum]; | ||
789 | desc_len = desc_len > desc->bLength ? | ||
790 | desc->bLength : desc_len; | ||
791 | dbg("sending string desc %d", strnum); | ||
792 | send_packet(dev, | ||
793 | alloc_packet(&dev->ep[0], desc_len, | ||
794 | desc), 0); | ||
795 | } else | ||
796 | endpoint_stall(&dev->ep[0]); | ||
797 | break; | ||
798 | default: | ||
799 | // Invalid request | ||
800 | err("invalid get desc=%d, stalled", | ||
801 | le16_to_cpu(setup->wValue) >> 8); | ||
802 | endpoint_stall(&dev->ep[0]); // Stall endpoint 0 | ||
803 | break; | ||
804 | } | ||
805 | |||
806 | return STATUS_STAGE; | ||
807 | } | ||
808 | |||
809 | static ep0_stage_t | ||
810 | do_set_descriptor(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
811 | { | ||
812 | // TODO: implement | ||
813 | // there will be an OUT data stage (the descriptor to set) | ||
814 | return DATA_STAGE; | ||
815 | } | ||
816 | |||
817 | static ep0_stage_t | ||
818 | do_get_configuration(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
819 | { | ||
820 | // send dev->configuration | ||
821 | dbg("sending config"); | ||
822 | send_packet(dev, alloc_packet(&dev->ep[0], 1, &dev->configuration), | ||
823 | 0); | ||
824 | return STATUS_STAGE; | ||
825 | } | ||
826 | |||
827 | static ep0_stage_t | ||
828 | do_set_configuration(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
829 | { | ||
830 | // set active config to low-byte of setup->wValue | ||
831 | dev->configuration = le16_to_cpu(setup->wValue) & 0xff; | ||
832 | dbg("set config, config=%d", dev->configuration); | ||
833 | if (!dev->configuration && dev->state > DEFAULT) { | ||
834 | dev->state = ADDRESS; | ||
835 | /* inform function layer of usbdev state change */ | ||
836 | dev->func_cb(CB_NEW_STATE, dev->state, dev->cb_data); | ||
837 | } else if (dev->configuration == 1) { | ||
838 | dev->state = CONFIGURED; | ||
839 | /* inform function layer of usbdev state change */ | ||
840 | dev->func_cb(CB_NEW_STATE, dev->state, dev->cb_data); | ||
841 | } else { | ||
842 | // FIXME: "respond with request error" - how? | ||
843 | } | ||
844 | |||
845 | return SETUP_STAGE; | ||
846 | } | ||
847 | |||
848 | static ep0_stage_t | ||
849 | do_get_interface(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
850 | { | ||
851 | // interface must be zero. | ||
852 | if ((le16_to_cpu(setup->wIndex) & 0xff) || dev->state == ADDRESS) { | ||
853 | // FIXME: respond with "request error". how? | ||
854 | } else if (dev->state == CONFIGURED) { | ||
855 | // send dev->alternate_setting | ||
856 | dbg("sending alt setting"); | ||
857 | send_packet(dev, alloc_packet(&dev->ep[0], 1, | ||
858 | &dev->alternate_setting), 0); | ||
859 | } | ||
860 | |||
861 | return STATUS_STAGE; | ||
862 | |||
863 | } | ||
864 | |||
865 | static ep0_stage_t | ||
866 | do_set_interface(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
867 | { | ||
868 | if (dev->state == ADDRESS) { | ||
869 | // FIXME: respond with "request error". how? | ||
870 | } else if (dev->state == CONFIGURED) { | ||
871 | dev->interface = le16_to_cpu(setup->wIndex) & 0xff; | ||
872 | dev->alternate_setting = | ||
873 | le16_to_cpu(setup->wValue) & 0xff; | ||
874 | // interface and alternate_setting must be zero | ||
875 | if (dev->interface || dev->alternate_setting) { | ||
876 | // FIXME: respond with "request error". how? | ||
877 | } | ||
878 | } | ||
879 | |||
880 | return SETUP_STAGE; | ||
881 | } | ||
882 | |||
883 | static ep0_stage_t | ||
884 | do_synch_frame(struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
885 | { | ||
886 | // TODO | ||
887 | return SETUP_STAGE; | ||
888 | } | ||
889 | |||
890 | typedef ep0_stage_t (*req_method_t)(struct usb_dev* dev, | ||
891 | struct usb_ctrlrequest* setup); | ||
892 | |||
893 | |||
894 | /* Table of the standard device request handlers */ | ||
895 | static const req_method_t req_method[] = { | ||
896 | do_get_status, | ||
897 | do_clear_feature, | ||
898 | do_reserved, | ||
899 | do_set_feature, | ||
900 | do_reserved, | ||
901 | do_set_address, | ||
902 | do_get_descriptor, | ||
903 | do_set_descriptor, | ||
904 | do_get_configuration, | ||
905 | do_set_configuration, | ||
906 | do_get_interface, | ||
907 | do_set_interface, | ||
908 | do_synch_frame | ||
909 | }; | ||
910 | |||
911 | |||
912 | // SETUP packet request dispatcher | ||
913 | static void | ||
914 | do_setup (struct usb_dev* dev, struct usb_ctrlrequest* setup) | ||
915 | { | ||
916 | req_method_t m; | ||
917 | |||
918 | dbg("%s: req %d %s", __FUNCTION__, setup->bRequestType, | ||
919 | get_std_req_name(setup->bRequestType)); | ||
920 | |||
921 | if ((setup->bRequestType & USB_TYPE_MASK) != USB_TYPE_STANDARD || | ||
922 | (setup->bRequestType & USB_RECIP_MASK) != USB_RECIP_DEVICE) { | ||
923 | err("%s: invalid requesttype 0x%02x", __FUNCTION__, | ||
924 | setup->bRequestType); | ||
925 | return; | ||
926 | } | ||
927 | |||
928 | if ((setup->bRequestType & 0x80) == USB_DIR_OUT && setup->wLength) | ||
929 | dbg("%s: OUT phase! length=%d", __FUNCTION__, setup->wLength); | ||
930 | |||
931 | if (setup->bRequestType < sizeof(req_method)/sizeof(req_method_t)) | ||
932 | m = req_method[setup->bRequestType]; | ||
933 | else | ||
934 | m = do_reserved; | ||
935 | |||
936 | dev->ep0_stage = (*m)(dev, setup); | ||
937 | } | ||
938 | |||
939 | /* | ||
940 | * A SETUP, DATA0, or DATA1 packet has been received | ||
941 | * on the default control endpoint's fifo. | ||
942 | */ | ||
943 | static void | ||
944 | process_ep0_receive (struct usb_dev* dev) | ||
945 | { | ||
946 | endpoint_t *ep0 = &dev->ep[0]; | ||
947 | usbdev_pkt_t *pkt; | ||
948 | |||
949 | spin_lock(&ep0->lock); | ||
950 | |||
951 | // complete packet and prepare a new packet | ||
952 | pkt = receive_packet_complete(ep0); | ||
953 | if (!pkt) { | ||
954 | // FIXME: should put a warn/err here. | ||
955 | spin_unlock(&ep0->lock); | ||
956 | return; | ||
957 | } | ||
958 | |||
959 | // unlink immediately from endpoint. | ||
960 | unlink_head(&ep0->outlist); | ||
961 | |||
962 | // override current stage if h/w says it's a setup packet | ||
963 | if (pkt->status & PKT_STATUS_SU) | ||
964 | dev->ep0_stage = SETUP_STAGE; | ||
965 | |||
966 | switch (dev->ep0_stage) { | ||
967 | case SETUP_STAGE: | ||
968 | vdbg("SU bit is %s in setup stage", | ||
969 | (pkt->status & PKT_STATUS_SU) ? "set" : "not set"); | ||
970 | |||
971 | if (pkt->size == sizeof(struct usb_ctrlrequest)) { | ||
972 | #ifdef VDEBUG | ||
973 | if (pkt->status & PKT_STATUS_ACK) | ||
974 | vdbg("received SETUP"); | ||
975 | else | ||
976 | vdbg("received NAK SETUP"); | ||
977 | #endif | ||
978 | do_setup(dev, (struct usb_ctrlrequest*)pkt->payload); | ||
979 | } else | ||
980 | err("%s: wrong size SETUP received", __FUNCTION__); | ||
981 | break; | ||
982 | case DATA_STAGE: | ||
983 | /* | ||
984 | * this setup has an OUT data stage. Of the standard | ||
985 | * device requests, only set_descriptor has this stage, | ||
986 | * so this packet is that descriptor. TODO: drop it for | ||
987 | * now, set_descriptor not implemented. | ||
988 | * | ||
989 | * Need to place a byte in the write FIFO here, to prepare | ||
990 | * to send a zero-length DATA ack packet to the host in the | ||
991 | * STATUS stage. | ||
992 | */ | ||
993 | au_writel(0, ep0->reg->write_fifo); | ||
994 | dbg("received OUT stage DATAx on EP0, size=%d", pkt->size); | ||
995 | dev->ep0_stage = SETUP_STAGE; | ||
996 | break; | ||
997 | case STATUS_STAGE: | ||
998 | // this setup had an IN data stage, and host is ACK'ing | ||
999 | // the packet we sent during that stage. | ||
1000 | if (pkt->size != 0) | ||
1001 | warn("received non-zero ACK on EP0??"); | ||
1002 | #ifdef VDEBUG | ||
1003 | else | ||
1004 | vdbg("received ACK on EP0"); | ||
1005 | #endif | ||
1006 | dev->ep0_stage = SETUP_STAGE; | ||
1007 | break; | ||
1008 | } | ||
1009 | |||
1010 | spin_unlock(&ep0->lock); | ||
1011 | // we're done processing the packet, free it | ||
1012 | kfree(pkt); | ||
1013 | } | ||
1014 | |||
1015 | |||
1016 | /* | ||
1017 | * A DATA0/1 packet has been received on one of the OUT endpoints (4 or 5) | ||
1018 | */ | ||
1019 | static void | ||
1020 | process_ep_receive (struct usb_dev* dev, endpoint_t *ep) | ||
1021 | { | ||
1022 | usbdev_pkt_t *pkt; | ||
1023 | |||
1024 | spin_lock(&ep->lock); | ||
1025 | pkt = receive_packet_complete(ep); | ||
1026 | spin_unlock(&ep->lock); | ||
1027 | |||
1028 | dev->func_cb(CB_PKT_COMPLETE, (unsigned long)pkt, dev->cb_data); | ||
1029 | } | ||
1030 | |||
1031 | |||
1032 | |||
1033 | /* This ISR handles the receive complete and suspend events */ | ||
1034 | static void req_sus_intr (int irq, void *dev_id) | ||
1035 | { | ||
1036 | struct usb_dev *dev = (struct usb_dev *) dev_id; | ||
1037 | u32 status; | ||
1038 | |||
1039 | status = au_readl(USBD_INTSTAT); | ||
1040 | au_writel(status, USBD_INTSTAT); // ack'em | ||
1041 | |||
1042 | if (status & (1<<0)) | ||
1043 | process_ep0_receive(dev); | ||
1044 | if (status & (1<<4)) | ||
1045 | process_ep_receive(dev, &dev->ep[4]); | ||
1046 | if (status & (1<<5)) | ||
1047 | process_ep_receive(dev, &dev->ep[5]); | ||
1048 | } | ||
1049 | |||
1050 | |||
1051 | /* This ISR handles the DMA done events on EP0 */ | ||
1052 | static void dma_done_ep0_intr(int irq, void *dev_id) | ||
1053 | { | ||
1054 | struct usb_dev *dev = (struct usb_dev *) dev_id; | ||
1055 | usbdev_pkt_t* pkt; | ||
1056 | endpoint_t *ep0 = &dev->ep[0]; | ||
1057 | u32 cs0, buff_done; | ||
1058 | |||
1059 | spin_lock(&ep0->lock); | ||
1060 | cs0 = au_readl(ep0->reg->ctrl_stat); | ||
1061 | |||
1062 | // first check packet transmit done | ||
1063 | if ((buff_done = get_dma_buffer_done(ep0->indma)) != 0) { | ||
1064 | // transmitted a DATAx packet during DATA stage | ||
1065 | // on control endpoint 0 | ||
1066 | // clear DMA done bit | ||
1067 | if (buff_done & DMA_D0) | ||
1068 | clear_dma_done0(ep0->indma); | ||
1069 | if (buff_done & DMA_D1) | ||
1070 | clear_dma_done1(ep0->indma); | ||
1071 | |||
1072 | pkt = send_packet_complete(ep0); | ||
1073 | kfree(pkt); | ||
1074 | } | ||
1075 | |||
1076 | /* | ||
1077 | * Now check packet receive done. Shouldn't get these, | ||
1078 | * the receive packet complete intr should happen | ||
1079 | * before the DMA done intr occurs. | ||
1080 | */ | ||
1081 | if ((buff_done = get_dma_buffer_done(ep0->outdma)) != 0) { | ||
1082 | // clear DMA done bit | ||
1083 | if (buff_done & DMA_D0) | ||
1084 | clear_dma_done0(ep0->outdma); | ||
1085 | if (buff_done & DMA_D1) | ||
1086 | clear_dma_done1(ep0->outdma); | ||
1087 | |||
1088 | //process_ep0_receive(dev); | ||
1089 | } | ||
1090 | |||
1091 | spin_unlock(&ep0->lock); | ||
1092 | } | ||
1093 | |||
1094 | /* This ISR handles the DMA done events on endpoints 2,3,4,5 */ | ||
1095 | static void dma_done_ep_intr(int irq, void *dev_id) | ||
1096 | { | ||
1097 | struct usb_dev *dev = (struct usb_dev *) dev_id; | ||
1098 | int i; | ||
1099 | |||
1100 | for (i = 2; i < 6; i++) { | ||
1101 | u32 buff_done; | ||
1102 | usbdev_pkt_t* pkt; | ||
1103 | endpoint_t *ep = &dev->ep[i]; | ||
1104 | |||
1105 | if (!ep->active) continue; | ||
1106 | |||
1107 | spin_lock(&ep->lock); | ||
1108 | |||
1109 | if (ep->direction == USB_DIR_IN) { | ||
1110 | buff_done = get_dma_buffer_done(ep->indma); | ||
1111 | if (buff_done != 0) { | ||
1112 | // transmitted a DATAx pkt on the IN ep | ||
1113 | // clear DMA done bit | ||
1114 | if (buff_done & DMA_D0) | ||
1115 | clear_dma_done0(ep->indma); | ||
1116 | if (buff_done & DMA_D1) | ||
1117 | clear_dma_done1(ep->indma); | ||
1118 | |||
1119 | pkt = send_packet_complete(ep); | ||
1120 | |||
1121 | spin_unlock(&ep->lock); | ||
1122 | dev->func_cb(CB_PKT_COMPLETE, | ||
1123 | (unsigned long)pkt, | ||
1124 | dev->cb_data); | ||
1125 | spin_lock(&ep->lock); | ||
1126 | } | ||
1127 | } else { | ||
1128 | /* | ||
1129 | * Check packet receive done (OUT ep). Shouldn't get | ||
1130 | * these, the rx packet complete intr should happen | ||
1131 | * before the DMA done intr occurs. | ||
1132 | */ | ||
1133 | buff_done = get_dma_buffer_done(ep->outdma); | ||
1134 | if (buff_done != 0) { | ||
1135 | // received a DATAx pkt on the OUT ep | ||
1136 | // clear DMA done bit | ||
1137 | if (buff_done & DMA_D0) | ||
1138 | clear_dma_done0(ep->outdma); | ||
1139 | if (buff_done & DMA_D1) | ||
1140 | clear_dma_done1(ep->outdma); | ||
1141 | |||
1142 | //process_ep_receive(dev, ep); | ||
1143 | } | ||
1144 | } | ||
1145 | |||
1146 | spin_unlock(&ep->lock); | ||
1147 | } | ||
1148 | } | ||
1149 | |||
1150 | |||
1151 | /*************************************************************************** | ||
1152 | * Here begins the external interface functions | ||
1153 | *************************************************************************** | ||
1154 | */ | ||
1155 | |||
1156 | /* | ||
1157 | * allocate a new packet | ||
1158 | */ | ||
1159 | int | ||
1160 | usbdev_alloc_packet(int ep_addr, int data_size, usbdev_pkt_t** pkt) | ||
1161 | { | ||
1162 | endpoint_t * ep = epaddr_to_ep(&usbdev, ep_addr); | ||
1163 | usbdev_pkt_t* lpkt = NULL; | ||
1164 | |||
1165 | if (!ep || !ep->active || ep->address < 2) | ||
1166 | return -ENODEV; | ||
1167 | if (data_size > ep->max_pkt_size) | ||
1168 | return -EINVAL; | ||
1169 | |||
1170 | lpkt = *pkt = alloc_packet(ep, data_size, NULL); | ||
1171 | if (!lpkt) | ||
1172 | return -ENOMEM; | ||
1173 | return 0; | ||
1174 | } | ||
1175 | |||
1176 | |||
1177 | /* | ||
1178 | * packet send | ||
1179 | */ | ||
1180 | int | ||
1181 | usbdev_send_packet(int ep_addr, usbdev_pkt_t * pkt) | ||
1182 | { | ||
1183 | unsigned long flags; | ||
1184 | int count; | ||
1185 | endpoint_t * ep; | ||
1186 | |||
1187 | if (!pkt || !(ep = epaddr_to_ep(&usbdev, pkt->ep_addr)) || | ||
1188 | !ep->active || ep->address < 2) | ||
1189 | return -ENODEV; | ||
1190 | if (ep->direction != USB_DIR_IN) | ||
1191 | return -EINVAL; | ||
1192 | |||
1193 | spin_lock_irqsave(&ep->lock, flags); | ||
1194 | count = send_packet(&usbdev, pkt, 1); | ||
1195 | spin_unlock_irqrestore(&ep->lock, flags); | ||
1196 | |||
1197 | return count; | ||
1198 | } | ||
1199 | |||
1200 | /* | ||
1201 | * packet receive | ||
1202 | */ | ||
1203 | int | ||
1204 | usbdev_receive_packet(int ep_addr, usbdev_pkt_t** pkt) | ||
1205 | { | ||
1206 | unsigned long flags; | ||
1207 | usbdev_pkt_t* lpkt = NULL; | ||
1208 | endpoint_t *ep = epaddr_to_ep(&usbdev, ep_addr); | ||
1209 | |||
1210 | if (!ep || !ep->active || ep->address < 2) | ||
1211 | return -ENODEV; | ||
1212 | if (ep->direction != USB_DIR_OUT) | ||
1213 | return -EINVAL; | ||
1214 | |||
1215 | spin_lock_irqsave(&ep->lock, flags); | ||
1216 | if (ep->outlist.count > 1) | ||
1217 | lpkt = unlink_head(&ep->outlist); | ||
1218 | spin_unlock_irqrestore(&ep->lock, flags); | ||
1219 | |||
1220 | if (!lpkt) { | ||
1221 | /* no packet available */ | ||
1222 | *pkt = NULL; | ||
1223 | return -ENODATA; | ||
1224 | } | ||
1225 | |||
1226 | *pkt = lpkt; | ||
1227 | |||
1228 | return lpkt->size; | ||
1229 | } | ||
1230 | |||
1231 | |||
1232 | /* | ||
1233 | * return total queued byte count on the endpoint. | ||
1234 | */ | ||
1235 | int | ||
1236 | usbdev_get_byte_count(int ep_addr) | ||
1237 | { | ||
1238 | unsigned long flags; | ||
1239 | pkt_list_t *list; | ||
1240 | usbdev_pkt_t *scan; | ||
1241 | int count = 0; | ||
1242 | endpoint_t * ep = epaddr_to_ep(&usbdev, ep_addr); | ||
1243 | |||
1244 | if (!ep || !ep->active || ep->address < 2) | ||
1245 | return -ENODEV; | ||
1246 | |||
1247 | if (ep->direction == USB_DIR_IN) { | ||
1248 | list = &ep->inlist; | ||
1249 | |||
1250 | spin_lock_irqsave(&ep->lock, flags); | ||
1251 | for (scan = list->head; scan; scan = scan->next) | ||
1252 | count += scan->size; | ||
1253 | spin_unlock_irqrestore(&ep->lock, flags); | ||
1254 | } else { | ||
1255 | list = &ep->outlist; | ||
1256 | |||
1257 | spin_lock_irqsave(&ep->lock, flags); | ||
1258 | if (list->count > 1) { | ||
1259 | for (scan = list->head; scan != list->tail; | ||
1260 | scan = scan->next) | ||
1261 | count += scan->size; | ||
1262 | } | ||
1263 | spin_unlock_irqrestore(&ep->lock, flags); | ||
1264 | } | ||
1265 | |||
1266 | return count; | ||
1267 | } | ||
1268 | |||
1269 | |||
1270 | void | ||
1271 | usbdev_exit(void) | ||
1272 | { | ||
1273 | endpoint_t *ep; | ||
1274 | int i; | ||
1275 | |||
1276 | au_writel(0, USBD_INTEN); // disable usb dev ints | ||
1277 | au_writel(0, USBD_ENABLE); // disable usb dev | ||
1278 | |||
1279 | free_irq(AU1000_USB_DEV_REQ_INT, &usbdev); | ||
1280 | free_irq(AU1000_USB_DEV_SUS_INT, &usbdev); | ||
1281 | |||
1282 | // free all control endpoint resources | ||
1283 | ep = &usbdev.ep[0]; | ||
1284 | free_au1000_dma(ep->indma); | ||
1285 | free_au1000_dma(ep->outdma); | ||
1286 | endpoint_flush(ep); | ||
1287 | |||
1288 | // free ep resources | ||
1289 | for (i = 2; i < 6; i++) { | ||
1290 | ep = &usbdev.ep[i]; | ||
1291 | if (!ep->active) continue; | ||
1292 | |||
1293 | if (ep->direction == USB_DIR_IN) { | ||
1294 | free_au1000_dma(ep->indma); | ||
1295 | } else { | ||
1296 | free_au1000_dma(ep->outdma); | ||
1297 | } | ||
1298 | endpoint_flush(ep); | ||
1299 | } | ||
1300 | |||
1301 | kfree(usbdev.full_conf_desc); | ||
1302 | } | ||
1303 | |||
1304 | int | ||
1305 | usbdev_init(struct usb_device_descriptor* dev_desc, | ||
1306 | struct usb_config_descriptor* config_desc, | ||
1307 | struct usb_interface_descriptor* if_desc, | ||
1308 | struct usb_endpoint_descriptor* ep_desc, | ||
1309 | struct usb_string_descriptor* str_desc[], | ||
1310 | void (*cb)(usbdev_cb_type_t, unsigned long, void *), | ||
1311 | void* cb_data) | ||
1312 | { | ||
1313 | endpoint_t *ep0; | ||
1314 | int i, ret=0; | ||
1315 | u8* fcd; | ||
1316 | |||
1317 | if (dev_desc->bNumConfigurations > 1 || | ||
1318 | config_desc->bNumInterfaces > 1 || | ||
1319 | if_desc->bNumEndpoints > 4) { | ||
1320 | err("Only one config, one i/f, and no more " | ||
1321 | "than 4 ep's allowed"); | ||
1322 | ret = -EINVAL; | ||
1323 | goto out; | ||
1324 | } | ||
1325 | |||
1326 | if (!cb) { | ||
1327 | err("Function-layer callback required"); | ||
1328 | ret = -EINVAL; | ||
1329 | goto out; | ||
1330 | } | ||
1331 | |||
1332 | if (dev_desc->bMaxPacketSize0 != USBDEV_EP0_MAX_PACKET_SIZE) { | ||
1333 | warn("EP0 Max Packet size must be %d", | ||
1334 | USBDEV_EP0_MAX_PACKET_SIZE); | ||
1335 | dev_desc->bMaxPacketSize0 = USBDEV_EP0_MAX_PACKET_SIZE; | ||
1336 | } | ||
1337 | |||
1338 | memset(&usbdev, 0, sizeof(struct usb_dev)); | ||
1339 | |||
1340 | usbdev.state = DEFAULT; | ||
1341 | usbdev.dev_desc = dev_desc; | ||
1342 | usbdev.if_desc = if_desc; | ||
1343 | usbdev.conf_desc = config_desc; | ||
1344 | for (i=0; i<6; i++) | ||
1345 | usbdev.str_desc[i] = str_desc[i]; | ||
1346 | usbdev.func_cb = cb; | ||
1347 | usbdev.cb_data = cb_data; | ||
1348 | |||
1349 | /* Initialize default control endpoint */ | ||
1350 | ep0 = &usbdev.ep[0]; | ||
1351 | ep0->active = 1; | ||
1352 | ep0->type = CONTROL_EP; | ||
1353 | ep0->max_pkt_size = USBDEV_EP0_MAX_PACKET_SIZE; | ||
1354 | spin_lock_init(&ep0->lock); | ||
1355 | ep0->desc = NULL; // ep0 has no descriptor | ||
1356 | ep0->address = 0; | ||
1357 | ep0->direction = 0; | ||
1358 | ep0->reg = &ep_reg[0]; | ||
1359 | |||
1360 | /* Initialize the other requested endpoints */ | ||
1361 | for (i = 0; i < if_desc->bNumEndpoints; i++) { | ||
1362 | struct usb_endpoint_descriptor* epd = &ep_desc[i]; | ||
1363 | endpoint_t *ep; | ||
1364 | |||
1365 | if ((epd->bEndpointAddress & 0x80) == USB_DIR_IN) { | ||
1366 | ep = &usbdev.ep[2]; | ||
1367 | ep->address = 2; | ||
1368 | if (ep->active) { | ||
1369 | ep = &usbdev.ep[3]; | ||
1370 | ep->address = 3; | ||
1371 | if (ep->active) { | ||
1372 | err("too many IN ep's requested"); | ||
1373 | ret = -ENODEV; | ||
1374 | goto out; | ||
1375 | } | ||
1376 | } | ||
1377 | } else { | ||
1378 | ep = &usbdev.ep[4]; | ||
1379 | ep->address = 4; | ||
1380 | if (ep->active) { | ||
1381 | ep = &usbdev.ep[5]; | ||
1382 | ep->address = 5; | ||
1383 | if (ep->active) { | ||
1384 | err("too many OUT ep's requested"); | ||
1385 | ret = -ENODEV; | ||
1386 | goto out; | ||
1387 | } | ||
1388 | } | ||
1389 | } | ||
1390 | |||
1391 | ep->active = 1; | ||
1392 | epd->bEndpointAddress &= ~0x0f; | ||
1393 | epd->bEndpointAddress |= (u8)ep->address; | ||
1394 | ep->direction = epd->bEndpointAddress & 0x80; | ||
1395 | ep->type = epd->bmAttributes & 0x03; | ||
1396 | ep->max_pkt_size = le16_to_cpu(epd->wMaxPacketSize); | ||
1397 | spin_lock_init(&ep->lock); | ||
1398 | ep->desc = epd; | ||
1399 | ep->reg = &ep_reg[ep->address]; | ||
1400 | } | ||
1401 | |||
1402 | /* | ||
1403 | * initialize the full config descriptor | ||
1404 | */ | ||
1405 | usbdev.full_conf_desc = fcd = kmalloc(le16_to_cpu(config_desc->wTotalLength), | ||
1406 | ALLOC_FLAGS); | ||
1407 | if (!fcd) { | ||
1408 | err("failed to alloc full config descriptor"); | ||
1409 | ret = -ENOMEM; | ||
1410 | goto out; | ||
1411 | } | ||
1412 | |||
1413 | memcpy(fcd, config_desc, USB_DT_CONFIG_SIZE); | ||
1414 | fcd += USB_DT_CONFIG_SIZE; | ||
1415 | memcpy(fcd, if_desc, USB_DT_INTERFACE_SIZE); | ||
1416 | fcd += USB_DT_INTERFACE_SIZE; | ||
1417 | for (i = 0; i < if_desc->bNumEndpoints; i++) { | ||
1418 | memcpy(fcd, &ep_desc[i], USB_DT_ENDPOINT_SIZE); | ||
1419 | fcd += USB_DT_ENDPOINT_SIZE; | ||
1420 | } | ||
1421 | |||
1422 | /* Now we're ready to enable the controller */ | ||
1423 | au_writel(0x0002, USBD_ENABLE); | ||
1424 | udelay(100); | ||
1425 | au_writel(0x0003, USBD_ENABLE); | ||
1426 | udelay(100); | ||
1427 | |||
1428 | /* build and send config table based on ep descriptors */ | ||
1429 | for (i = 0; i < 6; i++) { | ||
1430 | endpoint_t *ep; | ||
1431 | if (i == 1) | ||
1432 | continue; // skip dummy ep | ||
1433 | ep = &usbdev.ep[i]; | ||
1434 | if (ep->active) { | ||
1435 | au_writel((ep->address << 4) | 0x04, USBD_CONFIG); | ||
1436 | au_writel(((ep->max_pkt_size & 0x380) >> 7) | | ||
1437 | (ep->direction >> 4) | (ep->type << 4), | ||
1438 | USBD_CONFIG); | ||
1439 | au_writel((ep->max_pkt_size & 0x7f) << 1, USBD_CONFIG); | ||
1440 | au_writel(0x00, USBD_CONFIG); | ||
1441 | au_writel(ep->address, USBD_CONFIG); | ||
1442 | } else { | ||
1443 | u8 dir = (i==2 || i==3) ? DIR_IN : DIR_OUT; | ||
1444 | au_writel((i << 4) | 0x04, USBD_CONFIG); | ||
1445 | au_writel(((16 & 0x380) >> 7) | dir | | ||
1446 | (BULK_EP << 4), USBD_CONFIG); | ||
1447 | au_writel((16 & 0x7f) << 1, USBD_CONFIG); | ||
1448 | au_writel(0x00, USBD_CONFIG); | ||
1449 | au_writel(i, USBD_CONFIG); | ||
1450 | } | ||
1451 | } | ||
1452 | |||
1453 | /* | ||
1454 | * Enable Receive FIFO Complete interrupts only. Transmit | ||
1455 | * complete is being handled by the DMA done interrupts. | ||
1456 | */ | ||
1457 | au_writel(0x31, USBD_INTEN); | ||
1458 | |||
1459 | /* | ||
1460 | * Controller is now enabled, request DMA and IRQ | ||
1461 | * resources. | ||
1462 | */ | ||
1463 | |||
1464 | /* request the USB device transfer complete interrupt */ | ||
1465 | if (request_irq(AU1000_USB_DEV_REQ_INT, req_sus_intr, IRQF_DISABLED, | ||
1466 | "USBdev req", &usbdev)) { | ||
1467 | err("Can't get device request intr"); | ||
1468 | ret = -ENXIO; | ||
1469 | goto out; | ||
1470 | } | ||
1471 | /* request the USB device suspend interrupt */ | ||
1472 | if (request_irq(AU1000_USB_DEV_SUS_INT, req_sus_intr, IRQF_DISABLED, | ||
1473 | "USBdev sus", &usbdev)) { | ||
1474 | err("Can't get device suspend intr"); | ||
1475 | ret = -ENXIO; | ||
1476 | goto out; | ||
1477 | } | ||
1478 | |||
1479 | /* Request EP0 DMA and IRQ */ | ||
1480 | if ((ep0->indma = request_au1000_dma(ep_dma_id[0].id, | ||
1481 | ep_dma_id[0].str, | ||
1482 | dma_done_ep0_intr, | ||
1483 | IRQF_DISABLED, | ||
1484 | &usbdev)) < 0) { | ||
1485 | err("Can't get %s DMA", ep_dma_id[0].str); | ||
1486 | ret = -ENXIO; | ||
1487 | goto out; | ||
1488 | } | ||
1489 | if ((ep0->outdma = request_au1000_dma(ep_dma_id[1].id, | ||
1490 | ep_dma_id[1].str, | ||
1491 | NULL, 0, NULL)) < 0) { | ||
1492 | err("Can't get %s DMA", ep_dma_id[1].str); | ||
1493 | ret = -ENXIO; | ||
1494 | goto out; | ||
1495 | } | ||
1496 | |||
1497 | // Flush the ep0 buffers and FIFOs | ||
1498 | endpoint_flush(ep0); | ||
1499 | // start packet reception on ep0 | ||
1500 | kickstart_receive_packet(ep0); | ||
1501 | |||
1502 | /* Request DMA and IRQ for the other endpoints */ | ||
1503 | for (i = 2; i < 6; i++) { | ||
1504 | endpoint_t *ep = &usbdev.ep[i]; | ||
1505 | if (!ep->active) | ||
1506 | continue; | ||
1507 | |||
1508 | // Flush the endpoint buffers and FIFOs | ||
1509 | endpoint_flush(ep); | ||
1510 | |||
1511 | if (ep->direction == USB_DIR_IN) { | ||
1512 | ep->indma = | ||
1513 | request_au1000_dma(ep_dma_id[ep->address].id, | ||
1514 | ep_dma_id[ep->address].str, | ||
1515 | dma_done_ep_intr, | ||
1516 | IRQF_DISABLED, | ||
1517 | &usbdev); | ||
1518 | if (ep->indma < 0) { | ||
1519 | err("Can't get %s DMA", | ||
1520 | ep_dma_id[ep->address].str); | ||
1521 | ret = -ENXIO; | ||
1522 | goto out; | ||
1523 | } | ||
1524 | } else { | ||
1525 | ep->outdma = | ||
1526 | request_au1000_dma(ep_dma_id[ep->address].id, | ||
1527 | ep_dma_id[ep->address].str, | ||
1528 | NULL, 0, NULL); | ||
1529 | if (ep->outdma < 0) { | ||
1530 | err("Can't get %s DMA", | ||
1531 | ep_dma_id[ep->address].str); | ||
1532 | ret = -ENXIO; | ||
1533 | goto out; | ||
1534 | } | ||
1535 | |||
1536 | // start packet reception on OUT endpoint | ||
1537 | kickstart_receive_packet(ep); | ||
1538 | } | ||
1539 | } | ||
1540 | |||
1541 | out: | ||
1542 | if (ret) | ||
1543 | usbdev_exit(); | ||
1544 | return ret; | ||
1545 | } | ||
1546 | |||
1547 | EXPORT_SYMBOL(usbdev_init); | ||
1548 | EXPORT_SYMBOL(usbdev_exit); | ||
1549 | EXPORT_SYMBOL(usbdev_alloc_packet); | ||
1550 | EXPORT_SYMBOL(usbdev_receive_packet); | ||
1551 | EXPORT_SYMBOL(usbdev_send_packet); | ||
1552 | EXPORT_SYMBOL(usbdev_get_byte_count); | ||
diff --git a/arch/mips/au1000/db1x00/board_setup.c b/arch/mips/au1000/db1x00/board_setup.c index 7a79293f8527..8b08edb977be 100644 --- a/arch/mips/au1000/db1x00/board_setup.c +++ b/arch/mips/au1000/db1x00/board_setup.c | |||
@@ -58,11 +58,6 @@ void __init board_setup(void) | |||
58 | 58 | ||
59 | pin_func = 0; | 59 | pin_func = 0; |
60 | /* not valid for 1550 */ | 60 | /* not valid for 1550 */ |
61 | #ifdef CONFIG_AU1X00_USB_DEVICE | ||
62 | // 2nd USB port is USB device | ||
63 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); | ||
64 | au_writel(pin_func, SYS_PINFUNC); | ||
65 | #endif | ||
66 | 61 | ||
67 | #if defined(CONFIG_IRDA) && (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100)) | 62 | #if defined(CONFIG_IRDA) && (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100)) |
68 | /* set IRFIRSEL instead of GPIO15 */ | 63 | /* set IRFIRSEL instead of GPIO15 */ |
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c index e917e54fc683..13f9bf5f91a6 100644 --- a/arch/mips/au1000/mtx-1/board_setup.c +++ b/arch/mips/au1000/mtx-1/board_setup.c | |||
@@ -51,15 +51,11 @@ void board_reset (void) | |||
51 | 51 | ||
52 | void __init board_setup(void) | 52 | void __init board_setup(void) |
53 | { | 53 | { |
54 | #if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) | 54 | #ifdef CONFIG_USB_OHCI |
55 | #ifdef CONFIG_AU1X00_USB_DEVICE | ||
56 | // 2nd USB port is USB device | ||
57 | au_writel(au_readl(SYS_PINFUNC) & (u32)(~0x8000), SYS_PINFUNC); | ||
58 | #endif | ||
59 | // enable USB power switch | 55 | // enable USB power switch |
60 | au_writel( au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR ); | 56 | au_writel( au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR ); |
61 | au_writel( 0x100000, GPIO2_OUTPUT ); | 57 | au_writel( 0x100000, GPIO2_OUTPUT ); |
62 | #endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) | 58 | #endif // defined (CONFIG_USB_OHCI) |
63 | 59 | ||
64 | #ifdef CONFIG_PCI | 60 | #ifdef CONFIG_PCI |
65 | #if defined(__MIPSEB__) | 61 | #if defined(__MIPSEB__) |
diff --git a/arch/mips/au1000/pb1000/board_setup.c b/arch/mips/au1000/pb1000/board_setup.c index 1cf18e16ab54..824cfafaff92 100644 --- a/arch/mips/au1000/pb1000/board_setup.c +++ b/arch/mips/au1000/pb1000/board_setup.c | |||
@@ -54,7 +54,7 @@ void __init board_setup(void) | |||
54 | au_writel(0, SYS_PINSTATERD); | 54 | au_writel(0, SYS_PINSTATERD); |
55 | udelay(100); | 55 | udelay(100); |
56 | 56 | ||
57 | #if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) | 57 | #ifdef CONFIG_USB_OHCI |
58 | /* zero and disable FREQ2 */ | 58 | /* zero and disable FREQ2 */ |
59 | sys_freqctrl = au_readl(SYS_FREQCTRL0); | 59 | sys_freqctrl = au_readl(SYS_FREQCTRL0); |
60 | sys_freqctrl &= ~0xFFF00000; | 60 | sys_freqctrl &= ~0xFFF00000; |
@@ -105,22 +105,18 @@ void __init board_setup(void) | |||
105 | #ifdef CONFIG_USB_OHCI | 105 | #ifdef CONFIG_USB_OHCI |
106 | sys_clksrc |= ((4<<12) | (0<<11) | (0<<10)); | 106 | sys_clksrc |= ((4<<12) | (0<<11) | (0<<10)); |
107 | #endif | 107 | #endif |
108 | #ifdef CONFIG_AU1X00_USB_DEVICE | ||
109 | sys_clksrc |= ((4<<7) | (0<<6) | (0<<5)); | ||
110 | #endif | ||
111 | au_writel(sys_clksrc, SYS_CLKSRC); | 108 | au_writel(sys_clksrc, SYS_CLKSRC); |
112 | 109 | ||
113 | // configure pins GPIO[14:9] as GPIO | 110 | // configure pins GPIO[14:9] as GPIO |
114 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8080); | 111 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8080); |
115 | 112 | ||
116 | #ifndef CONFIG_AU1X00_USB_DEVICE | ||
117 | // 2nd USB port is USB host | 113 | // 2nd USB port is USB host |
118 | pin_func |= 0x8000; | 114 | pin_func |= 0x8000; |
119 | #endif | 115 | |
120 | au_writel(pin_func, SYS_PINFUNC); | 116 | au_writel(pin_func, SYS_PINFUNC); |
121 | au_writel(0x2800, SYS_TRIOUTCLR); | 117 | au_writel(0x2800, SYS_TRIOUTCLR); |
122 | au_writel(0x0030, SYS_OUTPUTCLR); | 118 | au_writel(0x0030, SYS_OUTPUTCLR); |
123 | #endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) | 119 | #endif // defined (CONFIG_USB_OHCI) |
124 | 120 | ||
125 | // make gpio 15 an input (for interrupt line) | 121 | // make gpio 15 an input (for interrupt line) |
126 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x100); | 122 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x100); |
diff --git a/arch/mips/au1000/pb1100/board_setup.c b/arch/mips/au1000/pb1100/board_setup.c index db27b9331ff3..2d1533f116c0 100644 --- a/arch/mips/au1000/pb1100/board_setup.c +++ b/arch/mips/au1000/pb1100/board_setup.c | |||
@@ -55,7 +55,7 @@ void __init board_setup(void) | |||
55 | au_writel(0, SYS_PININPUTEN); | 55 | au_writel(0, SYS_PININPUTEN); |
56 | udelay(100); | 56 | udelay(100); |
57 | 57 | ||
58 | #if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) | 58 | #ifdef CONFIG_USB_OHCI |
59 | // configure pins GPIO[14:9] as GPIO | 59 | // configure pins GPIO[14:9] as GPIO |
60 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80); | 60 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x80); |
61 | 61 | ||
@@ -92,12 +92,10 @@ void __init board_setup(void) | |||
92 | 92 | ||
93 | // get USB Functionality pin state (device vs host drive pins) | 93 | // get USB Functionality pin state (device vs host drive pins) |
94 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); | 94 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); |
95 | #ifndef CONFIG_AU1X00_USB_DEVICE | ||
96 | // 2nd USB port is USB host | 95 | // 2nd USB port is USB host |
97 | pin_func |= 0x8000; | 96 | pin_func |= 0x8000; |
98 | #endif | ||
99 | au_writel(pin_func, SYS_PINFUNC); | 97 | au_writel(pin_func, SYS_PINFUNC); |
100 | #endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) | 98 | #endif // defined (CONFIG_USB_OHCI) |
101 | 99 | ||
102 | /* Enable sys bus clock divider when IDLE state or no bus activity. */ | 100 | /* Enable sys bus clock divider when IDLE state or no bus activity. */ |
103 | au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); | 101 | au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); |
diff --git a/arch/mips/au1000/pb1500/board_setup.c b/arch/mips/au1000/pb1500/board_setup.c index 1a9a293de6ab..0ffdb4fd575b 100644 --- a/arch/mips/au1000/pb1500/board_setup.c +++ b/arch/mips/au1000/pb1500/board_setup.c | |||
@@ -56,7 +56,7 @@ void __init board_setup(void) | |||
56 | au_writel(0, SYS_PINSTATERD); | 56 | au_writel(0, SYS_PINSTATERD); |
57 | udelay(100); | 57 | udelay(100); |
58 | 58 | ||
59 | #if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) | 59 | #ifdef CONFIG_USB_OHCI |
60 | 60 | ||
61 | /* GPIO201 is input for PCMCIA card detect */ | 61 | /* GPIO201 is input for PCMCIA card detect */ |
62 | /* GPIO203 is input for PCMCIA interrupt request */ | 62 | /* GPIO203 is input for PCMCIA interrupt request */ |
@@ -88,19 +88,14 @@ void __init board_setup(void) | |||
88 | #ifdef CONFIG_USB_OHCI | 88 | #ifdef CONFIG_USB_OHCI |
89 | sys_clksrc |= ((4<<12) | (0<<11) | (0<<10)); | 89 | sys_clksrc |= ((4<<12) | (0<<11) | (0<<10)); |
90 | #endif | 90 | #endif |
91 | #ifdef CONFIG_AU1X00_USB_DEVICE | ||
92 | sys_clksrc |= ((4<<7) | (0<<6) | (0<<5)); | ||
93 | #endif | ||
94 | au_writel(sys_clksrc, SYS_CLKSRC); | 91 | au_writel(sys_clksrc, SYS_CLKSRC); |
95 | 92 | ||
96 | 93 | ||
97 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); | 94 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8000); |
98 | #ifndef CONFIG_AU1X00_USB_DEVICE | ||
99 | // 2nd USB port is USB host | 95 | // 2nd USB port is USB host |
100 | pin_func |= 0x8000; | 96 | pin_func |= 0x8000; |
101 | #endif | ||
102 | au_writel(pin_func, SYS_PINFUNC); | 97 | au_writel(pin_func, SYS_PINFUNC); |
103 | #endif // defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE) | 98 | #endif // defined (CONFIG_USB_OHCI) |
104 | 99 | ||
105 | 100 | ||
106 | 101 | ||
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig index 741f8258075c..9e672f63a0aa 100644 --- a/arch/mips/configs/pb1100_defconfig +++ b/arch/mips/configs/pb1100_defconfig | |||
@@ -76,7 +76,6 @@ CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y | |||
76 | CONFIG_SOC_AU1100=y | 76 | CONFIG_SOC_AU1100=y |
77 | CONFIG_SOC_AU1X00=y | 77 | CONFIG_SOC_AU1X00=y |
78 | CONFIG_SWAP_IO_SPACE=y | 78 | CONFIG_SWAP_IO_SPACE=y |
79 | # CONFIG_AU1X00_USB_DEVICE is not set | ||
80 | CONFIG_MIPS_L1_CACHE_SHIFT=5 | 79 | CONFIG_MIPS_L1_CACHE_SHIFT=5 |
81 | 80 | ||
82 | # | 81 | # |
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig index 8576340714da..d0c0f4af1bff 100644 --- a/arch/mips/configs/pb1500_defconfig +++ b/arch/mips/configs/pb1500_defconfig | |||
@@ -75,7 +75,6 @@ CONFIG_CPU_LITTLE_ENDIAN=y | |||
75 | CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y | 75 | CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y |
76 | CONFIG_SOC_AU1500=y | 76 | CONFIG_SOC_AU1500=y |
77 | CONFIG_SOC_AU1X00=y | 77 | CONFIG_SOC_AU1X00=y |
78 | # CONFIG_AU1X00_USB_DEVICE is not set | ||
79 | CONFIG_MIPS_L1_CACHE_SHIFT=5 | 78 | CONFIG_MIPS_L1_CACHE_SHIFT=5 |
80 | 79 | ||
81 | # | 80 | # |
diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S index 55d60d5e0e86..31dd47d1002d 100644 --- a/arch/mips/dec/int-handler.S +++ b/arch/mips/dec/int-handler.S | |||
@@ -266,10 +266,8 @@ | |||
266 | handle_it: | 266 | handle_it: |
267 | LONG_L s0, TI_REGS($28) | 267 | LONG_L s0, TI_REGS($28) |
268 | LONG_S sp, TI_REGS($28) | 268 | LONG_S sp, TI_REGS($28) |
269 | jal do_IRQ | 269 | PTR_LA ra, ret_from_irq |
270 | LONG_S s0, TI_REGS($28) | 270 | j do_IRQ |
271 | |||
272 | j ret_from_irq | ||
273 | nop | 271 | nop |
274 | 272 | ||
275 | #ifdef CONFIG_32BIT | 273 | #ifdef CONFIG_32BIT |
@@ -279,9 +277,8 @@ fpu: | |||
279 | #endif | 277 | #endif |
280 | 278 | ||
281 | spurious: | 279 | spurious: |
282 | jal spurious_interrupt | 280 | PTR_LA ra, _ret_from_irq |
283 | nop | 281 | j spurious_interrupt |
284 | j ret_from_irq | ||
285 | nop | 282 | nop |
286 | END(plat_irq_dispatch) | 283 | END(plat_irq_dispatch) |
287 | 284 | ||
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 9fbf8430c849..8485af340ee1 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -135,7 +135,6 @@ static inline void check_wait(void) | |||
135 | case CPU_R5000: | 135 | case CPU_R5000: |
136 | case CPU_NEVADA: | 136 | case CPU_NEVADA: |
137 | case CPU_RM7000: | 137 | case CPU_RM7000: |
138 | case CPU_RM9000: | ||
139 | case CPU_4KC: | 138 | case CPU_4KC: |
140 | case CPU_4KEC: | 139 | case CPU_4KEC: |
141 | case CPU_4KSC: | 140 | case CPU_4KSC: |
@@ -164,6 +163,14 @@ static inline void check_wait(void) | |||
164 | } else | 163 | } else |
165 | printk(" unavailable.\n"); | 164 | printk(" unavailable.\n"); |
166 | break; | 165 | break; |
166 | case CPU_RM9000: | ||
167 | if ((c->processor_id & 0x00ff) >= 0x40) { | ||
168 | cpu_wait = r4k_wait; | ||
169 | printk(" available.\n"); | ||
170 | } else { | ||
171 | printk(" unavailable.\n"); | ||
172 | } | ||
173 | break; | ||
167 | default: | 174 | default: |
168 | printk(" unavailable.\n"); | 175 | printk(" unavailable.\n"); |
169 | break; | 176 | break; |
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S index e93e43e1f42d..417c08ac76eb 100644 --- a/arch/mips/kernel/entry.S +++ b/arch/mips/kernel/entry.S | |||
@@ -20,10 +20,7 @@ | |||
20 | #include <asm/mipsmtregs.h> | 20 | #include <asm/mipsmtregs.h> |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef CONFIG_PREEMPT | 23 | #ifndef CONFIG_PREEMPT |
24 | .macro preempt_stop | ||
25 | .endm | ||
26 | #else | ||
27 | .macro preempt_stop | 24 | .macro preempt_stop |
28 | local_irq_disable | 25 | local_irq_disable |
29 | .endm | 26 | .endm |
@@ -32,9 +29,16 @@ | |||
32 | 29 | ||
33 | .text | 30 | .text |
34 | .align 5 | 31 | .align 5 |
32 | FEXPORT(ret_from_irq) | ||
33 | LONG_S s0, TI_REGS($28) | ||
34 | #ifdef CONFIG_PREEMPT | ||
35 | FEXPORT(ret_from_exception) | ||
36 | #else | ||
37 | b _ret_from_irq | ||
35 | FEXPORT(ret_from_exception) | 38 | FEXPORT(ret_from_exception) |
36 | preempt_stop | 39 | preempt_stop |
37 | FEXPORT(ret_from_irq) | 40 | #endif |
41 | FEXPORT(_ret_from_irq) | ||
38 | LONG_L t0, PT_STATUS(sp) # returning to kernel mode? | 42 | LONG_L t0, PT_STATUS(sp) # returning to kernel mode? |
39 | andi t0, t0, KU_USER | 43 | andi t0, t0, KU_USER |
40 | beqz t0, resume_kernel | 44 | beqz t0, resume_kernel |
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S index 50ed77297728..5baca16993d0 100644 --- a/arch/mips/kernel/genex.S +++ b/arch/mips/kernel/genex.S | |||
@@ -133,9 +133,8 @@ NESTED(handle_int, PT_SIZE, sp) | |||
133 | 133 | ||
134 | LONG_L s0, TI_REGS($28) | 134 | LONG_L s0, TI_REGS($28) |
135 | LONG_S sp, TI_REGS($28) | 135 | LONG_S sp, TI_REGS($28) |
136 | jal plat_irq_dispatch | 136 | PTR_LA ra, ret_from_irq |
137 | LONG_S s0, TI_REGS($28) | 137 | j plat_irq_dispatch |
138 | j ret_from_irq | ||
139 | END(handle_int) | 138 | END(handle_int) |
140 | 139 | ||
141 | __INIT | 140 | __INIT |
@@ -224,9 +223,8 @@ NESTED(except_vec_vi_handler, 0, sp) | |||
224 | 223 | ||
225 | LONG_L s0, TI_REGS($28) | 224 | LONG_L s0, TI_REGS($28) |
226 | LONG_S sp, TI_REGS($28) | 225 | LONG_S sp, TI_REGS($28) |
227 | jalr v0 | ||
228 | LONG_S s0, TI_REGS($28) | ||
229 | PTR_LA ra, ret_from_irq | 226 | PTR_LA ra, ret_from_irq |
227 | jr v0 | ||
230 | END(except_vec_vi_handler) | 228 | END(except_vec_vi_handler) |
231 | 229 | ||
232 | /* | 230 | /* |
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index 46ee5a68ab13..4ed37ba19731 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c | |||
@@ -107,7 +107,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
107 | 107 | ||
108 | seq_printf(m, "processor\t\t: %ld\n", n); | 108 | seq_printf(m, "processor\t\t: %ld\n", n); |
109 | sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n", | 109 | sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n", |
110 | cpu_has_fpu ? " FPU V%d.%d" : ""); | 110 | cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : ""); |
111 | seq_printf(m, fmt, cpu_name[cpu_data[n].cputype <= CPU_LAST ? | 111 | seq_printf(m, fmt, cpu_name[cpu_data[n].cputype <= CPU_LAST ? |
112 | cpu_data[n].cputype : CPU_UNKNOWN], | 112 | cpu_data[n].cputype : CPU_UNKNOWN], |
113 | (version >> 4) & 0x0f, version & 0x0f, | 113 | (version >> 4) & 0x0f, version & 0x0f, |
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 045d987bc683..9f307eb1a31e 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
@@ -115,7 +115,7 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp) | |||
115 | status |= KU_USER; | 115 | status |= KU_USER; |
116 | regs->cp0_status = status; | 116 | regs->cp0_status = status; |
117 | clear_used_math(); | 117 | clear_used_math(); |
118 | lose_fpu(); | 118 | clear_fpu_owner(); |
119 | if (cpu_has_dsp) | 119 | if (cpu_has_dsp) |
120 | __init_dsp(); | 120 | __init_dsp(); |
121 | regs->cp0_epc = pc; | 121 | regs->cp0_epc = pc; |
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 362d1728e531..258d74fd0b63 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
@@ -106,6 +106,7 @@ int ptrace_setregs (struct task_struct *child, __s64 __user *data) | |||
106 | int ptrace_getfpregs (struct task_struct *child, __u32 __user *data) | 106 | int ptrace_getfpregs (struct task_struct *child, __u32 __user *data) |
107 | { | 107 | { |
108 | int i; | 108 | int i; |
109 | unsigned int tmp; | ||
109 | 110 | ||
110 | if (!access_ok(VERIFY_WRITE, data, 33 * 8)) | 111 | if (!access_ok(VERIFY_WRITE, data, 33 * 8)) |
111 | return -EIO; | 112 | return -EIO; |
@@ -121,10 +122,10 @@ int ptrace_getfpregs (struct task_struct *child, __u32 __user *data) | |||
121 | 122 | ||
122 | __put_user (child->thread.fpu.fcr31, data + 64); | 123 | __put_user (child->thread.fpu.fcr31, data + 64); |
123 | 124 | ||
125 | preempt_disable(); | ||
124 | if (cpu_has_fpu) { | 126 | if (cpu_has_fpu) { |
125 | unsigned int flags, tmp; | 127 | unsigned int flags; |
126 | 128 | ||
127 | preempt_disable(); | ||
128 | if (cpu_has_mipsmt) { | 129 | if (cpu_has_mipsmt) { |
129 | unsigned int vpflags = dvpe(); | 130 | unsigned int vpflags = dvpe(); |
130 | flags = read_c0_status(); | 131 | flags = read_c0_status(); |
@@ -138,11 +139,11 @@ int ptrace_getfpregs (struct task_struct *child, __u32 __user *data) | |||
138 | __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp)); | 139 | __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp)); |
139 | write_c0_status(flags); | 140 | write_c0_status(flags); |
140 | } | 141 | } |
141 | preempt_enable(); | ||
142 | __put_user (tmp, data + 65); | ||
143 | } else { | 142 | } else { |
144 | __put_user ((__u32) 0, data + 65); | 143 | tmp = 0; |
145 | } | 144 | } |
145 | preempt_enable(); | ||
146 | __put_user (tmp, data + 65); | ||
146 | 147 | ||
147 | return 0; | 148 | return 0; |
148 | } | 149 | } |
@@ -245,16 +246,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
245 | unsigned int mtflags; | 246 | unsigned int mtflags; |
246 | #endif /* CONFIG_MIPS_MT_SMTC */ | 247 | #endif /* CONFIG_MIPS_MT_SMTC */ |
247 | 248 | ||
248 | if (!cpu_has_fpu) | 249 | preempt_disable(); |
250 | if (!cpu_has_fpu) { | ||
251 | preempt_enable(); | ||
249 | break; | 252 | break; |
253 | } | ||
250 | 254 | ||
251 | #ifdef CONFIG_MIPS_MT_SMTC | 255 | #ifdef CONFIG_MIPS_MT_SMTC |
252 | /* Read-modify-write of Status must be atomic */ | 256 | /* Read-modify-write of Status must be atomic */ |
253 | local_irq_save(irqflags); | 257 | local_irq_save(irqflags); |
254 | mtflags = dmt(); | 258 | mtflags = dmt(); |
255 | #endif /* CONFIG_MIPS_MT_SMTC */ | 259 | #endif /* CONFIG_MIPS_MT_SMTC */ |
256 | |||
257 | preempt_disable(); | ||
258 | if (cpu_has_mipsmt) { | 260 | if (cpu_has_mipsmt) { |
259 | unsigned int vpflags = dvpe(); | 261 | unsigned int vpflags = dvpe(); |
260 | flags = read_c0_status(); | 262 | flags = read_c0_status(); |
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c index f40ecd8be05f..d9a39c169450 100644 --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c | |||
@@ -175,7 +175,9 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
175 | unsigned int mtflags; | 175 | unsigned int mtflags; |
176 | #endif /* CONFIG_MIPS_MT_SMTC */ | 176 | #endif /* CONFIG_MIPS_MT_SMTC */ |
177 | 177 | ||
178 | preempt_disable(); | ||
178 | if (!cpu_has_fpu) { | 179 | if (!cpu_has_fpu) { |
180 | preempt_enable(); | ||
179 | tmp = 0; | 181 | tmp = 0; |
180 | break; | 182 | break; |
181 | } | 183 | } |
@@ -186,7 +188,6 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
186 | mtflags = dmt(); | 188 | mtflags = dmt(); |
187 | #endif /* CONFIG_MIPS_MT_SMTC */ | 189 | #endif /* CONFIG_MIPS_MT_SMTC */ |
188 | 190 | ||
189 | preempt_disable(); | ||
190 | if (cpu_has_mipsmt) { | 191 | if (cpu_has_mipsmt) { |
191 | unsigned int vpflags = dvpe(); | 192 | unsigned int vpflags = dvpe(); |
192 | flags = read_c0_status(); | 193 | flags = read_c0_status(); |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 221895802dca..1af3612a1ce8 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -467,14 +467,18 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); | |||
467 | 467 | ||
468 | static int __init topology_init(void) | 468 | static int __init topology_init(void) |
469 | { | 469 | { |
470 | int cpu; | 470 | int i, ret; |
471 | int ret; | ||
472 | 471 | ||
473 | for_each_present_cpu(cpu) { | 472 | #ifdef CONFIG_NUMA |
474 | ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu); | 473 | for_each_online_node(i) |
474 | register_one_node(i); | ||
475 | #endif /* CONFIG_NUMA */ | ||
476 | |||
477 | for_each_present_cpu(i) { | ||
478 | ret = register_cpu(&per_cpu(cpu_devices, i), i); | ||
475 | if (ret) | 479 | if (ret) |
476 | printk(KERN_WARNING "topology_init: register_cpu %d " | 480 | printk(KERN_WARNING "topology_init: register_cpu %d " |
477 | "failed (%d)\n", cpu, ret); | 481 | "failed (%d)\n", i, ret); |
478 | } | 482 | } |
479 | 483 | ||
480 | return 0; | 484 | return 0; |
diff --git a/arch/mips/kernel/smtc-asm.S b/arch/mips/kernel/smtc-asm.S index 76cb31d57482..1cb9441f1474 100644 --- a/arch/mips/kernel/smtc-asm.S +++ b/arch/mips/kernel/smtc-asm.S | |||
@@ -97,15 +97,12 @@ FEXPORT(__smtc_ipi_vector) | |||
97 | SAVE_ALL | 97 | SAVE_ALL |
98 | CLI | 98 | CLI |
99 | TRACE_IRQS_OFF | 99 | TRACE_IRQS_OFF |
100 | move a0,sp | ||
101 | /* Function to be invoked passed stack pad slot 5 */ | 100 | /* Function to be invoked passed stack pad slot 5 */ |
102 | lw t0,PT_PADSLOT5(sp) | 101 | lw t0,PT_PADSLOT5(sp) |
103 | /* Argument from sender passed in stack pad slot 4 */ | 102 | /* Argument from sender passed in stack pad slot 4 */ |
104 | lw a1,PT_PADSLOT4(sp) | 103 | lw a0,PT_PADSLOT4(sp) |
105 | jalr t0 | 104 | PTR_LA ra, _ret_from_irq |
106 | nop | 105 | jr t0 |
107 | j ret_from_irq | ||
108 | nop | ||
109 | 106 | ||
110 | /* | 107 | /* |
111 | * Called from idle loop to provoke processing of queued IPIs | 108 | * Called from idle loop to provoke processing of queued IPIs |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index b7292a56d4cd..cce8313ec27d 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -66,7 +66,7 @@ extern asmlinkage void handle_mcheck(void); | |||
66 | extern asmlinkage void handle_reserved(void); | 66 | extern asmlinkage void handle_reserved(void); |
67 | 67 | ||
68 | extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, | 68 | extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, |
69 | struct mips_fpu_struct *ctx); | 69 | struct mips_fpu_struct *ctx, int has_fpu); |
70 | 70 | ||
71 | void (*board_be_init)(void); | 71 | void (*board_be_init)(void); |
72 | int (*board_be_handler)(struct pt_regs *regs, int is_fixup); | 72 | int (*board_be_handler)(struct pt_regs *regs, int is_fixup); |
@@ -641,7 +641,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) | |||
641 | preempt_enable(); | 641 | preempt_enable(); |
642 | 642 | ||
643 | /* Run the emulator */ | 643 | /* Run the emulator */ |
644 | sig = fpu_emulator_cop1Handler (regs, ¤t->thread.fpu); | 644 | sig = fpu_emulator_cop1Handler (regs, ¤t->thread.fpu, 1); |
645 | 645 | ||
646 | preempt_disable(); | 646 | preempt_disable(); |
647 | 647 | ||
@@ -791,11 +791,13 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
791 | set_used_math(); | 791 | set_used_math(); |
792 | } | 792 | } |
793 | 793 | ||
794 | preempt_enable(); | 794 | if (cpu_has_fpu) { |
795 | 795 | preempt_enable(); | |
796 | if (!cpu_has_fpu) { | 796 | } else { |
797 | int sig = fpu_emulator_cop1Handler(regs, | 797 | int sig; |
798 | ¤t->thread.fpu); | 798 | preempt_enable(); |
799 | sig = fpu_emulator_cop1Handler(regs, | ||
800 | ¤t->thread.fpu, 0); | ||
799 | if (sig) | 801 | if (sig) |
800 | force_sig(sig, current); | 802 | force_sig(sig, current); |
801 | #ifdef CONFIG_MIPS_MT_FPAFF | 803 | #ifdef CONFIG_MIPS_MT_FPAFF |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 3f0d5d26d506..80531b35cd61 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -38,8 +38,6 @@ | |||
38 | 38 | ||
39 | #include <asm/inst.h> | 39 | #include <asm/inst.h> |
40 | #include <asm/bootinfo.h> | 40 | #include <asm/bootinfo.h> |
41 | #include <asm/cpu.h> | ||
42 | #include <asm/cpu-features.h> | ||
43 | #include <asm/processor.h> | 41 | #include <asm/processor.h> |
44 | #include <asm/ptrace.h> | 42 | #include <asm/ptrace.h> |
45 | #include <asm/signal.h> | 43 | #include <asm/signal.h> |
@@ -1233,7 +1231,8 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
1233 | return 0; | 1231 | return 0; |
1234 | } | 1232 | } |
1235 | 1233 | ||
1236 | int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | 1234 | int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx, |
1235 | int has_fpu) | ||
1237 | { | 1236 | { |
1238 | unsigned long oldepc, prevepc; | 1237 | unsigned long oldepc, prevepc; |
1239 | mips_instruction insn; | 1238 | mips_instruction insn; |
@@ -1263,7 +1262,7 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx) | |||
1263 | ieee754_csr.rm = mips_rm[ieee754_csr.rm]; | 1262 | ieee754_csr.rm = mips_rm[ieee754_csr.rm]; |
1264 | } | 1263 | } |
1265 | 1264 | ||
1266 | if (cpu_has_fpu) | 1265 | if (has_fpu) |
1267 | break; | 1266 | break; |
1268 | if (sig) | 1267 | if (sig) |
1269 | break; | 1268 | break; |
diff --git a/arch/mips/mips-boards/malta/malta_int.c b/arch/mips/mips-boards/malta/malta_int.c index ed221dc7f6ac..6244d0e2c7de 100644 --- a/arch/mips/mips-boards/malta/malta_int.c +++ b/arch/mips/mips-boards/malta/malta_int.c | |||
@@ -212,23 +212,23 @@ static inline unsigned int irq_ffs(unsigned int pending) | |||
212 | unsigned int a0 = 7; | 212 | unsigned int a0 = 7; |
213 | unsigned int t0; | 213 | unsigned int t0; |
214 | 214 | ||
215 | t0 = s0 & 0xf000; | 215 | t0 = pending & 0xf000; |
216 | t0 = t0 < 1; | 216 | t0 = t0 < 1; |
217 | t0 = t0 << 2; | 217 | t0 = t0 << 2; |
218 | a0 = a0 - t0; | 218 | a0 = a0 - t0; |
219 | s0 = s0 << t0; | 219 | pending = pending << t0; |
220 | 220 | ||
221 | t0 = s0 & 0xc000; | 221 | t0 = pending & 0xc000; |
222 | t0 = t0 < 1; | 222 | t0 = t0 < 1; |
223 | t0 = t0 << 1; | 223 | t0 = t0 << 1; |
224 | a0 = a0 - t0; | 224 | a0 = a0 - t0; |
225 | s0 = s0 << t0; | 225 | pending = pending << t0; |
226 | 226 | ||
227 | t0 = s0 & 0x8000; | 227 | t0 = pending & 0x8000; |
228 | t0 = t0 < 1; | 228 | t0 = t0 < 1; |
229 | //t0 = t0 << 2; | 229 | //t0 = t0 << 2; |
230 | a0 = a0 - t0; | 230 | a0 = a0 - t0; |
231 | //s0 = s0 << t0; | 231 | //pending = pending << t0; |
232 | 232 | ||
233 | return a0; | 233 | return a0; |
234 | #endif | 234 | #endif |
diff --git a/arch/mips/tx4927/common/tx4927_setup.c b/arch/mips/tx4927/common/tx4927_setup.c index 3ace4037343e..4658b2ae4833 100644 --- a/arch/mips/tx4927/common/tx4927_setup.c +++ b/arch/mips/tx4927/common/tx4927_setup.c | |||
@@ -53,19 +53,9 @@ void __init tx4927_time_init(void); | |||
53 | void dump_cp0(char *key); | 53 | void dump_cp0(char *key); |
54 | 54 | ||
55 | 55 | ||
56 | void (*__wbflush) (void); | ||
57 | |||
58 | static void tx4927_write_buffer_flush(void) | ||
59 | { | ||
60 | __asm__ __volatile__ | ||
61 | ("sync\n\t" "nop\n\t" "loop: bc0f loop\n\t" "nop\n\t"); | ||
62 | } | ||
63 | |||
64 | |||
65 | void __init plat_mem_setup(void) | 56 | void __init plat_mem_setup(void) |
66 | { | 57 | { |
67 | board_time_init = tx4927_time_init; | 58 | board_time_init = tx4927_time_init; |
68 | __wbflush = tx4927_write_buffer_flush; | ||
69 | 59 | ||
70 | #ifdef CONFIG_TOSHIBA_RBTX4927 | 60 | #ifdef CONFIG_TOSHIBA_RBTX4927 |
71 | { | 61 | { |
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c index 3e24413d4c09..0c3c3f668230 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c | |||
@@ -129,6 +129,7 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB | |||
129 | #include <asm/processor.h> | 129 | #include <asm/processor.h> |
130 | #include <asm/reboot.h> | 130 | #include <asm/reboot.h> |
131 | #include <asm/time.h> | 131 | #include <asm/time.h> |
132 | #include <asm/wbflush.h> | ||
132 | #include <linux/bootmem.h> | 133 | #include <linux/bootmem.h> |
133 | #include <linux/blkdev.h> | 134 | #include <linux/blkdev.h> |
134 | #ifdef CONFIG_RTC_DS1742 | 135 | #ifdef CONFIG_RTC_DS1742 |
diff --git a/arch/mips/tx4938/common/irq.c b/arch/mips/tx4938/common/irq.c index b6024749b8f4..77fe2454f5b9 100644 --- a/arch/mips/tx4938/common/irq.c +++ b/arch/mips/tx4938/common/irq.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
31 | #include <asm/mipsregs.h> | 31 | #include <asm/mipsregs.h> |
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
33 | #include <asm/wbflush.h> | ||
33 | #include <asm/tx4938/rbtx4938.h> | 34 | #include <asm/tx4938/rbtx4938.h> |
34 | 35 | ||
35 | /**********************************************************************************/ | 36 | /**********************************************************************************/ |
diff --git a/arch/mips/tx4938/common/setup.c b/arch/mips/tx4938/common/setup.c index 71859c4fee84..f415a1f18fba 100644 --- a/arch/mips/tx4938/common/setup.c +++ b/arch/mips/tx4938/common/setup.c | |||
@@ -41,29 +41,10 @@ void __init tx4938_setup(void); | |||
41 | void __init tx4938_time_init(void); | 41 | void __init tx4938_time_init(void); |
42 | void dump_cp0(char *key); | 42 | void dump_cp0(char *key); |
43 | 43 | ||
44 | void (*__wbflush) (void); | ||
45 | |||
46 | static void | ||
47 | tx4938_write_buffer_flush(void) | ||
48 | { | ||
49 | mmiowb(); | ||
50 | |||
51 | __asm__ __volatile__( | ||
52 | ".set push\n\t" | ||
53 | ".set noreorder\n\t" | ||
54 | "lw $0,%0\n\t" | ||
55 | "nop\n\t" | ||
56 | ".set pop" | ||
57 | : /* no output */ | ||
58 | : "m" (*(int *)KSEG1) | ||
59 | : "memory"); | ||
60 | } | ||
61 | |||
62 | void __init | 44 | void __init |
63 | plat_mem_setup(void) | 45 | plat_mem_setup(void) |
64 | { | 46 | { |
65 | board_time_init = tx4938_time_init; | 47 | board_time_init = tx4938_time_init; |
66 | __wbflush = tx4938_write_buffer_flush; | ||
67 | toshiba_rbtx4938_setup(); | 48 | toshiba_rbtx4938_setup(); |
68 | } | 49 | } |
69 | 50 | ||
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/irq.c b/arch/mips/tx4938/toshiba_rbtx4938/irq.c index bbb3390e98f7..102e473c10a2 100644 --- a/arch/mips/tx4938/toshiba_rbtx4938/irq.c +++ b/arch/mips/tx4938/toshiba_rbtx4938/irq.c | |||
@@ -83,6 +83,7 @@ IRQ Device | |||
83 | #include <asm/processor.h> | 83 | #include <asm/processor.h> |
84 | #include <asm/reboot.h> | 84 | #include <asm/reboot.h> |
85 | #include <asm/time.h> | 85 | #include <asm/time.h> |
86 | #include <asm/wbflush.h> | ||
86 | #include <linux/bootmem.h> | 87 | #include <linux/bootmem.h> |
87 | #include <asm/tx4938/rbtx4938.h> | 88 | #include <asm/tx4938/rbtx4938.h> |
88 | 89 | ||
diff --git a/arch/powerpc/platforms/82xx/mpc82xx.c b/arch/powerpc/platforms/82xx/mpc82xx.c index 89d702de4863..0f5b30dc60da 100644 --- a/arch/powerpc/platforms/82xx/mpc82xx.c +++ b/arch/powerpc/platforms/82xx/mpc82xx.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * option) any later version. | 11 | * option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/stddef.h> | 14 | #include <linux/stddef.h> |
16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c b/arch/powerpc/platforms/82xx/mpc82xx_ads.c index 0cea42a8053d..bb9acbb98176 100644 --- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c +++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c | |||
@@ -12,8 +12,6 @@ | |||
12 | * option) any later version. | 12 | * option) any later version. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/stddef.h> | 15 | #include <linux/stddef.h> |
18 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
19 | #include <linux/init.h> | 17 | #include <linux/init.h> |
diff --git a/arch/powerpc/platforms/82xx/pq2ads.h b/arch/powerpc/platforms/82xx/pq2ads.h index a7348213508f..fb2f92bcd770 100644 --- a/arch/powerpc/platforms/82xx/pq2ads.h +++ b/arch/powerpc/platforms/82xx/pq2ads.h | |||
@@ -22,8 +22,6 @@ | |||
22 | #ifndef __MACH_ADS8260_DEFS | 22 | #ifndef __MACH_ADS8260_DEFS |
23 | #define __MACH_ADS8260_DEFS | 23 | #define __MACH_ADS8260_DEFS |
24 | 24 | ||
25 | #include <linux/config.h> | ||
26 | |||
27 | #include <asm/ppcboot.h> | 25 | #include <asm/ppcboot.h> |
28 | 26 | ||
29 | /* For our show_cpuinfo hooks. */ | 27 | /* For our show_cpuinfo hooks. */ |
diff --git a/arch/powerpc/sysdev/qe_lib/qe_io.c b/arch/powerpc/sysdev/qe_lib/qe_io.c index aea435970389..0afe6bfe3714 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_io.c +++ b/arch/powerpc/sysdev/qe_lib/qe_io.c | |||
@@ -14,7 +14,6 @@ | |||
14 | * option) any later version. | 14 | * option) any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/stddef.h> | 17 | #include <linux/stddef.h> |
19 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c index 4ca9e5fc97f4..2cc302b6bec0 100644 --- a/arch/sparc/kernel/prom.c +++ b/arch/sparc/kernel/prom.c | |||
@@ -243,7 +243,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len | |||
243 | void *old_val = prop->value; | 243 | void *old_val = prop->value; |
244 | int ret; | 244 | int ret; |
245 | 245 | ||
246 | ret = prom_setprop(dp->node, name, val, len); | 246 | ret = prom_setprop(dp->node, (char *) name, val, len); |
247 | err = -EINVAL; | 247 | err = -EINVAL; |
248 | if (ret >= 0) { | 248 | if (ret >= 0) { |
249 | prop->value = new_val; | 249 | prop->value = new_val; |
@@ -477,7 +477,10 @@ static struct property * __init build_one_prop(phandle node, char *prev, char *s | |||
477 | p->length = 0; | 477 | p->length = 0; |
478 | } else { | 478 | } else { |
479 | p->value = prom_early_alloc(p->length + 1); | 479 | p->value = prom_early_alloc(p->length + 1); |
480 | prom_getproperty(node, p->name, p->value, p->length); | 480 | len = prom_getproperty(node, p->name, p->value, |
481 | p->length); | ||
482 | if (len <= 0) | ||
483 | p->length = 0; | ||
481 | ((unsigned char *)p->value)[p->length] = '\0'; | 484 | ((unsigned char *)p->value)[p->length] = '\0'; |
482 | } | 485 | } |
483 | } | 486 | } |
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index f54ab375464b..dcae559879ae 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.18 | 3 | # Linux kernel version: 2.6.19-rc1 |
4 | # Mon Oct 2 14:24:40 2006 | 4 | # Thu Oct 5 02:08:41 2006 |
5 | # | 5 | # |
6 | CONFIG_SPARC=y | 6 | CONFIG_SPARC=y |
7 | CONFIG_SPARC64=y | 7 | CONFIG_SPARC64=y |
@@ -197,6 +197,7 @@ CONFIG_INET_XFRM_TUNNEL=y | |||
197 | CONFIG_INET_TUNNEL=y | 197 | CONFIG_INET_TUNNEL=y |
198 | CONFIG_INET_XFRM_MODE_TRANSPORT=y | 198 | CONFIG_INET_XFRM_MODE_TRANSPORT=y |
199 | CONFIG_INET_XFRM_MODE_TUNNEL=y | 199 | CONFIG_INET_XFRM_MODE_TUNNEL=y |
200 | CONFIG_INET_XFRM_MODE_BEET=y | ||
200 | CONFIG_INET_DIAG=y | 201 | CONFIG_INET_DIAG=y |
201 | CONFIG_INET_TCP_DIAG=y | 202 | CONFIG_INET_TCP_DIAG=y |
202 | # CONFIG_TCP_CONG_ADVANCED is not set | 203 | # CONFIG_TCP_CONG_ADVANCED is not set |
@@ -214,6 +215,7 @@ CONFIG_INET6_XFRM_TUNNEL=m | |||
214 | CONFIG_INET6_TUNNEL=m | 215 | CONFIG_INET6_TUNNEL=m |
215 | CONFIG_INET6_XFRM_MODE_TRANSPORT=m | 216 | CONFIG_INET6_XFRM_MODE_TRANSPORT=m |
216 | CONFIG_INET6_XFRM_MODE_TUNNEL=m | 217 | CONFIG_INET6_XFRM_MODE_TUNNEL=m |
218 | CONFIG_INET6_XFRM_MODE_BEET=m | ||
217 | # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set | 219 | # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set |
218 | CONFIG_IPV6_TUNNEL=m | 220 | CONFIG_IPV6_TUNNEL=m |
219 | # CONFIG_IPV6_SUBTREES is not set | 221 | # CONFIG_IPV6_SUBTREES is not set |
@@ -373,6 +375,7 @@ CONFIG_BLK_DEV_ALI15X3=y | |||
373 | # CONFIG_BLK_DEV_CS5530 is not set | 375 | # CONFIG_BLK_DEV_CS5530 is not set |
374 | # CONFIG_BLK_DEV_HPT34X is not set | 376 | # CONFIG_BLK_DEV_HPT34X is not set |
375 | # CONFIG_BLK_DEV_HPT366 is not set | 377 | # CONFIG_BLK_DEV_HPT366 is not set |
378 | # CONFIG_BLK_DEV_JMICRON is not set | ||
376 | # CONFIG_BLK_DEV_SC1200 is not set | 379 | # CONFIG_BLK_DEV_SC1200 is not set |
377 | # CONFIG_BLK_DEV_PIIX is not set | 380 | # CONFIG_BLK_DEV_PIIX is not set |
378 | # CONFIG_BLK_DEV_IT821X is not set | 381 | # CONFIG_BLK_DEV_IT821X is not set |
@@ -449,10 +452,10 @@ CONFIG_ISCSI_TCP=m | |||
449 | # CONFIG_SCSI_INIA100 is not set | 452 | # CONFIG_SCSI_INIA100 is not set |
450 | # CONFIG_SCSI_STEX is not set | 453 | # CONFIG_SCSI_STEX is not set |
451 | # CONFIG_SCSI_SYM53C8XX_2 is not set | 454 | # CONFIG_SCSI_SYM53C8XX_2 is not set |
452 | # CONFIG_SCSI_IPR is not set | ||
453 | # CONFIG_SCSI_QLOGIC_1280 is not set | 455 | # CONFIG_SCSI_QLOGIC_1280 is not set |
454 | # CONFIG_SCSI_QLOGICPTI is not set | 456 | # CONFIG_SCSI_QLOGICPTI is not set |
455 | # CONFIG_SCSI_QLA_FC is not set | 457 | # CONFIG_SCSI_QLA_FC is not set |
458 | # CONFIG_SCSI_QLA_ISCSI is not set | ||
456 | # CONFIG_SCSI_LPFC is not set | 459 | # CONFIG_SCSI_LPFC is not set |
457 | # CONFIG_SCSI_DC395x is not set | 460 | # CONFIG_SCSI_DC395x is not set |
458 | # CONFIG_SCSI_DC390T is not set | 461 | # CONFIG_SCSI_DC390T is not set |
@@ -478,6 +481,7 @@ CONFIG_MD_RAID456=m | |||
478 | CONFIG_MD_MULTIPATH=m | 481 | CONFIG_MD_MULTIPATH=m |
479 | # CONFIG_MD_FAULTY is not set | 482 | # CONFIG_MD_FAULTY is not set |
480 | CONFIG_BLK_DEV_DM=m | 483 | CONFIG_BLK_DEV_DM=m |
484 | # CONFIG_DM_DEBUG is not set | ||
481 | CONFIG_DM_CRYPT=m | 485 | CONFIG_DM_CRYPT=m |
482 | CONFIG_DM_SNAPSHOT=m | 486 | CONFIG_DM_SNAPSHOT=m |
483 | CONFIG_DM_MIRROR=m | 487 | CONFIG_DM_MIRROR=m |
@@ -840,12 +844,12 @@ CONFIG_HWMON=y | |||
840 | # | 844 | # |
841 | # Misc devices | 845 | # Misc devices |
842 | # | 846 | # |
847 | # CONFIG_TIFM_CORE is not set | ||
843 | 848 | ||
844 | # | 849 | # |
845 | # Multimedia devices | 850 | # Multimedia devices |
846 | # | 851 | # |
847 | # CONFIG_VIDEO_DEV is not set | 852 | # CONFIG_VIDEO_DEV is not set |
848 | CONFIG_VIDEO_V4L2=y | ||
849 | 853 | ||
850 | # | 854 | # |
851 | # Digital Video Broadcasting Devices | 855 | # Digital Video Broadcasting Devices |
@@ -858,6 +862,7 @@ CONFIG_VIDEO_V4L2=y | |||
858 | # | 862 | # |
859 | # CONFIG_FIRMWARE_EDID is not set | 863 | # CONFIG_FIRMWARE_EDID is not set |
860 | CONFIG_FB=y | 864 | CONFIG_FB=y |
865 | CONFIG_FB_DDC=y | ||
861 | CONFIG_FB_CFB_FILLRECT=y | 866 | CONFIG_FB_CFB_FILLRECT=y |
862 | CONFIG_FB_CFB_COPYAREA=y | 867 | CONFIG_FB_CFB_COPYAREA=y |
863 | CONFIG_FB_CFB_IMAGEBLIT=y | 868 | CONFIG_FB_CFB_IMAGEBLIT=y |
@@ -1236,6 +1241,7 @@ CONFIG_FS_MBCACHE=y | |||
1236 | # CONFIG_JFS_FS is not set | 1241 | # CONFIG_JFS_FS is not set |
1237 | CONFIG_FS_POSIX_ACL=y | 1242 | CONFIG_FS_POSIX_ACL=y |
1238 | # CONFIG_XFS_FS is not set | 1243 | # CONFIG_XFS_FS is not set |
1244 | # CONFIG_GFS2_FS is not set | ||
1239 | # CONFIG_OCFS2_FS is not set | 1245 | # CONFIG_OCFS2_FS is not set |
1240 | # CONFIG_MINIX_FS is not set | 1246 | # CONFIG_MINIX_FS is not set |
1241 | # CONFIG_ROMFS_FS is not set | 1247 | # CONFIG_ROMFS_FS is not set |
@@ -1279,6 +1285,7 @@ CONFIG_RAMFS=y | |||
1279 | # | 1285 | # |
1280 | # CONFIG_ADFS_FS is not set | 1286 | # CONFIG_ADFS_FS is not set |
1281 | # CONFIG_AFFS_FS is not set | 1287 | # CONFIG_AFFS_FS is not set |
1288 | # CONFIG_ECRYPT_FS is not set | ||
1282 | # CONFIG_HFS_FS is not set | 1289 | # CONFIG_HFS_FS is not set |
1283 | # CONFIG_HFSPLUS_FS is not set | 1290 | # CONFIG_HFSPLUS_FS is not set |
1284 | # CONFIG_BEFS_FS is not set | 1291 | # CONFIG_BEFS_FS is not set |
@@ -1355,6 +1362,10 @@ CONFIG_NLS_DEFAULT="iso8859-1" | |||
1355 | # CONFIG_NLS_UTF8 is not set | 1362 | # CONFIG_NLS_UTF8 is not set |
1356 | 1363 | ||
1357 | # | 1364 | # |
1365 | # Distributed Lock Manager | ||
1366 | # | ||
1367 | |||
1368 | # | ||
1358 | # Instrumentation Support | 1369 | # Instrumentation Support |
1359 | # | 1370 | # |
1360 | CONFIG_PROFILING=y | 1371 | CONFIG_PROFILING=y |
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index 7f9204535770..d822c7c18e1f 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -841,7 +841,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, | |||
841 | if (!parent) | 841 | if (!parent) |
842 | strcpy(op->dev.bus_id, "root"); | 842 | strcpy(op->dev.bus_id, "root"); |
843 | else | 843 | else |
844 | strcpy(op->dev.bus_id, dp->path_component_name); | 844 | sprintf(op->dev.bus_id, "%s@%08x", dp->name, dp->node); |
845 | 845 | ||
846 | if (of_device_register(op)) { | 846 | if (of_device_register(op)) { |
847 | printk("%s: Could not register of device.\n", | 847 | printk("%s: Could not register of device.\n", |
diff --git a/arch/um/drivers/pcap_user.h b/arch/um/drivers/pcap_user.h index 58f9f6a1420f..96b80b565eeb 100644 --- a/arch/um/drivers/pcap_user.h +++ b/arch/um/drivers/pcap_user.h | |||
@@ -15,7 +15,7 @@ struct pcap_data { | |||
15 | void *dev; | 15 | void *dev; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | extern struct net_user_info pcap_user_info; | 18 | extern const struct net_user_info pcap_user_info; |
19 | 19 | ||
20 | extern int pcap_user_read(int fd, void *buf, int len, struct pcap_data *pri); | 20 | extern int pcap_user_read(int fd, void *buf, int len, struct pcap_data *pri); |
21 | 21 | ||
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c index d18198ed636b..3a7561d4703e 100644 --- a/arch/x86_64/ia32/ptrace32.c +++ b/arch/x86_64/ia32/ptrace32.c | |||
@@ -205,9 +205,9 @@ static int getreg32(struct task_struct *child, unsigned regno, u32 *val) | |||
205 | static long ptrace32_siginfo(unsigned request, u32 pid, u32 addr, u32 data) | 205 | static long ptrace32_siginfo(unsigned request, u32 pid, u32 addr, u32 data) |
206 | { | 206 | { |
207 | int ret; | 207 | int ret; |
208 | compat_siginfo_t *si32 = (compat_siginfo_t *)compat_ptr(data); | 208 | compat_siginfo_t __user *si32 = compat_ptr(data); |
209 | siginfo_t ssi; | 209 | siginfo_t ssi; |
210 | siginfo_t *si = compat_alloc_user_space(sizeof(siginfo_t)); | 210 | siginfo_t __user *si = compat_alloc_user_space(sizeof(siginfo_t)); |
211 | if (request == PTRACE_SETSIGINFO) { | 211 | if (request == PTRACE_SETSIGINFO) { |
212 | memset(&ssi, 0, sizeof(siginfo_t)); | 212 | memset(&ssi, 0, sizeof(siginfo_t)); |
213 | ret = copy_siginfo_from_user32(&ssi, si32); | 213 | ret = copy_siginfo_from_user32(&ssi, si32); |
diff --git a/crypto/serpent.c b/crypto/serpent.c index 465d091cd3ec..2b0a19a44ec5 100644 --- a/crypto/serpent.c +++ b/crypto/serpent.c | |||
@@ -364,10 +364,10 @@ static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
364 | { | 364 | { |
365 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | 365 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); |
366 | const u32 | 366 | const u32 |
367 | *k = ctx->expkey, | 367 | *k = ctx->expkey; |
368 | *s = (const u32 *)src; | 368 | const __le32 *s = (const __le32 *)src; |
369 | u32 *d = (u32 *)dst, | 369 | __le32 *d = (__le32 *)dst; |
370 | r0, r1, r2, r3, r4; | 370 | u32 r0, r1, r2, r3, r4; |
371 | 371 | ||
372 | /* | 372 | /* |
373 | * Note: The conversions between u8* and u32* might cause trouble | 373 | * Note: The conversions between u8* and u32* might cause trouble |
@@ -423,10 +423,10 @@ static void serpent_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
423 | { | 423 | { |
424 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | 424 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); |
425 | const u32 | 425 | const u32 |
426 | *k = ((struct serpent_ctx *)ctx)->expkey, | 426 | *k = ((struct serpent_ctx *)ctx)->expkey; |
427 | *s = (const u32 *)src; | 427 | const __le32 *s = (const __le32 *)src; |
428 | u32 *d = (u32 *)dst, | 428 | __le32 *d = (__le32 *)dst; |
429 | r0, r1, r2, r3, r4; | 429 | u32 r0, r1, r2, r3, r4; |
430 | 430 | ||
431 | r0 = le32_to_cpu(s[0]); | 431 | r0 = le32_to_cpu(s[0]); |
432 | r1 = le32_to_cpu(s[1]); | 432 | r1 = le32_to_cpu(s[1]); |
diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c index a01ce6700bfe..4a9b7bf6f44e 100644 --- a/drivers/acpi/cm_sbs.c +++ b/drivers/acpi/cm_sbs.c | |||
@@ -67,7 +67,7 @@ void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param) | |||
67 | lock_ac_dir_cnt--; | 67 | lock_ac_dir_cnt--; |
68 | if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) { | 68 | if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) { |
69 | remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); | 69 | remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); |
70 | acpi_ac_dir = 0; | 70 | acpi_ac_dir = NULL; |
71 | } | 71 | } |
72 | mutex_unlock(&cm_sbs_mutex); | 72 | mutex_unlock(&cm_sbs_mutex); |
73 | } | 73 | } |
@@ -99,7 +99,7 @@ void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param) | |||
99 | if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param | 99 | if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param |
100 | && acpi_battery_dir) { | 100 | && acpi_battery_dir) { |
101 | remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); | 101 | remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); |
102 | acpi_battery_dir = 0; | 102 | acpi_battery_dir = NULL; |
103 | } | 103 | } |
104 | mutex_unlock(&cm_sbs_mutex); | 104 | mutex_unlock(&cm_sbs_mutex); |
105 | return; | 105 | return; |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index d636ede064aa..8bcdfa64667c 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -360,7 +360,7 @@ static void pdc_sata_phy_reset(struct ata_port *ap) | |||
360 | static void pdc_pata_cbl_detect(struct ata_port *ap) | 360 | static void pdc_pata_cbl_detect(struct ata_port *ap) |
361 | { | 361 | { |
362 | u8 tmp; | 362 | u8 tmp; |
363 | void __iomem *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; | 363 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; |
364 | 364 | ||
365 | tmp = readb(mmio); | 365 | tmp = readb(mmio); |
366 | 366 | ||
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index ae5edb80ea9a..ca8d99312472 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -349,7 +349,7 @@ static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg) | |||
349 | 349 | ||
350 | static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | 350 | static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) |
351 | { | 351 | { |
352 | void *mmio = (void __iomem *) sil_scr_addr(ap, sc_reg); | 352 | void __iomem *mmio = (void __iomem *) sil_scr_addr(ap, sc_reg); |
353 | if (mmio) | 353 | if (mmio) |
354 | writel(val, mmio); | 354 | writel(val, mmio); |
355 | } | 355 | } |
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c index 84025a2fd5be..db32d15b7fa1 100644 --- a/drivers/ata/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -177,7 +177,7 @@ static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc) | |||
177 | struct ata_port *ap = qc->ap; | 177 | struct ata_port *ap = qc->ap; |
178 | unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); | 178 | unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); |
179 | u8 dmactl; | 179 | u8 dmactl; |
180 | void *mmio = (void *) ap->ioaddr.bmdma_addr; | 180 | void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; |
181 | /* load PRD table addr. */ | 181 | /* load PRD table addr. */ |
182 | mb(); /* make sure PRD table writes are visible to controller */ | 182 | mb(); /* make sure PRD table writes are visible to controller */ |
183 | writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS); | 183 | writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS); |
@@ -205,7 +205,7 @@ static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc) | |||
205 | static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) | 205 | static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) |
206 | { | 206 | { |
207 | struct ata_port *ap = qc->ap; | 207 | struct ata_port *ap = qc->ap; |
208 | void *mmio = (void *) ap->ioaddr.bmdma_addr; | 208 | void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; |
209 | u8 dmactl; | 209 | u8 dmactl; |
210 | 210 | ||
211 | /* start host DMA transaction */ | 211 | /* start host DMA transaction */ |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index d6bb8da955a2..beab6d2643cb 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -295,7 +295,7 @@ fail: | |||
295 | * and do_lo_send_write(). | 295 | * and do_lo_send_write(). |
296 | */ | 296 | */ |
297 | static int __do_lo_send_write(struct file *file, | 297 | static int __do_lo_send_write(struct file *file, |
298 | u8 __user *buf, const int len, loff_t pos) | 298 | u8 *buf, const int len, loff_t pos) |
299 | { | 299 | { |
300 | ssize_t bw; | 300 | ssize_t bw; |
301 | mm_segment_t old_fs = get_fs(); | 301 | mm_segment_t old_fs = get_fs(); |
@@ -324,7 +324,7 @@ static int do_lo_send_direct_write(struct loop_device *lo, | |||
324 | struct bio_vec *bvec, int bsize, loff_t pos, struct page *page) | 324 | struct bio_vec *bvec, int bsize, loff_t pos, struct page *page) |
325 | { | 325 | { |
326 | ssize_t bw = __do_lo_send_write(lo->lo_backing_file, | 326 | ssize_t bw = __do_lo_send_write(lo->lo_backing_file, |
327 | (u8 __user *)kmap(bvec->bv_page) + bvec->bv_offset, | 327 | kmap(bvec->bv_page) + bvec->bv_offset, |
328 | bvec->bv_len, pos); | 328 | bvec->bv_len, pos); |
329 | kunmap(bvec->bv_page); | 329 | kunmap(bvec->bv_page); |
330 | cond_resched(); | 330 | cond_resched(); |
@@ -351,7 +351,7 @@ static int do_lo_send_write(struct loop_device *lo, struct bio_vec *bvec, | |||
351 | bvec->bv_offset, bvec->bv_len, pos >> 9); | 351 | bvec->bv_offset, bvec->bv_len, pos >> 9); |
352 | if (likely(!ret)) | 352 | if (likely(!ret)) |
353 | return __do_lo_send_write(lo->lo_backing_file, | 353 | return __do_lo_send_write(lo->lo_backing_file, |
354 | (u8 __user *)page_address(page), bvec->bv_len, | 354 | page_address(page), bvec->bv_len, |
355 | pos); | 355 | pos); |
356 | printk(KERN_ERR "loop: Transfer error at byte offset %llu, " | 356 | printk(KERN_ERR "loop: Transfer error at byte offset %llu, " |
357 | "length %i.\n", (unsigned long long)pos, bvec->bv_len); | 357 | "length %i.\n", (unsigned long long)pos, bvec->bv_len); |
@@ -1187,7 +1187,7 @@ struct compat_loop_info { | |||
1187 | * - noinlined to reduce stack space usage in main part of driver | 1187 | * - noinlined to reduce stack space usage in main part of driver |
1188 | */ | 1188 | */ |
1189 | static noinline int | 1189 | static noinline int |
1190 | loop_info64_from_compat(const struct compat_loop_info *arg, | 1190 | loop_info64_from_compat(const struct compat_loop_info __user *arg, |
1191 | struct loop_info64 *info64) | 1191 | struct loop_info64 *info64) |
1192 | { | 1192 | { |
1193 | struct compat_loop_info info; | 1193 | struct compat_loop_info info; |
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 2a0c50d84fc5..7ea0f48f8fa6 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -703,7 +703,7 @@ static int cdrom_has_defect_mgt(struct cdrom_device_info *cdi) | |||
703 | { | 703 | { |
704 | struct packet_command cgc; | 704 | struct packet_command cgc; |
705 | char buffer[16]; | 705 | char buffer[16]; |
706 | __u16 *feature_code; | 706 | __be16 *feature_code; |
707 | int ret; | 707 | int ret; |
708 | 708 | ||
709 | init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ); | 709 | init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ); |
@@ -716,7 +716,7 @@ static int cdrom_has_defect_mgt(struct cdrom_device_info *cdi) | |||
716 | if ((ret = cdi->ops->generic_packet(cdi, &cgc))) | 716 | if ((ret = cdi->ops->generic_packet(cdi, &cgc))) |
717 | return ret; | 717 | return ret; |
718 | 718 | ||
719 | feature_code = (__u16 *) &buffer[sizeof(struct feature_header)]; | 719 | feature_code = (__be16 *) &buffer[sizeof(struct feature_header)]; |
720 | if (be16_to_cpu(*feature_code) == CDF_HWDM) | 720 | if (be16_to_cpu(*feature_code) == CDF_HWDM) |
721 | return 0; | 721 | return 0; |
722 | 722 | ||
@@ -2963,7 +2963,7 @@ static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, | |||
2963 | how much data is available for transfer. buffer[1] is | 2963 | how much data is available for transfer. buffer[1] is |
2964 | unfortunately ambigious and the only reliable way seem | 2964 | unfortunately ambigious and the only reliable way seem |
2965 | to be to simply skip over the block descriptor... */ | 2965 | to be to simply skip over the block descriptor... */ |
2966 | offset = 8 + be16_to_cpu(*(unsigned short *)(buffer+6)); | 2966 | offset = 8 + be16_to_cpu(*(__be16 *)(buffer+6)); |
2967 | 2967 | ||
2968 | if (offset + 16 > sizeof(buffer)) | 2968 | if (offset + 16 > sizeof(buffer)) |
2969 | return -E2BIG; | 2969 | return -E2BIG; |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index d6e031542c6b..ffdf9df1a67a 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -686,37 +686,37 @@ static stlibrd_t *stli_allocbrd(void); | |||
686 | static void stli_ecpinit(stlibrd_t *brdp); | 686 | static void stli_ecpinit(stlibrd_t *brdp); |
687 | static void stli_ecpenable(stlibrd_t *brdp); | 687 | static void stli_ecpenable(stlibrd_t *brdp); |
688 | static void stli_ecpdisable(stlibrd_t *brdp); | 688 | static void stli_ecpdisable(stlibrd_t *brdp); |
689 | static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line); | 689 | static void __iomem *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line); |
690 | static void stli_ecpreset(stlibrd_t *brdp); | 690 | static void stli_ecpreset(stlibrd_t *brdp); |
691 | static void stli_ecpintr(stlibrd_t *brdp); | 691 | static void stli_ecpintr(stlibrd_t *brdp); |
692 | static void stli_ecpeiinit(stlibrd_t *brdp); | 692 | static void stli_ecpeiinit(stlibrd_t *brdp); |
693 | static void stli_ecpeienable(stlibrd_t *brdp); | 693 | static void stli_ecpeienable(stlibrd_t *brdp); |
694 | static void stli_ecpeidisable(stlibrd_t *brdp); | 694 | static void stli_ecpeidisable(stlibrd_t *brdp); |
695 | static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line); | 695 | static void __iomem *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line); |
696 | static void stli_ecpeireset(stlibrd_t *brdp); | 696 | static void stli_ecpeireset(stlibrd_t *brdp); |
697 | static void stli_ecpmcenable(stlibrd_t *brdp); | 697 | static void stli_ecpmcenable(stlibrd_t *brdp); |
698 | static void stli_ecpmcdisable(stlibrd_t *brdp); | 698 | static void stli_ecpmcdisable(stlibrd_t *brdp); |
699 | static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line); | 699 | static void __iomem *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line); |
700 | static void stli_ecpmcreset(stlibrd_t *brdp); | 700 | static void stli_ecpmcreset(stlibrd_t *brdp); |
701 | static void stli_ecppciinit(stlibrd_t *brdp); | 701 | static void stli_ecppciinit(stlibrd_t *brdp); |
702 | static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int line); | 702 | static void __iomem *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int line); |
703 | static void stli_ecppcireset(stlibrd_t *brdp); | 703 | static void stli_ecppcireset(stlibrd_t *brdp); |
704 | 704 | ||
705 | static void stli_onbinit(stlibrd_t *brdp); | 705 | static void stli_onbinit(stlibrd_t *brdp); |
706 | static void stli_onbenable(stlibrd_t *brdp); | 706 | static void stli_onbenable(stlibrd_t *brdp); |
707 | static void stli_onbdisable(stlibrd_t *brdp); | 707 | static void stli_onbdisable(stlibrd_t *brdp); |
708 | static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line); | 708 | static void __iomem *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line); |
709 | static void stli_onbreset(stlibrd_t *brdp); | 709 | static void stli_onbreset(stlibrd_t *brdp); |
710 | static void stli_onbeinit(stlibrd_t *brdp); | 710 | static void stli_onbeinit(stlibrd_t *brdp); |
711 | static void stli_onbeenable(stlibrd_t *brdp); | 711 | static void stli_onbeenable(stlibrd_t *brdp); |
712 | static void stli_onbedisable(stlibrd_t *brdp); | 712 | static void stli_onbedisable(stlibrd_t *brdp); |
713 | static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line); | 713 | static void __iomem *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line); |
714 | static void stli_onbereset(stlibrd_t *brdp); | 714 | static void stli_onbereset(stlibrd_t *brdp); |
715 | static void stli_bbyinit(stlibrd_t *brdp); | 715 | static void stli_bbyinit(stlibrd_t *brdp); |
716 | static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line); | 716 | static void __iomem *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line); |
717 | static void stli_bbyreset(stlibrd_t *brdp); | 717 | static void stli_bbyreset(stlibrd_t *brdp); |
718 | static void stli_stalinit(stlibrd_t *brdp); | 718 | static void stli_stalinit(stlibrd_t *brdp); |
719 | static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line); | 719 | static void __iomem *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line); |
720 | static void stli_stalreset(stlibrd_t *brdp); | 720 | static void stli_stalreset(stlibrd_t *brdp); |
721 | 721 | ||
722 | static stliport_t *stli_getport(int brdnr, int panelnr, int portnr); | 722 | static stliport_t *stli_getport(int brdnr, int panelnr, int portnr); |
@@ -1566,7 +1566,7 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1566 | 1566 | ||
1567 | len = MIN(len, cooksize); | 1567 | len = MIN(len, cooksize); |
1568 | count = 0; | 1568 | count = 0; |
1569 | shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset); | 1569 | shbuf = EBRDGETMEMPTR(brdp, portp->txoffset); |
1570 | buf = stli_txcookbuf; | 1570 | buf = stli_txcookbuf; |
1571 | 1571 | ||
1572 | while (len > 0) { | 1572 | while (len > 0) { |
@@ -2948,9 +2948,9 @@ static void stli_ecpdisable(stlibrd_t *brdp) | |||
2948 | 2948 | ||
2949 | /*****************************************************************************/ | 2949 | /*****************************************************************************/ |
2950 | 2950 | ||
2951 | static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 2951 | static void __iomem *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
2952 | { | 2952 | { |
2953 | void *ptr; | 2953 | void __iomem *ptr; |
2954 | unsigned char val; | 2954 | unsigned char val; |
2955 | 2955 | ||
2956 | if (offset > brdp->memsize) { | 2956 | if (offset > brdp->memsize) { |
@@ -3022,9 +3022,9 @@ static void stli_ecpeidisable(stlibrd_t *brdp) | |||
3022 | 3022 | ||
3023 | /*****************************************************************************/ | 3023 | /*****************************************************************************/ |
3024 | 3024 | ||
3025 | static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3025 | static void __iomem *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3026 | { | 3026 | { |
3027 | void *ptr; | 3027 | void __iomem *ptr; |
3028 | unsigned char val; | 3028 | unsigned char val; |
3029 | 3029 | ||
3030 | if (offset > brdp->memsize) { | 3030 | if (offset > brdp->memsize) { |
@@ -3074,9 +3074,9 @@ static void stli_ecpmcdisable(stlibrd_t *brdp) | |||
3074 | 3074 | ||
3075 | /*****************************************************************************/ | 3075 | /*****************************************************************************/ |
3076 | 3076 | ||
3077 | static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3077 | static void __iomem *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3078 | { | 3078 | { |
3079 | void *ptr; | 3079 | void __iomem *ptr; |
3080 | unsigned char val; | 3080 | unsigned char val; |
3081 | 3081 | ||
3082 | if (offset > brdp->memsize) { | 3082 | if (offset > brdp->memsize) { |
@@ -3119,9 +3119,9 @@ static void stli_ecppciinit(stlibrd_t *brdp) | |||
3119 | 3119 | ||
3120 | /*****************************************************************************/ | 3120 | /*****************************************************************************/ |
3121 | 3121 | ||
3122 | static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3122 | static void __iomem *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3123 | { | 3123 | { |
3124 | void *ptr; | 3124 | void __iomem *ptr; |
3125 | unsigned char val; | 3125 | unsigned char val; |
3126 | 3126 | ||
3127 | if (offset > brdp->memsize) { | 3127 | if (offset > brdp->memsize) { |
@@ -3185,9 +3185,9 @@ static void stli_onbdisable(stlibrd_t *brdp) | |||
3185 | 3185 | ||
3186 | /*****************************************************************************/ | 3186 | /*****************************************************************************/ |
3187 | 3187 | ||
3188 | static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3188 | static void __iomem *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3189 | { | 3189 | { |
3190 | void *ptr; | 3190 | void __iomem *ptr; |
3191 | 3191 | ||
3192 | if (offset > brdp->memsize) { | 3192 | if (offset > brdp->memsize) { |
3193 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3193 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
@@ -3250,9 +3250,9 @@ static void stli_onbedisable(stlibrd_t *brdp) | |||
3250 | 3250 | ||
3251 | /*****************************************************************************/ | 3251 | /*****************************************************************************/ |
3252 | 3252 | ||
3253 | static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3253 | static void __iomem *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3254 | { | 3254 | { |
3255 | void *ptr; | 3255 | void __iomem *ptr; |
3256 | unsigned char val; | 3256 | unsigned char val; |
3257 | 3257 | ||
3258 | if (offset > brdp->memsize) { | 3258 | if (offset > brdp->memsize) { |
@@ -3300,9 +3300,9 @@ static void stli_bbyinit(stlibrd_t *brdp) | |||
3300 | 3300 | ||
3301 | /*****************************************************************************/ | 3301 | /*****************************************************************************/ |
3302 | 3302 | ||
3303 | static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3303 | static void __iomem *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3304 | { | 3304 | { |
3305 | void *ptr; | 3305 | void __iomem *ptr; |
3306 | unsigned char val; | 3306 | unsigned char val; |
3307 | 3307 | ||
3308 | BUG_ON(offset > brdp->memsize); | 3308 | BUG_ON(offset > brdp->memsize); |
@@ -3337,7 +3337,7 @@ static void stli_stalinit(stlibrd_t *brdp) | |||
3337 | 3337 | ||
3338 | /*****************************************************************************/ | 3338 | /*****************************************************************************/ |
3339 | 3339 | ||
3340 | static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3340 | static void __iomem *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3341 | { | 3341 | { |
3342 | BUG_ON(offset > brdp->memsize); | 3342 | BUG_ON(offset > brdp->memsize); |
3343 | return brdp->membase + (offset % STAL_PAGESIZE); | 3343 | return brdp->membase + (offset % STAL_PAGESIZE); |
@@ -3876,7 +3876,7 @@ static int stli_eisamemprobe(stlibrd_t *brdp) | |||
3876 | continue; | 3876 | continue; |
3877 | 3877 | ||
3878 | if (brdp->brdtype == BRD_ECPE) { | 3878 | if (brdp->brdtype == BRD_ECPE) { |
3879 | ecpsigp = (cdkecpsig_t __iomem *) stli_ecpeigetmemptr(brdp, | 3879 | ecpsigp = stli_ecpeigetmemptr(brdp, |
3880 | CDK_SIGADDR, __LINE__); | 3880 | CDK_SIGADDR, __LINE__); |
3881 | memcpy_fromio(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); | 3881 | memcpy_fromio(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); |
3882 | if (ecpsig.magic == cpu_to_le32(ECP_MAGIC)) | 3882 | if (ecpsig.magic == cpu_to_le32(ECP_MAGIC)) |
@@ -4184,7 +4184,7 @@ static int stli_initbrds(void) | |||
4184 | static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) | 4184 | static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) |
4185 | { | 4185 | { |
4186 | unsigned long flags; | 4186 | unsigned long flags; |
4187 | void *memptr; | 4187 | void __iomem *memptr; |
4188 | stlibrd_t *brdp; | 4188 | stlibrd_t *brdp; |
4189 | int brdnr, size, n; | 4189 | int brdnr, size, n; |
4190 | void *p; | 4190 | void *p; |
@@ -4214,7 +4214,7 @@ static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, lof | |||
4214 | while (size > 0) { | 4214 | while (size > 0) { |
4215 | spin_lock_irqsave(&brd_lock, flags); | 4215 | spin_lock_irqsave(&brd_lock, flags); |
4216 | EBRDENABLE(brdp); | 4216 | EBRDENABLE(brdp); |
4217 | memptr = (void *) EBRDGETMEMPTR(brdp, off); | 4217 | memptr = EBRDGETMEMPTR(brdp, off); |
4218 | n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); | 4218 | n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); |
4219 | n = MIN(n, PAGE_SIZE); | 4219 | n = MIN(n, PAGE_SIZE); |
4220 | memcpy_fromio(p, memptr, n); | 4220 | memcpy_fromio(p, memptr, n); |
@@ -4247,7 +4247,7 @@ out: | |||
4247 | static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) | 4247 | static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) |
4248 | { | 4248 | { |
4249 | unsigned long flags; | 4249 | unsigned long flags; |
4250 | void *memptr; | 4250 | void __iomem *memptr; |
4251 | stlibrd_t *brdp; | 4251 | stlibrd_t *brdp; |
4252 | char __user *chbuf; | 4252 | char __user *chbuf; |
4253 | int brdnr, size, n; | 4253 | int brdnr, size, n; |
@@ -4287,7 +4287,7 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou | |||
4287 | } | 4287 | } |
4288 | spin_lock_irqsave(&brd_lock, flags); | 4288 | spin_lock_irqsave(&brd_lock, flags); |
4289 | EBRDENABLE(brdp); | 4289 | EBRDENABLE(brdp); |
4290 | memptr = (void *) EBRDGETMEMPTR(brdp, off); | 4290 | memptr = EBRDGETMEMPTR(brdp, off); |
4291 | memcpy_toio(memptr, p, n); | 4291 | memcpy_toio(memptr, p, n); |
4292 | EBRDDISABLE(brdp); | 4292 | EBRDDISABLE(brdp); |
4293 | spin_unlock_irqrestore(&brd_lock, flags); | 4293 | spin_unlock_irqrestore(&brd_lock, flags); |
diff --git a/drivers/char/qtronix.c b/drivers/char/qtronix.c deleted file mode 100644 index 5c9477741a30..000000000000 --- a/drivers/char/qtronix.c +++ /dev/null | |||
@@ -1,605 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * Qtronix 990P infrared keyboard driver. | ||
5 | * | ||
6 | * | ||
7 | * Copyright 2001 MontaVista Software Inc. | ||
8 | * Author: MontaVista Software, Inc. | ||
9 | * ppopov@mvista.com or source@mvista.com | ||
10 | * | ||
11 | * | ||
12 | * The bottom portion of this driver was take from | ||
13 | * pc_keyb.c Please see that file for copyrights. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
23 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
26 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | * | ||
31 | * You should have received a copy of the GNU General Public License along | ||
32 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
33 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
34 | */ | ||
35 | |||
36 | |||
37 | /* | ||
38 | * NOTE: | ||
39 | * | ||
40 | * This driver has only been tested with the Consumer IR | ||
41 | * port of the ITE 8172 system controller. | ||
42 | * | ||
43 | * You do not need this driver if you are using the ps/2 or | ||
44 | * USB adapter that the keyboard ships with. You only need | ||
45 | * this driver if your board has a IR port and the keyboard | ||
46 | * data is being sent directly to the IR. In that case, | ||
47 | * you also need some low-level IR support. See it8172_cir.c. | ||
48 | * | ||
49 | */ | ||
50 | |||
51 | #ifdef CONFIG_QTRONIX_KEYBOARD | ||
52 | |||
53 | #include <linux/module.h> | ||
54 | #include <linux/types.h> | ||
55 | #include <linux/pci.h> | ||
56 | #include <linux/kernel.h> | ||
57 | |||
58 | #include <asm/it8172/it8172.h> | ||
59 | #include <asm/it8172/it8172_int.h> | ||
60 | #include <asm/it8172/it8172_cir.h> | ||
61 | |||
62 | #include <linux/spinlock.h> | ||
63 | #include <linux/sched.h> | ||
64 | #include <linux/interrupt.h> | ||
65 | #include <linux/tty.h> | ||
66 | #include <linux/mm.h> | ||
67 | #include <linux/signal.h> | ||
68 | #include <linux/init.h> | ||
69 | #include <linux/kbd_ll.h> | ||
70 | #include <linux/delay.h> | ||
71 | #include <linux/poll.h> | ||
72 | #include <linux/miscdevice.h> | ||
73 | #include <linux/slab.h> | ||
74 | #include <linux/kbd_kern.h> | ||
75 | #include <linux/smp_lock.h> | ||
76 | #include <asm/io.h> | ||
77 | #include <linux/pc_keyb.h> | ||
78 | |||
79 | #include <asm/keyboard.h> | ||
80 | #include <linux/bitops.h> | ||
81 | #include <asm/uaccess.h> | ||
82 | #include <asm/irq.h> | ||
83 | #include <asm/system.h> | ||
84 | |||
85 | #define leading1 0 | ||
86 | #define leading2 0xF | ||
87 | |||
88 | #define KBD_CIR_PORT 0 | ||
89 | #define AUX_RECONNECT 170 /* scancode when ps2 device is plugged (back) in */ | ||
90 | |||
91 | static int data_index; | ||
92 | struct cir_port *cir; | ||
93 | static unsigned char kbdbytes[5]; | ||
94 | static unsigned char cir_data[32]; /* we only need 16 chars */ | ||
95 | |||
96 | static void kbd_int_handler(int irq, void *dev_id); | ||
97 | static int handle_data(unsigned char *p_data); | ||
98 | static inline void handle_mouse_event(unsigned char scancode); | ||
99 | static inline void handle_keyboard_event(unsigned char scancode, int down); | ||
100 | static int __init psaux_init(void); | ||
101 | |||
102 | static struct aux_queue *queue; /* Mouse data buffer. */ | ||
103 | static int aux_count = 0; | ||
104 | |||
105 | /* | ||
106 | * Keys accessed through the 'Fn' key | ||
107 | * The Fn key does not produce a key-up sequence. So, the first | ||
108 | * time the user presses it, it will be key-down event. The key | ||
109 | * stays down until the user presses it again. | ||
110 | */ | ||
111 | #define NUM_FN_KEYS 56 | ||
112 | static unsigned char fn_keys[NUM_FN_KEYS] = { | ||
113 | 0,0,0,0,0,0,0,0, /* 0 7 */ | ||
114 | 8,9,10,93,0,0,0,0, /* 8 15 */ | ||
115 | 0,0,0,0,0,0,0,5, /* 16 23 */ | ||
116 | 6,7,91,0,0,0,0,0, /* 24 31 */ | ||
117 | 0,0,0,0,0,2,3,4, /* 32 39 */ | ||
118 | 92,0,0,0,0,0,0,0, /* 40 47 */ | ||
119 | 0,0,0,0,11,0,94,95 /* 48 55 */ | ||
120 | |||
121 | }; | ||
122 | |||
123 | void __init init_qtronix_990P_kbd(void) | ||
124 | { | ||
125 | int retval; | ||
126 | |||
127 | cir = (struct cir_port *)kmalloc(sizeof(struct cir_port), GFP_KERNEL); | ||
128 | if (!cir) { | ||
129 | printk("Unable to initialize Qtronix keyboard\n"); | ||
130 | return; | ||
131 | } | ||
132 | |||
133 | /* | ||
134 | * revisit | ||
135 | * this should be programmable, somehow by the, by the user. | ||
136 | */ | ||
137 | cir->port = KBD_CIR_PORT; | ||
138 | cir->baud_rate = 0x1d; | ||
139 | cir->rdwos = 0; | ||
140 | cir->rxdcr = 0x3; | ||
141 | cir->hcfs = 0; | ||
142 | cir->fifo_tl = 0; | ||
143 | cir->cfq = 0x1d; | ||
144 | cir_port_init(cir); | ||
145 | |||
146 | retval = request_irq(IT8172_CIR0_IRQ, kbd_int_handler, | ||
147 | (unsigned long )(IRQF_DISABLED|IRQF_SHARED), | ||
148 | (const char *)"Qtronix IR Keyboard", (void *)cir); | ||
149 | |||
150 | if (retval) { | ||
151 | printk("unable to allocate cir %d irq %d\n", | ||
152 | cir->port, IT8172_CIR0_IRQ); | ||
153 | } | ||
154 | #ifdef CONFIG_PSMOUSE | ||
155 | psaux_init(); | ||
156 | #endif | ||
157 | } | ||
158 | |||
159 | static inline unsigned char BitReverse(unsigned short key) | ||
160 | { | ||
161 | unsigned char rkey = 0; | ||
162 | rkey |= (key & 0x1) << 7; | ||
163 | rkey |= (key & 0x2) << 5; | ||
164 | rkey |= (key & 0x4) << 3; | ||
165 | rkey |= (key & 0x8) << 1; | ||
166 | rkey |= (key & 0x10) >> 1; | ||
167 | rkey |= (key & 0x20) >> 3; | ||
168 | rkey |= (key & 0x40) >> 5; | ||
169 | rkey |= (key & 0x80) >> 7; | ||
170 | return rkey; | ||
171 | |||
172 | } | ||
173 | |||
174 | |||
175 | static inline u_int8_t UpperByte(u_int8_t data) | ||
176 | { | ||
177 | return (data >> 4); | ||
178 | } | ||
179 | |||
180 | |||
181 | static inline u_int8_t LowerByte(u_int8_t data) | ||
182 | { | ||
183 | return (data & 0xF); | ||
184 | } | ||
185 | |||
186 | |||
187 | int CheckSumOk(u_int8_t byte1, u_int8_t byte2, | ||
188 | u_int8_t byte3, u_int8_t byte4, u_int8_t byte5) | ||
189 | { | ||
190 | u_int8_t CheckSum; | ||
191 | |||
192 | CheckSum = (byte1 & 0x0F) + byte2 + byte3 + byte4 + byte5; | ||
193 | if ( LowerByte(UpperByte(CheckSum) + LowerByte(CheckSum)) != UpperByte(byte1) ) | ||
194 | return 0; | ||
195 | else | ||
196 | return 1; | ||
197 | } | ||
198 | |||
199 | |||
200 | static void kbd_int_handler(int irq, void *dev_id) | ||
201 | { | ||
202 | struct cir_port *cir; | ||
203 | int j; | ||
204 | unsigned char int_status; | ||
205 | |||
206 | cir = (struct cir_port *)dev_id; | ||
207 | int_status = get_int_status(cir); | ||
208 | if (int_status & 0x4) { | ||
209 | clear_fifo(cir); | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | while (cir_get_rx_count(cir)) { | ||
214 | |||
215 | cir_data[data_index] = cir_read_data(cir); | ||
216 | |||
217 | if (data_index == 0) {/* expecting first byte */ | ||
218 | if (cir_data[data_index] != leading1) { | ||
219 | //printk("!leading byte %x\n", cir_data[data_index]); | ||
220 | set_rx_active(cir); | ||
221 | clear_fifo(cir); | ||
222 | continue; | ||
223 | } | ||
224 | } | ||
225 | if (data_index == 1) { | ||
226 | if ((cir_data[data_index] & 0xf) != leading2) { | ||
227 | set_rx_active(cir); | ||
228 | data_index = 0; /* start over */ | ||
229 | clear_fifo(cir); | ||
230 | continue; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | if ( (cir_data[data_index] == 0xff)) { /* last byte */ | ||
235 | //printk("data_index %d\n", data_index); | ||
236 | set_rx_active(cir); | ||
237 | #if 0 | ||
238 | for (j=0; j<=data_index; j++) { | ||
239 | printk("rx_data %d: %x\n", j, cir_data[j]); | ||
240 | } | ||
241 | #endif | ||
242 | data_index = 0; | ||
243 | handle_data(cir_data); | ||
244 | return; | ||
245 | } | ||
246 | else if (data_index>16) { | ||
247 | set_rx_active(cir); | ||
248 | #if 0 | ||
249 | printk("warning: data_index %d\n", data_index); | ||
250 | for (j=0; j<=data_index; j++) { | ||
251 | printk("rx_data %d: %x\n", j, cir_data[j]); | ||
252 | } | ||
253 | #endif | ||
254 | data_index = 0; | ||
255 | clear_fifo(cir); | ||
256 | return; | ||
257 | } | ||
258 | data_index++; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | |||
263 | #define NUM_KBD_BYTES 5 | ||
264 | static int handle_data(unsigned char *p_data) | ||
265 | { | ||
266 | u_int32_t bit_bucket; | ||
267 | u_int32_t i, j; | ||
268 | u_int32_t got_bits, next_byte; | ||
269 | int down = 0; | ||
270 | |||
271 | /* Reorganize the bit stream */ | ||
272 | for (i=0; i<16; i++) | ||
273 | p_data[i] = BitReverse(~p_data[i]); | ||
274 | |||
275 | /* | ||
276 | * We've already previously checked that p_data[0] | ||
277 | * is equal to leading1 and that (p_data[1] & 0xf) | ||
278 | * is equal to leading2. These twelve bits are the | ||
279 | * leader code. We can now throw them away (the 12 | ||
280 | * bits) and continue parsing the stream. | ||
281 | */ | ||
282 | bit_bucket = p_data[1] << 12; | ||
283 | got_bits = 4; | ||
284 | next_byte = 2; | ||
285 | |||
286 | /* | ||
287 | * Process four bits at a time | ||
288 | */ | ||
289 | for (i=0; i<NUM_KBD_BYTES; i++) { | ||
290 | |||
291 | kbdbytes[i]=0; | ||
292 | |||
293 | for (j=0; j<8; j++) /* 8 bits per byte */ | ||
294 | { | ||
295 | if (got_bits < 4) { | ||
296 | bit_bucket |= (p_data[next_byte++] << (8 - got_bits)); | ||
297 | got_bits += 8; | ||
298 | } | ||
299 | |||
300 | if ((bit_bucket & 0xF000) == 0x8000) { | ||
301 | /* Convert 1000b to 1 */ | ||
302 | kbdbytes[i] = 0x80 | (kbdbytes[i] >> 1); | ||
303 | got_bits -= 4; | ||
304 | bit_bucket = bit_bucket << 4; | ||
305 | } | ||
306 | else if ((bit_bucket & 0xC000) == 0x8000) { | ||
307 | /* Convert 10b to 0 */ | ||
308 | kbdbytes[i] = kbdbytes[i] >> 1; | ||
309 | got_bits -= 2; | ||
310 | bit_bucket = bit_bucket << 2; | ||
311 | } | ||
312 | else { | ||
313 | /* bad serial stream */ | ||
314 | return 1; | ||
315 | } | ||
316 | |||
317 | if (next_byte > 16) { | ||
318 | //printk("error: too many bytes\n"); | ||
319 | return 1; | ||
320 | } | ||
321 | } | ||
322 | } | ||
323 | |||
324 | |||
325 | if (!CheckSumOk(kbdbytes[0], kbdbytes[1], | ||
326 | kbdbytes[2], kbdbytes[3], kbdbytes[4])) { | ||
327 | //printk("checksum failed\n"); | ||
328 | return 1; | ||
329 | } | ||
330 | |||
331 | if (kbdbytes[1] & 0x08) { | ||
332 | //printk("m: %x %x %x\n", kbdbytes[1], kbdbytes[2], kbdbytes[3]); | ||
333 | handle_mouse_event(kbdbytes[1]); | ||
334 | handle_mouse_event(kbdbytes[2]); | ||
335 | handle_mouse_event(kbdbytes[3]); | ||
336 | } | ||
337 | else { | ||
338 | if (kbdbytes[2] == 0) down = 1; | ||
339 | #if 0 | ||
340 | if (down) | ||
341 | printk("down %d\n", kbdbytes[3]); | ||
342 | else | ||
343 | printk("up %d\n", kbdbytes[3]); | ||
344 | #endif | ||
345 | handle_keyboard_event(kbdbytes[3], down); | ||
346 | } | ||
347 | return 0; | ||
348 | } | ||
349 | |||
350 | |||
351 | DEFINE_SPINLOCK(kbd_controller_lock); | ||
352 | static unsigned char handle_kbd_event(void); | ||
353 | |||
354 | |||
355 | int kbd_setkeycode(unsigned int scancode, unsigned int keycode) | ||
356 | { | ||
357 | printk("kbd_setkeycode scancode %x keycode %x\n", scancode, keycode); | ||
358 | return 0; | ||
359 | } | ||
360 | |||
361 | int kbd_getkeycode(unsigned int scancode) | ||
362 | { | ||
363 | return scancode; | ||
364 | } | ||
365 | |||
366 | |||
367 | int kbd_translate(unsigned char scancode, unsigned char *keycode, | ||
368 | char raw_mode) | ||
369 | { | ||
370 | static int prev_scancode = 0; | ||
371 | |||
372 | if (scancode == 0x00 || scancode == 0xff) { | ||
373 | prev_scancode = 0; | ||
374 | return 0; | ||
375 | } | ||
376 | |||
377 | /* todo */ | ||
378 | if (!prev_scancode && scancode == 160) { /* Fn key down */ | ||
379 | //printk("Fn key down\n"); | ||
380 | prev_scancode = 160; | ||
381 | return 0; | ||
382 | } | ||
383 | else if (prev_scancode && scancode == 160) { /* Fn key up */ | ||
384 | //printk("Fn key up\n"); | ||
385 | prev_scancode = 0; | ||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | /* todo */ | ||
390 | if (prev_scancode == 160) { | ||
391 | if (scancode <= NUM_FN_KEYS) { | ||
392 | *keycode = fn_keys[scancode]; | ||
393 | //printk("fn keycode %d\n", *keycode); | ||
394 | } | ||
395 | else | ||
396 | return 0; | ||
397 | } | ||
398 | else if (scancode <= 127) { | ||
399 | *keycode = scancode; | ||
400 | } | ||
401 | else | ||
402 | return 0; | ||
403 | |||
404 | |||
405 | return 1; | ||
406 | } | ||
407 | |||
408 | char kbd_unexpected_up(unsigned char keycode) | ||
409 | { | ||
410 | //printk("kbd_unexpected_up\n"); | ||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static unsigned char kbd_exists = 1; | ||
415 | |||
416 | static inline void handle_keyboard_event(unsigned char scancode, int down) | ||
417 | { | ||
418 | kbd_exists = 1; | ||
419 | handle_scancode(scancode, down); | ||
420 | tasklet_schedule(&keyboard_tasklet); | ||
421 | } | ||
422 | |||
423 | |||
424 | void kbd_leds(unsigned char leds) | ||
425 | { | ||
426 | } | ||
427 | |||
428 | /* dummy */ | ||
429 | void kbd_init_hw(void) | ||
430 | { | ||
431 | } | ||
432 | |||
433 | |||
434 | |||
435 | static inline void handle_mouse_event(unsigned char scancode) | ||
436 | { | ||
437 | if(scancode == AUX_RECONNECT){ | ||
438 | queue->head = queue->tail = 0; /* Flush input queue */ | ||
439 | // __aux_write_ack(AUX_ENABLE_DEV); /* ping the mouse :) */ | ||
440 | return; | ||
441 | } | ||
442 | |||
443 | if (aux_count) { | ||
444 | int head = queue->head; | ||
445 | |||
446 | queue->buf[head] = scancode; | ||
447 | head = (head + 1) & (AUX_BUF_SIZE-1); | ||
448 | if (head != queue->tail) { | ||
449 | queue->head = head; | ||
450 | kill_fasync(&queue->fasync, SIGIO, POLL_IN); | ||
451 | wake_up_interruptible(&queue->proc_list); | ||
452 | } | ||
453 | } | ||
454 | } | ||
455 | |||
456 | static unsigned char get_from_queue(void) | ||
457 | { | ||
458 | unsigned char result; | ||
459 | unsigned long flags; | ||
460 | |||
461 | spin_lock_irqsave(&kbd_controller_lock, flags); | ||
462 | result = queue->buf[queue->tail]; | ||
463 | queue->tail = (queue->tail + 1) & (AUX_BUF_SIZE-1); | ||
464 | spin_unlock_irqrestore(&kbd_controller_lock, flags); | ||
465 | return result; | ||
466 | } | ||
467 | |||
468 | |||
469 | static inline int queue_empty(void) | ||
470 | { | ||
471 | return queue->head == queue->tail; | ||
472 | } | ||
473 | |||
474 | static int fasync_aux(int fd, struct file *filp, int on) | ||
475 | { | ||
476 | int retval; | ||
477 | |||
478 | //printk("fasync_aux\n"); | ||
479 | retval = fasync_helper(fd, filp, on, &queue->fasync); | ||
480 | if (retval < 0) | ||
481 | return retval; | ||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | |||
486 | /* | ||
487 | * Random magic cookie for the aux device | ||
488 | */ | ||
489 | #define AUX_DEV ((void *)queue) | ||
490 | |||
491 | static int release_aux(struct inode * inode, struct file * file) | ||
492 | { | ||
493 | fasync_aux(-1, file, 0); | ||
494 | aux_count--; | ||
495 | return 0; | ||
496 | } | ||
497 | |||
498 | static int open_aux(struct inode * inode, struct file * file) | ||
499 | { | ||
500 | if (aux_count++) { | ||
501 | return 0; | ||
502 | } | ||
503 | queue->head = queue->tail = 0; /* Flush input queue */ | ||
504 | return 0; | ||
505 | } | ||
506 | |||
507 | /* | ||
508 | * Put bytes from input queue to buffer. | ||
509 | */ | ||
510 | |||
511 | static ssize_t read_aux(struct file * file, char * buffer, | ||
512 | size_t count, loff_t *ppos) | ||
513 | { | ||
514 | DECLARE_WAITQUEUE(wait, current); | ||
515 | ssize_t i = count; | ||
516 | unsigned char c; | ||
517 | |||
518 | if (queue_empty()) { | ||
519 | if (file->f_flags & O_NONBLOCK) | ||
520 | return -EAGAIN; | ||
521 | add_wait_queue(&queue->proc_list, &wait); | ||
522 | repeat: | ||
523 | set_current_state(TASK_INTERRUPTIBLE); | ||
524 | if (queue_empty() && !signal_pending(current)) { | ||
525 | schedule(); | ||
526 | goto repeat; | ||
527 | } | ||
528 | current->state = TASK_RUNNING; | ||
529 | remove_wait_queue(&queue->proc_list, &wait); | ||
530 | } | ||
531 | while (i > 0 && !queue_empty()) { | ||
532 | c = get_from_queue(); | ||
533 | put_user(c, buffer++); | ||
534 | i--; | ||
535 | } | ||
536 | if (count-i) { | ||
537 | struct inode *inode = file->f_dentry->d_inode; | ||
538 | inode->i_atime = current_fs_time(inode->i_sb); | ||
539 | return count-i; | ||
540 | } | ||
541 | if (signal_pending(current)) | ||
542 | return -ERESTARTSYS; | ||
543 | return 0; | ||
544 | } | ||
545 | |||
546 | /* | ||
547 | * Write to the aux device. | ||
548 | */ | ||
549 | |||
550 | static ssize_t write_aux(struct file * file, const char * buffer, | ||
551 | size_t count, loff_t *ppos) | ||
552 | { | ||
553 | /* | ||
554 | * The ITE boards this was tested on did not have the | ||
555 | * transmit wires connected. | ||
556 | */ | ||
557 | return count; | ||
558 | } | ||
559 | |||
560 | static unsigned int aux_poll(struct file *file, poll_table * wait) | ||
561 | { | ||
562 | poll_wait(file, &queue->proc_list, wait); | ||
563 | if (!queue_empty()) | ||
564 | return POLLIN | POLLRDNORM; | ||
565 | return 0; | ||
566 | } | ||
567 | |||
568 | struct file_operations psaux_fops = { | ||
569 | .read = read_aux, | ||
570 | .write = write_aux, | ||
571 | .poll = aux_poll, | ||
572 | .open = open_aux, | ||
573 | .release = release_aux, | ||
574 | .fasync = fasync_aux, | ||
575 | }; | ||
576 | |||
577 | /* | ||
578 | * Initialize driver. | ||
579 | */ | ||
580 | static struct miscdevice psaux_mouse = { | ||
581 | PSMOUSE_MINOR, "psaux", &psaux_fops | ||
582 | }; | ||
583 | |||
584 | static int __init psaux_init(void) | ||
585 | { | ||
586 | int retval; | ||
587 | |||
588 | retval = misc_register(&psaux_mouse); | ||
589 | if(retval < 0) | ||
590 | return retval; | ||
591 | |||
592 | queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL); | ||
593 | if (!queue) { | ||
594 | misc_deregister(&psaux_mouse); | ||
595 | return -ENOMEM; | ||
596 | } | ||
597 | |||
598 | memset(queue, 0, sizeof(*queue)); | ||
599 | queue->head = queue->tail = 0; | ||
600 | init_waitqueue_head(&queue->proc_list); | ||
601 | |||
602 | return 0; | ||
603 | } | ||
604 | module_init(init_qtronix_990P_kbd); | ||
605 | #endif | ||
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index abee7a339462..66a7385bc34a 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -35,13 +35,13 @@ | |||
35 | * 1.09a Pete Zaitcev: Sun SPARC | 35 | * 1.09a Pete Zaitcev: Sun SPARC |
36 | * 1.09b Jeff Garzik: Modularize, init cleanup | 36 | * 1.09b Jeff Garzik: Modularize, init cleanup |
37 | * 1.09c Jeff Garzik: SMP cleanup | 37 | * 1.09c Jeff Garzik: SMP cleanup |
38 | * 1.10 Paul Barton-Davis: add support for async I/O | 38 | * 1.10 Paul Barton-Davis: add support for async I/O |
39 | * 1.10a Andrea Arcangeli: Alpha updates | 39 | * 1.10a Andrea Arcangeli: Alpha updates |
40 | * 1.10b Andrew Morton: SMP lock fix | 40 | * 1.10b Andrew Morton: SMP lock fix |
41 | * 1.10c Cesar Barros: SMP locking fixes and cleanup | 41 | * 1.10c Cesar Barros: SMP locking fixes and cleanup |
42 | * 1.10d Paul Gortmaker: delete paranoia check in rtc_exit | 42 | * 1.10d Paul Gortmaker: delete paranoia check in rtc_exit |
43 | * 1.10e Maciej W. Rozycki: Handle DECstation's year weirdness. | 43 | * 1.10e Maciej W. Rozycki: Handle DECstation's year weirdness. |
44 | * 1.11 Takashi Iwai: Kernel access functions | 44 | * 1.11 Takashi Iwai: Kernel access functions |
45 | * rtc_register/rtc_unregister/rtc_control | 45 | * rtc_register/rtc_unregister/rtc_control |
46 | * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init | 46 | * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init |
47 | * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer | 47 | * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer |
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c index f3bf1e230bca..0358419a0e48 100644 --- a/drivers/dma/ioatdma.c +++ b/drivers/dma/ioatdma.c | |||
@@ -80,7 +80,7 @@ static int enumerate_dma_channels(struct ioat_device *device) | |||
80 | 80 | ||
81 | static struct ioat_desc_sw *ioat_dma_alloc_descriptor( | 81 | static struct ioat_desc_sw *ioat_dma_alloc_descriptor( |
82 | struct ioat_dma_chan *ioat_chan, | 82 | struct ioat_dma_chan *ioat_chan, |
83 | int flags) | 83 | gfp_t flags) |
84 | { | 84 | { |
85 | struct ioat_dma_descriptor *desc; | 85 | struct ioat_dma_descriptor *desc; |
86 | struct ioat_desc_sw *desc_sw; | 86 | struct ioat_desc_sw *desc_sw; |
@@ -686,7 +686,7 @@ static int __devinit ioat_probe(struct pci_dev *pdev, | |||
686 | { | 686 | { |
687 | int err; | 687 | int err; |
688 | unsigned long mmio_start, mmio_len; | 688 | unsigned long mmio_start, mmio_len; |
689 | void *reg_base; | 689 | void __iomem *reg_base; |
690 | struct ioat_device *device; | 690 | struct ioat_device *device; |
691 | 691 | ||
692 | err = pci_enable_device(pdev); | 692 | err = pci_enable_device(pdev); |
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h index a5d3b3644160..62b26a9be4c9 100644 --- a/drivers/dma/ioatdma.h +++ b/drivers/dma/ioatdma.h | |||
@@ -44,7 +44,7 @@ extern struct list_head dma_client_list; | |||
44 | 44 | ||
45 | struct ioat_device { | 45 | struct ioat_device { |
46 | struct pci_dev *pdev; | 46 | struct pci_dev *pdev; |
47 | void *reg_base; | 47 | void __iomem *reg_base; |
48 | struct pci_pool *dma_pool; | 48 | struct pci_pool *dma_pool; |
49 | struct pci_pool *completion_pool; | 49 | struct pci_pool *completion_pool; |
50 | 50 | ||
@@ -73,7 +73,7 @@ struct ioat_device { | |||
73 | 73 | ||
74 | struct ioat_dma_chan { | 74 | struct ioat_dma_chan { |
75 | 75 | ||
76 | void *reg_base; | 76 | void __iomem *reg_base; |
77 | 77 | ||
78 | dma_cookie_t completed_cookie; | 78 | dma_cookie_t completed_cookie; |
79 | unsigned long last_completion; | 79 | unsigned long last_completion; |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index f35fcc4c0638..25b1018a476c 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -75,6 +75,7 @@ static struct ib_cm { | |||
75 | struct rb_root remote_sidr_table; | 75 | struct rb_root remote_sidr_table; |
76 | struct idr local_id_table; | 76 | struct idr local_id_table; |
77 | __be32 random_id_operand; | 77 | __be32 random_id_operand; |
78 | struct list_head timewait_list; | ||
78 | struct workqueue_struct *wq; | 79 | struct workqueue_struct *wq; |
79 | } cm; | 80 | } cm; |
80 | 81 | ||
@@ -112,6 +113,7 @@ struct cm_work { | |||
112 | 113 | ||
113 | struct cm_timewait_info { | 114 | struct cm_timewait_info { |
114 | struct cm_work work; /* Must be first. */ | 115 | struct cm_work work; /* Must be first. */ |
116 | struct list_head list; | ||
115 | struct rb_node remote_qp_node; | 117 | struct rb_node remote_qp_node; |
116 | struct rb_node remote_id_node; | 118 | struct rb_node remote_id_node; |
117 | __be64 remote_ca_guid; | 119 | __be64 remote_ca_guid; |
@@ -647,13 +649,6 @@ static inline int cm_convert_to_ms(int iba_time) | |||
647 | 649 | ||
648 | static void cm_cleanup_timewait(struct cm_timewait_info *timewait_info) | 650 | static void cm_cleanup_timewait(struct cm_timewait_info *timewait_info) |
649 | { | 651 | { |
650 | unsigned long flags; | ||
651 | |||
652 | if (!timewait_info->inserted_remote_id && | ||
653 | !timewait_info->inserted_remote_qp) | ||
654 | return; | ||
655 | |||
656 | spin_lock_irqsave(&cm.lock, flags); | ||
657 | if (timewait_info->inserted_remote_id) { | 652 | if (timewait_info->inserted_remote_id) { |
658 | rb_erase(&timewait_info->remote_id_node, &cm.remote_id_table); | 653 | rb_erase(&timewait_info->remote_id_node, &cm.remote_id_table); |
659 | timewait_info->inserted_remote_id = 0; | 654 | timewait_info->inserted_remote_id = 0; |
@@ -663,7 +658,6 @@ static void cm_cleanup_timewait(struct cm_timewait_info *timewait_info) | |||
663 | rb_erase(&timewait_info->remote_qp_node, &cm.remote_qp_table); | 658 | rb_erase(&timewait_info->remote_qp_node, &cm.remote_qp_table); |
664 | timewait_info->inserted_remote_qp = 0; | 659 | timewait_info->inserted_remote_qp = 0; |
665 | } | 660 | } |
666 | spin_unlock_irqrestore(&cm.lock, flags); | ||
667 | } | 661 | } |
668 | 662 | ||
669 | static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id) | 663 | static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id) |
@@ -684,8 +678,12 @@ static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id) | |||
684 | static void cm_enter_timewait(struct cm_id_private *cm_id_priv) | 678 | static void cm_enter_timewait(struct cm_id_private *cm_id_priv) |
685 | { | 679 | { |
686 | int wait_time; | 680 | int wait_time; |
681 | unsigned long flags; | ||
687 | 682 | ||
683 | spin_lock_irqsave(&cm.lock, flags); | ||
688 | cm_cleanup_timewait(cm_id_priv->timewait_info); | 684 | cm_cleanup_timewait(cm_id_priv->timewait_info); |
685 | list_add_tail(&cm_id_priv->timewait_info->list, &cm.timewait_list); | ||
686 | spin_unlock_irqrestore(&cm.lock, flags); | ||
689 | 687 | ||
690 | /* | 688 | /* |
691 | * The cm_id could be destroyed by the user before we exit timewait. | 689 | * The cm_id could be destroyed by the user before we exit timewait. |
@@ -701,9 +699,13 @@ static void cm_enter_timewait(struct cm_id_private *cm_id_priv) | |||
701 | 699 | ||
702 | static void cm_reset_to_idle(struct cm_id_private *cm_id_priv) | 700 | static void cm_reset_to_idle(struct cm_id_private *cm_id_priv) |
703 | { | 701 | { |
702 | unsigned long flags; | ||
703 | |||
704 | cm_id_priv->id.state = IB_CM_IDLE; | 704 | cm_id_priv->id.state = IB_CM_IDLE; |
705 | if (cm_id_priv->timewait_info) { | 705 | if (cm_id_priv->timewait_info) { |
706 | spin_lock_irqsave(&cm.lock, flags); | ||
706 | cm_cleanup_timewait(cm_id_priv->timewait_info); | 707 | cm_cleanup_timewait(cm_id_priv->timewait_info); |
708 | spin_unlock_irqrestore(&cm.lock, flags); | ||
707 | kfree(cm_id_priv->timewait_info); | 709 | kfree(cm_id_priv->timewait_info); |
708 | cm_id_priv->timewait_info = NULL; | 710 | cm_id_priv->timewait_info = NULL; |
709 | } | 711 | } |
@@ -1307,6 +1309,7 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, | |||
1307 | if (timewait_info) { | 1309 | if (timewait_info) { |
1308 | cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, | 1310 | cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, |
1309 | timewait_info->work.remote_id); | 1311 | timewait_info->work.remote_id); |
1312 | cm_cleanup_timewait(cm_id_priv->timewait_info); | ||
1310 | spin_unlock_irqrestore(&cm.lock, flags); | 1313 | spin_unlock_irqrestore(&cm.lock, flags); |
1311 | if (cur_cm_id_priv) { | 1314 | if (cur_cm_id_priv) { |
1312 | cm_dup_req_handler(work, cur_cm_id_priv); | 1315 | cm_dup_req_handler(work, cur_cm_id_priv); |
@@ -1315,7 +1318,8 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, | |||
1315 | cm_issue_rej(work->port, work->mad_recv_wc, | 1318 | cm_issue_rej(work->port, work->mad_recv_wc, |
1316 | IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, | 1319 | IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, |
1317 | NULL, 0); | 1320 | NULL, 0); |
1318 | goto error; | 1321 | listen_cm_id_priv = NULL; |
1322 | goto out; | ||
1319 | } | 1323 | } |
1320 | 1324 | ||
1321 | /* Find matching listen request. */ | 1325 | /* Find matching listen request. */ |
@@ -1323,21 +1327,20 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, | |||
1323 | req_msg->service_id, | 1327 | req_msg->service_id, |
1324 | req_msg->private_data); | 1328 | req_msg->private_data); |
1325 | if (!listen_cm_id_priv) { | 1329 | if (!listen_cm_id_priv) { |
1330 | cm_cleanup_timewait(cm_id_priv->timewait_info); | ||
1326 | spin_unlock_irqrestore(&cm.lock, flags); | 1331 | spin_unlock_irqrestore(&cm.lock, flags); |
1327 | cm_issue_rej(work->port, work->mad_recv_wc, | 1332 | cm_issue_rej(work->port, work->mad_recv_wc, |
1328 | IB_CM_REJ_INVALID_SERVICE_ID, CM_MSG_RESPONSE_REQ, | 1333 | IB_CM_REJ_INVALID_SERVICE_ID, CM_MSG_RESPONSE_REQ, |
1329 | NULL, 0); | 1334 | NULL, 0); |
1330 | goto error; | 1335 | goto out; |
1331 | } | 1336 | } |
1332 | atomic_inc(&listen_cm_id_priv->refcount); | 1337 | atomic_inc(&listen_cm_id_priv->refcount); |
1333 | atomic_inc(&cm_id_priv->refcount); | 1338 | atomic_inc(&cm_id_priv->refcount); |
1334 | cm_id_priv->id.state = IB_CM_REQ_RCVD; | 1339 | cm_id_priv->id.state = IB_CM_REQ_RCVD; |
1335 | atomic_inc(&cm_id_priv->work_count); | 1340 | atomic_inc(&cm_id_priv->work_count); |
1336 | spin_unlock_irqrestore(&cm.lock, flags); | 1341 | spin_unlock_irqrestore(&cm.lock, flags); |
1342 | out: | ||
1337 | return listen_cm_id_priv; | 1343 | return listen_cm_id_priv; |
1338 | |||
1339 | error: cm_cleanup_timewait(cm_id_priv->timewait_info); | ||
1340 | return NULL; | ||
1341 | } | 1344 | } |
1342 | 1345 | ||
1343 | static int cm_req_handler(struct cm_work *work) | 1346 | static int cm_req_handler(struct cm_work *work) |
@@ -1899,6 +1902,32 @@ out: spin_unlock_irqrestore(&cm_id_priv->lock, flags); | |||
1899 | } | 1902 | } |
1900 | EXPORT_SYMBOL(ib_send_cm_drep); | 1903 | EXPORT_SYMBOL(ib_send_cm_drep); |
1901 | 1904 | ||
1905 | static int cm_issue_drep(struct cm_port *port, | ||
1906 | struct ib_mad_recv_wc *mad_recv_wc) | ||
1907 | { | ||
1908 | struct ib_mad_send_buf *msg = NULL; | ||
1909 | struct cm_dreq_msg *dreq_msg; | ||
1910 | struct cm_drep_msg *drep_msg; | ||
1911 | int ret; | ||
1912 | |||
1913 | ret = cm_alloc_response_msg(port, mad_recv_wc, &msg); | ||
1914 | if (ret) | ||
1915 | return ret; | ||
1916 | |||
1917 | dreq_msg = (struct cm_dreq_msg *) mad_recv_wc->recv_buf.mad; | ||
1918 | drep_msg = (struct cm_drep_msg *) msg->mad; | ||
1919 | |||
1920 | cm_format_mad_hdr(&drep_msg->hdr, CM_DREP_ATTR_ID, dreq_msg->hdr.tid); | ||
1921 | drep_msg->remote_comm_id = dreq_msg->local_comm_id; | ||
1922 | drep_msg->local_comm_id = dreq_msg->remote_comm_id; | ||
1923 | |||
1924 | ret = ib_post_send_mad(msg, NULL); | ||
1925 | if (ret) | ||
1926 | cm_free_msg(msg); | ||
1927 | |||
1928 | return ret; | ||
1929 | } | ||
1930 | |||
1902 | static int cm_dreq_handler(struct cm_work *work) | 1931 | static int cm_dreq_handler(struct cm_work *work) |
1903 | { | 1932 | { |
1904 | struct cm_id_private *cm_id_priv; | 1933 | struct cm_id_private *cm_id_priv; |
@@ -1910,8 +1939,10 @@ static int cm_dreq_handler(struct cm_work *work) | |||
1910 | dreq_msg = (struct cm_dreq_msg *)work->mad_recv_wc->recv_buf.mad; | 1939 | dreq_msg = (struct cm_dreq_msg *)work->mad_recv_wc->recv_buf.mad; |
1911 | cm_id_priv = cm_acquire_id(dreq_msg->remote_comm_id, | 1940 | cm_id_priv = cm_acquire_id(dreq_msg->remote_comm_id, |
1912 | dreq_msg->local_comm_id); | 1941 | dreq_msg->local_comm_id); |
1913 | if (!cm_id_priv) | 1942 | if (!cm_id_priv) { |
1943 | cm_issue_drep(work->port, work->mad_recv_wc); | ||
1914 | return -EINVAL; | 1944 | return -EINVAL; |
1945 | } | ||
1915 | 1946 | ||
1916 | work->cm_event.private_data = &dreq_msg->private_data; | 1947 | work->cm_event.private_data = &dreq_msg->private_data; |
1917 | 1948 | ||
@@ -2601,28 +2632,29 @@ static int cm_timewait_handler(struct cm_work *work) | |||
2601 | { | 2632 | { |
2602 | struct cm_timewait_info *timewait_info; | 2633 | struct cm_timewait_info *timewait_info; |
2603 | struct cm_id_private *cm_id_priv; | 2634 | struct cm_id_private *cm_id_priv; |
2604 | unsigned long flags; | ||
2605 | int ret; | 2635 | int ret; |
2606 | 2636 | ||
2607 | timewait_info = (struct cm_timewait_info *)work; | 2637 | timewait_info = (struct cm_timewait_info *)work; |
2608 | cm_cleanup_timewait(timewait_info); | 2638 | spin_lock_irq(&cm.lock); |
2639 | list_del(&timewait_info->list); | ||
2640 | spin_unlock_irq(&cm.lock); | ||
2609 | 2641 | ||
2610 | cm_id_priv = cm_acquire_id(timewait_info->work.local_id, | 2642 | cm_id_priv = cm_acquire_id(timewait_info->work.local_id, |
2611 | timewait_info->work.remote_id); | 2643 | timewait_info->work.remote_id); |
2612 | if (!cm_id_priv) | 2644 | if (!cm_id_priv) |
2613 | return -EINVAL; | 2645 | return -EINVAL; |
2614 | 2646 | ||
2615 | spin_lock_irqsave(&cm_id_priv->lock, flags); | 2647 | spin_lock_irq(&cm_id_priv->lock); |
2616 | if (cm_id_priv->id.state != IB_CM_TIMEWAIT || | 2648 | if (cm_id_priv->id.state != IB_CM_TIMEWAIT || |
2617 | cm_id_priv->remote_qpn != timewait_info->remote_qpn) { | 2649 | cm_id_priv->remote_qpn != timewait_info->remote_qpn) { |
2618 | spin_unlock_irqrestore(&cm_id_priv->lock, flags); | 2650 | spin_unlock_irq(&cm_id_priv->lock); |
2619 | goto out; | 2651 | goto out; |
2620 | } | 2652 | } |
2621 | cm_id_priv->id.state = IB_CM_IDLE; | 2653 | cm_id_priv->id.state = IB_CM_IDLE; |
2622 | ret = atomic_inc_and_test(&cm_id_priv->work_count); | 2654 | ret = atomic_inc_and_test(&cm_id_priv->work_count); |
2623 | if (!ret) | 2655 | if (!ret) |
2624 | list_add_tail(&work->list, &cm_id_priv->work_list); | 2656 | list_add_tail(&work->list, &cm_id_priv->work_list); |
2625 | spin_unlock_irqrestore(&cm_id_priv->lock, flags); | 2657 | spin_unlock_irq(&cm_id_priv->lock); |
2626 | 2658 | ||
2627 | if (ret) | 2659 | if (ret) |
2628 | cm_process_work(cm_id_priv, work); | 2660 | cm_process_work(cm_id_priv, work); |
@@ -3374,6 +3406,7 @@ static int __init ib_cm_init(void) | |||
3374 | idr_init(&cm.local_id_table); | 3406 | idr_init(&cm.local_id_table); |
3375 | get_random_bytes(&cm.random_id_operand, sizeof cm.random_id_operand); | 3407 | get_random_bytes(&cm.random_id_operand, sizeof cm.random_id_operand); |
3376 | idr_pre_get(&cm.local_id_table, GFP_KERNEL); | 3408 | idr_pre_get(&cm.local_id_table, GFP_KERNEL); |
3409 | INIT_LIST_HEAD(&cm.timewait_list); | ||
3377 | 3410 | ||
3378 | cm.wq = create_workqueue("ib_cm"); | 3411 | cm.wq = create_workqueue("ib_cm"); |
3379 | if (!cm.wq) | 3412 | if (!cm.wq) |
@@ -3391,7 +3424,20 @@ error: | |||
3391 | 3424 | ||
3392 | static void __exit ib_cm_cleanup(void) | 3425 | static void __exit ib_cm_cleanup(void) |
3393 | { | 3426 | { |
3427 | struct cm_timewait_info *timewait_info, *tmp; | ||
3428 | |||
3429 | spin_lock_irq(&cm.lock); | ||
3430 | list_for_each_entry(timewait_info, &cm.timewait_list, list) | ||
3431 | cancel_delayed_work(&timewait_info->work.work); | ||
3432 | spin_unlock_irq(&cm.lock); | ||
3433 | |||
3394 | destroy_workqueue(cm.wq); | 3434 | destroy_workqueue(cm.wq); |
3435 | |||
3436 | list_for_each_entry_safe(timewait_info, tmp, &cm.timewait_list, list) { | ||
3437 | list_del(&timewait_info->list); | ||
3438 | kfree(timewait_info); | ||
3439 | } | ||
3440 | |||
3395 | ib_unregister_client(&cm_client); | 3441 | ib_unregister_client(&cm_client); |
3396 | idr_destroy(&cm.local_id_table); | 3442 | idr_destroy(&cm.local_id_table); |
3397 | } | 3443 | } |
diff --git a/drivers/infiniband/hw/amso1100/c2_ae.c b/drivers/infiniband/hw/amso1100/c2_ae.c index 3aae4978e1cb..a31439bd3b67 100644 --- a/drivers/infiniband/hw/amso1100/c2_ae.c +++ b/drivers/infiniband/hw/amso1100/c2_ae.c | |||
@@ -66,7 +66,6 @@ static int c2_convert_cm_status(u32 c2_status) | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | #ifdef DEBUG | ||
70 | static const char* to_event_str(int event) | 69 | static const char* to_event_str(int event) |
71 | { | 70 | { |
72 | static const char* event_str[] = { | 71 | static const char* event_str[] = { |
@@ -144,7 +143,6 @@ static const char *to_qp_state_str(int state) | |||
144 | return "<invalid QP state>"; | 143 | return "<invalid QP state>"; |
145 | }; | 144 | }; |
146 | } | 145 | } |
147 | #endif | ||
148 | 146 | ||
149 | void c2_ae_event(struct c2_dev *c2dev, u32 mq_index) | 147 | void c2_ae_event(struct c2_dev *c2dev, u32 mq_index) |
150 | { | 148 | { |
diff --git a/drivers/infiniband/hw/amso1100/c2_qp.c b/drivers/infiniband/hw/amso1100/c2_qp.c index 12261132b077..5bcf697aa335 100644 --- a/drivers/infiniband/hw/amso1100/c2_qp.c +++ b/drivers/infiniband/hw/amso1100/c2_qp.c | |||
@@ -35,6 +35,8 @@ | |||
35 | * | 35 | * |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include <linux/delay.h> | ||
39 | |||
38 | #include "c2.h" | 40 | #include "c2.h" |
39 | #include "c2_vq.h" | 41 | #include "c2_vq.h" |
40 | #include "c2_status.h" | 42 | #include "c2_status.h" |
@@ -705,10 +707,8 @@ static inline void c2_activity(struct c2_dev *c2dev, u32 mq_index, u16 shared) | |||
705 | * cannot get on the bus and the card and system hang in a | 707 | * cannot get on the bus and the card and system hang in a |
706 | * deadlock -- thus the need for this code. [TOT] | 708 | * deadlock -- thus the need for this code. [TOT] |
707 | */ | 709 | */ |
708 | while (readl(c2dev->regs + PCI_BAR0_ADAPTER_HINT) & 0x80000000) { | 710 | while (readl(c2dev->regs + PCI_BAR0_ADAPTER_HINT) & 0x80000000) |
709 | set_current_state(TASK_UNINTERRUPTIBLE); | 711 | udelay(10); |
710 | schedule_timeout(0); | ||
711 | } | ||
712 | 712 | ||
713 | __raw_writel(C2_HINT_MAKE(mq_index, shared), | 713 | __raw_writel(C2_HINT_MAKE(mq_index, shared), |
714 | c2dev->regs + PCI_BAR0_ADAPTER_HINT); | 714 | c2dev->regs + PCI_BAR0_ADAPTER_HINT); |
@@ -766,6 +766,7 @@ int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, | |||
766 | struct c2_dev *c2dev = to_c2dev(ibqp->device); | 766 | struct c2_dev *c2dev = to_c2dev(ibqp->device); |
767 | struct c2_qp *qp = to_c2qp(ibqp); | 767 | struct c2_qp *qp = to_c2qp(ibqp); |
768 | union c2wr wr; | 768 | union c2wr wr; |
769 | unsigned long lock_flags; | ||
769 | int err = 0; | 770 | int err = 0; |
770 | 771 | ||
771 | u32 flags; | 772 | u32 flags; |
@@ -881,8 +882,10 @@ int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, | |||
881 | /* | 882 | /* |
882 | * Post the puppy! | 883 | * Post the puppy! |
883 | */ | 884 | */ |
885 | spin_lock_irqsave(&qp->lock, lock_flags); | ||
884 | err = qp_wr_post(&qp->sq_mq, &wr, qp, msg_size); | 886 | err = qp_wr_post(&qp->sq_mq, &wr, qp, msg_size); |
885 | if (err) { | 887 | if (err) { |
888 | spin_unlock_irqrestore(&qp->lock, lock_flags); | ||
886 | break; | 889 | break; |
887 | } | 890 | } |
888 | 891 | ||
@@ -890,6 +893,7 @@ int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, | |||
890 | * Enqueue mq index to activity FIFO. | 893 | * Enqueue mq index to activity FIFO. |
891 | */ | 894 | */ |
892 | c2_activity(c2dev, qp->sq_mq.index, qp->sq_mq.hint_count); | 895 | c2_activity(c2dev, qp->sq_mq.index, qp->sq_mq.hint_count); |
896 | spin_unlock_irqrestore(&qp->lock, lock_flags); | ||
893 | 897 | ||
894 | ib_wr = ib_wr->next; | 898 | ib_wr = ib_wr->next; |
895 | } | 899 | } |
@@ -905,6 +909,7 @@ int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, | |||
905 | struct c2_dev *c2dev = to_c2dev(ibqp->device); | 909 | struct c2_dev *c2dev = to_c2dev(ibqp->device); |
906 | struct c2_qp *qp = to_c2qp(ibqp); | 910 | struct c2_qp *qp = to_c2qp(ibqp); |
907 | union c2wr wr; | 911 | union c2wr wr; |
912 | unsigned long lock_flags; | ||
908 | int err = 0; | 913 | int err = 0; |
909 | 914 | ||
910 | if (qp->state > IB_QPS_RTS) | 915 | if (qp->state > IB_QPS_RTS) |
@@ -945,8 +950,10 @@ int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, | |||
945 | break; | 950 | break; |
946 | } | 951 | } |
947 | 952 | ||
953 | spin_lock_irqsave(&qp->lock, lock_flags); | ||
948 | err = qp_wr_post(&qp->rq_mq, &wr, qp, qp->rq_mq.msg_size); | 954 | err = qp_wr_post(&qp->rq_mq, &wr, qp, qp->rq_mq.msg_size); |
949 | if (err) { | 955 | if (err) { |
956 | spin_unlock_irqrestore(&qp->lock, lock_flags); | ||
950 | break; | 957 | break; |
951 | } | 958 | } |
952 | 959 | ||
@@ -954,6 +961,7 @@ int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, | |||
954 | * Enqueue mq index to activity FIFO | 961 | * Enqueue mq index to activity FIFO |
955 | */ | 962 | */ |
956 | c2_activity(c2dev, qp->rq_mq.index, qp->rq_mq.hint_count); | 963 | c2_activity(c2dev, qp->rq_mq.index, qp->rq_mq.hint_count); |
964 | spin_unlock_irqrestore(&qp->lock, lock_flags); | ||
957 | 965 | ||
958 | ib_wr = ib_wr->next; | 966 | ib_wr = ib_wr->next; |
959 | } | 967 | } |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 981fe2eebdfa..fc67f780581b 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -179,6 +179,8 @@ static int mthca_query_port(struct ib_device *ibdev, | |||
179 | props->max_mtu = out_mad->data[41] & 0xf; | 179 | props->max_mtu = out_mad->data[41] & 0xf; |
180 | props->active_mtu = out_mad->data[36] >> 4; | 180 | props->active_mtu = out_mad->data[36] >> 4; |
181 | props->subnet_timeout = out_mad->data[51] & 0x1f; | 181 | props->subnet_timeout = out_mad->data[51] & 0x1f; |
182 | props->max_vl_num = out_mad->data[37] >> 4; | ||
183 | props->init_type_reply = out_mad->data[41] >> 4; | ||
182 | 184 | ||
183 | out: | 185 | out: |
184 | kfree(in_mad); | 186 | kfree(in_mad); |
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index 0f316c87bf64..92a72f521528 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -201,6 +201,8 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd, | |||
201 | 201 | ||
202 | if (mthca_is_memfree(dev)) | 202 | if (mthca_is_memfree(dev)) |
203 | srq->max = roundup_pow_of_two(srq->max + 1); | 203 | srq->max = roundup_pow_of_two(srq->max + 1); |
204 | else | ||
205 | srq->max = srq->max + 1; | ||
204 | 206 | ||
205 | ds = max(64UL, | 207 | ds = max(64UL, |
206 | roundup_pow_of_two(sizeof (struct mthca_next_seg) + | 208 | roundup_pow_of_two(sizeof (struct mthca_next_seg) + |
@@ -277,7 +279,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd, | |||
277 | srq->first_free = 0; | 279 | srq->first_free = 0; |
278 | srq->last_free = srq->max - 1; | 280 | srq->last_free = srq->max - 1; |
279 | 281 | ||
280 | attr->max_wr = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max; | 282 | attr->max_wr = srq->max - 1; |
281 | attr->max_sge = srq->max_gs; | 283 | attr->max_sge = srq->max_gs; |
282 | 284 | ||
283 | return 0; | 285 | return 0; |
@@ -413,7 +415,7 @@ int mthca_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr) | |||
413 | srq_attr->srq_limit = be16_to_cpu(tavor_ctx->limit_watermark); | 415 | srq_attr->srq_limit = be16_to_cpu(tavor_ctx->limit_watermark); |
414 | } | 416 | } |
415 | 417 | ||
416 | srq_attr->max_wr = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max; | 418 | srq_attr->max_wr = srq->max - 1; |
417 | srq_attr->max_sge = srq->max_gs; | 419 | srq_attr->max_sge = srq->max_gs; |
418 | 420 | ||
419 | out: | 421 | out: |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index f426a69d9a43..8bf5e9ec7c95 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -355,6 +355,11 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, | |||
355 | tx_req->skb = skb; | 355 | tx_req->skb = skb; |
356 | addr = dma_map_single(priv->ca->dma_device, skb->data, skb->len, | 356 | addr = dma_map_single(priv->ca->dma_device, skb->data, skb->len, |
357 | DMA_TO_DEVICE); | 357 | DMA_TO_DEVICE); |
358 | if (unlikely(dma_mapping_error(addr))) { | ||
359 | ++priv->stats.tx_errors; | ||
360 | dev_kfree_skb_any(skb); | ||
361 | return; | ||
362 | } | ||
358 | pci_unmap_addr_set(tx_req, mapping, addr); | 363 | pci_unmap_addr_set(tx_req, mapping, addr); |
359 | 364 | ||
360 | if (unlikely(post_send(priv, priv->tx_head & (ipoib_sendq_size - 1), | 365 | if (unlikely(post_send(priv, priv->tx_head & (ipoib_sendq_size - 1), |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 44b9e5be6687..4b09147f438f 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -343,29 +343,32 @@ static int srp_send_req(struct srp_target_port *target) | |||
343 | */ | 343 | */ |
344 | if (target->io_class == SRP_REV10_IB_IO_CLASS) { | 344 | if (target->io_class == SRP_REV10_IB_IO_CLASS) { |
345 | memcpy(req->priv.initiator_port_id, | 345 | memcpy(req->priv.initiator_port_id, |
346 | target->srp_host->initiator_port_id + 8, 8); | 346 | &target->path.sgid.global.interface_id, 8); |
347 | memcpy(req->priv.initiator_port_id + 8, | 347 | memcpy(req->priv.initiator_port_id + 8, |
348 | target->srp_host->initiator_port_id, 8); | 348 | &target->initiator_ext, 8); |
349 | memcpy(req->priv.target_port_id, &target->ioc_guid, 8); | 349 | memcpy(req->priv.target_port_id, &target->ioc_guid, 8); |
350 | memcpy(req->priv.target_port_id + 8, &target->id_ext, 8); | 350 | memcpy(req->priv.target_port_id + 8, &target->id_ext, 8); |
351 | } else { | 351 | } else { |
352 | memcpy(req->priv.initiator_port_id, | 352 | memcpy(req->priv.initiator_port_id, |
353 | target->srp_host->initiator_port_id, 16); | 353 | &target->initiator_ext, 8); |
354 | memcpy(req->priv.initiator_port_id + 8, | ||
355 | &target->path.sgid.global.interface_id, 8); | ||
354 | memcpy(req->priv.target_port_id, &target->id_ext, 8); | 356 | memcpy(req->priv.target_port_id, &target->id_ext, 8); |
355 | memcpy(req->priv.target_port_id + 8, &target->ioc_guid, 8); | 357 | memcpy(req->priv.target_port_id + 8, &target->ioc_guid, 8); |
356 | } | 358 | } |
357 | 359 | ||
358 | /* | 360 | /* |
359 | * Topspin/Cisco SRP targets will reject our login unless we | 361 | * Topspin/Cisco SRP targets will reject our login unless we |
360 | * zero out the first 8 bytes of our initiator port ID. The | 362 | * zero out the first 8 bytes of our initiator port ID and set |
361 | * second 8 bytes must be our local node GUID, but we always | 363 | * the second 8 bytes to the local node GUID. |
362 | * use that anyway. | ||
363 | */ | 364 | */ |
364 | if (topspin_workarounds && !memcmp(&target->ioc_guid, topspin_oui, 3)) { | 365 | if (topspin_workarounds && !memcmp(&target->ioc_guid, topspin_oui, 3)) { |
365 | printk(KERN_DEBUG PFX "Topspin/Cisco initiator port ID workaround " | 366 | printk(KERN_DEBUG PFX "Topspin/Cisco initiator port ID workaround " |
366 | "activated for target GUID %016llx\n", | 367 | "activated for target GUID %016llx\n", |
367 | (unsigned long long) be64_to_cpu(target->ioc_guid)); | 368 | (unsigned long long) be64_to_cpu(target->ioc_guid)); |
368 | memset(req->priv.initiator_port_id, 0, 8); | 369 | memset(req->priv.initiator_port_id, 0, 8); |
370 | memcpy(req->priv.initiator_port_id + 8, | ||
371 | &target->srp_host->dev->dev->node_guid, 8); | ||
369 | } | 372 | } |
370 | 373 | ||
371 | status = ib_send_cm_req(target->cm_id, &req->param); | 374 | status = ib_send_cm_req(target->cm_id, &req->param); |
@@ -1553,6 +1556,7 @@ enum { | |||
1553 | SRP_OPT_MAX_SECT = 1 << 5, | 1556 | SRP_OPT_MAX_SECT = 1 << 5, |
1554 | SRP_OPT_MAX_CMD_PER_LUN = 1 << 6, | 1557 | SRP_OPT_MAX_CMD_PER_LUN = 1 << 6, |
1555 | SRP_OPT_IO_CLASS = 1 << 7, | 1558 | SRP_OPT_IO_CLASS = 1 << 7, |
1559 | SRP_OPT_INITIATOR_EXT = 1 << 8, | ||
1556 | SRP_OPT_ALL = (SRP_OPT_ID_EXT | | 1560 | SRP_OPT_ALL = (SRP_OPT_ID_EXT | |
1557 | SRP_OPT_IOC_GUID | | 1561 | SRP_OPT_IOC_GUID | |
1558 | SRP_OPT_DGID | | 1562 | SRP_OPT_DGID | |
@@ -1569,6 +1573,7 @@ static match_table_t srp_opt_tokens = { | |||
1569 | { SRP_OPT_MAX_SECT, "max_sect=%d" }, | 1573 | { SRP_OPT_MAX_SECT, "max_sect=%d" }, |
1570 | { SRP_OPT_MAX_CMD_PER_LUN, "max_cmd_per_lun=%d" }, | 1574 | { SRP_OPT_MAX_CMD_PER_LUN, "max_cmd_per_lun=%d" }, |
1571 | { SRP_OPT_IO_CLASS, "io_class=%x" }, | 1575 | { SRP_OPT_IO_CLASS, "io_class=%x" }, |
1576 | { SRP_OPT_INITIATOR_EXT, "initiator_ext=%s" }, | ||
1572 | { SRP_OPT_ERR, NULL } | 1577 | { SRP_OPT_ERR, NULL } |
1573 | }; | 1578 | }; |
1574 | 1579 | ||
@@ -1668,6 +1673,12 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target) | |||
1668 | target->io_class = token; | 1673 | target->io_class = token; |
1669 | break; | 1674 | break; |
1670 | 1675 | ||
1676 | case SRP_OPT_INITIATOR_EXT: | ||
1677 | p = match_strdup(args); | ||
1678 | target->initiator_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); | ||
1679 | kfree(p); | ||
1680 | break; | ||
1681 | |||
1671 | default: | 1682 | default: |
1672 | printk(KERN_WARNING PFX "unknown parameter or missing value " | 1683 | printk(KERN_WARNING PFX "unknown parameter or missing value " |
1673 | "'%s' in target creation request\n", p); | 1684 | "'%s' in target creation request\n", p); |
@@ -1708,7 +1719,6 @@ static ssize_t srp_create_target(struct class_device *class_dev, | |||
1708 | target_host->max_lun = SRP_MAX_LUN; | 1719 | target_host->max_lun = SRP_MAX_LUN; |
1709 | 1720 | ||
1710 | target = host_to_target(target_host); | 1721 | target = host_to_target(target_host); |
1711 | memset(target, 0, sizeof *target); | ||
1712 | 1722 | ||
1713 | target->io_class = SRP_REV16A_IB_IO_CLASS; | 1723 | target->io_class = SRP_REV16A_IB_IO_CLASS; |
1714 | target->scsi_host = target_host; | 1724 | target->scsi_host = target_host; |
@@ -1815,9 +1825,6 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port) | |||
1815 | host->dev = device; | 1825 | host->dev = device; |
1816 | host->port = port; | 1826 | host->port = port; |
1817 | 1827 | ||
1818 | host->initiator_port_id[7] = port; | ||
1819 | memcpy(host->initiator_port_id + 8, &device->dev->node_guid, 8); | ||
1820 | |||
1821 | host->class_dev.class = &srp_class; | 1828 | host->class_dev.class = &srp_class; |
1822 | host->class_dev.dev = device->dev->dma_device; | 1829 | host->class_dev.dev = device->dev->dma_device; |
1823 | snprintf(host->class_dev.class_id, BUS_ID_SIZE, "srp-%s-%d", | 1830 | snprintf(host->class_dev.class_id, BUS_ID_SIZE, "srp-%s-%d", |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 5b581fb8eb0d..d4e35ef51374 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h | |||
@@ -91,7 +91,6 @@ struct srp_device { | |||
91 | }; | 91 | }; |
92 | 92 | ||
93 | struct srp_host { | 93 | struct srp_host { |
94 | u8 initiator_port_id[16]; | ||
95 | struct srp_device *dev; | 94 | struct srp_device *dev; |
96 | u8 port; | 95 | u8 port; |
97 | struct class_device class_dev; | 96 | struct class_device class_dev; |
@@ -122,6 +121,7 @@ struct srp_target_port { | |||
122 | __be64 id_ext; | 121 | __be64 id_ext; |
123 | __be64 ioc_guid; | 122 | __be64 ioc_guid; |
124 | __be64 service_id; | 123 | __be64 service_id; |
124 | __be64 initiator_ext; | ||
125 | u16 io_class; | 125 | u16 io_class; |
126 | struct srp_host *srp_host; | 126 | struct srp_host *srp_host; |
127 | struct Scsi_Host *scsi_host; | 127 | struct Scsi_Host *scsi_host; |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 20df657b70c8..2a461dde480c 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -174,7 +174,7 @@ static void em28xx_config_i2c(struct em28xx *dev) | |||
174 | 174 | ||
175 | route.input = INPUT(dev->ctl_input)->vmux; | 175 | route.input = INPUT(dev->ctl_input)->vmux; |
176 | route.output = 0; | 176 | route.output = 0; |
177 | em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, 0); | 177 | em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL); |
178 | em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); | 178 | em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); |
179 | em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL); | 179 | em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL); |
180 | 180 | ||
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 6d024342b2fd..9a7d39b7cdbf 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -1329,7 +1329,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1329 | tasklet_init(&host->finish_tasklet, | 1329 | tasklet_init(&host->finish_tasklet, |
1330 | sdhci_tasklet_finish, (unsigned long)host); | 1330 | sdhci_tasklet_finish, (unsigned long)host); |
1331 | 1331 | ||
1332 | setup_timer(&host->timer, sdhci_timeout_timer, (long)host); | 1332 | setup_timer(&host->timer, sdhci_timeout_timer, (unsigned long)host); |
1333 | 1333 | ||
1334 | ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED, | 1334 | ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED, |
1335 | host->slot_descr, host); | 1335 | host->slot_descr, host); |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index bc7cc71788bc..d1717763f719 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -62,7 +62,7 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | if (info->map.virt != NULL) | 64 | if (info->map.virt != NULL) |
65 | iounmap((void *)info->map.virt); | 65 | iounmap(info->map.virt); |
66 | 66 | ||
67 | if (info->res != NULL) { | 67 | if (info->res != NULL) { |
68 | release_resource(info->res); | 68 | release_resource(info->res); |
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c index e0a1d386e581..94924d52a9b9 100644 --- a/drivers/mtd/nand/cs553x_nand.c +++ b/drivers/mtd/nand/cs553x_nand.c | |||
@@ -249,7 +249,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) | |||
249 | goto out; | 249 | goto out; |
250 | 250 | ||
251 | out_ior: | 251 | out_ior: |
252 | iounmap((void *)this->IO_ADDR_R); | 252 | iounmap(this->IO_ADDR_R); |
253 | out_mtd: | 253 | out_mtd: |
254 | kfree(new_mtd); | 254 | kfree(new_mtd); |
255 | out: | 255 | out: |
diff --git a/drivers/net/chelsio/cpl5_cmd.h b/drivers/net/chelsio/cpl5_cmd.h index 27925e487bcf..5b357d9e88d6 100644 --- a/drivers/net/chelsio/cpl5_cmd.h +++ b/drivers/net/chelsio/cpl5_cmd.h | |||
@@ -108,7 +108,7 @@ struct cpl_tx_pkt_lso { | |||
108 | u8 iff:4; | 108 | u8 iff:4; |
109 | #endif | 109 | #endif |
110 | u16 vlan; | 110 | u16 vlan; |
111 | u32 len; | 111 | __be32 len; |
112 | 112 | ||
113 | u32 rsvd2; | 113 | u32 rsvd2; |
114 | u8 rsvd3; | 114 | u8 rsvd3; |
@@ -119,7 +119,7 @@ struct cpl_tx_pkt_lso { | |||
119 | u8 ip_hdr_words:4; | 119 | u8 ip_hdr_words:4; |
120 | u8 tcp_hdr_words:4; | 120 | u8 tcp_hdr_words:4; |
121 | #endif | 121 | #endif |
122 | u16 eth_type_mss; | 122 | __be16 eth_type_mss; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | struct cpl_rx_pkt { | 125 | struct cpl_rx_pkt { |
@@ -138,7 +138,7 @@ struct cpl_rx_pkt { | |||
138 | u8 iff:4; | 138 | u8 iff:4; |
139 | #endif | 139 | #endif |
140 | u16 csum; | 140 | u16 csum; |
141 | u16 vlan; | 141 | __be16 vlan; |
142 | u16 len; | 142 | u16 len; |
143 | }; | 143 | }; |
144 | 144 | ||
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 72f52dc98f53..12b719f4d00f 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -116,179 +116,179 @@ typedef struct { | |||
116 | /* The statistics block of Xena */ | 116 | /* The statistics block of Xena */ |
117 | typedef struct stat_block { | 117 | typedef struct stat_block { |
118 | /* Tx MAC statistics counters. */ | 118 | /* Tx MAC statistics counters. */ |
119 | u32 tmac_data_octets; | 119 | __le32 tmac_data_octets; |
120 | u32 tmac_frms; | 120 | __le32 tmac_frms; |
121 | u64 tmac_drop_frms; | 121 | __le64 tmac_drop_frms; |
122 | u32 tmac_bcst_frms; | 122 | __le32 tmac_bcst_frms; |
123 | u32 tmac_mcst_frms; | 123 | __le32 tmac_mcst_frms; |
124 | u64 tmac_pause_ctrl_frms; | 124 | __le64 tmac_pause_ctrl_frms; |
125 | u32 tmac_ucst_frms; | 125 | __le32 tmac_ucst_frms; |
126 | u32 tmac_ttl_octets; | 126 | __le32 tmac_ttl_octets; |
127 | u32 tmac_any_err_frms; | 127 | __le32 tmac_any_err_frms; |
128 | u32 tmac_nucst_frms; | 128 | __le32 tmac_nucst_frms; |
129 | u64 tmac_ttl_less_fb_octets; | 129 | __le64 tmac_ttl_less_fb_octets; |
130 | u64 tmac_vld_ip_octets; | 130 | __le64 tmac_vld_ip_octets; |
131 | u32 tmac_drop_ip; | 131 | __le32 tmac_drop_ip; |
132 | u32 tmac_vld_ip; | 132 | __le32 tmac_vld_ip; |
133 | u32 tmac_rst_tcp; | 133 | __le32 tmac_rst_tcp; |
134 | u32 tmac_icmp; | 134 | __le32 tmac_icmp; |
135 | u64 tmac_tcp; | 135 | __le64 tmac_tcp; |
136 | u32 reserved_0; | 136 | __le32 reserved_0; |
137 | u32 tmac_udp; | 137 | __le32 tmac_udp; |
138 | 138 | ||
139 | /* Rx MAC Statistics counters. */ | 139 | /* Rx MAC Statistics counters. */ |
140 | u32 rmac_data_octets; | 140 | __le32 rmac_data_octets; |
141 | u32 rmac_vld_frms; | 141 | __le32 rmac_vld_frms; |
142 | u64 rmac_fcs_err_frms; | 142 | __le64 rmac_fcs_err_frms; |
143 | u64 rmac_drop_frms; | 143 | __le64 rmac_drop_frms; |
144 | u32 rmac_vld_bcst_frms; | 144 | __le32 rmac_vld_bcst_frms; |
145 | u32 rmac_vld_mcst_frms; | 145 | __le32 rmac_vld_mcst_frms; |
146 | u32 rmac_out_rng_len_err_frms; | 146 | __le32 rmac_out_rng_len_err_frms; |
147 | u32 rmac_in_rng_len_err_frms; | 147 | __le32 rmac_in_rng_len_err_frms; |
148 | u64 rmac_long_frms; | 148 | __le64 rmac_long_frms; |
149 | u64 rmac_pause_ctrl_frms; | 149 | __le64 rmac_pause_ctrl_frms; |
150 | u64 rmac_unsup_ctrl_frms; | 150 | __le64 rmac_unsup_ctrl_frms; |
151 | u32 rmac_accepted_ucst_frms; | 151 | __le32 rmac_accepted_ucst_frms; |
152 | u32 rmac_ttl_octets; | 152 | __le32 rmac_ttl_octets; |
153 | u32 rmac_discarded_frms; | 153 | __le32 rmac_discarded_frms; |
154 | u32 rmac_accepted_nucst_frms; | 154 | __le32 rmac_accepted_nucst_frms; |
155 | u32 reserved_1; | 155 | __le32 reserved_1; |
156 | u32 rmac_drop_events; | 156 | __le32 rmac_drop_events; |
157 | u64 rmac_ttl_less_fb_octets; | 157 | __le64 rmac_ttl_less_fb_octets; |
158 | u64 rmac_ttl_frms; | 158 | __le64 rmac_ttl_frms; |
159 | u64 reserved_2; | 159 | __le64 reserved_2; |
160 | u32 rmac_usized_frms; | 160 | __le32 rmac_usized_frms; |
161 | u32 reserved_3; | 161 | __le32 reserved_3; |
162 | u32 rmac_frag_frms; | 162 | __le32 rmac_frag_frms; |
163 | u32 rmac_osized_frms; | 163 | __le32 rmac_osized_frms; |
164 | u32 reserved_4; | 164 | __le32 reserved_4; |
165 | u32 rmac_jabber_frms; | 165 | __le32 rmac_jabber_frms; |
166 | u64 rmac_ttl_64_frms; | 166 | __le64 rmac_ttl_64_frms; |
167 | u64 rmac_ttl_65_127_frms; | 167 | __le64 rmac_ttl_65_127_frms; |
168 | u64 reserved_5; | 168 | __le64 reserved_5; |
169 | u64 rmac_ttl_128_255_frms; | 169 | __le64 rmac_ttl_128_255_frms; |
170 | u64 rmac_ttl_256_511_frms; | 170 | __le64 rmac_ttl_256_511_frms; |
171 | u64 reserved_6; | 171 | __le64 reserved_6; |
172 | u64 rmac_ttl_512_1023_frms; | 172 | __le64 rmac_ttl_512_1023_frms; |
173 | u64 rmac_ttl_1024_1518_frms; | 173 | __le64 rmac_ttl_1024_1518_frms; |
174 | u32 rmac_ip; | 174 | __le32 rmac_ip; |
175 | u32 reserved_7; | 175 | __le32 reserved_7; |
176 | u64 rmac_ip_octets; | 176 | __le64 rmac_ip_octets; |
177 | u32 rmac_drop_ip; | 177 | __le32 rmac_drop_ip; |
178 | u32 rmac_hdr_err_ip; | 178 | __le32 rmac_hdr_err_ip; |
179 | u32 reserved_8; | 179 | __le32 reserved_8; |
180 | u32 rmac_icmp; | 180 | __le32 rmac_icmp; |
181 | u64 rmac_tcp; | 181 | __le64 rmac_tcp; |
182 | u32 rmac_err_drp_udp; | 182 | __le32 rmac_err_drp_udp; |
183 | u32 rmac_udp; | 183 | __le32 rmac_udp; |
184 | u64 rmac_xgmii_err_sym; | 184 | __le64 rmac_xgmii_err_sym; |
185 | u64 rmac_frms_q0; | 185 | __le64 rmac_frms_q0; |
186 | u64 rmac_frms_q1; | 186 | __le64 rmac_frms_q1; |
187 | u64 rmac_frms_q2; | 187 | __le64 rmac_frms_q2; |
188 | u64 rmac_frms_q3; | 188 | __le64 rmac_frms_q3; |
189 | u64 rmac_frms_q4; | 189 | __le64 rmac_frms_q4; |
190 | u64 rmac_frms_q5; | 190 | __le64 rmac_frms_q5; |
191 | u64 rmac_frms_q6; | 191 | __le64 rmac_frms_q6; |
192 | u64 rmac_frms_q7; | 192 | __le64 rmac_frms_q7; |
193 | u16 rmac_full_q3; | 193 | __le16 rmac_full_q3; |
194 | u16 rmac_full_q2; | 194 | __le16 rmac_full_q2; |
195 | u16 rmac_full_q1; | 195 | __le16 rmac_full_q1; |
196 | u16 rmac_full_q0; | 196 | __le16 rmac_full_q0; |
197 | u16 rmac_full_q7; | 197 | __le16 rmac_full_q7; |
198 | u16 rmac_full_q6; | 198 | __le16 rmac_full_q6; |
199 | u16 rmac_full_q5; | 199 | __le16 rmac_full_q5; |
200 | u16 rmac_full_q4; | 200 | __le16 rmac_full_q4; |
201 | u32 reserved_9; | 201 | __le32 reserved_9; |
202 | u32 rmac_pause_cnt; | 202 | __le32 rmac_pause_cnt; |
203 | u64 rmac_xgmii_data_err_cnt; | 203 | __le64 rmac_xgmii_data_err_cnt; |
204 | u64 rmac_xgmii_ctrl_err_cnt; | 204 | __le64 rmac_xgmii_ctrl_err_cnt; |
205 | u32 rmac_err_tcp; | 205 | __le32 rmac_err_tcp; |
206 | u32 rmac_accepted_ip; | 206 | __le32 rmac_accepted_ip; |
207 | 207 | ||
208 | /* PCI/PCI-X Read transaction statistics. */ | 208 | /* PCI/PCI-X Read transaction statistics. */ |
209 | u32 new_rd_req_cnt; | 209 | __le32 new_rd_req_cnt; |
210 | u32 rd_req_cnt; | 210 | __le32 rd_req_cnt; |
211 | u32 rd_rtry_cnt; | 211 | __le32 rd_rtry_cnt; |
212 | u32 new_rd_req_rtry_cnt; | 212 | __le32 new_rd_req_rtry_cnt; |
213 | 213 | ||
214 | /* PCI/PCI-X Write/Read transaction statistics. */ | 214 | /* PCI/PCI-X Write/Read transaction statistics. */ |
215 | u32 wr_req_cnt; | 215 | __le32 wr_req_cnt; |
216 | u32 wr_rtry_rd_ack_cnt; | 216 | __le32 wr_rtry_rd_ack_cnt; |
217 | u32 new_wr_req_rtry_cnt; | 217 | __le32 new_wr_req_rtry_cnt; |
218 | u32 new_wr_req_cnt; | 218 | __le32 new_wr_req_cnt; |
219 | u32 wr_disc_cnt; | 219 | __le32 wr_disc_cnt; |
220 | u32 wr_rtry_cnt; | 220 | __le32 wr_rtry_cnt; |
221 | 221 | ||
222 | /* PCI/PCI-X Write / DMA Transaction statistics. */ | 222 | /* PCI/PCI-X Write / DMA Transaction statistics. */ |
223 | u32 txp_wr_cnt; | 223 | __le32 txp_wr_cnt; |
224 | u32 rd_rtry_wr_ack_cnt; | 224 | __le32 rd_rtry_wr_ack_cnt; |
225 | u32 txd_wr_cnt; | 225 | __le32 txd_wr_cnt; |
226 | u32 txd_rd_cnt; | 226 | __le32 txd_rd_cnt; |
227 | u32 rxd_wr_cnt; | 227 | __le32 rxd_wr_cnt; |
228 | u32 rxd_rd_cnt; | 228 | __le32 rxd_rd_cnt; |
229 | u32 rxf_wr_cnt; | 229 | __le32 rxf_wr_cnt; |
230 | u32 txf_rd_cnt; | 230 | __le32 txf_rd_cnt; |
231 | 231 | ||
232 | /* Tx MAC statistics overflow counters. */ | 232 | /* Tx MAC statistics overflow counters. */ |
233 | u32 tmac_data_octets_oflow; | 233 | __le32 tmac_data_octets_oflow; |
234 | u32 tmac_frms_oflow; | 234 | __le32 tmac_frms_oflow; |
235 | u32 tmac_bcst_frms_oflow; | 235 | __le32 tmac_bcst_frms_oflow; |
236 | u32 tmac_mcst_frms_oflow; | 236 | __le32 tmac_mcst_frms_oflow; |
237 | u32 tmac_ucst_frms_oflow; | 237 | __le32 tmac_ucst_frms_oflow; |
238 | u32 tmac_ttl_octets_oflow; | 238 | __le32 tmac_ttl_octets_oflow; |
239 | u32 tmac_any_err_frms_oflow; | 239 | __le32 tmac_any_err_frms_oflow; |
240 | u32 tmac_nucst_frms_oflow; | 240 | __le32 tmac_nucst_frms_oflow; |
241 | u64 tmac_vlan_frms; | 241 | __le64 tmac_vlan_frms; |
242 | u32 tmac_drop_ip_oflow; | 242 | __le32 tmac_drop_ip_oflow; |
243 | u32 tmac_vld_ip_oflow; | 243 | __le32 tmac_vld_ip_oflow; |
244 | u32 tmac_rst_tcp_oflow; | 244 | __le32 tmac_rst_tcp_oflow; |
245 | u32 tmac_icmp_oflow; | 245 | __le32 tmac_icmp_oflow; |
246 | u32 tpa_unknown_protocol; | 246 | __le32 tpa_unknown_protocol; |
247 | u32 tmac_udp_oflow; | 247 | __le32 tmac_udp_oflow; |
248 | u32 reserved_10; | 248 | __le32 reserved_10; |
249 | u32 tpa_parse_failure; | 249 | __le32 tpa_parse_failure; |
250 | 250 | ||
251 | /* Rx MAC Statistics overflow counters. */ | 251 | /* Rx MAC Statistics overflow counters. */ |
252 | u32 rmac_data_octets_oflow; | 252 | __le32 rmac_data_octets_oflow; |
253 | u32 rmac_vld_frms_oflow; | 253 | __le32 rmac_vld_frms_oflow; |
254 | u32 rmac_vld_bcst_frms_oflow; | 254 | __le32 rmac_vld_bcst_frms_oflow; |
255 | u32 rmac_vld_mcst_frms_oflow; | 255 | __le32 rmac_vld_mcst_frms_oflow; |
256 | u32 rmac_accepted_ucst_frms_oflow; | 256 | __le32 rmac_accepted_ucst_frms_oflow; |
257 | u32 rmac_ttl_octets_oflow; | 257 | __le32 rmac_ttl_octets_oflow; |
258 | u32 rmac_discarded_frms_oflow; | 258 | __le32 rmac_discarded_frms_oflow; |
259 | u32 rmac_accepted_nucst_frms_oflow; | 259 | __le32 rmac_accepted_nucst_frms_oflow; |
260 | u32 rmac_usized_frms_oflow; | 260 | __le32 rmac_usized_frms_oflow; |
261 | u32 rmac_drop_events_oflow; | 261 | __le32 rmac_drop_events_oflow; |
262 | u32 rmac_frag_frms_oflow; | 262 | __le32 rmac_frag_frms_oflow; |
263 | u32 rmac_osized_frms_oflow; | 263 | __le32 rmac_osized_frms_oflow; |
264 | u32 rmac_ip_oflow; | 264 | __le32 rmac_ip_oflow; |
265 | u32 rmac_jabber_frms_oflow; | 265 | __le32 rmac_jabber_frms_oflow; |
266 | u32 rmac_icmp_oflow; | 266 | __le32 rmac_icmp_oflow; |
267 | u32 rmac_drop_ip_oflow; | 267 | __le32 rmac_drop_ip_oflow; |
268 | u32 rmac_err_drp_udp_oflow; | 268 | __le32 rmac_err_drp_udp_oflow; |
269 | u32 rmac_udp_oflow; | 269 | __le32 rmac_udp_oflow; |
270 | u32 reserved_11; | 270 | __le32 reserved_11; |
271 | u32 rmac_pause_cnt_oflow; | 271 | __le32 rmac_pause_cnt_oflow; |
272 | u64 rmac_ttl_1519_4095_frms; | 272 | __le64 rmac_ttl_1519_4095_frms; |
273 | u64 rmac_ttl_4096_8191_frms; | 273 | __le64 rmac_ttl_4096_8191_frms; |
274 | u64 rmac_ttl_8192_max_frms; | 274 | __le64 rmac_ttl_8192_max_frms; |
275 | u64 rmac_ttl_gt_max_frms; | 275 | __le64 rmac_ttl_gt_max_frms; |
276 | u64 rmac_osized_alt_frms; | 276 | __le64 rmac_osized_alt_frms; |
277 | u64 rmac_jabber_alt_frms; | 277 | __le64 rmac_jabber_alt_frms; |
278 | u64 rmac_gt_max_alt_frms; | 278 | __le64 rmac_gt_max_alt_frms; |
279 | u64 rmac_vlan_frms; | 279 | __le64 rmac_vlan_frms; |
280 | u32 rmac_len_discard; | 280 | __le32 rmac_len_discard; |
281 | u32 rmac_fcs_discard; | 281 | __le32 rmac_fcs_discard; |
282 | u32 rmac_pf_discard; | 282 | __le32 rmac_pf_discard; |
283 | u32 rmac_da_discard; | 283 | __le32 rmac_da_discard; |
284 | u32 rmac_red_discard; | 284 | __le32 rmac_red_discard; |
285 | u32 rmac_rts_discard; | 285 | __le32 rmac_rts_discard; |
286 | u32 reserved_12; | 286 | __le32 reserved_12; |
287 | u32 rmac_ingm_full_discard; | 287 | __le32 rmac_ingm_full_discard; |
288 | u32 reserved_13; | 288 | __le32 reserved_13; |
289 | u32 rmac_accepted_ip_oflow; | 289 | __le32 rmac_accepted_ip_oflow; |
290 | u32 reserved_14; | 290 | __le32 reserved_14; |
291 | u32 link_fault_cnt; | 291 | __le32 link_fault_cnt; |
292 | u8 buffer[20]; | 292 | u8 buffer[20]; |
293 | swStat_t sw_stat; | 293 | swStat_t sw_stat; |
294 | xpakStat_t xpak_stat; | 294 | xpakStat_t xpak_stat; |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 862a411a4aa0..c88babce9bca 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -1987,7 +1987,7 @@ zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *erp_action) | |||
1987 | sbale = &(adapter->response_queue.buffer[i]->element[0]); | 1987 | sbale = &(adapter->response_queue.buffer[i]->element[0]); |
1988 | sbale->length = 0; | 1988 | sbale->length = 0; |
1989 | sbale->flags = SBAL_FLAGS_LAST_ENTRY; | 1989 | sbale->flags = SBAL_FLAGS_LAST_ENTRY; |
1990 | sbale->addr = 0; | 1990 | sbale->addr = NULL; |
1991 | } | 1991 | } |
1992 | 1992 | ||
1993 | ZFCP_LOG_TRACE("calling do_QDIO on adapter %s (flags=0x%x, " | 1993 | ZFCP_LOG_TRACE("calling do_QDIO on adapter %s (flags=0x%x, " |
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 2f698763ba5d..81ba2d71cee2 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c | |||
@@ -630,7 +630,7 @@ static int openprom_ioctl(struct inode * inode, struct file * file, | |||
630 | case OPROMPATH2NODE: | 630 | case OPROMPATH2NODE: |
631 | if ((file->f_mode & FMODE_READ) == 0) | 631 | if ((file->f_mode & FMODE_READ) == 0) |
632 | return -EPERM; | 632 | return -EPERM; |
633 | return openprom_sunos_ioctl(inode, file, cmd, arg, 0); | 633 | return openprom_sunos_ioctl(inode, file, cmd, arg, NULL); |
634 | 634 | ||
635 | case OPIOCGET: | 635 | case OPIOCGET: |
636 | case OPIOCNEXTPROP: | 636 | case OPIOCNEXTPROP: |
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c index ddc0681ac759..b30372f17f1c 100644 --- a/drivers/sbus/char/uctrl.c +++ b/drivers/sbus/char/uctrl.c | |||
@@ -400,7 +400,7 @@ static int __init ts102_uctrl_init(void) | |||
400 | } | 400 | } |
401 | 401 | ||
402 | driver->regs->uctrl_intr = UCTRL_INTR_RXNE_REQ|UCTRL_INTR_RXNE_MSK; | 402 | driver->regs->uctrl_intr = UCTRL_INTR_RXNE_REQ|UCTRL_INTR_RXNE_MSK; |
403 | printk("uctrl: 0x%x (irq %d)\n", driver->regs, driver->irq); | 403 | printk("uctrl: 0x%p (irq %d)\n", driver->regs, driver->irq); |
404 | uctrl_get_event_status(); | 404 | uctrl_get_event_status(); |
405 | uctrl_get_external_status(); | 405 | uctrl_get_external_status(); |
406 | return 0; | 406 | return 0; |
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 83695416b2c9..2b344356a29e 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -3881,7 +3881,7 @@ typedef struct asc_board { | |||
3881 | /* | 3881 | /* |
3882 | * The following fields are used only for Wide Boards. | 3882 | * The following fields are used only for Wide Boards. |
3883 | */ | 3883 | */ |
3884 | void *ioremap_addr; /* I/O Memory remap address. */ | 3884 | void __iomem *ioremap_addr; /* I/O Memory remap address. */ |
3885 | ushort ioport; /* I/O Port address. */ | 3885 | ushort ioport; /* I/O Port address. */ |
3886 | ADV_CARR_T *orig_carrp; /* ADV_CARR_T memory block. */ | 3886 | ADV_CARR_T *orig_carrp; /* ADV_CARR_T memory block. */ |
3887 | adv_req_t *orig_reqp; /* adv_req_t memory block. */ | 3887 | adv_req_t *orig_reqp; /* adv_req_t memory block. */ |
@@ -3951,7 +3951,7 @@ typedef struct _PCI_CONFIG_SPACE_ | |||
3951 | 3951 | ||
3952 | /* Number of boards detected in system. */ | 3952 | /* Number of boards detected in system. */ |
3953 | STATIC int asc_board_count = 0; | 3953 | STATIC int asc_board_count = 0; |
3954 | STATIC struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { 0 }; | 3954 | STATIC struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { NULL }; |
3955 | 3955 | ||
3956 | /* Overrun buffer used by all narrow boards. */ | 3956 | /* Overrun buffer used by all narrow boards. */ |
3957 | STATIC uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; | 3957 | STATIC uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; |
@@ -6621,7 +6621,7 @@ adv_build_req(asc_board_t *boardp, struct scsi_cmnd *scp, | |||
6621 | dma_map_single(dev, scp->request_buffer, | 6621 | dma_map_single(dev, scp->request_buffer, |
6622 | scp->request_bufflen, scp->sc_data_direction); | 6622 | scp->request_bufflen, scp->sc_data_direction); |
6623 | } else { | 6623 | } else { |
6624 | scsiqp->vdata_addr = 0; | 6624 | scsiqp->vdata_addr = NULL; |
6625 | scp->SCp.dma_handle = 0; | 6625 | scp->SCp.dma_handle = 0; |
6626 | } | 6626 | } |
6627 | scsiqp->data_addr = cpu_to_le32(scp->SCp.dma_handle); | 6627 | scsiqp->data_addr = cpu_to_le32(scp->SCp.dma_handle); |
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 23f5e418ab55..e95b367d09ed 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c | |||
@@ -1219,7 +1219,7 @@ static void dump_register_info(struct AdapterCtlBlk *acb, | |||
1219 | srb, srb->cmd, srb->cmd->pid, | 1219 | srb, srb->cmd, srb->cmd->pid, |
1220 | srb->cmd->cmnd[0], srb->cmd->device->id, | 1220 | srb->cmd->cmnd[0], srb->cmd->device->id, |
1221 | srb->cmd->device->lun); | 1221 | srb->cmd->device->lun); |
1222 | printk(" sglist=%p cnt=%i idx=%i len=%Zd\n", | 1222 | printk(" sglist=%p cnt=%i idx=%i len=%zu\n", |
1223 | srb->segment_x, srb->sg_count, srb->sg_index, | 1223 | srb->segment_x, srb->sg_count, srb->sg_index, |
1224 | srb->total_xfer_length); | 1224 | srb->total_xfer_length); |
1225 | printk(" state=0x%04x status=0x%02x phase=0x%02x (%sconn.)\n", | 1225 | printk(" state=0x%04x status=0x%02x phase=0x%02x (%sconn.)\n", |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 3d355d054612..aff1b0cfd4b2 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -495,7 +495,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, | |||
495 | memcpy(scmd->cmnd, cmnd, cmnd_size); | 495 | memcpy(scmd->cmnd, cmnd, cmnd_size); |
496 | 496 | ||
497 | if (copy_sense) { | 497 | if (copy_sense) { |
498 | int gfp_mask = GFP_ATOMIC; | 498 | gfp_t gfp_mask = GFP_ATOMIC; |
499 | 499 | ||
500 | if (shost->hostt->unchecked_isa_dma) | 500 | if (shost->hostt->unchecked_isa_dma) |
501 | gfp_mask |= __GFP_DMA; | 501 | gfp_mask |= __GFP_DMA; |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index b11f6dea2704..73dd2eedaaad 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -1057,7 +1057,7 @@ static void sunzilog_free_tables(void) | |||
1057 | 1057 | ||
1058 | static void sunzilog_putchar(struct uart_port *port, int ch) | 1058 | static void sunzilog_putchar(struct uart_port *port, int ch) |
1059 | { | 1059 | { |
1060 | struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port); | 1060 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); |
1061 | int loops = ZS_PUT_CHAR_MAX_DELAY; | 1061 | int loops = ZS_PUT_CHAR_MAX_DELAY; |
1062 | 1062 | ||
1063 | /* This is a timed polling loop so do not switch the explicit | 1063 | /* This is a timed polling loop so do not switch the explicit |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 2c9c9462d899..724822cac2b1 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -1216,7 +1216,7 @@ static int proc_submiturb_compat(struct dev_state *ps, void __user *arg) | |||
1216 | { | 1216 | { |
1217 | struct usbdevfs_urb uurb; | 1217 | struct usbdevfs_urb uurb; |
1218 | 1218 | ||
1219 | if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg)) | 1219 | if (get_urb32(&uurb,(struct usbdevfs_urb32 __user *)arg)) |
1220 | return -EFAULT; | 1220 | return -EFAULT; |
1221 | 1221 | ||
1222 | return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, arg); | 1222 | return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, arg); |
@@ -1251,7 +1251,7 @@ static int processcompl_compat(struct async *as, void __user * __user *arg) | |||
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | free_async(as); | 1253 | free_async(as); |
1254 | if (put_user((u32)(u64)addr, (u32 __user *)arg)) | 1254 | if (put_user(ptr_to_compat(addr), (u32 __user *)arg)) |
1255 | return -EFAULT; | 1255 | return -EFAULT; |
1256 | return 0; | 1256 | return 0; |
1257 | } | 1257 | } |
@@ -1520,7 +1520,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
1520 | 1520 | ||
1521 | case USBDEVFS_IOCTL32: | 1521 | case USBDEVFS_IOCTL32: |
1522 | snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); | 1522 | snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); |
1523 | ret = proc_ioctl_compat(ps, (compat_uptr_t)(long)p); | 1523 | ret = proc_ioctl_compat(ps, ptr_to_compat(p)); |
1524 | break; | 1524 | break; |
1525 | #endif | 1525 | #endif |
1526 | 1526 | ||
diff --git a/fs/befs/befs.h b/fs/befs/befs.h index 057a2c3d73b7..d9a40abda6b7 100644 --- a/fs/befs/befs.h +++ b/fs/befs/befs.h | |||
@@ -94,7 +94,7 @@ void befs_debug(const struct super_block *sb, const char *fmt, ...); | |||
94 | 94 | ||
95 | void befs_dump_super_block(const struct super_block *sb, befs_super_block *); | 95 | void befs_dump_super_block(const struct super_block *sb, befs_super_block *); |
96 | void befs_dump_inode(const struct super_block *sb, befs_inode *); | 96 | void befs_dump_inode(const struct super_block *sb, befs_inode *); |
97 | void befs_dump_index_entry(const struct super_block *sb, befs_btree_super *); | 97 | void befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super *); |
98 | void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *); | 98 | void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *); |
99 | /****************************/ | 99 | /****************************/ |
100 | 100 | ||
@@ -136,7 +136,7 @@ blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno) | |||
136 | static inline unsigned int | 136 | static inline unsigned int |
137 | befs_iaddrs_per_block(struct super_block *sb) | 137 | befs_iaddrs_per_block(struct super_block *sb) |
138 | { | 138 | { |
139 | return BEFS_SB(sb)->block_size / sizeof (befs_inode_addr); | 139 | return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr); |
140 | } | 140 | } |
141 | 141 | ||
142 | static inline int | 142 | static inline int |
@@ -151,4 +151,6 @@ befs_brun_size(struct super_block *sb, befs_block_run run) | |||
151 | return BEFS_SB(sb)->block_size * run.len; | 151 | return BEFS_SB(sb)->block_size * run.len; |
152 | } | 152 | } |
153 | 153 | ||
154 | #include "endian.h" | ||
155 | |||
154 | #endif /* _LINUX_BEFS_H */ | 156 | #endif /* _LINUX_BEFS_H */ |
diff --git a/fs/befs/befs_fs_types.h b/fs/befs/befs_fs_types.h index 63ef1e18fb84..e2595c2c403a 100644 --- a/fs/befs/befs_fs_types.h +++ b/fs/befs/befs_fs_types.h | |||
@@ -79,17 +79,27 @@ enum inode_flags { | |||
79 | * On-Disk datastructures of BeFS | 79 | * On-Disk datastructures of BeFS |
80 | */ | 80 | */ |
81 | 81 | ||
82 | typedef u64 __bitwise fs64; | ||
83 | typedef u32 __bitwise fs32; | ||
84 | typedef u16 __bitwise fs16; | ||
85 | |||
82 | typedef u64 befs_off_t; | 86 | typedef u64 befs_off_t; |
83 | typedef u64 befs_time_t; | 87 | typedef fs64 befs_time_t; |
84 | typedef void befs_binode_etc; | ||
85 | 88 | ||
86 | /* Block runs */ | 89 | /* Block runs */ |
87 | typedef struct { | 90 | typedef struct { |
91 | fs32 allocation_group; | ||
92 | fs16 start; | ||
93 | fs16 len; | ||
94 | } PACKED befs_disk_block_run; | ||
95 | |||
96 | typedef struct { | ||
88 | u32 allocation_group; | 97 | u32 allocation_group; |
89 | u16 start; | 98 | u16 start; |
90 | u16 len; | 99 | u16 len; |
91 | } PACKED befs_block_run; | 100 | } PACKED befs_block_run; |
92 | 101 | ||
102 | typedef befs_disk_block_run befs_disk_inode_addr; | ||
93 | typedef befs_block_run befs_inode_addr; | 103 | typedef befs_block_run befs_inode_addr; |
94 | 104 | ||
95 | /* | 105 | /* |
@@ -97,31 +107,31 @@ typedef befs_block_run befs_inode_addr; | |||
97 | */ | 107 | */ |
98 | typedef struct { | 108 | typedef struct { |
99 | char name[B_OS_NAME_LENGTH]; | 109 | char name[B_OS_NAME_LENGTH]; |
100 | u32 magic1; | 110 | fs32 magic1; |
101 | u32 fs_byte_order; | 111 | fs32 fs_byte_order; |
102 | 112 | ||
103 | u32 block_size; | 113 | fs32 block_size; |
104 | u32 block_shift; | 114 | fs32 block_shift; |
105 | 115 | ||
106 | befs_off_t num_blocks; | 116 | fs64 num_blocks; |
107 | befs_off_t used_blocks; | 117 | fs64 used_blocks; |
108 | 118 | ||
109 | u32 inode_size; | 119 | fs32 inode_size; |
110 | 120 | ||
111 | u32 magic2; | 121 | fs32 magic2; |
112 | u32 blocks_per_ag; | 122 | fs32 blocks_per_ag; |
113 | u32 ag_shift; | 123 | fs32 ag_shift; |
114 | u32 num_ags; | 124 | fs32 num_ags; |
115 | 125 | ||
116 | u32 flags; | 126 | fs32 flags; |
117 | 127 | ||
118 | befs_block_run log_blocks; | 128 | befs_disk_block_run log_blocks; |
119 | befs_off_t log_start; | 129 | fs64 log_start; |
120 | befs_off_t log_end; | 130 | fs64 log_end; |
121 | 131 | ||
122 | u32 magic3; | 132 | fs32 magic3; |
123 | befs_inode_addr root_dir; | 133 | befs_disk_inode_addr root_dir; |
124 | befs_inode_addr indices; | 134 | befs_disk_inode_addr indices; |
125 | 135 | ||
126 | } PACKED befs_super_block; | 136 | } PACKED befs_super_block; |
127 | 137 | ||
@@ -130,6 +140,16 @@ typedef struct { | |||
130 | * be longer than one block! | 140 | * be longer than one block! |
131 | */ | 141 | */ |
132 | typedef struct { | 142 | typedef struct { |
143 | befs_disk_block_run direct[BEFS_NUM_DIRECT_BLOCKS]; | ||
144 | fs64 max_direct_range; | ||
145 | befs_disk_block_run indirect; | ||
146 | fs64 max_indirect_range; | ||
147 | befs_disk_block_run double_indirect; | ||
148 | fs64 max_double_indirect_range; | ||
149 | fs64 size; | ||
150 | } PACKED befs_disk_data_stream; | ||
151 | |||
152 | typedef struct { | ||
133 | befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS]; | 153 | befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS]; |
134 | befs_off_t max_direct_range; | 154 | befs_off_t max_direct_range; |
135 | befs_block_run indirect; | 155 | befs_block_run indirect; |
@@ -141,35 +161,35 @@ typedef struct { | |||
141 | 161 | ||
142 | /* Attribute */ | 162 | /* Attribute */ |
143 | typedef struct { | 163 | typedef struct { |
144 | u32 type; | 164 | fs32 type; |
145 | u16 name_size; | 165 | fs16 name_size; |
146 | u16 data_size; | 166 | fs16 data_size; |
147 | char name[1]; | 167 | char name[1]; |
148 | } PACKED befs_small_data; | 168 | } PACKED befs_small_data; |
149 | 169 | ||
150 | /* Inode structure */ | 170 | /* Inode structure */ |
151 | typedef struct { | 171 | typedef struct { |
152 | u32 magic1; | 172 | fs32 magic1; |
153 | befs_inode_addr inode_num; | 173 | befs_disk_inode_addr inode_num; |
154 | u32 uid; | 174 | fs32 uid; |
155 | u32 gid; | 175 | fs32 gid; |
156 | u32 mode; | 176 | fs32 mode; |
157 | u32 flags; | 177 | fs32 flags; |
158 | befs_time_t create_time; | 178 | befs_time_t create_time; |
159 | befs_time_t last_modified_time; | 179 | befs_time_t last_modified_time; |
160 | befs_inode_addr parent; | 180 | befs_disk_inode_addr parent; |
161 | befs_inode_addr attributes; | 181 | befs_disk_inode_addr attributes; |
162 | u32 type; | 182 | fs32 type; |
163 | 183 | ||
164 | u32 inode_size; | 184 | fs32 inode_size; |
165 | u32 etc; /* not use */ | 185 | fs32 etc; /* not use */ |
166 | 186 | ||
167 | union { | 187 | union { |
168 | befs_data_stream datastream; | 188 | befs_disk_data_stream datastream; |
169 | char symlink[BEFS_SYMLINK_LEN]; | 189 | char symlink[BEFS_SYMLINK_LEN]; |
170 | } data; | 190 | } data; |
171 | 191 | ||
172 | u32 pad[4]; /* not use */ | 192 | fs32 pad[4]; /* not use */ |
173 | befs_small_data small_data[1]; | 193 | befs_small_data small_data[1]; |
174 | } PACKED befs_inode; | 194 | } PACKED befs_inode; |
175 | 195 | ||
@@ -190,6 +210,16 @@ enum btree_types { | |||
190 | }; | 210 | }; |
191 | 211 | ||
192 | typedef struct { | 212 | typedef struct { |
213 | fs32 magic; | ||
214 | fs32 node_size; | ||
215 | fs32 max_depth; | ||
216 | fs32 data_type; | ||
217 | fs64 root_node_ptr; | ||
218 | fs64 free_node_ptr; | ||
219 | fs64 max_size; | ||
220 | } PACKED befs_disk_btree_super; | ||
221 | |||
222 | typedef struct { | ||
193 | u32 magic; | 223 | u32 magic; |
194 | u32 node_size; | 224 | u32 node_size; |
195 | u32 max_depth; | 225 | u32 max_depth; |
@@ -203,11 +233,19 @@ typedef struct { | |||
203 | * Header stucture of each btree node | 233 | * Header stucture of each btree node |
204 | */ | 234 | */ |
205 | typedef struct { | 235 | typedef struct { |
236 | fs64 left; | ||
237 | fs64 right; | ||
238 | fs64 overflow; | ||
239 | fs16 all_key_count; | ||
240 | fs16 all_key_length; | ||
241 | } PACKED befs_btree_nodehead; | ||
242 | |||
243 | typedef struct { | ||
206 | befs_off_t left; | 244 | befs_off_t left; |
207 | befs_off_t right; | 245 | befs_off_t right; |
208 | befs_off_t overflow; | 246 | befs_off_t overflow; |
209 | u16 all_key_count; | 247 | u16 all_key_count; |
210 | u16 all_key_length; | 248 | u16 all_key_length; |
211 | } PACKED befs_btree_nodehead; | 249 | } PACKED befs_host_btree_nodehead; |
212 | 250 | ||
213 | #endif /* _LINUX_BEFS_FS_TYPES */ | 251 | #endif /* _LINUX_BEFS_FS_TYPES */ |
diff --git a/fs/befs/btree.c b/fs/befs/btree.c index 76e219799409..81b042ee24e6 100644 --- a/fs/befs/btree.c +++ b/fs/befs/btree.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include "befs.h" | 30 | #include "befs.h" |
31 | #include "btree.h" | 31 | #include "btree.h" |
32 | #include "datastream.h" | 32 | #include "datastream.h" |
33 | #include "endian.h" | ||
34 | 33 | ||
35 | /* | 34 | /* |
36 | * The btree functions in this file are built on top of the | 35 | * The btree functions in this file are built on top of the |
@@ -80,7 +79,7 @@ | |||
80 | * In memory structure of each btree node | 79 | * In memory structure of each btree node |
81 | */ | 80 | */ |
82 | typedef struct { | 81 | typedef struct { |
83 | befs_btree_nodehead head; /* head of node converted to cpu byteorder */ | 82 | befs_host_btree_nodehead head; /* head of node converted to cpu byteorder */ |
84 | struct buffer_head *bh; | 83 | struct buffer_head *bh; |
85 | befs_btree_nodehead *od_node; /* on disk node */ | 84 | befs_btree_nodehead *od_node; /* on disk node */ |
86 | } befs_btree_node; | 85 | } befs_btree_node; |
@@ -102,9 +101,9 @@ static int befs_bt_read_node(struct super_block *sb, befs_data_stream * ds, | |||
102 | 101 | ||
103 | static int befs_leafnode(befs_btree_node * node); | 102 | static int befs_leafnode(befs_btree_node * node); |
104 | 103 | ||
105 | static u16 *befs_bt_keylen_index(befs_btree_node * node); | 104 | static fs16 *befs_bt_keylen_index(befs_btree_node * node); |
106 | 105 | ||
107 | static befs_off_t *befs_bt_valarray(befs_btree_node * node); | 106 | static fs64 *befs_bt_valarray(befs_btree_node * node); |
108 | 107 | ||
109 | static char *befs_bt_keydata(befs_btree_node * node); | 108 | static char *befs_bt_keydata(befs_btree_node * node); |
110 | 109 | ||
@@ -136,7 +135,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, | |||
136 | befs_btree_super * sup) | 135 | befs_btree_super * sup) |
137 | { | 136 | { |
138 | struct buffer_head *bh = NULL; | 137 | struct buffer_head *bh = NULL; |
139 | befs_btree_super *od_sup = NULL; | 138 | befs_disk_btree_super *od_sup = NULL; |
140 | 139 | ||
141 | befs_debug(sb, "---> befs_btree_read_super()"); | 140 | befs_debug(sb, "---> befs_btree_read_super()"); |
142 | 141 | ||
@@ -146,7 +145,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, | |||
146 | befs_error(sb, "Couldn't read index header."); | 145 | befs_error(sb, "Couldn't read index header."); |
147 | goto error; | 146 | goto error; |
148 | } | 147 | } |
149 | od_sup = (befs_btree_super *) bh->b_data; | 148 | od_sup = (befs_disk_btree_super *) bh->b_data; |
150 | befs_dump_index_entry(sb, od_sup); | 149 | befs_dump_index_entry(sb, od_sup); |
151 | 150 | ||
152 | sup->magic = fs32_to_cpu(sb, od_sup->magic); | 151 | sup->magic = fs32_to_cpu(sb, od_sup->magic); |
@@ -342,7 +341,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node, | |||
342 | u16 keylen; | 341 | u16 keylen; |
343 | int findkey_len; | 342 | int findkey_len; |
344 | char *thiskey; | 343 | char *thiskey; |
345 | befs_off_t *valarray; | 344 | fs64 *valarray; |
346 | 345 | ||
347 | befs_debug(sb, "---> befs_find_key() %s", findkey); | 346 | befs_debug(sb, "---> befs_find_key() %s", findkey); |
348 | 347 | ||
@@ -422,7 +421,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, | |||
422 | befs_btree_super bt_super; | 421 | befs_btree_super bt_super; |
423 | befs_off_t node_off = 0; | 422 | befs_off_t node_off = 0; |
424 | int cur_key; | 423 | int cur_key; |
425 | befs_off_t *valarray; | 424 | fs64 *valarray; |
426 | char *keystart; | 425 | char *keystart; |
427 | u16 keylen; | 426 | u16 keylen; |
428 | int res; | 427 | int res; |
@@ -572,7 +571,7 @@ befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds, | |||
572 | this_node->head.overflow); | 571 | this_node->head.overflow); |
573 | *node_off = this_node->head.overflow; | 572 | *node_off = this_node->head.overflow; |
574 | } else { | 573 | } else { |
575 | befs_off_t *valarray = befs_bt_valarray(this_node); | 574 | fs64 *valarray = befs_bt_valarray(this_node); |
576 | *node_off = fs64_to_cpu(sb, valarray[0]); | 575 | *node_off = fs64_to_cpu(sb, valarray[0]); |
577 | } | 576 | } |
578 | if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) { | 577 | if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) { |
@@ -622,7 +621,7 @@ befs_leafnode(befs_btree_node * node) | |||
622 | * | 621 | * |
623 | * Except that rounding up to 8 works, and rounding up to 4 doesn't. | 622 | * Except that rounding up to 8 works, and rounding up to 4 doesn't. |
624 | */ | 623 | */ |
625 | static u16 * | 624 | static fs16 * |
626 | befs_bt_keylen_index(befs_btree_node * node) | 625 | befs_bt_keylen_index(befs_btree_node * node) |
627 | { | 626 | { |
628 | const int keylen_align = 8; | 627 | const int keylen_align = 8; |
@@ -633,7 +632,7 @@ befs_bt_keylen_index(befs_btree_node * node) | |||
633 | if (tmp) | 632 | if (tmp) |
634 | off += keylen_align - tmp; | 633 | off += keylen_align - tmp; |
635 | 634 | ||
636 | return (u16 *) ((void *) node->od_node + off); | 635 | return (fs16 *) ((void *) node->od_node + off); |
637 | } | 636 | } |
638 | 637 | ||
639 | /** | 638 | /** |
@@ -643,13 +642,13 @@ befs_bt_keylen_index(befs_btree_node * node) | |||
643 | * Returns a pointer to the start of the value array | 642 | * Returns a pointer to the start of the value array |
644 | * of the node pointed to by the node header | 643 | * of the node pointed to by the node header |
645 | */ | 644 | */ |
646 | static befs_off_t * | 645 | static fs64 * |
647 | befs_bt_valarray(befs_btree_node * node) | 646 | befs_bt_valarray(befs_btree_node * node) |
648 | { | 647 | { |
649 | void *keylen_index_start = (void *) befs_bt_keylen_index(node); | 648 | void *keylen_index_start = (void *) befs_bt_keylen_index(node); |
650 | size_t keylen_index_size = node->head.all_key_count * sizeof (u16); | 649 | size_t keylen_index_size = node->head.all_key_count * sizeof (fs16); |
651 | 650 | ||
652 | return (befs_off_t *) (keylen_index_start + keylen_index_size); | 651 | return (fs64 *) (keylen_index_start + keylen_index_size); |
653 | } | 652 | } |
654 | 653 | ||
655 | /** | 654 | /** |
@@ -681,7 +680,7 @@ befs_bt_get_key(struct super_block *sb, befs_btree_node * node, | |||
681 | { | 680 | { |
682 | int prev_key_end; | 681 | int prev_key_end; |
683 | char *keystart; | 682 | char *keystart; |
684 | u16 *keylen_index; | 683 | fs16 *keylen_index; |
685 | 684 | ||
686 | if (index < 0 || index > node->head.all_key_count) { | 685 | if (index < 0 || index > node->head.all_key_count) { |
687 | *keylen = 0; | 686 | *keylen = 0; |
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index b7d6b920f65f..aacb4da6298a 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include "befs.h" | 18 | #include "befs.h" |
19 | #include "datastream.h" | 19 | #include "datastream.h" |
20 | #include "io.h" | 20 | #include "io.h" |
21 | #include "endian.h" | ||
22 | 21 | ||
23 | const befs_inode_addr BAD_IADDR = { 0, 0, 0 }; | 22 | const befs_inode_addr BAD_IADDR = { 0, 0, 0 }; |
24 | 23 | ||
@@ -312,7 +311,7 @@ befs_find_brun_indirect(struct super_block *sb, | |||
312 | befs_blocknr_t indir_start_blk; | 311 | befs_blocknr_t indir_start_blk; |
313 | befs_blocknr_t search_blk; | 312 | befs_blocknr_t search_blk; |
314 | struct buffer_head *indirblock; | 313 | struct buffer_head *indirblock; |
315 | befs_block_run *array; | 314 | befs_disk_block_run *array; |
316 | 315 | ||
317 | befs_block_run indirect = data->indirect; | 316 | befs_block_run indirect = data->indirect; |
318 | befs_blocknr_t indirblockno = iaddr2blockno(sb, &indirect); | 317 | befs_blocknr_t indirblockno = iaddr2blockno(sb, &indirect); |
@@ -334,7 +333,7 @@ befs_find_brun_indirect(struct super_block *sb, | |||
334 | return BEFS_ERR; | 333 | return BEFS_ERR; |
335 | } | 334 | } |
336 | 335 | ||
337 | array = (befs_block_run *) indirblock->b_data; | 336 | array = (befs_disk_block_run *) indirblock->b_data; |
338 | 337 | ||
339 | for (j = 0; j < arraylen; ++j) { | 338 | for (j = 0; j < arraylen; ++j) { |
340 | int len = fs16_to_cpu(sb, array[j].len); | 339 | int len = fs16_to_cpu(sb, array[j].len); |
@@ -427,7 +426,7 @@ befs_find_brun_dblindirect(struct super_block *sb, | |||
427 | struct buffer_head *dbl_indir_block; | 426 | struct buffer_head *dbl_indir_block; |
428 | struct buffer_head *indir_block; | 427 | struct buffer_head *indir_block; |
429 | befs_block_run indir_run; | 428 | befs_block_run indir_run; |
430 | befs_inode_addr *iaddr_array = NULL; | 429 | befs_disk_inode_addr *iaddr_array = NULL; |
431 | befs_sb_info *befs_sb = BEFS_SB(sb); | 430 | befs_sb_info *befs_sb = BEFS_SB(sb); |
432 | 431 | ||
433 | befs_blocknr_t indir_start_blk = | 432 | befs_blocknr_t indir_start_blk = |
@@ -482,7 +481,7 @@ befs_find_brun_dblindirect(struct super_block *sb, | |||
482 | 481 | ||
483 | dbl_block_indx = | 482 | dbl_block_indx = |
484 | dblindir_indx - (dbl_which_block * befs_iaddrs_per_block(sb)); | 483 | dblindir_indx - (dbl_which_block * befs_iaddrs_per_block(sb)); |
485 | iaddr_array = (befs_inode_addr *) dbl_indir_block->b_data; | 484 | iaddr_array = (befs_disk_inode_addr *) dbl_indir_block->b_data; |
486 | indir_run = fsrun_to_cpu(sb, iaddr_array[dbl_block_indx]); | 485 | indir_run = fsrun_to_cpu(sb, iaddr_array[dbl_block_indx]); |
487 | brelse(dbl_indir_block); | 486 | brelse(dbl_indir_block); |
488 | iaddr_array = NULL; | 487 | iaddr_array = NULL; |
@@ -507,7 +506,7 @@ befs_find_brun_dblindirect(struct super_block *sb, | |||
507 | } | 506 | } |
508 | 507 | ||
509 | block_indx = indir_indx - (which_block * befs_iaddrs_per_block(sb)); | 508 | block_indx = indir_indx - (which_block * befs_iaddrs_per_block(sb)); |
510 | iaddr_array = (befs_inode_addr *) indir_block->b_data; | 509 | iaddr_array = (befs_disk_inode_addr *) indir_block->b_data; |
511 | *run = fsrun_to_cpu(sb, iaddr_array[block_indx]); | 510 | *run = fsrun_to_cpu(sb, iaddr_array[block_indx]); |
512 | brelse(indir_block); | 511 | brelse(indir_block); |
513 | iaddr_array = NULL; | 512 | iaddr_array = NULL; |
diff --git a/fs/befs/debug.c b/fs/befs/debug.c index 875cc0aa318c..e831a8f30849 100644 --- a/fs/befs/debug.c +++ b/fs/befs/debug.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #endif /* __KERNEL__ */ | 21 | #endif /* __KERNEL__ */ |
22 | 22 | ||
23 | #include "befs.h" | 23 | #include "befs.h" |
24 | #include "endian.h" | ||
25 | 24 | ||
26 | #define ERRBUFSIZE 1024 | 25 | #define ERRBUFSIZE 1024 |
27 | 26 | ||
@@ -125,7 +124,7 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode) | |||
125 | befs_debug(sb, " type %08x", fs32_to_cpu(sb, inode->type)); | 124 | befs_debug(sb, " type %08x", fs32_to_cpu(sb, inode->type)); |
126 | befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, inode->inode_size)); | 125 | befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, inode->inode_size)); |
127 | 126 | ||
128 | if (S_ISLNK(inode->mode)) { | 127 | if (S_ISLNK(fs32_to_cpu(sb, inode->mode))) { |
129 | befs_debug(sb, " Symbolic link [%s]", inode->data.symlink); | 128 | befs_debug(sb, " Symbolic link [%s]", inode->data.symlink); |
130 | } else { | 129 | } else { |
131 | int i; | 130 | int i; |
@@ -231,21 +230,20 @@ befs_dump_small_data(const struct super_block *sb, befs_small_data * sd) | |||
231 | 230 | ||
232 | /* unused */ | 231 | /* unused */ |
233 | void | 232 | void |
234 | befs_dump_run(const struct super_block *sb, befs_block_run run) | 233 | befs_dump_run(const struct super_block *sb, befs_disk_block_run run) |
235 | { | 234 | { |
236 | #ifdef CONFIG_BEFS_DEBUG | 235 | #ifdef CONFIG_BEFS_DEBUG |
237 | 236 | ||
238 | run = fsrun_to_cpu(sb, run); | 237 | befs_block_run n = fsrun_to_cpu(sb, run); |
239 | 238 | ||
240 | befs_debug(sb, "[%u, %hu, %hu]", | 239 | befs_debug(sb, "[%u, %hu, %hu]", n.allocation_group, n.start, n.len); |
241 | run.allocation_group, run.start, run.len); | ||
242 | 240 | ||
243 | #endif //CONFIG_BEFS_DEBUG | 241 | #endif //CONFIG_BEFS_DEBUG |
244 | } | 242 | } |
245 | #endif /* 0 */ | 243 | #endif /* 0 */ |
246 | 244 | ||
247 | void | 245 | void |
248 | befs_dump_index_entry(const struct super_block *sb, befs_btree_super * super) | 246 | befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * super) |
249 | { | 247 | { |
250 | #ifdef CONFIG_BEFS_DEBUG | 248 | #ifdef CONFIG_BEFS_DEBUG |
251 | 249 | ||
diff --git a/fs/befs/endian.h b/fs/befs/endian.h index 9ecaea4e3325..e254a20869f4 100644 --- a/fs/befs/endian.h +++ b/fs/befs/endian.h | |||
@@ -10,85 +10,84 @@ | |||
10 | #define LINUX_BEFS_ENDIAN | 10 | #define LINUX_BEFS_ENDIAN |
11 | 11 | ||
12 | #include <linux/byteorder/generic.h> | 12 | #include <linux/byteorder/generic.h> |
13 | #include "befs.h" | ||
14 | 13 | ||
15 | static inline u64 | 14 | static inline u64 |
16 | fs64_to_cpu(const struct super_block *sb, u64 n) | 15 | fs64_to_cpu(const struct super_block *sb, fs64 n) |
17 | { | 16 | { |
18 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) | 17 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) |
19 | return le64_to_cpu(n); | 18 | return le64_to_cpu((__force __le64)n); |
20 | else | 19 | else |
21 | return be64_to_cpu(n); | 20 | return be64_to_cpu((__force __be64)n); |
22 | } | 21 | } |
23 | 22 | ||
24 | static inline u64 | 23 | static inline fs64 |
25 | cpu_to_fs64(const struct super_block *sb, u64 n) | 24 | cpu_to_fs64(const struct super_block *sb, u64 n) |
26 | { | 25 | { |
27 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) | 26 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) |
28 | return cpu_to_le64(n); | 27 | return (__force fs64)cpu_to_le64(n); |
29 | else | 28 | else |
30 | return cpu_to_be64(n); | 29 | return (__force fs64)cpu_to_be64(n); |
31 | } | 30 | } |
32 | 31 | ||
33 | static inline u32 | 32 | static inline u32 |
34 | fs32_to_cpu(const struct super_block *sb, u32 n) | 33 | fs32_to_cpu(const struct super_block *sb, fs32 n) |
35 | { | 34 | { |
36 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) | 35 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) |
37 | return le32_to_cpu(n); | 36 | return le32_to_cpu((__force __le32)n); |
38 | else | 37 | else |
39 | return be32_to_cpu(n); | 38 | return be32_to_cpu((__force __be32)n); |
40 | } | 39 | } |
41 | 40 | ||
42 | static inline u32 | 41 | static inline fs32 |
43 | cpu_to_fs32(const struct super_block *sb, u32 n) | 42 | cpu_to_fs32(const struct super_block *sb, u32 n) |
44 | { | 43 | { |
45 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) | 44 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) |
46 | return cpu_to_le32(n); | 45 | return (__force fs32)cpu_to_le32(n); |
47 | else | 46 | else |
48 | return cpu_to_be32(n); | 47 | return (__force fs32)cpu_to_be32(n); |
49 | } | 48 | } |
50 | 49 | ||
51 | static inline u16 | 50 | static inline u16 |
52 | fs16_to_cpu(const struct super_block *sb, u16 n) | 51 | fs16_to_cpu(const struct super_block *sb, fs16 n) |
53 | { | 52 | { |
54 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) | 53 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) |
55 | return le16_to_cpu(n); | 54 | return le16_to_cpu((__force __le16)n); |
56 | else | 55 | else |
57 | return be16_to_cpu(n); | 56 | return be16_to_cpu((__force __be16)n); |
58 | } | 57 | } |
59 | 58 | ||
60 | static inline u16 | 59 | static inline fs16 |
61 | cpu_to_fs16(const struct super_block *sb, u16 n) | 60 | cpu_to_fs16(const struct super_block *sb, u16 n) |
62 | { | 61 | { |
63 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) | 62 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) |
64 | return cpu_to_le16(n); | 63 | return (__force fs16)cpu_to_le16(n); |
65 | else | 64 | else |
66 | return cpu_to_be16(n); | 65 | return (__force fs16)cpu_to_be16(n); |
67 | } | 66 | } |
68 | 67 | ||
69 | /* Composite types below here */ | 68 | /* Composite types below here */ |
70 | 69 | ||
71 | static inline befs_block_run | 70 | static inline befs_block_run |
72 | fsrun_to_cpu(const struct super_block *sb, befs_block_run n) | 71 | fsrun_to_cpu(const struct super_block *sb, befs_disk_block_run n) |
73 | { | 72 | { |
74 | befs_block_run run; | 73 | befs_block_run run; |
75 | 74 | ||
76 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { | 75 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { |
77 | run.allocation_group = le32_to_cpu(n.allocation_group); | 76 | run.allocation_group = le32_to_cpu((__force __le32)n.allocation_group); |
78 | run.start = le16_to_cpu(n.start); | 77 | run.start = le16_to_cpu((__force __le16)n.start); |
79 | run.len = le16_to_cpu(n.len); | 78 | run.len = le16_to_cpu((__force __le16)n.len); |
80 | } else { | 79 | } else { |
81 | run.allocation_group = be32_to_cpu(n.allocation_group); | 80 | run.allocation_group = be32_to_cpu((__force __be32)n.allocation_group); |
82 | run.start = be16_to_cpu(n.start); | 81 | run.start = be16_to_cpu((__force __be16)n.start); |
83 | run.len = be16_to_cpu(n.len); | 82 | run.len = be16_to_cpu((__force __be16)n.len); |
84 | } | 83 | } |
85 | return run; | 84 | return run; |
86 | } | 85 | } |
87 | 86 | ||
88 | static inline befs_block_run | 87 | static inline befs_disk_block_run |
89 | cpu_to_fsrun(const struct super_block *sb, befs_block_run n) | 88 | cpu_to_fsrun(const struct super_block *sb, befs_block_run n) |
90 | { | 89 | { |
91 | befs_block_run run; | 90 | befs_disk_block_run run; |
92 | 91 | ||
93 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { | 92 | if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { |
94 | run.allocation_group = cpu_to_le32(n.allocation_group); | 93 | run.allocation_group = cpu_to_le32(n.allocation_group); |
@@ -103,7 +102,7 @@ cpu_to_fsrun(const struct super_block *sb, befs_block_run n) | |||
103 | } | 102 | } |
104 | 103 | ||
105 | static inline befs_data_stream | 104 | static inline befs_data_stream |
106 | fsds_to_cpu(const struct super_block *sb, befs_data_stream n) | 105 | fsds_to_cpu(const struct super_block *sb, befs_disk_data_stream n) |
107 | { | 106 | { |
108 | befs_data_stream data; | 107 | befs_data_stream data; |
109 | int i; | 108 | int i; |
diff --git a/fs/befs/inode.c b/fs/befs/inode.c index d41c9247ae8a..94c17f9a9576 100644 --- a/fs/befs/inode.c +++ b/fs/befs/inode.c | |||
@@ -8,7 +8,6 @@ | |||
8 | 8 | ||
9 | #include "befs.h" | 9 | #include "befs.h" |
10 | #include "inode.h" | 10 | #include "inode.h" |
11 | #include "endian.h" | ||
12 | 11 | ||
13 | /* | 12 | /* |
14 | Validates the correctness of the befs inode | 13 | Validates the correctness of the befs inode |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 57020c7a7e65..07f7144f0e2e 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include "datastream.h" | 22 | #include "datastream.h" |
23 | #include "super.h" | 23 | #include "super.h" |
24 | #include "io.h" | 24 | #include "io.h" |
25 | #include "endian.h" | ||
26 | 25 | ||
27 | MODULE_DESCRIPTION("BeOS File System (BeFS) driver"); | 26 | MODULE_DESCRIPTION("BeOS File System (BeFS) driver"); |
28 | MODULE_AUTHOR("Will Dyson"); | 27 | MODULE_AUTHOR("Will Dyson"); |
diff --git a/fs/befs/super.c b/fs/befs/super.c index 4557acbac528..8c3401ff6d6a 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include "befs.h" | 12 | #include "befs.h" |
13 | #include "super.h" | 13 | #include "super.h" |
14 | #include "endian.h" | ||
15 | 14 | ||
16 | /** | 15 | /** |
17 | * load_befs_sb -- Read from disk and properly byteswap all the fields | 16 | * load_befs_sb -- Read from disk and properly byteswap all the fields |
diff --git a/fs/buffer.c b/fs/buffer.c index 16cfbcd254f1..eeb8ac1aa856 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -701,7 +701,10 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode); | |||
701 | */ | 701 | */ |
702 | int __set_page_dirty_buffers(struct page *page) | 702 | int __set_page_dirty_buffers(struct page *page) |
703 | { | 703 | { |
704 | struct address_space * const mapping = page->mapping; | 704 | struct address_space * const mapping = page_mapping(page); |
705 | |||
706 | if (unlikely(!mapping)) | ||
707 | return !TestSetPageDirty(page); | ||
705 | 708 | ||
706 | spin_lock(&mapping->private_lock); | 709 | spin_lock(&mapping->private_lock); |
707 | if (page_has_buffers(page)) { | 710 | if (page_has_buffers(page)) { |
diff --git a/fs/compat.c b/fs/compat.c index 4d3fbcb2ddb1..50624d4a70c6 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1316,7 +1316,7 @@ compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32, | |||
1316 | unsigned int nr_segs, unsigned int flags) | 1316 | unsigned int nr_segs, unsigned int flags) |
1317 | { | 1317 | { |
1318 | unsigned i; | 1318 | unsigned i; |
1319 | struct iovec *iov; | 1319 | struct iovec __user *iov; |
1320 | if (nr_segs > UIO_MAXIOV) | 1320 | if (nr_segs > UIO_MAXIOV) |
1321 | return -EINVAL; | 1321 | return -EINVAL; |
1322 | iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec)); | 1322 | iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec)); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 045738032a83..4613cb202170 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -384,7 +384,7 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) | |||
384 | le16_to_cpu(de->cdate)) + secs; | 384 | le16_to_cpu(de->cdate)) + secs; |
385 | inode->i_ctime.tv_nsec = csecs * 10000000; | 385 | inode->i_ctime.tv_nsec = csecs * 10000000; |
386 | inode->i_atime.tv_sec = | 386 | inode->i_atime.tv_sec = |
387 | date_dos2unix(le16_to_cpu(0), le16_to_cpu(de->adate)); | 387 | date_dos2unix(0, le16_to_cpu(de->adate)); |
388 | inode->i_atime.tv_nsec = 0; | 388 | inode->i_atime.tv_nsec = 0; |
389 | } else | 389 | } else |
390 | inode->i_ctime = inode->i_atime = inode->i_mtime; | 390 | inode->i_ctime = inode->i_atime = inode->i_mtime; |
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index bcf6ee36e065..7faef8544f32 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c | |||
@@ -60,14 +60,14 @@ void hpfs_read_inode(struct inode *i) | |||
60 | if (hpfs_sb(i->i_sb)->sb_eas) { | 60 | if (hpfs_sb(i->i_sb)->sb_eas) { |
61 | if ((ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size))) { | 61 | if ((ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size))) { |
62 | if (ea_size == 2) { | 62 | if (ea_size == 2) { |
63 | i->i_uid = le16_to_cpu(*(u16*)ea); | 63 | i->i_uid = le16_to_cpu(*(__le16*)ea); |
64 | hpfs_inode->i_ea_uid = 1; | 64 | hpfs_inode->i_ea_uid = 1; |
65 | } | 65 | } |
66 | kfree(ea); | 66 | kfree(ea); |
67 | } | 67 | } |
68 | if ((ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size))) { | 68 | if ((ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size))) { |
69 | if (ea_size == 2) { | 69 | if (ea_size == 2) { |
70 | i->i_gid = le16_to_cpu(*(u16*)ea); | 70 | i->i_gid = le16_to_cpu(*(__le16*)ea); |
71 | hpfs_inode->i_ea_gid = 1; | 71 | hpfs_inode->i_ea_gid = 1; |
72 | } | 72 | } |
73 | kfree(ea); | 73 | kfree(ea); |
@@ -87,7 +87,7 @@ void hpfs_read_inode(struct inode *i) | |||
87 | int rdev = 0; | 87 | int rdev = 0; |
88 | umode_t mode = hpfs_sb(sb)->sb_mode; | 88 | umode_t mode = hpfs_sb(sb)->sb_mode; |
89 | if (ea_size == 2) { | 89 | if (ea_size == 2) { |
90 | mode = le16_to_cpu(*(u16*)ea); | 90 | mode = le16_to_cpu(*(__le16*)ea); |
91 | hpfs_inode->i_ea_mode = 1; | 91 | hpfs_inode->i_ea_mode = 1; |
92 | } | 92 | } |
93 | kfree(ea); | 93 | kfree(ea); |
@@ -95,7 +95,7 @@ void hpfs_read_inode(struct inode *i) | |||
95 | if (S_ISBLK(mode) || S_ISCHR(mode)) { | 95 | if (S_ISBLK(mode) || S_ISCHR(mode)) { |
96 | if ((ea = hpfs_get_ea(i->i_sb, fnode, "DEV", &ea_size))) { | 96 | if ((ea = hpfs_get_ea(i->i_sb, fnode, "DEV", &ea_size))) { |
97 | if (ea_size == 4) | 97 | if (ea_size == 4) |
98 | rdev = le32_to_cpu(*(u32*)ea); | 98 | rdev = le32_to_cpu(*(__le32*)ea); |
99 | kfree(ea); | 99 | kfree(ea); |
100 | } | 100 | } |
101 | } | 101 | } |
@@ -148,7 +148,7 @@ static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode) | |||
148 | we'd better not overwrite them | 148 | we'd better not overwrite them |
149 | hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 stuctures", i->i_ino); | 149 | hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 stuctures", i->i_ino); |
150 | } else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) { | 150 | } else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) { |
151 | u32 ea; | 151 | __le32 ea; |
152 | if ((i->i_uid != hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) { | 152 | if ((i->i_uid != hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) { |
153 | ea = cpu_to_le32(i->i_uid); | 153 | ea = cpu_to_le32(i->i_uid); |
154 | hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2); | 154 | hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2); |
@@ -165,6 +165,7 @@ static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode) | |||
165 | && i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0222 : 0333)) | 165 | && i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0222 : 0333)) |
166 | | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))) || hpfs_inode->i_ea_mode) { | 166 | | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))) || hpfs_inode->i_ea_mode) { |
167 | ea = cpu_to_le32(i->i_mode); | 167 | ea = cpu_to_le32(i->i_mode); |
168 | /* sick, but legal */ | ||
168 | hpfs_set_ea(i, fnode, "MODE", (char *)&ea, 2); | 169 | hpfs_set_ea(i, fnode, "MODE", (char *)&ea, 2); |
169 | hpfs_inode->i_ea_mode = 1; | 170 | hpfs_inode->i_ea_mode = 1; |
170 | } | 171 | } |
diff --git a/fs/inode.c b/fs/inode.c index bf6bec4e54ff..d9a21d122926 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -162,7 +162,7 @@ static struct inode *alloc_inode(struct super_block *sb) | |||
162 | bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info; | 162 | bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info; |
163 | mapping->backing_dev_info = bdi; | 163 | mapping->backing_dev_info = bdi; |
164 | } | 164 | } |
165 | inode->i_private = 0; | 165 | inode->i_private = NULL; |
166 | inode->i_mapping = mapping; | 166 | inode->i_mapping = mapping; |
167 | } | 167 | } |
168 | return inode; | 168 | return inode; |
diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c index 81a90e170ac3..fb8fe7a9ddc6 100644 --- a/fs/isofs/joliet.c +++ b/fs/isofs/joliet.c | |||
@@ -14,9 +14,9 @@ | |||
14 | * Convert Unicode 16 to UTF-8 or ASCII. | 14 | * Convert Unicode 16 to UTF-8 or ASCII. |
15 | */ | 15 | */ |
16 | static int | 16 | static int |
17 | uni16_to_x8(unsigned char *ascii, u16 *uni, int len, struct nls_table *nls) | 17 | uni16_to_x8(unsigned char *ascii, __be16 *uni, int len, struct nls_table *nls) |
18 | { | 18 | { |
19 | wchar_t *ip, ch; | 19 | __be16 *ip, ch; |
20 | unsigned char *op; | 20 | unsigned char *op; |
21 | 21 | ||
22 | ip = uni; | 22 | ip = uni; |
@@ -24,8 +24,8 @@ uni16_to_x8(unsigned char *ascii, u16 *uni, int len, struct nls_table *nls) | |||
24 | 24 | ||
25 | while ((ch = get_unaligned(ip)) && len) { | 25 | while ((ch = get_unaligned(ip)) && len) { |
26 | int llen; | 26 | int llen; |
27 | ch = be16_to_cpu(ch); | 27 | llen = nls->uni2char(be16_to_cpu(ch), op, NLS_MAX_CHARSET_SIZE); |
28 | if ((llen = nls->uni2char(ch, op, NLS_MAX_CHARSET_SIZE)) > 0) | 28 | if (llen > 0) |
29 | op += llen; | 29 | op += llen; |
30 | else | 30 | else |
31 | *op++ = '?'; | 31 | *op++ = '?'; |
@@ -82,7 +82,7 @@ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, st | |||
82 | len = wcsntombs_be(outname, de->name, | 82 | len = wcsntombs_be(outname, de->name, |
83 | de->name_len[0] >> 1, PAGE_SIZE); | 83 | de->name_len[0] >> 1, PAGE_SIZE); |
84 | } else { | 84 | } else { |
85 | len = uni16_to_x8(outname, (u16 *) de->name, | 85 | len = uni16_to_x8(outname, (__be16 *) de->name, |
86 | de->name_len[0] >> 1, nls); | 86 | de->name_len[0] >> 1, nls); |
87 | } | 87 | } |
88 | if ((len > 2) && (outname[len-2] == ';') && (outname[len-1] == '1')) { | 88 | if ((len > 2) && (outname[len-2] == ';') && (outname[len-1] == '1')) { |
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 4f8df71e49d3..8c7af1777819 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c | |||
@@ -32,13 +32,11 @@ | |||
32 | #include <asm/unaligned.h> | 32 | #include <asm/unaligned.h> |
33 | 33 | ||
34 | #define SYS_IND(p) (get_unaligned(&p->sys_ind)) | 34 | #define SYS_IND(p) (get_unaligned(&p->sys_ind)) |
35 | #define NR_SECTS(p) ({ __typeof__(p->nr_sects) __a = \ | 35 | #define NR_SECTS(p) ({ __le32 __a = get_unaligned(&p->nr_sects); \ |
36 | get_unaligned(&p->nr_sects); \ | ||
37 | le32_to_cpu(__a); \ | 36 | le32_to_cpu(__a); \ |
38 | }) | 37 | }) |
39 | 38 | ||
40 | #define START_SECT(p) ({ __typeof__(p->start_sect) __a = \ | 39 | #define START_SECT(p) ({ __le32 __a = get_unaligned(&p->start_sect); \ |
41 | get_unaligned(&p->start_sect); \ | ||
42 | le32_to_cpu(__a); \ | 40 | le32_to_cpu(__a); \ |
43 | }) | 41 | }) |
44 | 42 | ||
diff --git a/fs/ufs/util.c b/fs/ufs/util.c index 22f820a9b15c..17437574f79c 100644 --- a/fs/ufs/util.c +++ b/fs/ufs/util.c | |||
@@ -184,14 +184,13 @@ void _ubh_memcpyubh_(struct ufs_sb_private_info * uspi, | |||
184 | dev_t | 184 | dev_t |
185 | ufs_get_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi) | 185 | ufs_get_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi) |
186 | { | 186 | { |
187 | __fs32 fs32; | 187 | __u32 fs32; |
188 | dev_t dev; | 188 | dev_t dev; |
189 | 189 | ||
190 | if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86) | 190 | if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86) |
191 | fs32 = ufsi->i_u1.i_data[1]; | 191 | fs32 = fs32_to_cpu(sb, ufsi->i_u1.i_data[1]); |
192 | else | 192 | else |
193 | fs32 = ufsi->i_u1.i_data[0]; | 193 | fs32 = fs32_to_cpu(sb, ufsi->i_u1.i_data[0]); |
194 | fs32 = fs32_to_cpu(sb, fs32); | ||
195 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { | 194 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { |
196 | case UFS_ST_SUNx86: | 195 | case UFS_ST_SUNx86: |
197 | case UFS_ST_SUN: | 196 | case UFS_ST_SUN: |
@@ -212,7 +211,7 @@ ufs_get_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi) | |||
212 | void | 211 | void |
213 | ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi, dev_t dev) | 212 | ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi, dev_t dev) |
214 | { | 213 | { |
215 | __fs32 fs32; | 214 | __u32 fs32; |
216 | 215 | ||
217 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { | 216 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { |
218 | case UFS_ST_SUNx86: | 217 | case UFS_ST_SUNx86: |
@@ -227,11 +226,10 @@ ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi, dev_t dev | |||
227 | fs32 = old_encode_dev(dev); | 226 | fs32 = old_encode_dev(dev); |
228 | break; | 227 | break; |
229 | } | 228 | } |
230 | fs32 = cpu_to_fs32(sb, fs32); | ||
231 | if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86) | 229 | if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86) |
232 | ufsi->i_u1.i_data[1] = fs32; | 230 | ufsi->i_u1.i_data[1] = cpu_to_fs32(sb, fs32); |
233 | else | 231 | else |
234 | ufsi->i_u1.i_data[0] = fs32; | 232 | ufsi->i_u1.i_data[0] = cpu_to_fs32(sb, fs32); |
235 | } | 233 | } |
236 | 234 | ||
237 | /** | 235 | /** |
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h index e3b0c3fe5eed..da3eade0cae2 100644 --- a/include/asm-ia64/sn/pcibr_provider.h +++ b/include/asm-ia64/sn/pcibr_provider.h | |||
@@ -135,7 +135,7 @@ extern void pcireg_intr_addr_addr_set(struct pcibus_info *, int, u64 | |||
135 | extern void pcireg_force_intr_set(struct pcibus_info *, int); | 135 | extern void pcireg_force_intr_set(struct pcibus_info *, int); |
136 | extern u64 pcireg_wrb_flush_get(struct pcibus_info *, int); | 136 | extern u64 pcireg_wrb_flush_get(struct pcibus_info *, int); |
137 | extern void pcireg_int_ate_set(struct pcibus_info *, int, u64); | 137 | extern void pcireg_int_ate_set(struct pcibus_info *, int, u64); |
138 | extern u64 * pcireg_int_ate_addr(struct pcibus_info *, int); | 138 | extern u64 __iomem * pcireg_int_ate_addr(struct pcibus_info *, int); |
139 | extern void pcibr_force_interrupt(struct sn_irq_info *sn_irq_info); | 139 | extern void pcibr_force_interrupt(struct sn_irq_info *sn_irq_info); |
140 | extern void pcibr_change_devices_irq(struct sn_irq_info *sn_irq_info); | 140 | extern void pcibr_change_devices_irq(struct sn_irq_info *sn_irq_info); |
141 | extern int pcibr_ate_alloc(struct pcibus_info *, int); | 141 | extern int pcibr_ate_alloc(struct pcibus_info *, int); |
diff --git a/include/asm-ia64/sn/tioca_provider.h b/include/asm-ia64/sn/tioca_provider.h index 65cdd73c2a57..9a820ac61be3 100644 --- a/include/asm-ia64/sn/tioca_provider.h +++ b/include/asm-ia64/sn/tioca_provider.h | |||
@@ -162,11 +162,11 @@ static inline void | |||
162 | tioca_tlbflush(struct tioca_kernel *tioca_kernel) | 162 | tioca_tlbflush(struct tioca_kernel *tioca_kernel) |
163 | { | 163 | { |
164 | volatile u64 tmp; | 164 | volatile u64 tmp; |
165 | volatile struct tioca *ca_base; | 165 | volatile struct tioca __iomem *ca_base; |
166 | struct tioca_common *tioca_common; | 166 | struct tioca_common *tioca_common; |
167 | 167 | ||
168 | tioca_common = tioca_kernel->ca_common; | 168 | tioca_common = tioca_kernel->ca_common; |
169 | ca_base = (struct tioca *)tioca_common->ca_common.bs_base; | 169 | ca_base = (struct tioca __iomem *)tioca_common->ca_common.bs_base; |
170 | 170 | ||
171 | /* | 171 | /* |
172 | * Explicit flushes not needed if GART is in cached mode | 172 | * Explicit flushes not needed if GART is in cached mode |
diff --git a/include/asm-ia64/sn/tioce_provider.h b/include/asm-ia64/sn/tioce_provider.h index 6d62b13f7ae7..32c32f30b099 100644 --- a/include/asm-ia64/sn/tioce_provider.h +++ b/include/asm-ia64/sn/tioce_provider.h | |||
@@ -53,7 +53,7 @@ struct tioce_dmamap { | |||
53 | u64 ct_start; /* coretalk start address */ | 53 | u64 ct_start; /* coretalk start address */ |
54 | u64 pci_start; /* bus start address */ | 54 | u64 pci_start; /* bus start address */ |
55 | 55 | ||
56 | u64 *ate_hw; /* hw ptr of first ate in map */ | 56 | u64 __iomem *ate_hw;/* hw ptr of first ate in map */ |
57 | u64 *ate_shadow; /* shadow ptr of firat ate */ | 57 | u64 *ate_shadow; /* shadow ptr of firat ate */ |
58 | u16 ate_count; /* # ate's in the map */ | 58 | u16 ate_count; /* # ate's in the map */ |
59 | }; | 59 | }; |
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h index 58c561a9ec6b..efef843b93f0 100644 --- a/include/asm-mips/fpu.h +++ b/include/asm-mips/fpu.h | |||
@@ -134,9 +134,11 @@ static inline void restore_fp(struct task_struct *tsk) | |||
134 | 134 | ||
135 | static inline fpureg_t *get_fpu_regs(struct task_struct *tsk) | 135 | static inline fpureg_t *get_fpu_regs(struct task_struct *tsk) |
136 | { | 136 | { |
137 | if (cpu_has_fpu) { | 137 | if (tsk == current) { |
138 | if ((tsk == current) && __is_fpu_owner()) | 138 | preempt_disable(); |
139 | if (is_fpu_owner()) | ||
139 | _save_fp(current); | 140 | _save_fp(current); |
141 | preempt_enable(); | ||
140 | } | 142 | } |
141 | 143 | ||
142 | return tsk->thread.fpu.fpr; | 144 | return tsk->thread.fpu.fpr; |
diff --git a/include/asm-mips/mach-au1x00/au1000_usbdev.h b/include/asm-mips/mach-au1x00/au1000_usbdev.h deleted file mode 100644 index 05bc74bed0b1..000000000000 --- a/include/asm-mips/mach-au1x00/au1000_usbdev.h +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Au1000 USB Device-Side Driver | ||
4 | * | ||
5 | * Copyright 2001 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * stevel@mvista.com or source@mvista.com | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | #define USBDEV_REV 0x0110 // BCD | ||
31 | #define USBDEV_EP0_MAX_PACKET_SIZE 64 | ||
32 | |||
33 | typedef enum { | ||
34 | ATTACHED = 0, | ||
35 | POWERED, | ||
36 | DEFAULT, | ||
37 | ADDRESS, | ||
38 | CONFIGURED | ||
39 | } usbdev_state_t; | ||
40 | |||
41 | typedef enum { | ||
42 | CB_NEW_STATE = 0, | ||
43 | CB_PKT_COMPLETE | ||
44 | } usbdev_cb_type_t; | ||
45 | |||
46 | |||
47 | typedef struct usbdev_pkt { | ||
48 | int ep_addr; // ep addr this packet routed to | ||
49 | int size; // size of payload in bytes | ||
50 | unsigned status; // packet status | ||
51 | struct usbdev_pkt* next; // function layer can't touch this | ||
52 | u8 payload[0]; // the payload | ||
53 | } usbdev_pkt_t; | ||
54 | |||
55 | #define PKT_STATUS_ACK (1<<0) | ||
56 | #define PKT_STATUS_NAK (1<<1) | ||
57 | #define PKT_STATUS_SU (1<<2) | ||
58 | |||
59 | extern int usbdev_init(struct usb_device_descriptor* dev_desc, | ||
60 | struct usb_config_descriptor* config_desc, | ||
61 | struct usb_interface_descriptor* if_desc, | ||
62 | struct usb_endpoint_descriptor* ep_desc, | ||
63 | struct usb_string_descriptor* str_desc[], | ||
64 | void (*cb)(usbdev_cb_type_t, unsigned long, void *), | ||
65 | void* cb_data); | ||
66 | |||
67 | extern void usbdev_exit(void); | ||
68 | |||
69 | extern int usbdev_alloc_packet (int ep_addr, int data_size, | ||
70 | usbdev_pkt_t** pkt); | ||
71 | extern int usbdev_send_packet (int ep_addr, usbdev_pkt_t* pkt); | ||
72 | extern int usbdev_receive_packet(int ep_addr, usbdev_pkt_t** pkt); | ||
73 | extern int usbdev_get_byte_count(int ep_addr); | ||
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 3c9b0bc05123..bbbe7b4da0bb 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
@@ -749,7 +749,7 @@ struct request_sense { | |||
749 | #define MRW_MODE_PC 0x03 | 749 | #define MRW_MODE_PC 0x03 |
750 | 750 | ||
751 | struct mrw_feature_desc { | 751 | struct mrw_feature_desc { |
752 | __u16 feature_code; | 752 | __be16 feature_code; |
753 | #if defined(__BIG_ENDIAN_BITFIELD) | 753 | #if defined(__BIG_ENDIAN_BITFIELD) |
754 | __u8 reserved1 : 2; | 754 | __u8 reserved1 : 2; |
755 | __u8 feature_version : 4; | 755 | __u8 feature_version : 4; |
@@ -776,7 +776,7 @@ struct mrw_feature_desc { | |||
776 | 776 | ||
777 | /* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ | 777 | /* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ |
778 | struct rwrt_feature_desc { | 778 | struct rwrt_feature_desc { |
779 | __u16 feature_code; | 779 | __be16 feature_code; |
780 | #if defined(__BIG_ENDIAN_BITFIELD) | 780 | #if defined(__BIG_ENDIAN_BITFIELD) |
781 | __u8 reserved1 : 2; | 781 | __u8 reserved1 : 2; |
782 | __u8 feature_version : 4; | 782 | __u8 feature_version : 4; |
@@ -803,7 +803,7 @@ struct rwrt_feature_desc { | |||
803 | }; | 803 | }; |
804 | 804 | ||
805 | typedef struct { | 805 | typedef struct { |
806 | __u16 disc_information_length; | 806 | __be16 disc_information_length; |
807 | #if defined(__BIG_ENDIAN_BITFIELD) | 807 | #if defined(__BIG_ENDIAN_BITFIELD) |
808 | __u8 reserved1 : 3; | 808 | __u8 reserved1 : 3; |
809 | __u8 erasable : 1; | 809 | __u8 erasable : 1; |
@@ -849,7 +849,7 @@ typedef struct { | |||
849 | } disc_information; | 849 | } disc_information; |
850 | 850 | ||
851 | typedef struct { | 851 | typedef struct { |
852 | __u16 track_information_length; | 852 | __be16 track_information_length; |
853 | __u8 track_lsb; | 853 | __u8 track_lsb; |
854 | __u8 session_lsb; | 854 | __u8 session_lsb; |
855 | __u8 reserved1; | 855 | __u8 reserved1; |
@@ -880,12 +880,12 @@ typedef struct { | |||
880 | __u8 lra_v : 1; | 880 | __u8 lra_v : 1; |
881 | __u8 reserved3 : 6; | 881 | __u8 reserved3 : 6; |
882 | #endif | 882 | #endif |
883 | __u32 track_start; | 883 | __be32 track_start; |
884 | __u32 next_writable; | 884 | __be32 next_writable; |
885 | __u32 free_blocks; | 885 | __be32 free_blocks; |
886 | __u32 fixed_packet_size; | 886 | __be32 fixed_packet_size; |
887 | __u32 track_size; | 887 | __be32 track_size; |
888 | __u32 last_rec_address; | 888 | __be32 last_rec_address; |
889 | } track_information; | 889 | } track_information; |
890 | 890 | ||
891 | struct feature_header { | 891 | struct feature_header { |
@@ -896,12 +896,12 @@ struct feature_header { | |||
896 | }; | 896 | }; |
897 | 897 | ||
898 | struct mode_page_header { | 898 | struct mode_page_header { |
899 | __u16 mode_data_length; | 899 | __be16 mode_data_length; |
900 | __u8 medium_type; | 900 | __u8 medium_type; |
901 | __u8 reserved1; | 901 | __u8 reserved1; |
902 | __u8 reserved2; | 902 | __u8 reserved2; |
903 | __u8 reserved3; | 903 | __u8 reserved3; |
904 | __u16 desc_length; | 904 | __be16 desc_length; |
905 | }; | 905 | }; |
906 | 906 | ||
907 | #ifdef __KERNEL__ | 907 | #ifdef __KERNEL__ |
@@ -1106,7 +1106,7 @@ typedef struct { | |||
1106 | #endif | 1106 | #endif |
1107 | __u8 session_format; | 1107 | __u8 session_format; |
1108 | __u8 reserved6; | 1108 | __u8 reserved6; |
1109 | __u32 packet_size; | 1109 | __be32 packet_size; |
1110 | __u16 audio_pause; | 1110 | __u16 audio_pause; |
1111 | __u8 mcn[16]; | 1111 | __u8 mcn[16]; |
1112 | __u8 isrc[16]; | 1112 | __u8 isrc[16]; |
@@ -1151,7 +1151,7 @@ typedef struct { | |||
1151 | } rpc_state_t; | 1151 | } rpc_state_t; |
1152 | 1152 | ||
1153 | struct event_header { | 1153 | struct event_header { |
1154 | __u16 data_len; | 1154 | __be16 data_len; |
1155 | #if defined(__BIG_ENDIAN_BITFIELD) | 1155 | #if defined(__BIG_ENDIAN_BITFIELD) |
1156 | __u8 nea : 1; | 1156 | __u8 nea : 1; |
1157 | __u8 reserved1 : 4; | 1157 | __u8 reserved1 : 4; |
diff --git a/include/linux/compat.h b/include/linux/compat.h index ef5cd192784c..f4ebf96f5308 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -163,7 +163,7 @@ asmlinkage long | |||
163 | compat_sys_set_robust_list(struct compat_robust_list_head __user *head, | 163 | compat_sys_set_robust_list(struct compat_robust_list_head __user *head, |
164 | compat_size_t len); | 164 | compat_size_t len); |
165 | asmlinkage long | 165 | asmlinkage long |
166 | compat_sys_get_robust_list(int pid, compat_uptr_t *head_ptr, | 166 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, |
167 | compat_size_t __user *len_ptr); | 167 | compat_size_t __user *len_ptr); |
168 | 168 | ||
169 | long compat_sys_semctl(int first, int second, int third, void __user *uptr); | 169 | long compat_sys_semctl(int first, int second, int third, void __user *uptr); |
diff --git a/include/linux/config.h b/include/linux/config.h deleted file mode 100644 index 479ffb0a22d8..000000000000 --- a/include/linux/config.h +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #ifndef _LINUX_CONFIG_H | ||
2 | #define _LINUX_CONFIG_H | ||
3 | /* This file is no longer in use and kept only for backward compatibility. | ||
4 | * autoconf.h is now included via -imacros on the commandline | ||
5 | */ | ||
6 | #warning Including config.h is deprecated. | ||
7 | #include <linux/autoconf.h> | ||
8 | |||
9 | #endif | ||
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index d6f4ec467a4b..53553c99cad6 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -191,7 +191,7 @@ enum { | |||
191 | /* this structure is argument to DCCP_SOCKOPT_CHANGE_X */ | 191 | /* this structure is argument to DCCP_SOCKOPT_CHANGE_X */ |
192 | struct dccp_so_feat { | 192 | struct dccp_so_feat { |
193 | __u8 dccpsf_feat; | 193 | __u8 dccpsf_feat; |
194 | __u8 *dccpsf_val; | 194 | __u8 __user *dccpsf_val; |
195 | __u8 dccpsf_len; | 195 | __u8 dccpsf_len; |
196 | }; | 196 | }; |
197 | 197 | ||
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index ab2740832742..35cb38573583 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -44,7 +44,7 @@ struct vlan_ethhdr { | |||
44 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ | 44 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ |
45 | __be16 h_vlan_proto; /* Should always be 0x8100 */ | 45 | __be16 h_vlan_proto; /* Should always be 0x8100 */ |
46 | __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */ | 46 | __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */ |
47 | unsigned short h_vlan_encapsulated_proto; /* packet type ID field (or len) */ | 47 | __be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */ |
48 | }; | 48 | }; |
49 | 49 | ||
50 | #include <linux/skbuff.h> | 50 | #include <linux/skbuff.h> |
diff --git a/include/linux/ioc4.h b/include/linux/ioc4.h index de73a3289cc2..51e2b9fb6372 100644 --- a/include/linux/ioc4.h +++ b/include/linux/ioc4.h | |||
@@ -157,7 +157,7 @@ struct ioc4_driver_data { | |||
157 | unsigned long idd_bar0; | 157 | unsigned long idd_bar0; |
158 | struct pci_dev *idd_pdev; | 158 | struct pci_dev *idd_pdev; |
159 | const struct pci_device_id *idd_pci_id; | 159 | const struct pci_device_id *idd_pci_id; |
160 | struct __iomem ioc4_misc_regs *idd_misc_regs; | 160 | struct ioc4_misc_regs __iomem *idd_misc_regs; |
161 | unsigned long count_period; | 161 | unsigned long count_period; |
162 | void *idd_serial_data; | 162 | void *idd_serial_data; |
163 | unsigned int idd_variant; | 163 | unsigned int idd_variant; |
diff --git a/include/linux/istallion.h b/include/linux/istallion.h index 1f996621bc9c..b55e2a035605 100644 --- a/include/linux/istallion.h +++ b/include/linux/istallion.h | |||
@@ -100,7 +100,7 @@ typedef struct stlibrd { | |||
100 | unsigned int iobase; | 100 | unsigned int iobase; |
101 | int iosize; | 101 | int iosize; |
102 | unsigned long memaddr; | 102 | unsigned long memaddr; |
103 | void *membase; | 103 | void __iomem *membase; |
104 | int memsize; | 104 | int memsize; |
105 | int pagesize; | 105 | int pagesize; |
106 | int hostoffset; | 106 | int hostoffset; |
@@ -113,7 +113,7 @@ typedef struct stlibrd { | |||
113 | void (*enable)(struct stlibrd *brdp); | 113 | void (*enable)(struct stlibrd *brdp); |
114 | void (*reenable)(struct stlibrd *brdp); | 114 | void (*reenable)(struct stlibrd *brdp); |
115 | void (*disable)(struct stlibrd *brdp); | 115 | void (*disable)(struct stlibrd *brdp); |
116 | char *(*getmemptr)(struct stlibrd *brdp, unsigned long offset, int line); | 116 | void __iomem *(*getmemptr)(struct stlibrd *brdp, unsigned long offset, int line); |
117 | void (*intr)(struct stlibrd *brdp); | 117 | void (*intr)(struct stlibrd *brdp); |
118 | void (*reset)(struct stlibrd *brdp); | 118 | void (*reset)(struct stlibrd *brdp); |
119 | stliport_t *ports[STL_MAXPORTS]; | 119 | stliport_t *ports[STL_MAXPORTS]; |
diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index 367d6c3e8ed4..13b3af547864 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h | |||
@@ -43,17 +43,17 @@ static inline struct smb_inode_info *SMB_I(struct inode *inode) | |||
43 | 43 | ||
44 | /* macro names are short for word, double-word, long value (?) */ | 44 | /* macro names are short for word, double-word, long value (?) */ |
45 | #define WVAL(buf,pos) \ | 45 | #define WVAL(buf,pos) \ |
46 | (le16_to_cpu(get_unaligned((u16 *)((u8 *)(buf) + (pos))))) | 46 | (le16_to_cpu(get_unaligned((__le16 *)((u8 *)(buf) + (pos))))) |
47 | #define DVAL(buf,pos) \ | 47 | #define DVAL(buf,pos) \ |
48 | (le32_to_cpu(get_unaligned((u32 *)((u8 *)(buf) + (pos))))) | 48 | (le32_to_cpu(get_unaligned((__le32 *)((u8 *)(buf) + (pos))))) |
49 | #define LVAL(buf,pos) \ | 49 | #define LVAL(buf,pos) \ |
50 | (le64_to_cpu(get_unaligned((u64 *)((u8 *)(buf) + (pos))))) | 50 | (le64_to_cpu(get_unaligned((__le64 *)((u8 *)(buf) + (pos))))) |
51 | #define WSET(buf,pos,val) \ | 51 | #define WSET(buf,pos,val) \ |
52 | put_unaligned(cpu_to_le16((u16)(val)), (u16 *)((u8 *)(buf) + (pos))) | 52 | put_unaligned(cpu_to_le16((u16)(val)), (__le16 *)((u8 *)(buf) + (pos))) |
53 | #define DSET(buf,pos,val) \ | 53 | #define DSET(buf,pos,val) \ |
54 | put_unaligned(cpu_to_le32((u32)(val)), (u32 *)((u8 *)(buf) + (pos))) | 54 | put_unaligned(cpu_to_le32((u32)(val)), (__le32 *)((u8 *)(buf) + (pos))) |
55 | #define LSET(buf,pos,val) \ | 55 | #define LSET(buf,pos,val) \ |
56 | put_unaligned(cpu_to_le64((u64)(val)), (u64 *)((u8 *)(buf) + (pos))) | 56 | put_unaligned(cpu_to_le64((u64)(val)), (__le64 *)((u8 *)(buf) + (pos))) |
57 | 57 | ||
58 | /* where to find the base of the SMB packet proper */ | 58 | /* where to find the base of the SMB packet proper */ |
59 | #define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) | 59 | #define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 3efcfc7e9c6c..b0ace3fd7eb9 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -593,7 +593,7 @@ asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags); | |||
593 | asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, | 593 | asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, |
594 | unsigned int flags); | 594 | unsigned int flags); |
595 | asmlinkage long sys_get_robust_list(int pid, | 595 | asmlinkage long sys_get_robust_list(int pid, |
596 | struct robust_list_head __user **head_ptr, | 596 | struct robust_list_head __user * __user *head_ptr, |
597 | size_t __user *len_ptr); | 597 | size_t __user *len_ptr); |
598 | asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, | 598 | asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, |
599 | size_t len); | 599 | size_t len); |
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index fc62887c5206..61eef508b041 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h | |||
@@ -351,6 +351,14 @@ struct ufs2_csum_total { | |||
351 | __fs64 cs_spare[3]; /* future expansion */ | 351 | __fs64 cs_spare[3]; /* future expansion */ |
352 | }; | 352 | }; |
353 | 353 | ||
354 | struct ufs_csum_core { | ||
355 | __u64 cs_ndir; /* number of directories */ | ||
356 | __u64 cs_nbfree; /* number of free blocks */ | ||
357 | __u64 cs_nifree; /* number of free inodes */ | ||
358 | __u64 cs_nffree; /* number of free frags */ | ||
359 | __u64 cs_numclusters; /* number of free clusters */ | ||
360 | }; | ||
361 | |||
354 | /* | 362 | /* |
355 | * File system flags | 363 | * File system flags |
356 | */ | 364 | */ |
@@ -715,7 +723,7 @@ struct ufs_cg_private_info { | |||
715 | 723 | ||
716 | struct ufs_sb_private_info { | 724 | struct ufs_sb_private_info { |
717 | struct ufs_buffer_head s_ubh; /* buffer containing super block */ | 725 | struct ufs_buffer_head s_ubh; /* buffer containing super block */ |
718 | struct ufs2_csum_total cs_total; | 726 | struct ufs_csum_core cs_total; |
719 | __u32 s_sblkno; /* offset of super-blocks in filesys */ | 727 | __u32 s_sblkno; /* offset of super-blocks in filesys */ |
720 | __u32 s_cblkno; /* offset of cg-block in filesys */ | 728 | __u32 s_cblkno; /* offset of cg-block in filesys */ |
721 | __u32 s_iblkno; /* offset of inode-blocks in filesys */ | 729 | __u32 s_iblkno; /* offset of inode-blocks in filesys */ |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 9d850ae13b1b..6313c38c930e 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -2137,7 +2137,7 @@ static int cpuset_handle_cpuhp(struct notifier_block *nb, | |||
2137 | * See also the previous routine cpuset_handle_cpuhp(). | 2137 | * See also the previous routine cpuset_handle_cpuhp(). |
2138 | */ | 2138 | */ |
2139 | 2139 | ||
2140 | void cpuset_track_online_nodes() | 2140 | void cpuset_track_online_nodes(void) |
2141 | { | 2141 | { |
2142 | common_cpu_mem_hotplug_unplug(); | 2142 | common_cpu_mem_hotplug_unplug(); |
2143 | } | 2143 | } |
diff --git a/kernel/futex.c b/kernel/futex.c index 4aaf91951a43..b364e0026191 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1612,10 +1612,10 @@ sys_set_robust_list(struct robust_list_head __user *head, | |||
1612 | * @len_ptr: pointer to a length field, the kernel fills in the header size | 1612 | * @len_ptr: pointer to a length field, the kernel fills in the header size |
1613 | */ | 1613 | */ |
1614 | asmlinkage long | 1614 | asmlinkage long |
1615 | sys_get_robust_list(int pid, struct robust_list_head __user **head_ptr, | 1615 | sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr, |
1616 | size_t __user *len_ptr) | 1616 | size_t __user *len_ptr) |
1617 | { | 1617 | { |
1618 | struct robust_list_head *head; | 1618 | struct robust_list_head __user *head; |
1619 | unsigned long ret; | 1619 | unsigned long ret; |
1620 | 1620 | ||
1621 | if (!pid) | 1621 | if (!pid) |
@@ -1694,14 +1694,15 @@ retry: | |||
1694 | * Fetch a robust-list pointer. Bit 0 signals PI futexes: | 1694 | * Fetch a robust-list pointer. Bit 0 signals PI futexes: |
1695 | */ | 1695 | */ |
1696 | static inline int fetch_robust_entry(struct robust_list __user **entry, | 1696 | static inline int fetch_robust_entry(struct robust_list __user **entry, |
1697 | struct robust_list __user **head, int *pi) | 1697 | struct robust_list __user * __user *head, |
1698 | int *pi) | ||
1698 | { | 1699 | { |
1699 | unsigned long uentry; | 1700 | unsigned long uentry; |
1700 | 1701 | ||
1701 | if (get_user(uentry, (unsigned long *)head)) | 1702 | if (get_user(uentry, (unsigned long __user *)head)) |
1702 | return -EFAULT; | 1703 | return -EFAULT; |
1703 | 1704 | ||
1704 | *entry = (void *)(uentry & ~1UL); | 1705 | *entry = (void __user *)(uentry & ~1UL); |
1705 | *pi = uentry & 1; | 1706 | *pi = uentry & 1; |
1706 | 1707 | ||
1707 | return 0; | 1708 | return 0; |
@@ -1739,7 +1740,7 @@ void exit_robust_list(struct task_struct *curr) | |||
1739 | return; | 1740 | return; |
1740 | 1741 | ||
1741 | if (pending) | 1742 | if (pending) |
1742 | handle_futex_death((void *)pending + futex_offset, curr, pip); | 1743 | handle_futex_death((void __user *)pending + futex_offset, curr, pip); |
1743 | 1744 | ||
1744 | while (entry != &head->list) { | 1745 | while (entry != &head->list) { |
1745 | /* | 1746 | /* |
@@ -1747,7 +1748,7 @@ void exit_robust_list(struct task_struct *curr) | |||
1747 | * don't process it twice: | 1748 | * don't process it twice: |
1748 | */ | 1749 | */ |
1749 | if (entry != pending) | 1750 | if (entry != pending) |
1750 | if (handle_futex_death((void *)entry + futex_offset, | 1751 | if (handle_futex_death((void __user *)entry + futex_offset, |
1751 | curr, pi)) | 1752 | curr, pi)) |
1752 | return; | 1753 | return; |
1753 | /* | 1754 | /* |
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index c5cca3f65cb7..50f24eea6cd0 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | static inline int | 19 | static inline int |
20 | fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry, | 20 | fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry, |
21 | compat_uptr_t *head, int *pi) | 21 | compat_uptr_t __user *head, int *pi) |
22 | { | 22 | { |
23 | if (get_user(*uentry, head)) | 23 | if (get_user(*uentry, head)) |
24 | return -EFAULT; | 24 | return -EFAULT; |
@@ -62,7 +62,7 @@ void compat_exit_robust_list(struct task_struct *curr) | |||
62 | &head->list_op_pending, &pip)) | 62 | &head->list_op_pending, &pip)) |
63 | return; | 63 | return; |
64 | if (upending) | 64 | if (upending) |
65 | handle_futex_death((void *)pending + futex_offset, curr, pip); | 65 | handle_futex_death((void __user *)pending + futex_offset, curr, pip); |
66 | 66 | ||
67 | while (compat_ptr(uentry) != &head->list) { | 67 | while (compat_ptr(uentry) != &head->list) { |
68 | /* | 68 | /* |
@@ -70,7 +70,7 @@ void compat_exit_robust_list(struct task_struct *curr) | |||
70 | * dont process it twice: | 70 | * dont process it twice: |
71 | */ | 71 | */ |
72 | if (entry != pending) | 72 | if (entry != pending) |
73 | if (handle_futex_death((void *)entry + futex_offset, | 73 | if (handle_futex_death((void __user *)entry + futex_offset, |
74 | curr, pi)) | 74 | curr, pi)) |
75 | return; | 75 | return; |
76 | 76 | ||
@@ -78,7 +78,7 @@ void compat_exit_robust_list(struct task_struct *curr) | |||
78 | * Fetch the next entry in the list: | 78 | * Fetch the next entry in the list: |
79 | */ | 79 | */ |
80 | if (fetch_robust_entry(&uentry, &entry, | 80 | if (fetch_robust_entry(&uentry, &entry, |
81 | (compat_uptr_t *)&entry->next, &pi)) | 81 | (compat_uptr_t __user *)&entry->next, &pi)) |
82 | return; | 82 | return; |
83 | /* | 83 | /* |
84 | * Avoid excessively long or circular lists: | 84 | * Avoid excessively long or circular lists: |
@@ -103,10 +103,10 @@ compat_sys_set_robust_list(struct compat_robust_list_head __user *head, | |||
103 | } | 103 | } |
104 | 104 | ||
105 | asmlinkage long | 105 | asmlinkage long |
106 | compat_sys_get_robust_list(int pid, compat_uptr_t *head_ptr, | 106 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, |
107 | compat_size_t __user *len_ptr) | 107 | compat_size_t __user *len_ptr) |
108 | { | 108 | { |
109 | struct compat_robust_list_head *head; | 109 | struct compat_robust_list_head __user *head; |
110 | unsigned long ret; | 110 | unsigned long ret; |
111 | 111 | ||
112 | if (!pid) | 112 | if (!pid) |
diff --git a/kernel/relay.c b/kernel/relay.c index 1d63ecddfa70..f04bbdb56ac2 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -887,7 +887,7 @@ static int subbuf_read_actor(size_t read_start, | |||
887 | 887 | ||
888 | from = buf->start + read_start; | 888 | from = buf->start + read_start; |
889 | ret = avail; | 889 | ret = avail; |
890 | if (copy_to_user(desc->arg.data, from, avail)) { | 890 | if (copy_to_user(desc->arg.buf, from, avail)) { |
891 | desc->error = -EFAULT; | 891 | desc->error = -EFAULT; |
892 | ret = 0; | 892 | ret = 0; |
893 | } | 893 | } |
@@ -946,24 +946,17 @@ typedef int (*subbuf_actor_t) (size_t read_start, | |||
946 | */ | 946 | */ |
947 | static inline ssize_t relay_file_read_subbufs(struct file *filp, | 947 | static inline ssize_t relay_file_read_subbufs(struct file *filp, |
948 | loff_t *ppos, | 948 | loff_t *ppos, |
949 | size_t count, | ||
950 | subbuf_actor_t subbuf_actor, | 949 | subbuf_actor_t subbuf_actor, |
951 | read_actor_t actor, | 950 | read_actor_t actor, |
952 | void *target) | 951 | read_descriptor_t *desc) |
953 | { | 952 | { |
954 | struct rchan_buf *buf = filp->private_data; | 953 | struct rchan_buf *buf = filp->private_data; |
955 | size_t read_start, avail; | 954 | size_t read_start, avail; |
956 | read_descriptor_t desc; | ||
957 | int ret; | 955 | int ret; |
958 | 956 | ||
959 | if (!count) | 957 | if (!desc->count) |
960 | return 0; | 958 | return 0; |
961 | 959 | ||
962 | desc.written = 0; | ||
963 | desc.count = count; | ||
964 | desc.arg.data = target; | ||
965 | desc.error = 0; | ||
966 | |||
967 | mutex_lock(&filp->f_dentry->d_inode->i_mutex); | 960 | mutex_lock(&filp->f_dentry->d_inode->i_mutex); |
968 | do { | 961 | do { |
969 | if (!relay_file_read_avail(buf, *ppos)) | 962 | if (!relay_file_read_avail(buf, *ppos)) |
@@ -974,19 +967,19 @@ static inline ssize_t relay_file_read_subbufs(struct file *filp, | |||
974 | if (!avail) | 967 | if (!avail) |
975 | break; | 968 | break; |
976 | 969 | ||
977 | avail = min(desc.count, avail); | 970 | avail = min(desc->count, avail); |
978 | ret = subbuf_actor(read_start, buf, avail, &desc, actor); | 971 | ret = subbuf_actor(read_start, buf, avail, desc, actor); |
979 | if (desc.error < 0) | 972 | if (desc->error < 0) |
980 | break; | 973 | break; |
981 | 974 | ||
982 | if (ret) { | 975 | if (ret) { |
983 | relay_file_read_consume(buf, read_start, ret); | 976 | relay_file_read_consume(buf, read_start, ret); |
984 | *ppos = relay_file_read_end_pos(buf, read_start, ret); | 977 | *ppos = relay_file_read_end_pos(buf, read_start, ret); |
985 | } | 978 | } |
986 | } while (desc.count && ret); | 979 | } while (desc->count && ret); |
987 | mutex_unlock(&filp->f_dentry->d_inode->i_mutex); | 980 | mutex_unlock(&filp->f_dentry->d_inode->i_mutex); |
988 | 981 | ||
989 | return desc.written; | 982 | return desc->written; |
990 | } | 983 | } |
991 | 984 | ||
992 | static ssize_t relay_file_read(struct file *filp, | 985 | static ssize_t relay_file_read(struct file *filp, |
@@ -994,8 +987,13 @@ static ssize_t relay_file_read(struct file *filp, | |||
994 | size_t count, | 987 | size_t count, |
995 | loff_t *ppos) | 988 | loff_t *ppos) |
996 | { | 989 | { |
997 | return relay_file_read_subbufs(filp, ppos, count, subbuf_read_actor, | 990 | read_descriptor_t desc; |
998 | NULL, buffer); | 991 | desc.written = 0; |
992 | desc.count = count; | ||
993 | desc.arg.buf = buffer; | ||
994 | desc.error = 0; | ||
995 | return relay_file_read_subbufs(filp, ppos, subbuf_read_actor, | ||
996 | NULL, &desc); | ||
999 | } | 997 | } |
1000 | 998 | ||
1001 | static ssize_t relay_file_sendfile(struct file *filp, | 999 | static ssize_t relay_file_sendfile(struct file *filp, |
@@ -1004,8 +1002,13 @@ static ssize_t relay_file_sendfile(struct file *filp, | |||
1004 | read_actor_t actor, | 1002 | read_actor_t actor, |
1005 | void *target) | 1003 | void *target) |
1006 | { | 1004 | { |
1007 | return relay_file_read_subbufs(filp, ppos, count, subbuf_send_actor, | 1005 | read_descriptor_t desc; |
1008 | actor, target); | 1006 | desc.written = 0; |
1007 | desc.count = count; | ||
1008 | desc.arg.data = target; | ||
1009 | desc.error = 0; | ||
1010 | return relay_file_read_subbufs(filp, ppos, subbuf_send_actor, | ||
1011 | actor, &desc); | ||
1009 | } | 1012 | } |
1010 | 1013 | ||
1011 | struct file_operations relay_file_operations = { | 1014 | struct file_operations relay_file_operations = { |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 637d55608de5..aa9bfd0bdbd1 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -160,13 +160,13 @@ static inline int tag_get(struct radix_tree_node *node, unsigned int tag, | |||
160 | 160 | ||
161 | static inline void root_tag_set(struct radix_tree_root *root, unsigned int tag) | 161 | static inline void root_tag_set(struct radix_tree_root *root, unsigned int tag) |
162 | { | 162 | { |
163 | root->gfp_mask |= (1 << (tag + __GFP_BITS_SHIFT)); | 163 | root->gfp_mask |= (__force gfp_t)(1 << (tag + __GFP_BITS_SHIFT)); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | static inline void root_tag_clear(struct radix_tree_root *root, unsigned int tag) | 167 | static inline void root_tag_clear(struct radix_tree_root *root, unsigned int tag) |
168 | { | 168 | { |
169 | root->gfp_mask &= ~(1 << (tag + __GFP_BITS_SHIFT)); | 169 | root->gfp_mask &= (__force gfp_t)~(1 << (tag + __GFP_BITS_SHIFT)); |
170 | } | 170 | } |
171 | 171 | ||
172 | static inline void root_tag_clear_all(struct radix_tree_root *root) | 172 | static inline void root_tag_clear_all(struct radix_tree_root *root) |
@@ -176,7 +176,7 @@ static inline void root_tag_clear_all(struct radix_tree_root *root) | |||
176 | 176 | ||
177 | static inline int root_tag_get(struct radix_tree_root *root, unsigned int tag) | 177 | static inline int root_tag_get(struct radix_tree_root *root, unsigned int tag) |
178 | { | 178 | { |
179 | return root->gfp_mask & (1 << (tag + __GFP_BITS_SHIFT)); | 179 | return (__force unsigned)root->gfp_mask & (1 << (tag + __GFP_BITS_SHIFT)); |
180 | } | 180 | } |
181 | 181 | ||
182 | /* | 182 | /* |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index da9cfe927158..60a508eb1945 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -62,7 +62,7 @@ int vlan_dev_rebuild_header(struct sk_buff *skb) | |||
62 | default: | 62 | default: |
63 | printk(VLAN_DBG | 63 | printk(VLAN_DBG |
64 | "%s: unable to resolve type %X addresses.\n", | 64 | "%s: unable to resolve type %X addresses.\n", |
65 | dev->name, (int)veth->h_vlan_encapsulated_proto); | 65 | dev->name, ntohs(veth->h_vlan_encapsulated_proto)); |
66 | 66 | ||
67 | memcpy(veth->h_source, dev->dev_addr, ETH_ALEN); | 67 | memcpy(veth->h_source, dev->dev_addr, ETH_ALEN); |
68 | break; | 68 | break; |
diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/ipv4/ipvs/ip_vs_ftp.c index e433cb0ff894..6d398f10aa91 100644 --- a/net/ipv4/ipvs/ip_vs_ftp.c +++ b/net/ipv4/ipvs/ip_vs_ftp.c | |||
@@ -274,7 +274,7 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
274 | while (data <= data_limit - 6) { | 274 | while (data <= data_limit - 6) { |
275 | if (strnicmp(data, "PASV\r\n", 6) == 0) { | 275 | if (strnicmp(data, "PASV\r\n", 6) == 0) { |
276 | /* Passive mode on */ | 276 | /* Passive mode on */ |
277 | IP_VS_DBG(7, "got PASV at %zd of %zd\n", | 277 | IP_VS_DBG(7, "got PASV at %td of %td\n", |
278 | data - data_start, | 278 | data - data_start, |
279 | data_limit - data_start); | 279 | data_limit - data_start); |
280 | cp->app_data = &ip_vs_ftp_pasv; | 280 | cp->app_data = &ip_vs_ftp_pasv; |
diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c index a154b1d71c0f..56292ab7d652 100644 --- a/net/irda/irias_object.c +++ b/net/irda/irias_object.c | |||
@@ -43,7 +43,7 @@ struct ias_value irias_missing = { IAS_MISSING, 0, 0, 0, {0}}; | |||
43 | * | 43 | * |
44 | * Faster, check boundary... Jean II | 44 | * Faster, check boundary... Jean II |
45 | */ | 45 | */ |
46 | static char *strndup(char *str, int max) | 46 | static char *strndup(char *str, size_t max) |
47 | { | 47 | { |
48 | char *new_str; | 48 | char *new_str; |
49 | int len; | 49 | int len; |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 447d9aef4605..1f0f079ffa65 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -1146,10 +1146,11 @@ out: | |||
1146 | return ret; | 1146 | return ret; |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | u32 * | 1149 | static __be32 * |
1150 | svcauth_gss_prepare_to_wrap(struct xdr_buf *resbuf, struct gss_svc_data *gsd) | 1150 | svcauth_gss_prepare_to_wrap(struct xdr_buf *resbuf, struct gss_svc_data *gsd) |
1151 | { | 1151 | { |
1152 | u32 *p, verf_len; | 1152 | __be32 *p; |
1153 | u32 verf_len; | ||
1153 | 1154 | ||
1154 | p = gsd->verf_start; | 1155 | p = gsd->verf_start; |
1155 | gsd->verf_start = NULL; | 1156 | gsd->verf_start = NULL; |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 32d778448a00..acfb852e7c98 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -941,7 +941,7 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock, | |||
941 | int sz_to_copy; | 941 | int sz_to_copy; |
942 | int sz_copied = 0; | 942 | int sz_copied = 0; |
943 | int needed; | 943 | int needed; |
944 | char *crs = m->msg_iov->iov_base; | 944 | char __user *crs = m->msg_iov->iov_base; |
945 | unsigned char *buf_crs; | 945 | unsigned char *buf_crs; |
946 | u32 err; | 946 | u32 err; |
947 | int res; | 947 | int res; |
@@ -1496,7 +1496,7 @@ static int setsockopt(struct socket *sock, | |||
1496 | return -ENOPROTOOPT; | 1496 | return -ENOPROTOOPT; |
1497 | if (ol < sizeof(value)) | 1497 | if (ol < sizeof(value)) |
1498 | return -EINVAL; | 1498 | return -EINVAL; |
1499 | if ((res = get_user(value, (u32 *)ov))) | 1499 | if ((res = get_user(value, (u32 __user *)ov))) |
1500 | return res; | 1500 | return res; |
1501 | 1501 | ||
1502 | if (down_interruptible(&tsock->sem)) | 1502 | if (down_interruptible(&tsock->sem)) |
@@ -1541,7 +1541,7 @@ static int setsockopt(struct socket *sock, | |||
1541 | */ | 1541 | */ |
1542 | 1542 | ||
1543 | static int getsockopt(struct socket *sock, | 1543 | static int getsockopt(struct socket *sock, |
1544 | int lvl, int opt, char __user *ov, int *ol) | 1544 | int lvl, int opt, char __user *ov, int __user *ol) |
1545 | { | 1545 | { |
1546 | struct tipc_sock *tsock = tipc_sk(sock->sk); | 1546 | struct tipc_sock *tsock = tipc_sk(sock->sk); |
1547 | int len; | 1547 | int len; |
diff --git a/sound/core/hwdep_compat.c b/sound/core/hwdep_compat.c index 938f77580966..3827c0ceec8f 100644 --- a/sound/core/hwdep_compat.c +++ b/sound/core/hwdep_compat.c | |||
@@ -33,7 +33,7 @@ struct snd_hwdep_dsp_image32 { | |||
33 | static int snd_hwdep_dsp_load_compat(struct snd_hwdep *hw, | 33 | static int snd_hwdep_dsp_load_compat(struct snd_hwdep *hw, |
34 | struct snd_hwdep_dsp_image32 __user *src) | 34 | struct snd_hwdep_dsp_image32 __user *src) |
35 | { | 35 | { |
36 | struct snd_hwdep_dsp_image *dst; | 36 | struct snd_hwdep_dsp_image __user *dst; |
37 | compat_caddr_t ptr; | 37 | compat_caddr_t ptr; |
38 | u32 val; | 38 | u32 val; |
39 | 39 | ||