Changeset 437 for trunk/kernel/devices
- Timestamp:
- Mar 28, 2018, 2:40:29 PM (7 years ago)
- Location:
- trunk/kernel/devices
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_dma.c
r408 r437 2 2 * dev_dma.c - DMA (Interrupt Controler Unit) generic device API implementation. 3 3 * 4 * Authors Alain Greiner (201 7)4 * Authors Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 90 90 thread_t * this = CURRENT_THREAD; 91 91 92 dma_dmsg("\n[DBG] %s : enters for thread %x / dst = %l /src = %l / size = %x\n", 93 __FUNCTION__ , this->trdid , dst_xp , src_xp , size ); 92 #if CONGIG_DEBUG_DEV_DMA 93 uint32_t cycle = (uint32_t)hal_get_cycles(); 94 if( CONGIG_DEBUG_DEV_DMA < cycle ) 95 printk("\n[DBG] %s : thread %x enters / dst %l / src %l / size = %x\n", 96 __FUNCTION__ , this, dst_xp, src_xp, size ); 97 #endif 94 98 95 99 // select DMA channel corresponding to core lid … … 112 116 chdev_register_command( dev_xp ); 113 117 114 dma_dmsg("\n[DBG] %s : completes for thread %x / error = %d\n", 115 __FUNCTION__ , this->trdid , this->dma_cmd.error ); 118 #if CONGIG_DEBUG_DEV_DMA 119 cycle = (uint32_t)hal_get_cycles(); 120 if( CONGIG_DEBUG_DEV_DMA < cycle ) 121 printk("\n[DBG] %s : thread %x exit / dst %l / src %l / size = %x\n", 122 __FUNCTION__ , this, dst_xp, src_xp, size ); 123 #endif 116 124 117 125 // return I/O operation status from calling thread descriptor -
trunk/kernel/devices/dev_dma.h
r14 r437 2 2 * dev_dma.h - DMA (Direct Memory Access) generic device API definition. 3 3 * 4 * Authors Alain Greiner (201 7)4 * Authors Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/kernel/devices/dev_fbf.c
r422 r437 2 2 * dev_fbf.c - FBF (Block Device Controler) generic device API implementation. 3 3 * 4 * Author Alain Greiner (2016 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 137 137 error = vmm_v2p_translate( CONFIG_KERNEL_IDENTITY_MAP , buffer , &buf_paddr ); 138 138 139 if( error ) 140 { 141 printk("\n[ERROR] in %s : cannot translate vaddr = %p in process %x\n", 142 __FUNCTION__ , buffer , this->process->pid ); 143 return EINVAL; 144 } 145 146 fbf_dmsg("\n[DBG] %s : thread %x in process %x / vaddr = %p / paddr = %l\n", 147 __FUNCTION__ , this->trdid , this->process->pid , buffer , buf_paddr ); 139 // check buffer is mapped 140 assert( (error == 0) , __FUNCTION__ , 141 "cannot translate vaddr = %p in process %x\n", buffer, this->process->pid ); 148 142 149 143 // get extended pointer on FBF chdev descriptor … … 162 156 163 157 // check offset and length versus FBF size 164 if( (offset + length) > (width * height) ) 165 { 166 printk("\n[ERROR] in %s : offset = %d / length = %d / width = %d / height = %d\n", 167 __FUNCTION__ , offset , length , width , height ); 168 return EINVAL; 169 } 158 assert( ((offset + length) <= (width * height)) , __FUNCTION__ , 159 "offset %d / length %d / width %d / height %d\n", offset, length, width, height ); 170 160 171 161 // compute extended pointers on frame buffer and memory buffer … … 186 176 uint32_t offset ) 187 177 { 178 179 #if CONFIG_DEBUG_DEV_FBF_RX 180 uint32_t cycle = (uint32_t)hal_get_cycle(); 181 if( CONFIG_DEBUG_DEV_FBF_RX < cycle ) 182 printk("\n[DBG] %s : thread %x enter / process %x / vaddr %x / size %x\n", 183 __FUNCTION__ , this, this->process->pid , buffer , buf_paddr ); 184 #endif 185 188 186 return dev_fbf_access( false , buffer , length , offset ); 187 188 #if CONFIG_DEBUG_DEV_FBF_RX 189 cycle = (uint32_t)hal_get_cycle(); 190 if( CONFIG_DEBUG_DEV_FBF_RX < cycle ) 191 printk("\n[DBG] %s : thread %x exit / process %x / vaddr %x / size %x\n", 192 __FUNCTION__ , this, this->process->pid , buffer , buf_paddr ); 193 #endif 194 189 195 } 190 196 … … 194 200 uint32_t offset ) 195 201 { 202 203 #if CONFIG_DEBUG_DEV_FBF_TX 204 uint32_t cycle = (uint32_t)hal_get_cycle(); 205 if( CONFIG_DEBUG_DEV_FBF_TX < cycle ) 206 printk("\n[DBG] %s : thread %x enter / process %x / vaddr %x / size %x\n", 207 __FUNCTION__ , this, this->process->pid , buffer , buf_paddr ); 208 #endif 209 196 210 return dev_fbf_access( true , buffer , length , offset ); 211 212 #if CONFIG_DEBUG_DEV_FBF_RX 213 cycle = (uint32_t)hal_get_cycle(); 214 if( CONFIG_DEBUG_DEV_FBF_RX < cycle ) 215 printk("\n[DBG] %s : thread %x exit / process %x / vaddr %x / size %x\n", 216 __FUNCTION__ , this, this->process->pid , buffer , buf_paddr ); 217 #endif 218 197 219 } -
trunk/kernel/devices/dev_ioc.c
r408 r437 2 2 * dev_ioc.c - IOC (Block Device Controler) generic device API implementation. 3 3 * 4 * Author Alain Greiner (2016 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 101 101 thread_t * this = CURRENT_THREAD; // pointer on client thread 102 102 103 ioc_dmsg("\n[DBG] %s : thread %x in process %x"104 " for lba = %x / buffer = %x / at cycle %d\n",105 __FUNCTION__ , this->trdid , this->process->pid ,106 lba , (intptr_t)buffer , hal_get_cycles() );107 108 103 // software L2/L3 cache coherence for memory buffer 109 104 if( chdev_dir.iob ) … … 130 125 chdev_register_command( dev_xp ); 131 126 132 ioc_dmsg("\n[DBG] in %s : thread %x in process %x"133 " completes / error = %d / at cycle %d\n",134 __FUNCTION__ , this->trdid , this->process->pid ,135 this->ioc_cmd.error , hal_get_cycles() );136 137 127 // return I/O operation status 138 128 return this->ioc_cmd.error; … … 145 135 uint32_t count ) 146 136 { 137 138 #if CONFIG_DEBUG_DEV_IOC_RX 139 uint32_t cycle = (uint32_t)hal_get_cycles(); 140 if( CONFIG_DEBUG_DEV_IOC_RX < cycle ) 141 printk("\n[DBG] %s : thread %x enters / lba %x / buffer %x / cycle %d\n", 142 __FUNCTION__ , this, lba, buffer, cycle ); 143 #endif 144 147 145 return dev_ioc_access( IOC_READ , buffer , lba , count ); 146 147 #if CONFIG_DEBUG_DEV_IOC_RX 148 cycle = (uint32_t)hal_get_cycles(); 149 if( CONFIG_DEBUG_DEV_IOC_RX < cycle ) 150 printk("\n[DBG] %s : thread %x exit / lba %x / buffer %x / cycle %d\n", 151 __FUNCTION__ , this, lba, buffer, cycle ); 152 #endif 153 148 154 } 149 155 … … 153 159 uint32_t count ) 154 160 { 161 162 #if CONFIG_DEBUG_DEV_IOC_TX 163 uint32_t cycle = (uint32_t)hal_get_cycles(); 164 if( CONFIG_DEBUG_DEV_IOC_TX < cycle ) 165 printk("\n[DBG] %s : thread %x enters / lba %x / buffer %x / cycle %d\n", 166 __FUNCTION__ , this, lba, buffer, cycle ); 167 #endif 168 155 169 return dev_ioc_access( IOC_WRITE , buffer , lba , count ); 170 171 #if CONFIG_DEBUG_DEV_IOC_TX 172 cycle = (uint32_t)hal_get_cycles(); 173 if( CONFIG_DEBUG_DEV_IOC_TX < cycle ) 174 printk("\n[DBG] %s : thread %x exit / lba %x / buffer %x / cycle %d\n", 175 __FUNCTION__ , this, lba, buffer, cycle ); 176 #endif 177 156 178 } 157 179 … … 164 186 thread_t * this = CURRENT_THREAD; 165 187 166 ioc_dmsg("\n[DBG] %s : core[%x,%d] enter for %d blocks / lba = %x / cycle %d\n", 167 __FUNCTION__ , local_cxy , this->core->lid , count , lba , hal_time_stamp() ); 188 #if CONFIG_DEBUG_DEV_IOC_RX 189 uint32_t cycle = (uint32_t)hal_get_cycles(); 190 if( CONFIG_DEBUG_DEV_IOC_RX < cycle ) 191 printk("\n[DBG] %s : thread %x enters / lba %x / buffer %x / cycle %d\n", 192 __FUNCTION__ , this, lba, buffer, cycle ); 193 #endif 168 194 169 195 // software L2/L3 cache coherence for memory buffer … … 201 227 dev_pic_enable_irq( lid , ioc_xp ); 202 228 203 ioc_dmsg("\n[DBG] %s : core[%x,%d] exit / error = %d / cycle %d\n", 204 __FUNCTION__ , local_cxy , this->core->lid , this->ioc_cmd.error , hal_time_stamp() ); 229 #if CONFIG_DEBUG_DEV_IOC_RX 230 cycle = (uint32_t)hal_get_cycles(); 231 if( CONFIG_DEBUG_DEV_IOC_RX < cycle ) 232 printk("\n[DBG] %s : thread %x exit / lba %x / buffer %x / cycle %d\n", 233 __FUNCTION__ , this, lba, buffer, cycle ); 234 #endif 205 235 206 236 // return I/O operation status from calling thread descriptor -
trunk/kernel/devices/dev_ioc.h
r246 r437 2 2 * dev_ioc.h - IOC (Block Device Controler) generic device API definition. 3 3 * 4 * Author Alain Greiner (2016 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/kernel/devices/dev_mmc.c
r407 r437 2 2 * dev_mmc.c - MMC (Memory Cache Controler) generic device API implementation. 3 3 * 4 * Author Alain Greiner (2016 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 99 99 thread_t * this = CURRENT_THREAD; 100 100 101 mmc_dmsg("\n[DBG] %s enters for thread %x in process %x / buf_xp = %l\n", 102 __FUNCTION__ , this->trdid , this->process->pid , buf_xp ); 101 #if CONFIG_DEBUG_DEV_MMC 102 uint32_t cycle = (uint32_t)hal_get_cycles(); 103 if( CONFIG_DEBUG_DEV_MMC < cycle ) 104 printk("\n[DBG] %s : thread %x enters / process %x / buf_xp = %l\n", 105 __FUNCTION__, this, this->process->pid , buf_xp ); 106 #endif 103 107 104 108 // get buffer cluster and local pointer … … 124 128 error = dev_mmc_access( this ); 125 129 126 mmc_dmsg("\n[DBG] %s completes for thread %x in process %x / error = %d\n", 127 __FUNCTION__ , this->trdid , this->process->pid , error ); 130 #if CONFIG_DEBUG_DEV_MMC 131 cycle = (uint32_t)hal_get_cycles(); 132 if( CONFIG_DEBUG_DEV_MMC < cycle ) 133 printk("\n[DBG] %s : thread %x exit / process %x / buf_xp = %l\n", 134 __FUNCTION__, this, this->process->pid , buf_xp ); 135 #endif 128 136 129 137 return error; … … 139 147 thread_t * this = CURRENT_THREAD; 140 148 141 mmc_dmsg("\n[DBG] %s enters for thread %x in process %x / buf_xp = %l\n", 142 __FUNCTION__ , this->trdid , this->process->pid , buf_xp ); 149 #if CONFIG_DEBUG_DEV_MMC 150 uint32_t cycle = (uint32_t)hal_get_cycles(); 151 if( CONFIG_DEBUG_DEV_MMC < cycle ) 152 printk("\n[DBG] %s : thread %x enters / process %x / buf_xp = %l\n", 153 __FUNCTION__, this, this->process->pid , buf_xp ); 154 #endif 143 155 144 156 // get buffer cluster and local pointer … … 164 176 error = dev_mmc_access( this ); 165 177 166 mmc_dmsg("\n[DBG] %s completes for thread %x in process %x / error = %d\n", 167 __FUNCTION__ , this->trdid , this->process->pid , error ); 178 #if CONFIG_DEBUG_DEV_MMC 179 cycle = (uint32_t)hal_get_cycles(); 180 if( CONFIG_DEBUG_DEV_MMC < cycle ) 181 printk("\n[DBG] %s : thread %x exit / process %x / buf_xp = %l\n", 182 __FUNCTION__, this, this->process->pid , buf_xp ); 183 #endif 168 184 169 185 return error; -
trunk/kernel/devices/dev_mmc.h
r23 r437 2 2 * dev_mmc.h - MMC (Generic L2 cache controller) device API definition. 3 3 * 4 * Authors Alain Greiner (2016 )4 * Authors Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/kernel/devices/dev_nic.c
r436 r437 2 2 * dev_nic.c - NIC (Network Controler) generic device API implementation. 3 3 * 4 * Author Alain Greiner (2016,2017 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 99 99 core_t * core = thread_ptr->core; 100 100 101 nic_dmsg("\n[DBG] %s enters for NIC-RX thread on core %d in cluster %x\n", 102 __FUNCTION__ , core->lid , local_cxy ); 101 #if CONFIG_DEBUG_DEV_NIC_RX 102 uint32_t cycle = (uint32_t)hal_get_cycles(); 103 if( CONFIG_DEBUG_DEV_NIC_RX < cycle ) 104 printk("\n[DBG] %s : thread %x enters for packet %x in cluster %x\n", 105 __FUNCTION__ , thread_ptr , pkd , local_cxy ); 106 #endif 103 107 104 108 // get pointer on NIC-RX chdev descriptor … … 149 153 pkd->length = thread_ptr->nic_cmd.length; 150 154 151 nic_dmsg("\n[DBG] %s exit for NIC-RX thread on core %d in cluster %x\n", 152 __FUNCTION__ , core->lid , local_cxy ); 155 #if CONFIG_DEBUG_DEV_NIC_RX 156 cycle = (uint32_t)hal_get_cycles(); 157 if( CONFIG_DEBUG_DEV_NIC_RX < cycle ) 158 printk("\n[DBG] %s : thread %x exit for packet %x in cluster %x\n", 159 __FUNCTION__ , thread_ptr , pkd , local_cxy ); 160 #endif 153 161 154 162 return 0; … … 169 177 core_t * core = thread_ptr->core; 170 178 171 nic_dmsg("\n[DBG] %s enters for NIC-RX thread on core %d in cluster %x\n", 172 __FUNCTION__ , core->lid , local_cxy ); 179 #if CONFIG_DEBUG_DEV_NIC_RX 180 uint32_t cycle = (uint32_t)hal_get_cycles(); 181 if( CONFIG_DEBUG_DEV_NIC_RX < cycle ) 182 printk("\n[DBG] %s : thread %x enters for packet %x in cluster %x\n", 183 __FUNCTION__ , thread_ptr , pkd , local_cxy ); 184 #endif 173 185 174 186 // get pointer on NIC-TX chdev descriptor … … 217 229 if( error ) return error; 218 230 219 nic_dmsg("\n[DBG] %s exit for NIC-TX thread on core %d in cluster %x\n", 220 __FUNCTION__ , core->lid , local_cxy ); 231 #if CONFIG_DEBUG_DEV_NIC_RX 232 cycle = (uint32_t)hal_get_cycles(); 233 if( CONFIG_DEBUG_DEV_NIC_RX < cycle ) 234 printk("\n[DBG] %s : thread %x exit for packet %x in cluster %x\n", 235 __FUNCTION__ , thread_ptr , pkd , local_cxy ); 236 #endif 221 237 222 238 return 0; -
trunk/kernel/devices/dev_nic.h
r407 r437 2 2 * dev_nic.h - NIC (Network Controler) generic device API definition. 3 3 * 4 * Author Alain Greiner (2016 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/kernel/devices/dev_pic.c
r422 r437 2 2 * dev_pic.c - PIC (External Interrupt Controler) generic device API implementation. 3 3 * 4 * Authors Alain Greiner (2016 )4 * Authors Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 86 86 { 87 87 88 irq_dmsg("\n[DBG] %s : core = [%x,%d] / src_chdev_cxy = %x / src_chdev_ptr = %x\n", 89 __FUNCTION__ , local_cxy , lid , GET_CXY(src_chdev_xp) , GET_PTR(src_chdev_xp) ); 88 #if CONFIG_DEBUG_DEV_PIC 89 uint32_t cycle = (uint32_t)hal_get_cycles(); 90 if( CONFIG_DEBUG_DEV_PIC < cycle ) 91 printk("\n[DBG] %s : core[%x,%d] / src_chdev_cxy %x / src_chdev_ptr %x / cycle %d\n", 92 __FUNCTION__, local_cxy, lid, GET_CXY(src_chdev_xp), GET_PTR(src_chdev_xp), cycle ); 93 #endif 90 94 91 95 // get pointer on PIC chdev … … 105 109 { 106 110 107 irq_dmsg("\n[DBG] %s : core = [%x,%d] / src_chdev_cxy = %x / src_chdev_ptr = %x\n", 108 __FUNCTION__ , local_cxy , lid , GET_CXY(src_chdev_xp) , GET_PTR(src_chdev_xp) ); 111 #if CONFIG_DEBUG_DEV_PIC 112 uint32_t cycle = (uint32_t)hal_get_cycles(); 113 if( CONFIG_DEBUG_DEV_PIC < cycle ) 114 printk("\n[DBG] %s : core[%x,%d] / src_chdev_cxy %x / src_chdev_ptr %x / cycle %d\n", 115 __FUNCTION__, local_cxy, lid, GET_CXY(src_chdev_xp), GET_PTR(src_chdev_xp), cycle ); 116 #endif 109 117 110 118 // get pointer on PIC chdev … … 123 131 { 124 132 125 irq_dmsg("\n[DBG] %s : core = [%x,%d] / period = %d\n", 126 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , period ); 133 #if CONFIG_DEBUG_DEV_PIC 134 uint32_t cycle = (uint32_t)hal_get_cycles(); 135 if( CONFIG_DEBUG_DEV_PIC < cycle ) 136 printk("\n[DBG] %s : core[%x,%d] / period %d / cycle %d\n", 137 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , period, cycle ); 138 #endif 127 139 128 140 // get pointer on PIC chdev … … 141 153 { 142 154 143 irq_dmsg("\n[DBG] %s : core = [%x,%d] / cycle %d\n", 144 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , hal_time_stamp() ); 155 #if CONFIG_DEBUG_DEV_PIC 156 uint32_t cycle = (uint32_t)hal_get_cycles(); 157 if( CONFIG_DEBUG_DEV_PIC < cycle ) 158 printk("\n[DBG] %s : core[%x,%d] / cycle %d\n", 159 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , cycle ); 160 #endif 145 161 146 162 // get pointer on PIC chdev … … 160 176 { 161 177 162 irq_dmsg("\n[DBG] %s : src_core = [%x,%d] / dst_core = [%x,%d] / cycle %d\n", 163 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, cxy, lid, hal_time_stamp() ); 178 #if CONFIG_DEBUG_DEV_PIC 179 uint32_t cycle = (uint32_t)hal_get_cycles(); 180 if( CONFIG_DEBUG_DEV_PIC < cycle ) 181 printk("\n[DBG] %s : src_core[%x,%d] / dst_core[%x,%d] / cycle %d\n", 182 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, cxy, lid, cycle ); 183 #endif 164 184 165 185 // get pointer on PIC chdev … … 178 198 { 179 199 180 irq_dmsg("\n[DBG] %s : core = [%x,%d] / cycle %d\n", 181 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, hal_time_stamp() ); 200 #if CONFIG_DEBUG_DEV_PIC 201 uint32_t cycle = (uint32_t)hal_get_cycles(); 202 if( CONFIG_DEBUG_DEV_PIC < cycle ) 203 printk("\n[DBG] %s : core[%x,%d] / cycle %d\n", 204 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, cycle ); 205 #endif 182 206 183 207 // get pointer on PIC chdev -
trunk/kernel/devices/dev_pic.h
r407 r437 2 2 * dev_pic.h - PIC (Programmable Interrupt Controler) generic device API definition. 3 3 * 4 * Authors Alain Greiner (2016 )4 * Authors Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites
Note: See TracChangeset
for help on using the changeset viewer.