Subversion Repositories HelenOS

Rev

Rev 4344 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4344 Rev 4691
Line 95... Line 95...
95
 *         is no task matching the specified ID or the physical address space
95
 *         is no task matching the specified ID or the physical address space
96
 *         is not enabled for mapping and ENOMEM if there was a problem in
96
 *         is not enabled for mapping and ENOMEM if there was a problem in
97
 *         creating address space area.
97
 *         creating address space area.
98
 *
98
 *
99
 */
99
 */
100
static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, count_t pages, int flags)
100
static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages, int flags)
101
{
101
{
102
    ASSERT(TASK);
102
    ASSERT(TASK);
103
    ASSERT((pf % FRAME_SIZE) == 0);
103
    ASSERT((pf % FRAME_SIZE) == 0);
104
    ASSERT((vp % PAGE_SIZE) == 0);
104
    ASSERT((vp % PAGE_SIZE) == 0);
105
   
105
   
Line 116... Line 116...
116
   
116
   
117
    ipl_t ipl = interrupts_disable();
117
    ipl_t ipl = interrupts_disable();
118
   
118
   
119
    /* Find the zone of the physical memory */
119
    /* Find the zone of the physical memory */
120
    spinlock_lock(&zones.lock);
120
    spinlock_lock(&zones.lock);
121
    count_t znum = find_zone(ADDR2PFN(pf), pages, 0);
121
    size_t znum = find_zone(ADDR2PFN(pf), pages, 0);
122
   
122
   
123
    if (znum == (count_t) -1) {
123
    if (znum == (size_t) -1) {
124
        /* Frames not found in any zones
124
        /* Frames not found in any zones
125
         * -> assume it is hardware device and allow mapping
125
         * -> assume it is hardware device and allow mapping
126
         */
126
         */
127
        spinlock_unlock(&zones.lock);
127
        spinlock_unlock(&zones.lock);
128
        goto map;
128
        goto map;
Line 240... Line 240...
240
unative_t sys_physmem_map(unative_t phys_base, unative_t virt_base,
240
unative_t sys_physmem_map(unative_t phys_base, unative_t virt_base,
241
    unative_t pages, unative_t flags)
241
    unative_t pages, unative_t flags)
242
{
242
{
243
    return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
243
    return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
244
        FRAME_SIZE), ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE),
244
        FRAME_SIZE), ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE),
245
        (count_t) pages, (int) flags);
245
        (size_t) pages, (int) flags);
246
}
246
}
247
 
247
 
248
/** Wrapper for SYS_ENABLE_IOSPACE syscall.
248
/** Wrapper for SYS_ENABLE_IOSPACE syscall.
249
 *
249
 *
250
 * @param uspace_io_arg User space address of DDI argument structure.
250
 * @param uspace_io_arg User space address of DDI argument structure.