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