| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mvsata.c,v 1.12 2012/01/09 01:01:49 jakllsch Exp $ */ | | 1 | /* $NetBSD: mvsata.c,v 1.13 2012/01/21 18:33:17 jakllsch Exp $ */ |
2 | /* | | 2 | /* |
3 | * Copyright (c) 2008 KIYOHARA Takashi | | 3 | * Copyright (c) 2008 KIYOHARA Takashi |
4 | * All rights reserved. | | 4 | * All rights reserved. |
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 | * |
| @@ -16,27 +16,27 @@ | | | @@ -16,27 +16,27 @@ |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | | 18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
23 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | 23 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
24 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 24 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 | * POSSIBILITY OF SUCH DAMAGE. | | 25 | * POSSIBILITY OF SUCH DAMAGE. |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.12 2012/01/09 01:01:49 jakllsch Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.13 2012/01/21 18:33:17 jakllsch Exp $"); |
30 | | | 30 | |
31 | #include "opt_mvsata.h" | | 31 | #include "opt_mvsata.h" |
32 | | | 32 | |
33 | /* ATAPI implementation not finished. Also don't work shadow registers? */ | | 33 | /* ATAPI implementation not finished. Also don't work shadow registers? */ |
34 | //#include "atapibus.h" | | 34 | //#include "atapibus.h" |
35 | | | 35 | |
36 | #include <sys/param.h> | | 36 | #include <sys/param.h> |
37 | #if NATAPIBUS > 0 | | 37 | #if NATAPIBUS > 0 |
38 | #include <sys/buf.h> | | 38 | #include <sys/buf.h> |
39 | #endif | | 39 | #endif |
40 | #include <sys/bus.h> | | 40 | #include <sys/bus.h> |
41 | #include <sys/cpu.h> | | 41 | #include <sys/cpu.h> |
42 | #include <sys/device.h> | | 42 | #include <sys/device.h> |
| @@ -1591,28 +1591,28 @@ mvsata_wdc_cmd_intr(struct ata_channel * | | | @@ -1591,28 +1591,28 @@ mvsata_wdc_cmd_intr(struct ata_channel * |
1591 | if ((ata_c->flags & (AT_WAIT | AT_POLL)) == (AT_WAIT | AT_POLL)) | | 1591 | if ((ata_c->flags & (AT_WAIT | AT_POLL)) == (AT_WAIT | AT_POLL)) |
1592 | /* both wait and poll, we can tsleep here */ | | 1592 | /* both wait and poll, we can tsleep here */ |
1593 | wflags = AT_WAIT | AT_POLL; | | 1593 | wflags = AT_WAIT | AT_POLL; |
1594 | else | | 1594 | else |
1595 | wflags = AT_POLL; | | 1595 | wflags = AT_POLL; |
1596 | | | 1596 | |
1597 | again: | | 1597 | again: |
1598 | DPRINTFN(1, ("%s:%d: mvsata_cmd_intr: drive=%d\n", | | 1598 | DPRINTFN(1, ("%s:%d: mvsata_cmd_intr: drive=%d\n", |
1599 | device_xname(MVSATA_DEV2(mvport)), chp->ch_channel, xfer->c_drive)); | | 1599 | device_xname(MVSATA_DEV2(mvport)), chp->ch_channel, xfer->c_drive)); |
1600 | | | 1600 | |
1601 | /* | | 1601 | /* |
1602 | * after a ATAPI_SOFT_RESET, the device will have released the bus. | | 1602 | * after a ATAPI_SOFT_RESET, the device will have released the bus. |
1603 | * Reselect again, it doesn't hurt for others commands, and the time | | 1603 | * Reselect again, it doesn't hurt for others commands, and the time |
1604 | * penalty for the extra regiter write is acceptable, | | 1604 | * penalty for the extra register write is acceptable, |
1605 | * wdc_exec_command() isn't called often (mosly for autoconfig) | | 1605 | * wdc_exec_command() isn't called often (mostly for autoconfig) |
1606 | */ | | 1606 | */ |
1607 | MVSATA_WDC_WRITE_1(mvport, SRB_H, WDSD_IBM); | | 1607 | MVSATA_WDC_WRITE_1(mvport, SRB_H, WDSD_IBM); |
1608 | if ((ata_c->flags & AT_XFDONE) != 0) { | | 1608 | if ((ata_c->flags & AT_XFDONE) != 0) { |
1609 | /* | | 1609 | /* |
1610 | * We have completed a data xfer. The drive should now be | | 1610 | * We have completed a data xfer. The drive should now be |
1611 | * in its initial state | | 1611 | * in its initial state |
1612 | */ | | 1612 | */ |
1613 | if (wdcwait(chp, ata_c->r_st_bmask | WDCS_DRQ, | | 1613 | if (wdcwait(chp, ata_c->r_st_bmask | WDCS_DRQ, |
1614 | ata_c->r_st_bmask, (irq == 0) ? ata_c->timeout : 0, | | 1614 | ata_c->r_st_bmask, (irq == 0) ? ata_c->timeout : 0, |
1615 | wflags) == WDCWAIT_TOUT) { | | 1615 | wflags) == WDCWAIT_TOUT) { |
1616 | if (irq && (xfer->c_flags & C_TIMEOU) == 0) | | 1616 | if (irq && (xfer->c_flags & C_TIMEOU) == 0) |
1617 | return 0; /* IRQ was not for us */ | | 1617 | return 0; /* IRQ was not for us */ |
1618 | ata_c->flags |= AT_TIMEOU; | | 1618 | ata_c->flags |= AT_TIMEOU; |