ida_disk.c (59213) | ida_disk.c (59249) |
---|---|
1/*- 2 * Copyright (c) 1999,2000 Jonathan Lemon 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999,2000 Jonathan Lemon 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/ida/ida_disk.c 59213 2000-04-13 23:42:55Z jlemon $ | 26 * $FreeBSD: head/sys/dev/ida/ida_disk.c 59249 2000-04-15 05:54:02Z phk $ |
27 */ 28 29/* 30 * Disk driver for Compaq SMART RAID adapters. 31 */ 32 33#include <sys/param.h> 34#include <sys/systm.h> --- 109 unchanged lines hidden (view full) --- 144 145/* 146 * Read/write routine for a buffer. Finds the proper unit, range checks 147 * arguments, and schedules the transfer. Does not wait for the transfer 148 * to complete. Multi-page transfers are supported. All I/O requests must 149 * be a multiple of a sector in length. 150 */ 151static void | 27 */ 28 29/* 30 * Disk driver for Compaq SMART RAID adapters. 31 */ 32 33#include <sys/param.h> 34#include <sys/systm.h> --- 109 unchanged lines hidden (view full) --- 144 145/* 146 * Read/write routine for a buffer. Finds the proper unit, range checks 147 * arguments, and schedules the transfer. Does not wait for the transfer 148 * to complete. Multi-page transfers are supported. All I/O requests must 149 * be a multiple of a sector in length. 150 */ 151static void |
152idstrategy(struct buf *bp) | 152idstrategy(struct bio *bp) |
153{ 154 struct id_softc *drv; 155 int s; 156 | 153{ 154 struct id_softc *drv; 155 int s; 156 |
157 drv = idgetsoftc(bp->b_dev); | 157 drv = idgetsoftc(bp->bio_dev); |
158 if (drv == NULL) { | 158 if (drv == NULL) { |
159 bp->b_error = EINVAL; | 159 bp->bio_error = EINVAL; |
160 goto bad; 161 } 162 163 /* 164 * software write protect check 165 */ | 160 goto bad; 161 } 162 163 /* 164 * software write protect check 165 */ |
166 if (drv->flags & DRV_WRITEPROT && (bp->b_iocmd == BIO_WRITE)) { 167 bp->b_error = EROFS; | 166 if (drv->flags & DRV_WRITEPROT && (bp->bio_cmd == BIO_WRITE)) { 167 bp->bio_error = EROFS; |
168 goto bad; 169 } 170 171 /* 172 * If it's a null transfer, return immediately 173 */ | 168 goto bad; 169 } 170 171 /* 172 * If it's a null transfer, return immediately 173 */ |
174 if (bp->b_bcount == 0) | 174 if (bp->bio_bcount == 0) |
175 goto done; 176 | 175 goto done; 176 |
177 bp->b_driver1 = drv; | 177 bp->bio_driver1 = drv; |
178 s = splbio(); 179 devstat_start_transaction(&drv->stats); 180 ida_submit_buf(drv->controller, bp); 181 splx(s); 182 return; 183 184bad: | 178 s = splbio(); 179 devstat_start_transaction(&drv->stats); 180 ida_submit_buf(drv->controller, bp); 181 splx(s); 182 return; 183 184bad: |
185 bp->b_ioflags |= BIO_ERROR; | 185 bp->bio_flags |= BIO_ERROR; |
186 187done: 188 /* 189 * Correctly set the buf to indicate a completed transfer 190 */ | 186 187done: 188 /* 189 * Correctly set the buf to indicate a completed transfer 190 */ |
191 bp->b_resid = bp->b_bcount; | 191 bp->bio_resid = bp->bio_bcount; |
192 biodone(bp); 193 return; 194} 195 196void | 192 biodone(bp); 193 return; 194} 195 196void |
197id_intr(struct buf *bp) | 197id_intr(struct bio *bp) |
198{ | 198{ |
199 struct id_softc *drv = (struct id_softc *)bp->b_driver1; | 199 struct id_softc *drv = (struct id_softc *)bp->bio_driver1; |
200 | 200 |
201 if (bp->b_ioflags & BIO_ERROR) 202 bp->b_error = EIO; | 201 if (bp->bio_flags & BIO_ERROR) 202 bp->bio_error = EIO; |
203 else | 203 else |
204 bp->b_resid = 0; | 204 bp->bio_resid = 0; |
205 | 205 |
206 devstat_end_transaction_buf(&drv->stats, bp); | 206 devstat_end_transaction_bio(&drv->stats, bp); |
207 biodone(bp); 208} 209 210static int 211idprobe(device_t dev) 212{ 213 214 device_set_desc(dev, "Compaq Logical Drive"); --- 66 unchanged lines hidden --- | 207 biodone(bp); 208} 209 210static int 211idprobe(device_t dev) 212{ 213 214 device_set_desc(dev, "Compaq Logical Drive"); --- 66 unchanged lines hidden --- |