Changeset 249 for soft/giet_vm/sys
- Timestamp:
- Jul 18, 2013, 6:33:38 PM (11 years ago)
- Location:
- soft/giet_vm/sys
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/common.h
r238 r249 28 28 extern _ld_symbol_t seg_fbf_base; 29 29 extern _ld_symbol_t seg_ioc_base; 30 extern _ld_symbol_t seg_mmc_base; 31 30 32 extern _ld_symbol_t seg_mapping_base; 31 33 extern _ld_symbol_t seg_kernel_pt_base; -
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() -
soft/giet_vm/sys/drivers.h
r246 r249 8 8 #ifndef _GIET_SYS_DRIVERS_H_ 9 9 #define _GIET_SYS_DRIVERS_H_ 10 11 10 12 11 /////////////////////////////////////////////////////////////////////////////////// … … 113 112 unsigned int _gcd_read( unsigned int register_index, unsigned int * buffer); 114 113 114 /////////////////////////////////////////////////////////////////////////////////// 115 // MEMC access functions 116 /////////////////////////////////////////////////////////////////////////////////// 117 118 void _memc_inval( unsigned long long buf_paddr, unsigned int buf_length); 119 void _memc_sync( unsigned long long buf_paddr, unsigned int buf_length); 115 120 116 121 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/sys/vm_handler.c
r246 r249 29 29 unsigned int ix2, 30 30 unsigned int ppn, 31 unsigned int flags) { 31 unsigned int flags) 32 { 32 33 unsigned int ptba; 33 34 unsigned int * pt_ppn; … … 38 39 39 40 // get ptba and update PT2 40 if ((pt->pt1[ix1] & PTE_V) == 0) 41 if ((pt->pt1[ix1] & PTE_V) == 0) 41 42 { 43 _get_lock(&_tty_put_lock); 42 44 _puts("\n[GIET ERROR] in iommu_add_pte2 function\n"); 43 45 _puts("the IOMMU PT1 entry is not mapped / ix1 = "); 44 46 _putx( ix1 ); 45 47 _puts("\n"); 48 _release_lock(&_tty_put_lock); 46 49 _exit(); 47 50 } 48 else { 51 else 52 { 49 53 ptba = pt->pt1[ix1] << 12; 50 54 pt_flags = (unsigned int *) (ptba + 8 * ix2);
Note: See TracChangeset
for help on using the changeset viewer.