Deleted Added
full compact
cfi_disk.c (189654) cfi_disk.c (233553)
1/*-
2 * Copyright (c) 2009 Sam Leffler, Errno Consulting
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

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009 Sam Leffler, Errno Consulting
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

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/dev/cfi/cfi_disk.c 189654 2009-03-10 22:29:42Z sam $");
27__FBSDID("$FreeBSD: head/sys/dev/cfi/cfi_disk.c 233553 2012-03-27 15:13:12Z jchandra $");
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/bio.h>
32#include <sys/bus.h>
33#include <sys/conf.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>

--- 141 unchanged lines hidden (view full) ---

177 bp->bio_flags |= BIO_ERROR;
178 bp->bio_error = EIO;
179 goto done;
180 }
181 resid = bp->bio_bcount;
182 if (sc->sc_width == 1) {
183 uint8_t *dp = (uint8_t *)bp->bio_data;
184 while (resid > 0 && bp->bio_offset < sc->sc_size) {
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/bio.h>
32#include <sys/bus.h>
33#include <sys/conf.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>

--- 141 unchanged lines hidden (view full) ---

177 bp->bio_flags |= BIO_ERROR;
178 bp->bio_error = EIO;
179 goto done;
180 }
181 resid = bp->bio_bcount;
182 if (sc->sc_width == 1) {
183 uint8_t *dp = (uint8_t *)bp->bio_data;
184 while (resid > 0 && bp->bio_offset < sc->sc_size) {
185 *dp++ = cfi_read(sc, bp->bio_offset);
185 *dp++ = cfi_read_raw(sc, bp->bio_offset);
186 bp->bio_offset += 1, resid -= 1;
187 }
188 } else if (sc->sc_width == 2) {
189 uint16_t *dp = (uint16_t *)bp->bio_data;
190 while (resid > 0 && bp->bio_offset < sc->sc_size) {
186 bp->bio_offset += 1, resid -= 1;
187 }
188 } else if (sc->sc_width == 2) {
189 uint16_t *dp = (uint16_t *)bp->bio_data;
190 while (resid > 0 && bp->bio_offset < sc->sc_size) {
191 *dp++ = cfi_read(sc, bp->bio_offset);
191 *dp++ = cfi_read_raw(sc, bp->bio_offset);
192 bp->bio_offset += 2, resid -= 2;
193 }
194 } else {
195 uint32_t *dp = (uint32_t *)bp->bio_data;
196 while (resid > 0 && bp->bio_offset < sc->sc_size) {
192 bp->bio_offset += 2, resid -= 2;
193 }
194 } else {
195 uint32_t *dp = (uint32_t *)bp->bio_data;
196 while (resid > 0 && bp->bio_offset < sc->sc_size) {
197 *dp++ = cfi_read(sc, bp->bio_offset);
197 *dp++ = cfi_read_raw(sc, bp->bio_offset);
198 bp->bio_offset += 4, resid -= 4;
199 }
200 }
201 bp->bio_resid = resid;
202done:
203 biodone(bp);
204}
205

--- 121 unchanged lines hidden ---
198 bp->bio_offset += 4, resid -= 4;
199 }
200 }
201 bp->bio_resid = resid;
202done:
203 biodone(bp);
204}
205

--- 121 unchanged lines hidden ---