| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ata_wdc.c,v 1.94 2011/08/27 17:05:57 bouyer Exp $ */ | | 1 | /* $NetBSD: ata_wdc.c,v 1.95 2011/08/28 09:43:25 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. | | 4 | * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -44,27 +44,27 @@ | | | @@ -44,27 +44,27 @@ |
44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
53 | * POSSIBILITY OF SUCH DAMAGE. | | 53 | * POSSIBILITY OF SUCH DAMAGE. |
54 | */ | | 54 | */ |
55 | | | 55 | |
56 | #include <sys/cdefs.h> | | 56 | #include <sys/cdefs.h> |
57 | __KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.94 2011/08/27 17:05:57 bouyer Exp $"); | | 57 | __KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.95 2011/08/28 09:43:25 christos Exp $"); |
58 | | | 58 | |
59 | #include "opt_ata.h" | | 59 | #include "opt_ata.h" |
60 | #include "opt_wdc.h" | | 60 | #include "opt_wdc.h" |
61 | | | 61 | |
62 | #include <sys/param.h> | | 62 | #include <sys/param.h> |
63 | #include <sys/systm.h> | | 63 | #include <sys/systm.h> |
64 | #include <sys/kernel.h> | | 64 | #include <sys/kernel.h> |
65 | #include <sys/file.h> | | 65 | #include <sys/file.h> |
66 | #include <sys/stat.h> | | 66 | #include <sys/stat.h> |
67 | #include <sys/buf.h> | | 67 | #include <sys/buf.h> |
68 | #include <sys/bufq.h> | | 68 | #include <sys/bufq.h> |
69 | #include <sys/malloc.h> | | 69 | #include <sys/malloc.h> |
70 | #include <sys/device.h> | | 70 | #include <sys/device.h> |
| @@ -169,32 +169,32 @@ wdc_ata_bio(struct ata_drive_datas *drvp | | | @@ -169,32 +169,32 @@ wdc_ata_bio(struct ata_drive_datas *drvp |
169 | xfer->c_kill_xfer = wdc_ata_bio_kill_xfer; | | 169 | xfer->c_kill_xfer = wdc_ata_bio_kill_xfer; |
170 | ata_exec_xfer(chp, xfer); | | 170 | ata_exec_xfer(chp, xfer); |
171 | return (ata_bio->flags & ATA_ITSDONE) ? ATACMD_COMPLETE : ATACMD_QUEUED; | | 171 | return (ata_bio->flags & ATA_ITSDONE) ? ATACMD_COMPLETE : ATACMD_QUEUED; |
172 | } | | 172 | } |
173 | | | 173 | |
174 | static void | | 174 | static void |
175 | wdc_ata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer) | | 175 | wdc_ata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer) |
176 | { | | 176 | { |
177 | struct atac_softc *atac = chp->ch_atac; | | 177 | struct atac_softc *atac = chp->ch_atac; |
178 | struct wdc_softc *wdc = CHAN_TO_WDC(chp); | | 178 | struct wdc_softc *wdc = CHAN_TO_WDC(chp); |
179 | struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; | | 179 | struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; |
180 | struct ata_bio *ata_bio = xfer->c_cmd; | | 180 | struct ata_bio *ata_bio = xfer->c_cmd; |
181 | struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; | | 181 | struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; |
182 | int wait_flags = (xfer->c_flags & C_POLL) ? AT_POLL : 0; | | 182 | int wait_flags; |
183 | const char *errstring; | | 183 | const char *errstring; |
184 | #ifdef WDC_NO_IDS | | 184 | #ifdef WDC_NO_IDS |
185 | wait_flags = AT_POLL; | | 185 | wait_flags = AT_POLL; |
186 | #else | | 186 | #else |
187 | #error "NEED WDC_NO_IDS" | | 187 | wait_flags = (xfer->c_flags & C_POLL) ? AT_POLL : 0; |
188 | #endif | | 188 | #endif |
189 | | | 189 | |
190 | ATADEBUG_PRINT(("wdc_ata_bio_start %s:%d:%d\n", | | 190 | ATADEBUG_PRINT(("wdc_ata_bio_start %s:%d:%d\n", |
191 | device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive), | | 191 | device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive), |
192 | DEBUG_XFERS); | | 192 | DEBUG_XFERS); |
193 | | | 193 | |
194 | /* Do control operations specially. */ | | 194 | /* Do control operations specially. */ |
195 | if (__predict_false(drvp->state < READY)) { | | 195 | if (__predict_false(drvp->state < READY)) { |
196 | /* | | 196 | /* |
197 | * Actually, we want to be careful not to mess with the control | | 197 | * Actually, we want to be careful not to mess with the control |
198 | * state if the device is currently busy, but we can assume | | 198 | * state if the device is currently busy, but we can assume |
199 | * that we never get to this point if that's the case. | | 199 | * that we never get to this point if that's the case. |
200 | */ | | 200 | */ |