]> git.ipfire.org Git - people/ms/u-boot.git/blob - post/lib_ppc/fpu/fpu.c
rename CFG_ macros to CONFIG_SYS
[people/ms/u-boot.git] / post / lib_ppc / fpu / fpu.c
1 /*
2 * Copyright (C) 2007
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * Author: Sergei Poselenov <sposelenov@emcraft.com>
6 *
7 * See file CREDITS for list of people who contributed to this
8 * project.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 */
25
26 #include <common.h>
27
28 /*
29 * FPU test
30 *
31 * This test checks the arithmetic logic unit (ALU) of CPU.
32 * It tests independently various groups of instructions using
33 * run-time modification of the code to reduce the memory footprint.
34 * For more details refer to post/cpu/ *.c files.
35 */
36
37 #include <post.h>
38
39 #if CONFIG_POST & CONFIG_SYS_POST_FPU
40
41 #include <watchdog.h>
42
43 extern int fpu_status (void);
44 extern void fpu_enable (void);
45 extern void fpu_disable (void);
46
47 extern int fpu_post_test_math1 (void);
48 extern int fpu_post_test_math2 (void);
49 extern int fpu_post_test_math3 (void);
50 extern int fpu_post_test_math4 (void);
51 extern int fpu_post_test_math5 (void);
52 extern int fpu_post_test_math6 (void);
53 extern int fpu_post_test_math7 (void);
54
55 int fpu_post_test (int flags)
56 {
57 int fpu = fpu_status ();
58
59 int ret = 0;
60
61 WATCHDOG_RESET ();
62
63 if (!fpu)
64 fpu_enable ();
65
66 if (ret == 0)
67 ret = fpu_post_test_math1 ();
68 if (ret == 0)
69 ret = fpu_post_test_math2 ();
70 if (ret == 0)
71 ret = fpu_post_test_math3 ();
72 if (ret == 0)
73 ret = fpu_post_test_math4 ();
74 if (ret == 0)
75 ret = fpu_post_test_math5 ();
76 if (ret == 0)
77 ret = fpu_post_test_math6 ();
78 if (ret == 0)
79 ret = fpu_post_test_math7 ();
80
81 if (!fpu)
82 fpu_disable ();
83
84 WATCHDOG_RESET ();
85
86 return ret;
87 }
88
89 #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */