Date: Sat, 15 Dec 2007 18:19:30 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 130966 for review Message-ID: <200712151819.lBFIJUQi097714@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=130966 Change 130966 by hselasky@hselasky_laptop001 on 2007/12/15 18:19:21 Reintroduce support for non KVA to UCOM layer. Reverts change 130019 . Affected files ... .. //depot/projects/usb/src/sys/dev/usb/ucom.c#26 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/ucom.c#26 (text+ko) ==== @@ -1023,8 +1023,10 @@ ucom_get_data(struct ucom_softc *sc, struct usbd_page_cache *pc, uint32_t offset, uint32_t len, uint32_t *actlen) { + struct usbd_page_search res; struct tty *tp = sc->sc_tty; uint32_t cnt; + uint32_t offset_orig; mtx_assert(sc->sc_parent_mtx, MA_OWNED); @@ -1054,9 +1056,27 @@ DPRINTF(0, "stopped\n"); goto done; } - cnt = q_to_b(&(tp->t_outq), usbd_get_buffer(pc, offset), len); + offset_orig = offset; + + while (len != 0) { + + usbd_get_page(pc, offset, &res); + + if (res.length > len) { + res.length = len; + } + cnt = q_to_b(&(tp->t_outq), res.buffer, res.length); + + offset += cnt; + len -= cnt; + + if (cnt < res.length) { + /* end of buffer */ + break; + } + } - actlen[0] = cnt; + actlen[0] = offset - offset_orig; DPRINTF(0, "cnt=%d\n", actlen[0]); @@ -1079,8 +1099,8 @@ ucom_put_data(struct ucom_softc *sc, struct usbd_page_cache *pc, uint32_t offset, uint32_t len) { + struct usbd_page_search res; struct tty *tp = sc->sc_tty; - uint8_t *buf; uint32_t cnt; mtx_assert(sc->sc_parent_mtx, MA_OWNED); @@ -1091,19 +1111,28 @@ } /* set a flag to prevent recursation ? */ - buf = usbd_get_buffer(pc, offset); + while (len > 0) { + + usbd_get_page(pc, offset, &res); + + if (res.length > len) { + res.length = len; + } + len -= res.length; + offset += res.length; if (tp->t_state & TS_CAN_BYPASS_L_RINT) { - if (((tp->t_rawq.c_cc + len) > tp->t_ihiwat) && + if (((tp->t_rawq.c_cc + res.length) > tp->t_ihiwat) && ((sc->sc_flag & UCOM_FLAG_RTS_IFLOW) || (tp->t_iflag & IXOFF)) && (!(tp->t_state & TS_TBLOCK))) { ttyblock(tp); } - cnt = b_to_q(buf, len, &(tp->t_rawq)); + + cnt = b_to_q(res.buffer, res.length, &(tp->t_rawq)); - tp->t_rawcc += len; + tp->t_rawcc += res.length; ttwakeup(tp); @@ -1120,20 +1149,25 @@ } } else { + uint8_t *buf; + /* pass characters to tty layer */ - for (cnt = 0; cnt != len; cnt++) { + buf = res.buffer; + + for (cnt = 0; cnt != res.length; cnt++) { if (ttyld_rint(tp, buf[cnt]) == -1) { /* XXX what should we do? */ DPRINTF(0, "tp=%p, lost %d " - "chars\n", tp, len - cnt); + "chars\n", tp, res.length - cnt); break; } } } + } if ((sc->sc_flag & UCOM_FLAG_RTS_IFLOW) && (!(sc->sc_mcr & SER_RTS)) &&
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712151819.lBFIJUQi097714>