ioremap.c (c6e8b587718c486b55c2ebecc6de231a30beba35) | ioremap.c (c3455b0efc2b5b1bdc755602f77ce7f43725bf61) |
---|---|
1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * (C) Copyright 1995 1996 Linus Torvalds 7 * (C) Copyright 2001, 2002 Ralf Baechle 8 */ --- 88 unchanged lines hidden (view full) --- 97 dir++; 98 } while (address && (address < end)); 99 spin_unlock(&init_mm.page_table_lock); 100 flush_tlb_all(); 101 return error; 102} 103 104/* | 1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * (C) Copyright 1995 1996 Linus Torvalds 7 * (C) Copyright 2001, 2002 Ralf Baechle 8 */ --- 88 unchanged lines hidden (view full) --- 97 dir++; 98 } while (address && (address < end)); 99 spin_unlock(&init_mm.page_table_lock); 100 flush_tlb_all(); 101 return error; 102} 103 104/* |
105 * Allow physical addresses to be fixed up to help 36 bit peripherals. 106 */ 107phys_t __attribute__ ((weak)) 108fixup_bigphys_addr(phys_t phys_addr, phys_t size) 109{ 110 return phys_addr; 111} 112 113/* | |
114 * Generic mapping function (not visible outside): 115 */ 116 117/* 118 * Remap an arbitrary physical address space into the kernel virtual 119 * address space. Needed when the kernel wants to access high addresses 120 * directly. 121 * 122 * NOTE! We need to allow non-page-aligned mappings too: we will obviously 123 * have to convert them into an offset in a page-aligned mapping, but the 124 * caller shouldn't need to know that small detail. 125 */ 126 127#define IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL)) 128 | 105 * Generic mapping function (not visible outside): 106 */ 107 108/* 109 * Remap an arbitrary physical address space into the kernel virtual 110 * address space. Needed when the kernel wants to access high addresses 111 * directly. 112 * 113 * NOTE! We need to allow non-page-aligned mappings too: we will obviously 114 * have to convert them into an offset in a page-aligned mapping, but the 115 * caller shouldn't need to know that small detail. 116 */ 117 118#define IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL)) 119 |
129void * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags) | 120void __iomem * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags) |
130{ 131 struct vm_struct * area; 132 unsigned long offset; 133 phys_t last_addr; 134 void * addr; 135 136 phys_addr = fixup_bigphys_addr(phys_addr, size); 137 138 /* Don't allow wraparound or zero size */ 139 last_addr = phys_addr + size - 1; 140 if (!size || last_addr < phys_addr) 141 return NULL; 142 143 /* 144 * Map uncached objects in the low 512mb of address space using KSEG1, 145 * otherwise map using page tables. 146 */ 147 if (IS_LOW512(phys_addr) && IS_LOW512(last_addr) && 148 flags == _CACHE_UNCACHED) | 121{ 122 struct vm_struct * area; 123 unsigned long offset; 124 phys_t last_addr; 125 void * addr; 126 127 phys_addr = fixup_bigphys_addr(phys_addr, size); 128 129 /* Don't allow wraparound or zero size */ 130 last_addr = phys_addr + size - 1; 131 if (!size || last_addr < phys_addr) 132 return NULL; 133 134 /* 135 * Map uncached objects in the low 512mb of address space using KSEG1, 136 * otherwise map using page tables. 137 */ 138 if (IS_LOW512(phys_addr) && IS_LOW512(last_addr) && 139 flags == _CACHE_UNCACHED) |
149 return (void *) CKSEG1ADDR(phys_addr); | 140 return (void __iomem *) CKSEG1ADDR(phys_addr); |
150 151 /* 152 * Don't allow anybody to remap normal RAM that we're using.. 153 */ 154 if (phys_addr < virt_to_phys(high_memory)) { 155 char *t_addr, *t_end; 156 struct page *page; 157 --- 19 unchanged lines hidden (view full) --- 177 if (!area) 178 return NULL; 179 addr = area->addr; 180 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 181 vunmap(addr); 182 return NULL; 183 } 184 | 141 142 /* 143 * Don't allow anybody to remap normal RAM that we're using.. 144 */ 145 if (phys_addr < virt_to_phys(high_memory)) { 146 char *t_addr, *t_end; 147 struct page *page; 148 --- 19 unchanged lines hidden (view full) --- 168 if (!area) 169 return NULL; 170 addr = area->addr; 171 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 172 vunmap(addr); 173 return NULL; 174 } 175 |
185 return (void *) (offset + (char *)addr); | 176 return (void __iomem *) (offset + (char *)addr); |
186} 187 188#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) 189 190void __iounmap(volatile void __iomem *addr) 191{ 192 struct vm_struct *p; 193 --- 12 unchanged lines hidden --- | 177} 178 179#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) 180 181void __iounmap(volatile void __iomem *addr) 182{ 183 struct vm_struct *p; 184 --- 12 unchanged lines hidden --- |