fpu.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2007
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. *
  6. * Author: Sergei Poselenov <sposelenov@emcraft.com>
  7. */
  8. #include <common.h>
  9. /*
  10. * FPU test
  11. *
  12. * This test checks the arithmetic logic unit (ALU) of CPU.
  13. * It tests independently various groups of instructions using
  14. * run-time modification of the code to reduce the memory footprint.
  15. * For more details refer to post/cpu/ *.c files.
  16. */
  17. #include <post.h>
  18. GNU_FPOST_ATTR
  19. #if CONFIG_POST & CONFIG_SYS_POST_FPU
  20. #include <watchdog.h>
  21. extern int fpu_status (void);
  22. extern void fpu_enable (void);
  23. extern void fpu_disable (void);
  24. extern int fpu_post_test_math1 (void);
  25. extern int fpu_post_test_math2 (void);
  26. extern int fpu_post_test_math3 (void);
  27. extern int fpu_post_test_math4 (void);
  28. extern int fpu_post_test_math5 (void);
  29. extern int fpu_post_test_math6 (void);
  30. extern int fpu_post_test_math7 (void);
  31. int fpu_post_test (int flags)
  32. {
  33. int fpu = fpu_status ();
  34. int ret = 0;
  35. WATCHDOG_RESET ();
  36. if (!fpu)
  37. fpu_enable ();
  38. if (ret == 0)
  39. ret = fpu_post_test_math1 ();
  40. if (ret == 0)
  41. ret = fpu_post_test_math2 ();
  42. if (ret == 0)
  43. ret = fpu_post_test_math3 ();
  44. if (ret == 0)
  45. ret = fpu_post_test_math4 ();
  46. if (ret == 0)
  47. ret = fpu_post_test_math5 ();
  48. if (ret == 0)
  49. ret = fpu_post_test_math6 ();
  50. if (ret == 0)
  51. ret = fpu_post_test_math7 ();
  52. if (!fpu)
  53. fpu_disable ();
  54. WATCHDOG_RESET ();
  55. return ret;
  56. }
  57. #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */