xref: /openbsd/sys/dev/isa/if_egreg.h (revision c0a88b36)
1 /*	$OpenBSD: if_egreg.h,v 1.3 2000/06/05 20:56:20 niklas Exp $	*/
2 /*	$NetBSD: if_egreg.h,v 1.3 1995/07/23 21:14:35 mycroft Exp $	*/
3 
4 /*
5  * Copyright (c) 1993 Dean Huxley (dean@fsa.ca)
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *      This product includes software developed by Dean Huxley.
19  * 4. The name of Dean Huxley may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*
35  * Register offsets from base.
36  */
37 #define EG_COMMAND	0x00
38 #define EG_STATUS	0x02
39 #define EG_DATA		0x04
40 #define EG_CONTROL	0x06
41 
42 #define EG_IO_PORTS	8
43 
44 /*
45  * Host Control Register bits
46  * EG_CTL_ATTN - does a soft reset
47  * EG_CTL_FLSH - flushes the data register
48  * EG_CTL_RESET - does a hard reset
49  * EG_CTL_DMAE - Used with DIR bit, enables DMA transfers to/from data reg.
50  * EG_CTL_DIR  - if clear then host -> adapter, if set then adapter -> host
51  * EG_CTL_TCEN - terminal count enable. enables host interrupt after DMA.
52  * EG_CTL_CMDE - command reg interrupt enable. (when it is written)
53  * EG_CTL_HSF1 - Host status flag 1
54  * EG_CTL_HSF2 - Host status flag 2
55  */
56 
57 #define EG_CTL_ATTN 0x80
58 #define EG_CTL_FLSH 0x40
59 #define EG_CTL_RESET (EG_CTL_ATTN|EG_CTL_FLSH)
60 #define EG_CTL_DMAE 0x20
61 #define EG_CTL_DIR  0x10
62 #define EG_CTL_TCEN 0x08
63 #define EG_CTL_CMDE 0x04
64 #define EG_CTL_HSF2 0x02
65 #define EG_CTL_HSF1 0x01
66 
67 /*
68  * Host Status Register bits
69  * EG_STAT_HRDY - Data Register ready
70  * EG_STAT_HCRE - Host Command Register empty
71  * EG_STAT_ACRF - Adapter Command register full
72  * EG_STAT_DIR  - Direction flag, 0 = host -> adapter, 1 = adapter -> host
73  * EG_STAT_DONE - DMA done
74  * EG_STAT_ASF1 - Adapter status flag 1
75  * EG_STAT_ASF2 - Adapter status flag 2
76  * EG_STAT_ASF3 - Adapter status flag 3
77  */
78 
79 #define EG_STAT_HRDY 0x80
80 #define EG_STAT_HCRE 0x40
81 #define EG_STAT_ACRF 0x20
82 #define EG_STAT_DIR  0x10
83 #define EG_STAT_DONE 0x08
84 #define EG_STAT_ASF3 0x04
85 #define EG_STAT_ASF2 0x02
86 #define EG_STAT_ASF1 0x01
87 
88 #define	EG_PCB_NULL	0x00
89 #define EG_PCB_ACCEPT	0x01
90 #define EG_PCB_REJECT	0x02
91 #define EG_PCB_DONE	0x03
92 #define EG_PCB_STAT	0x03
93 
94 #define EG_CMD_CONFIG82586	0x02
95 #define EG_CMD_GETEADDR		0x03
96 #define EG_CMD_RECVPACKET	0x08
97 #define EG_CMD_SENDPACKET	0x09
98 #define EG_CMD_GETSTATS		0x0a
99 #define EG_CMD_SETEADDR		0x10
100 #define EG_CMD_GETINFO		0x11
101 
102 #define EG_RSP_CONFIG82586	0x32
103 #define EG_RSP_GETEADDR		0x33
104 #define EG_RSP_RECVPACKET	0x38
105 #define EG_RSP_SENDPACKET	0x39
106 #define EG_RSP_GETSTATS		0x3a
107 #define EG_RSP_SETEADDR		0x40
108 #define EG_RSP_GETINFO		0x41
109