1#include "macros.inc" 2 3.purgem test_init 4.macro test_init 5 call0 cache_unlock_invalidate 6.endm 7 8test_suite cache 9 10.macro pf_op op 11 \op a2, 0 12 \op a3, 0 13 \op a4, 0 14.endm 15 16test prefetch 17 movi a2, 0xd0000000 /* cacheable */ 18 movi a3, 0xd8000000 /* non-cacheable */ 19 movi a4, 0x00001235 /* unmapped */ 20 21 pf_op dpfr 22 pf_op dpfro 23 pf_op dpfw 24 pf_op dpfwo 25 pf_op ipf 26 27 dpfl a2, 0 28 ipfl a2, 0 29test_end 30 31.macro cache_fault op, addr, exc_code 32 set_vector kernel, 2f 33 34 movi a4, \addr 351: 36 \op a4, 0 37 test_fail 382: 39 rsr a2, epc1 40 movi a3, 1b 41 assert eq, a2, a3 42 rsr a2, excvaddr 43 assert eq, a2, a4 44 rsr a2, exccause 45 movi a3, \exc_code 46 assert eq, a2, a3 47.endm 48 49test dpfl_tlb_miss 50 cache_fault dpfl, 0x00002345, 24 51test_end 52 53test dhwb_tlb_miss 54 cache_fault dhwb, 0x00002345, 24 55test_end 56 57test dhwbi_tlb_miss 58 cache_fault dhwbi, 0x00002345, 24 59test_end 60 61test dhi_tlb_miss 62 cache_fault dhi, 0x00002345, 24 63test_end 64 65test dhu_tlb_miss 66 cache_fault dhu, 0x00002345, 24 67test_end 68 69 70test ipfl_tlb_miss 71 cache_fault ipfl, 0x00002345, 16 72test_end 73 74test ihu_tlb_miss 75 cache_fault ihu, 0x00002345, 16 76test_end 77 78test ihi_tlb_miss 79 cache_fault ihi, 0x00002345, 16 80test_end 81 82test_suite_end 83 84.macro cache_all op1, op2, size, linesize 85 movi a2, 0 86 movi a3, \size 871: 88 \op1 a2, 0 89 \op2 a2, 0 90 addi a2, a2, \linesize 91 bltu a2, a3, 1b 92.endm 93 94cache_unlock_invalidate: 95 cache_all diu, dii, XCHAL_DCACHE_SIZE, XCHAL_DCACHE_LINESIZE 96 cache_all iiu, iii, XCHAL_ICACHE_SIZE, XCHAL_ICACHE_LINESIZE 97 ret 98