| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ld_thunkbus.c,v 1.22 2011/12/13 15:50:17 reinoud Exp $ */ | | 1 | /* $NetBSD: ld_thunkbus.c,v 1.23 2011/12/13 15:53:47 reinoud Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> | | 4 | * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.22 2011/12/13 15:50:17 reinoud Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.23 2011/12/13 15:53:47 reinoud Exp $"); |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/proc.h> | | 33 | #include <sys/proc.h> |
34 | #include <sys/systm.h> | | 34 | #include <sys/systm.h> |
35 | #include <sys/device.h> | | 35 | #include <sys/device.h> |
36 | #include <sys/buf.h> | | 36 | #include <sys/buf.h> |
37 | #include <sys/disk.h> | | 37 | #include <sys/disk.h> |
38 | #include <sys/kmem.h> | | 38 | #include <sys/kmem.h> |
39 | | | 39 | |
40 | #include <dev/ldvar.h> | | 40 | #include <dev/ldvar.h> |
41 | | | 41 | |
42 | #include <machine/mainbus.h> | | 42 | #include <machine/mainbus.h> |
43 | #include <machine/thunk.h> | | 43 | #include <machine/thunk.h> |
| @@ -119,37 +119,35 @@ ld_thunkbus_attach(device_t parent, devi | | | @@ -119,37 +119,35 @@ ld_thunkbus_attach(device_t parent, devi |
119 | sc->sc_ih = softint_establish(SOFTINT_BIO, | | 119 | sc->sc_ih = softint_establish(SOFTINT_BIO, |
120 | ld_thunkbus_complete, ld); | | 120 | ld_thunkbus_complete, ld); |
121 | | | 121 | |
122 | sc->busy = false; | | 122 | sc->busy = false; |
123 | | | 123 | |
124 | ldattach(ld); | | 124 | ldattach(ld); |
125 | } | | 125 | } |
126 | | | 126 | |
127 | static int | | 127 | static int |
128 | ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp) | | 128 | ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp) |
129 | { | | 129 | { |
130 | struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; | | 130 | struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; |
131 | struct ld_thunkbus_transfer *tt = &sc->sc_tt; | | 131 | struct ld_thunkbus_transfer *tt = &sc->sc_tt; |
132 | int error; | | | |
133 | | | 132 | |
134 | tt->tt_sc = sc; | | 133 | tt->tt_sc = sc; |
135 | tt->tt_bp = bp; | | 134 | tt->tt_bp = bp; |
136 | | | 135 | |
137 | /* let the softint do the work */ | | 136 | /* let the softint do the work */ |
138 | sc->busy = true; | | 137 | sc->busy = true; |
139 | spl_intr(IPL_BIO, softint_schedule, sc->sc_ih); | | 138 | spl_intr(IPL_BIO, softint_schedule, sc->sc_ih); |
140 | error = 0; | | | |
141 | | | 139 | |
142 | return error == -1 ? thunk_geterrno() : 0; | | 140 | return 0; |
143 | } | | 141 | } |
144 | | | 142 | |
145 | static void | | 143 | static void |
146 | ld_thunkbus_complete(void *arg) | | 144 | ld_thunkbus_complete(void *arg) |
147 | { | | 145 | { |
148 | struct ld_softc *ld = arg; | | 146 | struct ld_softc *ld = arg; |
149 | struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; | | 147 | struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; |
150 | struct ld_thunkbus_transfer *tt = &sc->sc_tt; | | 148 | struct ld_thunkbus_transfer *tt = &sc->sc_tt; |
151 | struct buf *bp = tt->tt_bp; | | 149 | struct buf *bp = tt->tt_bp; |
152 | off_t offset = bp->b_rawblkno * ld->sc_secsize; | | 150 | off_t offset = bp->b_rawblkno * ld->sc_secsize; |
153 | size_t ret; | | 151 | size_t ret; |
154 | | | 152 | |
155 | if (!sc->busy) | | 153 | if (!sc->busy) |