blob: 1e7ed31badb9e41a66f7934af90763e7a0cb6635 [file] [log] [blame]
Sergei Poselenovb4489622007-07-05 08:17:37 +02001/*
2 * Copyright (C) 2007
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * Author: Sergei Poselenov <sposelenov@emcraft.com>
6 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Sergei Poselenovb4489622007-07-05 08:17:37 +02008 */
9
10#include <common.h>
11
12/*
13 * FPU test
14 *
15 * This test checks the arithmetic logic unit (ALU) of CPU.
16 * It tests independently various groups of instructions using
17 * run-time modification of the code to reduce the memory footprint.
18 * For more details refer to post/cpu/ *.c files.
19 */
20
Sergei Poselenovb4489622007-07-05 08:17:37 +020021#include <post.h>
22
Kumar Galae009cde2011-01-25 03:00:08 -060023GNU_FPOST_ATTR
24
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020025#if CONFIG_POST & CONFIG_SYS_POST_FPU
Sergei Poselenovb4489622007-07-05 08:17:37 +020026
27#include <watchdog.h>
28
29extern int fpu_status (void);
30extern void fpu_enable (void);
31extern void fpu_disable (void);
32
33extern int fpu_post_test_math1 (void);
34extern int fpu_post_test_math2 (void);
35extern int fpu_post_test_math3 (void);
36extern int fpu_post_test_math4 (void);
37extern int fpu_post_test_math5 (void);
38extern int fpu_post_test_math6 (void);
39extern int fpu_post_test_math7 (void);
40
41int fpu_post_test (int flags)
42{
43 int fpu = fpu_status ();
44
45 int ret = 0;
46
47 WATCHDOG_RESET ();
48
49 if (!fpu)
50 fpu_enable ();
51
52 if (ret == 0)
53 ret = fpu_post_test_math1 ();
54 if (ret == 0)
55 ret = fpu_post_test_math2 ();
56 if (ret == 0)
57 ret = fpu_post_test_math3 ();
58 if (ret == 0)
59 ret = fpu_post_test_math4 ();
60 if (ret == 0)
61 ret = fpu_post_test_math5 ();
62 if (ret == 0)
63 ret = fpu_post_test_math6 ();
64 if (ret == 0)
65 ret = fpu_post_test_math7 ();
66
67 if (!fpu)
68 fpu_disable ();
69
70 WATCHDOG_RESET ();
71
72 return ret;
73}
74
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020075#endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */