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