This source file includes following definitions.
- ioremap
- __iounmap
1
2
3
4
5
6
7
8 #include <linux/io.h>
9 #include <linux/vmalloc.h>
10 #include <linux/mm.h>
11
12 void __iomem *ioremap(unsigned long phys_addr, unsigned long size)
13 {
14 unsigned long last_addr, addr;
15 unsigned long offset = phys_addr & ~PAGE_MASK;
16 struct vm_struct *area;
17
18 pgprot_t prot = __pgprot(_PAGE_PRESENT|_PAGE_READ|_PAGE_WRITE
19 |(__HEXAGON_C_DEV << 6));
20
21 last_addr = phys_addr + size - 1;
22
23
24 if (!size || (last_addr < phys_addr))
25 return NULL;
26
27
28 size = PAGE_ALIGN(offset + size);
29
30 area = get_vm_area(size, VM_IOREMAP);
31 addr = (unsigned long)area->addr;
32
33 if (ioremap_page_range(addr, addr+size, phys_addr, prot)) {
34 vunmap((void *)addr);
35 return NULL;
36 }
37
38 return (void __iomem *) (offset + addr);
39 }
40
41 void __iounmap(const volatile void __iomem *addr)
42 {
43 vunmap((void *) ((unsigned long) addr & PAGE_MASK));
44 }