Lines Matching refs:cookie
168 struct isadma_bounce_cookie *cookie;
171 if ((cookie = kmem_zalloc(isadma_bounce_cookiesize(map, cookieflags),
176 cookie->id_flags = cookieflags;
177 map->_dm_cookie = cookie;
185 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
187 if (cookie != NULL) {
189 isadma_bounce_cookiesize(map, cookie->id_flags));
221 struct isadma_bounce_cookie *cookie;
235 * Allocate our cookie.
240 cookie = map->_dm_cookie;
242 if (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) {
267 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
272 if (cookie->id_flags & ID_HAS_BOUNCE)
286 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
300 if (error == 0 || (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0)
310 if ((cookie->id_flags & ID_HAS_BOUNCE) == 0) {
320 cookie->id_origbuf = buf;
321 cookie->id_origbuflen = buflen;
322 cookie->id_buftype = ID_BUFTYPE_LINEAR;
323 error = _bus_dmamap_load(t, map, cookie->id_bouncebuf, buflen,
336 cookie->id_flags |= ID_IS_BOUNCING;
347 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
369 if (error == 0 || (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0)
379 if ((cookie->id_flags & ID_HAS_BOUNCE) == 0) {
390 cookie->id_origbuf = m0;
391 cookie->id_origbuflen = m0->m_pkthdr.len; /* not really used */
392 cookie->id_buftype = ID_BUFTYPE_MBUF;
393 error = _bus_dmamap_load(t, map, cookie->id_bouncebuf,
406 cookie->id_flags |= ID_IS_BOUNCING;
439 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
445 if ((cookie->id_flags & ID_HAS_BOUNCE) &&
449 cookie->id_flags &= ~ID_IS_BOUNCING;
450 cookie->id_buftype = ID_BUFTYPE_INVALID;
465 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
490 if ((cookie->id_flags & ID_IS_BOUNCING) == 0) {
504 switch (cookie->id_buftype) {
514 memcpy((char *)cookie->id_bouncebuf + offset,
515 (char *)cookie->id_origbuf + offset, len);
522 memcpy((char *)cookie->id_origbuf + offset,
523 (char *)cookie->id_bouncebuf + offset, len);
533 struct mbuf *m, *m0 = cookie->id_origbuf;
545 (char *)cookie->id_bouncebuf + offset);
569 (char *)cookie->id_bouncebuf + offset,
597 printf("unknown buffer type %d\n", cookie->id_buftype);
632 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
635 cookie->id_bouncebuflen = round_page(size);
636 error = isadma_bounce_dmamem_alloc(t, cookie->id_bouncebuflen,
637 PAGE_SIZE, map->_dm_boundary, cookie->id_bouncesegs,
638 map->_dm_segcnt, &cookie->id_nbouncesegs, flags);
641 error = _bus_dmamem_map(t, cookie->id_bouncesegs,
642 cookie->id_nbouncesegs, cookie->id_bouncebuflen,
643 (void **)&cookie->id_bouncebuf, flags);
647 _bus_dmamem_free(t, cookie->id_bouncesegs,
648 cookie->id_nbouncesegs);
649 cookie->id_bouncebuflen = 0;
650 cookie->id_nbouncesegs = 0;
652 cookie->id_flags |= ID_HAS_BOUNCE;
660 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
662 _bus_dmamem_unmap(t, cookie->id_bouncebuf,
663 cookie->id_bouncebuflen);
664 _bus_dmamem_free(t, cookie->id_bouncesegs,
665 cookie->id_nbouncesegs);
666 cookie->id_bouncebuflen = 0;
667 cookie->id_nbouncesegs = 0;
668 cookie->id_flags &= ~ID_HAS_BOUNCE;