Home | History | Annotate | Line # | Download | only in pci
twereg.h revision 1.8
      1  1.8     heas /*	$NetBSD: twereg.h,v 1.8 2004/09/25 08:27:47 heas Exp $	*/
      2  1.1       ad 
      3  1.1       ad /*-
      4  1.1       ad  * Copyright (c) 2000 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) 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: twereg.h,v 1.1 2000/05/24 23:35:23 msmith Exp
     66  1.1       ad  */
     67  1.1       ad 
     68  1.1       ad #ifndef _PCI_TWEREG_H_
     69  1.1       ad #define	_PCI_TWEREG_H_
     70  1.1       ad 
     71  1.1       ad /* Board registers. */
     72  1.1       ad #define	TWE_REG_CTL			0x00
     73  1.1       ad #define	TWE_REG_STS			0x04
     74  1.1       ad #define	TWE_REG_CMD_QUEUE		0x08
     75  1.1       ad #define	TWE_REG_RESP_QUEUE		0x0c
     76  1.1       ad 
     77  1.1       ad /* Control register bit definitions. */
     78  1.1       ad #define	TWE_CTL_CLEAR_HOST_INTR		0x00080000
     79  1.1       ad #define	TWE_CTL_CLEAR_ATTN_INTR		0x00040000
     80  1.1       ad #define	TWE_CTL_MASK_CMD_INTR		0x00020000
     81  1.1       ad #define	TWE_CTL_MASK_RESP_INTR		0x00010000
     82  1.1       ad #define	TWE_CTL_UNMASK_CMD_INTR		0x00008000
     83  1.1       ad #define	TWE_CTL_UNMASK_RESP_INTR	0x00004000
     84  1.1       ad #define	TWE_CTL_CLEAR_ERROR_STS		0x00000200
     85  1.1       ad #define	TWE_CTL_ISSUE_SOFT_RESET	0x00000100
     86  1.1       ad #define	TWE_CTL_ENABLE_INTRS		0x00000080
     87  1.1       ad #define	TWE_CTL_DISABLE_INTRS		0x00000040
     88  1.1       ad #define	TWE_CTL_ISSUE_HOST_INTR		0x00000020
     89  1.6  thorpej #define	TWE_CTL_CLEAR_PARITY_ERROR	0x00800000
     90  1.6  thorpej #define	TWE_CTL_CLEAR_PCI_ABORT		0x00100000
     91  1.1       ad 
     92  1.1       ad /* Status register bit definitions. */
     93  1.1       ad #define	TWE_STS_MAJOR_VERSION_MASK	0xf0000000
     94  1.1       ad #define	TWE_STS_MINOR_VERSION_MASK	0x0f000000
     95  1.1       ad #define	TWE_STS_PCI_PARITY_ERROR	0x00800000
     96  1.1       ad #define	TWE_STS_QUEUE_ERROR		0x00400000
     97  1.1       ad #define	TWE_STS_MICROCONTROLLER_ERROR	0x00200000
     98  1.1       ad #define	TWE_STS_PCI_ABORT		0x00100000
     99  1.1       ad #define	TWE_STS_HOST_INTR		0x00080000
    100  1.1       ad #define	TWE_STS_ATTN_INTR		0x00040000
    101  1.1       ad #define	TWE_STS_CMD_INTR		0x00020000
    102  1.1       ad #define	TWE_STS_RESP_INTR		0x00010000
    103  1.1       ad #define	TWE_STS_CMD_QUEUE_FULL		0x00008000
    104  1.1       ad #define	TWE_STS_RESP_QUEUE_EMPTY	0x00004000
    105  1.1       ad #define	TWE_STS_MICROCONTROLLER_READY	0x00002000
    106  1.1       ad #define	TWE_STS_CMD_QUEUE_EMPTY		0x00001000
    107  1.1       ad 
    108  1.1       ad #define	TWE_STS_ALL_INTRS		0x000f0000
    109  1.1       ad #define	TWE_STS_CLEARABLE_BITS		0x00d00000
    110  1.1       ad #define	TWE_STS_EXPECTED_BITS		0x00002000
    111  1.1       ad #define	TWE_STS_UNEXPECTED_BITS		0x00f80000
    112  1.1       ad 
    113  1.1       ad /* Command packet opcodes. */
    114  1.3       ad #define TWE_OP_NOP			0x00
    115  1.3       ad #define TWE_OP_INIT_CONNECTION		0x01
    116  1.3       ad #define TWE_OP_READ			0x02
    117  1.3       ad #define TWE_OP_WRITE			0x03
    118  1.3       ad #define TWE_OP_READVERIFY		0x04
    119  1.3       ad #define TWE_OP_VERIFY			0x05
    120  1.8     heas #define TWE_OP_PROBE			0x06
    121  1.3       ad #define TWE_OP_ZEROUNIT			0x08
    122  1.3       ad #define TWE_OP_REPLACEUNIT		0x09
    123  1.3       ad #define TWE_OP_HOTSWAP			0x0a
    124  1.3       ad #define TWE_OP_SETATAFEATURE		0x0c
    125  1.3       ad #define TWE_OP_FLUSH			0x0e
    126  1.3       ad #define TWE_OP_ABORT			0x0f
    127  1.3       ad #define TWE_OP_CHECKSTATUS		0x10
    128  1.6  thorpej #define	TWE_OP_ATA_PASSTHROUGH		0x11
    129  1.3       ad #define TWE_OP_GET_PARAM		0x12
    130  1.3       ad #define TWE_OP_SET_PARAM		0x13
    131  1.3       ad #define TWE_OP_CREATEUNIT		0x14
    132  1.3       ad #define TWE_OP_DELETEUNIT		0x15
    133  1.3       ad #define TWE_OP_REBUILDUNIT		0x17
    134  1.3       ad #define TWE_OP_SECTOR_INFO		0x1a
    135  1.3       ad #define TWE_OP_AEN_LISTEN		0x1c
    136  1.3       ad #define TWE_OP_CMD_PACKET		0x1d
    137  1.6  thorpej #define	TWE_OP_CMD_WITH_DATA		0x1f
    138  1.1       ad 
    139  1.1       ad /* Response queue entries.  Masking and shifting yields request ID. */
    140  1.1       ad #define	TWE_RESP_MASK			0x00000ff0
    141  1.1       ad #define	TWE_RESP_SHIFT			4
    142  1.1       ad 
    143  1.1       ad /* Miscellenous constants. */
    144  1.1       ad #define	TWE_ALIGNMENT			512
    145  1.1       ad #define	TWE_MAX_UNITS			16
    146  1.1       ad #define	TWE_INIT_CMD_PACKET_SIZE	0x3
    147  1.1       ad #define	TWE_SG_SIZE			62
    148  1.2       ad #define	TWE_MAX_CMDS			255
    149  1.1       ad #define	TWE_Q_START			0
    150  1.1       ad #define	TWE_UNIT_INFORMATION_TABLE_BASE	0x300
    151  1.1       ad #define	TWE_IOCTL			0x80
    152  1.1       ad #define	TWE_SECTOR_SIZE			512
    153  1.1       ad 
    154  1.1       ad /* Scatter/gather block. */
    155  1.1       ad struct twe_sgb {
    156  1.1       ad 	u_int32_t	tsg_address;
    157  1.1       ad 	u_int32_t	tsg_length;
    158  1.1       ad } __attribute__ ((packed));
    159  1.1       ad 
    160  1.1       ad /*
    161  1.1       ad  * Command block.  This is 512 (really 508) bytes in size, and must be
    162  1.1       ad  * aligned on a 512 byte boundary.
    163  1.1       ad  */
    164  1.1       ad struct twe_cmd {
    165  1.1       ad 	u_int8_t	tc_opcode;	/* high 3 bits is S/G list offset */
    166  1.1       ad 	u_int8_t	tc_size;
    167  1.1       ad 	u_int8_t	tc_cmdid;
    168  1.1       ad 	u_int8_t	tc_unit;	/* high nybble is host ID */
    169  1.1       ad 	u_int8_t	tc_status;
    170  1.1       ad 	u_int8_t	tc_flags;
    171  1.1       ad 	u_int16_t	tc_count;	/* block & param count, msg credits */
    172  1.1       ad 	union {
    173  1.1       ad 		struct {
    174  1.1       ad 			u_int32_t	lba;
    175  1.1       ad 			struct	twe_sgb sgl[TWE_SG_SIZE];
    176  1.1       ad 		} io __attribute__ ((packed));
    177  1.1       ad 		struct {
    178  1.1       ad 			struct	twe_sgb sgl[TWE_SG_SIZE];
    179  1.1       ad 		} param  __attribute__ ((packed));
    180  1.1       ad 		struct {
    181  1.1       ad 			u_int32_t	response_queue_pointer;
    182  1.1       ad 		} init_connection  __attribute__ ((packed));
    183  1.1       ad 	} tc_args __attribute__ ((packed));
    184  1.1       ad 	int32_t		tc_pad;
    185  1.1       ad } __attribute__ ((packed));
    186  1.1       ad 
    187  1.1       ad /* Get/set parameter block. */
    188  1.1       ad struct twe_param {
    189  1.1       ad 	u_int16_t	tp_table_id;
    190  1.1       ad 	u_int8_t	tp_param_id;
    191  1.1       ad 	u_int8_t	tp_param_size;
    192  1.1       ad 	u_int8_t	tp_data[1];
    193  1.3       ad } __attribute__ ((packed));
    194  1.3       ad 
    195  1.3       ad /*
    196  1.3       ad  * From 3ware's documentation:
    197  1.3       ad  *
    198  1.3       ad  *   All parameters maintained by the controller are grouped into related
    199  1.3       ad  *   tables.  Tables are are accessed indirectly via get and set parameter
    200  1.3       ad  *   commands.  To access a specific parameter in a table, the table ID and
    201  1.3       ad  *   parameter index are used to uniquely identify a parameter.  Table
    202  1.3       ad  *   0xffff is the directory table and provides a list of the table IDs and
    203  1.3       ad  *   sizes of all other tables.  Index zero in each table specifies the
    204  1.3       ad  *   entire table, and index one specifies the size of the table.  An entire
    205  1.3       ad  *   table can be read or set by using index zero.
    206  1.3       ad  */
    207  1.3       ad 
    208  1.3       ad #define TWE_PARAM_PARAM_ALL	0
    209  1.3       ad #define TWE_PARAM_PARAM_SIZE	1
    210  1.3       ad 
    211  1.3       ad #define TWE_PARAM_DIRECTORY			0xffff	/* size is 4 * number of tables */
    212  1.3       ad #define TWE_PARAM_DIRECTORY_TABLES		2	/* 16 bits * number of tables */
    213  1.3       ad #define TWE_PARAM_DIRECTORY_SIZES		3	/* 16 bits * number of tables */
    214  1.3       ad 
    215  1.3       ad #define TWE_PARAM_DRIVESUMMARY			0x0002
    216  1.3       ad #define TWE_PARAM_DRIVESUMMARY_Num		2	/* number of physical drives [2] */
    217  1.3       ad #define TWE_PARAM_DRIVESUMMARY_Status		3	/* array giving drive status per aport */
    218  1.3       ad #define TWE_PARAM_DRIVESTATUS_Missing		0x00
    219  1.3       ad #define TWE_PARAM_DRIVESTATUS_NotSupp		0xfe
    220  1.3       ad #define TWE_PARAM_DRIVESTATUS_Present		0xff
    221  1.3       ad 
    222  1.3       ad #define TWE_PARAM_UNITSUMMARY			0x0003
    223  1.3       ad #define TWE_PARAM_UNITSUMMARY_Num		2	/* number of logical units [2] */
    224  1.3       ad #define TWE_PARAM_UNITSUMMARY_Status		3	/* array giving unit status [16] */
    225  1.3       ad #define TWE_PARAM_UNITSTATUS_Online		(1<<0)
    226  1.3       ad #define TWE_PARAM_UNITSTATUS_Complete		(1<<1)
    227  1.3       ad #define TWE_PARAM_UNITSTATUS_MASK		0xfc
    228  1.3       ad #define TWE_PARAM_UNITSTATUS_Normal		0xfc
    229  1.3       ad #define TWE_PARAM_UNITSTATUS_Initialising	0xf4	/* cannot be incomplete */
    230  1.3       ad #define TWE_PARAM_UNITSTATUS_Degraded		0xec
    231  1.3       ad #define TWE_PARAM_UNITSTATUS_Rebuilding		0xdc	/* cannot be incomplete */
    232  1.3       ad #define TWE_PARAM_UNITSTATUS_Verifying		0xcc	/* cannot be incomplete */
    233  1.3       ad #define TWE_PARAM_UNITSTATUS_Corrupt		0xbc	/* cannot be complete */
    234  1.3       ad #define TWE_PARAM_UNITSTATUS_Missing		0x00	/* cannot be complete or online */
    235  1.3       ad 
    236  1.3       ad #define TWE_PARAM_DRIVEINFO			0x0200	/* add drive number 0x00-0x0f XXX docco confused 0x0100 vs 0x0200 */
    237  1.3       ad #define TWE_PARAM_DRIVEINFO_Size		2	/* size in blocks [4] */
    238  1.3       ad #define TWE_PARAM_DRIVEINFO_Model		3	/* drive model string [40] */
    239  1.3       ad #define TWE_PARAM_DRIVEINFO_Serial		4	/* drive serial number [20] */
    240  1.3       ad #define TWE_PARAM_DRIVEINFO_PhysCylNum		5	/* physical geometry [2] */
    241  1.3       ad #define TWE_PARAM_DRIVEINFO_PhysHeadNum		6	/* [2] */
    242  1.7     heas #define TWE_PARAM_DRIVEINFO_PhysSectorNum	7	/* [2] */
    243  1.3       ad #define TWE_PARAM_DRIVEINFO_LogCylNum		8	/* logical geometry [2] */
    244  1.3       ad #define TWE_PARAM_DRIVEINFO_LogHeadNum		9	/* [2] */
    245  1.3       ad #define TWE_PARAM_DRIVEINFO_LogSectorNum	10	/* [2] */
    246  1.3       ad #define TWE_PARAM_DRIVEINFO_UnitNum		11	/* unit number this drive is associated with or 0xff [1] */
    247  1.3       ad #define TWE_PARAM_DRIVEINFO_DriveFlags		12	/* N/A [1] */
    248  1.3       ad 
    249  1.3       ad #define TWE_PARAM_APORTTIMEOUT			0x02c0	/* add (aport_number * 3) to parameter index */
    250  1.3       ad #define TWE_PARAM_APORTTIMEOUT_READ		2	/* read timeouts last 24hrs [2] */
    251  1.3       ad #define TWE_PARAM_APORTTIMEOUT_WRITE		3	/* write timeouts last 24hrs [2] */
    252  1.3       ad #define TWE_PARAM_APORTTIMEOUT_DEGRADE		4	/* degrade threshold [2] */
    253  1.3       ad 
    254  1.3       ad #define TWE_PARAM_UNITINFO			0x0300	/* add unit number 0x00-0x0f */
    255  1.3       ad #define TWE_PARAM_UNITINFO_Number		2	/* unit number [1] */
    256  1.3       ad #define TWE_PARAM_UNITINFO_Status		3	/* unit status [1] */
    257  1.3       ad #define TWE_PARAM_UNITINFO_Capacity		4	/* unit capacity in blocks [4] */
    258  1.3       ad #define TWE_PARAM_UNITINFO_DescriptorSize	5	/* unit descriptor size + 3 bytes [2] */
    259  1.3       ad #define TWE_PARAM_UNITINFO_Descriptor		6	/* unit descriptor, TWE_UnitDescriptor or TWE_Array_Descriptor */
    260  1.3       ad #define TWE_PARAM_UNITINFO_Flags		7	/* unit flags [1] */
    261  1.3       ad #define TWE_PARAM_UNITFLAGS_WCE			(1<<0)
    262  1.3       ad 
    263  1.3       ad #define TWE_PARAM_AEN				0x0401
    264  1.3       ad #define TWE_PARAM_AEN_UnitCode			2	/* (unit number << 8) | AEN code [2] */
    265  1.3       ad #define TWE_AEN_QUEUE_EMPTY			0x00
    266  1.3       ad #define TWE_AEN_SOFT_RESET			0x01
    267  1.3       ad #define TWE_AEN_DEGRADED_MIRROR			0x02	/* reports unit */
    268  1.3       ad #define TWE_AEN_CONTROLLER_ERROR		0x03
    269  1.3       ad #define TWE_AEN_REBUILD_FAIL			0x04	/* reports unit */
    270  1.3       ad #define TWE_AEN_REBUILD_DONE			0x05	/* reports unit */
    271  1.3       ad #define TWE_AEN_INCOMP_UNIT			0x06	/* reports unit */
    272  1.3       ad #define TWE_AEN_INIT_DONE			0x07	/* reports unit */
    273  1.3       ad #define TWE_AEN_UNCLEAN_SHUTDOWN		0x08	/* reports unit */
    274  1.3       ad #define TWE_AEN_APORT_TIMEOUT			0x09	/* reports unit, rate limited to 1 per 2^16 errors */
    275  1.3       ad #define TWE_AEN_DRIVE_ERROR			0x0a	/* reports unit */
    276  1.3       ad #define TWE_AEN_REBUILD_STARTED			0x0b	/* reports unit */
    277  1.3       ad #define TWE_AEN_QUEUE_FULL			0xff
    278  1.3       ad #define TWE_AEN_TABLE_UNDEFINED			0x15
    279  1.3       ad #define TWE_AEN_CODE(x)				((x) & 0xff)
    280  1.3       ad #define TWE_AEN_UNIT(x)				((x) >> 8)
    281  1.3       ad 
    282  1.3       ad #define TWE_PARAM_VERSION			0x0402
    283  1.3       ad #define TWE_PARAM_VERSION_Mon			2	/* monitor version [16] */
    284  1.3       ad #define TWE_PARAM_VERSION_FW			3	/* firmware version [16] */
    285  1.3       ad #define TWE_PARAM_VERSION_BIOS			4	/* BIOSs version [16] */
    286  1.3       ad #define TWE_PARAM_VERSION_PCB			5	/* PCB version [8] */
    287  1.3       ad #define TWE_PARAM_VERSION_ATA			6	/* A-chip version [8] */
    288  1.3       ad #define TWE_PARAM_VERSION_PCI			7	/* P-chip version [8] */
    289  1.3       ad #define TWE_PARAM_VERSION_CtrlModel		8	/* N/A */
    290  1.3       ad #define TWE_PARAM_VERSION_CtrlSerial		9	/* N/A */
    291  1.3       ad #define TWE_PARAM_VERSION_SBufSize		10	/* N/A */
    292  1.3       ad #define TWE_PARAM_VERSION_CompCode		11	/* compatibility code [4] */
    293  1.3       ad 
    294  1.3       ad #define TWE_PARAM_CONTROLLER			0x0403
    295  1.3       ad #define TWE_PARAM_CONTROLLER_DCBSectors		2	/* # sectors reserved for DCB per drive [2] */
    296  1.3       ad #define TWE_PARAM_CONTROLLER_PortCount		3	/* number of drive ports [1] */
    297  1.3       ad 
    298  1.3       ad #define TWE_PARAM_FEATURES			0x404
    299  1.3       ad #define TWE_PARAM_FEATURES_DriverShutdown	2	/* set to 1 if driver supports shutdown notification [1] */
    300  1.3       ad 
    301  1.3       ad struct twe_unit_descriptor {
    302  1.3       ad 	u_int8_t	num_subunits;	/* must be zero */
    303  1.3       ad 	u_int8_t	configuration;
    304  1.3       ad #define TWE_UD_CONFIG_CBOD	0x0c	/* JBOD with DCB, used for mirrors */
    305  1.3       ad #define TWE_UD_CONFIG_SPARE	0x0d	/* same as CBOD, but firmware will use as spare */
    306  1.3       ad #define TWE_UD_CONFIG_SUBUNIT	0x0e	/* drive is a subunit in an array */
    307  1.3       ad #define TWE_UD_CONFIG_JBOD	0x0f	/* plain drive */
    308  1.3       ad 	u_int8_t	phys_drv_num;	/* may be 0xff if port can't be determined at runtime */
    309  1.3       ad 	u_int8_t	log_drv_num;	/* must be zero for configuration == 0x0f */
    310  1.3       ad 	u_int32_t	start_lba;
    311  1.3       ad 	u_int32_t	block_count;	/* actual drive size if configuration == 0x0f, otherwise less DCB size */
    312  1.3       ad } __attribute__ ((packed));
    313  1.3       ad 
    314  1.3       ad struct twe_mirror_descriptor {
    315  1.3       ad 	u_int8_t	flag;			/* must be 0xff */
    316  1.3       ad 	u_int8_t	res1;
    317  1.3       ad 	u_int8_t	mirunit_status[4];	/* bitmap of functional subunits in each mirror */
    318  1.3       ad 	u_int8_t	res2[6];
    319  1.3       ad } __attribute__ ((packed));
    320  1.3       ad 
    321  1.3       ad struct twe_array_descriptor {
    322  1.3       ad 	u_int8_t	num_subunits;	/* number of subunits, or number of mirror units in RAID10 */
    323  1.3       ad 	u_int8_t	configuration;
    324  1.3       ad #define TWE_AD_CONFIG_RAID0	0x00
    325  1.3       ad #define TWE_AD_CONFIG_RAID1	0x01
    326  1.3       ad #define TWE_AD_CONFIG_TwinStor	0x02
    327  1.3       ad #define TWE_AD_CONFIG_RAID5	0x05
    328  1.3       ad #define TWE_AD_CONFIG_RAID10	0x06
    329  1.3       ad 	u_int8_t		stripe_size;
    330  1.3       ad #define TWE_AD_STRIPE_4k	0x03
    331  1.3       ad #define TWE_AD_STRIPE_8k	0x04
    332  1.3       ad #define TWE_AD_STRIPE_16k	0x05
    333  1.3       ad #define TWE_AD_STRIPE_32k	0x06
    334  1.3       ad #define TWE_AD_STRIPE_64k	0x07
    335  1.3       ad 	u_int8_t		log_drv_status;	/* bitmap of functional subunits, or mirror units in RAID10 */
    336  1.3       ad 	u_int32_t		start_lba;
    337  1.3       ad 	u_int32_t		block_count;	/* actual drive size if configuration == 0x0f, otherwise less DCB size */
    338  1.3       ad 	struct twe_unit_descriptor	subunit[1];
    339  1.1       ad } __attribute__ ((packed));
    340  1.1       ad 
    341  1.1       ad #endif	/* !_PCI_TWEREG_H_ */
    342