11772Sjl139090 /* 21772Sjl139090 * CDDL HEADER START 31772Sjl139090 * 41772Sjl139090 * The contents of this file are subject to the terms of the 51772Sjl139090 * Common Development and Distribution License (the "License"). 61772Sjl139090 * You may not use this file except in compliance with the License. 71772Sjl139090 * 81772Sjl139090 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 91772Sjl139090 * or http://www.opensolaris.org/os/licensing. 101772Sjl139090 * See the License for the specific language governing permissions 111772Sjl139090 * and limitations under the License. 121772Sjl139090 * 131772Sjl139090 * When distributing Covered Code, include this CDDL HEADER in each 141772Sjl139090 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 151772Sjl139090 * If applicable, add the following below this CDDL HEADER, with the 161772Sjl139090 * fields enclosed by brackets "[]" replaced with your own identifying 171772Sjl139090 * information: Portions Copyright [yyyy] [name of copyright owner] 181772Sjl139090 * 191772Sjl139090 * CDDL HEADER END 201772Sjl139090 */ 211772Sjl139090 /* 22*8664SJames.Anderson@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 231772Sjl139090 * Use is subject to license terms. 241772Sjl139090 */ 251772Sjl139090 261772Sjl139090 #ifndef _SYS_OPL_MODULE_H 271772Sjl139090 #define _SYS_OPL_MODULE_H 281772Sjl139090 291772Sjl139090 #include <sys/async.h> 301772Sjl139090 311772Sjl139090 #ifdef __cplusplus 321772Sjl139090 extern "C" { 331772Sjl139090 #endif 341772Sjl139090 351772Sjl139090 #ifdef _KERNEL 361772Sjl139090 371772Sjl139090 /* 381772Sjl139090 * Sets trap table entry ttentry by overwriting eight instructions from ttlabel. 391772Sjl139090 */ 401772Sjl139090 #define OPL_SET_TRAP(ttentry, ttlabel) \ 411772Sjl139090 bcopy((const void *)&ttlabel, &ttentry, 32); \ 421772Sjl139090 flush_instr_mem((caddr_t)&ttentry, 32); 431772Sjl139090 441772Sjl139090 /* 455414Smb158278 * The same thing as above, but to patch 7 instructions. 465414Smb158278 */ 475414Smb158278 #define OPL_PATCH_28(ttentry, ttlabel) \ 485414Smb158278 bcopy((const void *)&ttlabel, &ttentry, 28); \ 495414Smb158278 flush_instr_mem((caddr_t)&ttentry, 28); 505414Smb158278 515414Smb158278 /* 521772Sjl139090 * Define for max size of "reason" string in panic flows. Since this is on 531772Sjl139090 * the stack, we want to keep it as small as is reasonable. 541772Sjl139090 */ 551772Sjl139090 #define MAX_REASON_STRING 40 561772Sjl139090 571772Sjl139090 /* 581772Sjl139090 * These error types are specific to Olympus and are used internally for the 591772Sjl139090 * opl fault structure flt_type field. 601772Sjl139090 */ 611772Sjl139090 #define OPL_CPU_SYNC_UE 1 621772Sjl139090 #define OPL_CPU_SYNC_OTHERS 2 631772Sjl139090 #define OPL_CPU_URGENT 3 641772Sjl139090 #define OPL_CPU_INV_SFSR 4 651772Sjl139090 #define OPL_CPU_INV_UGESR 5 661772Sjl139090 671772Sjl139090 #ifndef _ASM 681772Sjl139090 691772Sjl139090 /* 701772Sjl139090 * Define Olympus family (SPARC64-VI) specific asynchronous error structure 711772Sjl139090 */ 721772Sjl139090 typedef struct olympus_async_flt { 731772Sjl139090 struct async_flt cmn_asyncflt; /* common - see sun4u/sys/async.h */ 741772Sjl139090 ushort_t flt_type; /* types of faults - cpu specific */ 751772Sjl139090 uint64_t flt_bit; /* fault bit for this log msg */ 761772Sjl139090 ushort_t flt_eid_mod; /* module ID (type of hardware) */ 771772Sjl139090 ushort_t flt_eid_sid; /* source ID */ 781772Sjl139090 } opl_async_flt_t; 791772Sjl139090 801772Sjl139090 /* 811772Sjl139090 * Error type table struct. 821772Sjl139090 */ 831772Sjl139090 typedef struct ecc_type_to_info { 841772Sjl139090 uint64_t ec_afsr_bit; /* SFSR bit of error */ 851772Sjl139090 char *ec_reason; /* Short error description */ 861772Sjl139090 uint_t ec_flags; /* Trap type error should be seen at */ 871772Sjl139090 int ec_flt_type; /* Used for error logging */ 881772Sjl139090 char *ec_desc; /* Long error description */ 891772Sjl139090 uint64_t ec_err_payload; /* FM ereport payload information */ 901772Sjl139090 char *ec_err_class; /* FM ereport class */ 911772Sjl139090 } ecc_type_to_info_t; 921772Sjl139090 931772Sjl139090 /* 941772Sjl139090 * Redefine fault status bit field definitions taken from 951772Sjl139090 * "async.h". Reused reserved Ultrasparc3 specific fault status 961772Sjl139090 * bits here since they are by definition mutually exclusive 971772Sjl139090 * w.r.t. OPL 981772Sjl139090 */ 991772Sjl139090 #define OPL_ECC_ISYNC_TRAP 0x0100 1001772Sjl139090 #define OPL_ECC_DSYNC_TRAP 0x0200 1011772Sjl139090 #define OPL_ECC_SYNC_TRAP (OPL_ECC_ISYNC_TRAP|OPL_ECC_DSYNC_TRAP) 1021772Sjl139090 #define OPL_ECC_URGENT_TRAP 0x0400 1031772Sjl139090 1041772Sjl139090 #define TRAP_TYPE_URGENT 0x40 1051772Sjl139090 1061772Sjl139090 /* 1071772Sjl139090 * Since all the files share a bunch of routines between each other 1081772Sjl139090 * we will put all the "extern" definitions in this header file so that we 1091772Sjl139090 * don't have to repeat it all in every file. 1101772Sjl139090 */ 1111772Sjl139090 1121772Sjl139090 /* 1131772Sjl139090 * functions that are defined in the OPL,SPARC64-VI cpu module: 1141772Sjl139090 */ 1151772Sjl139090 extern void shipit(int, int); 1161772Sjl139090 extern void cpu_page_retire(opl_async_flt_t *opl_flt); 1171772Sjl139090 extern void cpu_init_trap(void); 1181772Sjl139090 extern void cpu_error_ecache_flush(void); 1191772Sjl139090 extern void flush_ecache(uint64_t physaddr, size_t ecachesize, size_t linesize); 1201772Sjl139090 extern void stick_adj(int64_t skew); 1211772Sjl139090 extern void stick_timestamp(int64_t *ts); 1221772Sjl139090 extern void hwblkpagecopy(const void *src, void *dst); 1231772Sjl139090 extern void opl_error_setup(uint64_t); 1241772Sjl139090 extern int cpu_queue_events(opl_async_flt_t *, char *, uint64_t); 1251772Sjl139090 extern void ras_cntr_reset(void *); 1261772Sjl139090 1271772Sjl139090 /* 1281772Sjl139090 * variables and structures that are defined outside the FJSV,SPARC64-VI 1291772Sjl139090 * cpu module: 1301772Sjl139090 */ 1311772Sjl139090 extern uint64_t xc_tick_limit; 1321772Sjl139090 extern uint64_t xc_tick_jump_limit; 1331772Sjl139090 1341772Sjl139090 /* 1351772Sjl139090 * Labels used for the trap_table patching 1361772Sjl139090 */ 1371772Sjl139090 extern uint32_t tt0_iae; 1381772Sjl139090 extern uint32_t tt1_iae; 1391772Sjl139090 extern uint32_t tt0_dae; 1401772Sjl139090 extern uint32_t tt1_dae; 1411772Sjl139090 extern uint32_t tt0_asdat; 1421772Sjl139090 extern uint32_t tt1_asdat; 1431772Sjl139090 1445414Smb158278 extern uint32_t tt0_flushw; 1455414Smb158278 extern uint32_t opl_cleanw_patch; 1465414Smb158278 1471772Sjl139090 extern void opl_serr_instr(void); 1481772Sjl139090 extern void opl_ugerr_instr(void); 1491772Sjl139090 1505414Smb158278 extern void opl_ta3_instr(void); 1515414Smb158278 extern void opl_ta4_instr(void); 1525414Smb158278 1531772Sjl139090 /* 1541772Sjl139090 * D$ and I$ global parameters. 1551772Sjl139090 */ 1561772Sjl139090 extern int dcache_size; 1571772Sjl139090 extern int dcache_linesize; 1581772Sjl139090 extern int icache_size; 1591772Sjl139090 extern int icache_linesize; 1601772Sjl139090 1611772Sjl139090 #endif /* _ASM */ 1621772Sjl139090 1631772Sjl139090 #endif /* _KERNEL */ 1641772Sjl139090 1651772Sjl139090 #ifdef __cplusplus 1661772Sjl139090 } 1671772Sjl139090 #endif 1681772Sjl139090 1691772Sjl139090 #endif /* _SYS_OPL_MODULE_H */ 170