idareg.h revision 103870
10SN/A/*-
24052Sbpatel * Copyright (c) 1999,2000 Jonathan Lemon
30SN/A * All rights reserved.
40SN/A *
50SN/A * Redistribution and use in source and binary forms, with or without
60SN/A * modification, are permitted provided that the following conditions
7553SN/A * are met:
80SN/A * 1. Redistributions of source code must retain the above copyright
9553SN/A *    notice, this list of conditions and the following disclaimer.
100SN/A * 2. Redistributions in binary form must reproduce the above copyright
110SN/A *    notice, this list of conditions and the following disclaimer in the
120SN/A *    documentation and/or other materials provided with the distribution.
130SN/A *
140SN/A * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
150SN/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
160SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
170SN/A * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
180SN/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
190SN/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
200SN/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21553SN/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22553SN/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23553SN/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
240SN/A * SUCH DAMAGE.
250SN/A *
263233Sksrini * $FreeBSD: head/sys/dev/ida/idareg.h 103870 2002-09-23 18:54:32Z alfred $
273233Sksrini */
283233Sksrini
290SN/A/*
303233Sksrini * #defines and software structures for the Compaq RAID card
313233Sksrini */
323233Sksrini
333233Sksrini/*
343233Sksrini * defines for older EISA controllers (IDA, IDA-2, IAES, SMART)
353233Sksrini */
363233Sksrini#define R_EISA_INT_MASK			0x01
373233Sksrini#define R_EISA_LOCAL_MASK		0x04
383233Sksrini#define R_EISA_LOCAL_DOORBELL		0x05
393233Sksrini#define R_EISA_SYSTEM_MASK		0x06
403233Sksrini#define R_EISA_SYSTEM_DOORBELL		0x07
413233Sksrini#define R_EISA_LIST_ADDR		0x08
423233Sksrini#define R_EISA_LIST_LEN			0x0c
433233Sksrini#define R_EISA_TAG			0x0f
443233Sksrini#define R_EISA_COMPLETE_ADDR		0x10
453233Sksrini#define R_EISA_LIST_STATUS		0x16
463233Sksrini
473233Sksrini#define EISA_CHANNEL_BUSY		0x01
480SN/A#define EISA_CHANNEL_CLEAR		0x02
490SN/A
500SN/A/*
510SN/A * board register offsets for SMART-2 controllers
521358SN/A */
531358SN/A#define R_CMD_FIFO	0x04
541358SN/A#define R_DONE_FIFO	0x08
551358SN/A#define R_INT_MASK	0x0C
561358SN/A#define R_STATUS	0x10
570SN/A#define R_INT_PENDING	0x14
580SN/A
59765SN/A/*
600SN/A * interrupt mask values for SMART series
610SN/A */
620SN/A#define INT_DISABLE	0x00
633233Sksrini#define INT_ENABLE	0x01
643233Sksrini
650SN/A/*
660SN/A * board offsets for the 42xx series
670SN/A */
680SN/A#define R_42XX_STATUS	0x30
690SN/A#define R_42XX_INT_MASK	0x34
700SN/A#define R_42XX_REQUEST	0x40
710SN/A#define R_42XX_REPLY	0x44
72765SN/A
730SN/A/*
740SN/A * interrupt values for 42xx series
75765SN/A */
760SN/A#define INT_ENABLE_42XX			0x00
773233Sksrini#define INT_DISABLE_42XX		0x08
781740SN/A#define STATUS_42XX_INT_PENDING		0x08
791740SN/A
801740SN/A/*
813568Sjjg * return status codes
821740SN/A */
831740SN/A#define SOFT_ERROR	0x02
841740SN/A#define HARD_ERROR	0x04
851740SN/A#define CMD_REJECTED	0x14
861740SN/A
871740SN/A/*
881740SN/A * command types
891740SN/A */
901740SN/A#define	CMD_GET_LOG_DRV_INFO	0x10
913233Sksrini#define	CMD_GET_CTRL_INFO	0x11
923233Sksrini#define	CMD_SENSE_DRV_STATUS	0x12
931740SN/A#define	CMD_START_RECOVERY	0x13
940SN/A#define	CMD_GET_PHYS_DRV_INFO	0x15
950SN/A#define	CMD_BLINK_DRV_LEDS	0x16
96765SN/A#define	CMD_SENSE_DRV_LEDS	0x17
97765SN/A#define	CMD_GET_LOG_DRV_EXT	0x18
98765SN/A#define	CMD_GET_CTRL_INFO	0x11
993233Sksrini#define CMD_READ		0x20
1003233Sksrini#define CMD_WRITE		0x30
1013233Sksrini#define CMD_WRITE_MEDIA		0x31
1023233Sksrini#define CMD_GET_CONFIG		0x50
1033233Sksrini#define CMD_SET_CONFIG		0x51
1043233Sksrini#define CMD_START_FIRMWARE	0x99		/* for integrated RAID */
1053291Sksrini#define CMD_FLUSH_CACHE		0xc2
1063233Sksrini
1073233Sksrini/*
1083233Sksrini * command structures
1093291Sksrini */
1100SN/Astruct ida_drive_info {
1110SN/A	u_int16_t	secsize;
112765SN/A	u_int32_t	secperunit;
113765SN/A	u_int16_t	ncylinders;
114765SN/A	u_int8_t	nheads;
115765SN/A	u_int8_t	signature;
1163595Sksrini	u_int8_t	psectors;
117765SN/A	u_int16_t	wprecomp;
118765SN/A	u_int8_t	max_acc;
119765SN/A	u_int8_t	control;
1203233Sksrini	u_int16_t	pcylinders;
1213233Sksrini	u_int8_t	ptracks;
122765SN/A	u_int16_t	landing_zone;
1233233Sksrini	u_int8_t	nsectors;
1242146SN/A	u_int8_t	checksum;
1253233Sksrini	u_int8_t	mirror;
1263233Sksrini} __packed;
1272146SN/A
1283233Sksrinistruct ida_controller_info {
129765SN/A	u_int8_t	num_drvs;
1300SN/A	u_int32_t	signature;
1310SN/A	u_int8_t	firm_rev[4];
132765SN/A} __packed;
133765SN/A
134765SN/A
1353233Sksrinistruct ida_drive_status {
136765SN/A	u_int8_t	status;
137765SN/A	u_int32_t	failure_map;
138765SN/A	u_int8_t	reserved[416];
1393233Sksrini	u_int32_t	secrecover;
1403233Sksrini	u_int8_t	rebuilding;
1413233Sksrini	u_int16_t	remap_cnt[8];
1420SN/A	u_int32_t	repl_map;
1430SN/A	u_int32_t	spare_map;
144765SN/A	u_int8_t	spare_status;
145765SN/A	u_int8_t	spare_repl_map[32];
146765SN/A	u_int32_t	repl_ok_map;
147765SN/A	u_int8_t	media_exchange;
148765SN/A	u_int8_t	cache_failure;
149765SN/A	u_int8_t	expand_failure;
150765SN/A	u_int8_t	unit_flags;
151765SN/A	u_int16_t	big_failure_map[8];
1523233Sksrini	u_int16_t	big_remap_cnt[128];
1531736SN/A	u_int16_t	big_repl_map[8];
1543233Sksrini	u_int16_t	big_act_spare_map[8];
1553233Sksrini	u_int8_t	big_spare_repl_map[128];
1563233Sksrini	u_int16_t	big_repl_ok_map[8];
1573233Sksrini	u_int8_t	big_rebuilding;
1583568Sjjg} __packed;
1593233Sksrini