Ignore:
File:
1 edited

Legend:

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

    ra422bc5 rda1bafb  
    5959static btree_t parea_btree;
    6060
    61 /** Initialize DDI. */
     61/** Initialize DDI.
     62 *
     63 */
    6264void ddi_init(void)
    6365{
     
    9799 *
    98100 */
    99 static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages, int flags)
     101static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages,
     102    unsigned int flags)
    100103{
    101104        ASSERT(TASK);
     
    114117        backend_data.frames = pages;
    115118       
    116         ipl_t ipl = interrupts_disable();
    117        
    118119        /* Find the zone of the physical memory */
    119         spinlock_lock(&zones.lock);
     120        irq_spinlock_lock(&zones.lock, true);
    120121        size_t znum = find_zone(ADDR2PFN(pf), pages, 0);
    121122       
     
    124125                 * -> assume it is hardware device and allow mapping
    125126                 */
    126                 spinlock_unlock(&zones.lock);
     127                irq_spinlock_unlock(&zones.lock, true);
    127128                goto map;
    128129        }
     
    130131        if (zones.info[znum].flags & ZONE_FIRMWARE) {
    131132                /* Frames are part of firmware */
    132                 spinlock_unlock(&zones.lock);
     133                irq_spinlock_unlock(&zones.lock, true);
    133134                goto map;
    134135        }
    135136       
    136137        if (zone_flags_available(zones.info[znum].flags)) {
    137                 /* Frames are part of physical memory, check if the memory
     138                /*
     139                 * Frames are part of physical memory, check if the memory
    138140                 * region is enabled for mapping.
    139141                 */
    140                 spinlock_unlock(&zones.lock);
     142                irq_spinlock_unlock(&zones.lock, true);
    141143               
    142144                mutex_lock(&parea_lock);
     
    154156        }
    155157       
    156         spinlock_unlock(&zones.lock);
     158        irq_spinlock_unlock(&zones.lock, true);
     159       
    157160err:
    158         interrupts_restore(ipl);
    159161        return ENOENT;
    160162       
    161163map:
    162         interrupts_restore(ipl);
    163 
    164164        if (!as_area_create(TASK->as, flags, pages * PAGE_SIZE, vp,
    165165            AS_AREA_ATTR_NONE, &phys_backend, &backend_data)) {
     
    196196                return EPERM;
    197197       
    198         ipl_t ipl = interrupts_disable();
    199         spinlock_lock(&tasks_lock);
     198        irq_spinlock_lock(&tasks_lock, true);
    200199       
    201200        task_t *task = task_find_by_id(id);
     
    207206                 * context.
    208207                 */
    209                 spinlock_unlock(&tasks_lock);
    210                 interrupts_restore(ipl);
     208                irq_spinlock_unlock(&tasks_lock, true);
    211209                return ENOENT;
    212210        }
    213211       
    214212        /* Lock the task and release the lock protecting tasks_btree. */
    215         spinlock_lock(&task->lock);
    216         spinlock_unlock(&tasks_lock);
     213        irq_spinlock_exchange(&tasks_lock, &task->lock);
    217214       
    218215        int rc = ddi_iospace_enable_arch(task, ioaddr, size);
    219216       
    220         spinlock_unlock(&task->lock);
    221         interrupts_restore(ipl);
     217        irq_spinlock_unlock(&task->lock, true);
    222218       
    223219        return rc;
Note: See TracChangeset for help on using the changeset viewer.