1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <common.h>
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39#include <post.h>
40#include "cpu_asm.h"
41
42#if CONFIG_POST & CONFIG_SYS_POST_CPU
43
44extern void cpu_post_exec_11 (ulong *code, ulong *res, ulong op1);
45
46static struct cpu_post_cmpi_s
47{
48 ulong cmd;
49 ulong op1;
50 ushort op2;
51 ulong cr;
52 ulong res;
53} cpu_post_cmpi_table[] =
54{
55 {
56 OP_CMPWI,
57 123,
58 123,
59 2,
60 0x02
61 },
62 {
63 OP_CMPWI,
64 123,
65 133,
66 3,
67 0x08
68 },
69 {
70 OP_CMPWI,
71 123,
72 -133,
73 4,
74 0x04
75 },
76 {
77 OP_CMPLWI,
78 123,
79 123,
80 2,
81 0x02
82 },
83 {
84 OP_CMPLWI,
85 123,
86 -133,
87 3,
88 0x08
89 },
90 {
91 OP_CMPLWI,
92 123,
93 113,
94 4,
95 0x04
96 },
97};
98static unsigned int cpu_post_cmpi_size = ARRAY_SIZE(cpu_post_cmpi_table);
99
100int cpu_post_test_cmpi (void)
101{
102 int ret = 0;
103 unsigned int i;
104 int flag = disable_interrupts();
105
106 for (i = 0; i < cpu_post_cmpi_size && ret == 0; i++)
107 {
108 struct cpu_post_cmpi_s *test = cpu_post_cmpi_table + i;
109 unsigned long code[] =
110 {
111 ASM_1IC(test->cmd, test->cr, 3, test->op2),
112 ASM_MFCR(3),
113 ASM_BLR
114 };
115 ulong res;
116
117 cpu_post_exec_11 (code, & res, test->op1);
118
119 ret = ((res >> (28 - 4 * test->cr)) & 0xe) == test->res ? 0 : -1;
120
121 if (ret != 0)
122 {
123 post_log ("Error at cmpi test %d !\n", i);
124 }
125 }
126
127 if (flag)
128 enable_interrupts();
129
130 return ret;
131}
132
133#endif
134