cache_armv6.S 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2013 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <grub/symbol.h>
  19. .file "cache_armv6.S"
  20. .text
  21. .syntax unified
  22. .arm
  23. # define DMB mcr p15, 0, r0, c7, c10, 5
  24. # define DSB mcr p15, 0, r0, c7, c10, 4
  25. # define ISB mcr p15, 0, r0, c7, c5, 4
  26. #define ARMV6 1
  27. clean_invalidate_dcache:
  28. mcr p15, 0, r0, c7, c14, 0 @ Clean/Invalidate D-cache
  29. bx lr
  30. #include "cache.S"
  31. FUNCTION(grub_arm_main_id)
  32. mrc p15, 0, r0, c0, c0, 0
  33. bx lr
  34. FUNCTION(grub_arm_cache_type)
  35. mrc p15, 0, r0, c0, c0, 1
  36. bx lr
  37. FUNCTION(grub_arm_clear_mmu_v6)
  38. mov r0, #0
  39. mcr p15, 0, r0, c2, c0, 2
  40. bx lr
  41. FUNCTION(grub_arm_enable_mmu)
  42. mcr p15, 0, r0, c2, c0, 0
  43. mvn r0, #0
  44. mcr p15, 0, r0, c3, c0, 0
  45. mrc p15, 0, r0, c1, c0, 0
  46. bic r0, r0, #(1 << 23)
  47. mcr p15, 0, r0, c1, c0, 0
  48. mrc p15, 0, r0, c1, c0, 0
  49. orr r0, r0, #(1 << 0)
  50. mcr p15, 0, r0, c1, c0, 0
  51. mrc p15, 0, r0, c1, c0, 0
  52. orr r0, r0, #(1 << 2)
  53. mcr p15, 0, r0, c1, c0, 0
  54. mrc p15, 0, r0, c1, c0, 0
  55. orr r0, r0, #(1 << 12)
  56. mcr p15, 0, r0, c1, c0, 0
  57. bx lr