···1515#include <asm/page.h>1616#include <linux/types.h>1717#include <linux/mm.h> /* Get struct page {...} */1818-#include <asm-generic/iomap.h>19182019#ifndef CONFIG_PCI2120#define _IO_BASE 0···2425#define _IO_BASE isa_io_base2526#define _ISA_MEM_BASE isa_mem_base2627#define PCI_DRAM_OFFSET pci_dram_offset2727-#endif2828+struct pci_dev;2929+extern void pci_iounmap(struct pci_dev *dev, void __iomem *);3030+#define pci_iounmap pci_iounmap28312932extern unsigned long isa_io_base;3030-extern unsigned long pci_io_base;3133extern unsigned long pci_dram_offset;3232-3334extern resource_size_t isa_mem_base;3535+#endif34363737+#define PCI_IOBASE ((void __iomem *)_IO_BASE)3538#define IO_SPACE_LIMIT (0xFFFFFFFF)36393737-/* the following is needed to support PCI with some drivers */3838-3939-#define mmiowb()4040-4141-static inline unsigned char __raw_readb(const volatile void __iomem *addr)4242-{4343- return *(volatile unsigned char __force *)addr;4444-}4545-static inline unsigned short __raw_readw(const volatile void __iomem *addr)4646-{4747- return *(volatile unsigned short __force *)addr;4848-}4949-static inline unsigned int __raw_readl(const volatile void __iomem *addr)5050-{5151- return *(volatile unsigned int __force *)addr;5252-}5353-static inline unsigned long __raw_readq(const volatile void __iomem *addr)5454-{5555- return *(volatile unsigned long __force *)addr;5656-}5757-static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)5858-{5959- *(volatile unsigned char __force *)addr = v;6060-}6161-static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)6262-{6363- *(volatile unsigned short __force *)addr = v;6464-}6565-static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)6666-{6767- *(volatile unsigned int __force *)addr = v;6868-}6969-static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)7070-{7171- *(volatile unsigned long __force *)addr = v;7272-}7373-7474-/*7575- * read (readb, readw, readl, readq) and write (writeb, writew,7676- * writel, writeq) accessors are for PCI and thus little endian.7777- * Linux 2.4 for Microblaze had this wrong.7878- */7979-static inline unsigned char readb(const volatile void __iomem *addr)8080-{8181- return *(volatile unsigned char __force *)addr;8282-}8383-static inline unsigned short readw(const volatile void __iomem *addr)8484-{8585- return le16_to_cpu(*(volatile unsigned short __force *)addr);8686-}8787-static inline unsigned int readl(const volatile void __iomem *addr)8888-{8989- return le32_to_cpu(*(volatile unsigned int __force *)addr);9090-}9191-#define readq readq9292-static inline u64 readq(const volatile void __iomem *addr)9393-{9494- return le64_to_cpu(__raw_readq(addr));9595-}9696-static inline void writeb(unsigned char v, volatile void __iomem *addr)9797-{9898- *(volatile unsigned char __force *)addr = v;9999-}100100-static inline void writew(unsigned short v, volatile void __iomem *addr)101101-{102102- *(volatile unsigned short __force *)addr = cpu_to_le16(v);103103-}104104-static inline void writel(unsigned int v, volatile void __iomem *addr)105105-{106106- *(volatile unsigned int __force *)addr = cpu_to_le32(v);107107-}108108-#define writeq(b, addr) __raw_writeq(cpu_to_le64(b), addr)109109-110110-/* ioread and iowrite variants. thease are for now same as __raw_111111- * variants of accessors. we might check for endianess in the feature112112- */113113-#define ioread8(addr) __raw_readb((u8 *)(addr))114114-#define ioread16(addr) __raw_readw((u16 *)(addr))115115-#define ioread32(addr) __raw_readl((u32 *)(addr))116116-#define iowrite8(v, addr) __raw_writeb((u8)(v), (u8 *)(addr))117117-#define iowrite16(v, addr) __raw_writew((u16)(v), (u16 *)(addr))118118-#define iowrite32(v, addr) __raw_writel((u32)(v), (u32 *)(addr))119119-120120-#define ioread16be(addr) __raw_readw((u16 *)(addr))121121-#define ioread32be(addr) __raw_readl((u32 *)(addr))122122-#define iowrite16be(v, addr) __raw_writew((u16)(v), (u16 *)(addr))123123-#define iowrite32be(v, addr) __raw_writel((u32)(v), (u32 *)(addr))124124-125125-/* These are the definitions for the x86 IO instructions126126- * inb/inw/inl/outb/outw/outl, the "string" versions127127- * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions128128- * inb_p/inw_p/...129129- * The macros don't do byte-swapping.130130- */131131-#define inb(port) readb((u8 *)((unsigned long)(port)))132132-#define outb(val, port) writeb((val), (u8 *)((unsigned long)(port)))133133-#define inw(port) readw((u16 *)((unsigned long)(port)))134134-#define outw(val, port) writew((val), (u16 *)((unsigned long)(port)))135135-#define inl(port) readl((u32 *)((unsigned long)(port)))136136-#define outl(val, port) writel((val), (u32 *)((unsigned long)(port)))137137-138138-#define inb_p(port) inb((port))139139-#define outb_p(val, port) outb((val), (port))140140-#define inw_p(port) inw((port))141141-#define outw_p(val, port) outw((val), (port))142142-#define inl_p(port) inl((port))143143-#define outl_p(val, port) outl((val), (port))144144-145145-#define memset_io(a, b, c) memset((void *)(a), (b), (c))146146-#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))147147-#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))148148-14940#ifdef CONFIG_MMU150150-151151-#define phys_to_virt(addr) ((void *)__phys_to_virt(addr))152152-#define virt_to_phys(addr) ((unsigned long)__virt_to_phys(addr))153153-#define virt_to_bus(addr) ((unsigned long)__virt_to_phys(addr))154154-15541#define page_to_bus(page) (page_to_phys(page))156156-#define bus_to_virt(addr) (phys_to_virt(addr))1574215843extern void iounmap(void __iomem *addr);159159-/*extern void *__ioremap(phys_addr_t address, unsigned long size,160160- unsigned long flags);*/4444+16145extern void __iomem *ioremap(phys_addr_t address, unsigned long size);162162-#define ioremap_writethrough(addr, size) ioremap((addr), (size))163163-#define ioremap_nocache(addr, size) ioremap((addr), (size))164164-#define ioremap_fullcache(addr, size) ioremap((addr), (size))165165-166166-#else /* CONFIG_MMU */167167-168168-/**169169- * virt_to_phys - map virtual addresses to physical170170- * @address: address to remap171171- *172172- * The returned physical address is the physical (CPU) mapping for173173- * the memory address given. It is only valid to use this function on174174- * addresses directly mapped or allocated via kmalloc.175175- *176176- * This function does not give bus mappings for DMA transfers. In177177- * almost all conceivable cases a device driver should not be using178178- * this function179179- */180180-static inline unsigned long __iomem virt_to_phys(volatile void *address)181181-{182182- return __pa((unsigned long)address);183183-}184184-185185-#define virt_to_bus virt_to_phys186186-187187-/**188188- * phys_to_virt - map physical address to virtual189189- * @address: address to remap190190- *191191- * The returned virtual address is a current CPU mapping for192192- * the memory address given. It is only valid to use this function on193193- * addresses that have a kernel mapping194194- *195195- * This function does not handle bus mappings for DMA transfers. In196196- * almost all conceivable cases a device driver should not be using197197- * this function198198- */199199-static inline void *phys_to_virt(unsigned long address)200200-{201201- return (void *)__va(address);202202-}203203-204204-#define bus_to_virt(a) phys_to_virt(a)205205-206206-static inline void __iomem *__ioremap(phys_addr_t address, unsigned long size,207207- unsigned long flags)208208-{209209- return (void *)address;210210-}211211-212212-#define ioremap(physaddr, size) ((void __iomem *)(unsigned long)(physaddr))213213-#define iounmap(addr) ((void)0)214214-#define ioremap_nocache(physaddr, size) ioremap(physaddr, size)4646+#define ioremap_writethrough(addr, size) ioremap((addr), (size))4747+#define ioremap_nocache(addr, size) ioremap((addr), (size))4848+#define ioremap_fullcache(addr, size) ioremap((addr), (size))4949+#define ioremap_wc(addr, size) ioremap((addr), (size))2155021651#endif /* CONFIG_MMU */21752218218-/*219219- * Convert a physical pointer to a virtual kernel pointer for /dev/mem220220- * access221221- */222222-#define xlate_dev_mem_ptr(p) __va(p)223223-224224-/*225225- * Convert a virtual cached pointer to an uncached pointer226226- */227227-#define xlate_dev_kmem_ptr(p) p228228-229229-/*230230- * Big Endian231231- */5353+/* Big Endian */23254#define out_be32(a, v) __raw_writel((v), (void __iomem __force *)(a))23355#define out_be16(a, v) __raw_writew((v), (a))23456···59239#define writel_be(v, a) out_be32((__force unsigned *)a, v)60240#define readl_be(a) in_be32((__force unsigned *)a)612416262-/*6363- * Little endian6464- */6565-242242+/* Little endian */66243#define out_le32(a, v) __raw_writel(__cpu_to_le32(v), (a))67244#define out_le16(a, v) __raw_writew(__cpu_to_le16(v), (a))68245···70253#define out_8(a, v) __raw_writeb((v), (a))71254#define in_8(a) __raw_readb(a)722557373-#define mmiowb()7474-7575-#define ioport_map(port, nr) ((void __iomem *)(port))7676-#define ioport_unmap(addr)7777-7878-/* from asm-generic/io.h */7979-#ifndef insb8080-static inline void insb(unsigned long addr, void *buffer, int count)8181-{8282- if (count) {8383- u8 *buf = buffer;8484- do {8585- u8 x = inb(addr);8686- *buf++ = x;8787- } while (--count);8888- }8989-}9090-#endif9191-9292-#ifndef insw9393-static inline void insw(unsigned long addr, void *buffer, int count)9494-{9595- if (count) {9696- u16 *buf = buffer;9797- do {9898- u16 x = inw(addr);9999- *buf++ = x;100100- } while (--count);101101- }102102-}103103-#endif104104-105105-#ifndef insl106106-static inline void insl(unsigned long addr, void *buffer, int count)107107-{108108- if (count) {109109- u32 *buf = buffer;110110- do {111111- u32 x = inl(addr);112112- *buf++ = x;113113- } while (--count);114114- }115115-}116116-#endif117117-118118-#ifndef outsb119119-static inline void outsb(unsigned long addr, const void *buffer, int count)120120-{121121- if (count) {122122- const u8 *buf = buffer;123123- do {124124- outb(*buf++, addr);125125- } while (--count);126126- }127127-}128128-#endif129129-130130-#ifndef outsw131131-static inline void outsw(unsigned long addr, const void *buffer, int count)132132-{133133- if (count) {134134- const u16 *buf = buffer;135135- do {136136- outw(*buf++, addr);137137- } while (--count);138138- }139139-}140140-#endif141141-142142-#ifndef outsl143143-static inline void outsl(unsigned long addr, const void *buffer, int count)144144-{145145- if (count) {146146- const u32 *buf = buffer;147147- do {148148- outl(*buf++, addr);149149- } while (--count);150150- }151151-}152152-#endif153153-154154-#define ioread8_rep(p, dst, count) \155155- insb((unsigned long) (p), (dst), (count))156156-#define ioread16_rep(p, dst, count) \157157- insw((unsigned long) (p), (dst), (count))158158-#define ioread32_rep(p, dst, count) \159159- insl((unsigned long) (p), (dst), (count))160160-161161-#define iowrite8_rep(p, src, count) \162162- outsb((unsigned long) (p), (src), (count))163163-#define iowrite16_rep(p, src, count) \164164- outsw((unsigned long) (p), (src), (count))165165-#define iowrite32_rep(p, src, count) \166166- outsl((unsigned long) (p), (src), (count))256256+#include <asm-generic/io.h>167257168258#define readb_relaxed readb169259#define readw_relaxed readw
+1-1
arch/microblaze/kernel/signal.c
···216216 /* MS: I need add offset in page */217217 address += ((unsigned long)frame->tramp) & ~PAGE_MASK;218218 /* MS address is virtual */219219- address = virt_to_phys(address);219219+ address = __virt_to_phys(address);220220 invalidate_icache_range(address, address + 8);221221 flush_dcache_range(address, address + 8);222222 }
+1-1
arch/microblaze/mm/consistent.c
···117117 ret = (void *)va;118118119119 /* This gives us the real physical address of the first page. */120120- *dma_handle = pa = virt_to_bus((void *)vaddr);120120+ *dma_handle = pa = __virt_to_phys(vaddr);121121#endif122122123123 /*
+1-1
arch/microblaze/mm/init.c
···369369 if (initrd_start) {370370 unsigned long size;371371 size = initrd_end - initrd_start;372372- memblock_reserve(virt_to_phys(initrd_start), size);372372+ memblock_reserve(__virt_to_phys(initrd_start), size);373373 }374374#endif /* CONFIG_BLK_DEV_INITRD */375375
+3-2
arch/microblaze/mm/pgtable.c
···6969 *7070 * However, allow remap of rootfs: TBD7171 */7272+7273 if (mem_init_done &&7374 p >= memory_start && p < virt_to_phys(high_memory) &&7474- !(p >= virt_to_phys((unsigned long)&__bss_stop) &&7575- p < virt_to_phys((unsigned long)__bss_stop))) {7575+ !(p >= __virt_to_phys((phys_addr_t)__bss_stop) &&7676+ p < __virt_to_phys((phys_addr_t)__bss_stop))) {7677 pr_warn("__ioremap(): phys addr "PTE_FMT" is RAM lr %pf\n",7778 (unsigned long)p, __builtin_return_address(0));7879 return NULL;