xref: /illumos-gate/usr/src/uts/common/io/ufmtest.h (revision c3937c08b16d32677a7dc955a81325f2e7a61b5d)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2019 Joyent, Inc.
14  */
15 
16 #ifndef _UFMTEST_H
17 #define	_UFMTEST_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #ifdef _KERNEL
24 #include <sys/cred.h>
25 #include <sys/dditypes.h>
26 #include <sys/nvpair.h>
27 #include <sys/param.h>
28 #else
29 #include <sys/nvpair.h>
30 #include <sys/param.h>
31 #include <sys/types.h>
32 #endif /* _KERNEL */
33 
34 #define	DDI_UFMTEST_DEV			"/dev/ufmtest"
35 
36 #define	UFMTEST_IOC			('u' << 24) | ('f' << 16) | ('t' << 8)
37 #define	UFMTEST_IOC_SET_FW		(UFMTEST_IOC | 1)
38 #define	UFMTEST_IOC_TOGGLE_FAILS	(UFMTEST_IOC | 2)
39 #define	UFMTEST_IOC_DO_UPDATE		(UFMTEST_IOC | 3)
40 
41 typedef struct ufmtest_ioc_setfw {
42 	size_t	utsw_bufsz;
43 	caddr_t	utsw_buf;
44 } ufmtest_ioc_setfw_t;
45 
46 #ifdef _KERNEL
47 typedef struct ufmtest_ioc_setfw32 {
48 	size32_t	utsw_bufsz;
49 	caddr32_t	utsw_buf;
50 } ufmtest_ioc_setfw32_t;
51 #endif /* _KERNEL */
52 
53 /*
54  * The argument for the UFMTEST_IOC_TOGGLE_FAILS ioctl is a bitfield
55  * indicating which of the UFM entry points we want to simulate a failure on.
56  */
57 typedef enum {
58 	UFMTEST_FAIL_GETCAPS	= 1 << 0,
59 	UFMTEST_FAIL_NIMAGES	= 1 << 1,
60 	UFMTEST_FAIL_FILLIMAGE	= 1 << 2,
61 	UFMTEST_FAIL_FILLSLOT	= 1 << 3
62 } ufmtest_failflags_t;
63 
64 #define	UFMTEST_MAX_FAILFLAGS	(UFMTEST_FAIL_GETCAPS | UFMTEST_FAIL_NIMAGES | \
65 				UFMTEST_FAIL_FILLIMAGE | UFMTEST_FAIL_FILLSLOT)
66 
67 typedef struct ufmtest_ioc_fails {
68 	ufmtest_failflags_t	utfa_flags;
69 } ufmtest_ioc_fails_t;
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif	/* _UFMTEST_H */
76