Ignore:
File:
1 edited

Legend:

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

    rda1bafb ra422bc5  
    5959static btree_t parea_btree;
    6060
    61 /** Initialize DDI.
    62  *
    63  */
     61/** Initialize DDI. */
    6462void ddi_init(void)
    6563{
     
    9997 *
    10098 */
    101 static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages,
    102     unsigned int flags)
     99static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages, int flags)
    103100{
    104101        ASSERT(TASK);
     
    117114        backend_data.frames = pages;
    118115       
     116        ipl_t ipl = interrupts_disable();
     117       
    119118        /* Find the zone of the physical memory */
    120         irq_spinlock_lock(&zones.lock, true);
     119        spinlock_lock(&zones.lock);
    121120        size_t znum = find_zone(ADDR2PFN(pf), pages, 0);
    122121       
     
    125124                 * -> assume it is hardware device and allow mapping
    126125                 */
    127                 irq_spinlock_unlock(&zones.lock, true);
     126                spinlock_unlock(&zones.lock);
    128127                goto map;
    129128        }
     
    131130        if (zones.info[znum].flags & ZONE_FIRMWARE) {
    132131                /* Frames are part of firmware */
    133                 irq_spinlock_unlock(&zones.lock, true);
     132                spinlock_unlock(&zones.lock);
    134133                goto map;
    135134        }
    136135       
    137136        if (zone_flags_available(zones.info[znum].flags)) {
    138                 /*
    139                  * Frames are part of physical memory, check if the memory
     137                /* Frames are part of physical memory, check if the memory
    140138                 * region is enabled for mapping.
    141139                 */
    142                 irq_spinlock_unlock(&zones.lock, true);
     140                spinlock_unlock(&zones.lock);
    143141               
    144142                mutex_lock(&parea_lock);
     
    156154        }
    157155       
    158         irq_spinlock_unlock(&zones.lock, true);
    159        
     156        spinlock_unlock(&zones.lock);
    160157err:
     158        interrupts_restore(ipl);
    161159        return ENOENT;
    162160       
    163161map:
     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         irq_spinlock_lock(&tasks_lock, true);
     198        ipl_t ipl = interrupts_disable();
     199        spinlock_lock(&tasks_lock);
    199200       
    200201        task_t *task = task_find_by_id(id);
     
    206207                 * context.
    207208                 */
    208                 irq_spinlock_unlock(&tasks_lock, true);
     209                spinlock_unlock(&tasks_lock);
     210                interrupts_restore(ipl);
    209211                return ENOENT;
    210212        }
    211213       
    212214        /* Lock the task and release the lock protecting tasks_btree. */
    213         irq_spinlock_exchange(&tasks_lock, &task->lock);
     215        spinlock_lock(&task->lock);
     216        spinlock_unlock(&tasks_lock);
    214217       
    215218        int rc = ddi_iospace_enable_arch(task, ioaddr, size);
    216219       
    217         irq_spinlock_unlock(&task->lock, true);
     220        spinlock_unlock(&task->lock);
     221        interrupts_restore(ipl);
    218222       
    219223        return rc;
Note: See TracChangeset for help on using the changeset viewer.