mbus.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * mbus.h: Various defines for MBUS modules.
  4. *
  5. * Copyright (C) 1995 David S. Miller ([email protected])
  6. */
  7. #ifndef _SPARC_MBUS_H
  8. #define _SPARC_MBUS_H
  9. #include <asm/ross.h> /* HyperSparc stuff */
  10. #include <asm/viking.h> /* Ugh, bug city... */
  11. enum mbus_module {
  12. HyperSparc = 0,
  13. Swift_ok = 4,
  14. Swift_bad_c = 5,
  15. Swift_lots_o_bugs = 6,
  16. Tsunami = 7,
  17. Viking_12 = 8,
  18. Viking_2x = 9,
  19. Viking_30 = 10,
  20. Viking_35 = 11,
  21. Viking_new = 12,
  22. TurboSparc = 13,
  23. SRMMU_INVAL_MOD = 14,
  24. };
  25. extern enum mbus_module srmmu_modtype;
  26. extern unsigned int viking_rev, swift_rev, cypress_rev;
  27. /* HW Mbus module bugs we have to deal with */
  28. #define HWBUG_COPYBACK_BROKEN 0x00000001
  29. #define HWBUG_ASIFLUSH_BROKEN 0x00000002
  30. #define HWBUG_VACFLUSH_BITROT 0x00000004
  31. #define HWBUG_KERN_ACCBROKEN 0x00000008
  32. #define HWBUG_KERN_CBITBROKEN 0x00000010
  33. #define HWBUG_MODIFIED_BITROT 0x00000020
  34. #define HWBUG_PC_BADFAULT_ADDR 0x00000040
  35. #define HWBUG_SUPERSCALAR_BAD 0x00000080
  36. #define HWBUG_PACINIT_BITROT 0x00000100
  37. /* First the module type values. To find out which you have, just load
  38. * the mmu control register from ASI_M_MMUREG alternate address space and
  39. * shift the value right 28 bits.
  40. */
  41. /* IMPL field means the company which produced the chip. */
  42. #define MBUS_VIKING 0x4 /* bleech, Texas Instruments Module */
  43. #define MBUS_LSI 0x3 /* LSI Logics */
  44. #define MBUS_ROSS 0x1 /* Ross is nice */
  45. #define MBUS_FMI 0x0 /* Fujitsu Microelectronics/Swift */
  46. /* Ross Module versions */
  47. #define ROSS_604_REV_CDE 0x0 /* revisions c, d, and e */
  48. #define ROSS_604_REV_F 0x1 /* revision f */
  49. #define ROSS_605 0xf /* revision a, a.1, and a.2 */
  50. #define ROSS_605_REV_B 0xe /* revision b */
  51. /* TI Viking Module versions */
  52. #define VIKING_REV_12 0x1 /* Version 1.2 or SPARCclassic's CPU */
  53. #define VIKING_REV_2 0x2 /* Version 2.1, 2.2, 2.3, and 2.4 */
  54. #define VIKING_REV_30 0x3 /* Version 3.0 */
  55. #define VIKING_REV_35 0x4 /* Version 3.5 */
  56. /* LSI Logics. */
  57. #define LSI_L64815 0x0
  58. /* Fujitsu */
  59. #define FMI_AURORA 0x4 /* MB8690x, a Swift module... */
  60. #define FMI_TURBO 0x5 /* MB86907, a TurboSparc module... */
  61. /* For multiprocessor support we need to be able to obtain the CPU id and
  62. * the MBUS Module id.
  63. */
  64. /* The CPU ID is encoded in the trap base register, 20 bits to the left of
  65. * bit zero, with 2 bits being significant.
  66. */
  67. #define TBR_ID_SHIFT 20
  68. static inline int get_cpuid(void)
  69. {
  70. register int retval;
  71. __asm__ __volatile__("rd %%tbr, %0\n\t"
  72. "srl %0, %1, %0\n\t" :
  73. "=r" (retval) :
  74. "i" (TBR_ID_SHIFT));
  75. return (retval & 3);
  76. }
  77. static inline int get_modid(void)
  78. {
  79. return (get_cpuid() | 0x8);
  80. }
  81. #endif /* !(_SPARC_MBUS_H) */