cs89x0isa.c revision 1.3.4.2 1 1.3.4.2 thorpej /* $NetBSD: cs89x0isa.c,v 1.3.4.2 2002/01/10 19:55:20 thorpej Exp $ */
2 1.3.4.2 thorpej
3 1.3.4.2 thorpej /*
4 1.3.4.2 thorpej * Copyright 1997
5 1.3.4.2 thorpej * Digital Equipment Corporation. All rights reserved.
6 1.3.4.2 thorpej *
7 1.3.4.2 thorpej * This software is furnished under license and may be used and
8 1.3.4.2 thorpej * copied only in accordance with the following terms and conditions.
9 1.3.4.2 thorpej * Subject to these conditions, you may download, copy, install,
10 1.3.4.2 thorpej * use, modify and distribute this software in source and/or binary
11 1.3.4.2 thorpej * form. No title or ownership is transferred hereby.
12 1.3.4.2 thorpej *
13 1.3.4.2 thorpej * 1) Any source code used, modified or distributed must reproduce
14 1.3.4.2 thorpej * and retain this copyright notice and list of conditions as
15 1.3.4.2 thorpej * they appear in the source file.
16 1.3.4.2 thorpej *
17 1.3.4.2 thorpej * 2) No right is granted to use any trade name, trademark, or logo of
18 1.3.4.2 thorpej * Digital Equipment Corporation. Neither the "Digital Equipment
19 1.3.4.2 thorpej * Corporation" name nor any trademark or logo of Digital Equipment
20 1.3.4.2 thorpej * Corporation may be used to endorse or promote products derived
21 1.3.4.2 thorpej * from this software without the prior written permission of
22 1.3.4.2 thorpej * Digital Equipment Corporation.
23 1.3.4.2 thorpej *
24 1.3.4.2 thorpej * 3) This software is provided "AS-IS" and any express or implied
25 1.3.4.2 thorpej * warranties, including but not limited to, any implied warranties
26 1.3.4.2 thorpej * of merchantability, fitness for a particular purpose, or
27 1.3.4.2 thorpej * non-infringement are disclaimed. In no event shall DIGITAL be
28 1.3.4.2 thorpej * liable for any damages whatsoever, and in particular, DIGITAL
29 1.3.4.2 thorpej * shall not be liable for special, indirect, consequential, or
30 1.3.4.2 thorpej * incidental damages or damages for lost profits, loss of
31 1.3.4.2 thorpej * revenue or loss of use, whether such damages arise in contract,
32 1.3.4.2 thorpej * negligence, tort, under statute, in equity, at law or otherwise,
33 1.3.4.2 thorpej * even if advised of the possibility of such damage.
34 1.3.4.2 thorpej */
35 1.3.4.2 thorpej
36 1.3.4.2 thorpej /* isa dma routines for cs89x0 */
37 1.3.4.2 thorpej
38 1.3.4.2 thorpej #include <sys/cdefs.h>
39 1.3.4.2 thorpej __KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.3.4.2 2002/01/10 19:55:20 thorpej Exp $");
40 1.3.4.2 thorpej
41 1.3.4.2 thorpej #include <sys/param.h>
42 1.3.4.2 thorpej #include <sys/systm.h>
43 1.3.4.2 thorpej #include <sys/mbuf.h>
44 1.3.4.2 thorpej #include <sys/socket.h>
45 1.3.4.2 thorpej #include <sys/device.h>
46 1.3.4.2 thorpej
47 1.3.4.2 thorpej #include "rnd.h"
48 1.3.4.2 thorpej #if NRND > 0
49 1.3.4.2 thorpej #include <sys/rnd.h>
50 1.3.4.2 thorpej #endif
51 1.3.4.2 thorpej
52 1.3.4.2 thorpej #include <net/if.h>
53 1.3.4.2 thorpej #include <net/if_ether.h>
54 1.3.4.2 thorpej #include <net/if_media.h>
55 1.3.4.2 thorpej
56 1.3.4.2 thorpej #include <machine/bus.h>
57 1.3.4.2 thorpej
58 1.3.4.2 thorpej #include <dev/isa/isareg.h>
59 1.3.4.2 thorpej #include <dev/isa/isavar.h>
60 1.3.4.2 thorpej #include <dev/isa/isadmavar.h>
61 1.3.4.2 thorpej
62 1.3.4.2 thorpej #include <dev/ic/cs89x0reg.h>
63 1.3.4.2 thorpej #include <dev/ic/cs89x0var.h>
64 1.3.4.2 thorpej #include <dev/isa/cs89x0isavar.h>
65 1.3.4.2 thorpej
66 1.3.4.2 thorpej #define DMA_STATUS_BITS 0x0007 /* bit masks for checking DMA status */
67 1.3.4.2 thorpej #define DMA_STATUS_OK 0x0004
68 1.3.4.2 thorpej
69 1.3.4.2 thorpej void
70 1.3.4.2 thorpej cs_isa_dma_attach(struct cs_softc *sc)
71 1.3.4.2 thorpej {
72 1.3.4.2 thorpej struct cs_softc_isa *isc = (void *)sc;
73 1.3.4.2 thorpej
74 1.3.4.2 thorpej if (isc->sc_drq == ISACF_DRQ_DEFAULT)
75 1.3.4.2 thorpej printf("%s: DMA channel unspecified, not using DMA\n",
76 1.3.4.2 thorpej sc->sc_dev.dv_xname);
77 1.3.4.2 thorpej else if (isc->sc_drq < 5 || isc->sc_drq > 7)
78 1.3.4.2 thorpej printf("%s: invalid DMA channel, not using DMA\n",
79 1.3.4.2 thorpej sc->sc_dev.dv_xname);
80 1.3.4.2 thorpej else {
81 1.3.4.2 thorpej bus_size_t maxsize;
82 1.3.4.2 thorpej bus_addr_t dma_addr;
83 1.3.4.2 thorpej
84 1.3.4.2 thorpej maxsize = isa_dmamaxsize(isc->sc_ic, isc->sc_drq);
85 1.3.4.2 thorpej if (maxsize < CS8900_DMASIZE) {
86 1.3.4.2 thorpej printf("%s: max DMA size %lu is less than required %d\n",
87 1.3.4.2 thorpej sc->sc_dev.dv_xname, (u_long)maxsize,
88 1.3.4.2 thorpej CS8900_DMASIZE);
89 1.3.4.2 thorpej goto after_dma_block;
90 1.3.4.2 thorpej }
91 1.3.4.2 thorpej
92 1.3.4.2 thorpej if (isa_dmamap_create(isc->sc_ic, isc->sc_drq,
93 1.3.4.2 thorpej CS8900_DMASIZE, BUS_DMA_NOWAIT) != 0) {
94 1.3.4.2 thorpej printf("%s: unable to create ISA DMA map\n",
95 1.3.4.2 thorpej sc->sc_dev.dv_xname);
96 1.3.4.2 thorpej goto after_dma_block;
97 1.3.4.2 thorpej }
98 1.3.4.2 thorpej if (isa_dmamem_alloc(isc->sc_ic, isc->sc_drq,
99 1.3.4.2 thorpej CS8900_DMASIZE, &dma_addr, BUS_DMA_NOWAIT) != 0) {
100 1.3.4.2 thorpej printf("%s: unable to allocate DMA buffer\n",
101 1.3.4.2 thorpej sc->sc_dev.dv_xname);
102 1.3.4.2 thorpej goto after_dma_block;
103 1.3.4.2 thorpej }
104 1.3.4.2 thorpej if (isa_dmamem_map(isc->sc_ic, isc->sc_drq, dma_addr,
105 1.3.4.2 thorpej CS8900_DMASIZE, &isc->sc_dmabase,
106 1.3.4.2 thorpej BUS_DMA_NOWAIT | BUS_DMA_COHERENT /* XXX */ ) != 0) {
107 1.3.4.2 thorpej printf("%s: unable to map DMA buffer\n",
108 1.3.4.2 thorpej sc->sc_dev.dv_xname);
109 1.3.4.2 thorpej isa_dmamem_free(isc->sc_ic, isc->sc_drq, dma_addr,
110 1.3.4.2 thorpej CS8900_DMASIZE);
111 1.3.4.2 thorpej goto after_dma_block;
112 1.3.4.2 thorpej }
113 1.3.4.2 thorpej
114 1.3.4.2 thorpej isc->sc_dmasize = CS8900_DMASIZE;
115 1.3.4.2 thorpej sc->sc_cfgflags |= CFGFLG_DMA_MODE;
116 1.3.4.2 thorpej isc->sc_dmaaddr = dma_addr;
117 1.3.4.2 thorpej after_dma_block:
118 1.3.4.2 thorpej ;
119 1.3.4.2 thorpej }
120 1.3.4.2 thorpej }
121 1.3.4.2 thorpej
122 1.3.4.2 thorpej void cs_isa_dma_chipinit(struct cs_softc *sc)
123 1.3.4.2 thorpej {
124 1.3.4.2 thorpej struct cs_softc_isa *isc = (void *)sc;
125 1.3.4.2 thorpej
126 1.3.4.2 thorpej if (sc->sc_cfgflags & CFGFLG_DMA_MODE) {
127 1.3.4.2 thorpej /*
128 1.3.4.2 thorpej * First we program the DMA controller and ensure the memory
129 1.3.4.2 thorpej * buffer is valid. If it isn't then we just go on without
130 1.3.4.2 thorpej * DMA.
131 1.3.4.2 thorpej */
132 1.3.4.2 thorpej if (isa_dmastart(isc->sc_ic, isc->sc_drq, isc->sc_dmabase,
133 1.3.4.2 thorpej isc->sc_dmasize, NULL, DMAMODE_READ | DMAMODE_LOOPDEMAND,
134 1.3.4.2 thorpej BUS_DMA_NOWAIT)) {
135 1.3.4.2 thorpej /* XXX XXX XXX */
136 1.3.4.2 thorpej panic("%s: unable to start DMA\n", sc->sc_dev.dv_xname);
137 1.3.4.2 thorpej }
138 1.3.4.2 thorpej isc->sc_dmacur = isc->sc_dmabase;
139 1.3.4.2 thorpej
140 1.3.4.2 thorpej /* interrupt when a DMA'd frame is received */
141 1.3.4.2 thorpej CS_WRITE_PACKET_PAGE(sc, PKTPG_RX_CFG,
142 1.3.4.2 thorpej RX_CFG_ALL_IE | RX_CFG_RX_DMA_ONLY);
143 1.3.4.2 thorpej
144 1.3.4.2 thorpej /*
145 1.3.4.2 thorpej * set the DMA burst bit so we don't tie up the bus for too
146 1.3.4.2 thorpej * long.
147 1.3.4.2 thorpej */
148 1.3.4.2 thorpej if (isc->sc_dmasize == 16384) {
149 1.3.4.2 thorpej CS_WRITE_PACKET_PAGE(sc, PKTPG_BUS_CTL,
150 1.3.4.2 thorpej ((CS_READ_PACKET_PAGE(sc, PKTPG_BUS_CTL) &
151 1.3.4.2 thorpej ~BUS_CTL_DMA_SIZE) | BUS_CTL_DMA_BURST));
152 1.3.4.2 thorpej } else { /* use 64K */
153 1.3.4.2 thorpej CS_WRITE_PACKET_PAGE(sc, PKTPG_BUS_CTL,
154 1.3.4.2 thorpej CS_READ_PACKET_PAGE(sc, PKTPG_BUS_CTL) |
155 1.3.4.2 thorpej BUS_CTL_DMA_SIZE | BUS_CTL_DMA_BURST);
156 1.3.4.2 thorpej }
157 1.3.4.2 thorpej
158 1.3.4.2 thorpej CS_WRITE_PACKET_PAGE(sc, PKTPG_DMA_CHANNEL, isc->sc_drq - 5);
159 1.3.4.2 thorpej }
160 1.3.4.2 thorpej }
161 1.3.4.2 thorpej
162 1.3.4.2 thorpej void cs_process_rx_dma(struct cs_softc *sc)
163 1.3.4.2 thorpej {
164 1.3.4.2 thorpej struct cs_softc_isa *isc = (void *)sc;
165 1.3.4.2 thorpej struct ifnet *ifp;
166 1.3.4.2 thorpej u_int16_t num_dma_frames;
167 1.3.4.2 thorpej u_int16_t pkt_length;
168 1.3.4.2 thorpej u_int16_t status;
169 1.3.4.2 thorpej u_int to_copy;
170 1.3.4.2 thorpej char *dma_mem_ptr;
171 1.3.4.2 thorpej struct mbuf *m;
172 1.3.4.2 thorpej u_char *pBuff;
173 1.3.4.2 thorpej int pad;
174 1.3.4.2 thorpej
175 1.3.4.2 thorpej /* initialise the pointers */
176 1.3.4.2 thorpej ifp = &sc->sc_ethercom.ec_if;
177 1.3.4.2 thorpej
178 1.3.4.2 thorpej /* Read the number of frames DMAed. */
179 1.3.4.2 thorpej num_dma_frames = CS_READ_PACKET_PAGE(sc, PKTPG_DMA_FRAME_COUNT);
180 1.3.4.2 thorpej num_dma_frames &= (u_int16_t) (0x0fff);
181 1.3.4.2 thorpej
182 1.3.4.2 thorpej /*
183 1.3.4.2 thorpej * Loop till number of DMA frames ready to read is zero. After
184 1.3.4.2 thorpej * reading the frame out of memory we must check if any have been
185 1.3.4.2 thorpej * received while we were processing
186 1.3.4.2 thorpej */
187 1.3.4.2 thorpej while (num_dma_frames != 0) {
188 1.3.4.2 thorpej dma_mem_ptr = isc->sc_dmacur;
189 1.3.4.2 thorpej
190 1.3.4.2 thorpej /*
191 1.3.4.2 thorpej * process all of the dma frames in memory
192 1.3.4.2 thorpej *
193 1.3.4.2 thorpej * This loop relies on the dma_mem_ptr variable being set to the
194 1.3.4.2 thorpej * next frames start address.
195 1.3.4.2 thorpej */
196 1.3.4.2 thorpej for (; num_dma_frames > 0; num_dma_frames--) {
197 1.3.4.2 thorpej
198 1.3.4.2 thorpej /*
199 1.3.4.2 thorpej * Get the length and status of the packet. Only the
200 1.3.4.2 thorpej * status is guarenteed to be at dma_mem_ptr, ie need
201 1.3.4.2 thorpej * to check for wraparound before reading the length
202 1.3.4.2 thorpej */
203 1.3.4.2 thorpej status = *((unsigned short *) dma_mem_ptr)++;
204 1.3.4.2 thorpej if (dma_mem_ptr > (isc->sc_dmabase + isc->sc_dmasize)) {
205 1.3.4.2 thorpej dma_mem_ptr = isc->sc_dmabase;
206 1.3.4.2 thorpej }
207 1.3.4.2 thorpej pkt_length = *((unsigned short *) dma_mem_ptr)++;
208 1.3.4.2 thorpej
209 1.3.4.2 thorpej /* Do some sanity checks on the length and status. */
210 1.3.4.2 thorpej if ((pkt_length > ETHER_MAX_LEN) ||
211 1.3.4.2 thorpej ((status & DMA_STATUS_BITS) != DMA_STATUS_OK)) {
212 1.3.4.2 thorpej /*
213 1.3.4.2 thorpej * the SCO driver kills the adapter in this
214 1.3.4.2 thorpej * situation
215 1.3.4.2 thorpej */
216 1.3.4.2 thorpej /*
217 1.3.4.2 thorpej * should increment the error count and reset
218 1.3.4.2 thorpej * the dma operation.
219 1.3.4.2 thorpej */
220 1.3.4.2 thorpej printf("%s: cs_process_rx_dma: DMA buffer out of sync about to reset\n",
221 1.3.4.2 thorpej sc->sc_dev.dv_xname);
222 1.3.4.2 thorpej ifp->if_ierrors++;
223 1.3.4.2 thorpej
224 1.3.4.2 thorpej /* skip the rest of the DMA buffer */
225 1.3.4.2 thorpej isa_dmaabort(isc->sc_ic, isc->sc_drq);
226 1.3.4.2 thorpej
227 1.3.4.2 thorpej /* now reset the chip and reinitialise */
228 1.3.4.2 thorpej cs_init(&sc->sc_ethercom.ec_if);
229 1.3.4.2 thorpej return;
230 1.3.4.2 thorpej }
231 1.3.4.2 thorpej /* Check the status of the received packet. */
232 1.3.4.2 thorpej if (status & RX_EVENT_RX_OK) {
233 1.3.4.2 thorpej /* get a new mbuf */
234 1.3.4.2 thorpej MGETHDR(m, M_DONTWAIT, MT_DATA);
235 1.3.4.2 thorpej if (m == 0) {
236 1.3.4.2 thorpej printf("%s: cs_process_rx_dma: unable to allocate mbuf\n",
237 1.3.4.2 thorpej sc->sc_dev.dv_xname);
238 1.3.4.2 thorpej ifp->if_ierrors++;
239 1.3.4.2 thorpej /*
240 1.3.4.2 thorpej * couldn't allocate an mbuf so
241 1.3.4.2 thorpej * things are not good, may as well
242 1.3.4.2 thorpej * drop all the packets I think.
243 1.3.4.2 thorpej */
244 1.3.4.2 thorpej CS_READ_PACKET_PAGE(sc,
245 1.3.4.2 thorpej PKTPG_DMA_FRAME_COUNT);
246 1.3.4.2 thorpej
247 1.3.4.2 thorpej /* now reset DMA operation */
248 1.3.4.2 thorpej isa_dmaabort(isc->sc_ic, isc->sc_drq);
249 1.3.4.2 thorpej
250 1.3.4.2 thorpej /*
251 1.3.4.2 thorpej * now reset the chip and
252 1.3.4.2 thorpej * reinitialise
253 1.3.4.2 thorpej */
254 1.3.4.2 thorpej cs_init(&sc->sc_ethercom.ec_if);
255 1.3.4.2 thorpej return;
256 1.3.4.2 thorpej }
257 1.3.4.2 thorpej /*
258 1.3.4.2 thorpej * save processing by always using a mbuf
259 1.3.4.2 thorpej * cluster, guarenteed to fit packet
260 1.3.4.2 thorpej */
261 1.3.4.2 thorpej MCLGET(m, M_DONTWAIT);
262 1.3.4.2 thorpej if ((m->m_flags & M_EXT) == 0) {
263 1.3.4.2 thorpej /* couldn't allocate an mbuf cluster */
264 1.3.4.2 thorpej printf("%s: cs_process_rx_dma: unable to allocate a cluster\n",
265 1.3.4.2 thorpej sc->sc_dev.dv_xname);
266 1.3.4.2 thorpej m_freem(m);
267 1.3.4.2 thorpej
268 1.3.4.2 thorpej /* skip the frame */
269 1.3.4.2 thorpej CS_READ_PACKET_PAGE(sc, PKTPG_DMA_FRAME_COUNT);
270 1.3.4.2 thorpej isa_dmaabort(isc->sc_ic, isc->sc_drq);
271 1.3.4.2 thorpej
272 1.3.4.2 thorpej /*
273 1.3.4.2 thorpej * now reset the chip and
274 1.3.4.2 thorpej * reinitialise
275 1.3.4.2 thorpej */
276 1.3.4.2 thorpej cs_init(&sc->sc_ethercom.ec_if);
277 1.3.4.2 thorpej return;
278 1.3.4.2 thorpej }
279 1.3.4.2 thorpej m->m_pkthdr.rcvif = ifp;
280 1.3.4.2 thorpej m->m_pkthdr.len = pkt_length;
281 1.3.4.2 thorpej m->m_len = pkt_length;
282 1.3.4.2 thorpej
283 1.3.4.2 thorpej /*
284 1.3.4.2 thorpej * align ip header on word boundary for
285 1.3.4.2 thorpej * ipintr
286 1.3.4.2 thorpej */
287 1.3.4.2 thorpej pad = ALIGN(sizeof(struct ether_header)) -
288 1.3.4.2 thorpej sizeof(struct ether_header);
289 1.3.4.2 thorpej m->m_data += pad;
290 1.3.4.2 thorpej
291 1.3.4.2 thorpej /*
292 1.3.4.2 thorpej * set up the buffer pointer to point to the
293 1.3.4.2 thorpej * data area
294 1.3.4.2 thorpej */
295 1.3.4.2 thorpej pBuff = mtod(m, char *);
296 1.3.4.2 thorpej
297 1.3.4.2 thorpej /*
298 1.3.4.2 thorpej * Read the frame into free_pktbuf
299 1.3.4.2 thorpej * The buffer is circular buffer, either
300 1.3.4.2 thorpej * 16K or 64K in length.
301 1.3.4.2 thorpej *
302 1.3.4.2 thorpej * need to check where the end of the buffer
303 1.3.4.2 thorpej * is and go back to the start.
304 1.3.4.2 thorpej */
305 1.3.4.2 thorpej if ((dma_mem_ptr + pkt_length) <
306 1.3.4.2 thorpej (isc->sc_dmabase + isc->sc_dmasize)) {
307 1.3.4.2 thorpej /*
308 1.3.4.2 thorpej * No wrap around. Copy the frame
309 1.3.4.2 thorpej * header
310 1.3.4.2 thorpej */
311 1.3.4.2 thorpej memcpy(pBuff, dma_mem_ptr, pkt_length);
312 1.3.4.2 thorpej dma_mem_ptr += pkt_length;
313 1.3.4.2 thorpej } else {
314 1.3.4.2 thorpej to_copy = (u_int)
315 1.3.4.2 thorpej ((isc->sc_dmabase + isc->sc_dmasize) -
316 1.3.4.2 thorpej dma_mem_ptr);
317 1.3.4.2 thorpej
318 1.3.4.2 thorpej /* Copy the first half of the frame. */
319 1.3.4.2 thorpej memcpy(pBuff, dma_mem_ptr, to_copy);
320 1.3.4.2 thorpej pBuff += to_copy;
321 1.3.4.2 thorpej
322 1.3.4.2 thorpej /*
323 1.3.4.2 thorpej * Rest of the frame is to be read
324 1.3.4.2 thorpej * from the first byte of the DMA
325 1.3.4.2 thorpej * memory.
326 1.3.4.2 thorpej */
327 1.3.4.2 thorpej /*
328 1.3.4.2 thorpej * Get the number of bytes leftout in
329 1.3.4.2 thorpej * the frame.
330 1.3.4.2 thorpej */
331 1.3.4.2 thorpej to_copy = pkt_length - to_copy;
332 1.3.4.2 thorpej
333 1.3.4.2 thorpej dma_mem_ptr = isc->sc_dmabase;
334 1.3.4.2 thorpej
335 1.3.4.2 thorpej /* Copy rest of the frame. */
336 1.3.4.2 thorpej memcpy(pBuff, dma_mem_ptr, to_copy);
337 1.3.4.2 thorpej dma_mem_ptr += to_copy;
338 1.3.4.2 thorpej }
339 1.3.4.2 thorpej
340 1.3.4.2 thorpej cs_ether_input(sc, m);
341 1.3.4.2 thorpej }
342 1.3.4.2 thorpej /* (status & RX_OK) */
343 1.3.4.2 thorpej else {
344 1.3.4.2 thorpej /* the frame was not received OK */
345 1.3.4.2 thorpej /* Increment the input error count */
346 1.3.4.2 thorpej ifp->if_ierrors++;
347 1.3.4.2 thorpej
348 1.3.4.2 thorpej /*
349 1.3.4.2 thorpej * If debugging is enabled then log error
350 1.3.4.2 thorpej * messages if we got any.
351 1.3.4.2 thorpej */
352 1.3.4.2 thorpej if ((ifp->if_flags & IFF_DEBUG) &&
353 1.3.4.2 thorpej status != REG_NUM_RX_EVENT)
354 1.3.4.2 thorpej cs_print_rx_errors(sc, status);
355 1.3.4.2 thorpej }
356 1.3.4.2 thorpej /*
357 1.3.4.2 thorpej * now update the current frame pointer. the
358 1.3.4.2 thorpej * dma_mem_ptr should point to the next packet to be
359 1.3.4.2 thorpej * received, without the alignment considerations.
360 1.3.4.2 thorpej *
361 1.3.4.2 thorpej * The cs8900 pads all frames to start at the next 32bit
362 1.3.4.2 thorpej * aligned addres. hence we need to pad our offset
363 1.3.4.2 thorpej * pointer.
364 1.3.4.2 thorpej */
365 1.3.4.2 thorpej dma_mem_ptr += 3;
366 1.3.4.2 thorpej dma_mem_ptr = (char *)
367 1.3.4.2 thorpej ((long) dma_mem_ptr & 0xfffffffc);
368 1.3.4.2 thorpej if (dma_mem_ptr < (isc->sc_dmabase + isc->sc_dmasize)) {
369 1.3.4.2 thorpej isc->sc_dmacur = dma_mem_ptr;
370 1.3.4.2 thorpej } else {
371 1.3.4.2 thorpej dma_mem_ptr = isc->sc_dmacur = isc->sc_dmabase;
372 1.3.4.2 thorpej }
373 1.3.4.2 thorpej } /* for all frames */
374 1.3.4.2 thorpej /* Read the number of frames DMAed again. */
375 1.3.4.2 thorpej num_dma_frames = CS_READ_PACKET_PAGE(sc, PKTPG_DMA_FRAME_COUNT);
376 1.3.4.2 thorpej num_dma_frames &= (u_int16_t) (0x0fff);
377 1.3.4.2 thorpej } /* while there are frames left */
378 1.3.4.2 thorpej }
379