From owner-p4-projects@FreeBSD.ORG Tue Jan 16 19:00:22 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 60B9D16A47C; Tue, 16 Jan 2007 19:00:22 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A5DB16A412 for ; Tue, 16 Jan 2007 19:00:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id E848113C46A for ; Tue, 16 Jan 2007 19:00:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l0GJ0L1d097829 for ; Tue, 16 Jan 2007 19:00:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0GJ0LMB097826 for perforce@freebsd.org; Tue, 16 Jan 2007 19:00:21 GMT (envelope-from hselasky@FreeBSD.org) Date: Tue, 16 Jan 2007 19:00:21 GMT Message-Id: <200701161900.l0GJ0LMB097826@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 113011 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2007 19:00:22 -0000 http://perforce.freebsd.org/chv.cgi?CH=113011 Change 113011 by hselasky@hselasky_mini_itx on 2007/01/16 18:59:40 Update if_aue so that it works with newer device revisions, starting at bcdDevice = 0x0201. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/if_aue.c#16 edit .. //depot/projects/usb/src/sys/dev/usb/if_auereg.h#11 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/if_aue.c#16 (text+ko) ==== @@ -816,6 +816,10 @@ sc->sc_product = uaa->product; sc->sc_vendor = uaa->vendor; + if (uaa->release >= 0x0201) { + sc->sc_flags |= AUE_FLAG_VER_2; /* XXX currently undocumented */ + } + usbd_set_desc(dev, uaa->device); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", @@ -1120,28 +1124,39 @@ return; tr_transferred: + DPRINTF(sc, 10, "received %d bytes\n", xfer->actlen); - if (xfer->actlen <= (4 + ETHER_CRC_LEN)) { - ifp->if_ierrors++; - goto tr_setup; - } + if (sc->sc_flags & AUE_FLAG_VER_2) { + + if (xfer->actlen == 0) { + ifp->if_ierrors++; + goto tr_setup; + } + + } else { + + if (xfer->actlen <= (4 + ETHER_CRC_LEN)) { + ifp->if_ierrors++; + goto tr_setup; + } + + usbd_copy_out(&(xfer->buf_data), xfer->actlen - 4, &(sc->sc_rxpkt), + sizeof(sc->sc_rxpkt)); - usbd_copy_out(&(xfer->buf_data), xfer->actlen - 4, &(sc->sc_rxpkt), - sizeof(sc->sc_rxpkt)); + /* turn off all the non-error bits + * in the rx status word: + */ + sc->sc_rxpkt.aue_rxstat &= AUE_RXSTAT_MASK; - /* turn off all the non-error bits - * in the rx status word: - */ - sc->sc_rxpkt.aue_rxstat &= AUE_RXSTAT_MASK; + if (sc->sc_rxpkt.aue_rxstat) { + ifp->if_ierrors++; + goto tr_setup; + } - if (sc->sc_rxpkt.aue_rxstat) { - ifp->if_ierrors++; - goto tr_setup; + /* No errors; receive the packet. */ + xfer->actlen -= (4 + ETHER_CRC_LEN); } - /* No errors; receive the packet. */ - xfer->actlen -= (4 + ETHER_CRC_LEN); - m = usbd_ether_get_mbuf(); if (m == NULL) { @@ -1221,7 +1236,7 @@ return; tr_transferred: - DPRINTF(sc, 10, "transfer complete\n"); + DPRINTF(sc, 10, "transfer of %d bytes complete\n", xfer->actlen); ifp->if_opackets++; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1250,21 +1265,31 @@ m->m_pkthdr.len = MCLBYTES; } - xfer->length = (m->m_pkthdr.len + 2); + if (sc->sc_flags & AUE_FLAG_VER_2) { + + xfer->length = m->m_pkthdr.len; + + usbd_m_copy_in(&(xfer->buf_data), 0, + m, 0, m->m_pkthdr.len); + + } else { + + xfer->length = (m->m_pkthdr.len + 2); - /* - * The ADMtek documentation says that the packet length is - * supposed to be specified in the first two bytes of the - * transfer, however it actually seems to ignore this info - * and base the frame size on the bulk transfer length. - */ - buf[0] = (u_int8_t)(m->m_pkthdr.len); - buf[1] = (u_int8_t)(m->m_pkthdr.len >> 8); + /* + * The ADMtek documentation says that the packet length is + * supposed to be specified in the first two bytes of the + * transfer, however it actually seems to ignore this info + * and base the frame size on the bulk transfer length. + */ + buf[0] = (u_int8_t)(m->m_pkthdr.len); + buf[1] = (u_int8_t)(m->m_pkthdr.len >> 8); - usbd_copy_in(&(xfer->buf_data), 0, buf, 2); + usbd_copy_in(&(xfer->buf_data), 0, buf, 2); - usbd_m_copy_in(&(xfer->buf_data), 2, - m, 0, m->m_pkthdr.len); + usbd_m_copy_in(&(xfer->buf_data), 2, + m, 0, m->m_pkthdr.len); + } /* * if there's a BPF listener, bounce a copy ==== //depot/projects/usb/src/sys/dev/usb/if_auereg.h#11 (text+ko) ==== @@ -227,6 +227,7 @@ #define AUE_FLAG_LL_READY 0x0040 /* Lower Layer Ready */ #define AUE_FLAG_HL_READY 0x0080 /* Higher Layer Ready */ #define AUE_FLAG_INTR_STALL 0x0100 /* wait for clearing of stall */ +#define AUE_FLAG_VER_2 0x0200 /* chip is version 2 */ uint8_t sc_name[16]; };