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