Changeset 1c01e6c in mainline for kernel/arch/arm32/src/mm/page.c


Ignore:
Timestamp:
2011-11-26T16:37:37Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
056ddc30
Parents:
9aed144
Message:

Replace hw_map() implementations with one generic.
Currently the kernel is broken because of missing page allocator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/mm/page.c

    r9aed144 r1c01e6c  
    8282}
    8383
    84 /** Maps device into the kernel space.
    85  *
    86  * Maps physical address of device into kernel virtual address space (so it can
    87  * 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 
    11784/** @}
    11885 */
Note: See TracChangeset for help on using the changeset viewer.