]> git.ipfire.org Git - thirdparty/u-boot.git/blame - post/lib_powerpc/cpu.c
Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
[thirdparty/u-boot.git] / post / lib_powerpc / cpu.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
ad5bb451
WD
2/*
3 * (C) Copyright 2002
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
ad5bb451
WD
5 */
6
d678a59d 7#include <common.h>
9edefc27 8#include <cpu_func.h>
ad5bb451
WD
9
10/*
11 * CPU test
12 *
13 * This test checks the arithmetic logic unit (ALU) of CPU.
14 * It tests independently various groups of instructions using
15 * run-time modification of the code to reduce the memory footprint.
16 * For more details refer to post/cpu/ *.c files.
17 */
18
ad5bb451
WD
19#include <watchdog.h>
20#include <post.h>
3db93b8b 21#include <asm/mmu.h>
ad5bb451 22
1e019503 23#if CFG_POST & CFG_SYS_POST_CPU
ad5bb451
WD
24
25extern int cpu_post_test_cmp (void);
26extern int cpu_post_test_cmpi (void);
27extern int cpu_post_test_two (void);
28extern int cpu_post_test_twox (void);
29extern int cpu_post_test_three (void);
30extern int cpu_post_test_threex (void);
31extern int cpu_post_test_threei (void);
32extern int cpu_post_test_andi (void);
33extern int cpu_post_test_srawi (void);
34extern int cpu_post_test_rlwnm (void);
35extern int cpu_post_test_rlwinm (void);
36extern int cpu_post_test_rlwimi (void);
37extern int cpu_post_test_store (void);
38extern int cpu_post_test_load (void);
39extern int cpu_post_test_cr (void);
40extern int cpu_post_test_b (void);
41extern int cpu_post_test_multi (void);
42extern int cpu_post_test_string (void);
43extern int cpu_post_test_complex (void);
44
45ulong cpu_post_makecr (long v)
46{
47 ulong cr = 0;
48
49 if (v < 0)
50 cr |= 0x80000000;
51 if (v > 0)
52 cr |= 0x40000000;
53 if (v == 0)
54 cr |= 0x20000000;
55
56 return cr;
57}
58
59int cpu_post_test (int flags)
60{
6cc915b5 61 int ic = icache_status();
ad5bb451
WD
62 int ret = 0;
63
29caf930 64 schedule();
ad5bb451 65 if (ic)
6cc915b5 66 icache_disable();
ad5bb451
WD
67
68 if (ret == 0)
69 ret = cpu_post_test_cmp ();
70 if (ret == 0)
71 ret = cpu_post_test_cmpi ();
72 if (ret == 0)
73 ret = cpu_post_test_two ();
74 if (ret == 0)
75 ret = cpu_post_test_twox ();
29caf930 76 schedule();
ad5bb451
WD
77 if (ret == 0)
78 ret = cpu_post_test_three ();
79 if (ret == 0)
80 ret = cpu_post_test_threex ();
81 if (ret == 0)
82 ret = cpu_post_test_threei ();
83 if (ret == 0)
84 ret = cpu_post_test_andi ();
29caf930 85 schedule();
ad5bb451
WD
86 if (ret == 0)
87 ret = cpu_post_test_srawi ();
88 if (ret == 0)
89 ret = cpu_post_test_rlwnm ();
90 if (ret == 0)
91 ret = cpu_post_test_rlwinm ();
92 if (ret == 0)
93 ret = cpu_post_test_rlwimi ();
29caf930 94 schedule();
ad5bb451
WD
95 if (ret == 0)
96 ret = cpu_post_test_store ();
97 if (ret == 0)
98 ret = cpu_post_test_load ();
99 if (ret == 0)
100 ret = cpu_post_test_cr ();
101 if (ret == 0)
102 ret = cpu_post_test_b ();
29caf930 103 schedule();
ad5bb451
WD
104 if (ret == 0)
105 ret = cpu_post_test_multi ();
29caf930 106 schedule();
ad5bb451
WD
107 if (ret == 0)
108 ret = cpu_post_test_string ();
109 if (ret == 0)
110 ret = cpu_post_test_complex ();
29caf930 111 schedule();
ad5bb451
WD
112
113 if (ic)
6cc915b5 114 icache_enable();
ad5bb451 115
29caf930 116 schedule();
ad5bb451
WD
117
118 return ret;
119}
120
1e019503 121#endif /* CFG_POST & CFG_SYS_POST_CPU */