cache.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2001-2003, 2006 Silicon Graphics, Inc. All rights reserved.
  7. *
  8. */
  9. #include <linux/module.h>
  10. #include <asm/pgalloc.h>
  11. #include <asm/sn/arch.h>
  12. /**
  13. * sn_flush_all_caches - flush a range of address from all caches (incl. L4)
  14. * @flush_addr: identity mapped region 7 address to start flushing
  15. * @bytes: number of bytes to flush
  16. *
  17. * Flush a range of addresses from all caches including L4.
  18. * All addresses fully or partially contained within
  19. * @flush_addr to @flush_addr + @bytes are flushed
  20. * from all caches.
  21. */
  22. void
  23. sn_flush_all_caches(long flush_addr, long bytes)
  24. {
  25. unsigned long addr = flush_addr;
  26. /* SHub1 requires a cached address */
  27. if (is_shub1() && (addr & RGN_BITS) == RGN_BASE(RGN_UNCACHED))
  28. addr = (addr - RGN_BASE(RGN_UNCACHED)) + RGN_BASE(RGN_KERNEL);
  29. flush_icache_range(addr, addr + bytes);
  30. /*
  31. * The last call may have returned before the caches
  32. * were actually flushed, so we call it again to make
  33. * sure.
  34. */
  35. flush_icache_range(addr, addr + bytes);
  36. mb();
  37. }
  38. EXPORT_SYMBOL(sn_flush_all_caches);