xref: /illumos-gate/usr/src/uts/common/sys/scsi/adapters/mfi/mfi_ioctl.h (revision 98f0a994ee13c4f450852a3d01f2e340abe69fb8)
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 2024 Racktop Systems, Inc.
14  */
15 
16 #ifndef	_MFI_IOCTL_H
17 #define	_MFI_IOCTL_H
18 
19 #include <sys/cred.h>
20 #include <sys/file.h>
21 #include <sys/types.h>
22 #include <sys/errno.h>
23 #include <sys/ddi.h>
24 #include <sys/sunddi.h>
25 
26 #include <sys/scsi/adapters/mfi/mfi.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*
33  * Definitions for the MFI ioctl interface as used by lmrc(4D) and mr_sas(4D),
34  * although the latter has as of yet still its own private definitions.
35  * This interface is used by closed-source utilities like storcli and thus
36  * must not be changed.
37  */
38 #define	MFI_IOCTL_DRIVER			0x12341234
39 #define	MFI_IOCTL_FIRMWARE			0x12345678
40 #define	MFI_IOCTL_AEN				0x87654321
41 
42 #define	MFI_DRIVER_IOCTL_COMMON			0xF0010000
43 #define	MFI_DRIVER_IOCTL_DRIVER_VERSION		0xF0010100
44 #define	MFI_DRIVER_IOCTL_PCI_INFORMATION	0xF0010200
45 #define	MFI_DRIVER_IOCTL_MRRAID_STATISTICS	0xF0010300
46 
47 #define	MFI_IOC_SENSE_LEN	32
48 
49 #pragma pack(1)
50 
51 struct mfi_drv_ver {
52 	uint8_t			dv_signature[12];
53 	uint8_t			dv_os_name[16];
54 	uint8_t			dv_os_ver[12];
55 	uint8_t			dv_drv_name[20];
56 	uint8_t			dv_drv_ver[32];
57 	uint8_t			dv_drv_rel_date[20];
58 };
59 
60 struct mfi_pci_info {
61 	uint32_t		pi_bus;
62 	uint8_t			pi_dev;
63 	uint8_t			pi_func;
64 	uint8_t			pi_intr;
65 	uint8_t			pi_rsvd;
66 	uint8_t			pi_header[0x40];
67 	uint8_t			pi_cap[8];
68 	uint8_t			pi_rsvd2[32];
69 };
70 
71 struct mfi_ioctl {
72 	uint16_t		ioc_version;
73 	uint16_t		ioc_controller_id;
74 	uint8_t			ioc_signature[8];
75 	uint32_t		ioc_reserved_1;
76 	uint32_t		ioc_control_code;
77 	uint32_t		ioc_reserved_2[2];
78 	mfi_frame_t		ioc_frame;
79 	mfi_sgl_t		ioc_sgl;
80 	uint8_t			ioc_sense[MFI_IOC_SENSE_LEN];
81 	uint8_t			ioc_data[0];
82 };
83 
84 #pragma pack(0)
85 
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif	/* _MFI_IOCTL_H */
92