From owner-svn-src-all@FreeBSD.ORG Mon Nov 11 10:00:20 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1890223A; Mon, 11 Nov 2013 10:00:20 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 06427286A; Mon, 11 Nov 2013 10:00:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rABA0JgA089707; Mon, 11 Nov 2013 10:00:19 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rABA0Jxw089706; Mon, 11 Nov 2013 10:00:19 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201311111000.rABA0Jxw089706@svn.freebsd.org> From: Kevin Lo Date: Mon, 11 Nov 2013 10:00:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257958 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Nov 2013 10:00:20 -0000 Author: kevlo Date: Mon Nov 11 10:00:19 2013 New Revision: 257958 URL: http://svnweb.freebsd.org/changeset/base/257958 Log: Remove r257748 by accident. Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Mon Nov 11 09:48:57 2013 (r257957) +++ head/sys/dev/usb/wlan/if_run.c Mon Nov 11 10:00:19 2013 (r257958) @@ -1180,13 +1180,32 @@ run_write_region_1(struct run_softc *sc, return (error); #else usb_device_request_t req; + int error = 0; - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = RT2870_WRITE_REGION_1; - USETW(req.wValue, 0); - USETW(req.wIndex, reg); - USETW(req.wLength, len); - return (run_do_request(sc, &req, buf)); + /* + * NOTE: It appears the WRITE_REGION_1 command cannot be + * passed a huge amount of data, which will crash the + * firmware. Limit amount of data passed to 64-bytes at a + * time. + */ + while (len > 0) { + int delta = 64; + if (delta > len) + delta = len; + + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; + req.bRequest = RT2870_WRITE_REGION_1; + USETW(req.wValue, 0); + USETW(req.wIndex, reg); + USETW(req.wLength, delta); + error = run_do_request(sc, &req, __DECONST(uint8_t *, buf)); + if (error != 0) + break; + reg += delta; + buf += delta; + len -= delta; + } + return (error); #endif }