Changeset adec5b45 in mainline for kernel/generic/src/mm/km.c


Ignore:
Timestamp:
2012-01-27T22:19:12Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1ccd0aa
Parents:
d4673296
Message:

Rename hw_map() to km_map() and add protection flags argument
to make it more generic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/km.c

    rd4673296 radec5b45  
    124124}
    125125
    126 uintptr_t hw_map(uintptr_t physaddr, size_t size)
    127 {
    128         uintptr_t virtaddr;
     126uintptr_t km_map(uintptr_t paddr, size_t size, unsigned int flags)
     127{
     128        uintptr_t vaddr;
    129129        size_t asize;
    130130        size_t align;
    131         pfn_t i;
     131        uintptr_t offs;
    132132
    133133        asize = ALIGN_UP(size, PAGE_SIZE);
    134134        align = ispwr2(size) ? size : (1U << (fnzb(size) + 1));
    135         virtaddr = km_page_alloc(asize, max(PAGE_SIZE, align));
     135        vaddr = km_page_alloc(asize, max(PAGE_SIZE, align));
    136136
    137137        page_table_lock(AS_KERNEL, true);
    138         for (i = 0; i < ADDR2PFN(asize); i++) {
    139                 uintptr_t addr = PFN2ADDR(i);
    140                 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr,
    141                     PAGE_NOT_CACHEABLE | PAGE_WRITE);
     138        for (offs = 0; offs < asize; offs += PAGE_SIZE) {
     139                page_mapping_insert(AS_KERNEL, vaddr + offs, paddr + offs,
     140                    flags);
    142141        }
    143142        page_table_unlock(AS_KERNEL, true);
    144143       
    145         return virtaddr;
     144        return vaddr;
    146145}
    147146
Note: See TracChangeset for help on using the changeset viewer.