amrreg.h revision 51974
151974Smsmith/*- 251974Smsmith * Copyright (c) 1999 Michael Smith 351974Smsmith * All rights reserved. 451974Smsmith * 551974Smsmith * Redistribution and use in source and binary forms, with or without 651974Smsmith * modification, are permitted provided that the following conditions 751974Smsmith * are met: 851974Smsmith * 1. Redistributions of source code must retain the above copyright 951974Smsmith * notice, this list of conditions and the following disclaimer. 1051974Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1151974Smsmith * notice, this list of conditions and the following disclaimer in the 1251974Smsmith * documentation and/or other materials provided with the distribution. 1351974Smsmith * 1451974Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1551974Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1651974Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1751974Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1851974Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1951974Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2051974Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2151974Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2251974Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2351974Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2451974Smsmith * SUCH DAMAGE. 2551974Smsmith * 2651974Smsmith * $FreeBSD: head/sys/dev/amr/amrreg.h 51974 1999-10-07 02:23:12Z msmith $ 2751974Smsmith */ 2851974Smsmith 2951974Smsmith/* 3051974Smsmith * Mailbox commands 3151974Smsmith */ 3251974Smsmith#define AMR_CMD_LREAD 0x01 3351974Smsmith#define AMR_CMD_LWRITE 0x02 3451974Smsmith#define AMR_CMD_ENQUIRY 0x05 3551974Smsmith#define AMR_CMD_FLUSH 0x0a 3651974Smsmith#define AMR_CMD_CONFIG 0xa1 3751974Smsmith#define AMR_CONFIG_PRODINFO 0x0e 3851974Smsmith#define AMR_CONFIG_ENQ3 0x0f 3951974Smsmith#define AMR_CONFIG_ENQ3_SOLICITED_NOTIFY 0x01 4051974Smsmith#define AMR_CONFIG_ENQ3_SOLICITED_FULL 0x02 4151974Smsmith#define AMR_CONFIG_ENQ3_UNSOLICITED 0x03 4251974Smsmith 4351974Smsmith/* 4451974Smsmith * Command results 4551974Smsmith */ 4651974Smsmith#define AMR_STATUS_SUCCESS 0x00 4751974Smsmith#define AMR_STATUS_ABORTED 0x02 4851974Smsmith#define AMR_STATUS_FAILED 0x80 4951974Smsmith 5051974Smsmith/* 5151974Smsmith * Quartz doorbell registers 5251974Smsmith */ 5351974Smsmith#define AMR_QIDB 0x20 5451974Smsmith#define AMR_QODB 0x2c 5551974Smsmith#define AMR_QIDB_SUBMIT 0x00000001 /* mailbox ready for work */ 5651974Smsmith#define AMR_QIDB_ACK 0x00000002 /* mailbox done */ 5751974Smsmith#define AMR_QODB_READY 0x10001234 /* work ready to be processed */ 5851974Smsmith 5951974Smsmith/* 6051974Smsmith * Standard I/O registers 6151974Smsmith */ 6251974Smsmith#define AMR_SCMD 0x10 /* command/ack register (write) */ 6351974Smsmith#define AMR_SMBOX_BUSY 0x10 /* mailbox status (read) */ 6451974Smsmith#define AMR_STOGGLE 0x11 /* interrupt enable bit here */ 6551974Smsmith#define AMR_SMBOX_0 0x14 /* mailbox physical address low byte */ 6651974Smsmith#define AMR_SMBOX_1 0x15 6751974Smsmith#define AMR_SMBOX_2 0x16 6851974Smsmith#define AMR_SMBOX_3 0x17 /* high byte */ 6951974Smsmith#define AMR_SMBOX_ENABLE 0x18 /* atomic mailbox address enable */ 7051974Smsmith#define AMR_SINTR 0x1a /* interrupt status */ 7151974Smsmith 7251974Smsmith/* 7351974Smsmith * Standard I/O magic numbers 7451974Smsmith */ 7551974Smsmith#define AMR_SCMD_POST 0x10 /* -> SCMD to initiate action on mailbox */ 7651974Smsmith#define AMR_SCMD_ACKINTR 0x08 /* -> SCMD to ack mailbox retrieved */ 7751974Smsmith#define AMR_STOGL_IENABLE 0xc0 /* in STOGGLE */ 7851974Smsmith#define AMR_SINTR_VALID 0x40 /* in SINTR */ 7951974Smsmith#define AMR_SMBOX_BUSYFLAG 0x10 /* in SMBOX_BUSY */ 8051974Smsmith#define AMR_SMBOX_ADDR 0x00 /* -> SMBOX_ENABLE */ 8151974Smsmith 8251974Smsmith/* 8351974Smsmith * Old Enquiry results 8451974Smsmith */ 8551974Smsmith#define AMR_8LD_MAXDRIVES 8 8651974Smsmith#define AMR_8LD_MAXCHAN 5 8751974Smsmith#define AMR_8LD_MAXTARG 15 8851974Smsmith#define AMR_8LD_MAXPHYSDRIVES (AMR_8LD_MAXCHAN * AMR_8LD_MAXTARG) 8951974Smsmith 9051974Smsmithstruct amr_adapter_info 9151974Smsmith{ 9251974Smsmith u_int8_t aa_maxio; 9351974Smsmith u_int8_t aa_rebuild_rate; 9451974Smsmith u_int8_t aa_maxtargchan; 9551974Smsmith u_int8_t aa_channels; 9651974Smsmith u_int8_t aa_firmware[4]; 9751974Smsmith u_int16_t aa_flashage; 9851974Smsmith u_int8_t aa_chipsetvalue; 9951974Smsmith u_int8_t aa_memorysize; 10051974Smsmith u_int8_t aa_cacheflush; 10151974Smsmith u_int8_t aa_bios[4]; 10251974Smsmith u_int8_t res1[7]; 10351974Smsmith} __attribute__ ((packed)); 10451974Smsmith 10551974Smsmithstruct amr_logdrive_info 10651974Smsmith{ 10751974Smsmith u_int8_t al_numdrives; 10851974Smsmith u_int8_t res1[3]; 10951974Smsmith u_int32_t al_size[AMR_8LD_MAXDRIVES]; 11051974Smsmith u_int8_t al_properties[AMR_8LD_MAXDRIVES]; 11151974Smsmith u_int8_t al_state[AMR_8LD_MAXDRIVES]; 11251974Smsmith} __attribute__ ((packed)); 11351974Smsmith 11451974Smsmithstruct amr_physdrive_info 11551974Smsmith{ 11651974Smsmith u_int8_t ap_state[AMR_8LD_MAXPHYSDRIVES]; 11751974Smsmith u_int8_t res1; 11851974Smsmith} __attribute__ ((packed)); 11951974Smsmith 12051974Smsmithstruct amr_enquiry 12151974Smsmith{ 12251974Smsmith struct amr_adapter_info ae_adapter; 12351974Smsmith struct amr_logdrive_info ae_ldrv; 12451974Smsmith struct amr_physdrive_info ae_pdrv; 12551974Smsmith} __attribute__ ((packed)); 12651974Smsmith 12751974Smsmithstruct amr_prodinfo 12851974Smsmith{ 12951974Smsmith u_int32_t ap_size; /* current size in bytes (not including resvd) */ 13051974Smsmith u_int32_t ap_configsig; /* default is 0x00282008, indicating 0x28 maximum 13151974Smsmith * logical drives, 0x20 maximum stripes and 0x08 13251974Smsmith * maximum spans */ 13351974Smsmith u_int8_t ap_firmware[16]; /* printable identifiers */ 13451974Smsmith u_int8_t ap_bios[16]; 13551974Smsmith u_int8_t ap_product[80]; 13651974Smsmith u_int8_t ap_maxio; /* maximum number of concurrent commands supported */ 13751974Smsmith u_int8_t ap_nschan; /* number of SCSI channels present */ 13851974Smsmith u_int8_t ap_fcloops; /* number of fibre loops present */ 13951974Smsmith u_int8_t ap_memtype; /* memory type */ 14051974Smsmith u_int32_t ap_signature; 14151974Smsmith u_int16_t ap_memsize; /* onboard memory in MB */ 14251974Smsmith u_int16_t ap_subsystem; /* subsystem identifier */ 14351974Smsmith u_int16_t ap_subvendor; /* subsystem vendor ID */ 14451974Smsmith u_int8_t ap_numnotifyctr; /* number of notify counters */ 14551974Smsmith} __attribute__((packed)); 14651974Smsmith 14751974Smsmith#define AMR_MBOX_CMDSIZE 0x10 /* portion worth copying for controller */ 14851974Smsmith 14951974Smsmithstruct amr_mailbox 15051974Smsmith{ 15151974Smsmith u_int8_t mb_command; 15251974Smsmith u_int8_t mb_ident; 15351974Smsmith u_int16_t mb_blkcount; 15451974Smsmith u_int32_t mb_lba; 15551974Smsmith u_int32_t mb_physaddr; 15651974Smsmith u_int8_t mb_drive; 15751974Smsmith u_int8_t mb_nsgelem; 15851974Smsmith u_int8_t res1; 15951974Smsmith u_int8_t mb_busy; 16051974Smsmith u_int8_t mb_nstatus; 16151974Smsmith u_int8_t mb_status; 16251974Smsmith u_int8_t mb_completed[46]; 16351974Smsmith u_int8_t mb_poll; 16451974Smsmith u_int8_t mb_ack; 16551974Smsmith u_int8_t res2[16]; 16651974Smsmith} __attribute__ ((packed)); 16751974Smsmith 16851974Smsmithstruct amr_mailbox64 16951974Smsmith{ 17051974Smsmith u_int32_t mb64_segment; /* for 64-bit controllers */ 17151974Smsmith struct amr_mailbox mb; 17251974Smsmith} __attribute__ ((packed)); 17351974Smsmith 17451974Smsmithstruct amr_mailbox_ioctl 17551974Smsmith{ 17651974Smsmith u_int8_t mb_command; 17751974Smsmith u_int8_t mb_ident; 17851974Smsmith u_int8_t mb_channel; 17951974Smsmith u_int8_t mb_param; 18051974Smsmith u_int8_t res1[4]; 18151974Smsmith u_int32_t mb_physaddr; 18251974Smsmith u_int8_t mb_drive; 18351974Smsmith u_int8_t mb_nsgelem; 18451974Smsmith u_int8_t res2; 18551974Smsmith u_int8_t mb_busy; 18651974Smsmith u_int8_t mb_nstatus; 18751974Smsmith u_int8_t mb_completed[46]; 18851974Smsmith u_int8_t mb_poll; 18951974Smsmith u_int8_t mb_ack; 19051974Smsmith u_int8_t res3[16]; 19151974Smsmith} __attribute__ ((packed)); 19251974Smsmith 19351974Smsmithstruct amr_sgentry 19451974Smsmith{ 19551974Smsmith u_int32_t sg_addr; 19651974Smsmith u_int32_t sg_count; 19751974Smsmith} __attribute__ ((packed)); 19851974Smsmith 19951974Smsmith 200