Changeset 615 for soft/giet_vm/giet_drivers/mmc_driver.c
- Timestamp:
- Jul 15, 2015, 6:17:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/mmc_driver.c
r545 r615 39 39 40 40 /////////////////////////////////////////////////////////////////////////////// 41 // Distributed locks protecting MMC components (one per cluster) 42 /////////////////////////////////////////////////////////////////////////////// 41 // Locks protecting MMC components (one per cluster) 42 // There are two kinds of lock: the _mmc_lock table contains all the locks and 43 // and is stored in the kernel data segment, whereas the _mmc_distributed_lock 44 // contains the addresses of locks which are distributed in every cluster (each 45 // cluster contains the lock which protects its own mmc_component). 46 // The global variable mmc_boot_mode define the type of lock which is used, 47 // and must be defined in both kernel_init.c and boot.c files. 48 // - the boot code must use a spin_lock because the kernel heap is not set. 49 // - the kernel code can use a sqt_lock when the kernel heap is set. 50 /////////////////////////////////////////////////////////////////////////////// 51 52 extern unsigned int _mmc_boot_mode; 43 53 44 54 __attribute__((section(".kdata"))) 45 spin_lock_t _mmc_lock[X_SIZE][Y_SIZE] __attribute__((aligned(64))); 55 spin_lock_t _mmc_lock[X_SIZE][Y_SIZE] __attribute__((aligned(64))); 56 57 __attribute__((section(".kdata"))) 58 spin_lock_t* _mmc_distributed_lock[X_SIZE][Y_SIZE]; 59 60 ////////////////////////////////////////////////////////////////////////////// 61 // This function initializes the distributed locks stored in the kernel heaps 62 ////////////////////////////////////////////////////////////////////////////// 63 64 void _mmc_init_locks() 65 { 66 unsigned int cx; // cluster X coordinate 67 unsigned int cy; // cluster Y coordinate 68 69 for ( cx = 0 ; cx < X_SIZE ; cx++ ) 70 { 71 for ( cy = 0 ; cy < Y_SIZE ; cy++ ) 72 { 73 _mmc_distributed_lock[cx][cy] = _remote_malloc( sizeof(spin_lock_t), cx, cy ); 74 _spin_lock_init( _mmc_distributed_lock[cx][cy] ); 75 } 76 } 77 } 46 78 47 79 /////////////////////////////////////////////////////////////////////////////// … … 105 137 106 138 // get the lock protecting exclusive access to MEMC 107 _spin_lock_acquire( &_mmc_lock[x][y] ); 139 if ( _mmc_boot_mode ) _spin_lock_acquire( &_mmc_lock[x][y] ); 140 else _spin_lock_acquire( _mmc_distributed_lock[x][y] ); 108 141 109 142 // write inval arguments … … 114 147 115 148 // release the lock 116 _spin_lock_release( &_mmc_lock[x][y] ); 149 if ( _mmc_boot_mode ) _spin_lock_release( &_mmc_lock[x][y] ); 150 else _spin_lock_release( _mmc_distributed_lock[x][y] ); 117 151 } 118 152 … … 140 174 141 175 // get the lock protecting exclusive access to MEMC 142 _spin_lock_acquire( &_mmc_lock[x][y] ); 176 if ( _mmc_boot_mode ) _spin_lock_acquire( &_mmc_lock[x][y] ); 177 else _spin_lock_acquire( _mmc_distributed_lock[x][y] ); 143 178 144 179 // write inval arguments … … 149 184 150 185 // release the lock 151 _spin_lock_release( &_mmc_lock[x][y] ); 186 if ( _mmc_boot_mode ) _spin_lock_release( &_mmc_lock[x][y] ); 187 else _spin_lock_release( _mmc_distributed_lock[x][y] ); 152 188 } 153 189
Note: See TracChangeset
for help on using the changeset viewer.