cache.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* MN10300 cache management registers
  2. *
  3. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_CACHE_H
  12. #define _ASM_CACHE_H
  13. #include <asm/cpu-regs.h>
  14. #include <asm/proc/cache.h>
  15. #ifndef __ASSEMBLY__
  16. #define L1_CACHE_DISPARITY (L1_CACHE_NENTRIES * L1_CACHE_BYTES)
  17. #else
  18. #define L1_CACHE_DISPARITY L1_CACHE_NENTRIES * L1_CACHE_BYTES
  19. #endif
  20. /* data cache purge registers
  21. * - read from the register to unconditionally purge that cache line
  22. * - write address & 0xffffff00 to conditionally purge that cache line
  23. * - clear LSB to request invalidation as well
  24. */
  25. #define DCACHE_PURGE(WAY, ENTRY) \
  26. __SYSREG(0xc8400000 + (WAY) * L1_CACHE_WAYDISP + \
  27. (ENTRY) * L1_CACHE_BYTES, u32)
  28. #define DCACHE_PURGE_WAY0(ENTRY) \
  29. __SYSREG(0xc8400000 + 0 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32)
  30. #define DCACHE_PURGE_WAY1(ENTRY) \
  31. __SYSREG(0xc8400000 + 1 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32)
  32. #define DCACHE_PURGE_WAY2(ENTRY) \
  33. __SYSREG(0xc8400000 + 2 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32)
  34. #define DCACHE_PURGE_WAY3(ENTRY) \
  35. __SYSREG(0xc8400000 + 3 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32)
  36. /* instruction cache access registers */
  37. #define ICACHE_DATA(WAY, ENTRY, OFF) \
  38. __SYSREG(0xc8000000 + (WAY) * L1_CACHE_WAYDISP + (ENTRY) * 0x10 + (OFF) * 4, u32)
  39. #define ICACHE_TAG(WAY, ENTRY) \
  40. __SYSREG(0xc8100000 + (WAY) * L1_CACHE_WAYDISP + (ENTRY) * 0x10, u32)
  41. /* instruction cache access registers */
  42. #define DCACHE_DATA(WAY, ENTRY, OFF) \
  43. __SYSREG(0xc8200000 + (WAY) * L1_CACHE_WAYDISP + (ENTRY) * 0x10 + (OFF) * 4, u32)
  44. #define DCACHE_TAG(WAY, ENTRY) \
  45. __SYSREG(0xc8300000 + (WAY) * L1_CACHE_WAYDISP + (ENTRY) * 0x10, u32)
  46. #endif /* _ASM_CACHE_H */