1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_BOFI_H 28*0Sstevel@tonic-gate #define _SYS_BOFI_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate /* 33*0Sstevel@tonic-gate * header file for bus_ops fault injector 34*0Sstevel@tonic-gate */ 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #ifdef __cplusplus 37*0Sstevel@tonic-gate extern "C" { 38*0Sstevel@tonic-gate #endif 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate #include <sys/feature_tests.h> 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate /* 43*0Sstevel@tonic-gate * ioctl command values 44*0Sstevel@tonic-gate */ 45*0Sstevel@tonic-gate #define BOFI_ADD_DEF 0 46*0Sstevel@tonic-gate #define BOFI_DEL_DEF 1 47*0Sstevel@tonic-gate #define BOFI_START 2 48*0Sstevel@tonic-gate #define BOFI_STOP 3 49*0Sstevel@tonic-gate #define BOFI_CHK_STATE 8 50*0Sstevel@tonic-gate #define BOFI_CHK_STATE_W 9 51*0Sstevel@tonic-gate #define BOFI_BROADCAST 10 52*0Sstevel@tonic-gate #define BOFI_CLEAR_ACC_CHK 11 53*0Sstevel@tonic-gate #define BOFI_CLEAR_ERRORS 12 54*0Sstevel@tonic-gate #define BOFI_CLEAR_ERRDEFS 13 55*0Sstevel@tonic-gate #define BOFI_GET_HANDLES 16 56*0Sstevel@tonic-gate #define BOFI_GET_HANDLE_INFO 17 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate #define NAMESIZE 256 59*0Sstevel@tonic-gate #define ERRMSGSIZE 256 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gate struct acc_log_elem { 62*0Sstevel@tonic-gate hrtime_t access_time; /* timestamp */ 63*0Sstevel@tonic-gate uint_t access_type; /* the type of access */ 64*0Sstevel@tonic-gate uint_t _pad; /* pad struct to multiple of 8 bytes for x86 */ 65*0Sstevel@tonic-gate offset_t offset; /* the offset into handle */ 66*0Sstevel@tonic-gate uint64_t value; /* the value being read or written */ 67*0Sstevel@tonic-gate uint32_t size; /* the size (in bytes) of the transaction */ 68*0Sstevel@tonic-gate uint32_t repcount; /* repcount parameter of a ddi_repX routine */ 69*0Sstevel@tonic-gate }; 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate /* Access logging flags */ 72*0Sstevel@tonic-gate #define BOFI_LOG_REPIO 0x1 /* log ddi_repX as multiple accesses */ 73*0Sstevel@tonic-gate #define BOFI_LOG_WRAP 0x2 /* do continuous logging of accesses */ 74*0Sstevel@tonic-gate #define BOFI_LOG_FULL 0x4 /* lets callers know if the log has wrapped */ 75*0Sstevel@tonic-gate #define BOFI_LOG_TIMESTAMP 0x8 /* timestamp each log entry */ 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate struct acc_log { 78*0Sstevel@tonic-gate uint32_t logsize; /* length of the logbase array */ 79*0Sstevel@tonic-gate uint32_t entries; /* number of valid log elements */ 80*0Sstevel@tonic-gate uint_t flags; /* access logging flags */ 81*0Sstevel@tonic-gate uint_t wrapcnt; /* wrap cnt */ 82*0Sstevel@tonic-gate hrtime_t start_time; /* activation time */ 83*0Sstevel@tonic-gate hrtime_t stop_time; /* deactivation time (or time when full) */ 84*0Sstevel@tonic-gate caddr_t logbase; /* pointer to acc_log_elem struct */ 85*0Sstevel@tonic-gate }; 86*0Sstevel@tonic-gate #if defined(_SYSCALL32) 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 89*0Sstevel@tonic-gate #pragma pack(4) 90*0Sstevel@tonic-gate #endif 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate struct acc_log32 { 93*0Sstevel@tonic-gate uint32_t logsize; /* length of the logbase array */ 94*0Sstevel@tonic-gate uint32_t entries; /* number of valid log elements */ 95*0Sstevel@tonic-gate uint_t flags; /* access logging flags */ 96*0Sstevel@tonic-gate uint_t wrapcnt; /* wrap cnt */ 97*0Sstevel@tonic-gate hrtime_t start_time; /* activation time */ 98*0Sstevel@tonic-gate hrtime_t stop_time; /* deactivation time (or time when full) */ 99*0Sstevel@tonic-gate caddr32_t logbase; /* pointer to acc_log_elem struct */ 100*0Sstevel@tonic-gate }; 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 103*0Sstevel@tonic-gate #pragma pack() 104*0Sstevel@tonic-gate #endif 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate struct bofi_errdef { 109*0Sstevel@tonic-gate uint_t namesize; 110*0Sstevel@tonic-gate char name[NAMESIZE]; /* as returned by ddi_get_name() */ 111*0Sstevel@tonic-gate /* pointer to char */ 112*0Sstevel@tonic-gate int instance; /* as returned by ddi_get_instance() */ 113*0Sstevel@tonic-gate int rnumber; /* as used by ddi_regs_map_setup() */ 114*0Sstevel@tonic-gate offset_t offset; /* as used by ddi_regs_map_setup() */ 115*0Sstevel@tonic-gate offset_t len; /* as used by ddi_regs_map_setup() */ 116*0Sstevel@tonic-gate uint_t access_type; 117*0Sstevel@tonic-gate uint_t access_count; 118*0Sstevel@tonic-gate uint_t fail_count; 119*0Sstevel@tonic-gate uint_t acc_chk; 120*0Sstevel@tonic-gate uint_t optype; 121*0Sstevel@tonic-gate uint64_t operand; 122*0Sstevel@tonic-gate struct acc_log log; 123*0Sstevel@tonic-gate uint64_t errdef_handle; /* pointer to void */ 124*0Sstevel@tonic-gate }; 125*0Sstevel@tonic-gate #if defined(_SYSCALL32) 126*0Sstevel@tonic-gate 127*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 128*0Sstevel@tonic-gate #pragma pack(4) 129*0Sstevel@tonic-gate #endif 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate struct bofi_errdef32 { 132*0Sstevel@tonic-gate uint_t namesize; 133*0Sstevel@tonic-gate char name[NAMESIZE]; /* as returned by ddi_get_name() */ 134*0Sstevel@tonic-gate /* pointer to char */ 135*0Sstevel@tonic-gate int instance; /* as returned by ddi_get_instance() */ 136*0Sstevel@tonic-gate int rnumber; /* as used by ddi_regs_map_setup() */ 137*0Sstevel@tonic-gate offset_t offset; /* as used by ddi_regs_map_setup() */ 138*0Sstevel@tonic-gate offset_t len; /* as used by ddi_regs_map_setup() */ 139*0Sstevel@tonic-gate uint_t access_type; 140*0Sstevel@tonic-gate uint_t access_count; 141*0Sstevel@tonic-gate uint_t fail_count; 142*0Sstevel@tonic-gate uint_t acc_chk; 143*0Sstevel@tonic-gate uint_t optype; 144*0Sstevel@tonic-gate uint64_t operand; 145*0Sstevel@tonic-gate struct acc_log32 log; 146*0Sstevel@tonic-gate uint64_t errdef_handle; /* pointer to void */ 147*0Sstevel@tonic-gate }; 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 150*0Sstevel@tonic-gate #pragma pack() 151*0Sstevel@tonic-gate #endif 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate struct bofi_errctl { 156*0Sstevel@tonic-gate uint_t namesize; 157*0Sstevel@tonic-gate char name[NAMESIZE]; /* as returned by ddi_get_name() */ 158*0Sstevel@tonic-gate int instance; /* as returned by ddi_get_instance() */ 159*0Sstevel@tonic-gate }; 160*0Sstevel@tonic-gate 161*0Sstevel@tonic-gate struct bofi_get_handles { 162*0Sstevel@tonic-gate uint_t namesize; 163*0Sstevel@tonic-gate char name[NAMESIZE]; /* as returned by ddi_get_name() */ 164*0Sstevel@tonic-gate int instance; /* as returned by ddi_get_instance() */ 165*0Sstevel@tonic-gate int count; 166*0Sstevel@tonic-gate caddr_t buffer; 167*0Sstevel@tonic-gate }; 168*0Sstevel@tonic-gate #if defined(_SYSCALL32) 169*0Sstevel@tonic-gate struct bofi_get_handles32 { 170*0Sstevel@tonic-gate uint_t namesize; 171*0Sstevel@tonic-gate char name[NAMESIZE]; /* as returned by ddi_get_name() */ 172*0Sstevel@tonic-gate int instance; /* as returned by ddi_get_instance() */ 173*0Sstevel@tonic-gate int count; 174*0Sstevel@tonic-gate caddr32_t buffer; 175*0Sstevel@tonic-gate }; 176*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 177*0Sstevel@tonic-gate 178*0Sstevel@tonic-gate struct handle_info { 179*0Sstevel@tonic-gate int instance; 180*0Sstevel@tonic-gate uint_t access_type; 181*0Sstevel@tonic-gate int rnumber; 182*0Sstevel@tonic-gate int _pad; /* pad to 8 bytes for x86 */ 183*0Sstevel@tonic-gate offset_t len; 184*0Sstevel@tonic-gate offset_t offset; 185*0Sstevel@tonic-gate uint64_t addr_cookie; 186*0Sstevel@tonic-gate }; 187*0Sstevel@tonic-gate 188*0Sstevel@tonic-gate struct bofi_get_hdl_info { 189*0Sstevel@tonic-gate uint_t namesize; 190*0Sstevel@tonic-gate char name[NAMESIZE]; /* as returned by ddi_get_name() */ 191*0Sstevel@tonic-gate int count; /* number of handle_info structures */ 192*0Sstevel@tonic-gate caddr_t hdli; /* pointer to struct handle_info */ 193*0Sstevel@tonic-gate }; 194*0Sstevel@tonic-gate #if defined(_SYSCALL32) 195*0Sstevel@tonic-gate struct bofi_get_hdl_info32 { 196*0Sstevel@tonic-gate uint_t namesize; 197*0Sstevel@tonic-gate char name[NAMESIZE]; /* as returned by ddi_get_name() */ 198*0Sstevel@tonic-gate int count; /* number of handle_info structures */ 199*0Sstevel@tonic-gate caddr32_t hdli; /* pointer to struct handle_info */ 200*0Sstevel@tonic-gate }; 201*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 202*0Sstevel@tonic-gate 203*0Sstevel@tonic-gate /* 204*0Sstevel@tonic-gate * values for optype 205*0Sstevel@tonic-gate */ 206*0Sstevel@tonic-gate #define BOFI_EQUAL 0 207*0Sstevel@tonic-gate #define BOFI_AND 1 208*0Sstevel@tonic-gate #define BOFI_OR 2 209*0Sstevel@tonic-gate #define BOFI_XOR 3 210*0Sstevel@tonic-gate #define BOFI_NO_TRANSFER 4 211*0Sstevel@tonic-gate #define BOFI_DELAY_INTR 5 212*0Sstevel@tonic-gate #define BOFI_LOSE_INTR 6 213*0Sstevel@tonic-gate #define BOFI_EXTRA_INTR 7 214*0Sstevel@tonic-gate #define BOFI_NOP 16 215*0Sstevel@tonic-gate /* 216*0Sstevel@tonic-gate * values for access_type 217*0Sstevel@tonic-gate */ 218*0Sstevel@tonic-gate #define BOFI_PIO_R 1 219*0Sstevel@tonic-gate #define BOFI_PIO_W 2 220*0Sstevel@tonic-gate #define BOFI_PIO_RW (BOFI_PIO_R|BOFI_PIO_W) 221*0Sstevel@tonic-gate #define BOFI_DMA_R 4 222*0Sstevel@tonic-gate #define BOFI_DMA_W 8 223*0Sstevel@tonic-gate #define BOFI_DMA_RW (BOFI_DMA_R|BOFI_DMA_W) 224*0Sstevel@tonic-gate #define BOFI_INTR 64 225*0Sstevel@tonic-gate #define BOFI_LOG 128 226*0Sstevel@tonic-gate 227*0Sstevel@tonic-gate struct bofi_errstate { 228*0Sstevel@tonic-gate hrtime_t fail_time; /* time that count went to zero */ 229*0Sstevel@tonic-gate hrtime_t msg_time; /* time that ddi_report_error was called */ 230*0Sstevel@tonic-gate uint_t access_count; 231*0Sstevel@tonic-gate uint_t fail_count; 232*0Sstevel@tonic-gate uint_t acc_chk; 233*0Sstevel@tonic-gate uint_t errmsg_count; 234*0Sstevel@tonic-gate char buffer[ERRMSGSIZE]; 235*0Sstevel@tonic-gate ddi_fault_impact_t severity; 236*0Sstevel@tonic-gate struct acc_log log; 237*0Sstevel@tonic-gate uint64_t errdef_handle; 238*0Sstevel@tonic-gate }; 239*0Sstevel@tonic-gate #if defined(_SYSCALL32) 240*0Sstevel@tonic-gate 241*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 242*0Sstevel@tonic-gate #pragma pack(4) 243*0Sstevel@tonic-gate #endif 244*0Sstevel@tonic-gate 245*0Sstevel@tonic-gate struct bofi_errstate32 { 246*0Sstevel@tonic-gate hrtime_t fail_time; /* time that count went to zero */ 247*0Sstevel@tonic-gate hrtime_t msg_time; /* time that ddi_report_error was called */ 248*0Sstevel@tonic-gate uint_t access_count; 249*0Sstevel@tonic-gate uint_t fail_count; 250*0Sstevel@tonic-gate uint_t acc_chk; 251*0Sstevel@tonic-gate uint_t errmsg_count; 252*0Sstevel@tonic-gate char buffer[ERRMSGSIZE]; 253*0Sstevel@tonic-gate ddi_fault_impact_t severity; 254*0Sstevel@tonic-gate struct acc_log32 log; 255*0Sstevel@tonic-gate uint64_t errdef_handle; 256*0Sstevel@tonic-gate }; 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 259*0Sstevel@tonic-gate #pragma pack() 260*0Sstevel@tonic-gate #endif 261*0Sstevel@tonic-gate 262*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate #ifdef __cplusplus 265*0Sstevel@tonic-gate } 266*0Sstevel@tonic-gate #endif 267*0Sstevel@tonic-gate 268*0Sstevel@tonic-gate #endif /* _SYS_BOFI_H */ 269