1 /*- 2 * Copyright (c) 1999 Michael Smith 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * Copyright (c) 2002 Eric Moore 27 * Copyright (c) 2002 LSI Logic Corporation 28 * All rights reserved. 29 * 30 * Redistribution and use in source and binary forms, with or without 31 * modification, are permitted provided that the following conditions 32 * are met: 33 * 1. Redistributions of source code must retain the above copyright 34 * notice, this list of conditions and the following disclaimer. 35 * 2. Redistributions in binary form must reproduce the above copyright 36 * notice, this list of conditions and the following disclaimer in the 37 * documentation and/or other materials provided with the distribution. 38 * 3. The party using or redistributing the source code and binary forms 39 * agrees to the disclaimer below and the terms and conditions set forth 40 * herein. 41 * 42 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 43 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 44 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 45 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 46 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 47 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 52 * SUCH DAMAGE. 53 * 54 * 55 * $FreeBSD: src/sys/dev/amr/amrio.h,v 1.7 2005/12/14 03:26:49 scottl Exp $ 56 */ 57 58 /* 59 * ioctl interface 60 */ 61 62 #include <sys/ioccom.h> 63 #include <sys/param.h> 64 65 /* 66 * Fetch the driver's interface version. 67 */ 68 #define AMR_IO_VERSION_NUMBER 153 69 #define AMR_IO_VERSION _IOR('A', 0x200, int) 70 71 /* 72 * Pass a command from userspace through to the adapter. 73 * 74 * Note that in order to be code-compatible with the Linux 75 * interface where possible, the formatting of the au_cmd field is 76 * somewhat Interesting. 77 * 78 * For normal commands, the layout is (fields from struct amr_mailbox_ioctl): 79 * 80 * 0 mb_command 81 * 1 mb_channel 82 * 2 mb_param 83 * 3 mb_pad[0] 84 * 4 mb_drive 85 * 86 * For SCSI passthrough commands, the layout is: 87 * 88 * 0 AMR_CMD_PASS (0x3) 89 * 1 reserved, 0 90 * 2 cdb length 91 * 3 cdb data 92 * 3+cdb_len passthrough control byte (timeout, ars, islogical) 93 * 4+cdb_len reserved, 0 94 * 5+cdb_len channel 95 * 6+cdb_len target 96 */ 97 98 struct amr_user_ioctl { 99 unsigned char au_cmd[32]; /* command text from userspace */ 100 void *au_buffer; /* data buffer in userspace */ 101 unsigned long au_length; /* data buffer size (0 == no data) */ 102 int au_direction; /* data transfer direction */ 103 #define AMR_IO_NODATA 0 104 #define AMR_IO_READ 1 105 #define AMR_IO_WRITE 2 106 int au_status; /* command status returned by adapter */ 107 }; 108 109 #define AMR_IO_COMMAND _IOWR('A', 0x201, struct amr_user_ioctl) 110 111 #if defined(__x86_64__) 112 113 struct amr_user_ioctl32 { 114 unsigned char au_cmd[32]; /* command text from userspace */ 115 u_int32_t au_buffer; /* 32-bit pointer to uspace buf */ 116 u_int32_t au_length; /* length of the uspace buffer */ 117 int32_t au_direction; /* data transfer direction */ 118 int32_t au_status; /* command status returned by adapter */ 119 }; 120 121 # define AMR_IO_COMMAND32 _IOWR('A', 0x201, struct amr_user_ioctl32) 122 #endif 123