/sys/mips/include/cca.h

https://bitbucket.org/freebsd/freebsd-base · C Header · 153 lines · 46 code · 16 blank · 91 comment · 3 complexity · e79db6fba591b9b70899b6e148807a50 MD5 · raw file

  1. /* $NetBSD: cpuregs.h,v 1.70 2006/05/15 02:26:54 simonb Exp $ */
  2. /*
  3. * SPDX-License-Identifier: BSD-3-Clause
  4. *
  5. * Copyright (c) 1992, 1993
  6. * The Regents of the University of California. All rights reserved.
  7. *
  8. * This code is derived from software contributed to Berkeley by
  9. * Ralph Campbell and Rick Macklem.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. * 2. Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the distribution.
  19. * 3. Neither the name of the University nor the names of its contributors
  20. * may be used to endorse or promote products derived from this software
  21. * without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  24. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  27. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  29. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  30. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  31. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  32. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33. * SUCH DAMAGE.
  34. *
  35. * @(#)machConst.h 8.1 (Berkeley) 6/10/93
  36. *
  37. * machConst.h --
  38. *
  39. * Machine dependent constants.
  40. *
  41. * Copyright (C) 1989 Digital Equipment Corporation.
  42. * Permission to use, copy, modify, and distribute this software and
  43. * its documentation for any purpose and without fee is hereby granted,
  44. * provided that the above copyright notice appears in all copies.
  45. * Digital Equipment Corporation makes no representations about the
  46. * suitability of this software for any purpose. It is provided "as is"
  47. * without express or implied warranty.
  48. *
  49. * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machConst.h,
  50. * v 9.2 89/10/21 15:55:22 jhh Exp SPRITE (DECWRL)
  51. * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAddrs.h,
  52. * v 1.2 89/08/15 18:28:21 rab Exp SPRITE (DECWRL)
  53. * from: Header: /sprite/src/kernel/vm/ds3100.md/RCS/vmPmaxConst.h,
  54. * v 9.1 89/09/18 17:33:00 shirriff Exp SPRITE (DECWRL)
  55. *
  56. * $FreeBSD$
  57. */
  58. #ifndef _MIPS_CCA_H_
  59. #define _MIPS_CCA_H_
  60. /*
  61. * Cache Coherency Attributes:
  62. * UC: Uncached.
  63. * UA: Uncached accelerated.
  64. * C: Cacheable, coherency unspecified.
  65. * CNC: Cacheable non-coherent.
  66. * CC: Cacheable coherent.
  67. * CCS: Cacheable coherent, shared read.
  68. * CCE: Cacheable coherent, exclusive read.
  69. * CCEW: Cacheable coherent, exclusive write.
  70. * CCUOW: Cacheable coherent, update on write.
  71. *
  72. * Note that some bits vary in meaning across implementations (and that the
  73. * listing here is no doubt incomplete) and that the optimal cached mode varies
  74. * between implementations. 0x02 is required to be UC and 0x03 is required to
  75. * be a least C.
  76. *
  77. * We define the following logical bits:
  78. * UNCACHED:
  79. * The optimal uncached mode for the target CPU type. This must
  80. * be suitable for use in accessing memory-mapped devices.
  81. * CACHED: The optional cached mode for the target CPU type.
  82. */
  83. #define MIPS_CCA_UC 0x02 /* Uncached. */
  84. #define MIPS_CCA_C 0x03 /* Cacheable, coherency unspecified. */
  85. #if defined(CPU_R4000) || defined(CPU_R10000)
  86. #define MIPS_CCA_CNC 0x03
  87. #define MIPS_CCA_CCE 0x04
  88. #define MIPS_CCA_CCEW 0x05
  89. #ifdef CPU_R4000
  90. #define MIPS_CCA_CCUOW 0x06
  91. #endif
  92. #ifdef CPU_R10000
  93. #define MIPS_CCA_UA 0x07
  94. #endif
  95. #define MIPS_CCA_CACHED MIPS_CCA_CCEW
  96. #endif /* defined(CPU_R4000) || defined(CPU_R10000) */
  97. #if defined(CPU_SB1)
  98. #define MIPS_CCA_CC 0x05 /* Cacheable Coherent. */
  99. #endif
  100. #if defined(CPU_MIPS74K)
  101. #define MIPS_CCA_UNCACHED 0x02
  102. #define MIPS_CCA_CACHED 0x03
  103. #endif
  104. /*
  105. * 1004K and 1074K cores, as well as interAptiv and proAptiv cores, support
  106. * Cacheable Coherent CCAs 0x04 and 0x05, as well as Cacheable non-Coherent
  107. * CCA 0x03 and Uncached Accelerated CCA 0x07
  108. */
  109. #if defined(CPU_MIPS1004K) || defined(CPU_MIPS1074K) || \
  110. defined(CPU_INTERAPTIV) || defined(CPU_PROAPTIV)
  111. #define MIPS_CCA_CNC 0x03
  112. #define MIPS_CCA_CCE 0x04
  113. #define MIPS_CCA_CCS 0x05
  114. #define MIPS_CCA_UA 0x07
  115. /* We use shared read CCA for CACHED CCA */
  116. #define MIPS_CCA_CACHED MIPS_CCA_CCS
  117. #endif
  118. #if defined(CPU_XBURST)
  119. #define MIPS_CCA_UA 0x01
  120. #define MIPS_CCA_WC MIPS_CCA_UA
  121. #endif
  122. #ifndef MIPS_CCA_UNCACHED
  123. #define MIPS_CCA_UNCACHED MIPS_CCA_UC
  124. #endif
  125. /*
  126. * If we don't know which cached mode to use and there is a cache coherent
  127. * mode, use it. If there is not a cache coherent mode, use the required
  128. * cacheable mode.
  129. */
  130. #ifndef MIPS_CCA_CACHED
  131. #ifdef MIPS_CCA_CC
  132. #define MIPS_CCA_CACHED MIPS_CCA_CC
  133. #else
  134. #define MIPS_CCA_CACHED MIPS_CCA_C
  135. #endif
  136. #endif
  137. #endif