Changes in kernel/arch/arm32/src/cpu/cpu.c [8316547f:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/cpu/cpu.c
r8316547f r9d58539 44 44 /** Implementators (vendor) names */ 45 45 static const char *imp_data[] = { 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 */ 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 */ 59 56 }; 60 57 … … 97 94 } 98 95 99 /** Enables unaligned access and caching for armv6+*/96 /** Does nothing on ARM. */ 100 97 void cpu_arch_init(void) 101 98 { 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 armv6114 * switchable on armv6, RAO ignores writes on armv7,115 * see ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition116 * 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 level122 * of caches. Data cache is coherent.123 * "This means that the behavior of accesses from the same observer to124 * different VAs, that are translated to the same PA125 * with the same memory attributes, is fully coherent."126 * ARM Architecture Reference Manual ARMv7-A and ARMv7-R Edition127 * 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 #endif138 99 } 139 100 140 101 /** Retrieves processor identification and stores it to #CPU.arch */ 141 void cpu_identify(void) 102 void cpu_identify(void) 142 103 { 143 104 arch_cpu_identify(&CPU->arch); … … 151 112 cpu_arch_t * cpu_arch = &m->arch; 152 113 153 const unsigned imp_offset = cpu_arch->imp_num - IMP_DATA_START_OFFSET; 154 155 if (imp_offset < imp_data_length) { 114 if ((cpu_arch->imp_num) > 0 && 115 (cpu_arch->imp_num < (imp_data_length + IMP_DATA_START_OFFSET))) { 156 116 vendor = imp_data[cpu_arch->imp_num - IMP_DATA_START_OFFSET]; 157 117 } 158 118 159 // TODO CPUs with arch_num == 0xf use CPUID scheme for identification160 if (cpu_arch->arch_num < arch_data_length) {119 if ((cpu_arch->arch_num) > 0 && 120 (cpu_arch->arch_num < arch_data_length)) { 161 121 architecture = arch_data[cpu_arch->arch_num]; 162 122 }
Note:
See TracChangeset
for help on using the changeset viewer.