amrio.h revision 105419
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 * 3. The party using or redistributing the source code and binary forms 27 * agrees to the above disclaimer and the terms and conditions set forth 28 * herein. 29 * 30 * Additional Copyright (c) 2002 by Eric Moore under same license. 31 * Additional Copyright (c) 2002 LSI Logic Corporation 32 * 33 * $FreeBSD: head/sys/dev/amr/amrio.h 105419 2002-10-18 21:29:14Z emoore $ 34 */ 35 36/* 37 * ioctl interface 38 */ 39 40#include <sys/ioccom.h> 41 42/* 43 * Fetch the driver's interface version. 44 */ 45#define AMR_IO_VERSION_NUMBER 0x01 46#define AMR_IO_VERSION _IOR('A', 0x200, int) 47 48/* 49 * Pass a command from userspace through to the adapter. 50 * 51 * Note that in order to be code-compatible with the Linux 52 * interface where possible, the formatting of the au_cmd field is 53 * somewhat Interesting. 54 * 55 * For normal commands, the layout is (fields from struct amr_mailbox_ioctl): 56 * 57 * 0 mb_command 58 * 1 mb_channel 59 * 2 mb_param 60 * 3 mb_pad[0] 61 * 4 mb_drive 62 * 63 * For SCSI passthrough commands, the layout is: 64 * 65 * 0 AMR_CMD_PASS (0x3) 66 * 1 reserved, 0 67 * 2 cdb length 68 * 3 cdb data 69 * 3+cdb_len passthrough control byte (timeout, ars, islogical) 70 * 4+cdb_len reserved, 0 71 * 5+cdb_len channel 72 * 6+cdb_len target 73 */ 74 75struct amr_user_ioctl { 76 unsigned char au_cmd[32]; /* command text from userspace */ 77 void *au_buffer; /* data buffer in userspace */ 78 unsigned long au_length; /* data buffer size (0 == no data) */ 79 int au_direction; /* data transfer direction */ 80#define AMR_IO_NODATA 0 81#define AMR_IO_READ 1 82#define AMR_IO_WRITE 2 83 int au_status; /* command status returned by adapter */ 84}; 85 86#define AMR_IO_COMMAND _IOWR('A', 0x201, struct amr_user_ioctl) 87 88