3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (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.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * The test checks the contents of Special Purpose Registers (SPR) listed
30 * in the spr_test_list array below.
31 * Each SPR value is read using mfspr instruction, some bits are masked
32 * according to the table and the resulting value is compared to the
33 * corresponding table value.
38 #if CONFIG_POST & CONFIG_SYS_POST_SPR
46 } spr_test_list [] = {
47 /* Standard Special-Purpose Registers */
49 {1, "XER", 0x00000000, 0x00000000},
50 {8, "LR", 0x00000000, 0x00000000},
51 {9, "CTR", 0x00000000, 0x00000000},
52 {18, "DSISR", 0x00000000, 0x00000000},
53 {19, "DAR", 0x00000000, 0x00000000},
54 {22, "DEC", 0x00000000, 0x00000000},
55 {26, "SRR0", 0x00000000, 0x00000000},
56 {27, "SRR1", 0x00000000, 0x00000000},
57 {272, "SPRG0", 0x00000000, 0x00000000},
58 {273, "SPRG1", 0x00000000, 0x00000000},
59 {274, "SPRG2", 0x00000000, 0x00000000},
60 {275, "SPRG3", 0x00000000, 0x00000000},
61 {287, "PVR", 0xFFFF0000, 0x00500000},
63 /* Additional Special-Purpose Registers */
65 {144, "CMPA", 0x00000000, 0x00000000},
66 {145, "CMPB", 0x00000000, 0x00000000},
67 {146, "CMPC", 0x00000000, 0x00000000},
68 {147, "CMPD", 0x00000000, 0x00000000},
69 {148, "ICR", 0xFFFFFFFF, 0x00000000},
70 {149, "DER", 0x00000000, 0x00000000},
71 {150, "COUNTA", 0xFFFFFFFF, 0x00000000},
72 {151, "COUNTB", 0xFFFFFFFF, 0x00000000},
73 {152, "CMPE", 0x00000000, 0x00000000},
74 {153, "CMPF", 0x00000000, 0x00000000},
75 {154, "CMPG", 0x00000000, 0x00000000},
76 {155, "CMPH", 0x00000000, 0x00000000},
77 {156, "LCTRL1", 0xFFFFFFFF, 0x00000000},
78 {157, "LCTRL2", 0xFFFFFFFF, 0x00000000},
79 {158, "ICTRL", 0xFFFFFFFF, 0x00000007},
80 {159, "BAR", 0x00000000, 0x00000000},
81 {630, "DPDR", 0x00000000, 0x00000000},
82 {631, "DPIR", 0x00000000, 0x00000000},
83 {638, "IMMR", 0xFFFF0000, CONFIG_SYS_IMMR },
84 {560, "IC_CST", 0x8E380000, 0x00000000},
85 {561, "IC_ADR", 0x00000000, 0x00000000},
86 {562, "IC_DAT", 0x00000000, 0x00000000},
87 {568, "DC_CST", 0xEF380000, 0x00000000},
88 {569, "DC_ADR", 0x00000000, 0x00000000},
89 {570, "DC_DAT", 0x00000000, 0x00000000},
90 {784, "MI_CTR", 0xFFFFFFFF, 0x00000000},
91 {786, "MI_AP", 0x00000000, 0x00000000},
92 {787, "MI_EPN", 0x00000000, 0x00000000},
93 {789, "MI_TWC", 0xFFFFFE02, 0x00000000},
94 {790, "MI_RPN", 0x00000000, 0x00000000},
95 {816, "MI_DBCAM", 0x00000000, 0x00000000},
96 {817, "MI_DBRAM0", 0x00000000, 0x00000000},
97 {818, "MI_DBRAM1", 0x00000000, 0x00000000},
98 {792, "MD_CTR", 0xFFFFFFFF, 0x04000000},
99 {793, "M_CASID", 0xFFFFFFF0, 0x00000000},
100 {794, "MD_AP", 0x00000000, 0x00000000},
101 {795, "MD_EPN", 0x00000000, 0x00000000},
102 {796, "M_TWB", 0x00000003, 0x00000000},
103 {797, "MD_TWC", 0x00000003, 0x00000000},
104 {798, "MD_RPN", 0x00000000, 0x00000000},
105 {799, "M_TW", 0x00000000, 0x00000000},
106 {824, "MD_DBCAM", 0x00000000, 0x00000000},
107 {825, "MD_DBRAM0", 0x00000000, 0x00000000},
108 {826, "MD_DBRAM1", 0x00000000, 0x00000000},
111 static int spr_test_list_size = ARRAY_SIZE(spr_test_list);
113 int spr_post_test (int flags)
116 int ic = icache_status ();
119 unsigned long code[] = {
120 0x7c6002a6, /* mfspr r3,SPR */
123 unsigned long (*get_spr) (void) = (void *) code;
128 for (i = 0; i < spr_test_list_size; i++) {
129 int num = spr_test_list[i].number;
132 code[0] = 0x7c6002a6 | ((num & 0x1F) << 16) | ((num & 0x3E0) << 6);
134 if ((get_spr () & spr_test_list[i].mask) !=
135 (spr_test_list[i].value & spr_test_list[i].mask)) {
136 post_log ("The value of %s special register "
137 "is incorrect: 0x%08X\n",
138 spr_test_list[i].name, get_spr ());
148 #endif /* CONFIG_POST & CONFIG_SYS_POST_SPR */