Subversion Repositories HelenOS

Rev

Rev 4140 | Rev 4223 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4140 Rev 4220
Line 60... Line 60...
60
 *
60
 *
61
 * @return      Virtual address of the page where the device is mapped.
61
 * @return      Virtual address of the page where the device is mapped.
62
 */
62
 */
63
uintptr_t hw_map(uintptr_t physaddr, size_t size)
63
uintptr_t hw_map(uintptr_t physaddr, size_t size)
64
{
64
{
-
 
65
    if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
-
 
66
        panic("Unable to map physical memory %p (%d bytes).", physaddr, size)
-
 
67
   
-
 
68
    uintptr_t virtaddr = PA2KA(last_frame);
-
 
69
    pfn_t i;
-
 
70
    for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) {
-
 
71
        uintptr_t addr = PFN2ADDR(i);
-
 
72
        page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, PAGE_NOT_CACHEABLE | PAGE_WRITE);
-
 
73
    }
-
 
74
   
-
 
75
    last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);
-
 
76
   
65
    return PA2KA(physaddr);
77
    return virtaddr;
66
}
78
}
67
 
79
 
68
/** @}
80
/** @}
69
 */
81
 */