xref: /netbsd/sys/dev/pci/oboereg.h (revision bf9ec67e)
1 /*	$NetBSD: oboereg.h,v 1.1 2001/12/02 16:30:31 augustss Exp $	*/
2 
3 /*-
4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Jan Sparud.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 /*
40  * Toshiba OBOE SIR/FIR driver header file.
41  */
42 
43 #ifndef OBOE_H
44 #define OBOE_H
45 
46 /* Registers */
47 /*Receive and transmit task registers (read only) */
48 #define OBOE_RCVT	(0x00)
49 #define OBOE_XMTT	(0x01)
50 #define OBOE_XMTT_OFFSET	0x40
51 
52 /*Page pointers to the TaskFile structure */
53 #define OBOE_TFP2	(0x02)
54 #define OBOE_TFP0	(0x04)
55 #define OBOE_TFP1	(0x05)
56 
57 /*Dunno */
58 #define OBOE_REG_3	(0x03)
59 
60 /*Number of tasks to use in Xmit and Recv queues */
61 #define OBOE_NTR	(0x07)
62 #define OBOE_NTR_XMIT4	0x00
63 #define OBOE_NTR_XMIT8	0x10
64 #define OBOE_NTR_XMIT16	0x30
65 #define OBOE_NTR_XMIT32	0x70
66 #define OBOE_NTR_XMIT64	0xf0
67 #define OBOE_NTR_RECV4	0x00
68 #define OBOE_NTR_RECV8	0x01
69 #define OBOE_NTR_RECV6	0x03
70 #define OBOE_NTR_RECV32	0x07
71 #define OBOE_NTR_RECV64	0x0f
72 
73 /* Dunno */
74 #define OBOE_REG_9	(0x09)
75 
76 /* Interrupt Status Register */
77 #define OBOE_ISR	(0x0c)
78 #define OBOE_ISR_TXDONE	0x80
79 #define OBOE_ISR_RXDONE	0x40
80 #define OBOE_ISR_20	0x20
81 #define OBOE_ISR_10	0x10
82 #define OBOE_ISR_8	0x08         /*This is collision or parity or something */
83 #define OBOE_ISR_4	0x08
84 #define OBOE_ISR_2	0x08
85 #define OBOE_ISR_1	0x08
86 
87 /*Dunno */
88 #define OBOE_REG_D	(0x0d)
89 
90 /*Register Lock Register */
91 #define OBOE_LOCK	(0x0e)
92 
93 /*Speed control registers */
94 #define OBOE_PMDL	(0x10)
95 #define OBOE_PMDL_SIR	0x18
96 #define OBOE_PMDL_MIR	0xa0
97 #define OBOE_PMDL_FIR	0x40
98 
99 #define OBOE_SMDL	(0x18)
100 #define OBOE_SMDL_SIR	0x20
101 #define OBOE_SMDL_MIR	0x01
102 #define OBOE_SMDL_FIR	0x0f
103 
104 #define OBOE_UDIV	(0x19)
105 
106 /*Dunno */
107 #define OBOE_REG_11	(0x11)
108 
109 /*Chip Reset Register */
110 #define OBOE_RST	(0x15)
111 #define OBOE_RST_WRAP	0x8
112 
113 /*Dunno */
114 #define OBOE_REG_1A	(0x1a)
115 #define OBOE_REG_1B	(0x1b)
116 
117 #define OBOE_IOSIZE	0x1f
118 
119 #define IO_BAR		0x10
120 
121 typedef unsigned int dword;
122 typedef unsigned short int word;
123 typedef unsigned char byte;
124 typedef dword Paddr;
125 
126 struct OboeTask {
127 	uint16_t len;
128 	uint8_t unused;
129 	uint8_t control;
130 	uint32_t buffer;
131 };
132 
133 #define OBOE_NTASKS 64
134 
135 struct OboeTaskFile {
136 	struct OboeTask recv[OBOE_NTASKS];
137 	struct OboeTask xmit[OBOE_NTASKS];
138 };
139 
140 #define OBOE_TASK_BUF_LEN (sizeof(struct OboeTaskFile) << 1)
141 
142 /*These set the number of slots in use */
143 #define TX_SLOTS	8
144 #define RX_SLOTS	8
145 
146 #define RX_BUF_SZ 	4196
147 #define TX_BUF_SZ	4196
148 
149 /* You need also to change this, toshiba uses 4,8 and 4,4 */
150 /* It makes no difference if you are only going to use ONETASK mode */
151 /* remember each buffer use XX_BUF_SZ more _PHYSICAL_ memory */
152 #define OBOE_NTR_VAL 	(OBOE_NTR_XMIT8 | OBOE_NTR_RECV8)
153 
154 #define OUTB(sc, val, off) \
155   bus_space_write_1(sc->sc_iot, sc->sc_ioh, off, val)
156 
157 #define INB(sc, off) \
158   bus_space_read_1(sc->sc_iot, sc->sc_ioh, off)
159 
160 #endif
161