source: trunk/softs/tests_ccvcache_v4/test_dcache_inval_pa/test.S @ 232

Last change on this file since 232 was 232, checked in by alain, 12 years ago

Introducing the elementary tests for a TSAR mono-cluster
mono-processor platform with MMU using the vci_cc_vcache_v4
such as the "tsarv4_mono_mmu".
(assemby level tests written by Manuel Bouyer)

File size: 2.6 KB
Line 
1/*
2 * cache inval test: check that VC_DCACHE_INVAL_PA does the job
3 * on a cc_vcache, the cache invalidation/update should be done by hardware
4 * and VC_DCACHE_INVAL_PA should not be needed.
5 */
6#include <registers.h>
7#include <misc.h>
8#include <vcache.h>
9        .text
10        .globl  _start
11_start:
12        .set noreorder
13        la      k0, TTY_BASE
14        la      k1, EXIT_BASE
15
16        PRINT(startstr)
17
18        /* reset cop0 status (keep BEV) */
19        lui     a0, 0x0040;
20        mtc0    a0, COP0_STATUS
21
22        la      a0, pte1_a
23        srl     a0, a0, 13
24        mtc2    a0, VC_PTPR
25        nop
26
27        li      a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE
28        mtc2    a0, VC_TLB_EN
29
30        PRINT(mmustr_a)
31        la      t0, testval
32        lw      a0, 0(t0);
33        PRINTX
34        PUTCHAR('\n')
35        la      a1, DMA_BASE
36        la      a0, testval2
37        sw      a0, DMA_SRC(a1)
38        la      a0, testval
39        sw      a0, DMA_DST(a1)
40        li      a0, 4
41        sw      a0, DMA_LEN(a1) /* start DMA */
42loop:
43        lw      a0, DMA_LEN(a1)
44        bne     a0, zero, loop;
45        nop
46
47        PRINT(mmustr_b)
48        la      t0, testval
49        lw      a0, 0(t0);
50        PRINTX
51        PUTCHAR('\n')
52
53        la      a0, testval
54        mtc2    a0, VC_DATA_LO
55        mtc2    zero, VC_DATA_HI
56        mtc2    zero, VC_DCACHE_INVAL_PA
57        nop
58
59        PRINT(mmustr_c)
60        la      t0, testval
61        lw      a0, 0(t0);
62        PRINTX
63        PUTCHAR('\n')
64
65        /* we should get there */
66        EXIT(0)
67
68        .globl excep
69excep:
70        .set noreorder
71        PRINT(statusstr)
72        mfc0    a0, COP0_STATUS
73        PRINTX
74
75        PRINT(causestr)
76        mfc0    a0, COP0_CAUSE
77        PRINTX
78
79        PRINT(pcstr)
80        mfc0    a0, COP0_EXPC
81        PRINTX
82
83        PRINT(badvastr)
84        mfc0    a0, COP_0_BADVADDR
85        PRINTX
86
87        PUTCHAR('\n')
88        /* we should not get there */
89        EXIT(3)
90
91        .rodata:
92statusstr: .ascii "status \0"
93causestr: .ascii " cause \0"
94pcstr: .ascii " pc \0"
95badvastr: .ascii " badva \0"
96mmustr_a: .ascii "mmu started before DMA \0"
97mmustr_b: .ascii "mmu started after DMA \0"
98mmustr_c: .ascii "mmu started after FLUSH \0"
99startstr: .ascii "start\n\0"
100
101        .org EXCEP_ADDRESS - BOOT_ADDRESS
102        .globl evect
103evect:
104        j       excep
105        nop
106
107        .data
108data_a:
109        .word MAGIC1
110testval:
111        .word MAGIC2
112data_b:
113        .word MAGIC3
114testval2:
115        .word MAGIC4
116        .globl pte2_a
117
118pte2_a:
119        .align 12
120        .word PTE2_V | PTE2_C | PTE2_X
121        .word 0x0000 >> 12 /* check real value of data_a */
122        .org pte2_a + 4092
123        .word 0
124        .globl pte1_a
125pte1_a:
126        .align 13
127        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
128        .word PTE1_V | PTE1_T | (0x2000 >> 12) /* map PA 0x0 at VA 0x00200000 via pte2_a */
129        .org pte1_a + (BOOT_ADDRESS >> 21) * 4
130        .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */
131        .org pte1_a + (TTY_BASE >> 21) * 4
132        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
133        .org pte1_a + (EXIT_BASE >> 21) * 4
134        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
135        .org pte1_a + (DMA_BASE >> 21) * 4
136        .word PTE1_V | PTE1_W | (DMA_BASE >> 21) /* map PA 0xe8000000 at VA 0xe0000000 */
Note: See TracBrowser for help on using the repository browser.