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