4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * header file for bus_ops fault injector
40 #include <sys/feature_tests.h>
43 * ioctl command values
45 #define BOFI_ADD_DEF 0
46 #define BOFI_DEL_DEF 1
49 #define BOFI_CHK_STATE 8
50 #define BOFI_CHK_STATE_W 9
51 #define BOFI_BROADCAST 10
52 #define BOFI_CLEAR_ACC_CHK 11
53 #define BOFI_CLEAR_ERRORS 12
54 #define BOFI_CLEAR_ERRDEFS 13
55 #define BOFI_GET_HANDLES 16
56 #define BOFI_GET_HANDLE_INFO 17
59 #define ERRMSGSIZE 256
62 hrtime_t access_time
; /* timestamp */
63 uint_t access_type
; /* the type of access */
64 uint_t _pad
; /* pad struct to multiple of 8 bytes for x86 */
65 offset_t offset
; /* the offset into handle */
66 uint64_t value
; /* the value being read or written */
67 uint32_t size
; /* the size (in bytes) of the transaction */
68 uint32_t repcount
; /* repcount parameter of a ddi_repX routine */
71 /* Access logging flags */
72 #define BOFI_LOG_REPIO 0x1 /* log ddi_repX as multiple accesses */
73 #define BOFI_LOG_WRAP 0x2 /* do continuous logging of accesses */
74 #define BOFI_LOG_FULL 0x4 /* lets callers know if the log has wrapped */
75 #define BOFI_LOG_TIMESTAMP 0x8 /* timestamp each log entry */
78 uint32_t logsize
; /* length of the logbase array */
79 uint32_t entries
; /* number of valid log elements */
80 uint_t flags
; /* access logging flags */
81 uint_t wrapcnt
; /* wrap cnt */
82 hrtime_t start_time
; /* activation time */
83 hrtime_t stop_time
; /* deactivation time (or time when full) */
84 caddr_t logbase
; /* pointer to acc_log_elem struct */
86 #if defined(_SYSCALL32)
88 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
93 uint32_t logsize
; /* length of the logbase array */
94 uint32_t entries
; /* number of valid log elements */
95 uint_t flags
; /* access logging flags */
96 uint_t wrapcnt
; /* wrap cnt */
97 hrtime_t start_time
; /* activation time */
98 hrtime_t stop_time
; /* deactivation time (or time when full) */
99 caddr32_t logbase
; /* pointer to acc_log_elem struct */
102 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
106 #endif /* _SYSCALL32 */
110 char name
[NAMESIZE
]; /* as returned by ddi_get_name() */
111 /* pointer to char */
112 int instance
; /* as returned by ddi_get_instance() */
113 int rnumber
; /* as used by ddi_regs_map_setup() */
114 offset_t offset
; /* as used by ddi_regs_map_setup() */
115 offset_t len
; /* as used by ddi_regs_map_setup() */
123 uint64_t errdef_handle
; /* pointer to void */
125 #if defined(_SYSCALL32)
127 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
131 struct bofi_errdef32
{
133 char name
[NAMESIZE
]; /* as returned by ddi_get_name() */
134 /* pointer to char */
135 int instance
; /* as returned by ddi_get_instance() */
136 int rnumber
; /* as used by ddi_regs_map_setup() */
137 offset_t offset
; /* as used by ddi_regs_map_setup() */
138 offset_t len
; /* as used by ddi_regs_map_setup() */
145 struct acc_log32 log
;
146 uint64_t errdef_handle
; /* pointer to void */
149 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
153 #endif /* _SYSCALL32 */
157 char name
[NAMESIZE
]; /* as returned by ddi_get_name() */
158 int instance
; /* as returned by ddi_get_instance() */
161 struct bofi_get_handles
{
163 char name
[NAMESIZE
]; /* as returned by ddi_get_name() */
164 int instance
; /* as returned by ddi_get_instance() */
168 #if defined(_SYSCALL32)
169 struct bofi_get_handles32
{
171 char name
[NAMESIZE
]; /* as returned by ddi_get_name() */
172 int instance
; /* as returned by ddi_get_instance() */
176 #endif /* _SYSCALL32 */
182 int _pad
; /* pad to 8 bytes for x86 */
185 uint64_t addr_cookie
;
188 struct bofi_get_hdl_info
{
190 char name
[NAMESIZE
]; /* as returned by ddi_get_name() */
191 int count
; /* number of handle_info structures */
192 caddr_t hdli
; /* pointer to struct handle_info */
194 #if defined(_SYSCALL32)
195 struct bofi_get_hdl_info32
{
197 char name
[NAMESIZE
]; /* as returned by ddi_get_name() */
198 int count
; /* number of handle_info structures */
199 caddr32_t hdli
; /* pointer to struct handle_info */
201 #endif /* _SYSCALL32 */
210 #define BOFI_NO_TRANSFER 4
211 #define BOFI_DELAY_INTR 5
212 #define BOFI_LOSE_INTR 6
213 #define BOFI_EXTRA_INTR 7
216 * values for access_type
220 #define BOFI_PIO_RW (BOFI_PIO_R|BOFI_PIO_W)
223 #define BOFI_DMA_RW (BOFI_DMA_R|BOFI_DMA_W)
227 struct bofi_errstate
{
228 hrtime_t fail_time
; /* time that count went to zero */
229 hrtime_t msg_time
; /* time that ddi_report_error was called */
234 char buffer
[ERRMSGSIZE
];
235 ddi_fault_impact_t severity
;
237 uint64_t errdef_handle
;
239 #if defined(_SYSCALL32)
241 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
245 struct bofi_errstate32
{
246 hrtime_t fail_time
; /* time that count went to zero */
247 hrtime_t msg_time
; /* time that ddi_report_error was called */
252 char buffer
[ERRMSGSIZE
];
253 ddi_fault_impact_t severity
;
254 struct acc_log32 log
;
255 uint64_t errdef_handle
;
258 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
262 #endif /* _SYSCALL32 */
268 #endif /* _SYS_BOFI_H */