From owner-svn-src-all@freebsd.org Sun Mar 18 15:56:10 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5B93F5E938; Sun, 18 Mar 2018 15:56:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7944A77F54; Sun, 18 Mar 2018 15:56:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7413622820; Sun, 18 Mar 2018 15:56:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2IFuAXb046017; Sun, 18 Mar 2018 15:56:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2IFuA9d046016; Sun, 18 Mar 2018 15:56:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201803181556.w2IFuA9d046016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Mar 2018 15:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331123 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 331123 X-SVN-Commit-Repository: base 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.25 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: Sun, 18 Mar 2018 15:56:10 -0000 Author: ian Date: Sun Mar 18 15:56:10 2018 New Revision: 331123 URL: https://svnweb.freebsd.org/changeset/base/331123 Log: Do not overwrite the contents of BIO_WRITE buffers. SPI inherently transfers data in both directions at once. When writing to the device, use a dummy buffer for the incoming data, not the same buffer as the outgoing data. Writes are done in FLASH_PAGE_SIZE chunks, which is only 256 bytes, so just put the dummy buffer into the softc. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 15:44:07 2018 (r331122) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 15:56:10 2018 (r331123) @@ -90,6 +90,7 @@ struct mx25l_softc struct bio_queue_head sc_bio_queue; unsigned int sc_flags; unsigned int sc_taskstate; + uint8_t sc_dummybuf[FLASH_PAGE_SIZE]; }; #define TSTATE_STOPPED 0 @@ -344,7 +345,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, cmd.rx_cmd = rxBuf; cmd.tx_data = data + bytes_writen; cmd.tx_data_sz = bytes_to_write; - cmd.rx_data = data + bytes_writen; + cmd.rx_data = sc->sc_dummybuf; cmd.rx_data_sz = bytes_to_write; /*