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,
28 * Store instructions: stb(x)(u), sth(x)(u), stw(x)(u)
30 * All operations are performed on a 16-byte array. The array
31 * is 4-byte aligned. The base register points to offset 8.
32 * The immediate offset (index register) ranges in [-8 ... +7].
33 * The test cases are composed so that they do not
34 * cause alignment exceptions.
35 * The test contains a pre-built table describing all test cases.
36 * The table entry contains:
37 * the instruction opcode, the value of the index register and
38 * the value of the source register. After executing the
39 * instruction, the test verifies the contents of the array
40 * and the value of the base register (it must change for "store
41 * with update" instructions).
47 #if CONFIG_POST & CONFIG_SYS_POST_CPU
49 extern void cpu_post_exec_12w (ulong *code, ulong *op1, ulong op2, ulong op3);
50 extern void cpu_post_exec_11w (ulong *code, ulong *op1, ulong op2);
52 static struct cpu_post_store_s
60 } cpu_post_store_table[] =
159 static unsigned int cpu_post_store_size =
160 sizeof (cpu_post_store_table) / sizeof (struct cpu_post_store_s);
162 int cpu_post_test_store (void)
166 int flag = disable_interrupts();
168 for (i = 0; i < cpu_post_store_size && ret == 0; i++)
170 struct cpu_post_store_s *test = cpu_post_store_table + i;
172 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
173 ulong base0 = (ulong) (data + 8);
180 ASM_12(test->cmd, 5, 3, 4),
184 cpu_post_exec_12w (code, &base, test->offset, test->value);
190 ASM_11I(test->cmd, 4, 3, test->offset),
194 cpu_post_exec_11w (code, &base, test->value);
200 ret = base == base0 + test->offset ? 0 : -1;
202 ret = base == base0 ? 0 : -1;
210 ret = *(uchar *)(base0 + test->offset) == test->value ?
214 ret = *(ushort *)(base0 + test->offset) == test->value ?
218 ret = *(ulong *)(base0 + test->offset) == test->value ?
226 post_log ("Error at store test %d !\n", i);