Deleted Added
sdiff udiff text old ( 139749 ) new ( 151894 )
full compact
1/*-
2 * Copyright (C) 2002 Benno Rice <benno@FreeBSD.org>
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

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

21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 *
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_disk.c 151894 2005-10-31 03:09:38Z grehan $");
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/bio.h>
34#include <sys/kernel.h>
35#include <sys/kthread.h>
36#include <sys/linker.h>
37#include <sys/lock.h>

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

77TUNABLE_INT("kern.ofw.disk", &ofwd_enable);
78
79static int
80ofwd_startio(struct ofwd_softc *sc, struct bio *bp)
81{
82 u_int r;
83
84 r = OF_seek(sc->ofwd_instance, bp->bio_offset);
85
86 switch (bp->bio_cmd) {
87 case BIO_READ:
88 r = OF_read(sc->ofwd_instance, (void *)bp->bio_data,
89 bp->bio_length);
90 break;
91 case BIO_WRITE:
92 r = OF_write(sc->ofwd_instance, (void *)bp->bio_data,
93 bp->bio_length);

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

160 return;
161 }
162
163 sc = (struct ofwd_softc *)malloc(sizeof *sc, M_DEVBUF,
164 M_WAITOK|M_ZERO);
165 bioq_init(&sc->ofwd_bio_queue);
166 mtx_init(&sc->ofwd_queue_mtx, "ofwd bio queue", NULL, MTX_DEF);
167 sc->ofwd_instance = ifd;
168 sc->ofwd_mediasize = (off_t)2*33554432;
169 sc->ofwd_sectorsize = OFWD_BLOCKSIZE;
170 sc->ofwd_fwsectors = 0;
171 sc->ofwd_fwheads = 0;
172 error = kthread_create(ofwd_kthread, sc, &sc->ofwd_procp, 0, 0,
173 "ofwd0");
174 if (error != 0) {
175 free(sc, M_DEVBUF);
176 return;

--- 32 unchanged lines hidden ---