cache.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * (C) Copyright 2002
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. /* Cache test
  25. *
  26. * This test verifies the CPU data and instruction cache using
  27. * several test scenarios.
  28. */
  29. #include <post.h>
  30. #include <watchdog.h>
  31. #if CONFIG_POST & CONFIG_SYS_POST_CACHE
  32. #define CACHE_POST_SIZE 1024
  33. extern int cache_post_test1 (char *, unsigned int);
  34. extern int cache_post_test2 (char *, unsigned int);
  35. extern int cache_post_test3 (char *, unsigned int);
  36. extern int cache_post_test4 (char *, unsigned int);
  37. extern int cache_post_test5 (void);
  38. extern int cache_post_test6 (void);
  39. int cache_post_test (int flags)
  40. {
  41. int ints = disable_interrupts ();
  42. int res = 0;
  43. static char ta[CACHE_POST_SIZE + 0xf];
  44. char *testarea = (char *) (((unsigned long) ta + 0xf) & ~0xf);
  45. WATCHDOG_RESET ();
  46. if (res == 0)
  47. res = cache_post_test1 (testarea, CACHE_POST_SIZE);
  48. WATCHDOG_RESET ();
  49. if (res == 0)
  50. res = cache_post_test2 (testarea, CACHE_POST_SIZE);
  51. WATCHDOG_RESET ();
  52. if (res == 0)
  53. res = cache_post_test3 (testarea, CACHE_POST_SIZE);
  54. WATCHDOG_RESET ();
  55. if (res == 0)
  56. res = cache_post_test4 (testarea, CACHE_POST_SIZE);
  57. WATCHDOG_RESET ();
  58. if (res == 0)
  59. res = cache_post_test5 ();
  60. WATCHDOG_RESET ();
  61. if (res == 0)
  62. res = cache_post_test6 ();
  63. WATCHDOG_RESET ();
  64. if (ints)
  65. enable_interrupts ();
  66. return res;
  67. }
  68. #endif /* CONFIG_POST & CONFIG_SYS_POST_CACHE */