Changeset 249 for soft/giet_vm/sys/drivers.c
- Timestamp:
- Jul 18, 2013, 6:33:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/drivers.c
r246 r249 41 41 // - seg_cma_base 42 42 // - seg_iob_base 43 // - seg_mmc_base 43 44 // 44 45 /////////////////////////////////////////////////////////////////////////////////// … … 57 58 #endif 58 59 60 #if (NB_CLUSTERS > 256) 61 # error: NB_CLUSTERS cannot be larger than 256! 62 #endif 63 59 64 #if !defined(NB_PROCS_MAX) 60 65 # error: You must define NB_PROCS_MAX in the hard_config.h file … … 69 74 #endif 70 75 76 #if !defined(GIET_USE_IOMMU) 77 # error: You must define GIET_USE_IOMMU in the giet_config.h file 78 #endif 79 71 80 #if !defined(NB_TTY_CHANNELS) 72 81 # error: You must define NB_TTY_CHANNELS in the hard_config.h file … … 121 130 #endif 122 131 123 #if !defined( IOMMU_ACTIVE)124 # error: You must define IOMMU_ACTIVEin the hard_config.h file132 #if !defined( USE_IOB ) 133 # error: You must define USE_IOB in the hard_config.h file 125 134 #endif 126 135 … … 314 323 315 324 _get_lock(&_tty_put_lock); 316 if (tty_id == 0xFFFFFFFF) { 317 _puts("\n[GIET ERROR] no TTY assigned to the task "); 318 } 319 else { 320 _puts("\n[GIET ERROR] TTY index too large for task "); 321 } 325 if (tty_id == 0xFFFFFFFF) _puts("\n[GIET ERROR] no TTY assigned to the task "); 326 else _puts("\n[GIET ERROR] TTY index too large for task "); 322 327 _putd(task_id); 323 328 _puts(" on processor "); … … 671 676 if (ix2 == 0) ppn_first = ppn; 672 677 673 if ( IOMMU_ACTIVE) // the user buffer must beremapped in the I/0 space678 if ( GIET_USE_IOMMU && USE_IOB ) // user buffer remapped in the I/0 space 674 679 { 675 680 // check buffer length < 2 Mbytes … … 710 715 _ioc_iommu_npages = (user_vpn_max - user_vpn_min) + 1; 711 716 712 // invalidate data cache in case of memory write717 // invalidate local data cache in case of memory write 713 718 if (to_mem) _dcache_buf_invalidate((void *) user_vaddr, length); 714 719 … … 737 742 #endif 738 743 744 // Invalidate L2 cache if IO Bridge is used 745 if ( to_mem && USE_IOB ) _memc_inval( buf_paddr, length ); 746 739 747 // get the lock on ioc device 740 748 _get_lock(&_ioc_lock); 741 749 742 750 // peripheral configuration 743 if ( IOMMU_ACTIVE)751 if ( GIET_USE_IOMMU && USE_IOB ) 744 752 { 745 753 ioc_address[BLOCK_DEVICE_BUFFER] = buf_xaddr; … … 791 799 792 800 // unmap the buffer from IOMMU page table if IOMMU is activated 793 if ( IOMMU_ACTIVE)801 if ( GIET_USE_IOMMU && USE_IOB ) 794 802 { 795 803 unsigned int * iob_address = (unsigned int *) &seg_iob_base; … … 1107 1115 if ( ix2 == 0 ) ppn_first = ppn; 1108 1116 1109 if ( IOMMU_ACTIVE ) // the user buffer must beremapped in the I/0 space1117 if ( GIET_USE_IOMMU && USE_IOB ) // user buffer remapped in the I/0 space 1110 1118 { 1111 1119 // check buffer length < 2 Mbytes … … 1444 1452 } 1445 1453 1454 ////////////////////////////////////////////////////////////////////////////////// 1455 // VciMemCache driver 1456 ////////////////////////////////////////////////////////////////////////////////// 1457 // The VciMemCache device can be accessed through a configuration interface. 1458 // as a set of uncached, memory mapped registers. 1459 /////////////////////////////////////////////////////////////////////////////////// 1460 1461 /////////////////////////////////////////////////////////////////////////////////// 1462 // _memc_inval() 1463 // This function invalidate all cache lines covering a memory buffer defined 1464 // by the physical base address, and the length. 1465 // The buffer address MSB are used to compute the cluster index. 1466 /////////////////////////////////////////////////////////////////////////////////// 1467 void _memc_inval( paddr_t buf_paddr, 1468 unsigned int buf_length ) 1469 { 1470 unsigned int cluster_id = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS)); 1471 1472 unsigned int * mmc_address = (unsigned int *) ((char *) &seg_mmc_base + 1473 (cluster_id * GIET_CLUSTER_INCREMENT)); 1474 1475 // get the lock protecting exclusive access to MEMC 1476 while ( mmc_address[MEMC_LOCK] ) { asm volatile("nop"); } 1477 1478 // write inval arguments 1479 mmc_address[MEMC_ADDR_LO] = (unsigned int)buf_paddr; 1480 mmc_address[MEMC_ADDR_HI] = (unsigned int)(buf_paddr>>32); 1481 mmc_address[MEMC_BUF_LENGTH] = buf_length; 1482 mmc_address[MEMC_CMD_TYPE] = MEMC_CMD_INVAL; 1483 1484 // release the lock protecting MEMC 1485 mmc_address[MEMC_LOCK] = 0; 1486 } 1446 1487 /////////////////////////////////////////////////////////////////////////////////// 1447 1488 // _heap_info()
Note: See TracChangeset
for help on using the changeset viewer.