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