cfi_dev.c (222198) | cfi_dev.c (233553) |
---|---|
1/*- 2 * Copyright (c) 2007, Juniper Networks, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007, Juniper Networks, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/cfi/cfi_dev.c 222198 2011-05-22 20:55:54Z attilio $"); | 31__FBSDID("$FreeBSD: head/sys/dev/cfi/cfi_dev.c 233553 2012-03-27 15:13:12Z jchandra $"); |
32 33#include "opt_cfi.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/bus.h> 38#include <sys/conf.h> 39#include <sys/ioccom.h> --- 58 unchanged lines hidden (view full) --- 98 99 sc->sc_wrbufsz = sc->sc_region[r].r_blksz; 100 sc->sc_wrbuf = malloc(sc->sc_wrbufsz, M_TEMP, M_WAITOK); 101 sc->sc_wrofs = ofs - (ofs - rofs) % sc->sc_wrbufsz; 102 103 /* Read the block from flash for byte-serving. */ 104 ptr.x8 = sc->sc_wrbuf; 105 for (r = 0; r < sc->sc_wrbufsz; r += sc->sc_width) { | 32 33#include "opt_cfi.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/bus.h> 38#include <sys/conf.h> 39#include <sys/ioccom.h> --- 58 unchanged lines hidden (view full) --- 98 99 sc->sc_wrbufsz = sc->sc_region[r].r_blksz; 100 sc->sc_wrbuf = malloc(sc->sc_wrbufsz, M_TEMP, M_WAITOK); 101 sc->sc_wrofs = ofs - (ofs - rofs) % sc->sc_wrbufsz; 102 103 /* Read the block from flash for byte-serving. */ 104 ptr.x8 = sc->sc_wrbuf; 105 for (r = 0; r < sc->sc_wrbufsz; r += sc->sc_width) { |
106 val = cfi_read(sc, sc->sc_wrofs + r); | 106 val = cfi_read_raw(sc, sc->sc_wrofs + r); |
107 switch (sc->sc_width) { 108 case 1: 109 *(ptr.x8)++ = val; 110 break; 111 case 2: 112 *(ptr.x16)++ = val; 113 break; 114 case 4: --- 69 unchanged lines hidden (view full) --- 184 185 error = (sc->sc_writing) ? cfi_block_finish(sc) : 0; 186 if (!error) 187 error = (uio->uio_offset > sc->sc_size) ? EIO : 0; 188 189 while (error == 0 && uio->uio_resid > 0 && 190 uio->uio_offset < sc->sc_size) { 191 ofs = uio->uio_offset; | 107 switch (sc->sc_width) { 108 case 1: 109 *(ptr.x8)++ = val; 110 break; 111 case 2: 112 *(ptr.x16)++ = val; 113 break; 114 case 4: --- 69 unchanged lines hidden (view full) --- 184 185 error = (sc->sc_writing) ? cfi_block_finish(sc) : 0; 186 if (!error) 187 error = (uio->uio_offset > sc->sc_size) ? EIO : 0; 188 189 while (error == 0 && uio->uio_resid > 0 && 190 uio->uio_offset < sc->sc_size) { 191 ofs = uio->uio_offset; |
192 val = cfi_read(sc, ofs); | 192 val = cfi_read_raw(sc, ofs); |
193 switch (sc->sc_width) { 194 case 1: 195 buf.x8[0] = val; 196 break; 197 case 2: 198 buf.x16[0] = val; 199 break; 200 case 4: --- 101 unchanged lines hidden --- | 193 switch (sc->sc_width) { 194 case 1: 195 buf.x8[0] = val; 196 break; 197 case 2: 198 buf.x16[0] = val; 199 break; 200 case 4: --- 101 unchanged lines hidden --- |