Changeset 5e77d129 in rtems
- Timestamp:
- 06/14/00 20:32:44 (23 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- b91b1cf
- Parents:
- 9b05600
- Location:
- c/src/lib
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c
r9b05600 r5e77d129 85 85 */ 86 86 87 m68k_enable_caching();87 rtems_cache_enable_instruction(); 88 88 89 89 /* -
c/src/lib/libbsp/m68k/idp/startup/bspstart.c
r9b05600 r5e77d129 91 91 m68k_set_vbr( &M68Kvec ); 92 92 93 m68k_enable_caching();93 rtems_cache_enable_instruction(); 94 94 95 95 /* -
c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c
r9b05600 r5e77d129 74 74 (*(rtems_unsigned8 *)0xfffb0067) = 0x7f; /* make VME access round-robin */ 75 75 76 m68k_enable_caching();76 rtems_cache_enable_instruction(); 77 77 78 78 /* -
c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c
r9b05600 r5e77d129 80 80 /* make VME access round-robin */ 81 81 82 m68k_enable_caching();82 rtems_cache_enable_instruction(); 83 83 84 84 /* -
c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c
r9b05600 r5e77d129 140 140 /* Disable D32 transfers : they don't work on my VMEbus rack */ 141 141 142 m68k_enable_caching();142 rtems_cache_enable_instruction(); 143 143 144 144 /* -
c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
r9b05600 r5e77d129 747 747 * Invalidate the buffer for this descriptor 748 748 */ 749 rtems_ invalidate_multiple_data_cache_lines(rxBd->buffer, rxBd->length);749 rtems_cache_invalidate_multiple_data_lines(rxBd->buffer, rxBd->length); 750 750 751 751 m = sc->rxMbuf[rxBdIndex]; … … 883 883 * Invalidate the buffer for this descriptor 884 884 */ 885 rtems_ invalidate_multiple_data_cache_lines(rxBd->buffer, rxBd->length);885 rtems_cache_invalidate_multiple_data_lines(rxBd->buffer, rxBd->length); 886 886 887 887 m = sc->rxMbuf[rxBdIndex]; … … 1023 1023 * Flush the buffer for this descriptor 1024 1024 */ 1025 rtems_ flush_multiple_data_cache_lines(txBd->buffer, txBd->length);1025 rtems_cache_flush_multiple_data_lines(txBd->buffer, txBd->length); 1026 1026 1027 1027 sc->txMbuf[sc->txBdHead] = m; … … 1151 1151 * Flush the buffer for this descriptor 1152 1152 */ 1153 rtems_ flush_multiple_data_cache_lines(txBd->buffer, txBd->length);1153 rtems_cache_flush_multiple_data_lines(txBd->buffer, txBd->length); 1154 1154 1155 1155 sc->txMbuf[sc->txBdHead] = m; -
c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c
r9b05600 r5e77d129 137 137 */ 138 138 #ifdef INSTRUCTION_CACHE_ENABLE 139 rtems_ enable_inst_cache();139 rtems_cache_enable_instruction(); 140 140 #endif 141 141 142 142 #ifdef DATA_CACHE_ENABLE 143 rtems_ enable_data_cache();143 rtems_cache_enable_data(); 144 144 #endif 145 145 -
c/src/lib/libcpu/i386/cache.c
r9b05600 r5e77d129 16 16 regCr0.cr0.no_write_through = 1; 17 17 i386_set_cr0( regCr0.i ); 18 rtems_ flush_entire_data_cache();18 rtems_cache_flush_entire_data(); 19 19 } 20 20 … … 30 30 regCr0.cr0.no_write_through = 0; 31 31 i386_set_cr0( regCr0.i ); 32 /*rtems_ flush_entire_data_cache();*/32 /*rtems_cache_flush_entire_data();*/ 33 33 } 34 34 … … 39 39 * it does nothing by default. 40 40 * 41 * FIXME: Definitions for I386_CACHE_ALIGNMENT are missing above for 42 * each CPU. The routines below should be implemented per CPU, 41 * FIXME: The routines below should be implemented per CPU, 43 42 * to accomodate the capabilities of each. 44 43 */ 45 44 46 /* FIXME: I don't belong here. */ 47 #define I386_CACHE_ALIGNMENT 16 45 #if defined(I386_CACHE_ALIGNMENT) 46 void _CPU_cache_flush_1_data_line(const void *d_addr) {} 47 void _CPU_cache_invalidate_1_data_line(const void *d_addr) {} 48 void _CPU_cache_freeze_data(void) {} 49 void _CPU_cache_unfreeze_data(void) {} 50 void _CPU_cache_invalidate_1_instruction_line ( const void *d_addr ) {} 51 void _CPU_cache_freeze_instruction(void) {} 52 void _CPU_cache_unfreeze_instruction(void) {} 48 53 49 #if defined(I386_CACHE_ALIGNMENT) 50 #define _CPU_DATA_CACHE_ALIGNMENT I386_CACHE_ALIGNMENT 51 #define _CPU_INST_CACHE_ALIGNEMNT I386_CACHE_ALIGNMENT 52 53 void _CPU_flush_1_data_cache_line(const void *d_addr) {} 54 void _CPU_invalidate_1_data_cache_line(const void *d_addr) {} 55 void _CPU_freeze_data_cache(void) {} 56 void _CPU_unfreeze_data_cache(void) {} 57 void _CPU_invalidate_1_inst_cache_line ( const void *d_addr ) {} 58 void _CPU_freeze_inst_cache(void) {} 59 void _CPU_unfreeze_inst_cache(void) {} 60 61 void _CPU_flush_entire_data_cache(void) 54 void _CPU_cache_flush_entire_data(void) 62 55 { 63 56 asm volatile ("wbinvd"); 64 57 } 65 void _CPU_ invalidate_entire_data_cache(void)58 void _CPU_cache_invalidate_entire_data(void) 66 59 { 67 60 asm volatile ("invd"); 68 61 } 69 62 70 void _CPU_ enable_data_cache(void)63 void _CPU_cache_enable_data(void) 71 64 { 72 65 _CPU_enable_cache(); 73 66 } 74 67 75 void _CPU_ disable_data_cache(void)68 void _CPU_cache_disable_data(void) 76 69 { 77 70 _CPU_disable_cache(); 78 71 } 79 72 80 void _CPU_ invalidate_entire_inst_cache(void)73 void _CPU_cache_invalidate_entire_instruction(void) 81 74 { 82 75 asm volatile ("invd"); 83 76 } 84 77 85 void _CPU_ enable_inst_cache(void)78 void _CPU_cache_enable_instruction(void) 86 79 { 87 80 _CPU_enable_cache(); 88 81 } 89 82 90 void _CPU_ disable_inst_cache( void )83 void _CPU_cache_disable_instruction( void ) 91 84 { 92 85 _CPU_disable_cache(); -
c/src/lib/libcpu/i386/cache_.h
r9b05600 r5e77d129 7 7 8 8 #define I386_CACHE_ALIGNMENT 16 9 #define _CPU_DATA_CACHE_ALIGNMENT I386_CACHE_ALIGNMENT10 #define _CPU_INST_CACHE_ALIGNEMNT I386_CACHE_ALIGNMENT9 #define CPU_DATA_CACHE_ALIGNMENT I386_CACHE_ALIGNMENT 10 #define CPU_INSTRUCTION_CACHE_ALIGNEMNT I386_CACHE_ALIGNMENT 11 11 12 12 #include <libcpu/cache.h> -
c/src/lib/libcpu/i386/page.c
r9b05600 r5e77d129 46 46 cr0 regCr0; 47 47 48 rtems_ flush_entire_data_cache();48 rtems_cache_flush_entire_data(); 49 49 regCr0.i = i386_get_cr0(); 50 50 regCr0.cr0.paging = 0; … … 61 61 regCr0.cr0.paging = 1; 62 62 i386_set_cr0( regCr0.i ); 63 rtems_ flush_entire_data_cache();63 rtems_cache_flush_entire_data(); 64 64 } 65 65 -
c/src/lib/libcpu/m68k/shared/cache/cache.c
r9b05600 r5e77d129 53 53 /* Only the mc68030 has a data cache; it is writethrough only. */ 54 54 55 void _CPU_ flush_1_data_cache_line ( const void * d_addr ) {}56 void _CPU_ flush_entire_data_cache( const void * d_addr ) {}55 void _CPU_cache_flush_1_data_line ( const void * d_addr ) {} 56 void _CPU_cache_flush_entire_data ( const void * d_addr ) {} 57 57 58 void _CPU_ invalidate_1_data_cache_line (58 void _CPU_cache_invalidate_1_data_line ( 59 59 const void * d_addr ) 60 60 { … … 64 64 } 65 65 66 void _CPU_ invalidate_entire_data_cache( void )66 void _CPU_cache_invalidate_entire_data ( void ) 67 67 { 68 68 _CPU_CACR_OR( 0x00000800 ); 69 69 } 70 70 71 void _CPU_ freeze_data_cache( void )71 void _CPU_cache_freeze_data ( void ) 72 72 { 73 73 _CPU_CACR_OR( 0x00000200 ); 74 74 } 75 75 76 void _CPU_ unfreeze_data_cache( void )76 void _CPU_cache_unfreeze_data ( void ) 77 77 { 78 78 _CPU_CACR_AND( 0xFFFFFDFF ); 79 79 } 80 80 81 void _CPU_ enable_data_cache( void )81 void _CPU_cache_enable_data ( void ) 82 82 { 83 83 _CPU_CACR_OR( 0x00000100 ); 84 84 } 85 void _CPU_ disable_data_cache( void )85 void _CPU_cache_disable_data ( void ) 86 86 { 87 87 _CPU_CACR_AND( 0xFFFFFEFF ); … … 92 92 /* Both the 68020 and 68030 have instruction caches */ 93 93 94 void _CPU_ invalidate_1_inst_cache_line (94 void _CPU_cache_invalidate_1_instruction_line ( 95 95 const void * d_addr ) 96 96 { … … 100 100 } 101 101 102 void _CPU_ invalidate_entire_inst_cache( void )102 void _CPU_cache_invalidate_entire_instruction ( void ) 103 103 { 104 104 _CPU_CACR_OR( 0x00000008 ); 105 105 } 106 106 107 void _CPU_ freeze_inst_cache( void )107 void _CPU_cache_freeze_instruction ( void ) 108 108 { 109 109 _CPU_CACR_OR( 0x00000002); 110 110 } 111 111 112 void _CPU_ unfreeze_inst_cache( void )112 void _CPU_cache_unfreeze_instruction ( void ) 113 113 { 114 114 _CPU_CACR_AND( 0xFFFFFFFD ); 115 115 } 116 116 117 void _CPU_ enable_inst_cache( void )117 void _CPU_cache_enable_instruction ( void ) 118 118 { 119 119 _CPU_CACR_OR( 0x00000001 ); 120 120 } 121 121 122 void _CPU_ disable_inst_cache( void )122 void _CPU_cache_disable_instruction ( void ) 123 123 { 124 124 _CPU_CACR_AND( 0xFFFFFFFE ); … … 129 129 130 130 /* Cannot be frozen */ 131 void _CPU_ freeze_data_cache( void ) {}132 void _CPU_ unfreeze_data_cache( void ) {}133 void _CPU_ freeze_inst_cache( void ) {}134 void _CPU_ unfreeze_inst_cache( void ) {}131 void _CPU_cache_freeze_data ( void ) {} 132 void _CPU_cache_unfreeze_data ( void ) {} 133 void _CPU_cache_freeze_instruction ( void ) {} 134 void _CPU_cache_unfreeze_instruction ( void ) {} 135 135 136 void _CPU_ flush_1_data_cache_line (136 void _CPU_cache_flush_1_data_line ( 137 137 const void * d_addr ) 138 138 { … … 141 141 } 142 142 143 void _CPU_ invalidate_1_data_cache_line (143 void _CPU_cache_invalidate_1_data_line ( 144 144 const void * d_addr ) 145 145 { … … 148 148 } 149 149 150 void _CPU_ flush_entire_data_cache( void )150 void _CPU_cache_flush_entire_data ( void ) 151 151 { 152 152 asm volatile ( "cpusha %%dc" :: ); 153 153 } 154 154 155 void _CPU_ invalidate_entire_data_cache( void )155 void _CPU_cache_invalidate_entire_data ( void ) 156 156 { 157 157 asm volatile ( "cinva %%dc" :: ); 158 158 } 159 159 160 void _CPU_ enable_data_cache( void )160 void _CPU_cache_enable_data ( void ) 161 161 { 162 162 _CPU_CACR_OR( 0x80000000 ); 163 163 } 164 164 165 void _CPU_ disable_data_cache( void )165 void _CPU_cache_disable_data ( void ) 166 166 { 167 167 _CPU_CACR_AND( 0x7FFFFFFF ); 168 168 } 169 169 170 void _CPU_ invalidate_1_inst_cache_line (170 void _CPU_cache_invalidate_1_instruction_line ( 171 171 const void * i_addr ) 172 172 { … … 175 175 } 176 176 177 void _CPU_ invalidate_entire_inst_cache( void )177 void _CPU_cache_invalidate_entire_instruction ( void ) 178 178 { 179 179 asm volatile ( "cinva %%ic" :: ); 180 180 } 181 181 182 void _CPU_ enable_inst_cache( void )182 void _CPU_cache_enable_instruction ( void ) 183 183 { 184 184 _CPU_CACR_OR( 0x00008000 ); 185 185 } 186 186 187 void _CPU_ disable_inst_cache( void )187 void _CPU_cache_disable_instruction ( void ) 188 188 { 189 189 _CPU_CACR_AND( 0xFFFF7FFF ); -
c/src/lib/libcpu/m68k/shared/cache/cache_.h
r9b05600 r5e77d129 7 7 8 8 #if defined(__mc68020__) 9 #define M68K_INST _CACHE_ALIGNMENT 169 #define M68K_INSTRUCTION_CACHE_ALIGNMENT 16 10 10 #elif defined(__mc68030__) 11 #define M68K_INST _CACHE_ALIGNMENT 1611 #define M68K_INSTRUCTION_CACHE_ALIGNMENT 16 12 12 #define M68K_DATA_CACHE_ALIGNMENT 16 13 13 #elif ( defined(__mc68040__) || defined (__mc68060__) ) 14 #define M68K_INST _CACHE_ALIGNMENT 1614 #define M68K_INSTRUCTION_CACHE_ALIGNMENT 16 15 15 #define M68K_DATA_CACHE_ALIGNMENT 16 16 16 #endif 17 17 18 18 #if defined(M68K_DATA_CACHE_ALIGNMENT) 19 #define _CPU_DATA_CACHE_ALIGNMENT M68K_DATA_CACHE_ALIGNMENT19 #define CPU_DATA_CACHE_ALIGNMENT M68K_DATA_CACHE_ALIGNMENT 20 20 #endif 21 21 22 #if defined(M68K_INST _CACHE_ALIGNMENT)23 #define _CPU_INST_CACHE_ALIGNMENT M68K_INST_CACHE_ALIGNMENT22 #if defined(M68K_INSTRUCTION_CACHE_ALIGNMENT) 23 #define CPU_INSTRUCTION_CACHE_ALIGNMENT M68K_INSTRUCTION_CACHE_ALIGNMENT 24 24 #endif 25 25 -
c/src/lib/libcpu/powerpc/mpc8xx/console-generic/console-generic.c
r9b05600 r5e77d129 400 400 /* Check that the buffer is ours */ 401 401 if ((RxBd[SCC2_MINOR]->status & M8xx_BD_EMPTY) == 0) { 402 rtems_ invalidate_multiple_data_cache_lines(402 rtems_cache_invalidate_multiple_data_lines( 403 403 (const void *) RxBd[SCC2_MINOR]->buffer, 404 404 RxBd[SCC2_MINOR]->length ); … … 443 443 /* Check that the buffer is ours */ 444 444 if ((RxBd[SCC3_MINOR]->status & M8xx_BD_EMPTY) == 0) { 445 rtems_ invalidate_multiple_data_cache_lines(445 rtems_cache_invalidate_multiple_data_lines( 446 446 (const void *) RxBd[SCC3_MINOR]->buffer, 447 447 RxBd[SCC3_MINOR]->length ); … … 485 485 /* Check that the buffer is ours */ 486 486 if ((RxBd[SCC4_MINOR]->status & M8xx_BD_EMPTY) == 0) { 487 rtems_ invalidate_multiple_data_cache_lines(487 rtems_cache_invalidate_multiple_data_lines( 488 488 (const void *) RxBd[SCC4_MINOR]->buffer, 489 489 RxBd[SCC4_MINOR]->length ); … … 527 527 /* Check that the buffer is ours */ 528 528 if ((RxBd[SMC1_MINOR]->status & M8xx_BD_EMPTY) == 0) { 529 rtems_ invalidate_multiple_data_cache_lines(529 rtems_cache_invalidate_multiple_data_lines( 530 530 (const void *) RxBd[SMC1_MINOR]->buffer, 531 531 RxBd[SMC1_MINOR]->length ); … … 569 569 /* Check that the buffer is ours */ 570 570 if ((RxBd[SMC2_MINOR]->status & M8xx_BD_EMPTY) == 0) { 571 rtems_ invalidate_multiple_data_cache_lines(571 rtems_cache_invalidate_multiple_data_lines( 572 572 (const void *) RxBd[SMC2_MINOR]->buffer, 573 573 RxBd[SMC2_MINOR]->length ); … … 985 985 return -1; 986 986 } 987 rtems_ invalidate_multiple_data_cache_lines(987 rtems_cache_invalidate_multiple_data_lines( 988 988 (const void *) RxBd[minor]->buffer, 989 989 RxBd[minor]->length … … 1005 1005 ) 1006 1006 { 1007 rtems_ flush_multiple_data_cache_lines( buf, len );1007 rtems_cache_flush_multiple_data_lines( buf, len ); 1008 1008 TxBd[minor]->buffer = (char *) buf; 1009 1009 TxBd[minor]->length = len; … … 1024 1024 continue; 1025 1025 txBuf[minor] = *buf++; 1026 rtems_ flush_multiple_data_cache_lines(1026 rtems_cache_flush_multiple_data_lines( 1027 1027 (const void *) TxBd[minor]->buffer, 1028 1028 TxBd[minor]->length -
c/src/lib/libcpu/powerpc/shared/src/cache.c
r9b05600 r5e77d129 43 43 } while (0) 44 44 45 void _CPU_ enable_data_cache(45 void _CPU_cache_enable_data ( 46 46 void ) 47 47 { … … 52 52 } 53 53 54 void _CPU_ disable_data_cache(54 void _CPU_cache_disable_data ( 55 55 void ) 56 56 { … … 61 61 } 62 62 63 void _CPU_ enable_inst_cache(63 void _CPU_cache_enable_inst ( 64 64 void ) 65 65 { … … 70 70 } 71 71 72 void _CPU_ disable_inst_cache(72 void _CPU_cache_disable_inst ( 73 73 void ) 74 74 { … … 86 86 __asm__ volatile ("isync\n"::) 87 87 88 void _CPU_ flush_1_data_cache_line(88 void _CPU_cache_flush_1_data_line( 89 89 const void * _address ) 90 90 { … … 93 93 } 94 94 95 void _CPU_ invalidate_1_data_cache_line(95 void _CPU_cache_invalidate_1_data_line( 96 96 const void * _address ) 97 97 { … … 100 100 } 101 101 102 void _CPU_ flush_entire_data_cache( void ) {}103 void _CPU_ invalidate_entire_data_cache( void ) {}104 void _CPU_ freeze_data_cache( void ) {}105 void _CPU_ unfreeze_data_cache( void ) {}102 void _CPU_cache_flush_entire_data ( void ) {} 103 void _CPU_cache_invalidate_entire_data ( void ) {} 104 void _CPU_cache_freeze_data ( void ) {} 105 void _CPU_cache_unfreeze_data ( void ) {} 106 106 107 void _CPU_ enable_data_cache( void )107 void _CPU_cache_enable_data ( void ) 108 108 { 109 109 unsigned32 r1; … … 113 113 } 114 114 115 void _CPU_ disable_data_cache( void )115 void _CPU_cache_disable_data ( void ) 116 116 { 117 117 unsigned32 r1; … … 121 121 } 122 122 123 void _CPU_ invalidate_1_inst_cache_line(123 void _CPU_cache_invalidate_1_inst_line( 124 124 const void * _address ) 125 125 { … … 128 128 } 129 129 130 void _CPU_ invalidate_entire_inst_cache( void ) {}131 void _CPU_ freeze_inst_cache( void ) {}132 void _CPU_ unfreeze_inst_cache( void ) {}130 void _CPU_cache_invalidate_entire_inst ( void ) {} 131 void _CPU_cache_freeze_inst ( void ) {} 132 void _CPU_cache_unfreeze_inst ( void ) {} 133 133 134 void _CPU_ enable_inst_cache( void )134 void _CPU_cache_enable_inst ( void ) 135 135 { 136 136 unsigned32 r1; … … 140 140 } 141 141 142 void _CPU_ disable_inst_cache( void )142 void _CPU_cache_disable_inst ( void ) 143 143 { 144 144 unsigned32 r1; -
c/src/lib/libcpu/powerpc/shared/src/cache_.h
r9b05600 r5e77d129 16 16 17 17 #if defined(ppc603) /* And possibly others */ 18 #define _CPU_DATA_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT19 #define _CPU_INST_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT18 #define CPU_DATA_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT 19 #define CPU_INSTRUCTION_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT 20 20 21 21 #elif ( defined(mpc860) || defined(mpc821) ) 22 22 23 #define _CPU_DATA_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT24 #define _CPU_INST_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT23 #define CPU_DATA_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT 24 #define CPU_INSTRUCTION_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT 25 25 26 26 #endif -
c/src/lib/libcpu/shared/include/cache.h
r9b05600 r5e77d129 10 10 #include <sys/types.h> 11 11 12 void _CPU_disable_cache(); 13 void _CPU_enable_cache(); 14 15 void _CPU_flush_1_data_cache_line(const void *d_addr); 16 void _CPU_invalidate_1_data_cache_line(const void *d_addr); 17 void _CPU_freeze_data_cache(void); 18 void _CPU_unfreeze_data_cache(void); 19 void _CPU_invalidate_1_inst_cache_line(const void *d_addr); 20 void _CPU_freeze_inst_cache(void); 21 void _CPU_unfreeze_inst_cache(void); 22 23 void _CPU_flush_entire_data_cache(void); 24 void _CPU_invalidate_entire_data_cache(void); 25 void _CPU_enable_data_cache(void); 26 void _CPU_disable_data_cache(void); 27 void _CPU_invalidate_entire_inst_cache(void); 28 void _CPU_enable_inst_cache(void); 29 void _CPU_disable_inst_cache(void); 12 void _CPU_cache_flush_1_data_line(const void *d_addr); 13 void _CPU_cache_invalidate_1_data_line(const void *d_addr); 14 void _CPU_cache_freeze_data(void); 15 void _CPU_cache_unfreeze_data(void); 16 void _CPU_cache_invalidate_1_instruction_line(const void *d_addr); 17 void _CPU_cache_freeze_instruction(void); 18 void _CPU_cache_unfreeze_instruction(void); 19 void _CPU_cache_flush_entire_data(void); 20 void _CPU_cache_invalidate_entire_data(void); 21 void _CPU_cache_enable_data(void); 22 void _CPU_cache_disable_data(void); 23 void _CPU_cache_invalidate_entire_instruction(void); 24 void _CPU_cache_enable_instruction(void); 25 void _CPU_cache_disable_instruction(void); 30 26 31 27 #endif -
c/src/lib/libcpu/shared/src/cache_aligned_malloc.c
r9b05600 r5e77d129 33 33 * block beyond the header. 34 34 */ 35 #if defined( _CPU_DATA_CACHE_ALIGNMENT)35 #if defined(CPU_DATA_CACHE_ALIGNMENT) 36 36 return (void *) ((((unsigned long) 37 malloc( nbytes + _CPU_DATA_CACHE_ALIGNMENT - 1 ))38 + _CPU_DATA_CACHE_ALIGNMENT - 1 ) &(~(_CPU_DATA_CACHE_ALIGNMENT - 1)) );37 malloc( nbytes + CPU_DATA_CACHE_ALIGNMENT - 1 )) 38 + CPU_DATA_CACHE_ALIGNMENT - 1 ) &(~(CPU_DATA_CACHE_ALIGNMENT - 1)) ); 39 39 #else 40 40 return malloc( nbytes ); -
c/src/lib/libcpu/shared/src/cache_manager.c
r9b05600 r5e77d129 12 12 * The functions in this file implement the API to the RTEMS Cache Manager and 13 13 * are divided into data cache and instruction cache functions. Data cache 14 * functions are only declaredif a data cache is supported. Instruction15 * cache functions are only declaredif an instruction cache is supported.16 * Support for a particular cache exists only if _CPU_x_CACHE_ALIGNMENT is17 * defined, where x E {DATA, INST }. These definitions are found in the CPU18 * dependent source files in the supercore, often19 * 20 * rtems/c/src/ exec/score/cpu/CPU/rtems/score/CPU.h14 * functions only have bodies if a data cache is supported. Instruction 15 * cache functions only have bodies if an instruction cache is supported. 16 * Support for a particular cache exists only if CPU_x_CACHE_ALIGNMENT is 17 * defined, where x E {DATA, INSTRUCTION}. These definitions are found in 18 * the Cache Manager Wrapper header files, often 19 * 20 * rtems/c/src/lib/libcpu/CPU/cache_.h 21 21 * 22 22 * The functions below are implemented with CPU dependent inline routines 23 * also found in the above file. In the event that a CPU does not support a 24 * specific function, the CPU dependent routine does nothing (but does exist). 23 * found in the cache.c files for each CPU. In the event that a CPU does 24 * not support a specific function for a cache it has, the CPU dependent 25 * routine does nothing (but does exist). 25 26 * 26 27 * At this point, the Cache Manager makes no considerations, and provides no … … 46 47 */ 47 48 void 48 rtems_ flush_multiple_data_cache_lines( const void * d_addr, size_t n_bytes )49 { 50 #if defined( _CPU_DATA_CACHE_ALIGNMENT)49 rtems_cache_flush_multiple_data_lines( const void * d_addr, size_t n_bytes ) 50 { 51 #if defined(CPU_DATA_CACHE_ALIGNMENT) 51 52 const void * final_address; 52 53 … … 58 59 59 60 final_address = (void *)((size_t)d_addr + n_bytes - 1); 60 d_addr = (void *)((size_t)d_addr & ~( _CPU_DATA_CACHE_ALIGNMENT - 1));61 d_addr = (void *)((size_t)d_addr & ~(CPU_DATA_CACHE_ALIGNMENT - 1)); 61 62 while( d_addr <= final_address ) { 62 _CPU_ flush_1_data_cache_line( d_addr );63 d_addr = (void *)((size_t)d_addr + _CPU_DATA_CACHE_ALIGNMENT);63 _CPU_cache_flush_1_data_line( d_addr ); 64 d_addr = (void *)((size_t)d_addr + CPU_DATA_CACHE_ALIGNMENT); 64 65 } 65 66 #endif … … 74 75 75 76 void 76 rtems_ invalidate_multiple_data_cache_lines( const void * d_addr, size_t n_bytes )77 { 78 #if defined( _CPU_DATA_CACHE_ALIGNMENT)77 rtems_cache_invalidate_multiple_data_lines( const void * d_addr, size_t n_bytes ) 78 { 79 #if defined(CPU_DATA_CACHE_ALIGNMENT) 79 80 const void * final_address; 80 81 … … 86 87 87 88 final_address = (void *)((size_t)d_addr + n_bytes - 1); 88 d_addr = (void *)((size_t)d_addr & ~( _CPU_DATA_CACHE_ALIGNMENT - 1));89 d_addr = (void *)((size_t)d_addr & ~(CPU_DATA_CACHE_ALIGNMENT - 1)); 89 90 while( final_address > d_addr ) { 90 _CPU_ invalidate_1_data_cache_line( d_addr );91 d_addr = (void *)((size_t)d_addr + _CPU_DATA_CACHE_ALIGNMENT);91 _CPU_cache_invalidate_1_data_line( d_addr ); 92 d_addr = (void *)((size_t)d_addr + CPU_DATA_CACHE_ALIGNMENT); 92 93 } 93 94 #endif … … 100 101 */ 101 102 void 102 rtems_ flush_entire_data_cache( void )103 { 104 #if defined( _CPU_DATA_CACHE_ALIGNMENT)103 rtems_cache_flush_entire_data( void ) 104 { 105 #if defined(CPU_DATA_CACHE_ALIGNMENT) 105 106 /* 106 107 * Call the CPU-specific routine 107 108 */ 108 _CPU_ flush_entire_data_cache();109 _CPU_cache_flush_entire_data(); 109 110 #endif 110 111 } … … 116 117 */ 117 118 void 118 rtems_ invalidate_entire_data_cache( void )119 { 120 #if defined( _CPU_DATA_CACHE_ALIGNMENT)119 rtems_cache_invalidate_entire_data( void ) 120 { 121 #if defined(CPU_DATA_CACHE_ALIGNMENT) 121 122 /* 122 123 * Call the CPU-specific routine 123 124 */ 124 125 125 _CPU_ invalidate_entire_data_cache();126 _CPU_cache_invalidate_entire_data(); 126 127 #endif 127 128 } … … 132 133 */ 133 134 int 134 rtems_ get_data_cache_line_size( void )135 { 136 #if defined( _CPU_DATA_CACHE_ALIGNMENT)137 return _CPU_DATA_CACHE_ALIGNMENT;135 rtems_cache_get_data_line_size( void ) 136 { 137 #if defined(CPU_DATA_CACHE_ALIGNMENT) 138 return CPU_DATA_CACHE_ALIGNMENT; 138 139 #else 139 140 return 0; … … 147 148 */ 148 149 void 149 rtems_ freeze_data_cache( void )150 { 151 #if defined( _CPU_DATA_CACHE_ALIGNMENT)152 _CPU_ freeze_data_cache();150 rtems_cache_freeze_data( void ) 151 { 152 #if defined(CPU_DATA_CACHE_ALIGNMENT) 153 _CPU_cache_freeze_data(); 153 154 #endif 154 155 } … … 158 159 * This function unfreezes the instruction cache. 159 160 */ 160 void rtems_ unfreeze_data_cache( void )161 { 162 #if defined( _CPU_DATA_CACHE_ALIGNMENT)163 _CPU_ unfreeze_data_cache();161 void rtems_cache_unfreeze_data( void ) 162 { 163 #if defined(CPU_DATA_CACHE_ALIGNMENT) 164 _CPU_cache_unfreeze_data(); 164 165 #endif 165 166 } … … 168 169 /* Turn on the data cache. */ 169 170 void 170 rtems_ enable_data_cache( void )171 { 172 #if defined( _CPU_DATA_CACHE_ALIGNMENT)173 _CPU_ enable_data_cache();171 rtems_cache_enable_data( void ) 172 { 173 #if defined(CPU_DATA_CACHE_ALIGNMENT) 174 _CPU_cache_enable_data(); 174 175 #endif 175 176 } … … 178 179 /* Turn off the data cache. */ 179 180 void 180 rtems_ disable_data_cache( void )181 { 182 #if defined( _CPU_DATA_CACHE_ALIGNMENT)183 _CPU_ disable_data_cache();181 rtems_cache_disable_data( void ) 182 { 183 #if defined(CPU_DATA_CACHE_ALIGNMENT) 184 _CPU_cache_disable_data(); 184 185 #endif 185 186 } … … 197 198 */ 198 199 void 199 rtems_ invalidate_multiple_inst_cache_lines( const void * i_addr, size_t n_bytes )200 { 201 #if defined( _CPU_INST_CACHE_ALIGNMENT)200 rtems_cache_invalidate_multiple_instruction_lines( const void * i_addr, size_t n_bytes ) 201 { 202 #if defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) 202 203 const void * final_address; 203 204 … … 209 210 210 211 final_address = (void *)((size_t)i_addr + n_bytes - 1); 211 i_addr = (void *)((size_t)i_addr & ~( _CPU_INST_CACHE_ALIGNMENT - 1));212 i_addr = (void *)((size_t)i_addr & ~(CPU_INSTRUCTION_CACHE_ALIGNMENT - 1)); 212 213 while( final_address > i_addr ) { 213 _CPU_ invalidate_1_inst_cache_line( i_addr );214 i_addr = (void *)((size_t)i_addr + _CPU_INST_CACHE_ALIGNMENT);214 _CPU_cache_invalidate_1_instruction_line( i_addr ); 215 i_addr = (void *)((size_t)i_addr + CPU_INSTRUCTION_CACHE_ALIGNMENT); 215 216 } 216 217 #endif … … 223 224 */ 224 225 void 225 rtems_ invalidate_entire_inst_cache( void )226 { 227 #if defined( _CPU_INST_CACHE_ALIGNMENT)226 rtems_cache_invalidate_entire_instruction( void ) 227 { 228 #if defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) 228 229 /* 229 230 * Call the CPU-specific routine 230 231 */ 231 232 232 _CPU_ invalidate_entire_inst_cache();233 _CPU_cache_invalidate_entire_instruction(); 233 234 #endif 234 235 } … … 239 240 */ 240 241 int 241 rtems_ get_inst_cache_line_size( void )242 { 243 #if defined( _CPU_INST_CACHE_ALIGNMENT)244 return _CPU_INST_CACHE_ALIGNMENT;242 rtems_cache_get_instruction_line_size( void ) 243 { 244 #if defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) 245 return CPU_INSTRUCTION_CACHE_ALIGNMENT; 245 246 #else 246 247 return 0; … … 254 255 */ 255 256 void 256 rtems_ freeze_inst_cache( void )257 { 258 #if defined( _CPU_INST_CACHE_ALIGNMENT)259 _CPU_ freeze_inst_cache();257 rtems_cache_freeze_instruction( void ) 258 { 259 #if defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) 260 _CPU_cache_freeze_instruction(); 260 261 #endif 261 262 } … … 265 266 * This function unfreezes the instruction cache. 266 267 */ 267 void rtems_ unfreeze_inst_cache( void )268 { 269 #if defined( _CPU_INST_CACHE_ALIGNMENT)270 _CPU_ unfreeze_inst_cache();268 void rtems_cache_unfreeze_instruction( void ) 269 { 270 #if defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) 271 _CPU_cache_unfreeze_instruction(); 271 272 #endif 272 273 } … … 275 276 /* Turn on the instruction cache. */ 276 277 void 277 rtems_ enable_inst_cache( void )278 { 279 #if defined( _CPU_INST_CACHE_ALIGNMENT)280 _CPU_ enable_inst_cache();278 rtems_cache_enable_instruction( void ) 279 { 280 #if defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) 281 _CPU_cache_enable_instruction(); 281 282 #endif 282 283 } … … 285 286 /* Turn off the instruction cache. */ 286 287 void 287 rtems_ disable_inst_cache( void )288 { 289 #if defined( _CPU_INST_CACHE_ALIGNMENT)290 _CPU_ disable_inst_cache();291 #endif 292 } 288 rtems_cache_disable_instruction( void ) 289 { 290 #if defined(CPU_INSTRUCTION_CACHE_ALIGNMENT) 291 _CPU_cache_disable_instruction(); 292 #endif 293 }
Note: See TracChangeset
for help on using the changeset viewer.