Lines Matching refs:cookie
150 struct isadma_bounce_cookie *cookie;
153 if ((cookie = kmem_zalloc(isadma_bounce_cookiesize(map, cookieflags),
158 cookie->id_flags = cookieflags;
159 map->_dm_cookie = cookie;
167 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
169 if (cookie != NULL) {
171 isadma_bounce_cookiesize(map, cookie->id_flags));
183 struct isadma_bounce_cookie *cookie;
197 * Allocate our cookie.
202 cookie = map->_dm_cookie;
204 if (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) {
229 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
234 if (cookie->id_flags & ID_HAS_BOUNCE)
248 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
262 if (error == 0 || (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0)
272 if ((cookie->id_flags & ID_HAS_BOUNCE) == 0) {
282 cookie->id_origbuf = buf;
283 cookie->id_origbuflen = buflen;
284 cookie->id_buftype = ID_BUFTYPE_LINEAR;
285 error = _bus_dmamap_load_direct(t, map, cookie->id_bouncebuf, buflen,
298 cookie->id_flags |= ID_IS_BOUNCING;
310 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
332 if (error == 0 || (cookie->id_flags & ID_MIGHT_NEED_BOUNCE) == 0)
342 if ((cookie->id_flags & ID_HAS_BOUNCE) == 0) {
353 cookie->id_origbuf = m0;
354 cookie->id_origbuflen = m0->m_pkthdr.len; /* not really used */
355 cookie->id_buftype = ID_BUFTYPE_MBUF;
356 error = _bus_dmamap_load_direct(t, map, cookie->id_bouncebuf,
369 cookie->id_flags |= ID_IS_BOUNCING;
403 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
409 if ((cookie->id_flags & ID_HAS_BOUNCE) &&
413 cookie->id_flags &= ~ID_IS_BOUNCING;
414 cookie->id_buftype = ID_BUFTYPE_INVALID;
429 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
451 if ((cookie->id_flags & ID_IS_BOUNCING) == 0) {
456 switch (cookie->id_buftype) {
466 memcpy((char *)cookie->id_bouncebuf + offset,
467 (char *)cookie->id_origbuf + offset, len);
474 memcpy((char *)cookie->id_origbuf + offset,
475 (char *)cookie->id_bouncebuf + offset, len);
485 struct mbuf *m, *m0 = cookie->id_origbuf;
497 (char *)cookie->id_bouncebuf + offset);
521 (char *)cookie->id_bouncebuf + offset,
549 printf("unknown buffer type %d\n", cookie->id_buftype);
584 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
587 cookie->id_bouncebuflen = round_page(size);
588 error = isadma_bounce_dmamem_alloc(t, cookie->id_bouncebuflen,
589 PAGE_SIZE, map->_dm_boundary, cookie->id_bouncesegs,
590 map->_dm_segcnt, &cookie->id_nbouncesegs, flags);
593 error = _bus_dmamem_map(t, cookie->id_bouncesegs,
594 cookie->id_nbouncesegs, cookie->id_bouncebuflen,
595 (void **)&cookie->id_bouncebuf, flags);
599 _bus_dmamem_free(t, cookie->id_bouncesegs,
600 cookie->id_nbouncesegs);
601 cookie->id_bouncebuflen = 0;
602 cookie->id_nbouncesegs = 0;
604 cookie->id_flags |= ID_HAS_BOUNCE;
612 struct isadma_bounce_cookie *cookie = map->_dm_cookie;
614 _bus_dmamem_unmap(t, cookie->id_bouncebuf,
615 cookie->id_bouncebuflen);
616 _bus_dmamem_free(t, cookie->id_bouncesegs,
617 cookie->id_nbouncesegs);
618 cookie->id_bouncebuflen = 0;
619 cookie->id_nbouncesegs = 0;
620 cookie->id_flags &= ~ID_HAS_BOUNCE;