Changes in kernel/generic/src/ddi/ddi.c [da1bafb:a422bc5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ddi/ddi.c
rda1bafb ra422bc5 59 59 static btree_t parea_btree; 60 60 61 /** Initialize DDI. 62 * 63 */ 61 /** Initialize DDI. */ 64 62 void ddi_init(void) 65 63 { … … 99 97 * 100 98 */ 101 static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages, 102 unsigned int flags) 99 static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages, int flags) 103 100 { 104 101 ASSERT(TASK); … … 117 114 backend_data.frames = pages; 118 115 116 ipl_t ipl = interrupts_disable(); 117 119 118 /* Find the zone of the physical memory */ 120 irq_spinlock_lock(&zones.lock, true);119 spinlock_lock(&zones.lock); 121 120 size_t znum = find_zone(ADDR2PFN(pf), pages, 0); 122 121 … … 125 124 * -> assume it is hardware device and allow mapping 126 125 */ 127 irq_spinlock_unlock(&zones.lock, true);126 spinlock_unlock(&zones.lock); 128 127 goto map; 129 128 } … … 131 130 if (zones.info[znum].flags & ZONE_FIRMWARE) { 132 131 /* Frames are part of firmware */ 133 irq_spinlock_unlock(&zones.lock, true);132 spinlock_unlock(&zones.lock); 134 133 goto map; 135 134 } 136 135 137 136 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 140 138 * region is enabled for mapping. 141 139 */ 142 irq_spinlock_unlock(&zones.lock, true);140 spinlock_unlock(&zones.lock); 143 141 144 142 mutex_lock(&parea_lock); … … 156 154 } 157 155 158 irq_spinlock_unlock(&zones.lock, true); 159 156 spinlock_unlock(&zones.lock); 160 157 err: 158 interrupts_restore(ipl); 161 159 return ENOENT; 162 160 163 161 map: 162 interrupts_restore(ipl); 163 164 164 if (!as_area_create(TASK->as, flags, pages * PAGE_SIZE, vp, 165 165 AS_AREA_ATTR_NONE, &phys_backend, &backend_data)) { … … 196 196 return EPERM; 197 197 198 irq_spinlock_lock(&tasks_lock, true); 198 ipl_t ipl = interrupts_disable(); 199 spinlock_lock(&tasks_lock); 199 200 200 201 task_t *task = task_find_by_id(id); … … 206 207 * context. 207 208 */ 208 irq_spinlock_unlock(&tasks_lock, true); 209 spinlock_unlock(&tasks_lock); 210 interrupts_restore(ipl); 209 211 return ENOENT; 210 212 } 211 213 212 214 /* 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); 214 217 215 218 int rc = ddi_iospace_enable_arch(task, ioaddr, size); 216 219 217 irq_spinlock_unlock(&task->lock, true); 220 spinlock_unlock(&task->lock); 221 interrupts_restore(ipl); 218 222 219 223 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.