xref: /titanic_41/usr/src/uts/sun4u/sys/opl_module.h (revision 0a05e7057ae5537db2da83492d375e6524599463)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_OPL_MODULE_H
27 #define	_SYS_OPL_MODULE_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/async.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #ifdef _KERNEL
38 
39 /*
40  * Sets trap table entry ttentry by overwriting eight instructions from ttlabel.
41  */
42 #define	OPL_SET_TRAP(ttentry, ttlabel)					\
43 		bcopy((const void *)&ttlabel, &ttentry, 32);		\
44 		flush_instr_mem((caddr_t)&ttentry, 32);
45 
46 /*
47  * The same thing as above, but to patch 7 instructions.
48  */
49 #define	OPL_PATCH_28(ttentry, ttlabel)					\
50 		bcopy((const void *)&ttlabel, &ttentry, 28);		\
51 		flush_instr_mem((caddr_t)&ttentry, 28);
52 
53 /*
54  * Define for max size of "reason" string in panic flows.  Since this is on
55  * the stack, we want to keep it as small as is reasonable.
56  */
57 #define	MAX_REASON_STRING	40
58 
59 /*
60  * These error types are specific to Olympus and are used internally for the
61  * opl fault structure flt_type field.
62  */
63 #define	OPL_CPU_SYNC_UE		1
64 #define	OPL_CPU_SYNC_OTHERS	2
65 #define	OPL_CPU_URGENT		3
66 #define	OPL_CPU_INV_SFSR	4
67 #define	OPL_CPU_INV_UGESR	5
68 
69 #ifndef _ASM
70 
71 /*
72  * Define Olympus family (SPARC64-VI) specific asynchronous error structure
73  */
74 typedef struct olympus_async_flt {
75 	struct async_flt cmn_asyncflt;  /* common - see sun4u/sys/async.h */
76 	ushort_t flt_type;		/* types of faults - cpu specific */
77 	uint64_t flt_bit;		/* fault bit for this log msg */
78 	ushort_t flt_eid_mod;		/* module ID (type of hardware) */
79 	ushort_t flt_eid_sid;		/* source ID */
80 } opl_async_flt_t;
81 
82 /*
83  * Error type table struct.
84  */
85 typedef struct ecc_type_to_info {
86 	uint64_t	ec_afsr_bit;	/* SFSR bit of error */
87 	char		*ec_reason;	/* Short error description */
88 	uint_t		ec_flags;	/* Trap type error should be seen at */
89 	int		ec_flt_type;	/* Used for error logging */
90 	char		*ec_desc;	/* Long error description */
91 	uint64_t	ec_err_payload;	/* FM ereport payload information */
92 	char		*ec_err_class;	/* FM ereport class */
93 } ecc_type_to_info_t;
94 
95 /*
96  * Redefine fault status bit field definitions taken from
97  * "async.h". Reused reserved Ultrasparc3 specific fault status
98  * bits here since they are by definition mutually exclusive
99  * w.r.t. OPL
100  */
101 #define	OPL_ECC_ISYNC_TRAP	0x0100
102 #define	OPL_ECC_DSYNC_TRAP	0x0200
103 #define	OPL_ECC_SYNC_TRAP	(OPL_ECC_ISYNC_TRAP|OPL_ECC_DSYNC_TRAP)
104 #define	OPL_ECC_URGENT_TRAP	0x0400
105 
106 #define	TRAP_TYPE_URGENT	0x40
107 
108 /*
109  * Since all the files share a bunch of routines between each other
110  * we will put all the "extern" definitions in this header file so that we
111  * don't have to repeat it all in every file.
112  */
113 
114 /*
115  * functions that are defined in the OPL,SPARC64-VI cpu module:
116  */
117 extern void shipit(int, int);
118 extern void cpu_page_retire(opl_async_flt_t *opl_flt);
119 extern void cpu_init_trap(void);
120 extern void cpu_error_ecache_flush(void);
121 extern void flush_ecache(uint64_t physaddr, size_t ecachesize, size_t linesize);
122 extern void stick_adj(int64_t skew);
123 extern void stick_timestamp(int64_t *ts);
124 extern void hwblkpagecopy(const void *src, void *dst);
125 extern void opl_error_setup(uint64_t);
126 extern void opl_mpg_enable(void);
127 extern int  cpu_queue_events(opl_async_flt_t *, char *, uint64_t);
128 extern void ras_cntr_reset(void *);
129 
130 /*
131  * variables and structures that are defined outside the FJSV,SPARC64-VI
132  * cpu module:
133  */
134 extern uint64_t xc_tick_limit;
135 extern uint64_t xc_tick_jump_limit;
136 
137 /*
138  * Labels used for the trap_table patching
139  */
140 extern uint32_t tt0_iae;
141 extern uint32_t tt1_iae;
142 extern uint32_t tt0_dae;
143 extern uint32_t tt1_dae;
144 extern uint32_t tt0_asdat;
145 extern uint32_t tt1_asdat;
146 
147 extern uint32_t tt0_flushw;
148 extern uint32_t opl_cleanw_patch;
149 
150 extern void opl_serr_instr(void);
151 extern void opl_ugerr_instr(void);
152 
153 extern void opl_ta3_instr(void);
154 extern void opl_ta4_instr(void);
155 
156 /*
157  * D$ and I$ global parameters.
158  */
159 extern int dcache_size;
160 extern int dcache_linesize;
161 extern int icache_size;
162 extern int icache_linesize;
163 
164 #endif /* _ASM */
165 
166 #endif /* _KERNEL */
167 
168 #ifdef	__cplusplus
169 }
170 #endif
171 
172 #endif	/* _SYS_OPL_MODULE_H */
173