Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ddi/ddi.c

    r6f7071b r46e886f  
    4646#include <mm/frame.h>
    4747#include <mm/as.h>
     48#include <mm/km.h>
    4849#include <mm/page.h>
    4950#include <synch/mutex.h>
     
    5657#include <trace.h>
    5758#include <bitops.h>
     59#include <arch/asm.h>
    5860
    5961/** This lock protects the @c pareas ordered dictionary. */
     
    121123 *
    122124 */
    123 NO_TRACE static errno_t physmem_map(uintptr_t phys, size_t pages,
     125_NO_TRACE static errno_t physmem_map(uintptr_t phys, size_t pages,
    124126    unsigned int flags, uintptr_t *virt, uintptr_t bound)
    125127{
     
    227229}
    228230
    229 NO_TRACE static errno_t physmem_unmap(uintptr_t virt)
     231_NO_TRACE static errno_t physmem_unmap(uintptr_t virt)
    230232{
    231233        assert(TASK);
     
    312314 *
    313315 */
    314 NO_TRACE static errno_t iospace_enable(task_id_t id, uintptr_t ioaddr, size_t size)
     316_NO_TRACE static errno_t iospace_enable(task_id_t id, uintptr_t ioaddr, size_t size)
    315317{
    316318        /*
     
    353355 *
    354356 */
    355 NO_TRACE static errno_t iospace_disable(task_id_t id, uintptr_t ioaddr, size_t size)
     357_NO_TRACE static errno_t iospace_disable(task_id_t id, uintptr_t ioaddr, size_t size)
    356358{
    357359        /*
     
    413415}
    414416
    415 NO_TRACE static errno_t dmamem_map(uintptr_t virt, size_t size, unsigned int map_flags,
     417_NO_TRACE static errno_t dmamem_map(uintptr_t virt, size_t size, unsigned int map_flags,
    416418    unsigned int flags, uintptr_t *phys)
    417419{
     
    422424}
    423425
    424 NO_TRACE static errno_t dmamem_map_anonymous(size_t size, uintptr_t constraint,
     426_NO_TRACE static errno_t dmamem_map_anonymous(size_t size, uintptr_t constraint,
    425427    unsigned int map_flags, unsigned int flags, uintptr_t *phys,
    426428    uintptr_t *virt, uintptr_t bound)
     
    451453}
    452454
    453 NO_TRACE static errno_t dmamem_unmap(uintptr_t virt, size_t size)
     455_NO_TRACE static errno_t dmamem_unmap(uintptr_t virt, size_t size)
    454456{
    455457        // TODO: implement unlocking & unmap
     
    457459}
    458460
    459 NO_TRACE static errno_t dmamem_unmap_anonymous(uintptr_t virt)
     461_NO_TRACE static errno_t dmamem_unmap_anonymous(uintptr_t virt)
    460462{
    461463        return as_area_destroy(TASK->as, virt);
     
    527529                return dmamem_unmap_anonymous(virt);
    528530}
     531void *pio_map(void *phys, size_t size)
     532{
     533#ifdef IO_SPACE_BOUNDARY
     534        if (phys < IO_SPACE_BOUNDARY)
     535                return phys;
     536#endif
     537        return (void *) km_map((uintptr_t) phys, size, KM_NATURAL_ALIGNMENT,
     538            PAGE_READ | PAGE_WRITE | PAGE_NOT_CACHEABLE);
     539}
     540
     541void pio_unmap(void *phys, void *virt, size_t size)
     542{
     543#ifdef IO_SPACE_BOUNDARY
     544        if (phys < IO_SPACE_BOUNDARY)
     545                return;
     546#endif
     547        km_unmap((uintptr_t) virt, size);
     548}
    529549
    530550/** @}
Note: See TracChangeset for help on using the changeset viewer.