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