4 * UTLB unit test support
6 * Copyright (c) 2006 Nathan Keynes.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
23 #define TLB_VALID 0x00000100
24 #define TLB_USERMODE 0x00000040
25 #define TLB_WRITABLE 0x00000020
26 #define TLB_SIZE_1K 0x00000000
27 #define TLB_SIZE_4K 0x00000010
28 #define TLB_SIZE_64K 0x00000080
29 #define TLB_SIZE_1M 0x00000090
30 #define TLB_CACHEABLE 0x00000008
31 #define TLB_DIRTY 0x00000004
32 #define TLB_SHARE 0x00000002
33 #define TLB_WRITETHRU 0x00000001
35 #define PTEH 0xFF000000
36 #define PTEL 0xFF000004
37 #define TEA 0xFF00000C
38 #define MMUCR 0xFF000010
40 void set_tlb_enabled( int flag )
42 uint32_t val = long_read( MMUCR );
48 long_write( MMUCR, val );
53 uint32_t val = long_read( MMUCR );
54 long_write( MMUCR, val | 4 );
57 void set_sv_enabled( int flag )
59 uint32_t val = long_read( MMUCR );
65 long_write( MMUCR, val );
68 void set_storequeue_protected( int flag )
70 uint32_t val = long_read( MMUCR );
76 long_write( MMUCR, val );
80 void set_asid( int asid )
82 uint32_t val = long_read( PTEH ) & 0xFFFFFF00;
83 long_write( PTEH, val | asid );
87 void load_utlb_entry( int entryNo, uint32_t vpn, uint32_t ppn, int asid, uint32_t mode )
89 long_write( (0xF6000000 | (entryNo<<8)), vpn | asid );
90 long_write( (0xF7000000 | (entryNo<<8)), ppn | mode );
94 void check_utlb_access( uint32_t addr, uint32_t direct_addr, int mode )
.