mxcc.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * mxcc.h: Definitions of the Viking MXCC registers
  4. *
  5. * Copyright (C) 1995 David S. Miller ([email protected])
  6. */
  7. #ifndef _SPARC_MXCC_H
  8. #define _SPARC_MXCC_H
  9. /* These registers are accessed through ASI 0x2. */
  10. #define MXCC_DATSTREAM 0x1C00000 /* Data stream register */
  11. #define MXCC_SRCSTREAM 0x1C00100 /* Source stream register */
  12. #define MXCC_DESSTREAM 0x1C00200 /* Destination stream register */
  13. #define MXCC_RMCOUNT 0x1C00300 /* Count of references and misses */
  14. #define MXCC_STEST 0x1C00804 /* Internal self-test */
  15. #define MXCC_CREG 0x1C00A04 /* Control register */
  16. #define MXCC_SREG 0x1C00B00 /* Status register */
  17. #define MXCC_RREG 0x1C00C04 /* Reset register */
  18. #define MXCC_EREG 0x1C00E00 /* Error code register */
  19. #define MXCC_PREG 0x1C00F04 /* Address port register */
  20. /* Some MXCC constants. */
  21. #define MXCC_STREAM_SIZE 0x20 /* Size in bytes of one stream r/w */
  22. /* The MXCC Control Register:
  23. *
  24. * ----------------------------------------------------------------------
  25. * | | RRC | RSV |PRE|MCE|PARE|ECE|RSV|
  26. * ----------------------------------------------------------------------
  27. * 31 10 9 8-6 5 4 3 2 1-0
  28. *
  29. * RRC: Controls what you read from MXCC_RMCOUNT reg.
  30. * 0=Misses 1=References
  31. * PRE: Prefetch enable
  32. * MCE: Multiple Command Enable
  33. * PARE: Parity enable
  34. * ECE: External cache enable
  35. */
  36. #define MXCC_CTL_RRC 0x00000200
  37. #define MXCC_CTL_PRE 0x00000020
  38. #define MXCC_CTL_MCE 0x00000010
  39. #define MXCC_CTL_PARE 0x00000008
  40. #define MXCC_CTL_ECE 0x00000004
  41. /* The MXCC Error Register:
  42. *
  43. * --------------------------------------------------------
  44. * |ME| RSV|CE|PEW|PEE|ASE|EIV| MOPC|ECODE|PRIV|RSV|HPADDR|
  45. * --------------------------------------------------------
  46. * 31 30 29 28 27 26 25 24-15 14-7 6 5-3 2-0
  47. *
  48. * ME: Multiple Errors have occurred
  49. * CE: Cache consistency Error
  50. * PEW: Parity Error during a Write operation
  51. * PEE: Parity Error involving the External cache
  52. * ASE: ASynchronous Error
  53. * EIV: This register is toast
  54. * MOPC: MXCC Operation Code for instance causing error
  55. * ECODE: The Error CODE
  56. * PRIV: A privileged mode error? 0=no 1=yes
  57. * HPADDR: High PhysicalADDRess bits (35-32)
  58. */
  59. #define MXCC_ERR_ME 0x80000000
  60. #define MXCC_ERR_CE 0x20000000
  61. #define MXCC_ERR_PEW 0x10000000
  62. #define MXCC_ERR_PEE 0x08000000
  63. #define MXCC_ERR_ASE 0x04000000
  64. #define MXCC_ERR_EIV 0x02000000
  65. #define MXCC_ERR_MOPC 0x01FF8000
  66. #define MXCC_ERR_ECODE 0x00007F80
  67. #define MXCC_ERR_PRIV 0x00000040
  68. #define MXCC_ERR_HPADDR 0x0000000f
  69. /* The MXCC Port register:
  70. *
  71. * -----------------------------------------------------
  72. * | | MID | |
  73. * -----------------------------------------------------
  74. * 31 21 20-18 17 0
  75. *
  76. * MID: The moduleID of the cpu your read this from.
  77. */
  78. #ifndef __ASSEMBLY__
  79. static inline void mxcc_set_stream_src(unsigned long *paddr)
  80. {
  81. unsigned long data0 = paddr[0];
  82. unsigned long data1 = paddr[1];
  83. __asm__ __volatile__ ("or %%g0, %0, %%g2\n\t"
  84. "or %%g0, %1, %%g3\n\t"
  85. "stda %%g2, [%2] %3\n\t" : :
  86. "r" (data0), "r" (data1),
  87. "r" (MXCC_SRCSTREAM),
  88. "i" (ASI_M_MXCC) : "g2", "g3");
  89. }
  90. static inline void mxcc_set_stream_dst(unsigned long *paddr)
  91. {
  92. unsigned long data0 = paddr[0];
  93. unsigned long data1 = paddr[1];
  94. __asm__ __volatile__ ("or %%g0, %0, %%g2\n\t"
  95. "or %%g0, %1, %%g3\n\t"
  96. "stda %%g2, [%2] %3\n\t" : :
  97. "r" (data0), "r" (data1),
  98. "r" (MXCC_DESSTREAM),
  99. "i" (ASI_M_MXCC) : "g2", "g3");
  100. }
  101. static inline unsigned long mxcc_get_creg(void)
  102. {
  103. unsigned long mxcc_control;
  104. __asm__ __volatile__("set 0xffffffff, %%g2\n\t"
  105. "set 0xffffffff, %%g3\n\t"
  106. "stda %%g2, [%1] %2\n\t"
  107. "lda [%3] %2, %0\n\t" :
  108. "=r" (mxcc_control) :
  109. "r" (MXCC_EREG), "i" (ASI_M_MXCC),
  110. "r" (MXCC_CREG) : "g2", "g3");
  111. return mxcc_control;
  112. }
  113. static inline void mxcc_set_creg(unsigned long mxcc_control)
  114. {
  115. __asm__ __volatile__("sta %0, [%1] %2\n\t" : :
  116. "r" (mxcc_control), "r" (MXCC_CREG),
  117. "i" (ASI_M_MXCC));
  118. }
  119. #endif /* !__ASSEMBLY__ */
  120. #endif /* !(_SPARC_MXCC_H) */