Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * Author: Sergei Poselenov <sposelenov@emcraft.com> |
| 6 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 8 | */ |
| 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 Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 21 | #include <post.h> |
| 22 | |
Kumar Gala | fe6555b | 2011-01-25 03:00:08 -0600 | [diff] [blame] | 23 | GNU_FPOST_ATTR |
| 24 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 25 | #if CONFIG_POST & CONFIG_SYS_POST_FPU |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 26 | |
| 27 | #include <watchdog.h> |
| 28 | |
| 29 | extern int fpu_status (void); |
| 30 | extern void fpu_enable (void); |
| 31 | extern void fpu_disable (void); |
| 32 | |
| 33 | extern int fpu_post_test_math1 (void); |
| 34 | extern int fpu_post_test_math2 (void); |
| 35 | extern int fpu_post_test_math3 (void); |
| 36 | extern int fpu_post_test_math4 (void); |
| 37 | extern int fpu_post_test_math5 (void); |
| 38 | extern int fpu_post_test_math6 (void); |
| 39 | extern int fpu_post_test_math7 (void); |
| 40 | |
| 41 | int 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-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 75 | #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */ |