cm_init.S 946 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * MIPS Coherence Manager (CM) Initialisation
  3. *
  4. * Copyright (c) 2016 Imagination Technologies Ltd.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <asm/addrspace.h>
  9. #include <asm/asm.h>
  10. #include <asm/cm.h>
  11. #include <asm/mipsregs.h>
  12. #include <asm/regdef.h>
  13. LEAF(mips_cm_map)
  14. /* Config3 must exist for a CM to be present */
  15. mfc0 t0, CP0_CONFIG, 1
  16. bgez t0, 2f
  17. mfc0 t0, CP0_CONFIG, 2
  18. bgez t0, 2f
  19. /* Check Config3.CMGCR to determine CM presence */
  20. mfc0 t0, CP0_CONFIG, 3
  21. and t0, t0, MIPS_CONF3_CMGCR
  22. beqz t0, 2f
  23. /* Find the current physical GCR base address */
  24. 1: MFC0 t0, CP0_CMGCRBASE
  25. PTR_SLL t0, t0, 4
  26. /* If the GCRs are where we want, we're done */
  27. PTR_LI t1, CONFIG_MIPS_CM_BASE
  28. beq t0, t1, 2f
  29. /* Move the GCRs to our configured base address */
  30. PTR_LI t2, CKSEG1
  31. PTR_ADDU t0, t0, t2
  32. sw zero, GCR_BASE_UPPER(t0)
  33. sw t1, GCR_BASE(t0)
  34. /* Re-check the GCR base */
  35. b 1b
  36. 2: jr ra
  37. END(mips_cm_map)