if_le_ioasic.c revision 1.16 1 1.16 nisimura /* $NetBSD: if_le_ioasic.c,v 1.16 2000/07/11 04:10:25 nisimura Exp $ */
2 1.1 cgd
3 1.1 cgd /*
4 1.1 cgd * Copyright (c) 1996 Carnegie-Mellon University.
5 1.1 cgd * All rights reserved.
6 1.1 cgd *
7 1.1 cgd * Author: Chris G. Demetriou
8 1.1 cgd *
9 1.1 cgd * Permission to use, copy, modify and distribute this software and
10 1.1 cgd * its documentation is hereby granted, provided that both the copyright
11 1.1 cgd * notice and this permission notice appear in all copies of the
12 1.1 cgd * software, derivative works or modified versions, and any portions
13 1.1 cgd * thereof, and that both notices appear in supporting documentation.
14 1.1 cgd *
15 1.1 cgd * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 1.1 cgd * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 1.1 cgd * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 1.1 cgd *
19 1.1 cgd * Carnegie Mellon requests users of this software to return to
20 1.1 cgd *
21 1.1 cgd * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 1.1 cgd * School of Computer Science
23 1.1 cgd * Carnegie Mellon University
24 1.1 cgd * Pittsburgh PA 15213-3890
25 1.1 cgd *
26 1.1 cgd * any improvements or extensions that they make and grant Carnegie the
27 1.1 cgd * rights to redistribute these changes.
28 1.1 cgd */
29 1.1 cgd
30 1.1 cgd /*
31 1.1 cgd * LANCE on DEC IOCTL ASIC.
32 1.1 cgd */
33 1.9 jonathan
34 1.9 jonathan #include <sys/cdefs.h> /* RCS ID & macro defns */
35 1.16 nisimura __KERNEL_RCSID(0, "$NetBSD: if_le_ioasic.c,v 1.16 2000/07/11 04:10:25 nisimura Exp $");
36 1.11 jonathan
37 1.11 jonathan #include "opt_inet.h"
38 1.1 cgd
39 1.1 cgd #include <sys/param.h>
40 1.1 cgd #include <sys/systm.h>
41 1.1 cgd #include <sys/mbuf.h>
42 1.1 cgd #include <sys/syslog.h>
43 1.1 cgd #include <sys/socket.h>
44 1.1 cgd #include <sys/device.h>
45 1.1 cgd
46 1.1 cgd #include <net/if.h>
47 1.5 cgd #include <net/if_ether.h>
48 1.6 thorpej #include <net/if_media.h>
49 1.1 cgd
50 1.1 cgd #ifdef INET
51 1.1 cgd #include <netinet/in.h>
52 1.4 is #include <netinet/if_inarp.h>
53 1.1 cgd #endif
54 1.1 cgd
55 1.12 drochner #include <dev/ic/lancereg.h>
56 1.12 drochner #include <dev/ic/lancevar.h>
57 1.1 cgd #include <dev/ic/am7990reg.h>
58 1.1 cgd #include <dev/ic/am7990var.h>
59 1.1 cgd
60 1.2 thorpej #include <dev/tc/if_levar.h>
61 1.1 cgd #include <dev/tc/tcvar.h>
62 1.13 nisimura #include <dev/tc/ioasicreg.h>
63 1.1 cgd #include <dev/tc/ioasicvar.h>
64 1.1 cgd
65 1.16 nisimura struct le_ioasic_softc {
66 1.16 nisimura struct am7990_softc sc_am7990; /* glue to MI code */
67 1.16 nisimura struct lereg1 *sc_r1; /* LANCE registers */
68 1.16 nisimura /* XXX must match with le_softc of if_levar.h XXX */
69 1.12 drochner
70 1.16 nisimura bus_dma_tag_t sc_dmat; /* bus dma tag */
71 1.16 nisimura bus_dmamap_t sc_dmamap; /* bus dmamap */
72 1.16 nisimura };
73 1.13 nisimura
74 1.13 nisimura static int le_ioasic_match __P((struct device *, struct cfdata *, void *));
75 1.13 nisimura static void le_ioasic_attach __P((struct device *, struct device *, void *));
76 1.13 nisimura
77 1.13 nisimura struct cfattach le_ioasic_ca = {
78 1.13 nisimura sizeof(struct le_softc), le_ioasic_match, le_ioasic_attach
79 1.13 nisimura };
80 1.13 nisimura
81 1.16 nisimura static void le_ioasic_copytobuf_gap2 __P((struct lance_softc *, void *,
82 1.2 thorpej int, int));
83 1.16 nisimura static void le_ioasic_copyfrombuf_gap2 __P((struct lance_softc *, void *,
84 1.2 thorpej int, int));
85 1.16 nisimura static void le_ioasic_copytobuf_gap16 __P((struct lance_softc *, void *,
86 1.2 thorpej int, int));
87 1.16 nisimura static void le_ioasic_copyfrombuf_gap16 __P((struct lance_softc *, void *,
88 1.2 thorpej int, int));
89 1.16 nisimura static void le_ioasic_zerobuf_gap16 __P((struct lance_softc *, int, int));
90 1.2 thorpej
91 1.16 nisimura static int
92 1.1 cgd le_ioasic_match(parent, match, aux)
93 1.1 cgd struct device *parent;
94 1.3 cgd struct cfdata *match;
95 1.3 cgd void *aux;
96 1.1 cgd {
97 1.1 cgd struct ioasicdev_attach_args *d = aux;
98 1.1 cgd
99 1.16 nisimura if (strncmp("PMAD-BA ", d->iada_modname, TC_ROM_LLEN) != 0)
100 1.16 nisimura return 0;
101 1.1 cgd
102 1.16 nisimura return 1;
103 1.1 cgd }
104 1.1 cgd
105 1.16 nisimura /* IOASIC LANCE DMA needs 128KB boundary aligned 128KB chunk */
106 1.16 nisimura #define LE_IOASIC_MEMSIZE (128*1024)
107 1.16 nisimura #define LE_IOASIC_MEMALIGN (128*1024)
108 1.16 nisimura
109 1.16 nisimura static void
110 1.1 cgd le_ioasic_attach(parent, self, aux)
111 1.1 cgd struct device *parent, *self;
112 1.1 cgd void *aux;
113 1.1 cgd {
114 1.16 nisimura struct le_ioasic_softc *sc = (void *)self;
115 1.1 cgd struct ioasicdev_attach_args *d = aux;
116 1.16 nisimura struct lance_softc *le = &sc->sc_am7990.lsc;
117 1.16 nisimura bus_space_tag_t ioasic_bst;
118 1.16 nisimura bus_space_handle_t ioasic_bsh;
119 1.16 nisimura bus_dma_tag_t dmat;
120 1.16 nisimura bus_dma_segment_t seg;
121 1.16 nisimura tc_addr_t tca;
122 1.16 nisimura u_int32_t ssr;
123 1.16 nisimura int rseg;
124 1.16 nisimura caddr_t le_iomem;
125 1.1 cgd
126 1.16 nisimura ioasic_bst = ((struct ioasic_softc *)parent)->sc_bst;
127 1.16 nisimura ioasic_bsh = ((struct ioasic_softc *)parent)->sc_bsh;
128 1.16 nisimura dmat = sc->sc_dmat = ((struct ioasic_softc *)parent)->sc_dmat;
129 1.16 nisimura /*
130 1.16 nisimura * Allocate a DMA area for the chip.
131 1.16 nisimura */
132 1.16 nisimura if (bus_dmamem_alloc(dmat, LE_IOASIC_MEMSIZE, LE_IOASIC_MEMALIGN,
133 1.16 nisimura 0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) {
134 1.16 nisimura printf("can't allocate DMA area for LANCE\n");
135 1.16 nisimura return;
136 1.16 nisimura }
137 1.16 nisimura if (bus_dmamem_map(dmat, &seg, rseg, LE_IOASIC_MEMSIZE,
138 1.16 nisimura &le_iomem, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
139 1.16 nisimura printf("can't map DMA area for LANCE\n");
140 1.16 nisimura bus_dmamem_free(dmat, &seg, rseg);
141 1.13 nisimura return;
142 1.13 nisimura }
143 1.16 nisimura /*
144 1.16 nisimura * Create and load the DMA map for the DMA area.
145 1.16 nisimura */
146 1.16 nisimura if (bus_dmamap_create(dmat, LE_IOASIC_MEMSIZE, 1,
147 1.16 nisimura LE_IOASIC_MEMSIZE, 0, BUS_DMA_NOWAIT, &sc->sc_dmamap)) {
148 1.16 nisimura printf("can't create DMA map\n");
149 1.16 nisimura goto bad;
150 1.16 nisimura }
151 1.16 nisimura if (bus_dmamap_load(dmat, sc->sc_dmamap,
152 1.16 nisimura le_iomem, LE_IOASIC_MEMSIZE, NULL, BUS_DMA_NOWAIT)) {
153 1.16 nisimura printf("can't load DMA map\n");
154 1.16 nisimura goto bad;
155 1.16 nisimura }
156 1.16 nisimura /*
157 1.16 nisimura * Bind 128KB buffer with IOASIC DMA.
158 1.16 nisimura */
159 1.16 nisimura tca = (tc_addr_t)sc->sc_dmamap->dm_segs[0].ds_addr;
160 1.16 nisimura tca = ((tca << 3) & ~0x1f) | ((tca >> 29) & 0x1f);
161 1.16 nisimura bus_space_write_4(ioasic_bst, ioasic_bsh, IOASIC_LANCE_DMAPTR, tca);
162 1.16 nisimura ssr = bus_space_read_4(ioasic_bst, ioasic_bsh, IOASIC_CSR);
163 1.16 nisimura ssr |= IOASIC_CSR_DMAEN_LANCE;
164 1.16 nisimura bus_space_write_4(ioasic_bst, ioasic_bsh, IOASIC_CSR, ssr);
165 1.13 nisimura
166 1.16 nisimura sc->sc_r1 = (struct lereg1 *)
167 1.1 cgd TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->iada_addr));
168 1.16 nisimura le->sc_mem = (void *)TC_PHYS_TO_UNCACHED(le_iomem);
169 1.16 nisimura le->sc_copytodesc = le_ioasic_copytobuf_gap2;
170 1.16 nisimura le->sc_copyfromdesc = le_ioasic_copyfrombuf_gap2;
171 1.16 nisimura le->sc_copytobuf = le_ioasic_copytobuf_gap16;
172 1.16 nisimura le->sc_copyfrombuf = le_ioasic_copyfrombuf_gap16;
173 1.16 nisimura le->sc_zerobuf = le_ioasic_zerobuf_gap16;
174 1.16 nisimura
175 1.16 nisimura dec_le_common_attach(&sc->sc_am7990,
176 1.16 nisimura (u_char *)((struct ioasic_softc *)parent)->sc_base
177 1.16 nisimura + IOASIC_SLOT_2_START);
178 1.1 cgd
179 1.2 thorpej ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_NET,
180 1.2 thorpej am7990_intr, sc);
181 1.16 nisimura return;
182 1.16 nisimura
183 1.16 nisimura bad:
184 1.16 nisimura bus_dmamem_unmap(dmat, le_iomem, LE_IOASIC_MEMSIZE);
185 1.16 nisimura bus_dmamem_free(dmat, &seg, rseg);
186 1.2 thorpej }
187 1.2 thorpej
188 1.2 thorpej /*
189 1.2 thorpej * Special memory access functions needed by ioasic-attached LANCE
190 1.2 thorpej * chips.
191 1.2 thorpej */
192 1.2 thorpej
193 1.2 thorpej /*
194 1.2 thorpej * gap2: two bytes of data followed by two bytes of pad.
195 1.2 thorpej *
196 1.2 thorpej * Buffers must be 4-byte aligned. The code doesn't worry about
197 1.2 thorpej * doing an extra byte.
198 1.2 thorpej */
199 1.2 thorpej
200 1.2 thorpej void
201 1.2 thorpej le_ioasic_copytobuf_gap2(sc, fromv, boff, len)
202 1.12 drochner struct lance_softc *sc;
203 1.2 thorpej void *fromv;
204 1.2 thorpej int boff;
205 1.15 augustss int len;
206 1.2 thorpej {
207 1.2 thorpej volatile caddr_t buf = sc->sc_mem;
208 1.15 augustss caddr_t from = fromv;
209 1.15 augustss volatile u_int16_t *bptr;
210 1.2 thorpej
211 1.2 thorpej if (boff & 0x1) {
212 1.2 thorpej /* handle unaligned first byte */
213 1.2 thorpej bptr = ((volatile u_int16_t *)buf) + (boff - 1);
214 1.2 thorpej *bptr = (*from++ << 8) | (*bptr & 0xff);
215 1.2 thorpej bptr += 2;
216 1.2 thorpej len--;
217 1.2 thorpej } else
218 1.2 thorpej bptr = ((volatile u_int16_t *)buf) + boff;
219 1.2 thorpej while (len > 1) {
220 1.2 thorpej *bptr = (from[1] << 8) | (from[0] & 0xff);
221 1.2 thorpej bptr += 2;
222 1.2 thorpej from += 2;
223 1.2 thorpej len -= 2;
224 1.2 thorpej }
225 1.2 thorpej if (len == 1)
226 1.2 thorpej *bptr = (u_int16_t)*from;
227 1.2 thorpej }
228 1.2 thorpej
229 1.2 thorpej void
230 1.2 thorpej le_ioasic_copyfrombuf_gap2(sc, tov, boff, len)
231 1.12 drochner struct lance_softc *sc;
232 1.2 thorpej void *tov;
233 1.2 thorpej int boff, len;
234 1.2 thorpej {
235 1.2 thorpej volatile caddr_t buf = sc->sc_mem;
236 1.15 augustss caddr_t to = tov;
237 1.15 augustss volatile u_int16_t *bptr;
238 1.15 augustss u_int16_t tmp;
239 1.2 thorpej
240 1.2 thorpej if (boff & 0x1) {
241 1.2 thorpej /* handle unaligned first byte */
242 1.2 thorpej bptr = ((volatile u_int16_t *)buf) + (boff - 1);
243 1.2 thorpej *to++ = (*bptr >> 8) & 0xff;
244 1.2 thorpej bptr += 2;
245 1.2 thorpej len--;
246 1.2 thorpej } else
247 1.2 thorpej bptr = ((volatile u_int16_t *)buf) + boff;
248 1.2 thorpej while (len > 1) {
249 1.2 thorpej tmp = *bptr;
250 1.2 thorpej *to++ = tmp & 0xff;
251 1.2 thorpej *to++ = (tmp >> 8) & 0xff;
252 1.2 thorpej bptr += 2;
253 1.2 thorpej len -= 2;
254 1.2 thorpej }
255 1.2 thorpej if (len == 1)
256 1.2 thorpej *to = *bptr & 0xff;
257 1.2 thorpej }
258 1.2 thorpej
259 1.2 thorpej /*
260 1.2 thorpej * gap16: 16 bytes of data followed by 16 bytes of pad.
261 1.2 thorpej *
262 1.2 thorpej * Buffers must be 32-byte aligned.
263 1.2 thorpej */
264 1.2 thorpej
265 1.2 thorpej void
266 1.2 thorpej le_ioasic_copytobuf_gap16(sc, fromv, boff, len)
267 1.12 drochner struct lance_softc *sc;
268 1.2 thorpej void *fromv;
269 1.2 thorpej int boff;
270 1.15 augustss int len;
271 1.2 thorpej {
272 1.2 thorpej volatile caddr_t buf = sc->sc_mem;
273 1.15 augustss caddr_t from = fromv;
274 1.15 augustss caddr_t bptr;
275 1.2 thorpej
276 1.2 thorpej bptr = buf + ((boff << 1) & ~0x1f);
277 1.2 thorpej boff &= 0xf;
278 1.8 jonathan
279 1.8 jonathan /*
280 1.8 jonathan * Dispose of boff so destination of subsequent copies is
281 1.8 jonathan * 16-byte aligned.
282 1.8 jonathan */
283 1.8 jonathan if (boff) {
284 1.15 augustss int xfer;
285 1.8 jonathan xfer = min(len, 16 - boff);
286 1.2 thorpej bcopy(from, bptr + boff, xfer);
287 1.2 thorpej from += xfer;
288 1.2 thorpej bptr += 32;
289 1.2 thorpej len -= xfer;
290 1.2 thorpej }
291 1.8 jonathan
292 1.8 jonathan /* Destination of copies is now 16-byte aligned. */
293 1.8 jonathan if (len >= 16)
294 1.8 jonathan switch ((u_long)from & (sizeof(u_int32_t) -1)) {
295 1.8 jonathan case 2:
296 1.8 jonathan /* Ethernet headers make this the dominant case. */
297 1.8 jonathan do {
298 1.15 augustss u_int32_t *dst = (u_int32_t*)bptr;
299 1.15 augustss u_int16_t t0;
300 1.15 augustss u_int32_t t1, t2, t3, t4;
301 1.8 jonathan
302 1.8 jonathan /* read from odd-16-bit-aligned, cached src */
303 1.8 jonathan t0 = *(u_int16_t*)from;
304 1.8 jonathan t1 = *(u_int32_t*)(from+2);
305 1.8 jonathan t2 = *(u_int32_t*)(from+6);
306 1.8 jonathan t3 = *(u_int32_t*)(from+10);
307 1.8 jonathan t4 = *(u_int16_t*)(from+14);
308 1.8 jonathan
309 1.8 jonathan /* DMA buffer is uncached on mips */
310 1.8 jonathan dst[0] = t0 | (t1 << 16);
311 1.8 jonathan dst[1] = (t1 >> 16) | (t2 << 16);
312 1.8 jonathan dst[2] = (t2 >> 16) | (t3 << 16);
313 1.8 jonathan dst[3] = (t3 >> 16) | (t4 << 16);
314 1.8 jonathan
315 1.8 jonathan from += 16;
316 1.8 jonathan bptr += 32;
317 1.8 jonathan len -= 16;
318 1.8 jonathan } while (len >= 16);
319 1.8 jonathan break;
320 1.8 jonathan
321 1.8 jonathan case 0:
322 1.8 jonathan do {
323 1.15 augustss u_int32_t *src = (u_int32_t*)from;
324 1.15 augustss u_int32_t *dst = (u_int32_t*)bptr;
325 1.15 augustss u_int32_t t0, t1, t2, t3;
326 1.8 jonathan
327 1.8 jonathan t0 = src[0]; t1 = src[1]; t2 = src[2]; t3 = src[3];
328 1.8 jonathan dst[0] = t0; dst[1] = t1; dst[2] = t2; dst[3] = t3;
329 1.8 jonathan
330 1.8 jonathan from += 16;
331 1.8 jonathan bptr += 32;
332 1.8 jonathan len -= 16;
333 1.8 jonathan } while (len >= 16);
334 1.8 jonathan break;
335 1.8 jonathan
336 1.8 jonathan default:
337 1.8 jonathan /* Does odd-aligned case ever happen? */
338 1.8 jonathan do {
339 1.8 jonathan bcopy(from, bptr, 16);
340 1.8 jonathan from += 16;
341 1.8 jonathan bptr += 32;
342 1.8 jonathan len -= 16;
343 1.8 jonathan } while (len >= 16);
344 1.8 jonathan break;
345 1.8 jonathan }
346 1.8 jonathan if (len)
347 1.8 jonathan bcopy(from, bptr, len);
348 1.2 thorpej }
349 1.2 thorpej
350 1.2 thorpej void
351 1.2 thorpej le_ioasic_copyfrombuf_gap16(sc, tov, boff, len)
352 1.12 drochner struct lance_softc *sc;
353 1.2 thorpej void *tov;
354 1.2 thorpej int boff, len;
355 1.2 thorpej {
356 1.2 thorpej volatile caddr_t buf = sc->sc_mem;
357 1.15 augustss caddr_t to = tov;
358 1.15 augustss caddr_t bptr;
359 1.2 thorpej
360 1.2 thorpej bptr = buf + ((boff << 1) & ~0x1f);
361 1.2 thorpej boff &= 0xf;
362 1.8 jonathan
363 1.8 jonathan /* Dispose of boff. source of copy is subsequently 16-byte aligned. */
364 1.8 jonathan if (boff) {
365 1.15 augustss int xfer;
366 1.8 jonathan xfer = min(len, 16 - boff);
367 1.8 jonathan bcopy(bptr+boff, to, xfer);
368 1.2 thorpej to += xfer;
369 1.2 thorpej bptr += 32;
370 1.2 thorpej len -= xfer;
371 1.2 thorpej }
372 1.8 jonathan if (len >= 16)
373 1.8 jonathan switch ((u_long)to & (sizeof(u_int32_t) -1)) {
374 1.8 jonathan case 2:
375 1.8 jonathan /*
376 1.8 jonathan * to is aligned to an odd 16-bit boundary. Ethernet headers
377 1.8 jonathan * make this the dominant case (98% or more).
378 1.8 jonathan */
379 1.8 jonathan do {
380 1.15 augustss u_int32_t *src = (u_int32_t*)bptr;
381 1.15 augustss u_int32_t t0, t1, t2, t3;
382 1.8 jonathan
383 1.8 jonathan /* read from uncached aligned DMA buf */
384 1.8 jonathan t0 = src[0]; t1 = src[1]; t2 = src[2]; t3 = src[3];
385 1.8 jonathan
386 1.8 jonathan /* write to odd-16-bit-word aligned dst */
387 1.8 jonathan *(u_int16_t *) (to+0) = (u_short) t0;
388 1.8 jonathan *(u_int32_t *) (to+2) = (t0 >> 16) | (t1 << 16);
389 1.8 jonathan *(u_int32_t *) (to+6) = (t1 >> 16) | (t2 << 16);
390 1.8 jonathan *(u_int32_t *) (to+10) = (t2 >> 16) | (t3 << 16);
391 1.8 jonathan *(u_int16_t *) (to+14) = (t3 >> 16);
392 1.8 jonathan bptr += 32;
393 1.8 jonathan to += 16;
394 1.8 jonathan len -= 16;
395 1.8 jonathan } while (len > 16);
396 1.8 jonathan break;
397 1.8 jonathan case 0:
398 1.8 jonathan /* 32-bit aligned aligned copy. Rare. */
399 1.8 jonathan do {
400 1.15 augustss u_int32_t *src = (u_int32_t*)bptr;
401 1.15 augustss u_int32_t *dst = (u_int32_t*)to;
402 1.15 augustss u_int32_t t0, t1, t2, t3;
403 1.8 jonathan
404 1.8 jonathan t0 = src[0]; t1 = src[1]; t2 = src[2]; t3 = src[3];
405 1.8 jonathan dst[0] = t0; dst[1] = t1; dst[2] = t2; dst[3] = t3;
406 1.8 jonathan to += 16;
407 1.8 jonathan bptr += 32;
408 1.8 jonathan len -= 16;
409 1.8 jonathan } while (len > 16);
410 1.8 jonathan break;
411 1.8 jonathan
412 1.8 jonathan /* XXX Does odd-byte-aligned case ever happen? */
413 1.8 jonathan default:
414 1.8 jonathan do {
415 1.8 jonathan bcopy(bptr, to, 16);
416 1.8 jonathan to += 16;
417 1.8 jonathan bptr += 32;
418 1.8 jonathan len -= 16;
419 1.8 jonathan } while (len > 16);
420 1.8 jonathan break;
421 1.8 jonathan }
422 1.8 jonathan if (len)
423 1.8 jonathan bcopy(bptr, to, len);
424 1.2 thorpej }
425 1.2 thorpej
426 1.2 thorpej void
427 1.2 thorpej le_ioasic_zerobuf_gap16(sc, boff, len)
428 1.12 drochner struct lance_softc *sc;
429 1.2 thorpej int boff, len;
430 1.2 thorpej {
431 1.2 thorpej volatile caddr_t buf = sc->sc_mem;
432 1.15 augustss caddr_t bptr;
433 1.15 augustss int xfer;
434 1.2 thorpej
435 1.2 thorpej bptr = buf + ((boff << 1) & ~0x1f);
436 1.2 thorpej boff &= 0xf;
437 1.2 thorpej xfer = min(len, 16 - boff);
438 1.2 thorpej while (len > 0) {
439 1.2 thorpej bzero(bptr + boff, xfer);
440 1.2 thorpej bptr += 32;
441 1.2 thorpej boff = 0;
442 1.2 thorpej len -= xfer;
443 1.2 thorpej xfer = min(len, 16);
444 1.2 thorpej }
445 1.1 cgd }
446