Changeset 0ab362c in mainline for kernel/arch/arm32/src/cpu/cpu.c
- Timestamp:
- 2012-11-22T14:36:04Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e32720ff
- Parents:
- 1f7753a (diff), 0f2c80a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/cpu/cpu.c
r1f7753a r0ab362c 44 44 /** Implementators (vendor) names */ 45 45 static const char *imp_data[] = { 46 "?", /* IMP_DATA_START_OFFSET */ 47 "ARM Ltd", /* 0x41 */ 48 "", /* 0x42 */ 49 "", /* 0x43 */ 50 "Digital Equipment Corporation", /* 0x44 */ 51 "", "", "", "", "", "", "", "", "", "", /* 0x45 - 0x4e */ 52 "", "", "", "", "", "", "", "", "", "", /* 0x4f - 0x58 */ 53 "", "", "", "", "", "", "", "", "", "", /* 0x59 - 0x62 */ 54 "", "", "", "", "", "", /* 0x63 - 0x68 */ 55 "Intel Corporation" /* 0x69 */ 46 "?", /* IMP_DATA_START_OFFSET */ 47 "ARM Limited", /* 0x41 */ 48 "", "", /* 0x42 - 0x43 */ 49 "Digital Equipment Corporation", /* 0x44 */ 50 "", "", "", "", "", "", "", "", /* 0x45 - 0x4c */ 51 "Motorola, Freescale Semicondutor Inc.", /* 0x4d */ 52 "", "", "", /* 0x4e - 0x50 */ 53 "Qualcomm Inc.", /* 0x51 */ 54 "", "", "", "", /* 0x52 - 0x55 */ 55 "Marvell Semiconductor", /* 0x56 */ 56 "", "", "", "", "", "", "", "", "", "", /* 0x57 - 0x60 */ 57 "", "", "", "", "", "", "", "", /* 0x61 - 0x68 */ 58 "Intel Corporation" /* 0x69 */ 56 59 }; 57 60 … … 94 97 } 95 98 96 /** Does nothing on ARM.*/99 /** Enables unaligned access and caching for armv6+ */ 97 100 void cpu_arch_init(void) 98 101 { 102 #if defined(PROCESSOR_armv7_a) | defined(PROCESSOR_armv6) 103 uint32_t control_reg = 0; 104 asm volatile ( 105 "mrc p15, 0, %[control_reg], c1, c0" 106 : [control_reg] "=r" (control_reg) 107 ); 108 109 /* Turn off tex remap, RAZ ignores writes prior to armv7 */ 110 control_reg &= ~CP15_R1_TEX_REMAP_EN; 111 /* Turn off accessed flag, RAZ ignores writes prior to armv7 */ 112 control_reg &= ~(CP15_R1_ACCESS_FLAG_EN | CP15_R1_HW_ACCESS_FLAG_EN); 113 /* Enable unaligned access, RAZ ignores writes prior to armv6 114 * switchable on armv6, RAO ignores writes on armv7, 115 * see ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition 116 * L.3.1 (p. 2456) */ 117 control_reg |= CP15_R1_UNALIGNED_EN; 118 /* Disable alignment checks, this turns unaligned access to undefined, 119 * unless U bit is set. */ 120 control_reg &= ~CP15_R1_ALIGN_CHECK_EN; 121 /* Enable caching, On arm prior to armv7 there is only one level 122 * of caches. Data cache is coherent. 123 * "This means that the behavior of accesses from the same observer to 124 * different VAs, that are translated to the same PA 125 * with the same memory attributes, is fully coherent." 126 * ARM Architecture Reference Manual ARMv7-A and ARMv7-R Edition 127 * B3.11.1 (p. 1383) 128 * ICache coherency is elaborate on in barrier.h. 129 * We are safe to turn these on. 130 */ 131 control_reg |= CP15_R1_CACHE_EN | CP15_R1_INST_CACHE_EN; 132 133 asm volatile ( 134 "mcr p15, 0, %[control_reg], c1, c0" 135 :: [control_reg] "r" (control_reg) 136 ); 137 #endif 99 138 } 100 139 101 140 /** Retrieves processor identification and stores it to #CPU.arch */ 102 void cpu_identify(void) 141 void cpu_identify(void) 103 142 { 104 143 arch_cpu_identify(&CPU->arch); … … 112 151 cpu_arch_t * cpu_arch = &m->arch; 113 152 114 if ((cpu_arch->imp_num) > 0 && 115 (cpu_arch->imp_num < (imp_data_length + IMP_DATA_START_OFFSET))) { 153 const unsigned imp_offset = cpu_arch->imp_num - IMP_DATA_START_OFFSET; 154 155 if (imp_offset < imp_data_length) { 116 156 vendor = imp_data[cpu_arch->imp_num - IMP_DATA_START_OFFSET]; 117 157 } 118 158 119 if ((cpu_arch->arch_num) > 0 &&120 (cpu_arch->arch_num < arch_data_length)) {159 // TODO CPUs with arch_num == 0xf use CPUID scheme for identification 160 if (cpu_arch->arch_num < arch_data_length) { 121 161 architecture = arch_data[cpu_arch->arch_num]; 122 162 }
Note:
See TracChangeset
for help on using the changeset viewer.