edcreg.h revision 1.2 1 1.2 jdolecek /* $NetBSD: edcreg.h,v 1.2 2001/04/22 11:32:49 jdolecek Exp $ */
2 1.1 jdolecek
3 1.1 jdolecek /*
4 1.1 jdolecek * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 jdolecek *
6 1.1 jdolecek * This code is derived from software contributed to The NetBSD Foundation
7 1.1 jdolecek * by Jaromir Dolecek.
8 1.1 jdolecek *
9 1.1 jdolecek * Redistribution and use in source and binary forms, with or without
10 1.1 jdolecek * modification, are permitted provided that the following conditions
11 1.1 jdolecek * are met:
12 1.1 jdolecek * 1. Redistributions of source code must retain the above copyright
13 1.1 jdolecek * notice, this list of conditions and the following disclaimer.
14 1.1 jdolecek * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 jdolecek * notice, this list of conditions and the following disclaimer in the
16 1.1 jdolecek * documentation and/or other materials provided with the distribution.
17 1.1 jdolecek * 3. All advertising materials mentioning features or use of this software
18 1.1 jdolecek * must display the following acknowledgement:
19 1.1 jdolecek * This product includes software developed by the NetBSD
20 1.1 jdolecek * Foundation, Inc. and its contributors.
21 1.1 jdolecek * 4. The name of the author may not be used to endorse or promote products
22 1.1 jdolecek * derived from this software without specific prior written permission.
23 1.1 jdolecek *
24 1.1 jdolecek * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 1.1 jdolecek * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 1.1 jdolecek * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 1.1 jdolecek * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 1.1 jdolecek * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 1.1 jdolecek * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 1.1 jdolecek * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 1.1 jdolecek * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 1.1 jdolecek * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 1.1 jdolecek * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 1.1 jdolecek */
35 1.1 jdolecek
36 1.1 jdolecek /*
37 1.1 jdolecek * Driver for MCA ESDI controllers and disks.
38 1.1 jdolecek */
39 1.1 jdolecek
40 1.1 jdolecek #define ESDIC_IOPRM 0x3510
41 1.1 jdolecek #define ESDIC_IOALT 0x3518
42 1.1 jdolecek #define ESDIC_REG_NPORTS 8
43 1.1 jdolecek #define ESDIC_IRQ 14 /* this is fixed */
44 1.1 jdolecek
45 1.1 jdolecek /* pos2 */
46 1.1 jdolecek #define IO_IS_ALT 0x02
47 1.1 jdolecek #define DRQ_MASK 0x3c
48 1.1 jdolecek #define FAIRNESS_ENABLE 0x40
49 1.1 jdolecek
50 1.1 jdolecek /* pos3 */
51 1.1 jdolecek #define PACING_INT_MASK 0x30
52 1.1 jdolecek
53 1.1 jdolecek /* pos4 */
54 1.1 jdolecek #define PACING_CTRL_DISABLE 0x01
55 1.1 jdolecek #define RELEASE_2 0x02 /* lower bit of Time to Release */
56 1.1 jdolecek #define RELEASE_1 0x04 /* higher bit of Time to Release */
57 1.1 jdolecek
58 1.1 jdolecek /* controller registers */
59 1.1 jdolecek #define SIFR 0 /* read Status Interface Register,
60 1.1 jdolecek 2 bytes, little endian */
61 1.1 jdolecek #define SIFR_CMD_MASK 0x2f
62 1.1 jdolecek
63 1.1 jdolecek #define CIFR 0 /* write - Command Interface Reg,
64 1.1 jdolecek 2 bytes, little endian */
65 1.1 jdolecek #define CIFR_LONG_CMD (1<<14) /* 4 word command */
66 1.1 jdolecek
67 1.1 jdolecek /* Command Codes */
68 1.1 jdolecek #define CMD_READ_DATA 0x01 /* uses DMA */
69 1.1 jdolecek #define CMD_WRITE_DATA 0x02 /* uses DMA */
70 1.1 jdolecek #define CMD_READ_VERIFY 0x03
71 1.1 jdolecek #define CMD_WRITE_VERIFY 0x04 /* uses DMA */
72 1.1 jdolecek #define CMD_SEEK 0x05
73 1.1 jdolecek #define CMD_PARK_HEAD 0x06
74 1.1 jdolecek #define CMD_GET_CMD_COMP_STATUS 0x07
75 1.1 jdolecek #define CMD_GET_DEV_STATUS 0x08
76 1.1 jdolecek #define CMD_GET_DEV_CONF 0x09
77 1.1 jdolecek #define CMD_GET_POS_INFO 0x0A
78 1.1 jdolecek #define CMD_TRANSLATE_RBA 0x0B
79 1.1 jdolecek #define CMD_WRITE_ATTACH_BUFF 0x10 /* uses DMA */
80 1.1 jdolecek #define CMD_READ_ATTACH_BUFF 0x11 /* uses DMA */
81 1.1 jdolecek #define CMD_RUN_DIAG_TEST 0x12
82 1.1 jdolecek #define CMD_GET_DIAG_STAT_BLOCK 0x14
83 1.1 jdolecek #define CMD_GET_MFG_HEADER 0x15 /* uses DMA */
84 1.1 jdolecek #define CMD_FORMAT_UNIT 0x16 /* uses DMA */
85 1.1 jdolecek #define CMD_FORMAT_PREPARE 0x17
86 1.1 jdolecek #define CMD_SET_MAX_RBA 0x1A
87 1.1 jdolecek #define CMD_SET_PWR_SAV_MODE 0x1B /* optional */
88 1.1 jdolecek #define CMD_POWER_CONS_CMD 0x1C /* optional */
89 1.1 jdolecek
90 1.1 jdolecek #define BCR 2 /* write */
91 1.1 jdolecek #define BCR_INT_ENABLE 0x01
92 1.1 jdolecek #define BCR_DMA_ENABLE 0x02
93 1.1 jdolecek #define BCR_RESET 0x80
94 1.1 jdolecek
95 1.1 jdolecek #define BSR 2 /* read */
96 1.1 jdolecek #define BSR_DMA_ENABLED 0x80
97 1.1 jdolecek #define BSR_INT_PENDING 0x40
98 1.1 jdolecek #define BSR_CMD_INPROGRESS 0x20
99 1.1 jdolecek #define BSR_BUSY 0x10
100 1.1 jdolecek #define BSR_SIFR_FULL 0x08 /* also called STATUS OUT */
101 1.1 jdolecek #define BSR_CIFR_FULL 0x04
102 1.1 jdolecek #define BSR_TRANSFER_REQ 0x02
103 1.1 jdolecek #define BSR_INTR 0x01
104 1.1 jdolecek
105 1.1 jdolecek #define ISR 3 /* read, Interrupt Status Register */
106 1.1 jdolecek #define ISR_DEV_SELECT_MASK 0xE0
107 1.1 jdolecek #define ISR_ATTACH_ERR 0x10
108 1.1 jdolecek #define ISR_INTR_ID_MASK 0x0F
109 1.1 jdolecek #define ISR_COMPLETED 0x01
110 1.1 jdolecek #define ISR_COMPLETED_WITH_ECC 0x03
111 1.1 jdolecek #define ISR_COMPLETED_RETRIES 0x05
112 1.1 jdolecek #define ISR_PARTIAL_FORMAT 0x06 /* Status available */
113 1.1 jdolecek #define ISR_COMPLETED_WARNING 0x08
114 1.1 jdolecek #define ISR_ABORT_COMPLETED 0x09
115 1.1 jdolecek #define ISR_RESET_COMPLETED 0x0A
116 1.1 jdolecek #define ISR_DATA_TRANSFER_RDY 0x0B /* No Status Block */
117 1.1 jdolecek #define ISR_CMD_FAILED 0x0C
118 1.1 jdolecek #define ISR_DMA_ERROR 0x0D
119 1.1 jdolecek #define ISR_CMD_BLOCK_ERROR 0x0E
120 1.1 jdolecek #define ISR_ATTN_ERROR 0x0F
121 1.1 jdolecek
122 1.1 jdolecek /* Macros to get info from command status block */
123 1.1 jdolecek #define SB_GET_CMD_STATUS(sb) (((sb)[1] & 0xff00) >> 8)
124 1.2 jdolecek #define SB_RESBLKCNT_IDX 3
125 1.1 jdolecek
126 1.1 jdolecek #define ATN 3 /* write, Attention register */
127 1.1 jdolecek #define ATN_CMD_REQ 1
128 1.1 jdolecek #define ATN_END_INT 2 /* End of Interrupt (EOI) */
129 1.1 jdolecek #define ATN_ABORT_CMD 3
130 1.1 jdolecek #define ATN_RESET_ATTACHMENT 4
131 1.1 jdolecek
132 1.1 jdolecek #define DASD_DEVNO_CONTROLLER 7 /* Device number for controller */
133