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