24 #ifndef LIBCPU_SHARED_ARM_CP15_H 25 #define LIBCPU_SHARED_ARM_CP15_H 37 #ifndef ARM_CP15_TEXT_SECTION 38 #define ARM_CP15_TEXT_SECTION 41 #define ARM_CP15_CACHE_PREPARE_MVA(mva) \ 42 ((const void *) (((uint32_t) (mva)) & ~0x1fU)) 44 #define ARM_CP15_TLB_PREPARE_MVA(mva) \ 45 ((const void *) (((uint32_t) (mva)) & ~0x3fU)) 67 #define ARM_MMU_SECT_BASE_SHIFT 20 68 #define ARM_MMU_SECT_BASE_MASK (0xfffU << ARM_MMU_SECT_BASE_SHIFT) 69 #define ARM_MMU_SECT_NS (1U << 19) 70 #define ARM_MMU_SECT_NG (1U << 17) 71 #define ARM_MMU_SECT_S (1U << 16) 72 #define ARM_MMU_SECT_AP_2 (1U << 15) 73 #define ARM_MMU_SECT_TEX_2 (1U << 14) 74 #define ARM_MMU_SECT_TEX_1 (1U << 13) 75 #define ARM_MMU_SECT_TEX_0 (1U << 12) 76 #define ARM_MMU_SECT_TEX_SHIFT 12 77 #define ARM_MMU_SECT_TEX_MASK (0x3U << ARM_MMU_SECT_TEX_SHIFT) 78 #define ARM_MMU_SECT_AP_1 (1U << 11) 79 #define ARM_MMU_SECT_AP_0 (1U << 10) 80 #define ARM_MMU_SECT_AP_SHIFT 10 81 #define ARM_MMU_SECT_AP_MASK (0x23U << ARM_MMU_SECT_AP_SHIFT) 82 #define ARM_MMU_SECT_DOMAIN_SHIFT 5 83 #define ARM_MMU_SECT_DOMAIN_MASK (0xfU << ARM_MMU_SECT_DOMAIN_SHIFT) 84 #define ARM_MMU_SECT_XN (1U << 4) 85 #define ARM_MMU_SECT_C (1U << 3) 86 #define ARM_MMU_SECT_B (1U << 2) 87 #define ARM_MMU_SECT_PXN (1U << 0) 88 #define ARM_MMU_SECT_DEFAULT 0x2U 89 #define ARM_MMU_SECT_GET_INDEX(mva) \ 90 (((uint32_t) (mva)) >> ARM_MMU_SECT_BASE_SHIFT) 91 #define ARM_MMU_SECT_MVA_ALIGN_UP(mva) \ 92 ((1U << ARM_MMU_SECT_BASE_SHIFT) \ 93 + ((((uint32_t) (mva) - 1U)) & ~((1U << ARM_MMU_SECT_BASE_SHIFT) - 1U))) 95 #define ARM_MMU_PAGE_TABLE_BASE_SHIFT 10 96 #define ARM_MMU_PAGE_TABLE_BASE_MASK (0x3fffffU << ARM_MMU_PAGE_TABLE_BASE_SHIFT) 97 #define ARM_MMU_PAGE_TABLE_DOMAIN_SHIFT 5 98 #define ARM_MMU_PAGE_TABLE_DOMAIN_MASK (0xfU << ARM_MMU_PAGE_TABLE_DOMAIN_SHIFT) 99 #define ARM_MMU_PAGE_TABLE_NS (1U << 3) 100 #define ARM_MMU_PAGE_TABLE_PXN (1U << 2) 101 #define ARM_MMU_PAGE_TABLE_DEFAULT 0x1U 103 #define ARM_MMU_SMALL_PAGE_BASE_SHIFT 12 104 #define ARM_MMU_SMALL_PAGE_BASE_MASK (0xfffffU << ARM_MMU_SMALL_PAGE_BASE_SHIFT) 105 #define ARM_MMU_SMALL_PAGE_NG (1U << 11) 106 #define ARM_MMU_SMALL_PAGE_S (1U << 10) 107 #define ARM_MMU_SMALL_PAGE_AP_2 (1U << 9) 108 #define ARM_MMU_SMALL_PAGE_TEX_2 (1U << 8) 109 #define ARM_MMU_SMALL_PAGE_TEX_1 (1U << 7) 110 #define ARM_MMU_SMALL_PAGE_TEX_0 (1U << 6) 111 #define ARM_MMU_SMALL_PAGE_TEX_SHIFT 6 112 #define ARM_MMU_SMALL_PAGE_TEX_MASK (0x3U << ARM_MMU_SMALL_PAGE_TEX_SHIFT) 113 #define ARM_MMU_SMALL_PAGE_AP_1 (1U << 5) 114 #define ARM_MMU_SMALL_PAGE_AP_0 (1U << 4) 115 #define ARM_MMU_SMALL_PAGE_AP_SHIFT 4 116 #define ARM_MMU_SMALL_PAGE_AP_MASK (0x23U << ARM_MMU_SMALL_PAGE_AP_SHIFT) 117 #define ARM_MMU_SMALL_PAGE_C (1U << 3) 118 #define ARM_MMU_SMALL_PAGE_B (1U << 2) 119 #define ARM_MMU_SMALL_PAGE_XN (1U << 0) 120 #define ARM_MMU_SMALL_PAGE_DEFAULT 0x2U 121 #define ARM_MMU_SMALL_PAGE_GET_INDEX(mva) \ 122 (((uint32_t) (mva)) >> ARM_MMU_SMALL_PAGE_BASE_SHIFT) 123 #define ARM_MMU_SMALL_PAGE_MVA_ALIGN_UP(mva) \ 124 ((1U << ARM_MMU_SMALL_PAGE_BASE_SHIFT) \ 125 + ((((uint32_t) (mva) - 1U)) & ~((1U << ARM_MMU_SMALL_PAGE_BASE_SHIFT) - 1U))) 127 #define ARM_MMU_SECT_FLAGS_TO_PAGE_TABLE(flags) \ 128 (ARM_MMU_PAGE_TABLE_DEFAULT \ 129 | ((flags) & ARM_MMU_SECT_DOMAIN_MASK) \ 130 | (((flags) & ARM_MMU_SECT_NS) >> 16) \ 131 | (((flags) & ARM_MMU_SECT_PXN) << 2)) 133 #define ARM_MMU_PAGE_TABLE_FLAGS_TO_SECT(flags) \ 134 (ARM_MMU_SECT_DEFAULT \ 135 | ((flags) & ARM_MMU_PAGE_TABLE_DOMAIN_MASK) \ 136 | (((flags) & ARM_MMU_PAGE_TABLE_NS) << 16) \ 137 | (((flags) & ARM_MMU_PAGE_TABLE_PXN) >> 2)) 139 #define ARM_MMU_SECT_FLAGS_TO_SMALL_PAGE(flags) \ 140 ((((flags) & 0x3fc00) >> 6) \ 141 | ((flags) & (ARM_MMU_SECT_C | ARM_MMU_SECT_B | 0x2)) \ 142 | (((flags) & ARM_MMU_SECT_XN) >> 4)) 144 #define ARM_MMU_SMALL_PAGE_FLAGS_TO_SECT(flags) \ 145 ((((flags) & 0xff0) << 6) \ 146 | ((flags) & (ARM_MMU_SMALL_PAGE_C | ARM_MMU_SMALL_PAGE_B | 0x2)) \ 147 | (((flags) & ARM_MMU_SMALL_PAGE_XN) << 4)) 149 #define ARM_MMU_TRANSLATION_TABLE_ENTRY_SIZE 4U 150 #define ARM_MMU_TRANSLATION_TABLE_ENTRY_COUNT 4096U 152 #define ARM_MMU_SMALL_PAGE_TABLE_ENTRY_SIZE 4U 153 #define ARM_MMU_SMALL_PAGE_TABLE_ENTRY_COUNT 256U 155 #define ARM_MMU_DEFAULT_CLIENT_DOMAIN 15U 157 #define ARMV7_MMU_READ_ONLY \ 158 ((ARM_MMU_DEFAULT_CLIENT_DOMAIN << ARM_MMU_SECT_DOMAIN_SHIFT) \ 159 | ARM_MMU_SECT_AP_0 \ 160 | ARM_MMU_SECT_AP_2 \ 161 | ARM_MMU_SECT_DEFAULT) 163 #define ARMV7_MMU_READ_ONLY_CACHED \ 164 (ARMV7_MMU_READ_ONLY | ARM_MMU_SECT_TEX_0 | ARM_MMU_SECT_C | ARM_MMU_SECT_B) 166 #define ARMV7_MMU_READ_WRITE \ 167 ((ARM_MMU_DEFAULT_CLIENT_DOMAIN << ARM_MMU_SECT_DOMAIN_SHIFT) \ 168 | ARM_MMU_SECT_AP_0 \ 169 | ARM_MMU_SECT_DEFAULT) 172 #define ARMV7_MMU_READ_WRITE_CACHED \ 173 (ARMV7_MMU_READ_WRITE \ 174 | ARM_MMU_SECT_TEX_0 | ARM_MMU_SECT_C | ARM_MMU_SECT_B | ARM_MMU_SECT_S) 176 #define ARMV7_MMU_READ_WRITE_CACHED \ 177 (ARMV7_MMU_READ_WRITE \ 178 | ARM_MMU_SECT_TEX_0 | ARM_MMU_SECT_C | ARM_MMU_SECT_B) 181 #define ARMV7_MMU_DATA_READ_ONLY \ 182 (ARMV7_MMU_READ_ONLY | ARM_MMU_SECT_TEX_0) 184 #define ARMV7_MMU_DATA_READ_ONLY_CACHED \ 185 ARMV7_MMU_READ_ONLY_CACHED 187 #define ARMV7_MMU_DATA_READ_WRITE \ 188 (ARMV7_MMU_READ_WRITE | ARM_MMU_SECT_TEX_0) 190 #define ARMV7_MMU_DATA_READ_WRITE_CACHED \ 191 ARMV7_MMU_READ_WRITE_CACHED 193 #define ARMV7_MMU_CODE \ 194 (ARMV7_MMU_READ_ONLY | ARM_MMU_SECT_TEX_0) 196 #define ARMV7_MMU_CODE_CACHED \ 197 ARMV7_MMU_READ_ONLY_CACHED 199 #define ARMV7_MMU_DEVICE \ 200 (ARMV7_MMU_READ_WRITE | ARM_MMU_SECT_B) 210 #define ARM_CP15_CTRL_TE (1U << 30) 211 #define ARM_CP15_CTRL_AFE (1U << 29) 212 #define ARM_CP15_CTRL_TRE (1U << 28) 213 #define ARM_CP15_CTRL_NMFI (1U << 27) 214 #define ARM_CP15_CTRL_EE (1U << 25) 215 #define ARM_CP15_CTRL_VE (1U << 24) 216 #define ARM_CP15_CTRL_XP (1U << 23) 217 #define ARM_CP15_CTRL_U (1U << 22) 218 #define ARM_CP15_CTRL_FI (1U << 21) 219 #define ARM_CP15_CTRL_UWXN (1U << 20) 220 #define ARM_CP15_CTRL_WXN (1U << 19) 221 #define ARM_CP15_CTRL_HA (1U << 17) 222 #define ARM_CP15_CTRL_L4 (1U << 15) 223 #define ARM_CP15_CTRL_RR (1U << 14) 224 #define ARM_CP15_CTRL_V (1U << 13) 225 #define ARM_CP15_CTRL_I (1U << 12) 226 #define ARM_CP15_CTRL_Z (1U << 11) 227 #define ARM_CP15_CTRL_SW (1U << 10) 228 #define ARM_CP15_CTRL_R (1U << 9) 229 #define ARM_CP15_CTRL_S (1U << 8) 230 #define ARM_CP15_CTRL_B (1U << 7) 231 #define ARM_CP15_CTRL_CP15BEN (1U << 5) 232 #define ARM_CP15_CTRL_C (1U << 2) 233 #define ARM_CP15_CTRL_A (1U << 1) 234 #define ARM_CP15_CTRL_M (1U << 0) 244 #define ARM_CP15_DAC_NO_ACCESS 0x0U 245 #define ARM_CP15_DAC_CLIENT 0x1U 246 #define ARM_CP15_DAC_MANAGER 0x3U 247 #define ARM_CP15_DAC_DOMAIN(index, val) ((val) << (2 * index)) 257 #define ARM_CP15_FAULT_STATUS_MASK 0x040F 259 #define ARM_CP15_FSR_ALIGNMENT_FAULT 0x00000001 260 #define ARM_CP15_FSR_BACKGROUND_FAULT 0x0000 261 #define ARM_CP15_FSR_ACCESS_PERMISSION_FAULT 0x000D 262 #define ARM_CP15_FSR_PRECISE_EXTERNAL_ABORT_FAULT 0x0008 263 #define ARM_CP15_FSR_IMPRECISE_EXTERNAL_ABORT_FAULT 0x0406 264 #define ARM_CP15_FSR_PRECISE_PARITY_ERROR_EXCEPTION 0x0006 265 #define ARM_CP15_FSR_IMPRECISE_PARITY_ERROR_EXCEPTION 0x0408 266 #define ARM_CP15_FSR_DEBUG_EVENT 0x0002 279 #define ARM_CP15_CACHE_TYPE_FORMAT_ARMV6 0 280 #define ARM_CP15_CACHE_TYPE_FORMAT_ARMV7 4 290 #define ARM_CP15_CACHE_CSS_ID_DATA 0 291 #define ARM_CP15_CACHE_CSS_ID_INSTRUCTION 1 292 #define ARM_CP15_CACHE_CSS_LEVEL(level) ((level) << 1) 296 ARM_CP15_TEXT_SECTION
static inline uint32_t
297 arm_cp15_get_id_code(
void)
299 ARM_SWITCH_REGISTERS;
304 "mrc p15, 0, %[val], c0, c0, 0\n" 306 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
312 ARM_CP15_TEXT_SECTION
static inline uint32_t
313 arm_cp15_get_tcm_status(
void)
315 ARM_SWITCH_REGISTERS;
320 "mrc p15, 0, %[val], c0, c0, 2\n" 322 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
328 ARM_CP15_TEXT_SECTION
static inline uint32_t
329 arm_cp15_get_control(
void)
331 ARM_SWITCH_REGISTERS;
336 "mrc p15, 0, %[val], c1, c0, 0\n" 338 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
344 ARM_CP15_TEXT_SECTION
static inline void 345 arm_cp15_set_control(uint32_t val)
347 ARM_SWITCH_REGISTERS;
351 "mcr p15, 0, %[val], c1, c0, 0\n" 377 ARM_CP15_TEXT_SECTION
static inline uint32_t
378 arm_cp15_mmu_disable(uint32_t cls)
380 ARM_SWITCH_REGISTERS;
387 "mrc p15, 0, %[ctrl], c1, c0, 0\n" 388 "bic %[tmp_0], %[ctrl], #1\n" 389 "mcr p15, 0, %[tmp_0], c1, c0, 0\n" 393 "rsb %[tmp_0], %[cls], #0\n" 394 "and %[tmp_0], %[tmp_0], %[tmp_1]\n" 395 "sub %[tmp_0], %[tmp_0], %[cls], asl #3\n" 396 "add %[tmp_1], %[tmp_0], %[cls], asl #4\n" 398 "mcr p15, 0, %[tmp_0], c7, c14, 1\n" 399 "add %[tmp_0], %[tmp_0], %[cls]\n" 400 "cmp %[tmp_1], %[tmp_0]\n" 403 : [ctrl]
"=&r" (ctrl),
404 [tmp_0]
"=&r" (tmp_0),
405 [tmp_1]
"=&r" (tmp_1)
406 ARM_SWITCH_ADDITIONAL_OUTPUT
414 ARM_CP15_TEXT_SECTION
static inline uint32_t
415 *arm_cp15_get_translation_table_base(
void)
417 ARM_SWITCH_REGISTERS;
422 "mrc p15, 0, %[base], c2, c0, 0\n" 424 : [base]
"=&r" (base) ARM_SWITCH_ADDITIONAL_OUTPUT
430 ARM_CP15_TEXT_SECTION
static inline void 431 arm_cp15_set_translation_table_base(uint32_t *base)
433 ARM_SWITCH_REGISTERS;
437 "mcr p15, 0, %[base], c2, c0, 0\n" 445 ARM_CP15_TEXT_SECTION
static inline uint32_t
446 arm_cp15_get_translation_table_base_control_register(
void)
448 ARM_SWITCH_REGISTERS;
453 "mrc p15, 0, %[ttb_cr], c2, c0, 2\n" 455 : [ttb_cr]
"=&r" (ttb_cr) ARM_SWITCH_ADDITIONAL_OUTPUT
461 ARM_CP15_TEXT_SECTION
static inline void 462 arm_cp15_set_translation_table_base_control_register(uint32_t ttb_cr)
464 ARM_SWITCH_REGISTERS;
468 "mcr p15, 0, %[ttb_cr], c2, c0, 2\n" 471 : [ttb_cr]
"r" (ttb_cr)
475 ARM_CP15_TEXT_SECTION
static inline uint32_t
476 arm_cp15_get_domain_access_control(
void)
478 ARM_SWITCH_REGISTERS;
483 "mrc p15, 0, %[val], c3, c0, 0\n" 485 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
491 ARM_CP15_TEXT_SECTION
static inline void 492 arm_cp15_set_domain_access_control(uint32_t val)
494 ARM_SWITCH_REGISTERS;
498 "mcr p15, 0, %[val], c3, c0, 0\n" 505 ARM_CP15_TEXT_SECTION
static inline uint32_t
506 arm_cp15_get_data_fault_status(
void)
508 ARM_SWITCH_REGISTERS;
513 "mrc p15, 0, %[val], c5, c0, 0\n" 515 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
521 ARM_CP15_TEXT_SECTION
static inline void 522 arm_cp15_set_data_fault_status(uint32_t val)
524 ARM_SWITCH_REGISTERS;
528 "mcr p15, 0, %[val], c5, c0, 0\n" 535 ARM_CP15_TEXT_SECTION
static inline uint32_t
536 arm_cp15_get_instruction_fault_status(
void)
538 ARM_SWITCH_REGISTERS;
543 "mrc p15, 0, %[val], c5, c0, 1\n" 545 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
551 ARM_CP15_TEXT_SECTION
static inline void 552 arm_cp15_set_instruction_fault_status(uint32_t val)
554 ARM_SWITCH_REGISTERS;
558 "mcr p15, 0, %[val], c5, c0, 1\n" 565 ARM_CP15_TEXT_SECTION
static inline void 566 *arm_cp15_get_fault_address(
void)
568 ARM_SWITCH_REGISTERS;
573 "mrc p15, 0, %[mva], c6, c0, 0\n" 575 : [mva]
"=&r" (mva) ARM_SWITCH_ADDITIONAL_OUTPUT
581 ARM_CP15_TEXT_SECTION
static inline void 582 arm_cp15_set_fault_address(
const void *mva)
584 ARM_SWITCH_REGISTERS;
588 "mcr p15, 0, %[mva], c6, c0, 0\n" 595 ARM_CP15_TEXT_SECTION
static inline void 596 arm_cp15_tlb_invalidate(
void)
598 ARM_SWITCH_REGISTERS;
603 "mcr p15, 0, %[sbz], c8, c7, 0\n" 613 _ARM_Data_synchronization_barrier();
614 _ARM_Instruction_synchronization_barrier();
617 ARM_CP15_TEXT_SECTION
static inline void 618 arm_cp15_tlb_invalidate_entry(
const void *mva)
620 ARM_SWITCH_REGISTERS;
622 mva = ARM_CP15_TLB_PREPARE_MVA(mva);
626 "mcr p15, 0, %[mva], c8, c7, 1\n" 633 ARM_CP15_TEXT_SECTION
static inline void 634 arm_cp15_tlb_invalidate_entry_all_asids(
const void *mva)
636 ARM_SWITCH_REGISTERS;
638 mva = ARM_CP15_TLB_PREPARE_MVA(mva);
642 "mcr p15, 0, %[mva], c8, c7, 3\n" 649 ARM_CP15_TEXT_SECTION
static inline void 650 arm_cp15_tlb_instruction_invalidate(
void)
652 ARM_SWITCH_REGISTERS;
657 "mcr p15, 0, %[sbz], c8, c5, 0\n" 664 ARM_CP15_TEXT_SECTION
static inline void 665 arm_cp15_tlb_instruction_invalidate_entry(
const void *mva)
667 ARM_SWITCH_REGISTERS;
669 mva = ARM_CP15_TLB_PREPARE_MVA(mva);
673 "mcr p15, 0, %[mva], c8, c5, 1\n" 680 ARM_CP15_TEXT_SECTION
static inline void 681 arm_cp15_tlb_data_invalidate(
void)
683 ARM_SWITCH_REGISTERS;
688 "mcr p15, 0, %[sbz], c8, c6, 0\n" 695 ARM_CP15_TEXT_SECTION
static inline void 696 arm_cp15_tlb_data_invalidate_entry(
const void *mva)
698 ARM_SWITCH_REGISTERS;
700 mva = ARM_CP15_TLB_PREPARE_MVA(mva);
704 "mcr p15, 0, %[mva], c8, c6, 1\n" 711 ARM_CP15_TEXT_SECTION
static inline void 712 arm_cp15_tlb_lockdown_entry(
const void *mva)
714 uint32_t arm_switch_reg;
718 "add %[arm_switch_reg], pc, #16\n" 719 "mcr p15, 0, %[arm_switch_reg], c7, c13, 1\n" 720 "mcr p15, 0, %[mva], c8, c7, 1\n" 721 "mrc p15, 0, %[arm_switch_reg], c10, c0, 0\n" 722 "orr %[arm_switch_reg], #0x1\n" 723 "mcr p15, 0, %[arm_switch_reg], c10, c0, 0\n" 724 "ldr %[mva], [%[mva]]\n" 725 "mrc p15, 0, %[arm_switch_reg], c10, c0, 0\n" 726 "bic %[arm_switch_reg], #0x1\n" 727 "mcr p15, 0, %[arm_switch_reg], c10, c0, 0\n" 729 : [mva]
"=r" (mva), [arm_switch_reg]
"=&r" (arm_switch_reg)
743 ARM_CP15_TEXT_SECTION
static inline uint32_t
744 arm_cp15_get_cache_type(
void)
746 ARM_SWITCH_REGISTERS;
751 "mrc p15, 0, %[val], c0, c0, 1\n" 753 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
760 ARM_CP15_TEXT_SECTION
static inline int 761 arm_cp15_cache_type_get_format(uint32_t
ct)
763 return (
ct >> 29) & 0x7U;
767 ARM_CP15_TEXT_SECTION
static inline uint32_t
768 arm_cp15_get_min_cache_line_size(
void)
771 uint32_t
ct = arm_cp15_get_cache_type();
772 uint32_t
format = arm_cp15_cache_type_get_format(
ct);
774 if (
format == ARM_CP15_CACHE_TYPE_FORMAT_ARMV7) {
776 mcls = (1U << (
ct & 0xf)) * 4;
777 }
else if (
format == ARM_CP15_CACHE_TYPE_FORMAT_ARMV6) {
779 uint32_t mask = (1U << 12) - 1;
780 uint32_t dcls = (
ct >> 12) & mask;
781 uint32_t icls =
ct & mask;
783 mcls = dcls <= icls ? dcls : icls;
790 ARM_CP15_TEXT_SECTION
static inline uint32_t
791 arm_cp15_get_data_cache_line_size(
void)
794 uint32_t
ct = arm_cp15_get_cache_type();
795 uint32_t
format = arm_cp15_cache_type_get_format(
ct);
797 if (
format == ARM_CP15_CACHE_TYPE_FORMAT_ARMV7) {
799 mcls = (1U << ((
ct & 0xf0000) >> 16)) * 4;
800 }
else if (
format == ARM_CP15_CACHE_TYPE_FORMAT_ARMV6) {
802 uint32_t mask = (1U << 12) - 1;
803 mcls = (
ct >> 12) & mask;
810 ARM_CP15_TEXT_SECTION
static inline uint32_t
811 arm_cp15_get_instruction_cache_line_size(
void)
814 uint32_t
ct = arm_cp15_get_cache_type();
815 uint32_t
format = arm_cp15_cache_type_get_format(
ct);
817 if (
format == ARM_CP15_CACHE_TYPE_FORMAT_ARMV7) {
819 mcls = (1U << (
ct & 0x0000f)) * 4;
820 }
else if (
format == ARM_CP15_CACHE_TYPE_FORMAT_ARMV6) {
822 uint32_t mask = (1U << 12) - 1;
831 ARM_CP15_TEXT_SECTION
static inline uint32_t
832 arm_cp15_get_cache_size_id(
void)
834 ARM_SWITCH_REGISTERS;
839 "mrc p15, 1, %[val], c0, c0, 0\n" 841 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
847 ARM_CP15_TEXT_SECTION
static inline uint32_t
848 arm_ccsidr_get_line_power(uint32_t ccsidr)
850 return (ccsidr & 0x7) + 4;
853 ARM_CP15_TEXT_SECTION
static inline uint32_t
854 arm_ccsidr_get_associativity(uint32_t ccsidr)
856 return ((ccsidr >> 3) & 0x3ff) + 1;
859 ARM_CP15_TEXT_SECTION
static inline uint32_t
860 arm_ccsidr_get_num_sets(uint32_t ccsidr)
862 return ((ccsidr >> 13) & 0x7fff) + 1;
867 ARM_CP15_TEXT_SECTION
static inline uint32_t
868 arm_cp15_get_cache_level_id(
void)
870 ARM_SWITCH_REGISTERS;
875 "mrc p15, 1, %[val], c0, c0, 1\n" 877 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
883 ARM_CP15_TEXT_SECTION
static inline uint32_t
884 arm_clidr_get_level_of_coherency(uint32_t clidr)
886 return (clidr >> 24) & 0x7;
889 ARM_CP15_TEXT_SECTION
static inline uint32_t
890 arm_clidr_get_cache_type(uint32_t clidr, uint32_t level)
892 return (clidr >> (3 * level)) & 0x7;
897 ARM_CP15_TEXT_SECTION
static inline uint32_t
898 arm_cp15_get_cache_size_selection(
void)
900 ARM_SWITCH_REGISTERS;
905 "mrc p15, 2, %[val], c0, c0, 0\n" 907 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
913 ARM_CP15_TEXT_SECTION
static inline void 914 arm_cp15_set_cache_size_selection(uint32_t val)
916 ARM_SWITCH_REGISTERS;
920 "mcr p15, 2, %[val], c0, c0, 0\n" 928 ARM_CP15_TEXT_SECTION
static inline uint32_t
929 arm_cp15_get_cache_size_id_for_level(uint32_t level_and_inst_dat)
935 arm_cp15_set_cache_size_selection(level_and_inst_dat);
936 _ARM_Instruction_synchronization_barrier();
937 ccsidr = arm_cp15_get_cache_size_id();
943 ARM_CP15_TEXT_SECTION
static inline void 944 arm_cp15_cache_invalidate(
void)
946 ARM_SWITCH_REGISTERS;
951 "mcr p15, 0, %[sbz], c7, c7, 0\n" 961 ARM_CP15_TEXT_SECTION
static inline void 962 arm_cp15_instruction_cache_inner_shareable_invalidate_all(
void)
964 ARM_SWITCH_REGISTERS;
969 "mcr p15, 0, %[sbz], c7, c1, 0\n" 979 ARM_CP15_TEXT_SECTION
static inline void 980 arm_cp15_branch_predictor_inner_shareable_invalidate_all(
void)
982 ARM_SWITCH_REGISTERS;
987 "mcr p15, 0, %[sbz], c7, c1, 6\n" 997 ARM_CP15_TEXT_SECTION
static inline void 998 arm_cp15_branch_predictor_invalidate_all(
void)
1000 ARM_SWITCH_REGISTERS;
1005 "mcr p15, 0, %[sbz], c7, c5, 6\n" 1014 ARM_CP15_TEXT_SECTION
static inline void 1015 arm_cp15_flush_prefetch_buffer(
void)
1017 ARM_SWITCH_REGISTERS;
1022 "mcr p15, 0, %[sbz], c7, c5, 4\n" 1030 ARM_CP15_TEXT_SECTION
static inline void 1031 arm_cp15_instruction_cache_invalidate(
void)
1033 ARM_SWITCH_REGISTERS;
1038 "mcr p15, 0, %[sbz], c7, c5, 0\n" 1046 ARM_CP15_TEXT_SECTION
static inline void 1047 arm_cp15_instruction_cache_invalidate_line(
const void *mva)
1049 ARM_SWITCH_REGISTERS;
1051 mva = ARM_CP15_CACHE_PREPARE_MVA(mva);
1055 "mcr p15, 0, %[mva], c7, c5, 1\n" 1063 ARM_CP15_TEXT_SECTION
static inline void 1064 arm_cp15_instruction_cache_invalidate_line_by_set_and_way(uint32_t set_and_way)
1066 ARM_SWITCH_REGISTERS;
1070 "mcr p15, 0, %[set_and_way], c7, c5, 2\n" 1073 : [set_and_way]
"r" (set_and_way)
1078 ARM_CP15_TEXT_SECTION
static inline void 1079 arm_cp15_instruction_cache_prefetch_line(
const void *mva)
1081 ARM_SWITCH_REGISTERS;
1083 mva = ARM_CP15_CACHE_PREPARE_MVA(mva);
1087 "mcr p15, 0, %[mva], c7, c13, 1\n" 1094 ARM_CP15_TEXT_SECTION
static inline void 1095 arm_cp15_data_cache_invalidate(
void)
1097 ARM_SWITCH_REGISTERS;
1102 "mcr p15, 0, %[sbz], c7, c6, 0\n" 1110 ARM_CP15_TEXT_SECTION
static inline void 1111 arm_cp15_data_cache_invalidate_line(
const void *mva)
1113 ARM_SWITCH_REGISTERS;
1115 mva = ARM_CP15_CACHE_PREPARE_MVA(mva);
1119 "mcr p15, 0, %[mva], c7, c6, 1\n" 1127 ARM_CP15_TEXT_SECTION
static inline void 1128 arm_cp15_data_cache_invalidate_line_by_set_and_way(uint32_t set_and_way)
1130 ARM_SWITCH_REGISTERS;
1134 "mcr p15, 0, %[set_and_way], c7, c6, 2\n" 1137 : [set_and_way]
"r" (set_and_way)
1142 ARM_CP15_TEXT_SECTION
static inline void 1143 arm_cp15_cache_invalidate_level(uint32_t level, uint32_t inst_data_fl)
1146 uint32_t line_power;
1147 uint32_t associativity;
1151 ccsidr = arm_cp15_get_cache_size_id_for_level((level << 1) | inst_data_fl);
1153 line_power = arm_ccsidr_get_line_power(ccsidr);
1154 associativity = arm_ccsidr_get_associativity(ccsidr);
1155 way_shift = __builtin_clz(associativity - 1);
1157 for (way = 0; way < associativity; ++way) {
1158 uint32_t num_sets = arm_ccsidr_get_num_sets(ccsidr);
1161 for (set = 0; set < num_sets; ++set) {
1162 uint32_t set_way = (way << way_shift)
1163 | (set << line_power)
1166 arm_cp15_data_cache_invalidate_line_by_set_and_way(set_way);
1171 ARM_CP15_TEXT_SECTION
static inline void 1172 arm_cp15_data_cache_invalidate_all_levels(
void)
1174 uint32_t clidr = arm_cp15_get_cache_level_id();
1175 uint32_t loc = arm_clidr_get_level_of_coherency(clidr);
1178 for (level = 0; level < loc; ++level) {
1179 uint32_t ctype = arm_clidr_get_cache_type(clidr, level);
1182 if (((ctype & (0x6)) == 2) || (ctype == 4)) {
1183 arm_cp15_cache_invalidate_level(level, 0);
1188 ARM_CP15_TEXT_SECTION
static inline void 1189 arm_cp15_data_cache_clean_line(
const void *mva)
1191 ARM_SWITCH_REGISTERS;
1193 mva = ARM_CP15_CACHE_PREPARE_MVA(mva);
1197 "mcr p15, 0, %[mva], c7, c10, 1\n" 1205 ARM_CP15_TEXT_SECTION
static inline void 1206 arm_cp15_data_cache_clean_line_by_set_and_way(uint32_t set_and_way)
1208 ARM_SWITCH_REGISTERS;
1212 "mcr p15, 0, %[set_and_way], c7, c10, 2\n" 1215 : [set_and_way]
"r" (set_and_way)
1220 ARM_CP15_TEXT_SECTION
static inline void 1221 arm_cp15_data_cache_clean_level(uint32_t level)
1224 uint32_t line_power;
1225 uint32_t associativity;
1229 ccsidr = arm_cp15_get_cache_size_id_for_level(level << 1);
1231 line_power = arm_ccsidr_get_line_power(ccsidr);
1232 associativity = arm_ccsidr_get_associativity(ccsidr);
1233 way_shift = __builtin_clz(associativity - 1);
1235 for (way = 0; way < associativity; ++way) {
1236 uint32_t num_sets = arm_ccsidr_get_num_sets(ccsidr);
1239 for (set = 0; set < num_sets; ++set) {
1240 uint32_t set_way = (way << way_shift)
1241 | (set << line_power)
1244 arm_cp15_data_cache_clean_line_by_set_and_way(set_way);
1249 ARM_CP15_TEXT_SECTION
static inline void 1250 arm_cp15_data_cache_clean_all_levels(
void)
1252 uint32_t clidr = arm_cp15_get_cache_level_id();
1253 uint32_t loc = arm_clidr_get_level_of_coherency(clidr);
1256 for (level = 0; level < loc; ++level) {
1257 uint32_t ctype = arm_clidr_get_cache_type(clidr, level);
1260 if (((ctype & (0x6)) == 2) || (ctype == 4)) {
1261 arm_cp15_data_cache_clean_level(level);
1266 ARM_CP15_TEXT_SECTION
static inline void 1267 arm_cp15_data_cache_test_and_clean(
void)
1269 ARM_SWITCH_REGISTERS;
1274 "mrc p15, 0, r15, c7, c10, 3\n" 1287 ARM_CP15_TEXT_SECTION
static inline void 1288 arm_cp15_data_cache_clean_and_invalidate(
void)
1290 ARM_SWITCH_REGISTERS;
1296 "mcr p15, 0, %[sbz], c7, c14, 0\n" 1304 ARM_CP15_TEXT_SECTION
static inline void 1305 arm_cp15_data_cache_clean_and_invalidate_line(
const void *mva)
1307 ARM_SWITCH_REGISTERS;
1309 mva = ARM_CP15_CACHE_PREPARE_MVA(mva);
1313 "mcr p15, 0, %[mva], c7, c14, 1\n" 1321 ARM_CP15_TEXT_SECTION
static inline void 1322 arm_cp15_data_cache_clean_and_invalidate_line_by_set_and_way(uint32_t set_and_way)
1324 ARM_SWITCH_REGISTERS;
1328 "mcr p15, 0, %[set_and_way], c7, c14, 2\n" 1331 : [set_and_way]
"r" (set_and_way)
1336 ARM_CP15_TEXT_SECTION
static inline void 1337 arm_cp15_data_cache_test_and_clean_and_invalidate(
void)
1339 ARM_SWITCH_REGISTERS;
1344 "mrc p15, 0, r15, c7, c14, 3\n" 1355 ARM_CP15_TEXT_SECTION
static inline void 1356 arm_cp15_drain_write_buffer(
void)
1358 ARM_SWITCH_REGISTERS;
1363 "mcr p15, 0, %[sbz], c7, c10, 4\n" 1371 ARM_CP15_TEXT_SECTION
static inline void 1372 arm_cp15_wait_for_interrupt(
void)
1374 ARM_SWITCH_REGISTERS;
1379 "mcr p15, 0, %[sbz], c7, c0, 4\n" 1387 ARM_CP15_TEXT_SECTION
static inline uint32_t
1388 arm_cp15_get_multiprocessor_affinity(
void)
1390 ARM_SWITCH_REGISTERS;
1395 "mrc p15, 0, %[mpidr], c0, c0, 5\n" 1397 : [mpidr]
"=&r" (mpidr) ARM_SWITCH_ADDITIONAL_OUTPUT
1400 return mpidr & 0xff;
1403 ARM_CP15_TEXT_SECTION
static inline uint32_t
1404 arm_cortex_a9_get_multiprocessor_cpu_id(
void)
1406 return arm_cp15_get_multiprocessor_affinity() & 0xff;
1409 #define ARM_CORTEX_A9_ACTL_FW (1U << 0) 1410 #define ARM_CORTEX_A9_ACTL_L2_PREFETCH_HINT_ENABLE (1U << 1) 1411 #define ARM_CORTEX_A9_ACTL_L1_PREFETCH_ENABLE (1U << 2) 1412 #define ARM_CORTEX_A9_ACTL_WRITE_FULL_LINE_OF_ZEROS_MODE (1U << 3) 1413 #define ARM_CORTEX_A9_ACTL_SMP (1U << 6) 1414 #define ARM_CORTEX_A9_ACTL_EXCL (1U << 7) 1415 #define ARM_CORTEX_A9_ACTL_ALLOC_IN_ONE_WAY (1U << 8) 1416 #define ARM_CORTEX_A9_ACTL_PARITY_ON (1U << 9) 1418 ARM_CP15_TEXT_SECTION
static inline uint32_t
1419 arm_cp15_get_auxiliary_control(
void)
1421 ARM_SWITCH_REGISTERS;
1426 "mrc p15, 0, %[val], c1, c0, 1\n" 1428 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1434 ARM_CP15_TEXT_SECTION
static inline void 1435 arm_cp15_set_auxiliary_control(uint32_t val)
1437 ARM_SWITCH_REGISTERS;
1441 "mcr p15, 0, %[val], c1, c0, 1\n" 1450 ARM_CP15_TEXT_SECTION
static inline uint32_t
1451 arm_cp15_get_processor_feature_1(
void)
1453 ARM_SWITCH_REGISTERS;
1458 "mrc p15, 0, %[val], c0, c1, 1\n" 1460 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1468 ARM_CP15_TEXT_SECTION
static inline void 1469 *arm_cp15_get_vector_base_address(
void)
1471 ARM_SWITCH_REGISTERS;
1476 "mrc p15, 0, %[base], c12, c0, 0\n" 1478 : [base]
"=&r" (base) ARM_SWITCH_ADDITIONAL_OUTPUT
1484 ARM_CP15_TEXT_SECTION
static inline void 1485 arm_cp15_set_vector_base_address(
void *base)
1487 ARM_SWITCH_REGISTERS;
1491 "mcr p15, 0, %[base], c12, c0, 0\n" 1498 ARM_CP15_TEXT_SECTION
static inline void 1499 *arm_cp15_get_hyp_vector_base_address(
void)
1501 ARM_SWITCH_REGISTERS;
1506 "mrc p15, 4, %[base], c12, c0, 0\n" 1508 : [base]
"=&r" (base) ARM_SWITCH_ADDITIONAL_OUTPUT
1514 ARM_CP15_TEXT_SECTION
static inline void 1515 arm_cp15_set_hyp_vector_base_address(
void *base)
1517 ARM_SWITCH_REGISTERS;
1521 "mcr p15, 4, %[base], c12, c0, 0\n" 1529 ARM_CP15_TEXT_SECTION
static inline uint32_t
1530 arm_cp15_get_performance_monitors_cycle_count(
void)
1532 ARM_SWITCH_REGISTERS;
1537 "mrc p15, 0, %[val], c9, c13, 0\n" 1539 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1546 ARM_CP15_TEXT_SECTION
static inline void 1547 arm_cp15_set_performance_monitors_cycle_count(uint32_t val)
1549 ARM_SWITCH_REGISTERS;
1553 "mcr p15, 0, %[val], c9, c13, 0\n" 1561 ARM_CP15_TEXT_SECTION
static inline uint32_t
1562 arm_cp15_get_performance_monitors_common_event_id_0(
void)
1564 ARM_SWITCH_REGISTERS;
1569 "mrc p15, 0, %[val], c9, c12, 6\n" 1571 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1578 ARM_CP15_TEXT_SECTION
static inline uint32_t
1579 arm_cp15_get_performance_monitors_common_event_id_1(
void)
1581 ARM_SWITCH_REGISTERS;
1586 "mrc p15, 0, %[val], c9, c12, 7\n" 1588 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1594 #define ARM_CP15_PMCLRSET_CYCLE_COUNTER 0x80000000 1597 ARM_CP15_TEXT_SECTION
static inline uint32_t
1598 arm_cp15_get_performance_monitors_count_enable_clear(
void)
1600 ARM_SWITCH_REGISTERS;
1605 "mrc p15, 0, %[val], c9, c12, 2\n" 1607 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1614 ARM_CP15_TEXT_SECTION
static inline void 1615 arm_cp15_set_performance_monitors_count_enable_clear(uint32_t val)
1617 ARM_SWITCH_REGISTERS;
1621 "mcr p15, 0, %[val], c9, c12, 2\n" 1629 ARM_CP15_TEXT_SECTION
static inline uint32_t
1630 arm_cp15_get_performance_monitors_count_enable_set(
void)
1632 ARM_SWITCH_REGISTERS;
1637 "mrc p15, 0, %[val], c9, c12, 1\n" 1639 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1646 ARM_CP15_TEXT_SECTION
static inline void 1647 arm_cp15_set_performance_monitors_count_enable_set(uint32_t val)
1649 ARM_SWITCH_REGISTERS;
1653 "mcr p15, 0, %[val], c9, c12, 1\n" 1660 #define ARM_CP15_PMCR_IMP(x) ((x) << 24) 1661 #define ARM_CP15_PMCR_IDCODE(x) ((x) << 16) 1662 #define ARM_CP15_PMCR_N(x) ((x) << 11) 1663 #define ARM_CP15_PMCR_DP (1U << 5) 1664 #define ARM_CP15_PMCR_X (1U << 4) 1665 #define ARM_CP15_PMCR_D (1U << 3) 1666 #define ARM_CP15_PMCR_C (1U << 2) 1667 #define ARM_CP15_PMCR_P (1U << 1) 1668 #define ARM_CP15_PMCR_E (1U << 0) 1671 ARM_CP15_TEXT_SECTION
static inline uint32_t
1672 arm_cp15_get_performance_monitors_control(
void)
1674 ARM_SWITCH_REGISTERS;
1679 "mrc p15, 0, %[val], c9, c12, 0\n" 1681 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1688 ARM_CP15_TEXT_SECTION
static inline void 1689 arm_cp15_set_performance_monitors_control(uint32_t val)
1691 ARM_SWITCH_REGISTERS;
1695 "mcr p15, 0, %[val], c9, c12, 0\n" 1703 ARM_CP15_TEXT_SECTION
static inline uint32_t
1704 arm_cp15_get_performance_monitors_interrupt_enable_clear(
void)
1706 ARM_SWITCH_REGISTERS;
1711 "mrc p15, 0, %[val], c9, c14, 2\n" 1713 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1720 ARM_CP15_TEXT_SECTION
static inline void 1721 arm_cp15_set_performance_monitors_interrupt_enable_clear(uint32_t val)
1723 ARM_SWITCH_REGISTERS;
1727 "mcr p15, 0, %[val], c9, c14, 2\n" 1735 ARM_CP15_TEXT_SECTION
static inline uint32_t
1736 arm_cp15_get_performance_monitors_interrupt_enable_set(
void)
1738 ARM_SWITCH_REGISTERS;
1743 "mrc p15, 0, %[val], c9, c14, 1\n" 1745 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1752 ARM_CP15_TEXT_SECTION
static inline void 1753 arm_cp15_set_performance_monitors_interrupt_enable_set(uint32_t val)
1755 ARM_SWITCH_REGISTERS;
1759 "mcr p15, 0, %[val], c9, c14, 1\n" 1767 ARM_CP15_TEXT_SECTION
static inline uint32_t
1768 arm_cp15_get_performance_monitors_overflow_flag_status(
void)
1770 ARM_SWITCH_REGISTERS;
1775 "mrc p15, 0, %[val], c9, c12, 3\n" 1777 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1784 ARM_CP15_TEXT_SECTION
static inline void 1785 arm_cp15_set_performance_monitors_overflow_flag_status(uint32_t val)
1787 ARM_SWITCH_REGISTERS;
1791 "mcr p15, 0, %[val], c9, c12, 3\n" 1799 ARM_CP15_TEXT_SECTION
static inline uint32_t
1800 arm_cp15_get_performance_monitors_overflow_flag_status_set(
void)
1802 ARM_SWITCH_REGISTERS;
1807 "mrc p15, 0, %[val], c9, c14, 3\n" 1809 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1816 ARM_CP15_TEXT_SECTION
static inline void 1817 arm_cp15_set_performance_monitors_overflow_flag_status_set(uint32_t val)
1819 ARM_SWITCH_REGISTERS;
1823 "mcr p15, 0, %[val], c9, c14, 3\n" 1831 ARM_CP15_TEXT_SECTION
static inline uint32_t
1832 arm_cp15_get_performance_monitors_event_counter_selection(
void)
1834 ARM_SWITCH_REGISTERS;
1839 "mrc p15, 0, %[val], c9, c12, 5\n" 1841 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1848 ARM_CP15_TEXT_SECTION
static inline void 1849 arm_cp15_set_performance_monitors_event_counter_selection(uint32_t val)
1851 ARM_SWITCH_REGISTERS;
1855 "mcr p15, 0, %[val], c9, c12, 5\n" 1863 ARM_CP15_TEXT_SECTION
static inline void 1864 arm_cp15_set_performance_monitors_software_increment(uint32_t val)
1866 ARM_SWITCH_REGISTERS;
1870 "mcr p15, 0, %[val], c9, c12, 4\n" 1878 ARM_CP15_TEXT_SECTION
static inline uint32_t
1879 arm_cp15_get_performance_monitors_user_enable(
void)
1881 ARM_SWITCH_REGISTERS;
1886 "mrc p15, 0, %[val], c9, c14, 0\n" 1888 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1895 ARM_CP15_TEXT_SECTION
static inline void 1896 arm_cp15_set_performance_monitors_user_enable(uint32_t val)
1898 ARM_SWITCH_REGISTERS;
1902 "mcr p15, 0, %[val], c9, c14, 0\n" 1910 ARM_CP15_TEXT_SECTION
static inline uint32_t
1911 arm_cp15_get_performance_monitors_event_count(
void)
1913 ARM_SWITCH_REGISTERS;
1918 "mrc p15, 0, %[val], c9, c13, 2\n" 1920 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1927 ARM_CP15_TEXT_SECTION
static inline void 1928 arm_cp15_set_performance_monitors_event_count(uint32_t val)
1930 ARM_SWITCH_REGISTERS;
1934 "mcr p15, 0, %[val], c9, c13, 2\n" 1942 ARM_CP15_TEXT_SECTION
static inline uint32_t
1943 arm_cp15_get_performance_monitors_event_type_select(
void)
1945 ARM_SWITCH_REGISTERS;
1950 "mrc p15, 0, %[val], c9, c13, 1\n" 1952 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1959 ARM_CP15_TEXT_SECTION
static inline void 1960 arm_cp15_set_performance_monitors_event_type_select(uint32_t val)
1962 ARM_SWITCH_REGISTERS;
1966 "mcr p15, 0, %[val], c9, c13, 1\n" 1974 ARM_CP15_TEXT_SECTION
static inline uint32_t
1975 arm_cp15_get_counter_frequency(
void)
1977 ARM_SWITCH_REGISTERS;
1982 "mrc p15, 0, %[val], c14, c0, 0\n" 1984 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
1991 ARM_CP15_TEXT_SECTION
static inline void 1992 arm_cp15_set_counter_frequency(uint32_t val)
1994 ARM_SWITCH_REGISTERS;
1998 "mcr p15, 0, %[val], c14, c0, 0\n" 2006 ARM_CP15_TEXT_SECTION
static inline uint64_t
2007 arm_cp15_get_counter_physical_count(
void)
2009 ARM_SWITCH_REGISTERS;
2014 "mrrc p15, 0, %Q[val], %R[val], c14\n" 2016 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2023 ARM_CP15_TEXT_SECTION
static inline uint32_t
2024 arm_cp15_get_counter_non_secure_pl1_control(
void)
2026 ARM_SWITCH_REGISTERS;
2031 "mrc p15, 0, %[val], c14, c1, 0\n" 2033 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2040 ARM_CP15_TEXT_SECTION
static inline void 2041 arm_cp15_set_counter_non_secure_pl1_control(uint32_t val)
2043 ARM_SWITCH_REGISTERS;
2047 "mcr p15, 0, %[val], c14, c1, 0\n" 2055 ARM_CP15_TEXT_SECTION
static inline uint32_t
2056 arm_cp15_get_counter_pl1_physical_timer_value(
void)
2058 ARM_SWITCH_REGISTERS;
2063 "mrc p15, 0, %[val], c14, c2, 0\n" 2065 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2072 ARM_CP15_TEXT_SECTION
static inline void 2073 arm_cp15_set_counter_pl1_physical_timer_value(uint32_t val)
2075 ARM_SWITCH_REGISTERS;
2079 "mcr p15, 0, %[val], c14, c2, 0\n" 2087 ARM_CP15_TEXT_SECTION
static inline uint32_t
2088 arm_cp15_get_counter_pl1_physical_timer_control(
void)
2090 ARM_SWITCH_REGISTERS;
2095 "mrc p15, 0, %[val], c14, c2, 1\n" 2097 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2104 ARM_CP15_TEXT_SECTION
static inline void 2105 arm_cp15_set_counter_pl1_physical_timer_control(uint32_t val)
2107 ARM_SWITCH_REGISTERS;
2111 "mcr p15, 0, %[val], c14, c2, 1\n" 2119 ARM_CP15_TEXT_SECTION
static inline uint32_t
2120 arm_cp15_get_counter_pl1_virtual_timer_value(
void)
2122 ARM_SWITCH_REGISTERS;
2127 "mrc p15, 0, %[val], c14, c3, 0\n" 2129 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2136 ARM_CP15_TEXT_SECTION
static inline void 2137 arm_cp15_set_counter_pl1_virtual_timer_value(uint32_t val)
2139 ARM_SWITCH_REGISTERS;
2143 "mcr p15, 0, %[val], c14, c3, 0\n" 2151 ARM_CP15_TEXT_SECTION
static inline uint32_t
2152 arm_cp15_get_counter_pl1_virtual_timer_control(
void)
2154 ARM_SWITCH_REGISTERS;
2159 "mrc p15, 0, %[val], c14, c3, 1\n" 2161 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2168 ARM_CP15_TEXT_SECTION
static inline void 2169 arm_cp15_set_counter_pl1_virtual_timer_control(uint32_t val)
2171 ARM_SWITCH_REGISTERS;
2175 "mcr p15, 0, %[val], c14, c3, 1\n" 2183 ARM_CP15_TEXT_SECTION
static inline uint64_t
2184 arm_cp15_get_counter_virtual_count(
void)
2186 ARM_SWITCH_REGISTERS;
2191 "mrrc p15, 1, %Q[val], %R[val], c14\n" 2193 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2200 ARM_CP15_TEXT_SECTION
static inline uint64_t
2201 arm_cp15_get_counter_pl1_physical_compare_value(
void)
2203 ARM_SWITCH_REGISTERS;
2208 "mrrc p15, 2, %Q[val], %R[val], c14\n" 2210 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2217 ARM_CP15_TEXT_SECTION
static inline void 2218 arm_cp15_set_counter_pl1_physical_compare_value(uint64_t val)
2220 ARM_SWITCH_REGISTERS;
2224 "mcrr p15, 2, %Q[val], %R[val], c14\n" 2232 ARM_CP15_TEXT_SECTION
static inline uint64_t
2233 arm_cp15_get_counter_pl1_virtual_compare_value(
void)
2235 ARM_SWITCH_REGISTERS;
2240 "mrrc p15, 3, %Q[val], %R[val], c14\n" 2242 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2249 ARM_CP15_TEXT_SECTION
static inline void 2250 arm_cp15_set_counter_pl1_virtual_compare_value(uint64_t val)
2252 ARM_SWITCH_REGISTERS;
2256 "mcrr p15, 3, %Q[val], %R[val], c14\n" 2264 ARM_CP15_TEXT_SECTION
static inline uint64_t
2265 arm_cp15_get_counter_virtual_offset(
void)
2267 ARM_SWITCH_REGISTERS;
2272 "mrrc p15, 4, %Q[val], %R[val], c14\n" 2274 : [val]
"=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
2281 ARM_CP15_TEXT_SECTION
static inline void 2282 arm_cp15_set_counter_virtual_offset(uint64_t val)
2284 ARM_SWITCH_REGISTERS;
2288 "mcrr p15, 4, %Q[val], %R[val], c14\n" 2303 uint32_t section_flags
2312 Arm_symbolic_exception_name exception,
2313 void (*handler)(
void)
void * arm_cp15_set_exception_handler(Arm_symbolic_exception_name exception, void(*handler)(void))
Sets the exception handler in the vector table.
Definition: arm-cp15-set-exception-handler.c:19
#define rtems_interrupt_local_enable(_isr_cookie)
This macro restores the previous interrupt level on the current processor.
Definition: intr.h:148
uint32_t arm_cp15_set_translation_table_entries(const void *begin, const void *end, uint32_t section_flags)
Sets the section_flags for the address range [begin, end).
Definition: arm-cp15-set-ttb-entries.c:126
register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__("g6")
The pointer to the current per-CPU control is available via register g6.
unsigned ct
Definition: tlb.h:224
ISR_Level rtems_interrupt_level
Interrupt level type.
Definition: intr.h:42
#define rtems_interrupt_local_disable(_isr_cookie)
This macro disables the interrupts on the current processor.
Definition: intr.h:138