Changeset 570 for trunk/hal/tsar_mips32/drivers/soclib_hba.c
- Timestamp:
- Oct 5, 2018, 12:08:35 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_hba.c
r522 r570 27 27 #include <dev_ioc.h> 28 28 #include <soclib_hba.h> 29 #include <spinlock.h>30 29 #include <thread.h> 31 30 … … 51 50 52 51 // spinlock protecting the command slot allocator 53 __attribute__((section(".kdata")))54 spinlock_t hba_lock;52 // __attribute__((section(".kdata"))) 53 // busylock_t hba_lock; 55 54 56 55 /////////////////////////////////////// … … 69 68 70 69 // get block_size and block_count 71 uint32_t block_size = hal_remote_l w( XPTR( hba_cxy , hba_ptr + HBA_BLOCK_SIZE_REG ) );72 uint32_t block_count = hal_remote_l w( XPTR( hba_cxy , hba_ptr + HBA_BLOCK_COUNT_REG ) );70 uint32_t block_size = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_BLOCK_SIZE_REG ) ); 71 uint32_t block_count = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_BLOCK_COUNT_REG ) ); 73 72 74 73 // set device descriptor extension … … 77 76 78 77 // activate HBA interrupts 79 hal_remote_s w( XPTR( hba_cxy , hba_ptr + HBA_PXIE_REG ) , 0x1 );78 hal_remote_s32( XPTR( hba_cxy , hba_ptr + HBA_PXIE_REG ) , 0x1 ); 80 79 81 80 // reset SOCLIB_HBA driver global variable … … 107 106 108 107 // get command arguments and extended pointer on IOC device 109 cmd_type = hal_remote_l w( XPTR( th_cxy , &th_ptr->ioc_cmd.type ) );110 lba = hal_remote_l w( XPTR( th_cxy , &th_ptr->ioc_cmd.lba ) );111 count = hal_remote_l w( XPTR( th_cxy , &th_ptr->ioc_cmd.count ) );112 buf_xp = (xptr_t)hal_remote_l wd( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) );113 dev_xp = (xptr_t)hal_remote_l wd( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) );108 cmd_type = hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.type ) ); 109 lba = hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.lba ) ); 110 count = hal_remote_l32 ( XPTR( th_cxy , &th_ptr->ioc_cmd.count ) ); 111 buf_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.buf_xp ) ); 112 dev_xp = (xptr_t)hal_remote_l64( XPTR( th_cxy , &th_ptr->ioc_cmd.dev_xp ) ); 114 113 115 114 // get IOC device cluster and local pointer … … 118 117 119 118 // get cluster and pointers for SOCLIB-HBA peripheral segment base 120 xptr_t hba_xp = (xptr_t)hal_remote_l wd( XPTR( dev_cxy , &dev_ptr->base ) );119 xptr_t hba_xp = (xptr_t)hal_remote_l64( XPTR( dev_cxy , &dev_ptr->base ) ); 121 120 cxy_t hba_cxy = GET_CXY( hba_xp ); 122 121 uint32_t * hba_ptr = GET_PTR( hba_xp ); … … 181 180 182 181 // set HBA_PXCI_REG to start transfer 183 hal_remote_s w( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) , 1<<cmd_id );182 hal_remote_s32( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) , 1<<cmd_id ); 184 183 185 184 // exit the while … … 204 203 while(1) 205 204 { 206 pxis = hal_remote_l w( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) );207 pxci = hal_remote_l w( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) );205 pxis = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) ); 206 pxci = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) ); 208 207 error = (pxis & 0x40000000) >> 30; 209 208 fault_id = (pxis & 0x1F000000) >> 24; … … 217 216 if( error && (fault_id == cmd_id) ) 218 217 { 219 hal_remote_s w( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 );218 hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 1 ); 220 219 } 221 220 else 222 221 { 223 hal_remote_s w( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 );222 hal_remote_s32( XPTR( th_cxy , &th_ptr->ioc_cmd.error ) , 0 ); 224 223 } 225 224 … … 243 242 // get extended pointer on client thread 244 243 xptr_t root = XPTR( local_cxy , &chdev->wait_root ); 245 xptr_t client_xp = XLIST_FIRST _ELEMENT( root , thread_t , wait_list );244 xptr_t client_xp = XLIST_FIRST( root , thread_t , wait_list ); 246 245 247 246 // get client thread cluster and local pointer … … 254 253 255 254 // get HBA_PXIS_REG and HBA_PXCI_REG current values 256 uint32_t current_pxis = hal_remote_l w( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) );257 uint32_t current_pxci = hal_remote_l w( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) );255 uint32_t current_pxis = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) ); 256 uint32_t current_pxci = hal_remote_l32( XPTR( hba_cxy , hba_ptr + HBA_PXCI_REG ) ); 258 257 259 258 uint32_t error = (current_pxis & 0x40000000) >> 30; … … 273 272 if( error && (iter == fault_id ) ) 274 273 { 275 hal_remote_s w( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 1 );274 hal_remote_s32( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 1 ); 276 275 } 277 276 else 278 277 { 279 hal_remote_s w( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 0 );278 hal_remote_s32( XPTR( client_cxy , &client_ptr->ioc_cmd.error ) , 0 ); 280 279 } 281 280 … … 286 285 287 286 // reset HBA_PXIS_REG 288 hal_remote_s w( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) , 0 );287 hal_remote_s32( XPTR( hba_cxy , hba_ptr + HBA_PXIS_REG ) , 0 ); 289 288 290 289 } // end soclib_hba_isr()
Note: See TracChangeset
for help on using the changeset viewer.