- Timestamp:
- Mar 18, 2020, 11:16:59 PM (5 years ago)
- Location:
- trunk/hal
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/generic/hal_atomic.h
r587 r657 2 2 * hal_atomic.h - Generic Atomic Operations API definition. 3 3 * 4 * Authors Alain Greiner (2016 )4 * Authors Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/hal/generic/hal_remote.h
r629 r657 2 2 * hal_remote.h - Generic Remote Access API definition. 3 3 * 4 * Authors Alain Greiner (2016,2017,2018,2019 )4 * Authors Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/hal/generic/hal_uspace.h
r637 r657 2 2 * hal_uspace.h - Generic User Space Access API definition 3 3 * 4 * Authors Alain Greiner (2016,2017,2018,2019 )4 * Authors Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/hal/tsar_mips32/core/hal_macros.h
r570 r657 26 26 27 27 ////////////////////////////////////////////////////////////////////////////////////////// 28 // User-side, hardware dependant, macros definition.28 // Hardware dependant, macros definition. 29 29 // 30 30 // Any architecture specific implementation must implement these macros. -
trunk/hal/tsar_mips32/core/hal_remote.c
r647 r657 3 3 * 4 4 * Authors : Mohammed Karaoui (2015) 5 * Alain Greiner (2016 )5 * Alain Greiner (2016,2017,2018,2019) 6 6 * 7 7 * Copyright (c) UPMC Sorbonne Universites -
trunk/hal/tsar_mips32/core/hal_uspace.c
r654 r657 2 2 * hal_uspace.c - implementation of Generic User Space Access API for MIPS32 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 54 54 uint32_t dst = (uint32_t)GET_PTR( k_dst_xp ); 55 55 uint32_t cxy = (uint32_t)GET_CXY( k_dst_xp ); 56 57 56 58 57 #if DEBUG_HAL_USPACE -
trunk/hal/tsar_mips32/drivers/soclib_bdv.c
r647 r657 2 2 * soclib_bdv.c - soclib simple block device driver implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/hal/tsar_mips32/drivers/soclib_dma.c
r570 r657 2 2 * soclib_dma.c - soclib Multi Channels DMA driver implementation 3 3 * 4 * Author Alain Greiner (2017 )4 * Author Alain Greiner (2017,2018,2019,2020) 5 5 6 6 * Copyright (c) UPMC Sorbonne Universites … … 39 39 chdev->isr = &soclib_dma_isr; 40 40 41 // enable interrupts42 hal_remote_s32( XPTR( dma_cxy , dma_ptr + DMA_IRQ_DISABLED ) , 0);41 // disable interrupts 42 hal_remote_s32( XPTR( dma_cxy , dma_ptr + DMA_IRQ_DISABLED ) , 1 ); 43 43 44 44 } // soclib_dma_init() … … 47 47 void __attribute__ ((noinline)) soclib_dma_cmd( xptr_t thread_xp ) 48 48 { 49 bool_t sync; 49 50 xptr_t dev_xp; // extended pointer on DMA devive 50 51 xptr_t dst_xp; // extended pointer on destination buffer 51 52 xptr_t src_xp; // extended pointer on source buffer 52 53 uint32_t size; // buffer size 54 uint32_t status; // DMA status 53 55 54 56 // get client thread cluster and local pointer 55 cxy_t thread_cxy = GET_CXY( thread_xp ); 56 thread_t * thread_ptr = (thread_t *)GET_PTR( thread_xp ); 57 58 // get command arguments and extended pointer on DMA device 59 dev_xp = (xptr_t)hal_remote_l64( XPTR( thread_cxy , &thread_ptr->dma_cmd.dev_xp ) ); 60 dst_xp = (xptr_t)hal_remote_l64( XPTR( thread_cxy , &thread_ptr->dma_cmd.dst_xp ) ); 61 src_xp = (xptr_t)hal_remote_l64( XPTR( thread_cxy , &thread_ptr->dma_cmd.src_xp ) ); 62 size = hal_remote_l32 ( XPTR( thread_cxy , &thread_ptr->dma_cmd.size ) ); 57 cxy_t client_cxy = GET_CXY( thread_xp ); 58 thread_t * client_ptr = (thread_t *)GET_PTR( thread_xp ); 59 60 #if (DEBUG_HAL_IOC_RX || DEBUG_HAL_IOC_TX) 61 uint32_t cycle = (uint32_t)hal_get_cycles(); 62 thread_t * this = CURRENT_THREAD; 63 process_t * process = hal_remote_lpt( XPTR( th_cxy , &th_ptr->process ) ); 64 pid_t client_pid = hal_remote_l32( XPTR( th_cxy , &process->pid ) ); 65 trdid_t client_trdid = hal_remote_l32( XPTR( th_cxy , &th_ptr->trdid ) ); 66 #endif 67 68 // TODO both the client and the server threads are allways local, 69 // we could replace all these remote accesses by local accesses !!! [AG] 70 71 // get command arguments and extended pointer on DMA device descriptor 72 sync = hal_remote_l32( XPTR( client_cxy , &client_ptr->dma_cmd.sync ) ); 73 dev_xp = (xptr_t)hal_remote_l64( XPTR( client_cxy , &client_ptr->dma_cmd.dev_xp ) ); 74 dst_xp = (xptr_t)hal_remote_l64( XPTR( client_cxy , &client_ptr->dma_cmd.dst_xp ) ); 75 src_xp = (xptr_t)hal_remote_l64( XPTR( client_cxy , &client_ptr->dma_cmd.src_xp ) ); 76 size = hal_remote_l32( XPTR( client_cxy , &client_ptr->dma_cmd.size ) ); 63 77 64 78 // get DMA device cluster and local pointer … … 66 80 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 67 81 68 // get extended pointer on SOCLIB-DMA peripheral 69 xptr_t dma_xp = hal_remote_l32( XPTR( dev_cxy , &dev_ptr->base ) ); 70 71 // get SOCLIB_DMA device cluster and local pointer 82 // get pointers on DMA peripheral 83 xptr_t dma_xp = hal_remote_l32( XPTR( dev_cxy , &dev_ptr->base ) ); 72 84 cxy_t dma_cxy = GET_CXY( dma_xp ); 73 uint32_t * dma_ptr = (uint32_t *)GET_PTR( dma_xp );85 uint32_t * dma_ptr = GET_PTR( dma_xp ); 74 86 75 87 // get DMA channel index and channel base address … … 82 94 uint32_t src_msb = (uint32_t)(src_xp>>32); 83 95 84 // set SOCLIB_DMA registers to starttranfer operation96 // set SOCLIB_DMA registers and launch tranfer operation 85 97 hal_remote_s32( XPTR( dma_cxy , base + DMA_SRC ) , src_lsb ); 86 98 hal_remote_s32( XPTR( dma_cxy , base + DMA_SRC_EXT ) , src_msb ); 87 99 hal_remote_s32( XPTR( dma_cxy , base + DMA_DST ) , dst_lsb ); 88 100 hal_remote_s32( XPTR( dma_cxy , base + DMA_DST_EXT ) , dst_msb ); 89 hal_remote_s32( XPTR( dma_cxy , base + DMA_LEN ) , size ); 90 91 // Block and deschedule server thread 92 thread_block( XPTR( local_cxy , CURRENT_THREAD ) , THREAD_BLOCKED_ISR ); 93 sched_yield("blocked on ISR"); 94 101 hal_remote_s32( XPTR( dma_cxy , base + DMA_LEN_STS ) , size ); 102 103 #if DEBUG_HAL_DMA 104 if( DEBUG_HAL_DMA < cycle ) 105 printk("\n[%s] thread[%x,%x] launched DMA for client thread[%x,%x] / cycle %d\n", 106 __FUNCTION__, this->process->pid, this->trdid, client_pid, client_trdid, cycle ); 107 #endif 108 109 // waiting policy depends on the command type 110 // - for an asynchronous command, this function is called by the server thread 111 // => block and deschedule after launching the transfer. 112 // The operation status is reported in the command by the ISR, and the 113 // server thread is re-activated by the ISR. 114 // - for a synchronous command, this function is called by the client thread 115 // => mask the DMA_IRQ and poll the DMA status register until transfer completion, 116 // and reports status in the command when the transfer is completed. 117 118 if( sync ) // client thread poll status until completion 119 { 120 while( 1 ) 121 { 122 status = hal_remote_l32( XPTR( dma_cxy , base + DMA_LEN_STS ) ); 123 124 if( (status == DMA_SUCCESS) || (status == DMA_IDLE) ) 125 { 126 // set operation status in command 127 hal_remote_s32( XPTR( client_cxy , &client_ptr->dma_cmd.error ) , 0 ); 128 129 #if DEBUG_HAL_DMA 130 cycle = (uint32_t)hal_get_cycles(); 131 if( DEBUG_HAL_DMA < cycle ) 132 printk("\n[%s] thread[%x,%x] exit after SYNC success / cycle %d\n", 133 __FUNCTION__, this->process->pid, this->trdid, cycle ); 134 #endif 135 // exit while 136 break; 137 } 138 else if( (status == DMA_ERROR_READ) || (status == DMA_ERROR_WRITE) ) 139 { 140 // set operation status in command 141 hal_remote_s32( XPTR( client_cxy , &client_ptr->dma_cmd.error ) , 1 ); 142 143 #if DEBUG_HAL_DMA 144 cycle = (uint32_t)hal_get_cycles(); 145 if( DEBUG_HAL_DMA < cycle ) 146 printk("\n[%s] thread[%x,%x] exit after SYNC failure / cycle %d\n", 147 __FUNCTION__, this->process->pid, this->trdid, cycle ); 148 #endif 149 // exit while 150 break; 151 } 152 } 153 } 154 else // server thread block and deschedule 155 { 156 // server thread blocks on ISR 157 thread_block( XPTR( local_cxy , CURRENT_THREAD ) , THREAD_BLOCKED_ISR ); 158 159 // enable DMA interrupts 160 hal_remote_s32( XPTR( dma_cxy , dma_ptr + DMA_IRQ_DISABLED ) , 0 ); 161 162 // server thread deschedules 163 sched_yield("blocked on ISR"); 164 165 // disable DMA interrupts 166 hal_remote_s32( XPTR( dma_cxy , dma_ptr + DMA_IRQ_DISABLED ) , 1 ); 167 168 #if DEBUG_HAL_DMA 169 cycle = (uint32_t)hal_get_cycles(); 170 if( DEBUG_HAL_DMA < cycle ) 171 printk("\n[%s] thread[%x,%x] exit after ASYNC / client thread[%x,%x] / cycle %d\n", 172 __FUNCTION__ , this->process->pid, this->trdid, client_pid, client_trdid, cycle ); 173 #endif 174 175 } 95 176 } // soclib_dma_cmd() 96 177 … … 98 179 void __attribute__ ((noinline)) soclib_dma_isr( chdev_t * chdev ) 99 180 { 100 // get extended pointer on client thread 181 // get extended pointer on server thread 182 xptr_t server_xp = XPTR( local_cxy , &chdev->server ); 183 184 // get extended pointer on client thread 101 185 xptr_t root = XPTR( local_cxy , &chdev->wait_root ); 102 186 xptr_t client_xp = XLIST_FIRST( root , thread_t , wait_list ); 103 104 // get extended pointer on server thread105 xptr_t server_xp = XPTR( local_cxy , &chdev->server );106 187 107 188 // get client thread cluster and local pointer … … 113 194 uint32_t * dma_ptr = (uint32_t *)GET_PTR( chdev->base ); 114 195 115 // getDMA channel base address196 // build DMA channel base address 116 197 uint32_t * base = dma_ptr + (DMA_SPAN * chdev->channel); 117 198 118 199 // get DMA status register 119 uint32_t status = hal_remote_l32( XPTR( dma_cxy , base + DMA_LEN ) );200 uint32_t status = hal_remote_l32( XPTR( dma_cxy , base + DMA_LEN_STS ) ); 120 201 121 202 // acknowledge IRQ … … 129 210 thread_unblock( server_xp , THREAD_BLOCKED_ISR ); 130 211 131 // unblock client thread132 thread_unblock( client_xp , THREAD_BLOCKED_IO );133 134 212 } // soclib_dma_isr() 135 213 -
trunk/hal/tsar_mips32/drivers/soclib_dma.h
r75 r657 39 39 DMA_SRC = 0, /*! source buffer 32 LSB address bits */ 40 40 DMA_DST = 1, /*! source buffer 32 LSB address bits */ 41 DMA_LEN 41 DMA_LEN_STS = 2, /*! number of bytes (on write) / transfer status (on read) */ 42 42 DMA_RESET = 3, /*! desactivate channel (can be usde to acknowledge IRQ) */ 43 43 DMA_IRQ_DISABLED = 4, /*! no IRQ generated if non zero */ … … 60 60 61 61 /******************************************************************************************** 62 * This function access the SOCLIB_DMA hardware register to enable interrupts. 62 * This function access the SOCLIB_DMA hardware register to disable interrupts, 63 * because the most frequent operations are supposed to be synchronous accesses. 63 64 ******************************************************************************************** 64 65 * @ chdev : pointer on DMA chdev descriptor. … … 67 68 68 69 /******************************************************************************************** 69 * This function is called by the server thread associated to the DMA device. 70 * It access the command embedded in the calling thread descriptor, (format defined in the 71 * dev_dma.h file) and access the SOCLIB_DMA hardware registers to start command execution. 72 * Then it blocks on the THREAD_BLOCKED_DEV_ISR and deschedules, because each DMA channel 73 * can only execute one command at a given time. 74 * It is re-activated by the ISR signaling the transfer completion. 70 * This function can be called by the "server" thread associated to the DMA channel, for an 71 * asynchronous access, or can be directly called by the "client" thread for a synchronous 72 * access. In both cases, it get the command arguments from the calling thread descriptor, 73 * and access the DMA registers to launch the DMA transfer. 74 * Then, the waiting policy depends on the command type: 75 * - for asynchronous access, it enables the DMA interrupts, blocks on THREAD_BLOCKED_ISR, 76 * and deschedules. It will be re-activated by the soclib_dma_isr() function. 77 * - for a synchronous transfer, it polls the DMA status register until completion, 78 * and reports the transfer status in the command registered in the client thread. 75 79 ******************************************************************************************** 76 80 * @ thread_xp : extended pointer on the client thread. … … 80 84 /******************************************************************************************** 81 85 * This Interrupt Service Routine is executed when the IRQ signaling the completion of 82 * a DMA command is received by a core. It acknowledge the IRQ by accessing the proper83 * SOCLIB_DMA register, unblock the client thread, and unblock the server thread that84 * can starts execution of a new command if the waiting queue is not emppty.86 * an asynchronous DMA command is received by a core. It acknowledge the IRQ by accessing 87 * the proper SOCLIB_DMA register, reports the transfer status in the command registered 88 * in the client thread descriptor, and unblock the server thread. 85 89 ******************************************************************************************** 86 90 * @ chdev : pointer on DMA chdev descriptor. -
trunk/hal/tsar_mips32/drivers/soclib_fbf.c
r654 r657 2 2 * soclib_fbf.c - soclib frame-buffer driver implementation. 3 3 * 4 * Author Alain greiner (2016,2017,2018,2019 )4 * Author Alain greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 59 59 void __attribute__((noinline)) soclib_fbf_cmd( xptr_t thread_xp ) 60 60 { 61 uint32_t cmd_type; // READ / WRITE / SYNC_READ / SYNC_WRITE 62 uint32_t offset; 63 uint32_t length; 64 void * buffer; // pointer on memory buffer in user space 65 xptr_t fbf_xp; 61 uint32_t type; // USER_WRITE / USER_READ / KERNEL_WRITE / KERNEL_READ 62 uint32_t offset; // offset in FBF (in pixels) 63 uint32_t npixels; // number of pixels to move 64 xptr_t fbf_xp; // extended pointer on FBF chdev descriptor 66 65 uint32_t status; // I/0 operation status (from BDV) 66 void * buffer; // pointer on kernel or user buffer 67 67 68 68 // get client thread cluster and local pointer … … 78 78 79 79 // get command arguments 80 cmd_type = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.type) );81 offset = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.offset) );82 length = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.length) );83 buffer = hal_remote_lpt( XPTR( th_cxy , &th_ptr->fbf_cmd.buffer) );84 fbf_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->fbf_cmd.dev_xp) );80 type = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.type ) ); 81 offset = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.offset ) ); 82 npixels = hal_remote_l32( XPTR( th_cxy , &th_ptr->fbf_cmd.npixels ) ); 83 fbf_xp = hal_remote_l64( XPTR( th_cxy , &th_ptr->fbf_cmd.dev_xp ) ); 84 buffer = hal_remote_lpt( XPTR( th_cxy , &th_ptr->fbf_cmd.buffer ) ); 85 85 86 86 // get cluster and local pointer on FBF chdev … … 92 92 93 93 // execute command 94 if( cmd_type == FBF_READ ) // use a (kernel -> user) memcpy94 if( type == FBF_DRIVER_USER_WRITE ) // user_buffer => FBF 95 95 { 96 96 97 97 #if DEBUG_HAL_FBF 98 98 if( DEBUG_HAL_FBF < cycle ) 99 printk("\n[%s] client thread[%x,%x] / READ / offset %d / length %d / buffer %x / fbf (%x,%x)\n", 100 __FUNCTION__ , client_pid, client_trdid, 101 offset, length, buffer, GET_CXY(base_xp), GET_PTR(base_xp) ); 99 printk("\n[%s] client thread[%x,%x] / USER_WRITE / offset %d / npixels %d / buf %x\n", 100 __FUNCTION__ , client_pid, client_trdid, offset, npixels, buffer ); 102 101 #endif 103 hal_copy_to_uspace( buffer, 104 base_xp + offset, 105 length ); 106 #if DEBUG_HAL_FBF 107 if( DEBUG_HAL_FBF < cycle ) 108 printk("\n[%s] client thread[%x,%x] / READ successful / cycle %d\n", 109 __FUNCTION__ , client_pid, client_trdid , cycle ); 110 #endif 111 102 hal_copy_from_uspace( base_xp + offset, 103 buffer, 104 npixels ); 112 105 } 113 else // cmd_type == FBF_WRITE => use a (user -> kernel) memcpy106 else if( type == FBF_DRIVER_USER_READ ) // FBF => user_buffer 114 107 { 115 108 116 109 #if DEBUG_HAL_FBF 117 110 if( DEBUG_HAL_FBF < cycle ) 118 printk("\n[%s] client thread[%x,%x] / WRITE / offset %d / length %d / buffer %x / fbf (%x,%x)\n", 119 __FUNCTION__ , client_pid, client_trdid, 120 offset, length, buffer, GET_CXY(base_xp), GET_PTR(base_xp) ); 111 printk("\n[%s] client thread[%x,%x] / USER_READ / offset %d / npixels %d / buf %x\n", 112 __FUNCTION__ , client_pid, client_trdid, offset, npixels, buffer ); 121 113 #endif 122 hal_copy_from_uspace( base_xp + offset, 123 buffer, 124 length ); 114 hal_copy_to_uspace( buffer, 115 base_xp + offset, 116 npixels ); 117 } 118 else if( type == FBF_DRIVER_KERNEL_WRITE ) // kernel_buffer => FBF 119 { 120 125 121 #if DEBUG_HAL_FBF 126 122 if( DEBUG_HAL_FBF < cycle ) 127 printk("\n[%s] client thread[%x,%x] / WRITE successful / cycle %d\n",128 __FUNCTION__ , client_pid, client_trdid , cycle);123 printk("\n[%s] client thread[%x,%x] / KERNEL_WRITE / offset %d / npixels %d / buf %x\n", 124 __FUNCTION__ , client_pid, client_trdid, offset, npixels, buffer ); 129 125 #endif 126 hal_remote_memcpy( base_xp + offset, 127 XPTR( local_cxy , buffer ), 128 npixels ); 129 } 130 else if( type == FBF_DRIVER_KERNEL_READ ) // FBF => kernel_buffer 131 { 130 132 133 #if DEBUG_HAL_FBF 134 if( DEBUG_HAL_FBF < cycle ) 135 printk("\n[%s] client thread[%x,%x] / KERNEL_READ / offset %d / npixels %d / buf %x\n", 136 __FUNCTION__ , client_pid, client_trdid, offset, npixels, buffer ); 137 #endif 138 hal_remote_memcpy( XPTR( local_cxy , buffer ), 139 base_xp + offset, 140 npixels ); 131 141 } 132 142 133 143 // set success in command 134 144 hal_remote_s32( XPTR( th_cxy , &th_ptr->fbf_cmd.error ) , 0 ); 145 146 #if DEBUG_HAL_FBF 147 if( DEBUG_HAL_FBF < cycle ) 148 printk("\n[%s] client thread[%x,%x] / successful move / cycle %d\n", 149 __FUNCTION__ , client_pid, client_trdid , cycle ); 150 #endif 135 151 136 152 } // end soclib_fbf_cmd() -
trunk/hal/tsar_mips32/drivers/soclib_mmc.c
r654 r657 2 2 * soclib_mmc.c - soclib L2 cache driver implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019 )4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 18 18 * 19 19 * You should have received a copy of the GNU General Public License 20 * along with ALMOS-MKH .; if not, write to the Free Software Foundation,20 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 21 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 22 */ 23 24 23 25 24 #include <hal_kernel_types.h> … … 29 28 #include <thread.h> 30 29 #include <printk.h> 31 32 30 33 31 /////////////////////////////////////// … … 44 42 *(base + (SOCLIB_MMC_ERROR_FUNC << 7) + SOCLIB_MMC_ERROR_IRQ_ENABLE) = 1; 45 43 } 46 47 44 48 45 ////////////////////////////////////////////////////////////// … … 85 82 86 83 // set SOCLIB_MMC registers to start INVAL/SYNC operation 87 hal_remote_s32( XPTR( seg_cxy , seg_ptr + SOCLIB_MMC_ADDR_LO ) , (uint32_t)buf_ptr ); 88 hal_remote_s32( XPTR( seg_cxy , seg_ptr + SOCLIB_MMC_ADDR_HI ) , (uint32_t)dev_cxy ); 89 hal_remote_s32( XPTR( seg_cxy , seg_ptr + SOCLIB_MMC_BUF_LENGTH ) , buf_size ); 90 hal_remote_s32( XPTR( seg_cxy , seg_ptr + SOCLIB_MMC_CMD_TYPE ) , cc_cmd ); 84 hal_remote_s32( XPTR( seg_cxy , seg_ptr + 85 MMC_REG( SOCLIB_MMC_CC_FUNC , SOCLIB_MMC_ADDR_LO) ) , (uint32_t)buf_ptr ); 86 87 hal_remote_s32( XPTR( seg_cxy , seg_ptr + 88 MMC_REG( SOCLIB_MMC_CC_FUNC , SOCLIB_MMC_ADDR_HI) ) , dev_cxy ); 89 90 hal_remote_s32( XPTR( seg_cxy , seg_ptr + 91 MMC_REG( SOCLIB_MMC_CC_FUNC , SOCLIB_MMC_BUF_LENGTH) ) , buf_size ); 92 93 hal_remote_s32( XPTR( seg_cxy , seg_ptr + 94 MMC_REG( SOCLIB_MMC_CC_FUNC , SOCLIB_MMC_CMD_TYPE) ) , cc_cmd ); 91 95 } 92 else // (type == MMC_GET_ERROR) or (type == MMC_GET_ERROR) pr (type == MMC_GET_INSTRU)96 else if( (type == MMC_ERROR_GET) || (type == MMC_ERROR_SET) ) 93 97 { 94 98 // get src/dst buffer local pointer and register index 95 99 reg_ptr = (uint32_t *)hal_remote_lpt( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_ptr ) ); 96 reg_index = hal_remote_l32( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_index ) );100 reg_index = hal_remote_l32( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_index ) ); 97 101 98 // move register to/from local buffer 99 if( (type == MMC_GET_ERROR) || (type == MMC_GET_INSTRU) ) 100 { 101 *reg_ptr = hal_remote_l32( XPTR( seg_cxy , seg_ptr + reg_index ) ); 102 } 103 else // type == MMC_SET_ERROR 104 { 105 hal_remote_s32( XPTR( seg_cxy , seg_ptr + reg_index ) , *reg_ptr ); 106 } 102 // build extended pointer on relevant MMC register 103 xptr_t mmc_reg_xp = XPTR( seg_cxy , seg_ptr + 104 MMC_REG( SOCLIB_MMC_ERROR_FUNC , reg_index ) ); 105 106 // move MMC register to/from local buffer 107 if( type == MMC_ERROR_GET ) *reg_ptr = hal_remote_l32( mmc_reg_xp ); 108 else hal_remote_s32( mmc_reg_xp , *reg_ptr ); 107 109 } 110 else // type == MMC_INSTRU_GET 111 { 112 // get dst buffer local pointer and register index 113 reg_ptr = (uint32_t *)hal_remote_lpt( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_ptr ) ); 114 reg_index = hal_remote_l32( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_index ) ); 115 116 // build extended pointer on relevant MMC register 117 xptr_t mmc_reg_xp = XPTR( seg_cxy , seg_ptr + 118 MMC_REG( SOCLIB_MMC_INSTR_FUNC , reg_index ) ); 119 120 // move MMC register to local buffer 121 *reg_ptr = hal_remote_l32( mmc_reg_xp ); 122 } 123 108 124 } // end soclib_mmc_cmd() 109 125 … … 121 137 122 138 // print an error message on kernel terminal 123 printk("\n[ERROR] reported from MMC : cxy %x / cycle %d / bad address [%x,%x] / srcid %x\n",124 local_cxy , (uint32_t)hal_get_cycles() , paddr_hi , paddr_lo , srcid);139 printk("\n[ERROR] reported from MMC : bad address [%x,%x] / srcid %x / cycle %d\n", 140 paddr_hi , paddr_lo , srcid , (uint32_t)hal_get_cycles() ); 125 141 126 142 // reset MMC IRQ … … 128 144 129 145 } // end soclib_mmc_isr() 130 131 132 -
trunk/hal/tsar_mips32/drivers/soclib_mmc.h
r626 r657 2 2 * soclib_mmc.h - TSAR L2 cache driver definition. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019) 4 * Author Alain Greiner (2016,2017,2018,2019),2020) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 49 49 }; 50 50 51 enum SoclibMemCacheConfigCmd 52 { 53 SOCLIB_MMC_CC_NOP = 0, 54 SOCLIB_MMC_CC_INVAL = 1, 55 SOCLIB_MMC_CC_SYNC = 2, 56 }; 57 58 // CONFIG Registers indexes 51 59 enum SoclibMemCacheCCRegs 52 60 { … … 57 65 }; 58 66 59 enum SoclibMemCacheConfigCmd 60 { 61 SOCLIB_MMC_CC_NOP = 0, 62 SOCLIB_MMC_CC_INVAL = 1, 63 SOCLIB_MMC_CC_SYNC = 2, 64 }; 65 67 // INSTRU Registers indexes 66 68 enum SoclibMemCacheInstrRegs 67 69 { … … 143 145 }; 144 146 147 // ERROR registers indexes 145 148 enum SoclibMemCacheRerrorRegs 146 149 { … … 157 160 158 161 /******************************************************************************************** 159 * This function initializes the SOCLIB_MMC peripheral hardware registers related160 * to error signaling.It enables the MMC peripheral IRQ.162 * This function initializes the SOCLIB_MMC peripheral hardware registers. 163 * It enables the MMC peripheral IRQ. 161 164 ******************************************************************************************** 162 165 * @ chdev : local pointer on the MMC chdev descriptor. … … 175 178 /******************************************************************************************** 176 179 * This Interrupt Service Routine is executed when the MMC IRQ signals a faulty address. 177 * The ISR should access the vci_mem_cache componentto get the faulty physical address180 * The ISR should access the relevant MMC register to get the faulty physical address 178 181 * and the associated SRCID, and acknowledges the IRQ. 179 182 ******************************************************************************************** -
trunk/hal/tsar_mips32/drivers/soclib_nic.c
r635 r657 2 2 * soclib_nic.c - SOCLIB_NIC (Network Interface Controler) driver implementation. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019 )4 * Author Alain Greiner (2016,2017,2018,2019,2020:) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 93 93 void __attribute__ ((noinline)) soclib_nic_cmd( xptr_t thread_xp ) 94 94 { 95 uint32_t cmd;// command type95 uint32_t type; // command type 96 96 char * buffer; // pointer on command buffer 97 97 uint32_t length; // Ethernet packet length … … 109 109 110 110 // get command arguments 111 cmd = thread_ptr->nic_cmd.cmd;111 type = thread_ptr->nic_cmd.type; 112 112 buffer = thread_ptr->nic_cmd.buffer; 113 113 length = thread_ptr->nic_cmd.length; … … 121 121 122 122 // analyse command type 123 switch( cmd)123 switch( type ) 124 124 { 125 125 ///////////////////////////////////////////////////////////////////////////// … … 274 274 break; // end READABLE 275 275 default: { 276 assert( false, "Unknown command <%x>\n", cmd);276 assert( false, "Unknown command <%x>\n", type ); 277 277 } 278 278 }
Note: See TracChangeset
for help on using the changeset viewer.