summaryrefslogtreecommitdiffstats
path: root/sys/dev/amr/amrio.h
blob: bc06a863268dbcf66e0371e8b213ee0bad7fe08d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*-
 * Copyright (c) 1999 Michael Smith
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * Copyright (c) 2002 Eric Moore
 * Copyright (c) 2002 LSI Logic Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The party using or redistributing the source code and binary forms
 *    agrees to the disclaimer below and the terms and conditions set forth
 *    herein.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *
 *	$FreeBSD$
 */

/*
 * ioctl interface
 */

#include <sys/ioccom.h>
#include <sys/param.h>

/*
 * Fetch the driver's interface version.
 */
#define AMR_IO_VERSION_NUMBER	153
#define AMR_IO_VERSION	_IOR('A', 0x200, int)

/*
 * Pass a command from userspace through to the adapter.
 *
 * Note that in order to be code-compatible with the Linux
 * interface where possible, the formatting of the au_cmd field is
 * somewhat Interesting.
 *
 * For normal commands, the layout is (fields from struct amr_mailbox_ioctl):
 *
 * 0		mb_command
 * 1		mb_channel
 * 2		mb_param
 * 3		mb_pad[0]
 * 4		mb_drive
 *
 * For SCSI passthrough commands, the layout is:
 *
 * 0		AMR_CMD_PASS	(0x3)
 * 1		reserved, 0
 * 2		cdb length
 * 3		cdb data
 * 3+cdb_len	passthrough control byte (timeout, ars, islogical)
 * 4+cdb_len	reserved, 0
 * 5+cdb_len	channel
 * 6+cdb_len	target
 */

struct amr_user_ioctl {
    unsigned char	au_cmd[32];	/* command text from userspace */
    void		*au_buffer;	/* data buffer in userspace */
    unsigned long	au_length;	/* data buffer size (0 == no data) */
    int			au_direction;	/* data transfer direction */
#define AMR_IO_NODATA	0
#define AMR_IO_READ	1
#define AMR_IO_WRITE	2
    int			au_status;	/* command status returned by adapter */
};

#define AMR_IO_COMMAND	_IOWR('A', 0x201, struct amr_user_ioctl)

#if defined(__amd64__) || defined(__ia64__)

struct amr_user_ioctl32 {
    unsigned char	au_cmd[32];	/* command text from userspace */
    u_int32_t		au_buffer;	/* 32-bit pointer to uspace buf */
    u_int32_t		au_length;	/* length of the uspace buffer */
    int32_t		au_direction;	/* data transfer direction */
    int32_t		au_status;	/* command status returned by adapter */
};

#	define AMR_IO_COMMAND32	_IOWR('A', 0x201, struct amr_user_ioctl32)
#endif
OpenPOWER on IntegriCloud