Home | History | Annotate | Line # | Download | only in ic
mlxreg.h revision 1.6.72.1
      1  1.6.72.1   yamt /*	$NetBSD: mlxreg.h,v 1.6.72.1 2008/05/18 12:33:44 yamt Exp $	*/
      2       1.1     ad 
      3       1.1     ad /*-
      4       1.1     ad  * Copyright (c) 2001 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  *
     19       1.1     ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20       1.1     ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21       1.1     ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22       1.1     ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23       1.1     ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24       1.1     ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25       1.1     ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26       1.1     ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27       1.1     ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28       1.1     ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29       1.1     ad  * POSSIBILITY OF SUCH DAMAGE.
     30       1.1     ad  */
     31       1.1     ad 
     32       1.1     ad /*-
     33       1.1     ad  * Copyright (c) 1999 Michael Smith
     34       1.1     ad  * All rights reserved.
     35       1.1     ad  *
     36       1.1     ad  * Redistribution and use in source and binary forms, with or without
     37       1.1     ad  * modification, are permitted provided that the following conditions
     38       1.1     ad  * are met:
     39       1.1     ad  * 1. Redistributions of source code must retain the above copyright
     40       1.1     ad  *    notice, this list of conditions and the following disclaimer.
     41       1.1     ad  * 2. Redistributions in binary form must reproduce the above copyright
     42       1.1     ad  *    notice, this list of conditions and the following disclaimer in the
     43       1.1     ad  *    documentation and/or other materials provided with the distribution.
     44       1.1     ad  *
     45       1.1     ad  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     46       1.1     ad  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     47       1.1     ad  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     48       1.1     ad  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     49       1.1     ad  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     50       1.1     ad  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     51       1.1     ad  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     52       1.1     ad  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     53       1.1     ad  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     54       1.1     ad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     55       1.1     ad  * SUCH DAMAGE.
     56       1.1     ad  *
     57       1.1     ad  * from FreeBSD: mlxreg.h,v 1.5.2.2 2000/04/24 19:40:50 msmith Exp
     58       1.1     ad  */
     59       1.1     ad 
     60       1.1     ad #ifndef _IC_MLXREG_H_
     61       1.1     ad #define	_IC_MLXREG_H_
     62       1.1     ad 
     63       1.1     ad #define	MLX_SECTOR_SIZE		512
     64       1.1     ad 
     65       1.1     ad /*
     66       1.1     ad  * Selected command codes.
     67       1.1     ad  */
     68       1.1     ad #define	MLX_CMD_ENQUIRY_OLD	0x05
     69       1.1     ad #define	MLX_CMD_ENQUIRY		0x53
     70       1.1     ad #define	MLX_CMD_ENQUIRY2	0x1c
     71       1.1     ad #define	MLX_CMD_ENQSYSDRIVE	0x19
     72       1.1     ad #define	MLX_CMD_READSG		0xb6
     73       1.1     ad #define	MLX_CMD_WRITESG		0xb7
     74       1.1     ad #define	MLX_CMD_READSG_OLD	0x82
     75       1.1     ad #define	MLX_CMD_WRITESG_OLD	0x83
     76       1.1     ad #define	MLX_CMD_FLUSH		0x0a
     77       1.1     ad #define	MLX_CMD_LOGOP		0x72
     78       1.1     ad #define	MLX_CMD_REBUILDASYNC	0x16
     79       1.1     ad #define	MLX_CMD_CHECKASYNC	0x1e
     80       1.1     ad #define	MLX_CMD_REBUILDSTAT	0x0c
     81       1.1     ad #define	MLX_CMD_STOPCHANNEL	0x13
     82       1.1     ad #define	MLX_CMD_STARTCHANNEL	0x12
     83       1.1     ad #define	MLX_CMD_READ_CONFIG	0x4e
     84       1.1     ad #define	MLX_CMD_WRITE_CONFIG	0x4f
     85       1.1     ad #define	MLX_CMD_READ_DK_CONFIG	0x4a
     86       1.1     ad #define	MLX_CMD_WRITE_DK_CONFIG	0x4b
     87       1.1     ad #define	MLX_CMD_DIRECT_CDB	0x04
     88       1.1     ad #define	MLX_CMD_DEVICE_STATE	0x50
     89       1.1     ad #define	MLX_CMD_READ_CONFIG2	0x3d
     90       1.1     ad #define	MLX_CMD_WRITE_CONFIG2	0x3c
     91       1.1     ad 
     92       1.1     ad #ifdef _KERNEL
     93       1.1     ad 
     94       1.1     ad /*
     95       1.1     ad  * Status values.
     96       1.1     ad  */
     97       1.1     ad #define	MLX_STATUS_OK		0x0000
     98       1.1     ad #define	MLX_STATUS_RDWROFFLINE	0x0002	/* read/write claims drive is offline */
     99       1.1     ad #define	MLX_STATUS_WEDGED	0xdeaf	/* controller not listening */
    100       1.1     ad #define	MLX_STATUS_LOST		0xdead	/* never came back */
    101       1.3     ad #define	MLX_STATUS_BUSY		0xbabe	/* command is in controller */
    102       1.1     ad 
    103       1.1     ad /*
    104       1.1     ad  * V1 (EISA) interface.
    105       1.1     ad  */
    106       1.1     ad #define	MLX_V1REG_IE			0x09
    107       1.1     ad #define	MLX_V1REG_IDB			0x0d
    108       1.1     ad #define	MLX_V1REG_ODB_EN		0x0e
    109       1.1     ad #define	MLX_V1REG_ODB			0x0f
    110       1.1     ad #define	MLX_V1REG_MAILBOX		0x10
    111       1.1     ad 
    112       1.1     ad #define	MLX_V1_IDB_FULL		0x01	/* mailbox is full */
    113       1.1     ad #define	MLX_V1_IDB_INIT_BUSY	0x02	/* init in progress */
    114       1.1     ad 
    115       1.1     ad #define	MLX_V1_IDB_SACK		0x02	/* acknowledge status read */
    116       1.2     ad #define	MLX_V1_IDB_RESET	0x10	/* reset controller */
    117       1.1     ad 
    118       1.1     ad #define	MLX_V1_ODB_SAVAIL	0x01	/* status is available */
    119       1.2     ad #define	MLX_V1_ODB_RESET	0x02	/* reset controller */
    120       1.1     ad 
    121       1.1     ad #define	MLX_V1_FWERROR_PEND	0x04	/* firmware error pending */
    122       1.1     ad 
    123       1.1     ad /*
    124       1.1     ad  * V2/V3 interface.
    125       1.1     ad  */
    126       1.1     ad #define	MLX_V3REG_MAILBOX		0x00
    127       1.1     ad #define	MLX_V3REG_STATUS_IDENT		0x0d
    128       1.1     ad #define	MLX_V3REG_STATUS		0x0e
    129       1.1     ad #define	MLX_V3REG_IDB			0x40
    130       1.1     ad #define	MLX_V3REG_ODB			0x41
    131       1.1     ad #define	MLX_V3REG_IE			0x43
    132       1.1     ad #define	MLX_V3REG_FWERROR		0x3f
    133       1.1     ad #define	MLX_V3REG_FWERROR_PARAM1	0x00
    134       1.1     ad #define	MLX_V3REG_FWERROR_PARAM2	0x01
    135       1.1     ad 
    136       1.1     ad #define	MLX_V3_IDB_FULL		0x01	/* mailbox is full */
    137       1.1     ad #define	MLX_V3_IDB_INIT_BUSY	0x02	/* init in progress */
    138       1.1     ad 
    139       1.1     ad #define	MLX_V3_IDB_SACK		0x02	/* acknowledge status read */
    140       1.2     ad #define	MLX_V3_IDB_RESET	0x08	/* reset controller */
    141       1.1     ad 
    142       1.1     ad #define	MLX_V3_ODB_SAVAIL	0x01	/* status is available */
    143       1.1     ad 
    144       1.1     ad #define	MLX_V3_FWERROR_PEND	0x04	/* firmware error pending */
    145       1.1     ad 
    146       1.1     ad /*
    147       1.1     ad  * V4 interface.
    148       1.1     ad  */
    149       1.1     ad #define	MLX_V4REG_MAILBOX		0x1000
    150       1.1     ad #define	MLX_V4REG_STATUS_IDENT		0x1018
    151       1.1     ad #define	MLX_V4REG_STATUS		0x101a
    152       1.1     ad #define	MLX_V4REG_IDB			0x0020
    153       1.1     ad #define	MLX_V4REG_ODB			0x002c
    154       1.1     ad #define	MLX_V4REG_IE			0x0034
    155       1.1     ad #define	MLX_V4REG_FWERROR		0x103f
    156       1.1     ad #define	MLX_V4REG_FWERROR_PARAM1	0x1000
    157       1.1     ad #define	MLX_V4REG_FWERROR_PARAM2	0x1001
    158       1.1     ad 
    159       1.1     ad #define	MLX_V4_IDB_FULL		0x01	/* mailbox is full */
    160       1.1     ad #define	MLX_V4_IDB_INIT_BUSY	0x02	/* initialisation in progress */
    161       1.1     ad 
    162       1.1     ad #define	MLX_V4_IDB_HWMBOX_CMD	0x01	/* posted hardware mailbox command */
    163       1.1     ad #define	MLX_V4_IDB_SACK		0x02	/* acknowledge status read */
    164       1.1     ad #define	MLX_V4_IDB_MEMMBOX_CMD	0x10	/* posted memory mailbox command */
    165       1.1     ad 
    166       1.1     ad #define	MLX_V4_ODB_HWSAVAIL	0x01	/* status available for hardware m/b */
    167       1.1     ad #define	MLX_V4_ODB_MEMSAVAIL	0x02	/* status available for memory m/b */
    168       1.1     ad 
    169       1.1     ad #define	MLX_V4_ODB_HWMBOX_ACK	0x01	/* ack status read from hardware m/b */
    170       1.1     ad #define	MLX_V4_ODB_MEMMBOX_ACK	0x02	/* ack status read from memory m/b */
    171       1.1     ad 
    172       1.1     ad #define	MLX_V4_IE_MASK		0xfb	/* message unit interrupt mask */
    173       1.1     ad #define	MLX_V4_IE_DISINT	0x04	/* interrupt disable bit */
    174       1.1     ad 
    175       1.1     ad #define	MLX_V4_FWERROR_PEND	0x04	/* firmware error pending */
    176       1.1     ad 
    177       1.1     ad /*
    178       1.1     ad  * V5 interface.
    179       1.1     ad  */
    180       1.1     ad #define	MLX_V5REG_MAILBOX		0x50
    181       1.1     ad #define	MLX_V5REG_STATUS_IDENT		0x5d
    182       1.1     ad #define	MLX_V5REG_STATUS		0x5e
    183       1.1     ad #define	MLX_V5REG_IDB			0x60
    184       1.1     ad #define	MLX_V5REG_ODB			0x61
    185       1.1     ad #define	MLX_V5REG_IE			0x34
    186       1.1     ad #define	MLX_V5REG_FWERROR		0x63
    187       1.1     ad #define	MLX_V5REG_FWERROR_PARAM1	0x50
    188       1.1     ad #define	MLX_V5REG_FWERROR_PARAM2	0x51
    189       1.1     ad 
    190       1.1     ad #define	MLX_V5_IDB_EMPTY	0x01	/* mailbox is empty */
    191       1.1     ad #define	MLX_V5_IDB_INIT_DONE	0x02	/* initialisation has completed */
    192       1.1     ad 
    193       1.1     ad #define	MLX_V5_IDB_HWMBOX_CMD	0x01	/* posted hardware mailbox command */
    194       1.1     ad #define	MLX_V5_IDB_SACK		0x02	/* acknowledge status read */
    195       1.1     ad #define	MLX_V5_IDB_RESET	0x08	/* reset request */
    196       1.1     ad #define	MLX_V5_IDB_MEMMBOX_CMD	0x10	/* posted memory mailbox command */
    197       1.1     ad 
    198       1.1     ad #define	MLX_V5_ODB_HWSAVAIL	0x01	/* status available for hardware m/b */
    199       1.1     ad #define	MLX_V5_ODB_MEMSAVAIL	0x02	/* status available for memory m/b */
    200       1.1     ad 
    201       1.1     ad #define	MLX_V5_ODB_HWMBOX_ACK	0x01	/* ack status read from hardware m/b */
    202       1.1     ad #define	MLX_V5_ODB_MEMMBOX_ACK	0x02	/* ack status read from memory m/b */
    203       1.1     ad 
    204       1.1     ad #define	MLX_V5_IE_DISINT	0x04	/* interrupt disable bit */
    205       1.1     ad 
    206       1.1     ad #define	MLX_V5_FWERROR_PEND	0x04	/* firmware error pending */
    207       1.1     ad 
    208       1.1     ad #endif /* _KERNEL */
    209       1.1     ad 
    210       1.1     ad /*
    211       1.1     ad  * Scatter-gather list format, type 1, kind 00.
    212       1.1     ad  */
    213       1.1     ad struct mlx_sgentry {
    214       1.1     ad 	u_int32_t	sge_addr;
    215       1.1     ad 	u_int32_t	sge_count;
    216       1.1     ad } __attribute__ ((packed));
    217       1.1     ad 
    218       1.1     ad /*
    219       1.1     ad  * Command result buffers, as placed in system memory by the controller.
    220       1.1     ad  */
    221       1.1     ad struct mlx_enquiry_old {
    222       1.1     ad 	u_int8_t	me_num_sys_drvs;
    223       1.1     ad 	u_int8_t	me_res1[3];
    224       1.1     ad 	u_int32_t	me_drvsize[8];
    225       1.1     ad 	u_int16_t	me_flash_age;
    226       1.1     ad 	u_int8_t	me_status_flags;
    227       1.1     ad 	u_int8_t	me_free_state_change_count;
    228       1.1     ad 	u_int8_t	me_fwminor;
    229       1.1     ad 	u_int8_t	me_fwmajor;
    230       1.1     ad 	u_int8_t	me_rebuild_flag;
    231       1.1     ad 	u_int8_t	me_max_commands;
    232       1.1     ad 	u_int8_t	me_offline_sd_count;
    233       1.1     ad 	u_int8_t	me_res3;
    234       1.1     ad 	u_int8_t	me_critical_sd_count;
    235       1.1     ad 	u_int8_t	me_res4[3];
    236       1.1     ad 	u_int8_t	me_dead_count;
    237       1.1     ad 	u_int8_t	me_res5;
    238       1.1     ad 	u_int8_t	me_rebuild_count;
    239       1.1     ad 	u_int8_t	me_misc_flags;
    240       1.1     ad 	struct  {
    241       1.1     ad 		u_int8_t	dd_targ;
    242       1.1     ad 		u_int8_t	dd_chan;
    243       1.1     ad 	} __attribute__ ((packed)) me_dead[20];
    244       1.1     ad } __attribute__ ((packed));
    245       1.1     ad 
    246       1.1     ad struct mlx_enquiry {
    247       1.1     ad 	u_int8_t	me_num_sys_drvs;
    248       1.1     ad 	u_int8_t	me_res1[3];
    249       1.1     ad 	u_int32_t	me_drvsize[32];
    250       1.1     ad 	u_int16_t	me_flash_age;
    251       1.1     ad 	u_int8_t	me_status_flags;
    252       1.1     ad #define	MLX_ENQ_SFLAG_DEFWRERR	0x01	/* deferred write error indicator */
    253       1.1     ad #define	MLX_ENQ_SFLAG_BATTLOW	0x02	/* battery low */
    254       1.1     ad 	u_int8_t	me_res2;
    255       1.1     ad 	u_int8_t	me_fwminor;
    256       1.1     ad 	u_int8_t	me_fwmajor;
    257       1.1     ad 	u_int8_t	me_rebuild_flag;
    258       1.1     ad 	u_int8_t	me_max_commands;
    259       1.1     ad 	u_int8_t	me_offline_sd_count;
    260       1.1     ad 	u_int8_t	me_res3;
    261       1.1     ad 	u_int16_t	me_event_log_seq_num;
    262       1.1     ad 	u_int8_t	me_critical_sd_count;
    263       1.1     ad 	u_int8_t	me_res4[3];
    264       1.1     ad 	u_int8_t	me_dead_count;
    265       1.1     ad 	u_int8_t	me_res5;
    266       1.1     ad 	u_int8_t	me_rebuild_count;
    267       1.1     ad 	u_int8_t	me_misc_flags;
    268       1.1     ad #define	MLX_ENQ_MISC_BBU	0x08	/* battery backup present */
    269       1.1     ad 	struct {
    270       1.1     ad 		u_int8_t	dd_targ;
    271       1.1     ad 		u_int8_t	dd_chan;
    272       1.1     ad 	} __attribute__ ((packed)) me_dead[20];
    273       1.1     ad } __attribute__ ((packed));
    274       1.1     ad 
    275       1.1     ad struct mlx_enquiry2 {
    276       1.1     ad 	u_int8_t	me_hardware_id[4];
    277       1.1     ad 	u_int8_t	me_firmware_id[4];
    278       1.1     ad 	u_int32_t	me_res1;
    279       1.1     ad 	u_int8_t	me_configured_channels;
    280       1.1     ad 	u_int8_t	me_actual_channels;
    281       1.1     ad 	u_int8_t	me_max_targets;
    282       1.1     ad 	u_int8_t	me_max_tags;
    283       1.1     ad 	u_int8_t	me_max_sys_drives;
    284       1.1     ad 	u_int8_t	me_max_arms;
    285       1.1     ad 	u_int8_t	me_max_spans;
    286       1.1     ad 	u_int8_t	me_res2;
    287       1.1     ad 	u_int32_t	me_res3;
    288       1.1     ad 	u_int32_t	me_mem_size;
    289       1.1     ad 	u_int32_t	me_cache_size;
    290       1.1     ad 	u_int32_t	me_flash_size;
    291       1.1     ad 	u_int32_t	me_nvram_size;
    292       1.1     ad 	u_int16_t	me_mem_type;
    293       1.1     ad 	u_int16_t	me_clock_speed;
    294       1.1     ad 	u_int16_t	me_mem_speed;
    295       1.1     ad 	u_int16_t	me_hardware_speed;
    296       1.1     ad 	u_int8_t	me_res4[12];
    297       1.1     ad 	u_int16_t	me_max_commands;
    298       1.1     ad 	u_int16_t	me_max_sg;
    299       1.1     ad 	u_int16_t	me_max_dp;
    300       1.1     ad 	u_int16_t	me_max_iod;
    301       1.1     ad 	u_int16_t	me_max_comb;
    302       1.1     ad 	u_int8_t	me_latency;
    303       1.1     ad 	u_int8_t	me_res5;
    304       1.1     ad 	u_int8_t	me_scsi_timeout;
    305       1.1     ad 	u_int8_t	me_res6;
    306       1.1     ad 	u_int16_t	me_min_freelines;
    307       1.1     ad 	u_int8_t	me_res7[8];
    308       1.1     ad 	u_int8_t	me_rate_const;
    309       1.1     ad 	u_int8_t	me_res8[11];
    310       1.1     ad 	u_int16_t	me_physblk;
    311       1.1     ad 	u_int16_t	me_logblk;
    312       1.1     ad 	u_int16_t	me_maxblk;
    313       1.1     ad 	u_int16_t	me_blocking_factor;
    314       1.1     ad 	u_int16_t	me_cacheline;
    315       1.1     ad 	u_int8_t	me_scsi_cap;
    316       1.1     ad 	u_int8_t	me_res9[5];
    317       1.1     ad 	u_int16_t	me_firmware_build;
    318       1.1     ad 	u_int8_t	me_fault_mgmt_type;
    319       1.1     ad 	u_int8_t	me_res10;
    320       1.1     ad 	u_int32_t	me_firmware_features;
    321       1.1     ad 	u_int8_t	me_res11[8];
    322       1.1     ad } __attribute__ ((packed));
    323       1.1     ad 
    324       1.1     ad /* MLX_CMD_ENQSYSDRIVE returns an array of 32 of these. */
    325       1.1     ad struct mlx_enq_sys_drive {
    326       1.1     ad 	u_int32_t	sd_size;
    327       1.1     ad 	u_int8_t	sd_state;
    328       1.1     ad 	u_int8_t	sd_raidlevel;
    329       1.1     ad 	u_int16_t	sd_res1;
    330       1.1     ad } __attribute__ ((packed));
    331       1.1     ad 
    332       1.1     ad /*
    333       1.1     ad  * MLX_CMD_LOGOP/MLX_LOGOP_GET
    334       1.1     ad  *
    335       1.1     ad  * Bitfields:
    336       1.1     ad  *
    337       1.1     ad  * 0-4	el_target	SCSI target
    338       1.1     ad  * 5-7  el_target	SCSI channel
    339       1.1     ad  * 0-6	el_errorcode	error code
    340       1.1     ad  * 7-7	el_errorcode	validity (?)
    341       1.1     ad  * 0-3	el_sense	sense key
    342       1.1     ad  * 4-4	el_sense	reserved
    343       1.1     ad  * 5-5	el_sense	ILI
    344       1.1     ad  * 6-6	el_sense	EOM
    345       1.1     ad  * 7-7	el_sense	filemark
    346       1.1     ad  */
    347       1.1     ad struct mlx_eventlog_entry {
    348       1.1     ad 	u_int8_t	el_type;
    349       1.1     ad 	u_int8_t	el_length;
    350       1.1     ad 	u_int8_t	el_target;
    351       1.1     ad 	u_int8_t	el_lun;
    352       1.1     ad 	u_int16_t	el_seqno;
    353       1.1     ad 	u_int8_t	el_errorcode;
    354       1.1     ad 	u_int8_t	el_segment;
    355       1.1     ad 	u_int8_t	el_sense;
    356       1.1     ad 	u_int8_t	el_information[4];
    357       1.1     ad 	u_int8_t	el_addsense;
    358       1.1     ad 	u_int8_t	el_csi[4];
    359       1.1     ad 	u_int8_t	el_asc;
    360       1.1     ad 	u_int8_t	el_asq;
    361       1.1     ad 	u_int8_t	el_res3[12];
    362       1.1     ad } __attribute__ ((packed));
    363       1.1     ad 
    364       1.1     ad #define	MLX_LOGOP_GET		0x00	/* operation codes for MLX_CMD_LOGOP */
    365       1.1     ad #define	MLX_LOGMSG_SENSE	0x00	/* log message contents codes */
    366       1.1     ad 
    367       1.1     ad struct mlx_rebuild_stat {
    368       1.1     ad 	u_int32_t	rb_drive;
    369       1.1     ad 	u_int32_t	rb_size;
    370       1.1     ad 	u_int32_t	rb_remaining;
    371       1.1     ad } __attribute__ ((packed));
    372       1.1     ad 
    373       1.1     ad struct mlx_config {
    374       1.1     ad 	u_int16_t	cf_flags1;
    375       1.1     ad #define	MLX_CF2_ACTV_NEG	0x0002
    376       1.1     ad #define	MLX_CF2_NORSTRTRY	0x0080
    377       1.1     ad #define	MLX_CF2_STRGWRK		0x0100
    378       1.1     ad #define	MLX_CF2_HPSUPP		0x0200
    379       1.1     ad #define	MLX_CF2_NODISCN		0x0400
    380       1.1     ad #define	MLX_CF2_ARM		0x2000
    381       1.1     ad #define	MLX_CF2_OFM		0x8000
    382       1.1     ad #define	MLX_CF2_AEMI		(MLX_CF2_ARM | MLX_CF2_OFM)
    383       1.1     ad 	u_int8_t	cf_oemid;
    384       1.1     ad 	u_int8_t	cf_oem_model;
    385       1.1     ad 	u_int8_t	cf_physical_sector;
    386       1.1     ad 	u_int8_t	cf_logical_sector;
    387       1.1     ad 	u_int8_t	cf_blockfactor;
    388       1.1     ad 	u_int8_t	cf_flags2;
    389       1.1     ad #define	MLX_CF2_READAH		0x01
    390       1.1     ad #define	MLX_CF2_BIOSDLY		0x02
    391       1.1     ad #define	MLX_CF2_REASS1S		0x10
    392       1.1     ad #define	MLX_CF2_FUAENABL	0x40
    393       1.1     ad #define	MLX_CF2_R5ALLS		0x80
    394       1.1     ad 	u_int8_t	cf_rcrate;
    395       1.1     ad 	u_int8_t	cf_res1;
    396       1.1     ad 	u_int8_t	cf_blocks_per_cache_line;
    397       1.1     ad 	u_int8_t	cf_blocks_per_stripe;
    398       1.1     ad 	u_int8_t	cf_scsi_param_0;
    399       1.1     ad 	u_int8_t	cf_scsi_param_1;
    400       1.1     ad 	u_int8_t	cf_scsi_param_2;
    401       1.1     ad 	u_int8_t	cf_scsi_param_3;
    402       1.1     ad 	u_int8_t	cf_scsi_param_4;
    403       1.1     ad 	u_int8_t	cf_scsi_param_5;
    404       1.5  perry 	u_int8_t	cf_scsi_initiator_id;
    405       1.1     ad 	u_int8_t	cf_res2;
    406       1.1     ad 	u_int8_t	cf_startup_mode;
    407       1.1     ad 	u_int8_t	cf_simultaneous_spinup_devices;
    408       1.1     ad 	u_int8_t	cf_delay_between_spinups;
    409       1.1     ad 	u_int8_t	cf_res3;
    410       1.1     ad 	u_int16_t	cf_checksum;
    411       1.1     ad } __attribute__ ((packed));
    412       1.1     ad 
    413       1.1     ad struct mlx_config2 {
    414       1.1     ad 	struct mlx_config cf2_cf;
    415       1.1     ad 	u_int8_t	cf2_reserved0[26];
    416       1.1     ad 	u_int8_t	cf2_flags;
    417       1.1     ad #define	MLX_CF2_BIOS_DIS	0x01
    418       1.1     ad #define	MLX_CF2_CDROM_DIS	0x02
    419       1.1     ad #define	MLX_CF2_GEOM_255	0x20
    420       1.1     ad 	u_int8_t	cf2_reserved1[9];
    421       1.1     ad 	u_int16_t	cf2_checksum;
    422       1.1     ad } __attribute__ ((__packed__));
    423       1.1     ad 
    424       1.1     ad struct mlx_sys_drv_span {
    425       1.1     ad 	u_int32_t	sp_start_lba;
    426       1.1     ad 	u_int32_t	sp_nblks;
    427       1.1     ad 	u_int8_t	sp_arm[8];
    428       1.1     ad } __attribute__ ((packed));
    429       1.1     ad 
    430       1.1     ad struct mlx_sys_drv {
    431       1.1     ad 	u_int8_t	sd_status;
    432       1.1     ad 	u_int8_t	sd_ext_status;
    433       1.1     ad 	u_int8_t	sd_mod1;
    434       1.1     ad 	u_int8_t	sd_mod2;
    435       1.1     ad 	u_int8_t	sd_raidlevel;
    436       1.1     ad #define	MLX_SYS_DRV_WRITEBACK	(1<<7)
    437       1.1     ad #define	MLX_SYS_DRV_RAID0	0
    438       1.1     ad #define	MLX_SYS_DRV_RAID1	1
    439       1.1     ad #define	MLX_SYS_DRV_RAID3	3
    440       1.1     ad #define	MLX_SYS_DRV_RAID5	5
    441       1.1     ad #define	MLX_SYS_DRV_RAID6	6
    442       1.1     ad #define	MLX_SYS_DRV_JBOD	7
    443       1.1     ad 	u_int8_t	sd_valid_arms;
    444       1.1     ad 	u_int8_t	sd_valid_spans;
    445       1.1     ad 	u_int8_t	sd_init_state;
    446       1.1     ad #define	MLX_SYS_DRV_INITTED	0x81;
    447       1.1     ad 	struct	mlx_sys_drv_span sd_span[4];
    448       1.1     ad } __attribute__ ((packed));
    449       1.1     ad 
    450       1.1     ad struct mlx_phys_drv {
    451       1.1     ad 	u_int8_t	pd_flags1;
    452       1.1     ad #define	MLX_PHYS_DRV_PRESENT	0x01
    453       1.1     ad 	u_int8_t	pd_flags2;
    454       1.1     ad #define	MLX_PHYS_DRV_OTHER	0x00
    455       1.1     ad #define	MLX_PHYS_DRV_DISK	0x01
    456       1.1     ad #define	MLX_PHYS_DRV_SEQUENTIAL	0x02
    457       1.1     ad #define	MLX_PHYS_DRV_CDROM	0x03
    458       1.1     ad #define	MLX_PHYS_DRV_FAST20	0x08
    459       1.1     ad #define	MLX_PHYS_DRV_SYNC	0x10
    460       1.1     ad #define	MLX_PHYS_DRV_FAST	0x20
    461       1.1     ad #define	MLX_PHYS_DRV_WIDE	0x40
    462       1.1     ad #define	MLX_PHYS_DRV_TAG	0x80
    463       1.1     ad 	u_int8_t	pd_status;
    464       1.1     ad #define	MLX_PHYS_DRV_DEAD	0x00
    465       1.1     ad #define	MLX_PHYS_DRV_WRONLY	0x02
    466       1.1     ad #define	MLX_PHYS_DRV_ONLINE	0x03
    467       1.1     ad #define	MLX_PHYS_DRV_STANDBY	0x10
    468       1.1     ad 	u_int8_t	pd_res1;
    469       1.1     ad 	u_int8_t	pd_period;
    470       1.1     ad 	u_int8_t	pd_offset;
    471       1.1     ad 	u_int32_t	pd_config_size;
    472       1.1     ad } __attribute__ ((packed));
    473       1.1     ad 
    474       1.1     ad struct mlx_core_cfg {
    475       1.1     ad 	u_int8_t	cc_num_sys_drives;
    476       1.1     ad 	u_int8_t	cc_res1[3];
    477       1.1     ad 	struct	mlx_sys_drv cc_sys_drives[32];
    478       1.1     ad 	struct	mlx_phys_drv cc_phys_drives[5 * 16];
    479       1.1     ad } __attribute__ ((packed));
    480       1.1     ad 
    481       1.1     ad /*
    482       1.1     ad  * Bitfields:
    483       1.1     ad  *
    484       1.1     ad  * 0-3	dcdb_target	SCSI target
    485       1.1     ad  * 4-7	dcdb_target	SCSI channel
    486       1.1     ad  * 0-3	dcdb_length	CDB length
    487       1.1     ad  * 4-7	dcdb_length	high 4 bits of `datasize'
    488       1.1     ad  */
    489       1.1     ad struct mlx_dcdb {
    490       1.1     ad 	u_int8_t	dcdb_target;
    491       1.1     ad 	u_int8_t	dcdb_flags;
    492       1.1     ad #define	MLX_DCDB_NO_DATA	0x00
    493       1.1     ad #define	MLX_DCDB_DATA_IN	0x01
    494       1.1     ad #define	MLX_DCDB_DATA_OUT	0x02
    495       1.1     ad #define	MLX_DCDB_EARLY_STATUS	0x04
    496       1.1     ad #define	MLX_DCDB_TIMEOUT_10S	0x10	/* This lot is wrong? [ad] */
    497       1.1     ad #define	MLX_DCDB_TIMEOUT_60S	0x20
    498       1.1     ad #define	MLX_DCDB_TIMEOUT_20M	0x30
    499       1.1     ad #define	MLX_DCDB_TIMEOUT_24H	0x40
    500       1.1     ad #define	MLX_DCDB_NO_AUTO_SENSE	0x40	/* XXX ?? */
    501       1.1     ad #define	MLX_DCDB_DISCONNECT	0x80
    502       1.1     ad 	u_int16_t	dcdb_datasize;
    503       1.1     ad 	u_int32_t	dcdb_physaddr;
    504       1.1     ad 	u_int8_t	dcdb_length;
    505       1.1     ad 	u_int8_t	dcdb_sense_length;
    506       1.1     ad 	u_int8_t	dcdb_cdb[12];
    507       1.1     ad 	u_int8_t	dcdb_sense[64];
    508       1.1     ad 	u_int8_t	dcdb_status;
    509       1.1     ad 	u_int8_t	res1;
    510       1.1     ad } __attribute__ ((packed));
    511       1.1     ad 
    512       1.1     ad struct mlx_bbtable_entry {
    513       1.1     ad 	u_int32_t	bbt_block_number;
    514       1.1     ad 	u_int8_t	bbt_extent;
    515       1.1     ad 	u_int8_t	bbt_res1;
    516       1.1     ad 	u_int8_t	bbt_entry_type;
    517       1.1     ad 	u_int8_t	bbt_system_drive;	/* high 3 bits reserved */
    518       1.1     ad } __attribute__ ((packed));
    519       1.1     ad 
    520       1.1     ad #endif	/* !_IC_MLXREG_H_ */
    521