Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mips: add <asm-generic/io.h> including

With the adding, some default ioremap_xx methods defined in
asm-generic/io.h can be used. E.g the default ioremap_uc() returning
NULL.

We also massaged various headers to avoid nested includes.

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
[jiaxun.yang@flygoat.com: Massage more headers, fix ioport defines]
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

authored by

Jiaxun Yang and committed by
Arnd Bergmann
4bfb53e7 b85ea95d

+75 -35
+68 -28
arch/mips/include/asm/io.h
··· 13 13 #define _ASM_IO_H 14 14 15 15 #include <linux/compiler.h> 16 - #include <linux/kernel.h> 17 16 #include <linux/types.h> 18 17 #include <linux/irqflags.h> 19 18 ··· 24 25 #include <asm/cpu-features.h> 25 26 #include <asm/page.h> 26 27 #include <asm/pgtable-bits.h> 27 - #include <asm/processor.h> 28 28 #include <asm/string.h> 29 29 #include <mangle-port.h> 30 30 ··· 38 40 # define __raw_ioswabl(a, x) (x) 39 41 # define __raw_ioswabq(a, x) (x) 40 42 # define ____raw_ioswabq(a, x) (x) 43 + 44 + # define _ioswabb ioswabb 45 + # define _ioswabw ioswabw 46 + # define _ioswabl ioswabl 47 + # define _ioswabq ioswabq 41 48 42 49 # define __relaxed_ioswabb ioswabb 43 50 # define __relaxed_ioswabw ioswabw ··· 129 126 * almost all conceivable cases a device driver should not be using 130 127 * this function 131 128 */ 129 + #define phys_to_virt phys_to_virt 132 130 static inline void * phys_to_virt(unsigned long address) 133 131 { 134 132 return __va(address); ··· 300 296 return pfx##ioswab##bwlq(__mem, __val); \ 301 297 } 302 298 303 - #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax, p) \ 299 + #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax) \ 304 300 \ 305 - static inline void pfx##out##bwlq##p(type val, unsigned long port) \ 301 + static inline void pfx##out##bwlq(type val, unsigned long port) \ 306 302 { \ 307 303 volatile type *__addr; \ 308 304 type __val; \ ··· 322 318 *__addr = __val; \ 323 319 } \ 324 320 \ 325 - static inline type pfx##in##bwlq##p(unsigned long port) \ 321 + static inline type pfx##in##bwlq(unsigned long port) \ 326 322 { \ 327 323 volatile type *__addr; \ 328 324 type __val; \ ··· 364 360 #endif 365 361 366 362 #define __BUILD_IOPORT_PFX(bus, bwlq, type) \ 367 - __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0,) \ 368 - __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0, _p) 363 + __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0) 369 364 370 365 #define BUILDIO_IOPORT(bwlq, type) \ 371 - __BUILD_IOPORT_PFX(, bwlq, type) \ 366 + __BUILD_IOPORT_PFX(_, bwlq, type) \ 372 367 __BUILD_IOPORT_PFX(__mem_, bwlq, type) 373 368 374 369 BUILDIO_IOPORT(b, u8) ··· 414 411 __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr)) 415 412 #define writeq_be(val, addr) \ 416 413 __raw_writeq(cpu_to_be64((val)), (__force unsigned *)(addr)) 417 - 418 - /* 419 - * Some code tests for these symbols 420 - */ 421 - #ifdef CONFIG_64BIT 422 - #define readq readq 423 - #define writeq writeq 424 - #endif 425 414 426 415 #define __BUILD_MEMORY_STRING(bwlq, type) \ 427 416 \ ··· 475 480 BUILDSTRING(q, u64) 476 481 #endif 477 482 478 - static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) 479 - { 480 - memset((void __force *) addr, val, count); 481 - } 482 - static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) 483 - { 484 - memcpy(dst, (void __force *) src, count); 485 - } 486 - static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) 487 - { 488 - memcpy((void __force *) dst, src, count); 489 - } 490 483 491 484 /* 492 485 * The caches on some architectures aren't dma-coherent and have need to ··· 531 548 #define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v)) 532 549 #define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST)) 533 550 551 + 552 + #define __raw_readb __raw_readb 553 + #define __raw_readw __raw_readw 554 + #define __raw_readl __raw_readl 555 + #ifdef CONFIG_64BIT 556 + #define __raw_readq __raw_readq 557 + #endif 558 + #define __raw_writeb __raw_writeb 559 + #define __raw_writew __raw_writew 560 + #define __raw_writel __raw_writel 561 + #ifdef CONFIG_64BIT 562 + #define __raw_writeq __raw_writeq 563 + #endif 564 + 565 + #define readb readb 566 + #define readw readw 567 + #define readl readl 568 + #ifdef CONFIG_64BIT 569 + #define readq readq 570 + #endif 571 + #define writeb writeb 572 + #define writew writew 573 + #define writel writel 574 + #ifdef CONFIG_64BIT 575 + #define writeq writeq 576 + #endif 577 + 578 + #define readsb readsb 579 + #define readsw readsw 580 + #define readsl readsl 581 + #ifdef CONFIG_64BIT 582 + #define readsq readsq 583 + #endif 584 + #define writesb writesb 585 + #define writesw writesw 586 + #define writesl writesl 587 + #ifdef CONFIG_64BIT 588 + #define writesq writesq 589 + #endif 590 + 591 + #define _inb _inb 592 + #define _inw _inw 593 + #define _inl _inl 594 + #define insb insb 595 + #define insw insw 596 + #define insl insl 597 + 598 + #define _outb _outb 599 + #define _outw _outw 600 + #define _outl _outl 601 + #define outsb outsb 602 + #define outsw outsw 603 + #define outsl outsl 604 + 605 + 534 606 /* 535 607 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 536 608 * access ··· 594 556 #define unxlate_dev_mem_ptr(p, v) do { } while (0) 595 557 596 558 void __ioread64_copy(void *to, const void __iomem *from, size_t count); 559 + 560 + #include <asm-generic/io.h> 597 561 598 562 #endif /* _ASM_IO_H */
+2 -2
arch/mips/include/asm/mmiowb.h
··· 2 2 #ifndef _ASM_MMIOWB_H 3 3 #define _ASM_MMIOWB_H 4 4 5 - #include <asm/io.h> 5 + #include <asm/barrier.h> 6 6 7 - #define mmiowb() iobarrier_w() 7 + #define mmiowb() wmb() 8 8 9 9 #include <asm-generic/mmiowb.h> 10 10
-2
arch/mips/include/asm/smp-ops.h
··· 13 13 14 14 #include <linux/errno.h> 15 15 16 - #include <asm/mips-cps.h> 17 - 18 16 #ifdef CONFIG_SMP 19 17 20 18 #include <linux/cpumask.h>
+1 -3
arch/mips/include/asm/smp.h
··· 11 11 #ifndef __ASM_SMP_H 12 12 #define __ASM_SMP_H 13 13 14 - #include <linux/bitops.h> 14 + #include <linux/compiler.h> 15 15 #include <linux/linkage.h> 16 - #include <linux/smp.h> 17 16 #include <linux/threads.h> 18 17 #include <linux/cpumask.h> 19 18 20 - #include <linux/atomic.h> 21 19 #include <asm/smp-ops.h> 22 20 23 21 extern int smp_num_siblings;
+1
arch/mips/kernel/setup.c
··· 42 42 #include <asm/sections.h> 43 43 #include <asm/setup.h> 44 44 #include <asm/smp-ops.h> 45 + #include <asm/mips-cps.h> 45 46 #include <asm/prom.h> 46 47 #include <asm/fw/fw.h> 47 48
+3
arch/mips/pci/pci-ip27.c
··· 7 7 * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org) 8 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 9 9 */ 10 + 11 + #include <linux/io.h> 12 + 10 13 #include <asm/sn/addrs.h> 11 14 #include <asm/sn/types.h> 12 15 #include <asm/sn/klconfig.h>