mlx_disk.c (59136) | mlx_disk.c (59249) |
---|---|
1/*- 2 * Copyright (c) 1999 Jonathan Lemon 3 * Copyright (c) 1999 Michael Smith 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 1999 Jonathan Lemon 3 * Copyright (c) 1999 Michael Smith 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/dev/mlx/mlx_disk.c 59136 2000-04-11 02:52:46Z msmith $ | 27 * $FreeBSD: head/sys/dev/mlx/mlx_disk.c 59249 2000-04-15 05:54:02Z phk $ |
28 */ 29 30/* 31 * Disk driver for Mylex DAC960 RAID adapters. 32 */ 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 124 unchanged lines hidden (view full) --- 160 161/* 162 * Read/write routine for a buffer. Finds the proper unit, range checks 163 * arguments, and schedules the transfer. Does not wait for the transfer 164 * to complete. Multi-page transfers are supported. All I/O requests must 165 * be a multiple of a sector in length. 166 */ 167static void | 28 */ 29 30/* 31 * Disk driver for Mylex DAC960 RAID adapters. 32 */ 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 124 unchanged lines hidden (view full) --- 160 161/* 162 * Read/write routine for a buffer. Finds the proper unit, range checks 163 * arguments, and schedules the transfer. Does not wait for the transfer 164 * to complete. Multi-page transfers are supported. All I/O requests must 165 * be a multiple of a sector in length. 166 */ 167static void |
168mlxd_strategy(struct buf *bp) | 168mlxd_strategy(struct bio *bp) |
169{ | 169{ |
170 struct mlxd_softc *sc = (struct mlxd_softc *)bp->b_dev->si_drv1; | 170 struct mlxd_softc *sc = (struct mlxd_softc *)bp->bio_dev->si_drv1; |
171 172 debug_called(1); 173 174 /* bogus disk? */ 175 if (sc == NULL) { | 171 172 debug_called(1); 173 174 /* bogus disk? */ 175 if (sc == NULL) { |
176 bp->b_error = EINVAL; | 176 bp->bio_error = EINVAL; |
177 goto bad; 178 } 179 180 /* XXX may only be temporarily offline - sleep? */ 181 if (sc->mlxd_drive->ms_state == MLX_SYSD_OFFLINE) { | 177 goto bad; 178 } 179 180 /* XXX may only be temporarily offline - sleep? */ 181 if (sc->mlxd_drive->ms_state == MLX_SYSD_OFFLINE) { |
182 bp->b_error = ENXIO; | 182 bp->bio_error = ENXIO; |
183 goto bad; 184 } 185 186 /* do-nothing operation */ | 183 goto bad; 184 } 185 186 /* do-nothing operation */ |
187 if (bp->b_bcount == 0) | 187 if (bp->bio_bcount == 0) |
188 goto done; 189 190 devstat_start_transaction(&sc->mlxd_stats); 191 mlx_submit_buf(sc->mlxd_controller, bp); 192 return; 193 194 bad: | 188 goto done; 189 190 devstat_start_transaction(&sc->mlxd_stats); 191 mlx_submit_buf(sc->mlxd_controller, bp); 192 return; 193 194 bad: |
195 bp->b_ioflags |= BIO_ERROR; | 195 bp->bio_flags |= BIO_ERROR; |
196 197 done: 198 /* 199 * Correctly set the buf to indicate a completed transfer 200 */ | 196 197 done: 198 /* 199 * Correctly set the buf to indicate a completed transfer 200 */ |
201 bp->b_resid = bp->b_bcount; | 201 bp->bio_resid = bp->bio_bcount; |
202 biodone(bp); 203 return; 204} 205 206void 207mlxd_intr(void *data) 208{ | 202 biodone(bp); 203 return; 204} 205 206void 207mlxd_intr(void *data) 208{ |
209 struct buf *bp = (struct buf *)data; 210 struct mlxd_softc *sc = (struct mlxd_softc *)bp->b_dev->si_drv1; | 209 struct bio *bp = (struct bio *)data; 210 struct mlxd_softc *sc = (struct mlxd_softc *)bp->bio_dev->si_drv1; |
211 212 debug_called(1); 213 | 211 212 debug_called(1); 213 |
214 if (bp->b_ioflags & BIO_ERROR) 215 bp->b_error = EIO; | 214 if (bp->bio_flags & BIO_ERROR) 215 bp->bio_error = EIO; |
216 else | 216 else |
217 bp->b_resid = 0; | 217 bp->bio_resid = 0; |
218 | 218 |
219 devstat_end_transaction_buf(&sc->mlxd_stats, bp); | 219 devstat_end_transaction_bio(&sc->mlxd_stats, bp); |
220 biodone(bp); 221} 222 223static int 224mlxd_probe(device_t dev) 225{ 226 227 debug_called(1); --- 67 unchanged lines hidden --- | 220 biodone(bp); 221} 222 223static int 224mlxd_probe(device_t dev) 225{ 226 227 debug_called(1); --- 67 unchanged lines hidden --- |