Use designated initializers for struct ata_bustypediff -r1.118 -r1.119 src/sys/dev/ata/ata_wdc.c
(skrll)
--- src/sys/dev/ata/ata_wdc.c 2020/05/21 09:11:33 1.118
+++ src/sys/dev/ata/ata_wdc.c 2020/12/25 08:55:40 1.119
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ata_wdc.c,v 1.118 2020/05/21 09:11:33 jdolecek Exp $ */ | 1 | /* $NetBSD: ata_wdc.c,v 1.119 2020/12/25 08:55:40 skrll 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.118 2020/05/21 09:11:33 jdolecek Exp $"); | 57 | __KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.119 2020/12/25 08:55:40 skrll 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/device.h> | 69 | #include <sys/device.h> | |
70 | #include <sys/disklabel.h> | 70 | #include <sys/disklabel.h> | |
@@ -109,36 +109,36 @@ static void wdc_ata_bio_poll(struct ata_ | @@ -109,36 +109,36 @@ static void wdc_ata_bio_poll(struct ata_ | |||
109 | static int wdc_ata_bio_intr(struct ata_channel *, struct ata_xfer *, | 109 | static int wdc_ata_bio_intr(struct ata_channel *, struct ata_xfer *, | |
110 | int); | 110 | int); | |
111 | static void wdc_ata_bio_kill_xfer(struct ata_channel *, | 111 | static void wdc_ata_bio_kill_xfer(struct ata_channel *, | |
112 | struct ata_xfer *, int); | 112 | struct ata_xfer *, int); | |
113 | static void wdc_ata_bio_done(struct ata_channel *, struct ata_xfer *); | 113 | static void wdc_ata_bio_done(struct ata_channel *, struct ata_xfer *); | |
114 | static int wdc_ata_err(struct ata_drive_datas *, struct ata_bio *, int); | 114 | static int wdc_ata_err(struct ata_drive_datas *, struct ata_bio *, int); | |
115 | #define WDC_ATA_NOERR 0x00 /* Drive doesn't report an error */ | 115 | #define WDC_ATA_NOERR 0x00 /* Drive doesn't report an error */ | |
116 | #define WDC_ATA_RECOV 0x01 /* There was a recovered error */ | 116 | #define WDC_ATA_RECOV 0x01 /* There was a recovered error */ | |
117 | #define WDC_ATA_ERR 0x02 /* Drive reports an error */ | 117 | #define WDC_ATA_ERR 0x02 /* Drive reports an error */ | |
118 | static int wdc_ata_addref(struct ata_drive_datas *); | 118 | static int wdc_ata_addref(struct ata_drive_datas *); | |
119 | static void wdc_ata_delref(struct ata_drive_datas *); | 119 | static void wdc_ata_delref(struct ata_drive_datas *); | |
120 | 120 | |||
121 | const struct ata_bustype wdc_ata_bustype = { | 121 | const struct ata_bustype wdc_ata_bustype = { | |
122 | SCSIPI_BUSTYPE_ATA, | 122 | .bustype_type = SCSIPI_BUSTYPE_ATA, | |
123 | wdc_ata_bio, | 123 | .ata_bio = wdc_ata_bio, | |
124 | wdc_reset_drive, | 124 | .ata_reset_drive = wdc_reset_drive, | |
125 | wdc_reset_channel, | 125 | .ata_reset_channel = wdc_reset_channel, | |
126 | wdc_exec_command, | 126 | .ata_exec_command = wdc_exec_command, | |
127 | ata_get_params, | 127 | .ata_get_params = ata_get_params, | |
128 | wdc_ata_addref, | 128 | .ata_addref = wdc_ata_addref, | |
129 | wdc_ata_delref, | 129 | .ata_delref = wdc_ata_delref, | |
130 | ata_kill_pending, | 130 | .ata_killpending = ata_kill_pending, | |
131 | NULL, | 131 | .ata_recovery = NULL, | |
132 | }; | 132 | }; | |
133 | 133 | |||
134 | static const struct ata_xfer_ops wdc_bio_xfer_ops = { | 134 | static const struct ata_xfer_ops wdc_bio_xfer_ops = { | |
135 | .c_start = wdc_ata_bio_start, | 135 | .c_start = wdc_ata_bio_start, | |
136 | .c_poll = wdc_ata_bio_poll, | 136 | .c_poll = wdc_ata_bio_poll, | |
137 | .c_abort = wdc_ata_bio_done, | 137 | .c_abort = wdc_ata_bio_done, | |
138 | .c_intr = wdc_ata_bio_intr, | 138 | .c_intr = wdc_ata_bio_intr, | |
139 | .c_kill_xfer = wdc_ata_bio_kill_xfer | 139 | .c_kill_xfer = wdc_ata_bio_kill_xfer | |
140 | }; | 140 | }; | |
141 | 141 | |||
142 | /* | 142 | /* | |
143 | * Handle block I/O operation. | 143 | * Handle block I/O operation. | |
144 | */ | 144 | */ |
--- src/sys/dev/ic/ahcisata_core.c 2020/12/20 00:14:30 1.85
+++ src/sys/dev/ic/ahcisata_core.c 2020/12/25 08:55:40 1.86
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ahcisata_core.c,v 1.85 2020/12/20 00:14:30 jmcneill Exp $ */ | 1 | /* $NetBSD: ahcisata_core.c,v 1.86 2020/12/25 08:55:40 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2006 Manuel Bouyer. | 4 | * Copyright (c) 2006 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 | * | |
@@ -16,27 +16,27 @@ | @@ -16,27 +16,27 @@ | |||
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | * | 25 | * | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | #include <sys/cdefs.h> | 28 | #include <sys/cdefs.h> | |
29 | __KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.85 2020/12/20 00:14:30 jmcneill Exp $"); | 29 | __KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.86 2020/12/25 08:55:40 skrll Exp $"); | |
30 | 30 | |||
31 | #include <sys/types.h> | 31 | #include <sys/types.h> | |
32 | #include <sys/malloc.h> | 32 | #include <sys/malloc.h> | |
33 | #include <sys/param.h> | 33 | #include <sys/param.h> | |
34 | #include <sys/kernel.h> | 34 | #include <sys/kernel.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/disklabel.h> | 36 | #include <sys/disklabel.h> | |
37 | #include <sys/proc.h> | 37 | #include <sys/proc.h> | |
38 | #include <sys/buf.h> | 38 | #include <sys/buf.h> | |
39 | 39 | |||
40 | #include <dev/ata/atareg.h> | 40 | #include <dev/ata/atareg.h> | |
41 | #include <dev/ata/satavar.h> | 41 | #include <dev/ata/satavar.h> | |
42 | #include <dev/ata/satareg.h> | 42 | #include <dev/ata/satareg.h> | |
@@ -103,36 +103,36 @@ static const struct scsipi_bustype ahci_ | @@ -103,36 +103,36 @@ static const struct scsipi_bustype ahci_ | |||
103 | .bustype_cmd = atapi_scsipi_cmd, | 103 | .bustype_cmd = atapi_scsipi_cmd, | |
104 | .bustype_interpret_sense = atapi_interpret_sense, | 104 | .bustype_interpret_sense = atapi_interpret_sense, | |
105 | .bustype_printaddr = atapi_print_addr, | 105 | .bustype_printaddr = atapi_print_addr, | |
106 | .bustype_kill_pending = ahci_atapi_kill_pending, | 106 | .bustype_kill_pending = ahci_atapi_kill_pending, | |
107 | .bustype_async_event_xfer_mode = NULL, | 107 | .bustype_async_event_xfer_mode = NULL, | |
108 | }; | 108 | }; | |
109 | #endif /* NATAPIBUS */ | 109 | #endif /* NATAPIBUS */ | |
110 | 110 | |||
111 | #define ATA_DELAY 10000 /* 10s for a drive I/O */ | 111 | #define ATA_DELAY 10000 /* 10s for a drive I/O */ | |
112 | #define ATA_RESET_DELAY 31000 /* 31s for a drive reset */ | 112 | #define ATA_RESET_DELAY 31000 /* 31s for a drive reset */ | |
113 | #define AHCI_RST_WAIT (ATA_RESET_DELAY / 10) | 113 | #define AHCI_RST_WAIT (ATA_RESET_DELAY / 10) | |
114 | 114 | |||
115 | const struct ata_bustype ahci_ata_bustype = { | 115 | const struct ata_bustype ahci_ata_bustype = { | |
116 | SCSIPI_BUSTYPE_ATA, | 116 | .bustype_type = SCSIPI_BUSTYPE_ATA, | |
117 | ahci_ata_bio, | 117 | .ata_bio = ahci_ata_bio, | |
118 | ahci_reset_drive, | 118 | .ata_reset_drive = ahci_reset_drive, | |
119 | ahci_reset_channel, | 119 | .ata_reset_channel = ahci_reset_channel, | |
120 | ahci_exec_command, | 120 | .ata_exec_command = ahci_exec_command, | |
121 | ata_get_params, | 121 | .ata_get_params = ata_get_params, | |
122 | ahci_ata_addref, | 122 | .ata_addref = ahci_ata_addref, | |
123 | ahci_ata_delref, | 123 | .ata_delref = ahci_ata_delref, | |
124 | ahci_killpending, | 124 | .ata_killpending = ahci_killpending, | |
125 | ahci_channel_recover, | 125 | .ata_recovery = ahci_channel_recover, | |
126 | }; | 126 | }; | |
127 | 127 | |||
128 | static void ahci_setup_port(struct ahci_softc *sc, int i); | 128 | static void ahci_setup_port(struct ahci_softc *sc, int i); | |
129 | 129 | |||
130 | static void | 130 | static void | |
131 | ahci_enable(struct ahci_softc *sc) | 131 | ahci_enable(struct ahci_softc *sc) | |
132 | { | 132 | { | |
133 | uint32_t ghc; | 133 | uint32_t ghc; | |
134 | 134 | |||
135 | ghc = AHCI_READ(sc, AHCI_GHC); | 135 | ghc = AHCI_READ(sc, AHCI_GHC); | |
136 | if (!(ghc & AHCI_GHC_AE)) { | 136 | if (!(ghc & AHCI_GHC_AE)) { | |
137 | ghc |= AHCI_GHC_AE; | 137 | ghc |= AHCI_GHC_AE; | |
138 | AHCI_WRITE(sc, AHCI_GHC, ghc); | 138 | AHCI_WRITE(sc, AHCI_GHC, ghc); |