Deleted Added
full compact
mrsas_ioctl.h (265555) mrsas_ioctl.h (272737)
1/*
2 * Copyright (c) 2014, LSI Corp.
3 * All rights reserved.
4 * Author: Marian Choy
5 * Support: freebsdraid@lsi.com
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name of the <ORGANIZATION> nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 * The views and conclusions contained in the software and documentation
35 * are those of the authors and should not be interpreted as representing
36 * official policies,either expressed or implied, of the FreeBSD Project.
37 *
38 * Send feedback to: <megaraidfbsd@lsi.com>
39 * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035
40 * ATTN: MegaRaid FreeBSD
41 *
42 */
43
44#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2014, LSI Corp.
3 * All rights reserved.
4 * Author: Marian Choy
5 * Support: freebsdraid@lsi.com
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name of the <ORGANIZATION> nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 * The views and conclusions contained in the software and documentation
35 * are those of the authors and should not be interpreted as representing
36 * official policies,either expressed or implied, of the FreeBSD Project.
37 *
38 * Send feedback to: <megaraidfbsd@lsi.com>
39 * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035
40 * ATTN: MegaRaid FreeBSD
41 *
42 */
43
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/sys/dev/mrsas/mrsas_ioctl.h 265555 2014-05-07 16:16:49Z ambrisko $");
45__FBSDID("$FreeBSD: head/sys/dev/mrsas/mrsas_ioctl.h 272737 2014-10-08 09:19:35Z kadesai $");
46
47#ifndef MRSAS_IOCTL_H
48#define MRSAS_IOCTL_H
49
50#ifndef _IOWR
51#include <sys/ioccom.h>
52#endif /* !_IOWR */
53
46
47#ifndef MRSAS_IOCTL_H
48#define MRSAS_IOCTL_H
49
50#ifndef _IOWR
51#include <sys/ioccom.h>
52#endif /* !_IOWR */
53
54#ifdef COMPAT_FREEBSD32
55/* Compilation error FIX */
56#if (__FreeBSD_version <= 900000)
57#include <sys/socket.h>
58#endif
59#include <sys/mount.h>
60#include <compat/freebsd32/freebsd32.h>
61#endif
62
54/*
55 * We need to use the same values as the mfi driver until MegaCli adds
56 * support for this (mrsas) driver:
57 * M is for MegaRAID. (This is typically the vendor or product initial)
58 * 1 arbitrary. (This may be used to segment kinds of commands.
59 * (1-9 status, 10-20 policy, etc.)
60 * struct mrsas_iocpacket (sizeof() this parameter will be used.)
61 * These three values are encoded into a somewhat unique, 32-bit value.
62 */
63
63/*
64 * We need to use the same values as the mfi driver until MegaCli adds
65 * support for this (mrsas) driver:
66 * M is for MegaRAID. (This is typically the vendor or product initial)
67 * 1 arbitrary. (This may be used to segment kinds of commands.
68 * (1-9 status, 10-20 policy, etc.)
69 * struct mrsas_iocpacket (sizeof() this parameter will be used.)
70 * These three values are encoded into a somewhat unique, 32-bit value.
71 */
72
64#define MRSAS_IOC_FIRMWARE_PASS_THROUGH _IOWR('M', 1, struct mrsas_iocpacket)
73#define MRSAS_IOC_FIRMWARE_PASS_THROUGH64 _IOWR('M', 1, struct mrsas_iocpacket)
74#ifdef COMPAT_FREEBSD32
75#define MRSAS_IOC_FIRMWARE_PASS_THROUGH32 _IOWR('M', 1, struct mrsas_iocpacket32)
76#endif
65
66#define MRSAS_IOC_SCAN_BUS _IO('M', 10)
67
77
78#define MRSAS_IOC_SCAN_BUS _IO('M', 10)
79
80#define MRSAS_LINUX_CMD32 0xc1144d01
81
68#define MAX_IOCTL_SGE 16
69#define MFI_FRAME_DIR_READ 0x0010
70#define MFI_CMD_LD_SCSI_IO 0x03
71
72#define INQUIRY_CMD 0x12
73#define INQUIRY_CMDLEN 6
74#define INQUIRY_REPLY_LEN 96
75#define INQUIRY_VENDOR 8 /* Offset in reply data to vendor name */
76#define SCSI_SENSE_BUFFERSIZE 96
77
78#define MEGAMFI_RAW_FRAME_SIZE 128
79
80
81#pragma pack(1)
82struct mrsas_iocpacket {
83 u_int16_t host_no;
84 u_int16_t __pad1;
85 u_int32_t sgl_off;
86 u_int32_t sge_count;
87 u_int32_t sense_off;
88 u_int32_t sense_len;
89 union {
90 u_int8_t raw[MEGAMFI_RAW_FRAME_SIZE];
91 struct mrsas_header hdr;
92 } frame;
93 struct iovec sgl[MAX_IOCTL_SGE];
94};
95#pragma pack()
96
82#define MAX_IOCTL_SGE 16
83#define MFI_FRAME_DIR_READ 0x0010
84#define MFI_CMD_LD_SCSI_IO 0x03
85
86#define INQUIRY_CMD 0x12
87#define INQUIRY_CMDLEN 6
88#define INQUIRY_REPLY_LEN 96
89#define INQUIRY_VENDOR 8 /* Offset in reply data to vendor name */
90#define SCSI_SENSE_BUFFERSIZE 96
91
92#define MEGAMFI_RAW_FRAME_SIZE 128
93
94
95#pragma pack(1)
96struct mrsas_iocpacket {
97 u_int16_t host_no;
98 u_int16_t __pad1;
99 u_int32_t sgl_off;
100 u_int32_t sge_count;
101 u_int32_t sense_off;
102 u_int32_t sense_len;
103 union {
104 u_int8_t raw[MEGAMFI_RAW_FRAME_SIZE];
105 struct mrsas_header hdr;
106 } frame;
107 struct iovec sgl[MAX_IOCTL_SGE];
108};
109#pragma pack()
110
111#ifdef COMPAT_FREEBSD32
112#pragma pack(1)
113struct mrsas_iocpacket32 {
114 u_int16_t host_no;
115 u_int16_t __pad1;
116 u_int32_t sgl_off;
117 u_int32_t sge_count;
118 u_int32_t sense_off;
119 u_int32_t sense_len;
120 union {
121 u_int8_t raw[MEGAMFI_RAW_FRAME_SIZE];
122 struct mrsas_header hdr;
123 } frame;
124 struct iovec32 sgl[MAX_IOCTL_SGE];
125};
126#pragma pack()
127#endif /* COMPAT_FREEBSD32 */
128
97#endif /* MRSAS_IOCTL_H */
129#endif /* MRSAS_IOCTL_H */