Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.1 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Cache-handling routined for MIPS r5900
  3. *
  4. * Copyright (c) 2003 Wolfgang Denk <wd@denx.de>
  5. * Copyright (c) 2014 Juergen Urban
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <asm-offsets.h>
  10. #include <config.h>
  11. #include <asm/asm.h>
  12. #include <asm/regdef.h>
  13. #include <asm/mipsregs.h>
  14. #ifndef CONFIG_SYS_MIPS_CACHE_MODE
  15. #define CONFIG_SYS_MIPS_CACHE_MODE CONF_CM_CACHABLE_NONCOHERENT
  16. #endif
  17. /*
  18. * dcache_status - get cache status
  19. *
  20. * RETURNS: 0 - cache disabled; 1 - cache enabled
  21. *
  22. */
  23. LEAF(dcache_status)
  24. sync
  25. mfc0 t0, CP0_CONFIG
  26. li t1, CONF_CM_UNCACHED
  27. andi t0, t0, CONF_CM_CMASK
  28. move v0, zero
  29. beq t0, t1, 2f
  30. li v0, 1
  31. 2: jr ra
  32. END(dcache_status)
  33. /*
  34. * dcache_disable - disable cache
  35. *
  36. * RETURNS: N/A
  37. *
  38. */
  39. LEAF(dcache_disable)
  40. sync
  41. mfc0 t0, CP0_CONFIG
  42. li t1, -8
  43. and t0, t0, t1
  44. ori t0, t0, CONF_CM_UNCACHED
  45. mtc0 t0, CP0_CONFIG
  46. sync
  47. jr ra
  48. END(dcache_disable)
  49. /*
  50. * dcache_enable - enable cache
  51. *
  52. * RETURNS: N/A
  53. *
  54. */
  55. LEAF(dcache_enable)
  56. sync
  57. mfc0 t0, CP0_CONFIG
  58. ori t0, CONF_CM_CMASK
  59. xori t0, CONF_CM_CMASK
  60. ori t0, CONFIG_SYS_MIPS_CACHE_MODE
  61. mtc0 t0, CP0_CONFIG
  62. sync
  63. jr ra
  64. END(dcache_enable)