Changeset 1c01e6c in mainline
- Timestamp:
- 2011-11-26T16:37:37Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 056ddc30
- Parents:
- 9aed144
- Location:
- kernel
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/abs32le/src/mm/page.c
r9aed144 r1c01e6c 56 56 } 57 57 58 59 uintptr_t hw_map(uintptr_t physaddr, size_t size)60 {61 return physaddr;62 }63 64 58 void page_fault(unsigned int n __attribute__((unused)), istate_t *istate) 65 59 { -
kernel/arch/amd64/src/mm/page.c
r9aed144 r1c01e6c 98 98 } 99 99 100 uintptr_t hw_map(uintptr_t physaddr, size_t size)101 {102 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))103 panic("Unable to map physical memory %p (%zu bytes).",104 (void *) physaddr, size);105 106 uintptr_t virtaddr = PA2KA(last_frame);107 pfn_t i;108 109 page_table_lock(AS_KERNEL, true);110 111 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++)112 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE);113 114 page_table_unlock(AS_KERNEL, true);115 116 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);117 118 return virtaddr;119 }120 121 100 /** @} 122 101 */ -
kernel/arch/arm32/src/mm/page.c
r9aed144 r1c01e6c 82 82 } 83 83 84 /** Maps device into the kernel space.85 *86 * Maps physical address of device into kernel virtual address space (so it can87 * be accessed only by kernel through virtual address).88 *89 * @param physaddr Physical address where device is connected.90 * @param size Length of area where device is present.91 *92 * @return Virtual address where device will be accessible.93 */94 uintptr_t hw_map(uintptr_t physaddr, size_t size)95 {96 if (last_frame + ALIGN_UP(size, PAGE_SIZE) >97 KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) {98 panic("Unable to map physical memory %p (%d bytes).",99 (void *) physaddr, size);100 }101 102 uintptr_t virtaddr = PA2KA(last_frame);103 pfn_t i;104 105 page_table_lock(AS_KERNEL, true);106 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) {107 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i),108 physaddr + PFN2ADDR(i),109 PAGE_NOT_CACHEABLE | PAGE_READ | PAGE_WRITE | PAGE_KERNEL);110 }111 page_table_unlock(AS_KERNEL, true);112 113 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);114 return virtaddr;115 }116 117 84 /** @} 118 85 */ -
kernel/arch/ia32/src/mm/page.c
r9aed144 r1c01e6c 85 85 } 86 86 87 88 uintptr_t hw_map(uintptr_t physaddr, size_t size)89 {90 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))91 panic("Unable to map physical memory %p (%zu bytes).",92 (void *) physaddr, size);93 94 uintptr_t virtaddr = PA2KA(last_frame);95 pfn_t i;96 page_table_lock(AS_KERNEL, true);97 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) {98 uintptr_t addr = PFN2ADDR(i);99 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, PAGE_NOT_CACHEABLE | PAGE_WRITE);100 }101 page_table_unlock(AS_KERNEL, true);102 103 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);104 105 return virtaddr;106 }107 108 87 void page_fault(unsigned int n __attribute__((unused)), istate_t *istate) 109 88 { -
kernel/arch/ia64/src/mm/page.c
r9aed144 r1c01e6c 255 255 } 256 256 257 uintptr_t hw_map(uintptr_t physaddr, size_t size __attribute__ ((unused)))258 {259 /* THIS is a dirty hack. */260 return (uintptr_t)((uint64_t)(PA2KA(physaddr)) + VIO_OFFSET);261 }262 263 257 /** @} 264 258 */ -
kernel/arch/mips32/src/mm/page.c
r9aed144 r1c01e6c 43 43 } 44 44 45 /** Map device into kernel space46 * - on mips, all devices are already mapped into kernel space,47 * translate the physical address to uncached area48 */49 uintptr_t hw_map(uintptr_t physaddr, size_t size)50 {51 return physaddr + 0xa0000000;52 }53 54 45 /** @} 55 46 */ -
kernel/arch/mips64/src/mm/page.c
r9aed144 r1c01e6c 43 43 } 44 44 45 /** Map device into kernel space46 * - on mips, all devices are already mapped into kernel space,47 * translate the physical address to uncached area48 */49 uintptr_t hw_map(uintptr_t physaddr, size_t size)50 {51 return physaddr + 0xffffffffa0000000;52 }53 54 45 /** @} 55 46 */ -
kernel/arch/ppc32/src/mm/page.c
r9aed144 r1c01e6c 46 46 } 47 47 48 uintptr_t hw_map(uintptr_t physaddr, size_t size)49 {50 if (last_frame + ALIGN_UP(size, PAGE_SIZE) >51 KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))52 panic("Unable to map physical memory %p (%zu bytes).",53 (void *) physaddr, size);54 55 uintptr_t virtaddr = PA2KA(last_frame);56 pfn_t i;57 page_table_lock(AS_KERNEL, true);58 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++)59 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i),60 physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE);61 page_table_unlock(AS_KERNEL, true);62 63 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);64 65 return virtaddr;66 }67 68 48 /** @} 69 49 */ -
kernel/arch/sparc64/src/mm/page.c
r9aed144 r1c01e6c 51 51 } 52 52 53 /** Map memory-mapped device into virtual memory.54 *55 * We are currently using identity mapping for mapping device registers.56 *57 * @param physaddr Physical address of the page where the device is58 * located.59 * @param size Size of the device's registers.60 *61 * @return Virtual address of the page where the device is mapped.62 *63 */64 uintptr_t hw_map(uintptr_t physaddr, size_t size)65 {66 return PA2KA(physaddr);67 }68 69 53 /** @} 70 54 */ -
kernel/generic/src/mm/page.c
r9aed144 r1c01e6c 74 74 #include <syscall/copy.h> 75 75 #include <errno.h> 76 #include <align.h> 76 77 77 78 /** Virtual operations for page subsystem. */ … … 175 176 return page_mapping_operations->mapping_find(as, page, nolock); 176 177 } 178 179 uintptr_t hw_map(uintptr_t physaddr, size_t size) 180 { 181 uintptr_t virtaddr = (uintptr_t) NULL; // FIXME 182 pfn_t i; 183 184 page_table_lock(AS_KERNEL, true); 185 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) { 186 uintptr_t addr = PFN2ADDR(i); 187 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, 188 PAGE_NOT_CACHEABLE | PAGE_WRITE); 189 } 190 page_table_unlock(AS_KERNEL, true); 191 192 return virtaddr; 193 } 194 177 195 178 196 /** Syscall wrapper for getting mapping of a virtual page.
Note:
See TracChangeset
for help on using the changeset viewer.