xref: /illumos-gate/usr/src/uts/sun4u/sys/opl_module.h (revision c9d93b53)
125cf1a30Sjl /*
225cf1a30Sjl  * CDDL HEADER START
325cf1a30Sjl  *
425cf1a30Sjl  * The contents of this file are subject to the terms of the
525cf1a30Sjl  * Common Development and Distribution License (the "License").
625cf1a30Sjl  * You may not use this file except in compliance with the License.
725cf1a30Sjl  *
825cf1a30Sjl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
925cf1a30Sjl  * or http://www.opensolaris.org/os/licensing.
1025cf1a30Sjl  * See the License for the specific language governing permissions
1125cf1a30Sjl  * and limitations under the License.
1225cf1a30Sjl  *
1325cf1a30Sjl  * When distributing Covered Code, include this CDDL HEADER in each
1425cf1a30Sjl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1525cf1a30Sjl  * If applicable, add the following below this CDDL HEADER, with the
1625cf1a30Sjl  * fields enclosed by brackets "[]" replaced with your own identifying
1725cf1a30Sjl  * information: Portions Copyright [yyyy] [name of copyright owner]
1825cf1a30Sjl  *
1925cf1a30Sjl  * CDDL HEADER END
2025cf1a30Sjl  */
2125cf1a30Sjl /*
22*c9d93b53SJames Anderson  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
2325cf1a30Sjl  * Use is subject to license terms.
2425cf1a30Sjl  */
2525cf1a30Sjl 
2625cf1a30Sjl #ifndef _SYS_OPL_MODULE_H
2725cf1a30Sjl #define	_SYS_OPL_MODULE_H
2825cf1a30Sjl 
2925cf1a30Sjl #include <sys/async.h>
3025cf1a30Sjl 
3125cf1a30Sjl #ifdef	__cplusplus
3225cf1a30Sjl extern "C" {
3325cf1a30Sjl #endif
3425cf1a30Sjl 
3525cf1a30Sjl #ifdef _KERNEL
3625cf1a30Sjl 
3725cf1a30Sjl /*
3825cf1a30Sjl  * Sets trap table entry ttentry by overwriting eight instructions from ttlabel.
3925cf1a30Sjl  */
4025cf1a30Sjl #define	OPL_SET_TRAP(ttentry, ttlabel)					\
4125cf1a30Sjl 		bcopy((const void *)&ttlabel, &ttentry, 32);		\
4225cf1a30Sjl 		flush_instr_mem((caddr_t)&ttentry, 32);
4325cf1a30Sjl 
4450eff769Smb /*
4550eff769Smb  * The same thing as above, but to patch 7 instructions.
4650eff769Smb  */
4750eff769Smb #define	OPL_PATCH_28(ttentry, ttlabel)					\
4850eff769Smb 		bcopy((const void *)&ttlabel, &ttentry, 28);		\
4950eff769Smb 		flush_instr_mem((caddr_t)&ttentry, 28);
5050eff769Smb 
5125cf1a30Sjl /*
5225cf1a30Sjl  * Define for max size of "reason" string in panic flows.  Since this is on
5325cf1a30Sjl  * the stack, we want to keep it as small as is reasonable.
5425cf1a30Sjl  */
5525cf1a30Sjl #define	MAX_REASON_STRING	40
5625cf1a30Sjl 
5725cf1a30Sjl /*
5825cf1a30Sjl  * These error types are specific to Olympus and are used internally for the
5925cf1a30Sjl  * opl fault structure flt_type field.
6025cf1a30Sjl  */
6125cf1a30Sjl #define	OPL_CPU_SYNC_UE		1
6225cf1a30Sjl #define	OPL_CPU_SYNC_OTHERS	2
6325cf1a30Sjl #define	OPL_CPU_URGENT		3
6425cf1a30Sjl #define	OPL_CPU_INV_SFSR	4
6525cf1a30Sjl #define	OPL_CPU_INV_UGESR	5
6625cf1a30Sjl 
6725cf1a30Sjl #ifndef _ASM
6825cf1a30Sjl 
6925cf1a30Sjl /*
7025cf1a30Sjl  * Define Olympus family (SPARC64-VI) specific asynchronous error structure
7125cf1a30Sjl  */
7225cf1a30Sjl typedef struct olympus_async_flt {
7325cf1a30Sjl 	struct async_flt cmn_asyncflt;  /* common - see sun4u/sys/async.h */
7425cf1a30Sjl 	ushort_t flt_type;		/* types of faults - cpu specific */
7525cf1a30Sjl 	uint64_t flt_bit;		/* fault bit for this log msg */
7625cf1a30Sjl 	ushort_t flt_eid_mod;		/* module ID (type of hardware) */
7725cf1a30Sjl 	ushort_t flt_eid_sid;		/* source ID */
7825cf1a30Sjl } opl_async_flt_t;
7925cf1a30Sjl 
8025cf1a30Sjl /*
8125cf1a30Sjl  * Error type table struct.
8225cf1a30Sjl  */
8325cf1a30Sjl typedef struct ecc_type_to_info {
8425cf1a30Sjl 	uint64_t	ec_afsr_bit;	/* SFSR bit of error */
8525cf1a30Sjl 	char		*ec_reason;	/* Short error description */
8625cf1a30Sjl 	uint_t		ec_flags;	/* Trap type error should be seen at */
8725cf1a30Sjl 	int		ec_flt_type;	/* Used for error logging */
8825cf1a30Sjl 	char		*ec_desc;	/* Long error description */
8925cf1a30Sjl 	uint64_t	ec_err_payload;	/* FM ereport payload information */
9025cf1a30Sjl 	char		*ec_err_class;	/* FM ereport class */
9125cf1a30Sjl } ecc_type_to_info_t;
9225cf1a30Sjl 
9325cf1a30Sjl /*
9425cf1a30Sjl  * Redefine fault status bit field definitions taken from
9525cf1a30Sjl  * "async.h". Reused reserved Ultrasparc3 specific fault status
9625cf1a30Sjl  * bits here since they are by definition mutually exclusive
9725cf1a30Sjl  * w.r.t. OPL
9825cf1a30Sjl  */
9925cf1a30Sjl #define	OPL_ECC_ISYNC_TRAP	0x0100
10025cf1a30Sjl #define	OPL_ECC_DSYNC_TRAP	0x0200
10125cf1a30Sjl #define	OPL_ECC_SYNC_TRAP	(OPL_ECC_ISYNC_TRAP|OPL_ECC_DSYNC_TRAP)
10225cf1a30Sjl #define	OPL_ECC_URGENT_TRAP	0x0400
10325cf1a30Sjl 
10425cf1a30Sjl #define	TRAP_TYPE_URGENT	0x40
10525cf1a30Sjl 
10625cf1a30Sjl /*
10725cf1a30Sjl  * Since all the files share a bunch of routines between each other
10825cf1a30Sjl  * we will put all the "extern" definitions in this header file so that we
10925cf1a30Sjl  * don't have to repeat it all in every file.
11025cf1a30Sjl  */
11125cf1a30Sjl 
11225cf1a30Sjl /*
11325cf1a30Sjl  * functions that are defined in the OPL,SPARC64-VI cpu module:
11425cf1a30Sjl  */
11525cf1a30Sjl extern void shipit(int, int);
11625cf1a30Sjl extern void cpu_page_retire(opl_async_flt_t *opl_flt);
11725cf1a30Sjl extern void cpu_init_trap(void);
11825cf1a30Sjl extern void cpu_error_ecache_flush(void);
11925cf1a30Sjl extern void flush_ecache(uint64_t physaddr, size_t ecachesize, size_t linesize);
12025cf1a30Sjl extern void stick_adj(int64_t skew);
12125cf1a30Sjl extern void stick_timestamp(int64_t *ts);
12225cf1a30Sjl extern void hwblkpagecopy(const void *src, void *dst);
12325cf1a30Sjl extern void opl_error_setup(uint64_t);
12425cf1a30Sjl extern int  cpu_queue_events(opl_async_flt_t *, char *, uint64_t);
12525cf1a30Sjl extern void ras_cntr_reset(void *);
12625cf1a30Sjl 
12725cf1a30Sjl /*
12825cf1a30Sjl  * variables and structures that are defined outside the FJSV,SPARC64-VI
12925cf1a30Sjl  * cpu module:
13025cf1a30Sjl  */
13125cf1a30Sjl extern uint64_t xc_tick_limit;
13225cf1a30Sjl extern uint64_t xc_tick_jump_limit;
13325cf1a30Sjl 
13425cf1a30Sjl /*
13525cf1a30Sjl  * Labels used for the trap_table patching
13625cf1a30Sjl  */
13725cf1a30Sjl extern uint32_t tt0_iae;
13825cf1a30Sjl extern uint32_t tt1_iae;
13925cf1a30Sjl extern uint32_t tt0_dae;
14025cf1a30Sjl extern uint32_t tt1_dae;
14125cf1a30Sjl extern uint32_t tt0_asdat;
14225cf1a30Sjl extern uint32_t tt1_asdat;
14325cf1a30Sjl 
14450eff769Smb extern uint32_t tt0_flushw;
14550eff769Smb extern uint32_t opl_cleanw_patch;
14650eff769Smb 
14725cf1a30Sjl extern void opl_serr_instr(void);
14825cf1a30Sjl extern void opl_ugerr_instr(void);
14925cf1a30Sjl 
15050eff769Smb extern void opl_ta3_instr(void);
15150eff769Smb extern void opl_ta4_instr(void);
15250eff769Smb 
15325cf1a30Sjl /*
15425cf1a30Sjl  * D$ and I$ global parameters.
15525cf1a30Sjl  */
15625cf1a30Sjl extern int dcache_size;
15725cf1a30Sjl extern int dcache_linesize;
15825cf1a30Sjl extern int icache_size;
15925cf1a30Sjl extern int icache_linesize;
16025cf1a30Sjl 
16125cf1a30Sjl #endif /* _ASM */
16225cf1a30Sjl 
16325cf1a30Sjl #endif /* _KERNEL */
16425cf1a30Sjl 
16525cf1a30Sjl #ifdef	__cplusplus
16625cf1a30Sjl }
16725cf1a30Sjl #endif
16825cf1a30Sjl 
16925cf1a30Sjl #endif	/* _SYS_OPL_MODULE_H */
170