Changeset 481 for soft/giet_vm
- Timestamp:
- Jan 1, 2015, 8:23:48 PM (10 years ago)
- Location:
- soft/giet_vm/giet_drivers
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/dma_driver.c
r456 r481 278 278 } 279 279 280 unsigned int ko;281 280 unsigned int ppn; 282 281 unsigned int flags; … … 313 312 314 313 // get src_paddr buffer physical addresse 315 ko = _v2p_translate( (page_table_t*)pt, // page table pointer 316 src_vaddr>>12, // vpn 317 &ppn, // ppn 318 &flags ); // flags 319 if ( ko ) 320 { 321 _puts("\n[DMA ERROR] in _dma_copy() : source buffer unmapped\n"); 322 _exit(); 323 } 314 _v2p_translate( (page_table_t*)pt, // page table pointer 315 src_vaddr>>12, // vpn 316 &ppn, // ppn 317 &flags ); // flags 324 318 unsigned long long src_paddr = (((unsigned long long)ppn) << 12) | 325 319 (unsigned long long)(src_vaddr & 0x00000FFF); 326 320 327 321 // get dst_paddr buffer physical addresse 328 ko = _v2p_translate( (page_table_t*)pt, // page table pointer 329 dst_vaddr>>12, // vpn 330 &ppn, // ppn 331 &flags ); // flags 332 if ( ko ) 333 { 334 _puts("\n[DMA ERROR] in _dma_copy() : dest buffer unmapped\n"); 335 _exit(); 336 } 322 _v2p_translate( (page_table_t*)pt, // page table pointer 323 dst_vaddr>>12, // vpn 324 &ppn, // ppn 325 &flags ); // flags 337 326 unsigned long long dst_paddr = (((unsigned long long)ppn) << 12) | 338 327 (unsigned long long)(dst_vaddr & 0x00000FFF); -
soft/giet_vm/giet_drivers/hba_driver.c
r456 r481 173 173 174 174 // get ppn and flags 175 ko =_v2p_translate( (page_table_t*)user_pt_vbase,176 177 178 175 _v2p_translate( (page_table_t*)user_pt_vbase, 176 vpn, 177 &ppn, 178 &flags ); 179 179 180 180 // check access rights 181 if ( ko )182 {183 _puts("[GIET ERROR] in _hba_set_cmd() : user buffer unmapped\n");184 return -1;185 }186 181 if ((flags & PTE_U) == 0) 187 182 { … … 261 256 unsigned int ppn; 262 257 unsigned int flags; 263 unsigned int fail;264 258 unsigned int vbase; 265 259 unsigned int c; // c == command index … … 281 275 // Command list physical addresse 282 276 vbase = (unsigned int)(&hba_cmd_list[channel]); 283 fail = _v2p_translate( (page_table_t*)pt, 284 vbase>>12, 285 &ppn, 286 &flags ); 287 if ( fail ) 288 { 289 _puts("[GIET ERROR] in _hba_init() : command list unmapped\n"); 290 return -1; 291 } 277 _v2p_translate( (page_table_t*)pt, 278 vbase>>12, 279 &ppn, 280 &flags ); 292 281 hba_cmd_list_paddr[channel] = ((paddr_t)ppn) | (vbase & 0xFFF); 293 282 … … 296 285 { 297 286 vbase = (unsigned int)(&hba_cmd_table[channel][c]); 298 fail = _v2p_translate( (page_table_t*)pt, 299 vbase>>12, 300 &ppn, 301 &flags ); 302 if ( fail ) 303 { 304 _puts("[GIET ERROR] in _hba_init() : command table unmapped\n"); 305 return -1; 306 } 287 _v2p_translate( (page_table_t*)pt, 288 vbase>>12, 289 &ppn, 290 &flags ); 307 291 hba_cmd_table_paddr[channel][c] = ((paddr_t)ppn) | (vbase & 0xFFF); 308 292 } -
soft/giet_vm/giet_drivers/ioc_driver.c
r456 r481 150 150 151 151 // get user buffer first page ppn and flags 152 unsigned int ko = _v2p_translate( (page_table_t*)pt_vbase, 153 buf_vaddr >> 12, 154 &ppn, 155 &flags ); 152 _v2p_translate( (page_table_t*)pt_vbase, 153 buf_vaddr >> 12, 154 &ppn, 155 &flags ); 156 156 157 // check access rights 157 if ( ko )158 {159 _puts("\n[IOC ERROR] in _ioc_access() : buffer unmapped\n");160 _exit();161 }162 163 158 if ( (mode == IOC_USER_MODE) && ((flags & PTE_U) == 0) ) 164 159 { -
soft/giet_vm/giet_drivers/mmc_driver.c
r456 r481 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 7 8 #include < giet_config.h>8 #include <hard_config.h> 9 9 #include <mmc_driver.h> 10 10 #include <tty0.h> 11 #include <locks.h> 11 12 #include <utils.h> 13 12 14 #include <io.h> 13 15 … … 89 91 } 90 92 91 // get the hard lock protecting exclusive access to MEMC92 while ( _mmc_get_register(cluster_xy, 0, MEMC_LOCK));93 // get the hard queuing lock protecting exclusive access to MEMC 94 _spin_lock_acquire( &_mmc_lock[x][y] ); 93 95 94 96 // write inval arguments 95 _mmc_set_register( cluster_xy, 0, MEMC_ADDR_LO , (unsigned int)buf_paddr);96 _mmc_set_register( cluster_xy, 0, MEMC_ADDR_HI , (unsigned int)(buf_paddr>>32));97 _mmc_set_register( cluster_xy, 0, MEMC_BUF_LENGTH, buf_length);98 _mmc_set_register( cluster_xy, 0, MEMC_CMD_TYPE , MEMC_CMD_INVAL);97 _mmc_set_register( cluster_xy , 0 , MEMC_ADDR_LO , (unsigned int)buf_paddr ); 98 _mmc_set_register( cluster_xy , 0 , MEMC_ADDR_HI , (unsigned int)(buf_paddr>>32) ); 99 _mmc_set_register( cluster_xy , 0 , MEMC_BUF_LENGTH, buf_length ); 100 _mmc_set_register( cluster_xy , 0 , MEMC_CMD_TYPE , MEMC_CMD_INVAL ); 99 101 100 102 // release the lock 101 _ mmc_set_register(cluster_xy, 0, MEMC_LOCK, 0);103 _spin_lock_release( &_mmc_lock[x][y] ); 102 104 } 103 105 … … 118 120 } 119 121 120 // get the hard lock protecting exclusive access to MEMC121 while ( _mmc_get_register(cluster_xy, 0, MEMC_LOCK));122 // get the hard queuing lock protecting exclusive access to MEMC 123 _spin_lock_acquire( &_mmc_lock[x][y] ); 122 124 123 125 // write inval arguments … … 128 130 129 131 // release the lock 130 _ mmc_set_register(cluster_xy, 0, MEMC_LOCK, 0);132 _spin_lock_release( &_mmc_lock[x][y] ); 131 133 } 132 134 -
soft/giet_vm/giet_drivers/mmc_driver.h
r345 r481 8 8 #ifndef _GIET_MMC_DRIVERS_H_ 9 9 #define _GIET_MMC_DRIVERS_H_ 10 11 #include <hard_config.h> 12 #include <locks.h> 10 13 11 14 /////////////////////////////////////////////////////////////////////////////////// … … 30 33 31 34 #define MMC_REG(func,idx) ((func<<7)|idx) 35 36 /////////////////////////////////////////////////////////////////////////////// 37 // Distributed locks protecting MMC components (one per cluster) 38 /////////////////////////////////////////////////////////////////////////////// 39 40 spin_lock_t _mmc_lock[X_SIZE][Y_SIZE] __attribute__((aligned(64))); 32 41 33 42 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/nic_driver.c
r456 r481 49 49 # error: You must define USE_IOB in the hard_config.h file 50 50 #endif 51 52 #if !defined( GIET_NIC_NBUFS )53 # error: You must define GIET_NIC_NBUFS in the giet_config.h file54 #endif55 56 #if !defined( GIET_NIC_BUFSIZE )57 # error: You must define GIET_NIC_BUFSIZE in the giet_config.h file58 #endif59 60 #if !defined( GIET_NIC_TIMEOUT )61 # error: You must define GIET_NIC_TIMEOUT in the giet_config.h file62 #endif63 64 #define in_unckdata __attribute__((section (".unckdata")))65 51 66 52 /////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/nic_driver.h
r456 r481 76 76 }; 77 77 78 ///////////////////////////////////////////////////////////////////////////////////// 78 ////////////////////////////////////////////////////////////////////////////////////////////// 79 79 // Channel Addressable Registers 80 // A container descriptor has the following form: 81 // LOW WORD : 32 LSB bits of the container physical base address 82 // HIGH WORD : 16 MSB bits of the container physical base address + status (bit 31) 83 ///////////////////////////////////////////////////////////////////////////////////// 80 // A buffer descriptor occupies 64 bytes, but only 8 bytes (two 32 bits words) are useful: 81 // LOW WORD contains the 32 LSB bits of the buffer paddr 82 // HIGH WORD contains the 16 MSB bits of the buffer paddr, plus status (bit 31) 83 ////////////////////////////////////////////////////////////////////////////////////////////// 84 84 85 enum SoclibMultiNicChannelRegisters 85 86 { 86 87 NIC_RX_DESC_LO_0 = 0, // RX_0 descriptor low word (Read/Write) 87 88 NIC_RX_DESC_HI_0 = 1, // RX_0 descriptor high word (Read/Write) 88 NIC_RX_DESC_LO_1 = 2,// RX_1 descriptor low word (Read/Write)89 NIC_RX_DESC_HI_1 = 3,// RX_1 descriptor high word (Read/Write)90 NIC_TX_DESC_LO_0 = 4,// TX_0 descriptor low word (Read/Write)91 NIC_TX_DESC_HI_0 = 5,// TX_0 descriptor high word (Read/Write)92 NIC_TX_DESC_LO_1 = 6,// TX_1 descriptor low word (Read/Write)93 NIC_TX_DESC_HI_1 = 7,// TX_1 descriptor high word (Read/Write)94 NIC_MAC_4 = 8,// channel mac address 32 LSB bits (Read Only)95 NIC_MAC_2 = 9,// channel mac address 16 LSB bits (Read Only)96 NIC_RX_RUN = 10, // RX packets can be received (write_only)97 NIC_TX_RUN = 11, // TX packets can be transmitted (write_only)89 NIC_RX_DESC_LO_1 = 16, // RX_1 descriptor low word (Read/Write) 90 NIC_RX_DESC_HI_1 = 17, // RX_1 descriptor high word (Read/Write) 91 NIC_TX_DESC_LO_0 = 32, // TX_0 descriptor low word (Read/Write) 92 NIC_TX_DESC_HI_0 = 33, // TX_0 descriptor high word (Read/Write) 93 NIC_TX_DESC_LO_1 = 48, // TX_1 descriptor low word (Read/Write) 94 NIC_TX_DESC_HI_1 = 49, // TX_1 descriptor high word (Read/Write) 95 NIC_MAC_4 = 64, // channel mac address 32 LSB bits (Read Only) 96 NIC_MAC_2 = 65, // channel mac address 16 LSB bits (Read Only) 97 NIC_RX_RUN = 66, // RX packets can be received (write_only) 98 NIC_TX_RUN = 67, // TX packets can be transmitted (write_only) 98 99 }; 99 100
Note: See TracChangeset
for help on using the changeset viewer.