2 /* Copyright 2000 AG Electronics Ltd. */
3 /* This code is distributed without warranty under the GPL v2 (see COPYING) */
5 /* In the MSR, not all bits are interesting to us
6 13 - POW - Power management
7 14 - TGPR - temporary registers for page table routines
8 15 - ILE - Exception little endian
9 16 - EE - External interrupts
10 17 - PR - Privilege level
11 18 - FP - Floating Point available
12 19 - ME - Machine check exception enable
13 20 - FE0 - Floating exception mode 0
14 21 - SE - Single step trace mode
15 22 - BE - Branch trace enable
16 23 - FE1 - Floating exception mode 1
17 25 - IP - Exception prefix
18 26 - IR - Instruction address translation
19 27 - DR - Data address translation
20 30 - RI - Recoverable exception
21 31 - LE - Little endian mode
22 MSR_MASK is the bits we do not change.
25 #define MSR_MASK 0xfff8008c
26 #define MSR_POW 0x00040000
27 #define MSR_TGPR 0x00020000
28 #define MSR_ILE 0x00010000
29 #define MSR_EE 0x00008000
30 #define MSR_PR 0x00004000
31 #define MSR_FP 0x00002000
32 #define MSR_ME 0x00001000
33 #define MSR_FE0 0x00000800
34 #define MSR_SE 0x00000400
35 #define MSR_BE 0x00000200
36 #define MSR_FE1 0x00000100
37 #define MSR_IP 0x00000040
38 #define MSR_IR 0x00000020
39 #define MSR_DR 0x00000010
40 #define MSR_RI 0x00000002
41 #define MSR_LE 0x00000001
43 #define MSR_DEFAULT (MSR_FP | MSR_IR | MSR_DR)
45 /* We are interested in the following hid0 bits:
46 6 - ECLK - Enable external test clock (603 only)
47 11 - DPM - Turn on dynamic power management (603 only)
48 15 - NHR - Not hard reset
49 16 - ICE - Instruction cache enable
50 17 - DCE - Data cache enable
51 18 - ILOCK - Instruction cache lock
52 19 - DLOCK - Data cache lock
53 20 - ICFI - Instruction cache invalidate
54 21 - DCFI - Data cache invalidate
55 24 - NOSER - Serial execution disable (604 only - turbo mode)
56 24 - SGE - Store gathering enable (7410 only)
57 29 - BHT - Branch history table (604 only)
59 I made up the tags for the 604 specific bits, as they aren't
60 named in the 604 book. The 603 book calls the invalidate bits
61 ICFI and DCI, and I have no idea why it isn't DCFI. Maybe IBM named
62 one, and Motorola named the other. */
64 #define HID0_ECLK 0x02000000
65 #define HID0_DPM 0x00100000
66 #define HID0_NHR 0x00010000
67 #define HID0_ICE 0x00008000
68 #define HID0_DCE 0x00004000
69 #define HID0_ILOCK 0x00002000
70 #define HID0_DLOCK 0x00001000
71 #define HID0_ICFI 0x00000800
72 #define HID0_DCFI 0x00000400
73 #define HID0_NOSER 0x00000080
74 #define HID0_SGE 0x00000080
75 #define HID0_BTIC 0x00000020
76 #define HID0_BHT 0x00000004
83 * BL field in upper BAT register
85 #define BAT_BL_128K 0x00000000
86 #define BAT_BL_256K 0x00000004
87 #define BAT_BL_512K 0x0000000C
88 #define BAT_BL_1M 0x0000001C
89 #define BAT_BL_2M 0x0000003C
90 #define BAT_BL_4M 0x0000007C
91 #define BAT_BL_8M 0x000000FC
92 #define BAT_BL_16M 0x000001FC
93 #define BAT_BL_32M 0x000003FC
94 #define BAT_BL_64M 0x000007FC
95 #define BAT_BL_128M 0x00000FFC
96 #define BAT_BL_256M 0x00001FFC
99 * Supervisor/user valid mode in upper BAT register
101 #define BAT_VALID_SUPERVISOR 0x00000002
102 #define BAT_VALID_USER 0x00000001
103 #define BAT_INVALID 0x00000000
106 * WIMG bit setting in lower BAT register
108 #define BAT_WRITE_THROUGH 0x00000040
109 #define BAT_CACHE_INHIBITED 0x00000020
110 #define BAT_COHERENT 0x00000010
111 #define BAT_GUARDED 0x00000008
114 * Protection bits in lower BAT register
116 #define BAT_NO_ACCESS 0x00000000
117 #define BAT_READ_ONLY 0x00000001
118 #define BAT_READ_WRITE 0x00000002
121 unsigned __getmsr(void);
122 void __setmsr(unsigned value);
123 unsigned __gethid0(void);
124 unsigned __gethid1(void);
125 void __sethid0(unsigned value);
126 unsigned __getpvr(void);