xref: /titanic_50/usr/src/uts/sun4u/sys/opl_module.h (revision af79d7d9cd4d7b7b3b52261fc6f4be7426335485)
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 2009 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 #include <sys/async.h>
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #ifdef _KERNEL
36 
37 /*
38  * Sets trap table entry ttentry by overwriting eight instructions from ttlabel.
39  */
40 #define	OPL_SET_TRAP(ttentry, ttlabel)					\
41 		bcopy((const void *)&ttlabel, &ttentry, 32);		\
42 		flush_instr_mem((caddr_t)&ttentry, 32);
43 
44 /*
45  * The same thing as above, but to patch 7 instructions.
46  */
47 #define	OPL_PATCH_28(ttentry, ttlabel)					\
48 		bcopy((const void *)&ttlabel, &ttentry, 28);		\
49 		flush_instr_mem((caddr_t)&ttentry, 28);
50 
51 /*
52  * Define for max size of "reason" string in panic flows.  Since this is on
53  * the stack, we want to keep it as small as is reasonable.
54  */
55 #define	MAX_REASON_STRING	40
56 
57 /*
58  * These error types are specific to Olympus and are used internally for the
59  * opl fault structure flt_type field.
60  */
61 #define	OPL_CPU_SYNC_UE		1
62 #define	OPL_CPU_SYNC_OTHERS	2
63 #define	OPL_CPU_URGENT		3
64 #define	OPL_CPU_INV_SFSR	4
65 #define	OPL_CPU_INV_UGESR	5
66 
67 #ifndef _ASM
68 
69 /*
70  * Define Olympus family (SPARC64-VI) specific asynchronous error structure
71  */
72 typedef struct olympus_async_flt {
73 	struct async_flt cmn_asyncflt;  /* common - see sun4u/sys/async.h */
74 	ushort_t flt_type;		/* types of faults - cpu specific */
75 	uint64_t flt_bit;		/* fault bit for this log msg */
76 	ushort_t flt_eid_mod;		/* module ID (type of hardware) */
77 	ushort_t flt_eid_sid;		/* source ID */
78 } opl_async_flt_t;
79 
80 /*
81  * Error type table struct.
82  */
83 typedef struct ecc_type_to_info {
84 	uint64_t	ec_afsr_bit;	/* SFSR bit of error */
85 	char		*ec_reason;	/* Short error description */
86 	uint_t		ec_flags;	/* Trap type error should be seen at */
87 	int		ec_flt_type;	/* Used for error logging */
88 	char		*ec_desc;	/* Long error description */
89 	uint64_t	ec_err_payload;	/* FM ereport payload information */
90 	char		*ec_err_class;	/* FM ereport class */
91 } ecc_type_to_info_t;
92 
93 /*
94  * Redefine fault status bit field definitions taken from
95  * "async.h". Reused reserved Ultrasparc3 specific fault status
96  * bits here since they are by definition mutually exclusive
97  * w.r.t. OPL
98  */
99 #define	OPL_ECC_ISYNC_TRAP	0x0100
100 #define	OPL_ECC_DSYNC_TRAP	0x0200
101 #define	OPL_ECC_SYNC_TRAP	(OPL_ECC_ISYNC_TRAP|OPL_ECC_DSYNC_TRAP)
102 #define	OPL_ECC_URGENT_TRAP	0x0400
103 
104 #define	TRAP_TYPE_URGENT	0x40
105 
106 /*
107  * Since all the files share a bunch of routines between each other
108  * we will put all the "extern" definitions in this header file so that we
109  * don't have to repeat it all in every file.
110  */
111 
112 /*
113  * functions that are defined in the OPL,SPARC64-VI cpu module:
114  */
115 extern void shipit(int, int);
116 extern void cpu_page_retire(opl_async_flt_t *opl_flt);
117 extern void cpu_init_trap(void);
118 extern void cpu_error_ecache_flush(void);
119 extern void flush_ecache(uint64_t physaddr, size_t ecachesize, size_t linesize);
120 extern void stick_adj(int64_t skew);
121 extern void stick_timestamp(int64_t *ts);
122 extern void hwblkpagecopy(const void *src, void *dst);
123 extern void opl_error_setup(uint64_t);
124 extern int  cpu_queue_events(opl_async_flt_t *, char *, uint64_t);
125 extern void ras_cntr_reset(void *);
126 
127 /*
128  * variables and structures that are defined outside the FJSV,SPARC64-VI
129  * cpu module:
130  */
131 extern uint64_t xc_tick_limit;
132 extern uint64_t xc_tick_jump_limit;
133 
134 /*
135  * Labels used for the trap_table patching
136  */
137 extern uint32_t tt0_iae;
138 extern uint32_t tt1_iae;
139 extern uint32_t tt0_dae;
140 extern uint32_t tt1_dae;
141 extern uint32_t tt0_asdat;
142 extern uint32_t tt1_asdat;
143 
144 extern uint32_t tt0_flushw;
145 extern uint32_t opl_cleanw_patch;
146 
147 extern void opl_serr_instr(void);
148 extern void opl_ugerr_instr(void);
149 
150 extern void opl_ta3_instr(void);
151 extern void opl_ta4_instr(void);
152 
153 /*
154  * D$ and I$ global parameters.
155  */
156 extern int dcache_size;
157 extern int dcache_linesize;
158 extern int icache_size;
159 extern int icache_linesize;
160 
161 #endif /* _ASM */
162 
163 #endif /* _KERNEL */
164 
165 #ifdef	__cplusplus
166 }
167 #endif
168 
169 #endif	/* _SYS_OPL_MODULE_H */
170