Changeset 428 for trunk/kernel/kern/chdev.c
- Timestamp:
- Jan 29, 2018, 6:08:07 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/chdev.c
r418 r428 276 276 } // end chdev_sequencial_server() 277 277 278 //////////////////////////////////////// 279 xptr_t chdev_from_file( xptr_t file_xp ) 280 { 281 cxy_t file_cxy; 282 vfs_file_t * file_ptr; 283 uint32_t inode_type; 284 vfs_inode_t * inode_ptr; 285 chdev_t * chdev_ptr; 286 287 // get cluster and local pointer on remote file descriptor 288 // associated inode and chdev are stored in same cluster as the file desc. 289 file_cxy = GET_CXY( file_xp ); 290 file_ptr = (vfs_file_t *)GET_PTR( file_xp ); 291 292 // get inode type from file descriptor 293 inode_type = hal_remote_lw( XPTR( file_cxy , &file_ptr->type ) ); 294 inode_ptr = (vfs_inode_t *)hal_remote_lpt( XPTR( file_cxy , &file_ptr->inode ) ); 295 296 assert( (inode_type == INODE_TYPE_DEV) , __FUNCTION__ , 297 "inode type %d is not INODE_TYPE_DEV", inode_type ); 298 299 // get chdev local pointer from inode extension 300 chdev_ptr = (chdev_t *)hal_remote_lpt( XPTR( file_cxy , &inode_ptr->extend ) ); 301 302 return XPTR( file_cxy , chdev_ptr ); 303 304 } // end chdev_from_file() 305 278 306 //////////////////////// 279 307 void chdev_dir_display() 280 308 { 281 cxy_t iob_cxy = GET_CXY( chdev_dir.iob ); 282 chdev_t * iob_ptr = (chdev_t *)GET_PTR( chdev_dir.iob ); 283 uint32_t iob_base = (uint32_t)hal_remote_lwd( XPTR( iob_cxy , &iob_ptr->base ) ); 284 285 cxy_t pic_cxy = GET_CXY( chdev_dir.pic ); 286 chdev_t * pic_ptr = (chdev_t *)GET_PTR( chdev_dir.pic ); 287 uint32_t pic_base = (uint32_t)hal_remote_lwd( XPTR( pic_cxy , &pic_ptr->base ) ); 288 289 cxy_t txt0_tx_cxy = GET_CXY( chdev_dir.txt_tx[0] ); 290 chdev_t * txt0_tx_ptr = (chdev_t *)GET_PTR( chdev_dir.txt_tx[0] ); 291 uint32_t txt0_tx_base = (uint32_t)hal_remote_lwd( XPTR( txt0_tx_cxy , &txt0_tx_ptr->base ) ); 292 293 cxy_t txt0_rx_cxy = GET_CXY( chdev_dir.txt_rx[0] ); 294 chdev_t * txt0_rx_ptr = (chdev_t *)GET_PTR( chdev_dir.txt_rx[0] ); 295 uint32_t txt0_rx_base = (uint32_t)hal_remote_lwd( XPTR( txt0_rx_cxy , &txt0_rx_ptr->base ) ); 296 297 cxy_t txt1_tx_cxy = GET_CXY( chdev_dir.txt_tx[1] ); 298 chdev_t * txt1_tx_ptr = (chdev_t *)GET_PTR( chdev_dir.txt_tx[1] ); 299 uint32_t txt1_tx_base = (uint32_t)hal_remote_lwd( XPTR( txt1_tx_cxy , &txt1_tx_ptr->base ) ); 300 301 cxy_t txt1_rx_cxy = GET_CXY( chdev_dir.txt_rx[1] ); 302 chdev_t * txt1_rx_ptr = (chdev_t *)GET_PTR( chdev_dir.txt_rx[1] ); 303 uint32_t txt1_rx_base = (uint32_t)hal_remote_lwd( XPTR( txt1_rx_cxy , &txt1_rx_ptr->base ) ); 304 305 cxy_t txt2_tx_cxy = GET_CXY( chdev_dir.txt_tx[2] ); 306 chdev_t * txt2_tx_ptr = (chdev_t *)GET_PTR( chdev_dir.txt_tx[2] ); 307 uint32_t txt2_tx_base = (uint32_t)hal_remote_lwd( XPTR( txt2_tx_cxy , &txt2_tx_ptr->base ) ); 308 309 cxy_t txt2_rx_cxy = GET_CXY( chdev_dir.txt_rx[2] ); 310 chdev_t * txt2_rx_ptr = (chdev_t *)GET_PTR( chdev_dir.txt_rx[2] ); 311 uint32_t txt2_rx_base = (uint32_t)hal_remote_lwd( XPTR( txt2_rx_cxy , &txt2_rx_ptr->base ) ); 312 313 cxy_t ioc_cxy = GET_CXY( chdev_dir.ioc[0] ); 314 chdev_t * ioc_ptr = (chdev_t *)GET_PTR( chdev_dir.ioc[0] ); 315 uint32_t ioc_base = (uint32_t)hal_remote_lwd( XPTR( ioc_cxy , &ioc_ptr->base ) ); 316 317 cxy_t fbf_cxy = GET_CXY( chdev_dir.fbf[0] ); 318 chdev_t * fbf_ptr = (chdev_t *)GET_PTR( chdev_dir.fbf[0] ); 319 uint32_t fbf_base = (uint32_t)hal_remote_lwd( XPTR( fbf_cxy , &fbf_ptr->base ) ); 320 321 cxy_t nic0_rx_cxy = GET_CXY( chdev_dir.nic_rx[0] ); 322 chdev_t * nic0_rx_ptr = (chdev_t *)GET_PTR( chdev_dir.nic_rx[0] ); 323 uint32_t nic0_rx_base = (uint32_t)hal_remote_lwd( XPTR( nic0_rx_cxy , &nic0_rx_ptr->base ) ); 324 325 cxy_t nic0_tx_cxy = GET_CXY( chdev_dir.nic_tx[0] ); 326 chdev_t * nic0_tx_ptr = (chdev_t *)GET_PTR( chdev_dir.nic_tx[0] ); 327 uint32_t nic0_tx_base = (uint32_t)hal_remote_lwd( XPTR( nic0_tx_cxy , &nic0_tx_ptr->base ) ); 328 329 printk("\n***** external chdev directory in cluster %x\n" 330 " - iob : cxy = %X / ptr = %X / base = %X\n" 331 " - pic : cxy = %X / ptr = %X / base = %X\n" 332 " - ioc : cxy = %X / ptr = %X / base = %X\n" 333 " - fbf : cxy = %X / ptr = %X / base = %X\n" 334 " - txt_rx[0] : cxy = %X / ptr = %X / base = %X\n" 335 " - txt_tx[0] : cxy = %X / ptr = %X / base = %X\n" 336 " - txt_rx[1] : cxy = %X / ptr = %X / base = %X\n" 337 " - txt_tx[1] : cxy = %X / ptr = %X / base = %X\n" 338 " - txt_rx[2] : cxy = %X / ptr = %X / base = %X\n" 339 " - txt_tx[2] : cxy = %X / ptr = %X / base = %X\n" 340 " - nic_rx[0] : cxy = %X / ptr = %X / base = %X\n" 341 " - nic_tx[0] : cxy = %X / ptr = %X / base = %X\n", 342 local_cxy, 343 iob_cxy , iob_ptr , iob_base , 344 pic_cxy , pic_ptr , pic_base , 345 ioc_cxy , ioc_ptr , ioc_base , 346 fbf_cxy , fbf_ptr , fbf_base , 347 txt0_rx_cxy , txt0_rx_ptr , txt0_rx_base , 348 txt0_tx_cxy , txt0_tx_ptr , txt0_tx_base , 349 txt1_rx_cxy , txt1_rx_ptr , txt1_rx_base , 350 txt1_tx_cxy , txt1_tx_ptr , txt1_tx_base , 351 txt2_rx_cxy , txt2_rx_ptr , txt2_rx_base , 352 txt2_tx_cxy , txt2_tx_ptr , txt2_tx_base , 353 nic0_rx_cxy , nic0_rx_ptr , nic0_rx_base , 354 nic0_tx_cxy , nic0_tx_ptr , nic0_tx_base ); 309 uint32_t i; 310 cxy_t cxy; 311 chdev_t * ptr; 312 uint32_t base; 313 reg_t save_sr; 314 315 // get pointers on TXT0 chdev 316 xptr_t txt0_xp = chdev_dir.txt_tx[0]; 317 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 318 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); 319 320 // get extended pointer on remote TXT0 chdev lock 321 xptr_t lock_xp = XPTR( txt0_cxy , &txt0_ptr->wait_lock ); 322 323 // get TXT0 lock in busy waiting mode 324 remote_spinlock_lock_busy( lock_xp , &save_sr ); 325 326 // header 327 nolock_printk("\n***** external chdevs directory *****\n"); 328 329 // IOB 330 cxy = GET_CXY( chdev_dir.iob ); 331 ptr = GET_PTR( chdev_dir.iob ); 332 base = (uint32_t)hal_remote_lwd( XPTR( cxy , &ptr->base ) ); 333 nolock_printk(" - iob : cxy = %X / ptr = %X / base = %X\n", cxy, ptr, base); 334 335 // PIC 336 cxy = GET_CXY( chdev_dir.pic ); 337 ptr = GET_PTR( chdev_dir.pic ); 338 base = (uint32_t)hal_remote_lwd( XPTR( cxy , &ptr->base ) ); 339 nolock_printk(" - pic : cxy = %X / ptr = %X / base = %X\n", cxy, ptr, base); 340 341 // TXT 342 for( i = 0 ; i < LOCAL_CLUSTER->nb_txt_channels ; i++ ) 343 { 344 cxy = GET_CXY( chdev_dir.txt_rx[i] ); 345 ptr = GET_PTR( chdev_dir.txt_rx[i] ); 346 base = (uint32_t)hal_remote_lwd( XPTR( cxy , &ptr->base ) ); 347 nolock_printk(" - txt_rx[%d] : cxy = %X / ptr = %X / base = %X\n", i, cxy, ptr, base); 348 349 cxy = GET_CXY( chdev_dir.txt_tx[i] ); 350 ptr = GET_PTR( chdev_dir.txt_tx[i] ); 351 base = (uint32_t)hal_remote_lwd( XPTR( cxy , &ptr->base ) ); 352 nolock_printk(" - txt_tx[%d] : cxy = %X / ptr = %X / base = %X\n", i, cxy, ptr, base); 353 } 354 355 // IOC 356 for( i = 0 ; i < LOCAL_CLUSTER->nb_ioc_channels ; i++ ) 357 { 358 cxy = GET_CXY( chdev_dir.ioc[i] ); 359 ptr = GET_PTR( chdev_dir.ioc[i] ); 360 base = (uint32_t)hal_remote_lwd( XPTR( cxy , &ptr->base ) ); 361 nolock_printk(" - ioc[%d] : cxy = %X / ptr = %X / base = %X\n", i, cxy, ptr, base); 362 } 363 364 // FBF 365 for( i = 0 ; i < LOCAL_CLUSTER->nb_fbf_channels ; i++ ) 366 { 367 cxy = GET_CXY( chdev_dir.fbf[i] ); 368 ptr = GET_PTR( chdev_dir.fbf[i] ); 369 base = (uint32_t)hal_remote_lwd( XPTR( cxy , &ptr->base ) ); 370 nolock_printk(" - fbf[%d] : cxy = %X / ptr = %X / base = %X\n", i, cxy, ptr, base); 371 } 372 373 // NIC 374 for( i = 0 ; i < LOCAL_CLUSTER->nb_nic_channels ; i++ ) 375 { 376 cxy = GET_CXY( chdev_dir.nic_rx[i] ); 377 ptr = GET_PTR( chdev_dir.nic_rx[i] ); 378 base = (uint32_t)hal_remote_lwd( XPTR( cxy , &ptr->base ) ); 379 nolock_printk(" - nic_rx[%d] : cxy = %X / ptr = %X / base = %X\n", i, cxy, ptr, base); 380 381 cxy = GET_CXY( chdev_dir.nic_tx[i] ); 382 ptr = GET_PTR( chdev_dir.nic_tx[i] ); 383 base = (uint32_t)hal_remote_lwd( XPTR( cxy , &ptr->base ) ); 384 nolock_printk(" - nic_tx[%d] : cxy = %X / ptr = %X / base = %X\n", i, cxy, ptr, base); 385 } 386 387 // release lock 388 remote_spinlock_unlock_busy( lock_xp , save_sr ); 355 389 356 390 } // end chdev_dir_display()
Note: See TracChangeset
for help on using the changeset viewer.