Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d4673296 in mainline


Ignore:
Timestamp:
2012-01-27T21:12:25Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
adec5b45
Parents:
4dee0cb
Message:

Move hw_map() to km.c

Location:
kernel
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/mach/gta02/gta02.c

    r4dee0cb rd4673296  
    3838#include <arch/mm/page.h>
    3939#include <mm/page.h>
     40#include <mm/km.h>
    4041#include <genarch/fb/fb.h>
    4142#include <abi/fb/visuals.h>
  • kernel/arch/arm32/src/mach/integratorcp/integratorcp.c

    r4dee0cb rd4673296  
    4545#include <mm/page.h>
    4646#include <mm/frame.h>
     47#include <mm/km.h>
    4748#include <arch/mm/frame.h>
    4849#include <arch/mach/integratorcp/integratorcp.h>
  • kernel/arch/arm32/src/mach/testarm/testarm.c

    r4dee0cb rd4673296  
    3737#include <arch/mach/testarm/testarm.h>
    3838#include <mm/page.h>
     39#include <mm/km.h>
    3940#include <genarch/fb/fb.h>
    4041#include <abi/fb/visuals.h>
  • kernel/arch/ia32/src/smp/smp.c

    r4dee0cb rd4673296  
    4747#include <debug.h>
    4848#include <arch/asm.h>
     49#include <mm/page.h>
    4950#include <mm/frame.h>
    50 #include <mm/page.h>
     51#include <mm/km.h>
    5152#include <mm/slab.h>
    5253#include <mm/as.h>
  • kernel/arch/ia64/src/ia64.c

    r4dee0cb rd4673296  
    5353#include <genarch/srln/srln.h>
    5454#include <mm/page.h>
     55#include <mm/km.h>
    5556
    5657#ifdef MACHINE_ski
  • kernel/arch/ppc32/src/drivers/pic.c

    r4dee0cb rd4673296  
    3434
    3535#include <arch/drivers/pic.h>
    36 #include <mm/page.h>
     36#include <mm/km.h>
    3737#include <byteorder.h>
    3838#include <bitops.h>
  • kernel/arch/ppc32/src/ppc32.c

    r4dee0cb rd4673296  
    4646#include <userspace.h>
    4747#include <mm/page.h>
     48#include <mm/km.h>
    4849#include <abi/proc/uarg.h>
    4950#include <console/console.h>
  • kernel/arch/sparc64/src/drivers/kbd.c

    r4dee0cb rd4673296  
    4040#include <mm/page.h>
    4141#include <arch/mm/page.h>
     42#include <mm/km.h>
    4243#include <typedefs.h>
    4344#include <align.h>
  • kernel/arch/sparc64/src/drivers/pci.c

    r4dee0cb rd4673296  
    3939#include <genarch/ofw/upa.h>
    4040#include <arch/trap/interrupt.h>
    41 #include <mm/page.h>
     41#include <mm/km.h>
    4242#include <mm/slab.h>
    4343#include <typedefs.h>
  • kernel/genarch/src/drivers/ega/ega.c

    r4dee0cb rd4673296  
    3737#include <genarch/drivers/ega/ega.h>
    3838#include <putchar.h>
    39 #include <mm/page.h>
     39#include <mm/km.h>
    4040#include <mm/as.h>
    4141#include <mm/slab.h>
    42 #include <arch/mm/page.h>
    4342#include <typedefs.h>
    4443#include <arch/asm.h>
  • kernel/genarch/src/drivers/s3c24xx_uart/s3c24xx_uart.c

    r4dee0cb rd4673296  
    4545#include <mm/slab.h>
    4646#include <mm/page.h>
     47#include <mm/km.h>
    4748#include <sysinfo/sysinfo.h>
    4849#include <str.h>
  • kernel/genarch/src/fb/fb.c

    r4dee0cb rd4673296  
    4040#include <console/console.h>
    4141#include <sysinfo/sysinfo.h>
    42 #include <mm/page.h>
     42#include <mm/km.h>
    4343#include <mm/slab.h>
    4444#include <align.h>
  • kernel/generic/include/mm/km.h

    r4dee0cb rd4673296  
    4949extern bool km_is_non_identity(uintptr_t);
    5050
     51extern uintptr_t hw_map(uintptr_t, size_t);
     52
    5153extern uintptr_t km_temporary_page_get(uintptr_t *, frame_flags_t);
    5254extern void km_temporary_page_put(uintptr_t);
  • kernel/generic/include/mm/page.h

    r4dee0cb rd4673296  
    6666extern void map_structure(uintptr_t, size_t);
    6767
    68 extern uintptr_t hw_map(uintptr_t, size_t);
    69 
    7068extern int page_find_mapping(uintptr_t, void **);
    7169extern sysarg_t sys_page_find_mapping(uintptr_t, void *);
  • kernel/generic/src/mm/km.c

    r4dee0cb rd4673296  
    4646#include <debug.h>
    4747#include <arch.h>
     48#include <align.h>
     49#include <macros.h>
     50#include <bitops.h>
    4851
    4952static ra_arena_t *km_ni_arena;
     
    120123        ra_free(km_ni_arena, page, size);
    121124}
     125
     126uintptr_t hw_map(uintptr_t physaddr, size_t size)
     127{
     128        uintptr_t virtaddr;
     129        size_t asize;
     130        size_t align;
     131        pfn_t i;
     132
     133        asize = ALIGN_UP(size, PAGE_SIZE);
     134        align = ispwr2(size) ? size : (1U << (fnzb(size) + 1));
     135        virtaddr = km_page_alloc(asize, max(PAGE_SIZE, align));
     136
     137        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);
     142        }
     143        page_table_unlock(AS_KERNEL, true);
     144       
     145        return virtaddr;
     146}
     147
    122148
    123149/** Unmap kernen non-identity page.
  • kernel/generic/src/mm/page.c

    r4dee0cb rd4673296  
    6565#include <arch/mm/asid.h>
    6666#include <mm/as.h>
    67 #include <mm/km.h>
    6867#include <mm/frame.h>
    6968#include <arch/barrier.h>
     
    7675#include <errno.h>
    7776#include <align.h>
    78 #include <macros.h>
    79 #include <bitops.h>
    8077
    8178/** Virtual operations for page subsystem. */
     
    193190}
    194191
    195 uintptr_t hw_map(uintptr_t physaddr, size_t size)
    196 {
    197         uintptr_t virtaddr;
    198         size_t asize;
    199         size_t align;
    200         pfn_t i;
    201 
    202         asize = ALIGN_UP(size, PAGE_SIZE);
    203         align = ispwr2(size) ? size : (1U << (fnzb(size) + 1));
    204         virtaddr = km_page_alloc(asize, max(PAGE_SIZE, align));
    205 
    206         page_table_lock(AS_KERNEL, true);
    207         for (i = 0; i < ADDR2PFN(asize); i++) {
    208                 uintptr_t addr = PFN2ADDR(i);
    209                 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr,
    210                     PAGE_NOT_CACHEABLE | PAGE_WRITE);
    211         }
    212         page_table_unlock(AS_KERNEL, true);
    213        
    214         return virtaddr;
    215 }
    216 
    217192int page_find_mapping(uintptr_t virt, void **phys)
    218193{
Note: See TracChangeset for help on using the changeset viewer.