Changeset 284 for branch/giet_vm_ioc_drivers/giet_drivers/bdv_driver.c
- Timestamp:
- Jan 31, 2014, 2:37:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branch/giet_vm_ioc_drivers/giet_drivers/bdv_driver.c
r283 r284 1 1 /////////////////////////////////////////////////////////////////////////////////// 2 // File : ioc_driver.c 3 // Date : 23/05/2013 4 // Author : alain greiner 2 // File : bdv_driver.c 3 // Date : 23/05/2013 4 // Author : alain greiner 5 // Maintainer: cesar fuguet 5 6 // Copyright (c) UPMC-LIP6 6 7 /////////////////////////////////////////////////////////////////////////////////// 7 // The ioc_driver.c and ioc_driver.h files are part ot the GIET-VM kernel.8 // The bdv_driver.c and bdv_driver.h files are part ot the GIET-VM kernel. 8 9 // This driver supports the SocLib vci_block_device component, that is 9 10 // a single channel, block oriented, external storage contrÃŽler. … … 14 15 // that is always blocking, but can be called in 4 modes: 15 16 // 16 // - In BOOT_PA mode, the _bdv_access() function use the buffer virtual address 17 // as a physical address (as the page tables are not build) and use a polling 18 // policy on the IOC_STATUS register to detect transfer completion, as 19 // hardware interrupts are not activated. This mode is used by the 20 // boot code to load the map.bin file into memory. 21 // 22 // - In BOOT_VA mode, the _bdv_access() function makes a V2P translation to 23 // compute the buffer physical address, and use a polling policy on IOC_STATUS 24 // register to detect transfer completion. This mode is used by the boot code 25 // to load the various .elf files into memory. 26 // 27 // - In KERNEL mode, the _bdv_access() function makes a V2P translation to 28 // compute the buffer physical address, and use a descheduling strategy: 29 // The ISR executed when transfer completes should restart the calling task. 30 // There is no checking of user access right to the memory buffer. 31 // This mode must be used to access IOC, for an "open" system call. 32 // 33 // - In USER mode, the _bdv_access() function makes a V2P translation to 34 // compute the buffer physical address, and use a descheduling strategy: 17 // - In BOOT_PA mode, the _bdv_access() function uses a polling policy on the 18 // IOC_STATUS register to detect transfer completion, as hardware interrupts 19 // are not activated. This mode is used by the boot code to load the map.bin 20 // file into memory. 21 // 22 // - In BOOT_VA mode, the _bdv_access() function uses a polling policy on 23 // IOC_STATUS register to detect transfer completion. This mode is used by 24 // the boot code to load the various .elf files into memory. 25 // 26 // - In KERNEL mode, the _bdv_access() function uses a descheduling strategy: 27 // The ISR executed when transfer completes should restart the calling task. 28 // There is no checking of user access right to the memory buffer. This mode 29 // must be used to access IOC, for an "open" system call. 30 // 31 // - In USER mode, the _bdv_access() function uses a descheduling strategy: 35 32 // The ISR executed when transfer completes should restart the calling task, 36 33 // The user access right to the memory buffer must be checked. 37 34 // This mode must be used to access IOC, for a "read/write" system call. 38 35 // 39 // As the IOCcomponent can be used by several programs running in parallel,36 // As the BDV component can be used by several programs running in parallel, 40 37 // the _ioc_lock variable guaranties exclusive access to the device. The 41 38 // _bdv_read() and _bdv_write() functions use atomic LL/SC to get the lock. 42 //43 // The IOMMU can be activated or not:44 //45 // 1) When the IOMMU is used, a fixed size 2Mbytes vseg is allocated to46 // the IOC peripheral, in the I/O virtual space, and the user buffer is47 // dynamically remapped in the IOMMU page table. The corresponding entry48 // in the IOMMU PT1 is defined by the kernel _ioc_iommu_ix1 variable.49 // The number of pages to be unmapped is stored in the _ioc_npages variable.50 // The number of PT2 entries is dynamically computed and stored in the51 // kernel _ioc_iommu_npages variable. It cannot be larger than 512.52 // The user buffer is unmapped by the _ioc_completed() function when53 // the transfer is completed.54 //55 // 2/ If the IOMMU is not used, we check that the user buffer is mapped to a56 // contiguous physical buffer (this is generally true because the user space57 // page tables are statically constructed to use contiguous physical memory).58 39 // 59 40 // Finally, the memory buffer must fulfill the following conditions:
Note: See TracChangeset
for help on using the changeset viewer.