cache-dbg-inv-by-reg.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* MN10300 CPU cache invalidation routines, using automatic purge registers
  2. *
  3. * Copyright (C) 2011 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. #include <linux/sys.h>
  12. #include <linux/linkage.h>
  13. #include <asm/cache.h>
  14. #include <asm/irqflags.h>
  15. #include <asm/cacheflush.h>
  16. #include "cache.inc"
  17. .am33_2
  18. .globl debugger_local_cache_flushinv_one
  19. ###############################################################################
  20. #
  21. # void debugger_local_cache_flushinv_one(u8 *addr)
  22. #
  23. # Invalidate one particular cacheline if it's in the icache
  24. #
  25. ###############################################################################
  26. ALIGN
  27. .globl debugger_local_cache_flushinv_one
  28. .type debugger_local_cache_flushinv_one,@function
  29. debugger_local_cache_flushinv_one:
  30. mov d0,a1
  31. mov CHCTR,a0
  32. movhu (a0),d0
  33. btst CHCTR_ICEN,d0
  34. beq mn10300_local_icache_inv_range_reg_end
  35. LOCAL_CLI_SAVE(d1)
  36. mov ICIVCR,a0
  37. # wait for the invalidator to quiesce
  38. setlb
  39. mov (a0),d0
  40. btst ICIVCR_ICIVBSY,d0
  41. lne
  42. # set the mask
  43. mov ~L1_CACHE_TAG_MASK,d0
  44. mov d0,(ICIVMR)
  45. # invalidate the cache line at the given address
  46. and ~L1_CACHE_TAG_MASK,a1
  47. or ICIVCR_ICI,a1
  48. mov a1,(a0)
  49. # wait for the invalidator to quiesce again
  50. setlb
  51. mov (a0),d0
  52. btst ICIVCR_ICIVBSY,d0
  53. lne
  54. LOCAL_IRQ_RESTORE(d1)
  55. mn10300_local_icache_inv_range_reg_end:
  56. ret [],0
  57. .size debugger_local_cache_flushinv_one,.-debugger_local_cache_flushinv_one