Home | History | Annotate | Line # | Download | only in pci
amrreg.h revision 1.3
      1  1.3  bouyer /*	$NetBSD: amrreg.h,v 1.3 2006/07/23 12:01:26 bouyer Exp $	*/
      2  1.1      ad 
      3  1.1      ad /*-
      4  1.2      ad  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
      5  1.1      ad  * All rights reserved.
      6  1.1      ad  *
      7  1.1      ad  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1      ad  * by Andrew Doran.
      9  1.1      ad  *
     10  1.1      ad  * Redistribution and use in source and binary forms, with or without
     11  1.1      ad  * modification, are permitted provided that the following conditions
     12  1.1      ad  * are met:
     13  1.1      ad  * 1. Redistributions of source code must retain the above copyright
     14  1.1      ad  *    notice, this list of conditions and the following disclaimer.
     15  1.1      ad  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1      ad  *    notice, this list of conditions and the following disclaimer in the
     17  1.1      ad  *    documentation and/or other materials provided with the distribution.
     18  1.1      ad  * 3. All advertising materials mentioning features or use of this software
     19  1.1      ad  *    must display the following acknowledgement:
     20  1.1      ad  *        This product includes software developed by the NetBSD
     21  1.1      ad  *        Foundation, Inc. and its contributors.
     22  1.1      ad  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1      ad  *    contributors may be used to endorse or promote products derived
     24  1.1      ad  *    from this software without specific prior written permission.
     25  1.1      ad  *
     26  1.1      ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1      ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1      ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1      ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1      ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1      ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1      ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1      ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1      ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1      ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1      ad  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1      ad  */
     38  1.1      ad 
     39  1.1      ad /*-
     40  1.1      ad  * Copyright (c) 1999,2000 Michael Smith
     41  1.1      ad  * Copyright (c) 2000 BSDi
     42  1.1      ad  * All rights reserved.
     43  1.1      ad  *
     44  1.1      ad  * Redistribution and use in source and binary forms, with or without
     45  1.1      ad  * modification, are permitted provided that the following conditions
     46  1.1      ad  * are met:
     47  1.1      ad  * 1. Redistributions of source code must retain the above copyright
     48  1.1      ad  *    notice, this list of conditions and the following disclaimer.
     49  1.1      ad  * 2. Redistributions in binary form must reproduce the above copyright
     50  1.1      ad  *    notice, this list of conditions and the following disclaimer in the
     51  1.1      ad  *    documentation and/or other materials provided with the distribution.
     52  1.1      ad  *
     53  1.1      ad  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     54  1.1      ad  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     55  1.1      ad  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     56  1.1      ad  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     57  1.1      ad  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     58  1.1      ad  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     59  1.1      ad  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     60  1.1      ad  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     61  1.1      ad  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     62  1.1      ad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     63  1.1      ad  * SUCH DAMAGE.
     64  1.1      ad  *
     65  1.1      ad  * from FreeBSD: amrreg.h,v 1.2 2000/08/30 07:52:40 msmith Exp
     66  1.1      ad  */
     67  1.1      ad 
     68  1.1      ad #ifndef	_PCI_AMRREG_H_
     69  1.1      ad #define	_PCI_AMRREG_H_
     70  1.1      ad 
     71  1.1      ad #ifdef AMR_CRASH_ME
     72  1.1      ad #define	AMR_MAX_CMDS		255		/* ident = 0 not allowed */
     73  1.1      ad #else
     74  1.1      ad #define	AMR_MAX_CMDS		120
     75  1.1      ad #endif
     76  1.1      ad #define	AMR_MAXLD      		40
     77  1.1      ad 
     78  1.1      ad #define	AMR_MAX_CMDS_PU		63
     79  1.1      ad 
     80  1.2      ad #define	AMR_MAX_SEGS		26
     81  1.1      ad #define	AMR_MAX_CHANNEL		3
     82  1.1      ad #define	AMR_MAX_TARGET		15
     83  1.1      ad #define	AMR_MAX_LUN		7
     84  1.1      ad 
     85  1.1      ad #define	AMR_MAX_CDB_LEN		0x0a
     86  1.1      ad #define	AMR_MAX_REQ_SENSE_LEN	0x20
     87  1.1      ad 
     88  1.1      ad #define	AMR_SECTOR_SIZE		512
     89  1.1      ad 
     90  1.1      ad /* Mailbox commands.*/
     91  1.1      ad #define	AMR_CMD_LREAD		0x01
     92  1.1      ad #define	AMR_CMD_LWRITE		0x02
     93  1.1      ad #define	AMR_CMD_PASS		0x03
     94  1.1      ad #define	AMR_CMD_EXT_ENQUIRY	0x04
     95  1.1      ad #define	AMR_CMD_ENQUIRY		0x05
     96  1.1      ad #define	AMR_CMD_FLUSH		0x0a
     97  1.1      ad #define	AMR_CMD_EXT_ENQUIRY2	0x0c
     98  1.1      ad #define	AMR_CMD_GET_MACHINEID	0x36
     99  1.1      ad #define	AMR_CMD_GET_INITIATOR	0x7d	/* returns one byte */
    100  1.1      ad #define	AMR_CMD_CONFIG		0xa1
    101  1.1      ad #define	AMR_CONFIG_PRODUCT_INFO			0x0e
    102  1.1      ad #define	AMR_CONFIG_ENQ3				0x0f
    103  1.1      ad #define	AMR_CONFIG_ENQ3_SOLICITED_NOTIFY	0x01
    104  1.1      ad #define	AMR_CONFIG_ENQ3_SOLICITED_FULL		0x02
    105  1.1      ad #define	AMR_CONFIG_ENQ3_UNSOLICITED		0x03
    106  1.1      ad 
    107  1.1      ad /* Command completion status. */
    108  1.1      ad #define	AMR_STATUS_SUCCESS	0x00
    109  1.1      ad #define	AMR_STATUS_ABORTED	0x02
    110  1.1      ad #define	AMR_STATUS_FAILED	0x80
    111  1.1      ad 
    112  1.1      ad /* Physical/logical drive states. */
    113  1.1      ad #define	AMR_DRV_CURSTATE(x)	((x) & 0x0f)
    114  1.1      ad #define	AMR_DRV_PREVSTATE(x)	(((x) >> 4) & 0x0f)
    115  1.1      ad #define	AMR_DRV_OFFLINE		0x00
    116  1.1      ad #define	AMR_DRV_DEGRADED	0x01
    117  1.1      ad #define	AMR_DRV_OPTIMAL		0x02
    118  1.1      ad #define	AMR_DRV_ONLINE		0x03
    119  1.1      ad #define	AMR_DRV_FAILED		0x04
    120  1.1      ad #define	AMR_DRV_REBUILD		0x05
    121  1.1      ad #define	AMR_DRV_HOTSPARE	0x06
    122  1.1      ad 
    123  1.1      ad /* Logical drive properties. */
    124  1.1      ad #define	AMR_DRV_RAID_MASK	0x0f	/* RAID level 0, 1, 3, 5, etc. */
    125  1.1      ad #define	AMR_DRV_WRITEBACK	0x10	/* write-back enabled */
    126  1.1      ad #define	AMR_DRV_READHEAD	0x20	/* readhead policy enabled */
    127  1.1      ad #define	AMR_DRV_ADAPTIVE	0x40	/* adaptive I/O policy enabled */
    128  1.1      ad 
    129  1.1      ad /* Battery status. */
    130  1.1      ad #define	AMR_BATT_MODULE_MISSING		0x01
    131  1.1      ad #define	AMR_BATT_LOW_VOLTAGE		0x02
    132  1.1      ad #define	AMR_BATT_TEMP_HIGH		0x04
    133  1.1      ad #define	AMR_BATT_PACK_MISSING		0x08
    134  1.1      ad #define	AMR_BATT_CHARGE_MASK		0x30
    135  1.1      ad #define	AMR_BATT_CHARGE_DONE		0x00
    136  1.1      ad #define	AMR_BATT_CHARGE_INPROG		0x10
    137  1.1      ad #define	AMR_BATT_CHARGE_FAIL		0x20
    138  1.1      ad #define	AMR_BATT_CYCLES_EXCEEDED	0x40
    139  1.1      ad 
    140  1.1      ad /*
    141  1.1      ad  * 8LD firmware interface.
    142  1.1      ad  */
    143  1.1      ad 
    144  1.1      ad /* Array constraints. */
    145  1.1      ad #define	AMR_8LD_MAXDRIVES	8
    146  1.1      ad #define	AMR_8LD_MAXCHAN		5
    147  1.1      ad #define	AMR_8LD_MAXTARG		15
    148  1.1      ad #define	AMR_8LD_MAXPHYSDRIVES	(AMR_8LD_MAXCHAN * AMR_8LD_MAXTARG)
    149  1.1      ad 
    150  1.1      ad /* Adapter information. */
    151  1.1      ad struct amr_adapter_info {
    152  1.1      ad 	u_int8_t	aa_maxio;
    153  1.1      ad 	u_int8_t	aa_rebuild_rate;
    154  1.1      ad 	u_int8_t	aa_maxtargchan;
    155  1.1      ad 	u_int8_t	aa_channels;
    156  1.1      ad 	u_int8_t	aa_firmware[4];
    157  1.1      ad 	u_int16_t	aa_flashage;
    158  1.1      ad 	u_int8_t	aa_chipsetvalue;
    159  1.1      ad 	u_int8_t	aa_memorysize;
    160  1.1      ad 	u_int8_t	aa_cacheflush;
    161  1.1      ad 	u_int8_t	aa_bios[4];
    162  1.1      ad 	u_int8_t	aa_boardtype;
    163  1.1      ad 	u_int8_t	aa_scsisensealert;
    164  1.1      ad 	u_int8_t	aa_writeconfigcount;
    165  1.1      ad 	u_int8_t	aa_driveinsertioncount;
    166  1.1      ad 	u_int8_t	aa_inserteddrive;
    167  1.1      ad 	u_int8_t	aa_batterystatus;
    168  1.1      ad 	u_int8_t   	aa_res1;
    169  1.1      ad } __attribute__ ((__packed__));
    170  1.1      ad 
    171  1.1      ad /* Logical drive information. */
    172  1.1      ad struct amr_logdrive_info {
    173  1.1      ad 	u_int8_t	al_numdrives;
    174  1.1      ad 	u_int8_t	al_res1[3];
    175  1.1      ad 	u_int32_t	al_size[AMR_8LD_MAXDRIVES];
    176  1.1      ad 	u_int8_t	al_properties[AMR_8LD_MAXDRIVES];
    177  1.1      ad 	u_int8_t	al_state[AMR_8LD_MAXDRIVES];
    178  1.1      ad } __attribute__ ((__packed__));
    179  1.1      ad 
    180  1.1      ad /* Physical drive information. */
    181  1.1      ad struct amr_physdrive_info {
    182  1.1      ad 	/* Low nybble is current state, high nybble is previous state. */
    183  1.1      ad 	u_int8_t	ap_state[AMR_8LD_MAXPHYSDRIVES];
    184  1.1      ad 	u_int8_t	ap_predictivefailure;
    185  1.1      ad } __attribute__ ((__packed__));
    186  1.1      ad 
    187  1.1      ad /*
    188  1.1      ad  * Enquiry response structure for AMR_CMD_ENQUIRY (e), AMR_CMD_EXT_ENQUIRY (x)
    189  1.1      ad  * and AMR_CMD_EXT_ENQUIRY2 (2).
    190  1.1      ad  */
    191  1.1      ad struct amr_enquiry {
    192  1.1      ad 	struct		amr_adapter_info ae_adapter;		/* e x 2 */
    193  1.1      ad 	struct		amr_logdrive_info ae_ldrv;		/* e x 2 */
    194  1.1      ad 	struct		amr_physdrive_info ae_pdrv;		/* e x 2 */
    195  1.1      ad 	u_int8_t	ae_formatting[AMR_8LD_MAXDRIVES];	/*   x 2 */
    196  1.1      ad 	u_int8_t	res1[AMR_8LD_MAXDRIVES];		/*   x 2 */
    197  1.1      ad 	u_int32_t	ae_extlen;				/*     2 */
    198  1.1      ad 	u_int16_t	ae_subsystem;				/*     2 */
    199  1.1      ad 	u_int16_t	ae_subvendor;				/*     2 */
    200  1.1      ad 	u_int32_t	ae_signature;				/*     2 */
    201  1.1      ad #define	AMR_SIG_431	0xfffe0001
    202  1.1      ad #define	AMR_SIG_438	0xfffd0002
    203  1.1      ad #define	AMR_SIG_762	0xfffc0003
    204  1.1      ad #define	AMR_SIG_T5	0xfffb0004
    205  1.1      ad #define	AMR_SIG_466	0xfffa0005
    206  1.1      ad #define	AMR_SIG_467	0xfff90006
    207  1.1      ad #define	AMR_SIG_T7	0xfff80007
    208  1.1      ad #define	AMR_SIG_490	0xfff70008
    209  1.1      ad 	u_int8_t	res2[844];				/*     2 */
    210  1.1      ad } __attribute__ ((__packed__));
    211  1.1      ad 
    212  1.1      ad /*
    213  1.1      ad  * 40LD firmware interface.
    214  1.1      ad  */
    215  1.1      ad 
    216  1.1      ad /* Array constraints. */
    217  1.1      ad #define	AMR_40LD_MAXDRIVES	40
    218  1.1      ad #define	AMR_40LD_MAXCHAN	16
    219  1.1      ad #define	AMR_40LD_MAXTARG	16
    220  1.1      ad #define	AMR_40LD_MAXPHYSDRIVES	256
    221  1.1      ad 
    222  1.1      ad /* Product information structure. */
    223  1.1      ad struct amr_prodinfo {
    224  1.1      ad 	u_int32_t	ap_size;		/* current size in bytes (not including resvd) */
    225  1.1      ad 	u_int32_t	ap_configsig;		/* default is 0x00282008, indicating 0x28 maximum
    226  1.1      ad 					 * logical drives, 0x20 maximum stripes and 0x08
    227  1.1      ad 					 * maximum spans */
    228  1.1      ad 	u_int8_t	ap_firmware[16];	/* printable identifiers */
    229  1.1      ad 	u_int8_t	ap_bios[16];
    230  1.1      ad 	u_int8_t	ap_product[80];
    231  1.1      ad 	u_int8_t	ap_maxio;		/* maximum number of concurrent commands supported */
    232  1.1      ad 	u_int8_t	ap_nschan;		/* number of SCSI channels present */
    233  1.1      ad 	u_int8_t	ap_fcloops;		/* number of fibre loops present */
    234  1.1      ad 	u_int8_t	ap_memtype;		/* memory type */
    235  1.1      ad 	u_int32_t	ap_signature;
    236  1.1      ad 	u_int16_t	ap_memsize;		/* onboard memory in MB */
    237  1.1      ad 	u_int16_t	ap_subsystem;		/* subsystem identifier */
    238  1.1      ad 	u_int16_t	ap_subvendor;		/* subsystem vendor ID */
    239  1.1      ad 	u_int8_t	ap_numnotifyctr;	/* number of notify counters */
    240  1.1      ad } __attribute__ ((__packed__));
    241  1.1      ad 
    242  1.1      ad /* Notify structure. */
    243  1.1      ad struct amr_notify {
    244  1.1      ad 	u_int32_t	an_globalcounter;	/* change counter */
    245  1.1      ad 
    246  1.1      ad 	u_int8_t	an_paramcounter;	/* parameter change counter */
    247  1.1      ad 	u_int8_t	an_paramid;
    248  1.1      ad #define	AMR_PARAM_REBUILD_RATE		0x01	/* value = new rebuild rate */
    249  1.1      ad #define	AMR_PARAM_FLUSH_INTERVAL	0x02	/* value = new flush interval */
    250  1.1      ad #define	AMR_PARAM_SENSE_ALERT		0x03	/* value = last physical drive with check condition set */
    251  1.1      ad #define	AMR_PARAM_DRIVE_INSERTED	0x04	/* value = last physical drive inserted */
    252  1.1      ad #define	AMR_PARAM_BATTERY_STATUS	0x05	/* value = battery status */
    253  1.1      ad 	u_int16_t	an_paramval;
    254  1.1      ad 
    255  1.1      ad 	u_int8_t	an_writeconfigcounter;	/* write config occurred */
    256  1.1      ad 	u_int8_t	res1[3];
    257  1.1      ad 
    258  1.1      ad 	u_int8_t	an_ldrvopcounter;	/* logical drive operation started/completed */
    259  1.1      ad 	u_int8_t	an_ldrvopid;
    260  1.1      ad 	u_int8_t	an_ldrvopcmd;
    261  1.1      ad #define	AMR_LDRVOP_CHECK	0x01
    262  1.1      ad #define	AMR_LDRVOP_INIT		0x02
    263  1.1      ad #define	AMR_LDRVOP_REBUILD	0x03
    264  1.1      ad 	u_int8_t	an_ldrvopstatus;
    265  1.1      ad #define	AMR_LDRVOP_SUCCESS	0x00
    266  1.1      ad #define	AMR_LDRVOP_FAILED	0x01
    267  1.1      ad #define	AMR_LDRVOP_ABORTED	0x02
    268  1.1      ad #define	AMR_LDRVOP_CORRECTED	0x03
    269  1.1      ad #define	AMR_LDRVOP_STARTED	0x04
    270  1.1      ad 
    271  1.1      ad 	u_int8_t	an_ldrvstatecounter;	/* logical drive state change occurred */
    272  1.1      ad 	u_int8_t	an_ldrvstateid;
    273  1.1      ad 	u_int8_t	an_ldrvstatenew;
    274  1.1      ad 	u_int8_t	an_ldrvstateold;
    275  1.1      ad 
    276  1.1      ad 	u_int8_t	an_pdrvstatecounter;	/* physical drive state change occurred */
    277  1.1      ad 	u_int8_t	an_pdrvstateid;
    278  1.1      ad 	u_int8_t	an_pdrvstatenew;
    279  1.1      ad 	u_int8_t	an_pdrvstateold;
    280  1.1      ad 
    281  1.1      ad 	u_int8_t	an_pdrvfmtcounter;
    282  1.1      ad 	u_int8_t	an_pdrvfmtid;
    283  1.1      ad 	u_int8_t	an_pdrvfmtval;
    284  1.1      ad #define	AMR_FORMAT_START	0x01
    285  1.1      ad #define	AMR_FORMAT_COMPLETE	0x02
    286  1.1      ad 	u_int8_t	res2;
    287  1.1      ad 
    288  1.1      ad 	u_int8_t	an_targxfercounter;	/* scsi xfer rate change */
    289  1.1      ad 	u_int8_t	an_targxferid;
    290  1.1      ad 	u_int8_t	an_targxferval;
    291  1.1      ad 	u_int8_t	res3;
    292  1.1      ad 
    293  1.1      ad 	u_int8_t	an_fcloopidcounter;	/* FC/AL loop ID changed */
    294  1.1      ad 	u_int8_t	an_fcloopidpdrvid;
    295  1.1      ad 	u_int8_t	an_fcloopid0;
    296  1.1      ad 	u_int8_t	an_fcloopid1;
    297  1.1      ad 
    298  1.1      ad 	u_int8_t	an_fcloopstatecounter;	/* FC/AL loop status changed */
    299  1.1      ad 	u_int8_t	an_fcloopstate0;
    300  1.1      ad 	u_int8_t	an_fcloopstate1;
    301  1.1      ad 	u_int8_t	res4;
    302  1.1      ad } __attribute__ ((__packed__));
    303  1.1      ad 
    304  1.1      ad /* Enquiry3 structure. */
    305  1.1      ad struct amr_enquiry3 {
    306  1.1      ad 	u_int32_t	ae_datasize;		/* valid data size in this structure */
    307  1.1      ad 	union {				/* event notify structure */
    308  1.1      ad 	struct amr_notify	n;
    309  1.1      ad 	u_int8_t		pad[0x80];
    310  1.1      ad 	} 		ae_notify;
    311  1.1      ad 	u_int8_t	ae_rebuildrate;		/* current rebuild rate in % */
    312  1.1      ad 	u_int8_t	ae_cacheflush;		/* flush interval in seconds */
    313  1.1      ad 	u_int8_t	ae_sensealert;
    314  1.1      ad 	u_int8_t	ae_driveinsertcount;	/* count of inserted drives */
    315  1.1      ad 	u_int8_t	ae_batterystatus;
    316  1.1      ad 	u_int8_t	ae_numldrives;
    317  1.1      ad 	u_int8_t	ae_reconstate[AMR_40LD_MAXDRIVES / 8];	/* reconstruction state */
    318  1.1      ad 	u_int16_t	ae_opstatus[AMR_40LD_MAXDRIVES / 8];	/* operation status per drive */
    319  1.1      ad 	u_int32_t	ae_drivesize[AMR_40LD_MAXDRIVES];	/* logical drive size */
    320  1.1      ad 	u_int8_t	ae_driveprop[AMR_40LD_MAXDRIVES];	/* logical drive properties */
    321  1.1      ad 	u_int8_t	ae_drivestate[AMR_40LD_MAXDRIVES];	/* physical drive state */
    322  1.3  bouyer 	u_int8_t	ae_pdrivestate[AMR_40LD_MAXPHYSDRIVES]; /* physical drive state */
    323  1.1      ad 	u_int16_t	ae_driveformat[AMR_40LD_MAXPHYSDRIVES];
    324  1.1      ad 	u_int8_t	ae_targxfer[80];			/* physical drive transfer rates */
    325  1.1      ad 
    326  1.1      ad 	u_int8_t	res1[263];		/* pad to 1024 bytes */
    327  1.1      ad } __attribute__ ((__packed__));
    328  1.1      ad 
    329  1.1      ad /*
    330  1.1      ad  * Mailbox and command structures.
    331  1.1      ad  */
    332  1.1      ad 
    333  1.2      ad struct amr_mailbox_cmd {
    334  1.1      ad 	u_int8_t	mb_command;
    335  1.1      ad 	u_int8_t	mb_ident;
    336  1.1      ad 	u_int16_t	mb_blkcount;
    337  1.1      ad 	u_int32_t	mb_lba;
    338  1.1      ad 	u_int32_t	mb_physaddr;
    339  1.1      ad 	u_int8_t	mb_drive;
    340  1.1      ad 	u_int8_t	mb_nsgelem;
    341  1.1      ad 	u_int8_t	res1;
    342  1.1      ad 	u_int8_t	mb_busy;
    343  1.2      ad } __attribute__ ((__packed__));
    344  1.2      ad 
    345  1.2      ad struct amr_mailbox_resp {
    346  1.1      ad 	u_int8_t	mb_nstatus;
    347  1.1      ad 	u_int8_t	mb_status;
    348  1.1      ad 	u_int8_t	mb_completed[46];
    349  1.2      ad }  __attribute__ ((__packed__));
    350  1.2      ad 
    351  1.2      ad struct amr_mailbox {
    352  1.2      ad 	u_int32_t	mb_res1[3];
    353  1.2      ad 	u_int32_t	mb_segment;
    354  1.2      ad 	struct		amr_mailbox_cmd mb_cmd;
    355  1.2      ad 	struct		amr_mailbox_resp mb_resp;
    356  1.1      ad 	u_int8_t	mb_poll;
    357  1.1      ad 	u_int8_t	mb_ack;
    358  1.2      ad 	u_int8_t	res2[62];		/* Pad to 128+16 bytes. */
    359  1.1      ad } __attribute__ ((__packed__));
    360  1.1      ad 
    361  1.1      ad struct amr_mailbox_ioctl {
    362  1.1      ad 	u_int8_t	mb_command;
    363  1.1      ad 	u_int8_t	mb_ident;
    364  1.1      ad 	u_int8_t	mb_channel;
    365  1.1      ad 	u_int8_t	mb_param;
    366  1.1      ad 	u_int8_t	mb_pad[4];
    367  1.1      ad 	u_int32_t	mb_physaddr;
    368  1.1      ad 	u_int8_t	mb_drive;
    369  1.1      ad 	u_int8_t	mb_nsgelem;
    370  1.1      ad 	u_int8_t	res1;
    371  1.1      ad 	u_int8_t	mb_busy;
    372  1.1      ad 	u_int8_t	mb_nstatus;
    373  1.1      ad 	u_int8_t	mb_completed[46];
    374  1.1      ad 	u_int8_t	mb_poll;
    375  1.1      ad 	u_int8_t	mb_ack;
    376  1.1      ad 	u_int8_t	res4[16];
    377  1.1      ad } __attribute__ ((__packed__));
    378  1.1      ad 
    379  1.1      ad struct amr_sgentry {
    380  1.1      ad 	u_int32_t	sge_addr;
    381  1.1      ad 	u_int32_t	sge_count;
    382  1.1      ad } __attribute__ ((__packed__));
    383  1.1      ad 
    384  1.1      ad struct amr_passthrough {
    385  1.1      ad 	u_int8_t	ap_timeout:3;
    386  1.1      ad 	u_int8_t	ap_ars:1;
    387  1.1      ad 	u_int8_t	ap_dummy:3;
    388  1.1      ad 	u_int8_t	ap_islogical:1;
    389  1.1      ad 	u_int8_t	ap_logical_drive_no;
    390  1.1      ad 	u_int8_t	ap_channel;
    391  1.1      ad 	u_int8_t	ap_scsi_id;
    392  1.1      ad 	u_int8_t	ap_queue_tag;
    393  1.1      ad 	u_int8_t	ap_queue_action;
    394  1.1      ad 	u_int8_t	ap_cdb[AMR_MAX_CDB_LEN];
    395  1.1      ad 	u_int8_t	ap_cdb_length;
    396  1.1      ad 	u_int8_t	ap_request_sense_length;
    397  1.1      ad 	u_int8_t	ap_request_sense_area[AMR_MAX_REQ_SENSE_LEN];
    398  1.1      ad 	u_int8_t	ap_no_sg_elements;
    399  1.1      ad 	u_int8_t	ap_scsi_status;
    400  1.1      ad 	u_int32_t	ap_data_transfer_address;
    401  1.1      ad 	u_int32_t	ap_data_transfer_length;
    402  1.1      ad } __attribute__ ((__packed__));
    403  1.1      ad 
    404  1.1      ad /*
    405  1.1      ad  * "Quartz" i960 PCI bridge interface.
    406  1.1      ad  */
    407  1.1      ad 
    408  1.1      ad #define	AMR_QUARTZ_SIG_REG	0xa0
    409  1.1      ad #define	AMR_QUARTZ_SIG0		0xcccc
    410  1.1      ad #define	AMR_QUARTZ_SIG1		0x3344
    411  1.1      ad 
    412  1.1      ad /* Doorbell registers. */
    413  1.1      ad #define	AMR_QREG_IDB		0x20
    414  1.1      ad #define	AMR_QREG_ODB		0x2c
    415  1.1      ad 
    416  1.1      ad #define	AMR_QIDB_SUBMIT		0x00000001	/* mailbox ready for work */
    417  1.1      ad #define	AMR_QIDB_ACK		0x00000002	/* mailbox done */
    418  1.1      ad #define	AMR_QODB_READY		0x10001234	/* work ready to be processed */
    419  1.1      ad 
    420  1.1      ad /*
    421  1.1      ad  * Old-style ("standard") ASIC bridge interface.
    422  1.1      ad  */
    423  1.1      ad 
    424  1.1      ad /* I/O registers. */
    425  1.1      ad #define	AMR_SREG_CMD		0x10	/* Command/ack register (w) */
    426  1.1      ad #define	AMR_SREG_MBOX_BUSY	0x10	/* Mailbox status (r) */
    427  1.1      ad #define	AMR_SREG_TOGL		0x11	/* Interrupt enable */
    428  1.1      ad #define	AMR_SREG_MBOX		0x14	/* Mailbox physical address */
    429  1.1      ad #define	AMR_SREG_MBOX_ENABLE	0x18	/* Atomic mailbox address enable */
    430  1.1      ad #define	AMR_SREG_INTR		0x1a	/* Interrupt status */
    431  1.1      ad 
    432  1.1      ad /* I/O magic numbers. */
    433  1.1      ad #define	AMR_SCMD_POST		0x10	/* in SCMD to initiate action on mailbox */
    434  1.1      ad #define	AMR_SCMD_ACKINTR	0x08	/* in SCMD to ack mailbox retrieved */
    435  1.1      ad #define	AMR_STOGL_ENABLE	0xc0	/* in STOGL */
    436  1.1      ad #define	AMR_SINTR_VALID		0x40	/* in SINTR */
    437  1.1      ad #define	AMR_SMBOX_BUSY_FLAG	0x10	/* in SMBOX_BUSY */
    438  1.1      ad #define	AMR_SMBOX_ENABLE_ADDR	0x00	/* in SMBOX_ENABLE */
    439  1.1      ad 
    440  1.1      ad #endif	/* !_PCI_AMRREG_H_ */
    441