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