Changeset 347
- Timestamp:
- Apr 1, 2013, 8:57:02 PM (12 years ago)
- Location:
- trunk/softs/tsar_boot
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/softs/tsar_boot/README.txt
r302 r347 9 9 10 10 conf/ Platform specific files and ldscript. 11 11 For each platform, we must define a new directory. 12 12 13 13 ---> defs_platform.h: … … 16 16 NB_PROCS per cluster, the NB_CLUSTERS and the base address of 17 17 the TTY, IOC and XICU devices. 18 It also defines the IRQ_PER_PROC constant. This constant is used 19 to know how many XICU irq outputs are connected to each processor. 18 It defines also: 19 -> CACHE_COHERENCE 20 This constant is used by the boot_ioc_read function to know 21 if the buffer used to store the blocks from the block_device 22 must be invalidated in the dcache after the transfert has 23 finished. 24 0 means invalidation must be made. 25 26 -> CACHE_LINE_SIZE 27 This constant defines the size in bytes of a cache line. 28 29 -> IRQ_PER_PROC 30 This constant is used to know how many XICU irq outputs are 31 connected to each processor. 20 32 21 33 ---> platform_soclib.dts: -
trunk/softs/tsar_boot/conf/platform_fpga_de2-115/defs_platform.h
r302 r347 1 #define NB_PROCS 42 #define NB_CLUSTERS 11 #define NB_PROCS 4 2 #define NB_CLUSTERS 1 3 3 4 #define IRQ_PER_PROC 14 #define IRQ_PER_PROC 1 5 5 6 #define IOC_BASE 0xFB000000 7 #define VCIBD_BASE 0xFB000000 8 #define TTY_BASE 0xFC000000 9 #define ICU_BASE 0xFD000000 6 #define CACHE_COHERENCE 1 7 #define CACHE_LINE_SIZE 64//bytes 8 9 #define IOC_BASE 0xFB000000 10 #define VCIBD_BASE 0xFB000000 11 #define TTY_BASE 0xFC000000 12 #define ICU_BASE 0xFD000000 -
trunk/softs/tsar_boot/include/boot_ioc.h
r292 r347 9 9 #endif 10 10 11 #include <defs.h> 11 12 #include <boot_tty.h> 12 13 #include <io.h> … … 34 35 35 36 /** 37 * boot_dbuf_invalidate() 38 * 39 * Invalidate all data cache lines corresponding to a memory buffer. 40 */ 41 #if (CACHE_COHERENCE == 0) 42 void boot_dbuf_invalidate( 43 const void * buffer, 44 unsigned int line_size, 45 unsigned int size); 46 #endif 47 48 /** 36 49 * boot_ioc_write() 37 50 * -
trunk/softs/tsar_boot/src/boot_ioc.c
r302 r347 1 1 #include <boot_ioc.h> 2 #include <defs.h>3 2 4 3 #ifndef SOCLIB_IOC … … 16 15 int boot_ioc_init() 17 16 { 18 #ifndef SOCLIB_IOC 17 #ifdef SOCLIB_IOC 18 return 0; 19 #else 19 20 unsigned char sdcard_rsp; 20 21 … … 55 56 56 57 boot_puts("Finish block device initialization\n\r"); 57 #endif58 58 59 59 return 0; 60 #endif 60 61 } 61 62 … … 101 102 * has finished 102 103 */ 104 105 #ifdef SOCLIB_IOC 106 /////////////////////////////////////////////////////////////////////////////// 107 // SOCLIB version of the boot_ioc_read function 108 103 109 int boot_ioc_read(unsigned int lba, void* buffer, unsigned int count) 104 110 { 105 #ifdef SOCLIB_IOC106 111 107 112 unsigned int * ioc_address = (unsigned int*)VCIBD_BASE; … … 125 130 _boot_ioc_completed(); 126 131 132 #if (CACHE_COHERENCE == 0) 133 boot_dbuf_invalidate(buffer, CACHE_LINE_SIZE, count * 512); 134 #endif 135 return 0; 136 } 137 127 138 #else 139 /////////////////////////////////////////////////////////////////////////////// 140 // FPGA version of the boot_ioc_read function 141 142 int boot_ioc_read(unsigned int lba, void* buffer, unsigned int count) 143 { 128 144 unsigned int sdcard_rsp; 129 145 … … 147 163 } 148 164 } 149 150 #endif151 165 152 166 return 0; 153 167 } 154 155 /** 156 * boot_ioc_write() 157 * 158 * Transfer data from a memory buffer to a file on the block_device. 159 * 160 * \param lba : first block index on the disk 161 * \param buffer : base address of the memory buffer 162 * \param count : number of blocks to be transfered 163 * 164 * \note The source buffer must be in user address space. 165 * 166 *in_reset int _ioc_write(unsigned int lba, void* buffer, unsigned int count) 167 *{ 168 *#ifdef SOCLIB_IOC 169 * 170 * unsigned int * ioc_address = ( unsigned int * )VCIBD_BASE; 171 * 172 * // block_device configuration 173 * iowrite32( &ioc_address[BLOCK_DEVICE_BUFFER], 174 * ( unsigned int ) buffer ); 175 * 176 * iowrite32( &ioc_address[BLOCK_DEVICE_COUNT], 177 * ( unsigned int ) count ); 178 * 179 * iowrite32( &ioc_address[BLOCK_DEVICE_LBA], 180 * ( unsigned int ) lba ); 181 * 182 * iowrite32( &ioc_address[BLOCK_DEVICE_IRQ_ENABLE], 183 * ( unsigned int ) 0 ); 184 * 185 * iowrite32( &ioc_address[BLOCK_DEVICE_OP], 186 * ( unsigned int ) BLOCK_DEVICE_WRITE); 187 * 188 * _boot_ioc_completed(); 189 * 190 *#else 191 * 192 * sdcard_dev_lseek(&_sdcard_device, lba); 193 * sdcard_dev_write(&_sdcard_device, buffer, count*512); 194 * 195 *#endif 196 * 197 * return 0; 198 *} 199 */ 168 #endif 200 169 201 170 /** 202 171 * _dcache_buf_invalidate() 203 172 * 204 * Invalidate all cache lines corresponding to a memory buffer. 205 * This is used by the block_device driver. 206 * 207 *in_reset static void _dcache_buf_invalidate(const void * buffer, unsigned int size) 208 *{ 209 * unsigned int i; 210 * unsigned int dcache_line_size; 211 * 212 * // retrieve dcache line size from config register (bits 12:10) 213 * asm volatile("mfc0 %0, $16, 1" : "=r" (dcache_line_size)); 214 * 215 * dcache_line_size = 2 << ((dcache_line_size>>10) & 0x7); 216 * 217 * // iterate on lines to invalidate each one of them 218 * for ( i=0; i<size; i+=dcache_line_size ) 219 * asm volatile 220 * (" mtc2 %0, $7\n" 221 * : 222 * : "r" (*((char*)buffer+i)) 223 * ); 224 *} 173 * Invalidate all data cache lines corresponding to a memory 174 * buffer (identified by an address and a size). 225 175 */ 176 #if (CACHE_COHERENCE == 0) 177 void boot_dbuf_invalidate ( 178 const void * buffer, 179 unsigned int line_size, 180 unsigned int size) 181 { 182 unsigned int i; 183 184 // iterate on cache lines 185 for (i = 0; i < size; i += line_size) { 186 asm volatile( 187 " cache %0, %1" 188 :// no outputs 189 :"i" (0x11), "R" (*((unsigned char *) buffer + i)) 190 ); 191 } 192 } 193 #endif 226 194 227 195 /*
Note: See TracChangeset
for help on using the changeset viewer.