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