Changeset 279 for trunk/hal/tsar_mips32/drivers
- Timestamp:
- Jul 27, 2017, 12:23:29 AM (7 years ago)
- Location:
- trunk/hal/tsar_mips32/drivers
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_bdv.c
r265 r279 58 58 void __attribute__ ((noinline)) soclib_bdv_cmd( xptr_t th_xp ) 59 59 { 60 uint32_t cmd_type; 61 uint32_t lba; // command argument62 uint32_t count; // command argument63 xptr_t buf_xp; // command argument64 xptr_t dev_xp; // command argument60 uint32_t cmd_type; // IOC_READ / IOC_WRITE / IOC_SYNC_READ 61 uint32_t lba; 62 uint32_t count; 63 xptr_t buf_xp; 64 xptr_t ioc_xp; 65 65 66 66 // get client thread cluster and local pointer … … 69 69 70 70 // get command arguments and extended pointer on IOC device 71 cmd_type = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.ioc.type ) );72 lba = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.ioc.lba ) );73 count = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.ioc.count ) );74 buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr-> command.ioc.buf_xp ) );75 dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.ioc.dev_xp ) );71 cmd_type = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.type ) ); 72 lba = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.lba ) ); 73 count = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.count ) ); 74 buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) ); 75 ioc_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) ); 76 76 77 77 // get IOC device cluster and local pointer 78 cxy_t dev_cxy = GET_CXY( dev_xp );79 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );78 cxy_t ioc_cxy = GET_CXY( ioc_xp ); 79 chdev_t * ioc_ptr = (chdev_t *)GET_PTR( ioc_xp ); 80 80 81 81 // get extended pointer on SOCLIB-BDV peripheral 82 xptr_t bdv_xp = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->base ) );82 xptr_t bdv_xp = hal_remote_lw( XPTR( ioc_cxy , &ioc_ptr->base ) ); 83 83 84 84 // get SOCLIB_BDV device cluster and local pointer … … 114 114 if( status == BDV_READ_SUCCESS ) // successfully completed 115 115 { 116 hal_remote_sw( XPTR( th_cxy , &th_ptr-> command.ioc.error ) , 0 );116 hal_remote_sw( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 ); 117 117 break; 118 118 } … … 123 123 else // error reported 124 124 { 125 hal_remote_sw( XPTR( th_cxy , &th_ptr-> command.ioc.error ) , 1 );125 hal_remote_sw( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 ); 126 126 break; 127 127 } … … 161 161 if((status != BDV_READ_SUCCESS) && (status != BDV_WRITE_SUCCESS)) 162 162 { 163 hal_remote_sw( XPTR( client_cxy , &client_ptr-> command.ioc.error ) , 1 );163 hal_remote_sw( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 1 ); 164 164 } 165 165 else 166 166 { 167 hal_remote_sw( XPTR( client_cxy , &client_ptr-> command.ioc.error ) , 0 );167 hal_remote_sw( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 0 ); 168 168 } 169 169 -
trunk/hal/tsar_mips32/drivers/soclib_dma.c
r261 r279 57 57 58 58 // get command arguments and extended pointer on DMA device 59 dev_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr-> command.dma.dev_xp ) );60 dst_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr-> command.dma.dst_xp ) );61 src_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr-> command.dma.src_xp ) );62 size = hal_remote_lw ( XPTR( thread_cxy , &thread_ptr-> command.dma.size ) );59 dev_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr->dma_cmd.dev_xp ) ); 60 dst_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr->dma_cmd.dst_xp ) ); 61 src_xp = (xptr_t)hal_remote_lwd( XPTR( thread_cxy , &thread_ptr->dma_cmd.src_xp ) ); 62 size = hal_remote_lw ( XPTR( thread_cxy , &thread_ptr->dma_cmd.size ) ); 63 63 64 64 // get DMA device cluster and local pointer … … 124 124 // set operation status in command 125 125 error_t error = ( status != DMA_SUCCESS ); 126 hal_remote_sw( XPTR( client_cxy , &client_ptr-> command.dma.error ) , error );126 hal_remote_sw( XPTR( client_cxy , &client_ptr->dma_cmd.error ) , error ); 127 127 128 128 // unblock server thread -
trunk/hal/tsar_mips32/drivers/soclib_hba.c
r211 r279 107 107 108 108 // get command arguments and extended pointer on IOC device 109 cmd_type = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.ioc.type ) );110 lba = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.ioc.lba ) );111 count = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.ioc.count ) );112 buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr-> command.ioc.buf_xp ) );113 dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr-> command.ioc.dev_xp ) );109 cmd_type = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.type ) ); 110 lba = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.lba ) ); 111 count = hal_remote_lw ( XPTR( th_cxy , &th_ptr->ioc_cmd.count ) ); 112 buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) ); 113 dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) ); 114 114 115 115 // get IOC device cluster and local pointer … … 225 225 if( error && (fault_id == cmd_id) ) 226 226 { 227 hal_remote_sw( XPTR( th_cxy , &th_ptr-> command.ioc.error ) , 1 );227 hal_remote_sw( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 ); 228 228 } 229 229 else 230 230 { 231 hal_remote_sw( XPTR( th_cxy , &th_ptr-> command.ioc.error ) , 0 );231 hal_remote_sw( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 ); 232 232 } 233 233 … … 281 281 if( error && (iter == fault_id ) ) 282 282 { 283 hal_remote_sw( XPTR( client_cxy , &client_ptr-> command.ioc.error ) , 1 );283 hal_remote_sw( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 1 ); 284 284 } 285 285 else 286 286 { 287 hal_remote_sw( XPTR( client_cxy , &client_ptr-> command.ioc.error ) , 0 );287 hal_remote_sw( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 0 ); 288 288 } 289 289 -
trunk/hal/tsar_mips32/drivers/soclib_mmc.c
r257 r279 1 1 /* 2 * soclib_mmc.c - soclib simple block devicedriver implementation.2 * soclib_mmc.c - soclib L2 cache controller driver implementation. 3 3 * 4 4 * Author Alain Greiner (2016) … … 62 62 63 63 // get command type and extended pointer on MMC device 64 type = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.mmc.type ) );65 dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr-> command.mmc.dev_xp ) );64 type = hal_remote_lw ( XPTR( th_cxy , &th_ptr->mmc_cmd.type ) ); 65 dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->mmc_cmd.dev_xp ) ); 66 66 67 67 // get MMC device cluster and local pointer … … 79 79 { 80 80 // get buffer paddr 81 buf_paddr = hal_remote_lwd( XPTR( th_cxy , &th_ptr-> command.mmc.buf_paddr ) );81 buf_paddr = hal_remote_lwd( XPTR( th_cxy , &th_ptr->mmc_cmd.buf_paddr ) ); 82 82 83 83 // split buffer paddr in two 32 bits words … … 86 86 87 87 // get buffer size 88 buf_size = hal_remote_lw( XPTR( th_cxy , &th_ptr-> command.mmc.buf_size ) );88 buf_size = hal_remote_lw( XPTR( th_cxy , &th_ptr->mmc_cmd.buf_size ) ); 89 89 90 90 // get command type … … 102 102 { 103 103 // get src/dst buffer local pointer and register index 104 reg_ptr = (uint32_t *)hal_remote_lpt( XPTR( th_cxy , &th_ptr-> command.mmc.reg_ptr ) );105 reg_index = hal_remote_lw( XPTR( th_cxy , &th_ptr-> command.mmc.reg_index ) );104 reg_ptr = (uint32_t *)hal_remote_lpt( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_ptr ) ); 105 reg_index = hal_remote_lw( XPTR( th_cxy , &th_ptr->mmc_cmd.reg_index ) ); 106 106 107 107 // move register to/from local buffer -
trunk/hal/tsar_mips32/drivers/soclib_nic.c
r259 r279 107 107 108 108 // get command arguments 109 cmd = thread_ptr-> command.nic.cmd;110 buffer = thread_ptr-> command.nic.buffer;111 length = thread_ptr-> command.nic.length;112 dev_xp = thread_ptr-> command.nic.dev_xp;109 cmd = thread_ptr->nic_cmd.cmd; 110 buffer = thread_ptr->nic_cmd.buffer; 111 length = thread_ptr->nic_cmd.length; 112 dev_xp = thread_ptr->nic_cmd.dev_xp; 113 113 114 114 // get local pointer for device … … 212 212 { 213 213 // return chbuf writable 214 thread_ptr-> command.nic.status = true;214 thread_ptr->nic_cmd.status = true; 215 215 } 216 216 else // current container not writable … … 230 230 231 231 // return chbuf writable 232 thread_ptr-> command.nic.status = true;232 thread_ptr->nic_cmd.status = true; 233 233 } 234 234 else // next container full 235 235 { 236 236 // return chbuf non writable 237 thread_ptr-> command.nic.status = false;237 thread_ptr->nic_cmd.status = false; 238 238 } 239 239 } … … 256 256 { 257 257 // return chbuf readable 258 thread_ptr-> command.nic.status = true;258 thread_ptr->nic_cmd.status = true; 259 259 } 260 260 else // current container non readable … … 274 274 275 275 // return chbuf readable 276 thread_ptr-> command.nic.status = true;276 thread_ptr->nic_cmd.status = true; 277 277 } 278 278 else // next container empty 279 279 { 280 280 // return chbuf non readable 281 thread_ptr-> command.nic.status = false;281 thread_ptr->nic_cmd.status = false; 282 282 } 283 283 } -
trunk/hal/tsar_mips32/drivers/soclib_pic.c
r205 r279 83 83 } 84 84 85 86 //////////////////////////////////////////87 uint32_t soclib_pic_ack_timer( lid_t lid )88 {89 // get local XCU segment base90 uint32_t * base = soclib_pic_xcu_base();91 92 // read from register93 return base[(XCU_PTI_ACK << 5) | lid];94 95 } // end soclib_pic_ack_timer()96 97 85 /////////////////////////////////////////// 98 86 void soclib_pic_xcu_status( lid_t lid, … … 113 101 } 114 102 103 //////////////////////////////////////////////////// 104 inline uint32_t soclib_pic_xcu_ack( uint32_t * reg ) 105 { 106 return *reg; 107 } 108 115 109 ///////////////////////////// 116 110 void soclib_pic_irq_handler() … … 120 114 uint32_t pti_status; // PTI index + 1 / no pending PTI if 0 121 115 chdev_t * src_chdev; // pointer on source chdev descriptor 122 uint32_t index; // IRQ index 116 uint32_t index; // WTI / HWI / PTI index 117 uint32_t ack; // XCU acknowledge requires a read... 123 118 124 119 core_t * core = CURRENT_THREAD->core; … … 130 125 &pti_status ); 131 126 127 irq_dmsg("\n[INFO] %s : enter / WTI_STS = %x / HWI_STS = %x / WTI_STS = %x\n", 128 __FUNCTION__ , wti_status , hwi_status , pti_status ); 129 132 130 // analyse status and handle up to 3 pending IRQ (one WTI, one HWI, one PTI) 133 131 … … 140 138 assert( (index == core->lid) , __FUNCTION__ , "illegal IPI index" ); 141 139 142 // TODO acknowledge WTI [AG] 143 144 // TODO force scheduling [AG] 140 // acknowledge WTI 141 uint32_t * base = soclib_pic_xcu_base(); 142 ack = base[(XCU_WTI_REG << 5) | core->lid]; 143 144 // force scheduling 145 sched_yield(); 145 146 } 146 147 else // it is an external device … … 156 157 core->spurious_irqs ++; 157 158 158 // TODO disable this WTI in local XCU [AG] 159 // disable WTI in local XCU controller 160 uint32_t * base = soclib_pic_xcu_base(); 161 base[(XCU_MSK_WTI_DISABLE << 5) | core->lid] = 1 << core->lid; 159 162 } 160 163 else // call relevant ISR … … 183 186 core->spurious_irqs ++; 184 187 185 // TODO disable this HWI in local XCU [AG] 188 // disable HWI in local XCU controller 189 uint32_t * base = soclib_pic_xcu_base(); 190 base[(XCU_MSK_HWI_DISABLE << 5) | core->lid] = 1 << core->lid; 186 191 } 187 192 else // call relevant ISR … … 205 210 206 211 // acknowledge PTI 207 soclib_pic_ack_timer( index ); 208 209 // TODO execute all actions related to TICK event 212 uint32_t * base = soclib_pic_xcu_base(); 213 ack = base[(XCU_PTI_ACK << 5) | core->lid]; 214 215 // execute all actions related to TICK event 210 216 core_clock( core ); 211 217 } … … 431 437 else if( irq_type == SOCLIB_TYPE_WTI ) 432 438 { 433 // enable this WTI in localXCU controller439 // enable this WTI in remote XCU controller 434 440 hal_remote_sw( XPTR( src_chdev_cxy , 435 441 &seg_xcu_ptr[(XCU_MSK_WTI_ENABLE << 5) | lid] ) , (1 << irq_id) ); … … 464 470 else if( irq_type == SOCLIB_TYPE_WTI ) 465 471 { 466 // enable this WTI in localXCU controller472 // enable this WTI in remote XCU controller 467 473 hal_remote_sw( XPTR( src_chdev_cxy , 468 474 &seg_xcu_ptr[(XCU_MSK_WTI_DISABLE << 5) | lid] ) , (1 << irq_id) ); … … 486 492 base[(XCU_PTI_PER << 5) | lid] = period; 487 493 488 // enable thePTI in local XCU controller494 // enable PTI in local XCU controller 489 495 base[(XCU_MSK_PTI_ENABLE << 5) | lid] = 1 << lid; 496 } 497 498 //////////////////////////// 499 void soclib_pic_enable_ipi() 500 { 501 // calling core local index 502 lid_t lid = CURRENT_CORE->lid; 503 504 // get XCU segment base 505 uint32_t * base = soclib_pic_xcu_base(); 506 507 // enable WTI in local XCU controller 508 base[(XCU_MSK_WTI_ENABLE << 5) | lid] = 1 << lid; 490 509 } 491 510 -
trunk/hal/tsar_mips32/drivers/soclib_pic.h
r238 r279 228 228 229 229 /****************************************************************************************** 230 * This function activates the TICKtimer for the calling core.230 * This function activates the PTI timer for the calling core. 231 231 * The <period> argument define the number of cycles between IRQs. 232 232 ****************************************************************************************** … … 234 234 *****************************************************************************************/ 235 235 void soclib_pic_enable_timer( uint32_t period ); 236 237 /****************************************************************************************** 238 * This function activates the WTI[lid] in the local cluster, wherehe lid is the calling 239 * core local index. 240 *****************************************************************************************/ 241 void soclib_pic_enable_ipi(); 236 242 237 243 /****************************************************************************************** … … 279 285 280 286 /****************************************************************************************** 281 * This function acknowledge a PTI IRQ generated by the local XCU for a core282 * identified by the <lid> argument.283 *****************************************************************************************/284 uint32_t soclib_pic_ack_timer( lid_t lid );285 286 /******************************************************************************************287 287 * This function returns in the <hwi_status>, <wti_status>, <pti_status> buffers 288 288 * the local XCU status for a given core identidied by the <lid> argument. -
trunk/hal/tsar_mips32/drivers/soclib_tty.c
r77 r279 54 54 55 55 // get command type and extended pointer on TXT device 56 uint32_t type = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.txt.type ) );57 xptr_t dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr-> command.txt.dev_xp ) );56 uint32_t type = hal_remote_lw ( XPTR( th_cxy , &th_ptr->txt_cmd.type ) ); 57 xptr_t dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->txt_cmd.dev_xp ) ); 58 58 59 59 // get TXT device cluster and local pointer … … 103 103 104 104 // get source buffer extended pointer & bytes count 105 uint32_t count = hal_remote_lw ( XPTR( th_cxy , &th_ptr-> command.txt.count ) );106 xptr_t buf_xp = hal_remote_lwd( XPTR( th_cxy , &th_ptr-> command.txt.buf_xp ) );105 uint32_t count = hal_remote_lw ( XPTR( th_cxy , &th_ptr->txt_cmd.count ) ); 106 xptr_t buf_xp = hal_remote_lwd( XPTR( th_cxy , &th_ptr->txt_cmd.buf_xp ) ); 107 107 108 108 // loop on characters … … 127 127 } 128 128 } 129 } 129 } // end soclib_tty_cmd() 130 130 131 131 132 ///////////////////////////////////////////////////////////////// … … 148 149 149 150 // get command arguments 150 type = hal_remote_lw ( XPTR( client_cxy , &client_ptr-> command.txt.type ) );151 count = hal_remote_lw ( XPTR( client_cxy , &client_ptr-> command.txt.count ) );152 buf_xp = hal_remote_lwd( XPTR( client_cxy , &client_ptr-> command.txt.buf_xp ) );151 type = hal_remote_lw ( XPTR( client_cxy , &client_ptr->txt_cmd.type ) ); 152 count = hal_remote_lw ( XPTR( client_cxy , &client_ptr->txt_cmd.count ) ); 153 buf_xp = hal_remote_lwd( XPTR( client_cxy , &client_ptr->txt_cmd.buf_xp ) ); 153 154 154 155 // get SOCLIB_TTY peripheral cluster and local pointer … … 210 211 else // TTY_TX full => update command arguments and exit ISR for retry 211 212 { 212 hal_remote_sw ( XPTR( client_cxy , &client_ptr-> command.txt.count ), count-i );213 hal_remote_swd( XPTR( client_cxy , &client_ptr-> command.txt.buf_xp ), buf_xp+i );213 hal_remote_sw ( XPTR( client_cxy , &client_ptr->txt_cmd.count ), count-i ); 214 hal_remote_swd( XPTR( client_cxy , &client_ptr->txt_cmd.buf_xp ), buf_xp+i ); 214 215 return; 215 216 } … … 223 224 224 225 // set I/O operation status in command 225 hal_remote_sw( XPTR( client_cxy , &client_ptr-> command.txt.error ) , 0 );226 hal_remote_sw( XPTR( client_cxy , &client_ptr->txt_cmd.error ) , 0 ); 226 227 227 228 // unblock server thread … … 230 231 // unblock client thread 231 232 thread_unblock( client_xp , THREAD_BLOCKED_IO ); 232 } 233 233 234 } // end soclib_tty_isr() 235
Note: See TracChangeset
for help on using the changeset viewer.