cache.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #ifdef CONFIG_POST
  30. #include <post.h>
  31. #include <watchdog.h>
  32. #if CONFIG_POST & CFG_POST_CACHE
  33. #define CACHE_POST_SIZE 1024
  34. extern int cache_post_test1 (char *, unsigned int);
  35. extern int cache_post_test2 (char *, unsigned int);
  36. extern int cache_post_test3 (char *, unsigned int);
  37. extern int cache_post_test4 (char *, unsigned int);
  38. extern int cache_post_test5 (void);
  39. extern int cache_post_test6 (void);
  40. int cache_post_test (int flags)
  41. {
  42. int ints = disable_interrupts ();
  43. int res = 0;
  44. static char ta[CACHE_POST_SIZE + 0xf];
  45. char *testarea = (char *) (((unsigned long) ta + 0xf) & ~0xf);
  46. WATCHDOG_RESET ();
  47. if (res == 0)
  48. res = cache_post_test1 (testarea, CACHE_POST_SIZE);
  49. WATCHDOG_RESET ();
  50. if (res == 0)
  51. res = cache_post_test2 (testarea, CACHE_POST_SIZE);
  52. WATCHDOG_RESET ();
  53. if (res == 0)
  54. res = cache_post_test3 (testarea, CACHE_POST_SIZE);
  55. WATCHDOG_RESET ();
  56. if (res == 0)
  57. res = cache_post_test4 (testarea, CACHE_POST_SIZE);
  58. WATCHDOG_RESET ();
  59. if (res == 0)
  60. res = cache_post_test5 ();
  61. WATCHDOG_RESET ();
  62. if (res == 0)
  63. res = cache_post_test6 ();
  64. WATCHDOG_RESET ();
  65. if (ints)
  66. enable_interrupts ();
  67. return res;
  68. }
  69. #endif /* CONFIG_POST & CFG_POST_CACHE */
  70. #endif /* CONFIG_POST */