cache-sh2.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * arch/sh/mm/cache-sh2.c
  3. *
  4. * Copyright (C) 2002 Paul Mundt
  5. *
  6. * Released under the terms of the GNU GPL v2.0.
  7. */
  8. #include <linux/init.h>
  9. #include <linux/mm.h>
  10. #include <asm/cache.h>
  11. #include <asm/addrspace.h>
  12. #include <asm/processor.h>
  13. #include <asm/cacheflush.h>
  14. #include <asm/io.h>
  15. void __flush_wback_region(void *start, int size)
  16. {
  17. unsigned long v;
  18. unsigned long begin, end;
  19. begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
  20. end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
  21. & ~(L1_CACHE_BYTES-1);
  22. for (v = begin; v < end; v+=L1_CACHE_BYTES) {
  23. /* FIXME cache purge */
  24. ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
  25. }
  26. }
  27. void __flush_purge_region(void *start, int size)
  28. {
  29. unsigned long v;
  30. unsigned long begin, end;
  31. begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
  32. end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
  33. & ~(L1_CACHE_BYTES-1);
  34. for (v = begin; v < end; v+=L1_CACHE_BYTES) {
  35. ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
  36. }
  37. }
  38. void __flush_invalidate_region(void *start, int size)
  39. {
  40. unsigned long v;
  41. unsigned long begin, end;
  42. begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
  43. end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
  44. & ~(L1_CACHE_BYTES-1);
  45. for (v = begin; v < end; v+=L1_CACHE_BYTES) {
  46. ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
  47. }
  48. }