diff options
-rw-r--r-- | drivers/ata/ahci.c | 8 | ||||
-rw-r--r-- | drivers/ata/ata_generic.c | 5 | ||||
-rw-r--r-- | drivers/ata/ata_piix.c | 21 | ||||
-rw-r--r-- | drivers/ata/libata-acpi.c | 19 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 204 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 116 | ||||
-rw-r--r-- | drivers/ata/libata-pmp.c | 22 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 22 | ||||
-rw-r--r-- | drivers/ata/pata_bf54x.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_it821x.c | 34 | ||||
-rw-r--r-- | drivers/ata/pata_ixp4xx_cf.c | 14 | ||||
-rw-r--r-- | drivers/ata/pata_legacy.c | 18 | ||||
-rw-r--r-- | drivers/ata/pata_oldpiix.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_pdc2027x.c | 29 | ||||
-rw-r--r-- | drivers/ata/pata_platform.c | 14 | ||||
-rw-r--r-- | drivers/ata/pata_radisys.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_rz1000.c | 16 | ||||
-rw-r--r-- | drivers/ata/pata_scc.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_serverworks.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_sis.c | 1 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 1 | ||||
-rw-r--r-- | drivers/ata/sata_sil.c | 98 | ||||
-rw-r--r-- | drivers/firmware/dmi_scan.c | 16 | ||||
-rw-r--r-- | include/linux/dmi.h | 3 | ||||
-rw-r--r-- | include/linux/libata.h | 71 |
25 files changed, 457 insertions, 280 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index a67b8e7c712d..656448c7fef9 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1119,14 +1119,14 @@ static void ahci_start_port(struct ata_port *ap) | |||
1119 | 1119 | ||
1120 | /* turn on LEDs */ | 1120 | /* turn on LEDs */ |
1121 | if (ap->flags & ATA_FLAG_EM) { | 1121 | if (ap->flags & ATA_FLAG_EM) { |
1122 | ata_port_for_each_link(link, ap) { | 1122 | ata_for_each_link(link, ap, EDGE) { |
1123 | emp = &pp->em_priv[link->pmp]; | 1123 | emp = &pp->em_priv[link->pmp]; |
1124 | ahci_transmit_led_message(ap, emp->led_state, 4); | 1124 | ahci_transmit_led_message(ap, emp->led_state, 4); |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | if (ap->flags & ATA_FLAG_SW_ACTIVITY) | 1128 | if (ap->flags & ATA_FLAG_SW_ACTIVITY) |
1129 | ata_port_for_each_link(link, ap) | 1129 | ata_for_each_link(link, ap, EDGE) |
1130 | ahci_init_sw_activity(link); | 1130 | ahci_init_sw_activity(link); |
1131 | 1131 | ||
1132 | } | 1132 | } |
@@ -1361,7 +1361,7 @@ static ssize_t ahci_led_show(struct ata_port *ap, char *buf) | |||
1361 | struct ahci_em_priv *emp; | 1361 | struct ahci_em_priv *emp; |
1362 | int rc = 0; | 1362 | int rc = 0; |
1363 | 1363 | ||
1364 | ata_port_for_each_link(link, ap) { | 1364 | ata_for_each_link(link, ap, EDGE) { |
1365 | emp = &pp->em_priv[link->pmp]; | 1365 | emp = &pp->em_priv[link->pmp]; |
1366 | rc += sprintf(buf, "%lx\n", emp->led_state); | 1366 | rc += sprintf(buf, "%lx\n", emp->led_state); |
1367 | } | 1367 | } |
@@ -1941,7 +1941,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
1941 | u32 serror; | 1941 | u32 serror; |
1942 | 1942 | ||
1943 | /* determine active link */ | 1943 | /* determine active link */ |
1944 | ata_port_for_each_link(link, ap) | 1944 | ata_for_each_link(link, ap, EDGE) |
1945 | if (ata_link_active(link)) | 1945 | if (ata_link_active(link)) |
1946 | break; | 1946 | break; |
1947 | if (!link) | 1947 | if (!link) |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 5c33767e66de..dc48a6398abe 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -57,10 +57,7 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused) | |||
57 | if (pdev->vendor == PCI_VENDOR_ID_CENATEK) | 57 | if (pdev->vendor == PCI_VENDOR_ID_CENATEK) |
58 | dma_enabled = 0xFF; | 58 | dma_enabled = 0xFF; |
59 | 59 | ||
60 | ata_link_for_each_dev(dev, link) { | 60 | ata_for_each_dev(dev, link, ENABLED) { |
61 | if (!ata_dev_enabled(dev)) | ||
62 | continue; | ||
63 | |||
64 | /* We don't really care */ | 61 | /* We don't really care */ |
65 | dev->pio_mode = XFER_PIO_0; | 62 | dev->pio_mode = XFER_PIO_0; |
66 | dev->dma_mode = XFER_MW_DMA_0; | 63 | dev->dma_mode = XFER_MW_DMA_0; |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index c11936e13dd3..5fdf1678d0cc 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1072,20 +1072,13 @@ static int piix_broken_suspend(void) | |||
1072 | * matching is necessary because dmi_system_id.matches is | 1072 | * matching is necessary because dmi_system_id.matches is |
1073 | * limited to four entries. | 1073 | * limited to four entries. |
1074 | */ | 1074 | */ |
1075 | if (dmi_get_system_info(DMI_SYS_VENDOR) && | 1075 | if (dmi_match(DMI_SYS_VENDOR, "TOSHIBA") && |
1076 | dmi_get_system_info(DMI_PRODUCT_NAME) && | 1076 | dmi_match(DMI_PRODUCT_NAME, "000000") && |
1077 | dmi_get_system_info(DMI_PRODUCT_VERSION) && | 1077 | dmi_match(DMI_PRODUCT_VERSION, "000000") && |
1078 | dmi_get_system_info(DMI_PRODUCT_SERIAL) && | 1078 | dmi_match(DMI_PRODUCT_SERIAL, "000000") && |
1079 | dmi_get_system_info(DMI_BOARD_VENDOR) && | 1079 | dmi_match(DMI_BOARD_VENDOR, "TOSHIBA") && |
1080 | dmi_get_system_info(DMI_BOARD_NAME) && | 1080 | dmi_match(DMI_BOARD_NAME, "Portable PC") && |
1081 | dmi_get_system_info(DMI_BOARD_VERSION) && | 1081 | dmi_match(DMI_BOARD_VERSION, "Version A0")) |
1082 | !strcmp(dmi_get_system_info(DMI_SYS_VENDOR), "TOSHIBA") && | ||
1083 | !strcmp(dmi_get_system_info(DMI_PRODUCT_NAME), "000000") && | ||
1084 | !strcmp(dmi_get_system_info(DMI_PRODUCT_VERSION), "000000") && | ||
1085 | !strcmp(dmi_get_system_info(DMI_PRODUCT_SERIAL), "000000") && | ||
1086 | !strcmp(dmi_get_system_info(DMI_BOARD_VENDOR), "TOSHIBA") && | ||
1087 | !strcmp(dmi_get_system_info(DMI_BOARD_NAME), "Portable PC") && | ||
1088 | !strcmp(dmi_get_system_info(DMI_BOARD_VERSION), "Version A0")) | ||
1089 | return 1; | 1082 | return 1; |
1090 | 1083 | ||
1091 | return 0; | 1084 | return 0; |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index c012307d0ba6..ef02e488d468 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -89,7 +89,7 @@ void ata_acpi_associate_sata_port(struct ata_port *ap) | |||
89 | 89 | ||
90 | ap->link.device->acpi_handle = NULL; | 90 | ap->link.device->acpi_handle = NULL; |
91 | 91 | ||
92 | ata_port_for_each_link(link, ap) { | 92 | ata_for_each_link(link, ap, EDGE) { |
93 | acpi_integer adr = SATA_ADR(ap->port_no, link->pmp); | 93 | acpi_integer adr = SATA_ADR(ap->port_no, link->pmp); |
94 | 94 | ||
95 | link->device->acpi_handle = | 95 | link->device->acpi_handle = |
@@ -129,8 +129,8 @@ static void ata_acpi_detach_device(struct ata_port *ap, struct ata_device *dev) | |||
129 | struct ata_link *tlink; | 129 | struct ata_link *tlink; |
130 | struct ata_device *tdev; | 130 | struct ata_device *tdev; |
131 | 131 | ||
132 | ata_port_for_each_link(tlink, ap) | 132 | ata_for_each_link(tlink, ap, EDGE) |
133 | ata_link_for_each_dev(tdev, tlink) | 133 | ata_for_each_dev(tdev, tlink, ALL) |
134 | tdev->flags |= ATA_DFLAG_DETACH; | 134 | tdev->flags |= ATA_DFLAG_DETACH; |
135 | } | 135 | } |
136 | 136 | ||
@@ -588,12 +588,9 @@ int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm) | |||
588 | { | 588 | { |
589 | struct ata_device *dev; | 589 | struct ata_device *dev; |
590 | 590 | ||
591 | ata_link_for_each_dev(dev, &ap->link) { | 591 | ata_for_each_dev(dev, &ap->link, ENABLED) { |
592 | unsigned long xfer_mask, udma_mask; | 592 | unsigned long xfer_mask, udma_mask; |
593 | 593 | ||
594 | if (!ata_dev_enabled(dev)) | ||
595 | continue; | ||
596 | |||
597 | xfer_mask = ata_acpi_gtm_xfermask(dev, gtm); | 594 | xfer_mask = ata_acpi_gtm_xfermask(dev, gtm); |
598 | ata_unpack_xfermask(xfer_mask, NULL, NULL, &udma_mask); | 595 | ata_unpack_xfermask(xfer_mask, NULL, NULL, &udma_mask); |
599 | 596 | ||
@@ -893,7 +890,7 @@ void ata_acpi_on_resume(struct ata_port *ap) | |||
893 | * use values set by _STM. Cache _GTF result and | 890 | * use values set by _STM. Cache _GTF result and |
894 | * schedule _GTF. | 891 | * schedule _GTF. |
895 | */ | 892 | */ |
896 | ata_link_for_each_dev(dev, &ap->link) { | 893 | ata_for_each_dev(dev, &ap->link, ALL) { |
897 | ata_acpi_clear_gtf(dev); | 894 | ata_acpi_clear_gtf(dev); |
898 | if (ata_dev_enabled(dev) && | 895 | if (ata_dev_enabled(dev) && |
899 | ata_dev_get_GTF(dev, NULL) >= 0) | 896 | ata_dev_get_GTF(dev, NULL) >= 0) |
@@ -904,7 +901,7 @@ void ata_acpi_on_resume(struct ata_port *ap) | |||
904 | * there's no reason to evaluate IDE _GTF early | 901 | * there's no reason to evaluate IDE _GTF early |
905 | * without _STM. Clear cache and schedule _GTF. | 902 | * without _STM. Clear cache and schedule _GTF. |
906 | */ | 903 | */ |
907 | ata_link_for_each_dev(dev, &ap->link) { | 904 | ata_for_each_dev(dev, &ap->link, ALL) { |
908 | ata_acpi_clear_gtf(dev); | 905 | ata_acpi_clear_gtf(dev); |
909 | if (ata_dev_enabled(dev)) | 906 | if (ata_dev_enabled(dev)) |
910 | dev->flags |= ATA_DFLAG_ACPI_PENDING; | 907 | dev->flags |= ATA_DFLAG_ACPI_PENDING; |
@@ -932,8 +929,8 @@ void ata_acpi_set_state(struct ata_port *ap, pm_message_t state) | |||
932 | if (state.event == PM_EVENT_ON) | 929 | if (state.event == PM_EVENT_ON) |
933 | acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D0); | 930 | acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D0); |
934 | 931 | ||
935 | ata_link_for_each_dev(dev, &ap->link) { | 932 | ata_for_each_dev(dev, &ap->link, ENABLED) { |
936 | if (dev->acpi_handle && ata_dev_enabled(dev)) | 933 | if (dev->acpi_handle) |
937 | acpi_bus_set_power(dev->acpi_handle, | 934 | acpi_bus_set_power(dev->acpi_handle, |
938 | state.event == PM_EVENT_ON ? | 935 | state.event == PM_EVENT_ON ? |
939 | ACPI_STATE_D0 : ACPI_STATE_D3); | 936 | ACPI_STATE_D0 : ACPI_STATE_D3); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index bc6695e3c848..fecca4223f8e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -163,43 +163,119 @@ MODULE_LICENSE("GPL"); | |||
163 | MODULE_VERSION(DRV_VERSION); | 163 | MODULE_VERSION(DRV_VERSION); |
164 | 164 | ||
165 | 165 | ||
166 | /* | 166 | /** |
167 | * Iterator helpers. Don't use directly. | 167 | * ata_link_next - link iteration helper |
168 | * @link: the previous link, NULL to start | ||
169 | * @ap: ATA port containing links to iterate | ||
170 | * @mode: iteration mode, one of ATA_LITER_* | ||
171 | * | ||
172 | * LOCKING: | ||
173 | * Host lock or EH context. | ||
168 | * | 174 | * |
169 | * LOCKING: | 175 | * RETURNS: |
170 | * Host lock or EH context. | 176 | * Pointer to the next link. |
171 | */ | 177 | */ |
172 | struct ata_link *__ata_port_next_link(struct ata_port *ap, | 178 | struct ata_link *ata_link_next(struct ata_link *link, struct ata_port *ap, |
173 | struct ata_link *link, bool dev_only) | 179 | enum ata_link_iter_mode mode) |
174 | { | 180 | { |
181 | BUG_ON(mode != ATA_LITER_EDGE && | ||
182 | mode != ATA_LITER_PMP_FIRST && mode != ATA_LITER_HOST_FIRST); | ||
183 | |||
175 | /* NULL link indicates start of iteration */ | 184 | /* NULL link indicates start of iteration */ |
176 | if (!link) { | 185 | if (!link) |
177 | if (dev_only && sata_pmp_attached(ap)) | 186 | switch (mode) { |
178 | return ap->pmp_link; | 187 | case ATA_LITER_EDGE: |
179 | return &ap->link; | 188 | case ATA_LITER_PMP_FIRST: |
180 | } | 189 | if (sata_pmp_attached(ap)) |
190 | return ap->pmp_link; | ||
191 | /* fall through */ | ||
192 | case ATA_LITER_HOST_FIRST: | ||
193 | return &ap->link; | ||
194 | } | ||
181 | 195 | ||
182 | /* we just iterated over the host master link, what's next? */ | 196 | /* we just iterated over the host link, what's next? */ |
183 | if (link == &ap->link) { | 197 | if (link == &ap->link) |
184 | if (!sata_pmp_attached(ap)) { | 198 | switch (mode) { |
185 | if (unlikely(ap->slave_link) && !dev_only) | 199 | case ATA_LITER_HOST_FIRST: |
200 | if (sata_pmp_attached(ap)) | ||
201 | return ap->pmp_link; | ||
202 | /* fall through */ | ||
203 | case ATA_LITER_PMP_FIRST: | ||
204 | if (unlikely(ap->slave_link)) | ||
186 | return ap->slave_link; | 205 | return ap->slave_link; |
206 | /* fall through */ | ||
207 | case ATA_LITER_EDGE: | ||
187 | return NULL; | 208 | return NULL; |
188 | } | 209 | } |
189 | return ap->pmp_link; | ||
190 | } | ||
191 | 210 | ||
192 | /* slave_link excludes PMP */ | 211 | /* slave_link excludes PMP */ |
193 | if (unlikely(link == ap->slave_link)) | 212 | if (unlikely(link == ap->slave_link)) |
194 | return NULL; | 213 | return NULL; |
195 | 214 | ||
196 | /* iterate to the next PMP link */ | 215 | /* we were over a PMP link */ |
197 | if (++link < ap->pmp_link + ap->nr_pmp_links) | 216 | if (++link < ap->pmp_link + ap->nr_pmp_links) |
198 | return link; | 217 | return link; |
218 | |||
219 | if (mode == ATA_LITER_PMP_FIRST) | ||
220 | return &ap->link; | ||
221 | |||
199 | return NULL; | 222 | return NULL; |
200 | } | 223 | } |
201 | 224 | ||
202 | /** | 225 | /** |
226 | * ata_dev_next - device iteration helper | ||
227 | * @dev: the previous device, NULL to start | ||
228 | * @link: ATA link containing devices to iterate | ||
229 | * @mode: iteration mode, one of ATA_DITER_* | ||
230 | * | ||
231 | * LOCKING: | ||
232 | * Host lock or EH context. | ||
233 | * | ||
234 | * RETURNS: | ||
235 | * Pointer to the next device. | ||
236 | */ | ||
237 | struct ata_device *ata_dev_next(struct ata_device *dev, struct ata_link *link, | ||
238 | enum ata_dev_iter_mode mode) | ||
239 | { | ||
240 | BUG_ON(mode != ATA_DITER_ENABLED && mode != ATA_DITER_ENABLED_REVERSE && | ||
241 | mode != ATA_DITER_ALL && mode != ATA_DITER_ALL_REVERSE); | ||
242 | |||
243 | /* NULL dev indicates start of iteration */ | ||
244 | if (!dev) | ||
245 | switch (mode) { | ||
246 | case ATA_DITER_ENABLED: | ||
247 | case ATA_DITER_ALL: | ||
248 | dev = link->device; | ||
249 | goto check; | ||
250 | case ATA_DITER_ENABLED_REVERSE: | ||
251 | case ATA_DITER_ALL_REVERSE: | ||
252 | dev = link->device + ata_link_max_devices(link) - 1; | ||
253 | goto check; | ||
254 | } | ||
255 | |||
256 | next: | ||
257 | /* move to the next one */ | ||
258 | switch (mode) { | ||
259 | case ATA_DITER_ENABLED: | ||
260 | case ATA_DITER_ALL: | ||
261 | if (++dev < link->device + ata_link_max_devices(link)) | ||
262 | goto check; | ||
263 | return NULL; | ||
264 | case ATA_DITER_ENABLED_REVERSE: | ||
265 | case ATA_DITER_ALL_REVERSE: | ||
266 | if (--dev >= link->device) | ||
267 | goto check; | ||
268 | return NULL; | ||
269 | } | ||
270 | |||
271 | check: | ||
272 | if ((mode == ATA_DITER_ENABLED || mode == ATA_DITER_ENABLED_REVERSE) && | ||
273 | !ata_dev_enabled(dev)) | ||
274 | goto next; | ||
275 | return dev; | ||
276 | } | ||
277 | |||
278 | /** | ||
203 | * ata_dev_phys_link - find physical link for a device | 279 | * ata_dev_phys_link - find physical link for a device |
204 | * @dev: ATA device to look up physical link for | 280 | * @dev: ATA device to look up physical link for |
205 | * | 281 | * |
@@ -1107,8 +1183,8 @@ static void ata_lpm_enable(struct ata_host *host) | |||
1107 | 1183 | ||
1108 | for (i = 0; i < host->n_ports; i++) { | 1184 | for (i = 0; i < host->n_ports; i++) { |
1109 | ap = host->ports[i]; | 1185 | ap = host->ports[i]; |
1110 | ata_port_for_each_link(link, ap) { | 1186 | ata_for_each_link(link, ap, EDGE) { |
1111 | ata_link_for_each_dev(dev, link) | 1187 | ata_for_each_dev(dev, link, ALL) |
1112 | ata_dev_disable_pm(dev); | 1188 | ata_dev_disable_pm(dev); |
1113 | } | 1189 | } |
1114 | } | 1190 | } |
@@ -2594,11 +2670,11 @@ int ata_bus_probe(struct ata_port *ap) | |||
2594 | 2670 | ||
2595 | ata_port_probe(ap); | 2671 | ata_port_probe(ap); |
2596 | 2672 | ||
2597 | ata_link_for_each_dev(dev, &ap->link) | 2673 | ata_for_each_dev(dev, &ap->link, ALL) |
2598 | tries[dev->devno] = ATA_PROBE_MAX_TRIES; | 2674 | tries[dev->devno] = ATA_PROBE_MAX_TRIES; |
2599 | 2675 | ||
2600 | retry: | 2676 | retry: |
2601 | ata_link_for_each_dev(dev, &ap->link) { | 2677 | ata_for_each_dev(dev, &ap->link, ALL) { |
2602 | /* If we issue an SRST then an ATA drive (not ATAPI) | 2678 | /* If we issue an SRST then an ATA drive (not ATAPI) |
2603 | * may change configuration and be in PIO0 timing. If | 2679 | * may change configuration and be in PIO0 timing. If |
2604 | * we do a hard reset (or are coming from power on) | 2680 | * we do a hard reset (or are coming from power on) |
@@ -2620,7 +2696,7 @@ int ata_bus_probe(struct ata_port *ap) | |||
2620 | /* reset and determine device classes */ | 2696 | /* reset and determine device classes */ |
2621 | ap->ops->phy_reset(ap); | 2697 | ap->ops->phy_reset(ap); |
2622 | 2698 | ||
2623 | ata_link_for_each_dev(dev, &ap->link) { | 2699 | ata_for_each_dev(dev, &ap->link, ALL) { |
2624 | if (!(ap->flags & ATA_FLAG_DISABLED) && | 2700 | if (!(ap->flags & ATA_FLAG_DISABLED) && |
2625 | dev->class != ATA_DEV_UNKNOWN) | 2701 | dev->class != ATA_DEV_UNKNOWN) |
2626 | classes[dev->devno] = dev->class; | 2702 | classes[dev->devno] = dev->class; |
@@ -2636,7 +2712,7 @@ int ata_bus_probe(struct ata_port *ap) | |||
2636 | specific sequence bass-ackwards so that PDIAG- is released by | 2712 | specific sequence bass-ackwards so that PDIAG- is released by |
2637 | the slave device */ | 2713 | the slave device */ |
2638 | 2714 | ||
2639 | ata_link_for_each_dev_reverse(dev, &ap->link) { | 2715 | ata_for_each_dev(dev, &ap->link, ALL_REVERSE) { |
2640 | if (tries[dev->devno]) | 2716 | if (tries[dev->devno]) |
2641 | dev->class = classes[dev->devno]; | 2717 | dev->class = classes[dev->devno]; |
2642 | 2718 | ||
@@ -2653,24 +2729,19 @@ int ata_bus_probe(struct ata_port *ap) | |||
2653 | if (ap->ops->cable_detect) | 2729 | if (ap->ops->cable_detect) |
2654 | ap->cbl = ap->ops->cable_detect(ap); | 2730 | ap->cbl = ap->ops->cable_detect(ap); |
2655 | 2731 | ||
2656 | /* We may have SATA bridge glue hiding here irrespective of the | 2732 | /* We may have SATA bridge glue hiding here irrespective of |
2657 | reported cable types and sensed types */ | 2733 | * the reported cable types and sensed types. When SATA |
2658 | ata_link_for_each_dev(dev, &ap->link) { | 2734 | * drives indicate we have a bridge, we don't know which end |
2659 | if (!ata_dev_enabled(dev)) | 2735 | * of the link the bridge is which is a problem. |
2660 | continue; | 2736 | */ |
2661 | /* SATA drives indicate we have a bridge. We don't know which | 2737 | ata_for_each_dev(dev, &ap->link, ENABLED) |
2662 | end of the link the bridge is which is a problem */ | ||
2663 | if (ata_id_is_sata(dev->id)) | 2738 | if (ata_id_is_sata(dev->id)) |
2664 | ap->cbl = ATA_CBL_SATA; | 2739 | ap->cbl = ATA_CBL_SATA; |
2665 | } | ||
2666 | 2740 | ||
2667 | /* After the identify sequence we can now set up the devices. We do | 2741 | /* After the identify sequence we can now set up the devices. We do |
2668 | this in the normal order so that the user doesn't get confused */ | 2742 | this in the normal order so that the user doesn't get confused */ |
2669 | 2743 | ||
2670 | ata_link_for_each_dev(dev, &ap->link) { | 2744 | ata_for_each_dev(dev, &ap->link, ENABLED) { |
2671 | if (!ata_dev_enabled(dev)) | ||
2672 | continue; | ||
2673 | |||
2674 | ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; | 2745 | ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; |
2675 | rc = ata_dev_configure(dev); | 2746 | rc = ata_dev_configure(dev); |
2676 | ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; | 2747 | ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; |
@@ -2683,9 +2754,8 @@ int ata_bus_probe(struct ata_port *ap) | |||
2683 | if (rc) | 2754 | if (rc) |
2684 | goto fail; | 2755 | goto fail; |
2685 | 2756 | ||
2686 | ata_link_for_each_dev(dev, &ap->link) | 2757 | ata_for_each_dev(dev, &ap->link, ENABLED) |
2687 | if (ata_dev_enabled(dev)) | 2758 | return 0; |
2688 | return 0; | ||
2689 | 2759 | ||
2690 | /* no device present, disable port */ | 2760 | /* no device present, disable port */ |
2691 | ata_port_disable(ap); | 2761 | ata_port_disable(ap); |
@@ -3331,13 +3401,10 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3331 | int rc = 0, used_dma = 0, found = 0; | 3401 | int rc = 0, used_dma = 0, found = 0; |
3332 | 3402 | ||
3333 | /* step 1: calculate xfer_mask */ | 3403 | /* step 1: calculate xfer_mask */ |
3334 | ata_link_for_each_dev(dev, link) { | 3404 | ata_for_each_dev(dev, link, ENABLED) { |
3335 | unsigned long pio_mask, dma_mask; | 3405 | unsigned long pio_mask, dma_mask; |
3336 | unsigned int mode_mask; | 3406 | unsigned int mode_mask; |
3337 | 3407 | ||
3338 | if (!ata_dev_enabled(dev)) | ||
3339 | continue; | ||
3340 | |||
3341 | mode_mask = ATA_DMA_MASK_ATA; | 3408 | mode_mask = ATA_DMA_MASK_ATA; |
3342 | if (dev->class == ATA_DEV_ATAPI) | 3409 | if (dev->class == ATA_DEV_ATAPI) |
3343 | mode_mask = ATA_DMA_MASK_ATAPI; | 3410 | mode_mask = ATA_DMA_MASK_ATAPI; |
@@ -3366,10 +3433,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3366 | goto out; | 3433 | goto out; |
3367 | 3434 | ||
3368 | /* step 2: always set host PIO timings */ | 3435 | /* step 2: always set host PIO timings */ |
3369 | ata_link_for_each_dev(dev, link) { | 3436 | ata_for_each_dev(dev, link, ENABLED) { |
3370 | if (!ata_dev_enabled(dev)) | ||
3371 | continue; | ||
3372 | |||
3373 | if (dev->pio_mode == 0xff) { | 3437 | if (dev->pio_mode == 0xff) { |
3374 | ata_dev_printk(dev, KERN_WARNING, "no PIO support\n"); | 3438 | ata_dev_printk(dev, KERN_WARNING, "no PIO support\n"); |
3375 | rc = -EINVAL; | 3439 | rc = -EINVAL; |
@@ -3383,8 +3447,8 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3383 | } | 3447 | } |
3384 | 3448 | ||
3385 | /* step 3: set host DMA timings */ | 3449 | /* step 3: set host DMA timings */ |
3386 | ata_link_for_each_dev(dev, link) { | 3450 | ata_for_each_dev(dev, link, ENABLED) { |
3387 | if (!ata_dev_enabled(dev) || !ata_dma_enabled(dev)) | 3451 | if (!ata_dma_enabled(dev)) |
3388 | continue; | 3452 | continue; |
3389 | 3453 | ||
3390 | dev->xfer_mode = dev->dma_mode; | 3454 | dev->xfer_mode = dev->dma_mode; |
@@ -3394,11 +3458,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3394 | } | 3458 | } |
3395 | 3459 | ||
3396 | /* step 4: update devices' xfer mode */ | 3460 | /* step 4: update devices' xfer mode */ |
3397 | ata_link_for_each_dev(dev, link) { | 3461 | ata_for_each_dev(dev, link, ENABLED) { |
3398 | /* don't update suspended devices' xfer mode */ | ||
3399 | if (!ata_dev_enabled(dev)) | ||
3400 | continue; | ||
3401 | |||
3402 | rc = ata_dev_set_mode(dev); | 3462 | rc = ata_dev_set_mode(dev); |
3403 | if (rc) | 3463 | if (rc) |
3404 | goto out; | 3464 | goto out; |
@@ -4048,6 +4108,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4048 | { "Maxtor 7V300F0", "VA111630", ATA_HORKAGE_NONCQ }, | 4108 | { "Maxtor 7V300F0", "VA111630", ATA_HORKAGE_NONCQ }, |
4049 | { "ST380817AS", "3.42", ATA_HORKAGE_NONCQ }, | 4109 | { "ST380817AS", "3.42", ATA_HORKAGE_NONCQ }, |
4050 | { "ST3160023AS", "3.42", ATA_HORKAGE_NONCQ }, | 4110 | { "ST3160023AS", "3.42", ATA_HORKAGE_NONCQ }, |
4111 | { "OCZ CORE_SSD", "02.10104", ATA_HORKAGE_NONCQ }, | ||
4051 | 4112 | ||
4052 | /* Seagate NCQ + FLUSH CACHE firmware bug */ | 4113 | /* Seagate NCQ + FLUSH CACHE firmware bug */ |
4053 | { "ST31500341AS", "SD15", ATA_HORKAGE_NONCQ | | 4114 | { "ST31500341AS", "SD15", ATA_HORKAGE_NONCQ | |
@@ -4263,9 +4324,9 @@ static int cable_is_40wire(struct ata_port *ap) | |||
4263 | * - if you have a non detect capable drive you don't want it | 4324 | * - if you have a non detect capable drive you don't want it |
4264 | * to colour the choice | 4325 | * to colour the choice |
4265 | */ | 4326 | */ |
4266 | ata_port_for_each_link(link, ap) { | 4327 | ata_for_each_link(link, ap, EDGE) { |
4267 | ata_link_for_each_dev(dev, link) { | 4328 | ata_for_each_dev(dev, link, ENABLED) { |
4268 | if (ata_dev_enabled(dev) && !ata_is_40wire(dev)) | 4329 | if (!ata_is_40wire(dev)) |
4269 | return 0; | 4330 | return 0; |
4270 | } | 4331 | } |
4271 | } | 4332 | } |
@@ -4672,7 +4733,6 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | |||
4672 | /** | 4733 | /** |
4673 | * ata_qc_new_init - Request an available ATA command, and initialize it | 4734 | * ata_qc_new_init - Request an available ATA command, and initialize it |
4674 | * @dev: Device from whom we request an available command structure | 4735 | * @dev: Device from whom we request an available command structure |
4675 | * @tag: command tag | ||
4676 | * | 4736 | * |
4677 | * LOCKING: | 4737 | * LOCKING: |
4678 | * None. | 4738 | * None. |
@@ -5218,7 +5278,7 @@ static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, | |||
5218 | } | 5278 | } |
5219 | 5279 | ||
5220 | ap->pflags |= ATA_PFLAG_PM_PENDING; | 5280 | ap->pflags |= ATA_PFLAG_PM_PENDING; |
5221 | __ata_port_for_each_link(link, ap) { | 5281 | ata_for_each_link(link, ap, HOST_FIRST) { |
5222 | link->eh_info.action |= action; | 5282 | link->eh_info.action |= action; |
5223 | link->eh_info.flags |= ehi_flags; | 5283 | link->eh_info.flags |= ehi_flags; |
5224 | } | 5284 | } |
@@ -6047,8 +6107,6 @@ int ata_host_activate(struct ata_host *host, int irq, | |||
6047 | static void ata_port_detach(struct ata_port *ap) | 6107 | static void ata_port_detach(struct ata_port *ap) |
6048 | { | 6108 | { |
6049 | unsigned long flags; | 6109 | unsigned long flags; |
6050 | struct ata_link *link; | ||
6051 | struct ata_device *dev; | ||
6052 | 6110 | ||
6053 | if (!ap->ops->error_handler) | 6111 | if (!ap->ops->error_handler) |
6054 | goto skip_eh; | 6112 | goto skip_eh; |
@@ -6056,28 +6114,15 @@ static void ata_port_detach(struct ata_port *ap) | |||
6056 | /* tell EH we're leaving & flush EH */ | 6114 | /* tell EH we're leaving & flush EH */ |
6057 | spin_lock_irqsave(ap->lock, flags); | 6115 | spin_lock_irqsave(ap->lock, flags); |
6058 | ap->pflags |= ATA_PFLAG_UNLOADING; | 6116 | ap->pflags |= ATA_PFLAG_UNLOADING; |
6117 | ata_port_schedule_eh(ap); | ||
6059 | spin_unlock_irqrestore(ap->lock, flags); | 6118 | spin_unlock_irqrestore(ap->lock, flags); |
6060 | 6119 | ||
6120 | /* wait till EH commits suicide */ | ||
6061 | ata_port_wait_eh(ap); | 6121 | ata_port_wait_eh(ap); |
6062 | 6122 | ||
6063 | /* EH is now guaranteed to see UNLOADING - EH context belongs | 6123 | /* it better be dead now */ |
6064 | * to us. Restore SControl and disable all existing devices. | 6124 | WARN_ON(!(ap->pflags & ATA_PFLAG_UNLOADED)); |
6065 | */ | ||
6066 | __ata_port_for_each_link(link, ap) { | ||
6067 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); | ||
6068 | ata_link_for_each_dev(dev, link) | ||
6069 | ata_dev_disable(dev); | ||
6070 | } | ||
6071 | 6125 | ||
6072 | /* Final freeze & EH. All in-flight commands are aborted. EH | ||
6073 | * will be skipped and retrials will be terminated with bad | ||
6074 | * target. | ||
6075 | */ | ||
6076 | spin_lock_irqsave(ap->lock, flags); | ||
6077 | ata_port_freeze(ap); /* won't be thawed */ | ||
6078 | spin_unlock_irqrestore(ap->lock, flags); | ||
6079 | |||
6080 | ata_port_wait_eh(ap); | ||
6081 | cancel_rearming_delayed_work(&ap->hotplug_task); | 6126 | cancel_rearming_delayed_work(&ap->hotplug_task); |
6082 | 6127 | ||
6083 | skip_eh: | 6128 | skip_eh: |
@@ -6528,7 +6573,8 @@ EXPORT_SYMBOL_GPL(ata_base_port_ops); | |||
6528 | EXPORT_SYMBOL_GPL(sata_port_ops); | 6573 | EXPORT_SYMBOL_GPL(sata_port_ops); |
6529 | EXPORT_SYMBOL_GPL(ata_dummy_port_ops); | 6574 | EXPORT_SYMBOL_GPL(ata_dummy_port_ops); |
6530 | EXPORT_SYMBOL_GPL(ata_dummy_port_info); | 6575 | EXPORT_SYMBOL_GPL(ata_dummy_port_info); |
6531 | EXPORT_SYMBOL_GPL(__ata_port_next_link); | 6576 | EXPORT_SYMBOL_GPL(ata_link_next); |
6577 | EXPORT_SYMBOL_GPL(ata_dev_next); | ||
6532 | EXPORT_SYMBOL_GPL(ata_std_bios_param); | 6578 | EXPORT_SYMBOL_GPL(ata_std_bios_param); |
6533 | EXPORT_SYMBOL_GPL(ata_host_init); | 6579 | EXPORT_SYMBOL_GPL(ata_host_init); |
6534 | EXPORT_SYMBOL_GPL(ata_host_alloc); | 6580 | EXPORT_SYMBOL_GPL(ata_host_alloc); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 32da9a93ce44..8147a8386370 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -422,7 +422,7 @@ static void ata_eh_clear_action(struct ata_link *link, struct ata_device *dev, | |||
422 | 422 | ||
423 | if (!dev) { | 423 | if (!dev) { |
424 | ehi->action &= ~action; | 424 | ehi->action &= ~action; |
425 | ata_link_for_each_dev(tdev, link) | 425 | ata_for_each_dev(tdev, link, ALL) |
426 | ehi->dev_action[tdev->devno] &= ~action; | 426 | ehi->dev_action[tdev->devno] &= ~action; |
427 | } else { | 427 | } else { |
428 | /* doesn't make sense for port-wide EH actions */ | 428 | /* doesn't make sense for port-wide EH actions */ |
@@ -430,7 +430,7 @@ static void ata_eh_clear_action(struct ata_link *link, struct ata_device *dev, | |||
430 | 430 | ||
431 | /* break ehi->action into ehi->dev_action */ | 431 | /* break ehi->action into ehi->dev_action */ |
432 | if (ehi->action & action) { | 432 | if (ehi->action & action) { |
433 | ata_link_for_each_dev(tdev, link) | 433 | ata_for_each_dev(tdev, link, ALL) |
434 | ehi->dev_action[tdev->devno] |= | 434 | ehi->dev_action[tdev->devno] |= |
435 | ehi->action & action; | 435 | ehi->action & action; |
436 | ehi->action &= ~action; | 436 | ehi->action &= ~action; |
@@ -491,6 +491,31 @@ enum blk_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd) | |||
491 | return ret; | 491 | return ret; |
492 | } | 492 | } |
493 | 493 | ||
494 | static void ata_eh_unload(struct ata_port *ap) | ||
495 | { | ||
496 | struct ata_link *link; | ||
497 | struct ata_device *dev; | ||
498 | unsigned long flags; | ||
499 | |||
500 | /* Restore SControl IPM and SPD for the next driver and | ||
501 | * disable attached devices. | ||
502 | */ | ||
503 | ata_for_each_link(link, ap, PMP_FIRST) { | ||
504 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); | ||
505 | ata_for_each_dev(dev, link, ALL) | ||
506 | ata_dev_disable(dev); | ||
507 | } | ||
508 | |||
509 | /* freeze and set UNLOADED */ | ||
510 | spin_lock_irqsave(ap->lock, flags); | ||
511 | |||
512 | ata_port_freeze(ap); /* won't be thawed */ | ||
513 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; /* clear pending from freeze */ | ||
514 | ap->pflags |= ATA_PFLAG_UNLOADED; | ||
515 | |||
516 | spin_unlock_irqrestore(ap->lock, flags); | ||
517 | } | ||
518 | |||
494 | /** | 519 | /** |
495 | * ata_scsi_error - SCSI layer error handler callback | 520 | * ata_scsi_error - SCSI layer error handler callback |
496 | * @host: SCSI host on which error occurred | 521 | * @host: SCSI host on which error occurred |
@@ -592,7 +617,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
592 | /* fetch & clear EH info */ | 617 | /* fetch & clear EH info */ |
593 | spin_lock_irqsave(ap->lock, flags); | 618 | spin_lock_irqsave(ap->lock, flags); |
594 | 619 | ||
595 | __ata_port_for_each_link(link, ap) { | 620 | ata_for_each_link(link, ap, HOST_FIRST) { |
596 | struct ata_eh_context *ehc = &link->eh_context; | 621 | struct ata_eh_context *ehc = &link->eh_context; |
597 | struct ata_device *dev; | 622 | struct ata_device *dev; |
598 | 623 | ||
@@ -600,12 +625,9 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
600 | link->eh_context.i = link->eh_info; | 625 | link->eh_context.i = link->eh_info; |
601 | memset(&link->eh_info, 0, sizeof(link->eh_info)); | 626 | memset(&link->eh_info, 0, sizeof(link->eh_info)); |
602 | 627 | ||
603 | ata_link_for_each_dev(dev, link) { | 628 | ata_for_each_dev(dev, link, ENABLED) { |
604 | int devno = dev->devno; | 629 | int devno = dev->devno; |
605 | 630 | ||
606 | if (!ata_dev_enabled(dev)) | ||
607 | continue; | ||
608 | |||
609 | ehc->saved_xfer_mode[devno] = dev->xfer_mode; | 631 | ehc->saved_xfer_mode[devno] = dev->xfer_mode; |
610 | if (ata_ncq_enabled(dev)) | 632 | if (ata_ncq_enabled(dev)) |
611 | ehc->saved_ncq_enabled |= 1 << devno; | 633 | ehc->saved_ncq_enabled |= 1 << devno; |
@@ -621,8 +643,13 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
621 | /* invoke EH, skip if unloading or suspended */ | 643 | /* invoke EH, skip if unloading or suspended */ |
622 | if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) | 644 | if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) |
623 | ap->ops->error_handler(ap); | 645 | ap->ops->error_handler(ap); |
624 | else | 646 | else { |
647 | /* if unloading, commence suicide */ | ||
648 | if ((ap->pflags & ATA_PFLAG_UNLOADING) && | ||
649 | !(ap->pflags & ATA_PFLAG_UNLOADED)) | ||
650 | ata_eh_unload(ap); | ||
625 | ata_eh_finish(ap); | 651 | ata_eh_finish(ap); |
652 | } | ||
626 | 653 | ||
627 | /* process port suspend request */ | 654 | /* process port suspend request */ |
628 | ata_eh_handle_port_suspend(ap); | 655 | ata_eh_handle_port_suspend(ap); |
@@ -644,7 +671,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
644 | } | 671 | } |
645 | 672 | ||
646 | /* this run is complete, make sure EH info is clear */ | 673 | /* this run is complete, make sure EH info is clear */ |
647 | __ata_port_for_each_link(link, ap) | 674 | ata_for_each_link(link, ap, HOST_FIRST) |
648 | memset(&link->eh_info, 0, sizeof(link->eh_info)); | 675 | memset(&link->eh_info, 0, sizeof(link->eh_info)); |
649 | 676 | ||
650 | /* Clear host_eh_scheduled while holding ap->lock such | 677 | /* Clear host_eh_scheduled while holding ap->lock such |
@@ -1025,7 +1052,7 @@ int sata_async_notification(struct ata_port *ap) | |||
1025 | struct ata_link *link; | 1052 | struct ata_link *link; |
1026 | 1053 | ||
1027 | /* check and notify ATAPI AN */ | 1054 | /* check and notify ATAPI AN */ |
1028 | ata_port_for_each_link(link, ap) { | 1055 | ata_for_each_link(link, ap, EDGE) { |
1029 | if (!(sntf & (1 << link->pmp))) | 1056 | if (!(sntf & (1 << link->pmp))) |
1030 | continue; | 1057 | continue; |
1031 | 1058 | ||
@@ -2005,7 +2032,7 @@ void ata_eh_autopsy(struct ata_port *ap) | |||
2005 | { | 2032 | { |
2006 | struct ata_link *link; | 2033 | struct ata_link *link; |
2007 | 2034 | ||
2008 | ata_port_for_each_link(link, ap) | 2035 | ata_for_each_link(link, ap, EDGE) |
2009 | ata_eh_link_autopsy(link); | 2036 | ata_eh_link_autopsy(link); |
2010 | 2037 | ||
2011 | /* Handle the frigging slave link. Autopsy is done similarly | 2038 | /* Handle the frigging slave link. Autopsy is done similarly |
@@ -2219,7 +2246,7 @@ void ata_eh_report(struct ata_port *ap) | |||
2219 | { | 2246 | { |
2220 | struct ata_link *link; | 2247 | struct ata_link *link; |
2221 | 2248 | ||
2222 | __ata_port_for_each_link(link, ap) | 2249 | ata_for_each_link(link, ap, HOST_FIRST) |
2223 | ata_eh_link_report(link); | 2250 | ata_eh_link_report(link); |
2224 | } | 2251 | } |
2225 | 2252 | ||
@@ -2230,7 +2257,7 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | |||
2230 | struct ata_device *dev; | 2257 | struct ata_device *dev; |
2231 | 2258 | ||
2232 | if (clear_classes) | 2259 | if (clear_classes) |
2233 | ata_link_for_each_dev(dev, link) | 2260 | ata_for_each_dev(dev, link, ALL) |
2234 | classes[dev->devno] = ATA_DEV_UNKNOWN; | 2261 | classes[dev->devno] = ATA_DEV_UNKNOWN; |
2235 | 2262 | ||
2236 | return reset(link, classes, deadline); | 2263 | return reset(link, classes, deadline); |
@@ -2294,7 +2321,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2294 | 2321 | ||
2295 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2296 | 2323 | ||
2297 | ata_link_for_each_dev(dev, link) { | 2324 | ata_for_each_dev(dev, link, ALL) { |
2298 | /* If we issue an SRST then an ATA drive (not ATAPI) | 2325 | /* If we issue an SRST then an ATA drive (not ATAPI) |
2299 | * may change configuration and be in PIO0 timing. If | 2326 | * may change configuration and be in PIO0 timing. If |
2300 | * we do a hard reset (or are coming from power on) | 2327 | * we do a hard reset (or are coming from power on) |
@@ -2355,7 +2382,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2355 | "port disabled. ignoring.\n"); | 2382 | "port disabled. ignoring.\n"); |
2356 | ehc->i.action &= ~ATA_EH_RESET; | 2383 | ehc->i.action &= ~ATA_EH_RESET; |
2357 | 2384 | ||
2358 | ata_link_for_each_dev(dev, link) | 2385 | ata_for_each_dev(dev, link, ALL) |
2359 | classes[dev->devno] = ATA_DEV_NONE; | 2386 | classes[dev->devno] = ATA_DEV_NONE; |
2360 | 2387 | ||
2361 | rc = 0; | 2388 | rc = 0; |
@@ -2369,7 +2396,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2369 | * bang classes and return. | 2396 | * bang classes and return. |
2370 | */ | 2397 | */ |
2371 | if (reset && !(ehc->i.action & ATA_EH_RESET)) { | 2398 | if (reset && !(ehc->i.action & ATA_EH_RESET)) { |
2372 | ata_link_for_each_dev(dev, link) | 2399 | ata_for_each_dev(dev, link, ALL) |
2373 | classes[dev->devno] = ATA_DEV_NONE; | 2400 | classes[dev->devno] = ATA_DEV_NONE; |
2374 | rc = 0; | 2401 | rc = 0; |
2375 | goto out; | 2402 | goto out; |
@@ -2454,7 +2481,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2454 | /* | 2481 | /* |
2455 | * Post-reset processing | 2482 | * Post-reset processing |
2456 | */ | 2483 | */ |
2457 | ata_link_for_each_dev(dev, link) { | 2484 | ata_for_each_dev(dev, link, ALL) { |
2458 | /* After the reset, the device state is PIO 0 and the | 2485 | /* After the reset, the device state is PIO 0 and the |
2459 | * controller state is undefined. Reset also wakes up | 2486 | * controller state is undefined. Reset also wakes up |
2460 | * drives from sleeping mode. | 2487 | * drives from sleeping mode. |
@@ -2510,7 +2537,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2510 | * can be reliably detected and retried. | 2537 | * can be reliably detected and retried. |
2511 | */ | 2538 | */ |
2512 | nr_unknown = 0; | 2539 | nr_unknown = 0; |
2513 | ata_link_for_each_dev(dev, link) { | 2540 | ata_for_each_dev(dev, link, ALL) { |
2514 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ | 2541 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ |
2515 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) { | 2542 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) { |
2516 | classes[dev->devno] = ATA_DEV_NONE; | 2543 | classes[dev->devno] = ATA_DEV_NONE; |
@@ -2619,8 +2646,8 @@ static inline void ata_eh_pull_park_action(struct ata_port *ap) | |||
2619 | 2646 | ||
2620 | spin_lock_irqsave(ap->lock, flags); | 2647 | spin_lock_irqsave(ap->lock, flags); |
2621 | INIT_COMPLETION(ap->park_req_pending); | 2648 | INIT_COMPLETION(ap->park_req_pending); |
2622 | ata_port_for_each_link(link, ap) { | 2649 | ata_for_each_link(link, ap, EDGE) { |
2623 | ata_link_for_each_dev(dev, link) { | 2650 | ata_for_each_dev(dev, link, ALL) { |
2624 | struct ata_eh_info *ehi = &link->eh_info; | 2651 | struct ata_eh_info *ehi = &link->eh_info; |
2625 | 2652 | ||
2626 | link->eh_context.i.dev_action[dev->devno] |= | 2653 | link->eh_context.i.dev_action[dev->devno] |= |
@@ -2675,7 +2702,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
2675 | * be done backwards such that PDIAG- is released by the slave | 2702 | * be done backwards such that PDIAG- is released by the slave |
2676 | * device before the master device is identified. | 2703 | * device before the master device is identified. |
2677 | */ | 2704 | */ |
2678 | ata_link_for_each_dev_reverse(dev, link) { | 2705 | ata_for_each_dev(dev, link, ALL_REVERSE) { |
2679 | unsigned int action = ata_eh_dev_action(dev); | 2706 | unsigned int action = ata_eh_dev_action(dev); |
2680 | unsigned int readid_flags = 0; | 2707 | unsigned int readid_flags = 0; |
2681 | 2708 | ||
@@ -2744,7 +2771,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
2744 | /* Configure new devices forward such that user doesn't see | 2771 | /* Configure new devices forward such that user doesn't see |
2745 | * device detection messages backwards. | 2772 | * device detection messages backwards. |
2746 | */ | 2773 | */ |
2747 | ata_link_for_each_dev(dev, link) { | 2774 | ata_for_each_dev(dev, link, ALL) { |
2748 | if (!(new_mask & (1 << dev->devno)) || | 2775 | if (!(new_mask & (1 << dev->devno)) || |
2749 | dev->class == ATA_DEV_PMP) | 2776 | dev->class == ATA_DEV_PMP) |
2750 | continue; | 2777 | continue; |
@@ -2793,10 +2820,7 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
2793 | int rc; | 2820 | int rc; |
2794 | 2821 | ||
2795 | /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ | 2822 | /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ |
2796 | ata_link_for_each_dev(dev, link) { | 2823 | ata_for_each_dev(dev, link, ENABLED) { |
2797 | if (!ata_dev_enabled(dev)) | ||
2798 | continue; | ||
2799 | |||
2800 | if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { | 2824 | if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { |
2801 | struct ata_ering_entry *ent; | 2825 | struct ata_ering_entry *ent; |
2802 | 2826 | ||
@@ -2813,14 +2837,11 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
2813 | rc = ata_do_set_mode(link, r_failed_dev); | 2837 | rc = ata_do_set_mode(link, r_failed_dev); |
2814 | 2838 | ||
2815 | /* if transfer mode has changed, set DUBIOUS_XFER on device */ | 2839 | /* if transfer mode has changed, set DUBIOUS_XFER on device */ |
2816 | ata_link_for_each_dev(dev, link) { | 2840 | ata_for_each_dev(dev, link, ENABLED) { |
2817 | struct ata_eh_context *ehc = &link->eh_context; | 2841 | struct ata_eh_context *ehc = &link->eh_context; |
2818 | u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; | 2842 | u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; |
2819 | u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); | 2843 | u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); |
2820 | 2844 | ||
2821 | if (!ata_dev_enabled(dev)) | ||
2822 | continue; | ||
2823 | |||
2824 | if (dev->xfer_mode != saved_xfer_mode || | 2845 | if (dev->xfer_mode != saved_xfer_mode || |
2825 | ata_ncq_enabled(dev) != saved_ncq) | 2846 | ata_ncq_enabled(dev) != saved_ncq) |
2826 | dev->flags |= ATA_DFLAG_DUBIOUS_XFER; | 2847 | dev->flags |= ATA_DFLAG_DUBIOUS_XFER; |
@@ -2881,9 +2902,8 @@ static int ata_link_nr_enabled(struct ata_link *link) | |||
2881 | struct ata_device *dev; | 2902 | struct ata_device *dev; |
2882 | int cnt = 0; | 2903 | int cnt = 0; |
2883 | 2904 | ||
2884 | ata_link_for_each_dev(dev, link) | 2905 | ata_for_each_dev(dev, link, ENABLED) |
2885 | if (ata_dev_enabled(dev)) | 2906 | cnt++; |
2886 | cnt++; | ||
2887 | return cnt; | 2907 | return cnt; |
2888 | } | 2908 | } |
2889 | 2909 | ||
@@ -2892,7 +2912,7 @@ static int ata_link_nr_vacant(struct ata_link *link) | |||
2892 | struct ata_device *dev; | 2912 | struct ata_device *dev; |
2893 | int cnt = 0; | 2913 | int cnt = 0; |
2894 | 2914 | ||
2895 | ata_link_for_each_dev(dev, link) | 2915 | ata_for_each_dev(dev, link, ALL) |
2896 | if (dev->class == ATA_DEV_UNKNOWN) | 2916 | if (dev->class == ATA_DEV_UNKNOWN) |
2897 | cnt++; | 2917 | cnt++; |
2898 | return cnt; | 2918 | return cnt; |
@@ -2918,7 +2938,7 @@ static int ata_eh_skip_recovery(struct ata_link *link) | |||
2918 | return 0; | 2938 | return 0; |
2919 | 2939 | ||
2920 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ | 2940 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ |
2921 | ata_link_for_each_dev(dev, link) { | 2941 | ata_for_each_dev(dev, link, ALL) { |
2922 | if (dev->class == ATA_DEV_UNKNOWN && | 2942 | if (dev->class == ATA_DEV_UNKNOWN && |
2923 | ehc->classes[dev->devno] != ATA_DEV_NONE) | 2943 | ehc->classes[dev->devno] != ATA_DEV_NONE) |
2924 | return 0; | 2944 | return 0; |
@@ -3026,7 +3046,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3026 | DPRINTK("ENTER\n"); | 3046 | DPRINTK("ENTER\n"); |
3027 | 3047 | ||
3028 | /* prep for recovery */ | 3048 | /* prep for recovery */ |
3029 | ata_port_for_each_link(link, ap) { | 3049 | ata_for_each_link(link, ap, EDGE) { |
3030 | struct ata_eh_context *ehc = &link->eh_context; | 3050 | struct ata_eh_context *ehc = &link->eh_context; |
3031 | 3051 | ||
3032 | /* re-enable link? */ | 3052 | /* re-enable link? */ |
@@ -3038,7 +3058,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3038 | ata_eh_done(link, NULL, ATA_EH_ENABLE_LINK); | 3058 | ata_eh_done(link, NULL, ATA_EH_ENABLE_LINK); |
3039 | } | 3059 | } |
3040 | 3060 | ||
3041 | ata_link_for_each_dev(dev, link) { | 3061 | ata_for_each_dev(dev, link, ALL) { |
3042 | if (link->flags & ATA_LFLAG_NO_RETRY) | 3062 | if (link->flags & ATA_LFLAG_NO_RETRY) |
3043 | ehc->tries[dev->devno] = 1; | 3063 | ehc->tries[dev->devno] = 1; |
3044 | else | 3064 | else |
@@ -3068,19 +3088,19 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3068 | goto out; | 3088 | goto out; |
3069 | 3089 | ||
3070 | /* prep for EH */ | 3090 | /* prep for EH */ |
3071 | ata_port_for_each_link(link, ap) { | 3091 | ata_for_each_link(link, ap, EDGE) { |
3072 | struct ata_eh_context *ehc = &link->eh_context; | 3092 | struct ata_eh_context *ehc = &link->eh_context; |
3073 | 3093 | ||
3074 | /* skip EH if possible. */ | 3094 | /* skip EH if possible. */ |
3075 | if (ata_eh_skip_recovery(link)) | 3095 | if (ata_eh_skip_recovery(link)) |
3076 | ehc->i.action = 0; | 3096 | ehc->i.action = 0; |
3077 | 3097 | ||
3078 | ata_link_for_each_dev(dev, link) | 3098 | ata_for_each_dev(dev, link, ALL) |
3079 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; | 3099 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; |
3080 | } | 3100 | } |
3081 | 3101 | ||
3082 | /* reset */ | 3102 | /* reset */ |
3083 | ata_port_for_each_link(link, ap) { | 3103 | ata_for_each_link(link, ap, EDGE) { |
3084 | struct ata_eh_context *ehc = &link->eh_context; | 3104 | struct ata_eh_context *ehc = &link->eh_context; |
3085 | 3105 | ||
3086 | if (!(ehc->i.action & ATA_EH_RESET)) | 3106 | if (!(ehc->i.action & ATA_EH_RESET)) |
@@ -3105,8 +3125,8 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3105 | ata_eh_pull_park_action(ap); | 3125 | ata_eh_pull_park_action(ap); |
3106 | 3126 | ||
3107 | deadline = jiffies; | 3127 | deadline = jiffies; |
3108 | ata_port_for_each_link(link, ap) { | 3128 | ata_for_each_link(link, ap, EDGE) { |
3109 | ata_link_for_each_dev(dev, link) { | 3129 | ata_for_each_dev(dev, link, ALL) { |
3110 | struct ata_eh_context *ehc = &link->eh_context; | 3130 | struct ata_eh_context *ehc = &link->eh_context; |
3111 | unsigned long tmp; | 3131 | unsigned long tmp; |
3112 | 3132 | ||
@@ -3134,8 +3154,8 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3134 | deadline = wait_for_completion_timeout(&ap->park_req_pending, | 3154 | deadline = wait_for_completion_timeout(&ap->park_req_pending, |
3135 | deadline - now); | 3155 | deadline - now); |
3136 | } while (deadline); | 3156 | } while (deadline); |
3137 | ata_port_for_each_link(link, ap) { | 3157 | ata_for_each_link(link, ap, EDGE) { |
3138 | ata_link_for_each_dev(dev, link) { | 3158 | ata_for_each_dev(dev, link, ALL) { |
3139 | if (!(link->eh_context.unloaded_mask & | 3159 | if (!(link->eh_context.unloaded_mask & |
3140 | (1 << dev->devno))) | 3160 | (1 << dev->devno))) |
3141 | continue; | 3161 | continue; |
@@ -3146,7 +3166,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3146 | } | 3166 | } |
3147 | 3167 | ||
3148 | /* the rest */ | 3168 | /* the rest */ |
3149 | ata_port_for_each_link(link, ap) { | 3169 | ata_for_each_link(link, ap, EDGE) { |
3150 | struct ata_eh_context *ehc = &link->eh_context; | 3170 | struct ata_eh_context *ehc = &link->eh_context; |
3151 | 3171 | ||
3152 | /* revalidate existing devices and attach new ones */ | 3172 | /* revalidate existing devices and attach new ones */ |
@@ -3172,7 +3192,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3172 | * disrupting the current users of the device. | 3192 | * disrupting the current users of the device. |
3173 | */ | 3193 | */ |
3174 | if (ehc->i.flags & ATA_EHI_DID_RESET) { | 3194 | if (ehc->i.flags & ATA_EHI_DID_RESET) { |
3175 | ata_link_for_each_dev(dev, link) { | 3195 | ata_for_each_dev(dev, link, ALL) { |
3176 | if (dev->class != ATA_DEV_ATAPI) | 3196 | if (dev->class != ATA_DEV_ATAPI) |
3177 | continue; | 3197 | continue; |
3178 | rc = atapi_eh_clear_ua(dev); | 3198 | rc = atapi_eh_clear_ua(dev); |
@@ -3183,7 +3203,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3183 | 3203 | ||
3184 | /* configure link power saving */ | 3204 | /* configure link power saving */ |
3185 | if (ehc->i.action & ATA_EH_LPM) | 3205 | if (ehc->i.action & ATA_EH_LPM) |
3186 | ata_link_for_each_dev(dev, link) | 3206 | ata_for_each_dev(dev, link, ALL) |
3187 | ata_dev_enable_pm(dev, ap->pm_policy); | 3207 | ata_dev_enable_pm(dev, ap->pm_policy); |
3188 | 3208 | ||
3189 | /* this link is okay now */ | 3209 | /* this link is okay now */ |
@@ -3288,7 +3308,7 @@ void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3288 | rc = ata_eh_recover(ap, prereset, softreset, hardreset, postreset, | 3308 | rc = ata_eh_recover(ap, prereset, softreset, hardreset, postreset, |
3289 | NULL); | 3309 | NULL); |
3290 | if (rc) { | 3310 | if (rc) { |
3291 | ata_link_for_each_dev(dev, &ap->link) | 3311 | ata_for_each_dev(dev, &ap->link, ALL) |
3292 | ata_dev_disable(dev); | 3312 | ata_dev_disable(dev); |
3293 | } | 3313 | } |
3294 | 3314 | ||
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index b65db309c181..98ca07a2db87 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -321,7 +321,7 @@ static void sata_pmp_quirks(struct ata_port *ap) | |||
321 | 321 | ||
322 | if (vendor == 0x1095 && devid == 0x3726) { | 322 | if (vendor == 0x1095 && devid == 0x3726) { |
323 | /* sil3726 quirks */ | 323 | /* sil3726 quirks */ |
324 | ata_port_for_each_link(link, ap) { | 324 | ata_for_each_link(link, ap, EDGE) { |
325 | /* Class code report is unreliable and SRST | 325 | /* Class code report is unreliable and SRST |
326 | * times out under certain configurations. | 326 | * times out under certain configurations. |
327 | */ | 327 | */ |
@@ -336,7 +336,7 @@ static void sata_pmp_quirks(struct ata_port *ap) | |||
336 | } | 336 | } |
337 | } else if (vendor == 0x1095 && devid == 0x4723) { | 337 | } else if (vendor == 0x1095 && devid == 0x4723) { |
338 | /* sil4723 quirks */ | 338 | /* sil4723 quirks */ |
339 | ata_port_for_each_link(link, ap) { | 339 | ata_for_each_link(link, ap, EDGE) { |
340 | /* class code report is unreliable */ | 340 | /* class code report is unreliable */ |
341 | if (link->pmp < 2) | 341 | if (link->pmp < 2) |
342 | link->flags |= ATA_LFLAG_ASSUME_ATA; | 342 | link->flags |= ATA_LFLAG_ASSUME_ATA; |
@@ -348,7 +348,7 @@ static void sata_pmp_quirks(struct ata_port *ap) | |||
348 | } | 348 | } |
349 | } else if (vendor == 0x1095 && devid == 0x4726) { | 349 | } else if (vendor == 0x1095 && devid == 0x4726) { |
350 | /* sil4726 quirks */ | 350 | /* sil4726 quirks */ |
351 | ata_port_for_each_link(link, ap) { | 351 | ata_for_each_link(link, ap, EDGE) { |
352 | /* Class code report is unreliable and SRST | 352 | /* Class code report is unreliable and SRST |
353 | * times out under certain configurations. | 353 | * times out under certain configurations. |
354 | * Config device can be at port 0 or 5 and | 354 | * Config device can be at port 0 or 5 and |
@@ -450,7 +450,7 @@ int sata_pmp_attach(struct ata_device *dev) | |||
450 | if (ap->ops->pmp_attach) | 450 | if (ap->ops->pmp_attach) |
451 | ap->ops->pmp_attach(ap); | 451 | ap->ops->pmp_attach(ap); |
452 | 452 | ||
453 | ata_port_for_each_link(tlink, ap) | 453 | ata_for_each_link(tlink, ap, EDGE) |
454 | sata_link_init_spd(tlink); | 454 | sata_link_init_spd(tlink); |
455 | 455 | ||
456 | ata_acpi_associate_sata_port(ap); | 456 | ata_acpi_associate_sata_port(ap); |
@@ -487,7 +487,7 @@ static void sata_pmp_detach(struct ata_device *dev) | |||
487 | if (ap->ops->pmp_detach) | 487 | if (ap->ops->pmp_detach) |
488 | ap->ops->pmp_detach(ap); | 488 | ap->ops->pmp_detach(ap); |
489 | 489 | ||
490 | ata_port_for_each_link(tlink, ap) | 490 | ata_for_each_link(tlink, ap, EDGE) |
491 | ata_eh_detach_dev(tlink->device); | 491 | ata_eh_detach_dev(tlink->device); |
492 | 492 | ||
493 | spin_lock_irqsave(ap->lock, flags); | 493 | spin_lock_irqsave(ap->lock, flags); |
@@ -700,7 +700,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
700 | } | 700 | } |
701 | 701 | ||
702 | /* PMP is reset, SErrors cannot be trusted, scan all */ | 702 | /* PMP is reset, SErrors cannot be trusted, scan all */ |
703 | ata_port_for_each_link(tlink, ap) { | 703 | ata_for_each_link(tlink, ap, EDGE) { |
704 | struct ata_eh_context *ehc = &tlink->eh_context; | 704 | struct ata_eh_context *ehc = &tlink->eh_context; |
705 | 705 | ||
706 | ehc->i.probe_mask |= ATA_ALL_DEVICES; | 706 | ehc->i.probe_mask |= ATA_ALL_DEVICES; |
@@ -768,7 +768,7 @@ static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap) | |||
768 | 768 | ||
769 | spin_lock_irqsave(ap->lock, flags); | 769 | spin_lock_irqsave(ap->lock, flags); |
770 | 770 | ||
771 | ata_port_for_each_link(link, ap) { | 771 | ata_for_each_link(link, ap, EDGE) { |
772 | if (!(link->flags & ATA_LFLAG_DISABLED)) | 772 | if (!(link->flags & ATA_LFLAG_DISABLED)) |
773 | continue; | 773 | continue; |
774 | 774 | ||
@@ -852,7 +852,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
852 | int cnt, rc; | 852 | int cnt, rc; |
853 | 853 | ||
854 | pmp_tries = ATA_EH_PMP_TRIES; | 854 | pmp_tries = ATA_EH_PMP_TRIES; |
855 | ata_port_for_each_link(link, ap) | 855 | ata_for_each_link(link, ap, EDGE) |
856 | link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES; | 856 | link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES; |
857 | 857 | ||
858 | retry: | 858 | retry: |
@@ -861,7 +861,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
861 | rc = ata_eh_recover(ap, ops->prereset, ops->softreset, | 861 | rc = ata_eh_recover(ap, ops->prereset, ops->softreset, |
862 | ops->hardreset, ops->postreset, NULL); | 862 | ops->hardreset, ops->postreset, NULL); |
863 | if (rc) { | 863 | if (rc) { |
864 | ata_link_for_each_dev(dev, &ap->link) | 864 | ata_for_each_dev(dev, &ap->link, ALL) |
865 | ata_dev_disable(dev); | 865 | ata_dev_disable(dev); |
866 | return rc; | 866 | return rc; |
867 | } | 867 | } |
@@ -870,7 +870,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
870 | return 0; | 870 | return 0; |
871 | 871 | ||
872 | /* new PMP online */ | 872 | /* new PMP online */ |
873 | ata_port_for_each_link(link, ap) | 873 | ata_for_each_link(link, ap, EDGE) |
874 | link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES; | 874 | link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES; |
875 | 875 | ||
876 | /* fall through */ | 876 | /* fall through */ |
@@ -942,7 +942,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
942 | } | 942 | } |
943 | 943 | ||
944 | cnt = 0; | 944 | cnt = 0; |
945 | ata_port_for_each_link(link, ap) { | 945 | ata_for_each_link(link, ap, EDGE) { |
946 | if (!(gscr_error & (1 << link->pmp))) | 946 | if (!(gscr_error & (1 << link->pmp))) |
947 | continue; | 947 | continue; |
948 | 948 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 47c7afcb36f2..0b2e14f67655 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3229,12 +3229,12 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) | |||
3229 | return; | 3229 | return; |
3230 | 3230 | ||
3231 | repeat: | 3231 | repeat: |
3232 | ata_port_for_each_link(link, ap) { | 3232 | ata_for_each_link(link, ap, EDGE) { |
3233 | ata_link_for_each_dev(dev, link) { | 3233 | ata_for_each_dev(dev, link, ENABLED) { |
3234 | struct scsi_device *sdev; | 3234 | struct scsi_device *sdev; |
3235 | int channel = 0, id = 0; | 3235 | int channel = 0, id = 0; |
3236 | 3236 | ||
3237 | if (!ata_dev_enabled(dev) || dev->sdev) | 3237 | if (dev->sdev) |
3238 | continue; | 3238 | continue; |
3239 | 3239 | ||
3240 | if (ata_is_host_link(link)) | 3240 | if (ata_is_host_link(link)) |
@@ -3255,9 +3255,9 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) | |||
3255 | * failure occurred, scan would have failed silently. Check | 3255 | * failure occurred, scan would have failed silently. Check |
3256 | * whether all devices are attached. | 3256 | * whether all devices are attached. |
3257 | */ | 3257 | */ |
3258 | ata_port_for_each_link(link, ap) { | 3258 | ata_for_each_link(link, ap, EDGE) { |
3259 | ata_link_for_each_dev(dev, link) { | 3259 | ata_for_each_dev(dev, link, ENABLED) { |
3260 | if (ata_dev_enabled(dev) && !dev->sdev) | 3260 | if (!dev->sdev) |
3261 | goto exit_loop; | 3261 | goto exit_loop; |
3262 | } | 3262 | } |
3263 | } | 3263 | } |
@@ -3381,7 +3381,7 @@ static void ata_scsi_handle_link_detach(struct ata_link *link) | |||
3381 | struct ata_port *ap = link->ap; | 3381 | struct ata_port *ap = link->ap; |
3382 | struct ata_device *dev; | 3382 | struct ata_device *dev; |
3383 | 3383 | ||
3384 | ata_link_for_each_dev(dev, link) { | 3384 | ata_for_each_dev(dev, link, ALL) { |
3385 | unsigned long flags; | 3385 | unsigned long flags; |
3386 | 3386 | ||
3387 | if (!(dev->flags & ATA_DFLAG_DETACHED)) | 3387 | if (!(dev->flags & ATA_DFLAG_DETACHED)) |
@@ -3496,7 +3496,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, | |||
3496 | if (devno == SCAN_WILD_CARD) { | 3496 | if (devno == SCAN_WILD_CARD) { |
3497 | struct ata_link *link; | 3497 | struct ata_link *link; |
3498 | 3498 | ||
3499 | ata_port_for_each_link(link, ap) { | 3499 | ata_for_each_link(link, ap, EDGE) { |
3500 | struct ata_eh_info *ehi = &link->eh_info; | 3500 | struct ata_eh_info *ehi = &link->eh_info; |
3501 | ehi->probe_mask |= ATA_ALL_DEVICES; | 3501 | ehi->probe_mask |= ATA_ALL_DEVICES; |
3502 | ehi->action |= ATA_EH_RESET; | 3502 | ehi->action |= ATA_EH_RESET; |
@@ -3544,11 +3544,11 @@ void ata_scsi_dev_rescan(struct work_struct *work) | |||
3544 | 3544 | ||
3545 | spin_lock_irqsave(ap->lock, flags); | 3545 | spin_lock_irqsave(ap->lock, flags); |
3546 | 3546 | ||
3547 | ata_port_for_each_link(link, ap) { | 3547 | ata_for_each_link(link, ap, EDGE) { |
3548 | ata_link_for_each_dev(dev, link) { | 3548 | ata_for_each_dev(dev, link, ENABLED) { |
3549 | struct scsi_device *sdev = dev->sdev; | 3549 | struct scsi_device *sdev = dev->sdev; |
3550 | 3550 | ||
3551 | if (!ata_dev_enabled(dev) || !sdev) | 3551 | if (!sdev) |
3552 | continue; | 3552 | continue; |
3553 | if (scsi_device_get(sdev)) | 3553 | if (scsi_device_get(sdev)) |
3554 | continue; | 3554 | continue; |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index 1266924c11f9..1050fed96b2b 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -356,7 +356,6 @@ static void bfin_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
356 | * bfin_set_dmamode - Initialize host controller PATA DMA timings | 356 | * bfin_set_dmamode - Initialize host controller PATA DMA timings |
357 | * @ap: Port whose timings we are configuring | 357 | * @ap: Port whose timings we are configuring |
358 | * @adev: um | 358 | * @adev: um |
359 | * @udma: udma mode, 0 - 6 | ||
360 | * | 359 | * |
361 | * Set UDMA mode for device. | 360 | * Set UDMA mode for device. |
362 | * | 361 | * |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 860ede526282..f828a29d7756 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -465,24 +465,22 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus | |||
465 | { | 465 | { |
466 | struct ata_device *dev; | 466 | struct ata_device *dev; |
467 | 467 | ||
468 | ata_link_for_each_dev(dev, link) { | 468 | ata_for_each_dev(dev, link, ENABLED) { |
469 | if (ata_dev_enabled(dev)) { | 469 | /* We don't really care */ |
470 | /* We don't really care */ | 470 | dev->pio_mode = XFER_PIO_0; |
471 | dev->pio_mode = XFER_PIO_0; | 471 | dev->dma_mode = XFER_MW_DMA_0; |
472 | dev->dma_mode = XFER_MW_DMA_0; | 472 | /* We do need the right mode information for DMA or PIO |
473 | /* We do need the right mode information for DMA or PIO | 473 | and this comes from the current configuration flags */ |
474 | and this comes from the current configuration flags */ | 474 | if (ata_id_has_dma(dev->id)) { |
475 | if (ata_id_has_dma(dev->id)) { | 475 | ata_dev_printk(dev, KERN_INFO, "configured for DMA\n"); |
476 | ata_dev_printk(dev, KERN_INFO, "configured for DMA\n"); | 476 | dev->xfer_mode = XFER_MW_DMA_0; |
477 | dev->xfer_mode = XFER_MW_DMA_0; | 477 | dev->xfer_shift = ATA_SHIFT_MWDMA; |
478 | dev->xfer_shift = ATA_SHIFT_MWDMA; | 478 | dev->flags &= ~ATA_DFLAG_PIO; |
479 | dev->flags &= ~ATA_DFLAG_PIO; | 479 | } else { |
480 | } else { | 480 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); |
481 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); | 481 | dev->xfer_mode = XFER_PIO_0; |
482 | dev->xfer_mode = XFER_PIO_0; | 482 | dev->xfer_shift = ATA_SHIFT_PIO; |
483 | dev->xfer_shift = ATA_SHIFT_PIO; | 483 | dev->flags |= ATA_DFLAG_PIO; |
484 | dev->flags |= ATA_DFLAG_PIO; | ||
485 | } | ||
486 | } | 484 | } |
487 | } | 485 | } |
488 | return 0; | 486 | return 0; |
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index 2014253f6c88..b173c157ab00 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
@@ -30,14 +30,12 @@ static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error) | |||
30 | { | 30 | { |
31 | struct ata_device *dev; | 31 | struct ata_device *dev; |
32 | 32 | ||
33 | ata_link_for_each_dev(dev, link) { | 33 | ata_for_each_dev(dev, link, ENABLED) { |
34 | if (ata_dev_enabled(dev)) { | 34 | ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); |
35 | ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); | 35 | dev->pio_mode = XFER_PIO_0; |
36 | dev->pio_mode = XFER_PIO_0; | 36 | dev->xfer_mode = XFER_PIO_0; |
37 | dev->xfer_mode = XFER_PIO_0; | 37 | dev->xfer_shift = ATA_SHIFT_PIO; |
38 | dev->xfer_shift = ATA_SHIFT_PIO; | 38 | dev->flags |= ATA_DFLAG_PIO; |
39 | dev->flags |= ATA_DFLAG_PIO; | ||
40 | } | ||
41 | } | 39 | } |
42 | return 0; | 40 | return 0; |
43 | } | 41 | } |
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 930c2208640b..6c1d778b63a9 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -194,15 +194,12 @@ static int legacy_set_mode(struct ata_link *link, struct ata_device **unused) | |||
194 | { | 194 | { |
195 | struct ata_device *dev; | 195 | struct ata_device *dev; |
196 | 196 | ||
197 | ata_link_for_each_dev(dev, link) { | 197 | ata_for_each_dev(dev, link, ENABLED) { |
198 | if (ata_dev_enabled(dev)) { | 198 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); |
199 | ata_dev_printk(dev, KERN_INFO, | 199 | dev->pio_mode = XFER_PIO_0; |
200 | "configured for PIO\n"); | 200 | dev->xfer_mode = XFER_PIO_0; |
201 | dev->pio_mode = XFER_PIO_0; | 201 | dev->xfer_shift = ATA_SHIFT_PIO; |
202 | dev->xfer_mode = XFER_PIO_0; | 202 | dev->flags |= ATA_DFLAG_PIO; |
203 | dev->xfer_shift = ATA_SHIFT_PIO; | ||
204 | dev->flags |= ATA_DFLAG_PIO; | ||
205 | } | ||
206 | } | 203 | } |
207 | return 0; | 204 | return 0; |
208 | } | 205 | } |
@@ -641,7 +638,6 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
641 | * qdi6580dp_set_piomode - PIO setup for dual channel | 638 | * qdi6580dp_set_piomode - PIO setup for dual channel |
642 | * @ap: Port | 639 | * @ap: Port |
643 | * @adev: Device | 640 | * @adev: Device |
644 | * @irq: interrupt line | ||
645 | * | 641 | * |
646 | * In dual channel mode the 6580 has one clock per channel and we have | 642 | * In dual channel mode the 6580 has one clock per channel and we have |
647 | * to software clockswitch in qc_issue. | 643 | * to software clockswitch in qc_issue. |
@@ -1028,7 +1024,7 @@ static __init int legacy_init_one(struct legacy_probe *probe) | |||
1028 | /* Nothing found means we drop the port as its probably not there */ | 1024 | /* Nothing found means we drop the port as its probably not there */ |
1029 | 1025 | ||
1030 | ret = -ENODEV; | 1026 | ret = -ENODEV; |
1031 | ata_link_for_each_dev(dev, &ap->link) { | 1027 | ata_for_each_dev(dev, &ap->link, ALL) { |
1032 | if (!ata_dev_absent(dev)) { | 1028 | if (!ata_dev_absent(dev)) { |
1033 | legacy_host[probe->slot] = host; | 1029 | legacy_host[probe->slot] = host; |
1034 | ld->platform_dev = pdev; | 1030 | ld->platform_dev = pdev; |
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index c0dbc46a348e..2c1a91c40c1a 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -116,7 +116,6 @@ static void oldpiix_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
116 | * oldpiix_set_dmamode - Initialize host controller PATA DMA timings | 116 | * oldpiix_set_dmamode - Initialize host controller PATA DMA timings |
117 | * @ap: Port whose timings we are configuring | 117 | * @ap: Port whose timings we are configuring |
118 | * @adev: Device to program | 118 | * @adev: Device to program |
119 | * @isich: True if the device is an ICH and has IOCFG registers | ||
120 | * | 119 | * |
121 | * Set MWDMA mode for device, in host controller PCI config space. | 120 | * Set MWDMA mode for device, in host controller PCI config space. |
122 | * | 121 | * |
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index 0e1c2c1134d3..e94efccaa482 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -281,7 +281,6 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long | |||
281 | * pdc2027x_set_piomode - Initialize host controller PATA PIO timings | 281 | * pdc2027x_set_piomode - Initialize host controller PATA PIO timings |
282 | * @ap: Port to configure | 282 | * @ap: Port to configure |
283 | * @adev: um | 283 | * @adev: um |
284 | * @pio: PIO mode, 0 - 4 | ||
285 | * | 284 | * |
286 | * Set PIO mode for device. | 285 | * Set PIO mode for device. |
287 | * | 286 | * |
@@ -326,7 +325,6 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
326 | * pdc2027x_set_dmamode - Initialize host controller PATA UDMA timings | 325 | * pdc2027x_set_dmamode - Initialize host controller PATA UDMA timings |
327 | * @ap: Port to configure | 326 | * @ap: Port to configure |
328 | * @adev: um | 327 | * @adev: um |
329 | * @udma: udma mode, XFER_UDMA_0 to XFER_UDMA_6 | ||
330 | * | 328 | * |
331 | * Set UDMA mode for device. | 329 | * Set UDMA mode for device. |
332 | * | 330 | * |
@@ -406,23 +404,20 @@ static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed | |||
406 | if (rc < 0) | 404 | if (rc < 0) |
407 | return rc; | 405 | return rc; |
408 | 406 | ||
409 | ata_link_for_each_dev(dev, link) { | 407 | ata_for_each_dev(dev, link, ENABLED) { |
410 | if (ata_dev_enabled(dev)) { | 408 | pdc2027x_set_piomode(ap, dev); |
411 | 409 | ||
412 | pdc2027x_set_piomode(ap, dev); | 410 | /* |
411 | * Enable prefetch if the device support PIO only. | ||
412 | */ | ||
413 | if (dev->xfer_shift == ATA_SHIFT_PIO) { | ||
414 | u32 ctcr1 = ioread32(dev_mmio(ap, dev, PDC_CTCR1)); | ||
415 | ctcr1 |= (1 << 25); | ||
416 | iowrite32(ctcr1, dev_mmio(ap, dev, PDC_CTCR1)); | ||
413 | 417 | ||
414 | /* | 418 | PDPRINTK("Turn on prefetch\n"); |
415 | * Enable prefetch if the device support PIO only. | 419 | } else { |
416 | */ | 420 | pdc2027x_set_dmamode(ap, dev); |
417 | if (dev->xfer_shift == ATA_SHIFT_PIO) { | ||
418 | u32 ctcr1 = ioread32(dev_mmio(ap, dev, PDC_CTCR1)); | ||
419 | ctcr1 |= (1 << 25); | ||
420 | iowrite32(ctcr1, dev_mmio(ap, dev, PDC_CTCR1)); | ||
421 | |||
422 | PDPRINTK("Turn on prefetch\n"); | ||
423 | } else { | ||
424 | pdc2027x_set_dmamode(ap, dev); | ||
425 | } | ||
426 | } | 421 | } |
427 | } | 422 | } |
428 | return 0; | 423 | return 0; |
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 77e4e3b17f54..6afa07a37648 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
@@ -34,14 +34,12 @@ static int pata_platform_set_mode(struct ata_link *link, struct ata_device **unu | |||
34 | { | 34 | { |
35 | struct ata_device *dev; | 35 | struct ata_device *dev; |
36 | 36 | ||
37 | ata_link_for_each_dev(dev, link) { | 37 | ata_for_each_dev(dev, link, ENABLED) { |
38 | if (ata_dev_enabled(dev)) { | 38 | /* We don't really care */ |
39 | /* We don't really care */ | 39 | dev->pio_mode = dev->xfer_mode = XFER_PIO_0; |
40 | dev->pio_mode = dev->xfer_mode = XFER_PIO_0; | 40 | dev->xfer_shift = ATA_SHIFT_PIO; |
41 | dev->xfer_shift = ATA_SHIFT_PIO; | 41 | dev->flags |= ATA_DFLAG_PIO; |
42 | dev->flags |= ATA_DFLAG_PIO; | 42 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); |
43 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); | ||
44 | } | ||
45 | } | 43 | } |
46 | return 0; | 44 | return 0; |
47 | } | 45 | } |
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index 0b0aa452de14..695d44ae52c6 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c | |||
@@ -81,7 +81,6 @@ static void radisys_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
81 | * radisys_set_dmamode - Initialize host controller PATA DMA timings | 81 | * radisys_set_dmamode - Initialize host controller PATA DMA timings |
82 | * @ap: Port whose timings we are configuring | 82 | * @ap: Port whose timings we are configuring |
83 | * @adev: Device to program | 83 | * @adev: Device to program |
84 | * @isich: True if the device is an ICH and has IOCFG registers | ||
85 | * | 84 | * |
86 | * Set MWDMA mode for device, in host controller PCI config space. | 85 | * Set MWDMA mode for device, in host controller PCI config space. |
87 | * | 86 | * |
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index 7dfd1f3f6f3a..46d6bc1bf1e9 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
@@ -38,15 +38,13 @@ static int rz1000_set_mode(struct ata_link *link, struct ata_device **unused) | |||
38 | { | 38 | { |
39 | struct ata_device *dev; | 39 | struct ata_device *dev; |
40 | 40 | ||
41 | ata_link_for_each_dev(dev, link) { | 41 | ata_for_each_dev(dev, link, ENABLED) { |
42 | if (ata_dev_enabled(dev)) { | 42 | /* We don't really care */ |
43 | /* We don't really care */ | 43 | dev->pio_mode = XFER_PIO_0; |
44 | dev->pio_mode = XFER_PIO_0; | 44 | dev->xfer_mode = XFER_PIO_0; |
45 | dev->xfer_mode = XFER_PIO_0; | 45 | dev->xfer_shift = ATA_SHIFT_PIO; |
46 | dev->xfer_shift = ATA_SHIFT_PIO; | 46 | dev->flags |= ATA_DFLAG_PIO; |
47 | dev->flags |= ATA_DFLAG_PIO; | 47 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); |
48 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); | ||
49 | } | ||
50 | } | 48 | } |
51 | return 0; | 49 | return 0; |
52 | } | 50 | } |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index cf3707e516a2..d447f1cb46ec 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -210,7 +210,6 @@ static void scc_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
210 | * scc_set_dmamode - Initialize host controller PATA DMA timings | 210 | * scc_set_dmamode - Initialize host controller PATA DMA timings |
211 | * @ap: Port whose timings we are configuring | 211 | * @ap: Port whose timings we are configuring |
212 | * @adev: um | 212 | * @adev: um |
213 | * @udma: udma mode, 0 - 6 | ||
214 | * | 213 | * |
215 | * Set UDMA mode for device. | 214 | * Set UDMA mode for device. |
216 | * | 215 | * |
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index 72e41c9f969b..8d2fd9dd40c7 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -138,7 +138,6 @@ static struct sv_cable_table cable_detect[] = { | |||
138 | /** | 138 | /** |
139 | * serverworks_cable_detect - cable detection | 139 | * serverworks_cable_detect - cable detection |
140 | * @ap: ATA port | 140 | * @ap: ATA port |
141 | * @deadline: deadline jiffies for the operation | ||
142 | * | 141 | * |
143 | * Perform cable detection according to the device and subvendor | 142 | * Perform cable detection according to the device and subvendor |
144 | * identifications | 143 | * identifications |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index e4be55e047f6..27ceb42a774b 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -112,7 +112,6 @@ static int sis_133_cable_detect(struct ata_port *ap) | |||
112 | /** | 112 | /** |
113 | * sis_66_cable_detect - check for 40/80 pin | 113 | * sis_66_cable_detect - check for 40/80 pin |
114 | * @ap: Port | 114 | * @ap: Port |
115 | * @deadline: deadline jiffies for the operation | ||
116 | * | 115 | * |
117 | * Perform cable detection on the UDMA66, UDMA100 and early UDMA133 | 116 | * Perform cable detection on the UDMA66, UDMA100 and early UDMA133 |
118 | * SiS IDE controllers. | 117 | * SiS IDE controllers. |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 2b24ae58b52e..86918634a4c5 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -1836,7 +1836,6 @@ static void mv_unexpected_intr(struct ata_port *ap, int edma_was_enabled) | |||
1836 | /** | 1836 | /** |
1837 | * mv_err_intr - Handle error interrupts on the port | 1837 | * mv_err_intr - Handle error interrupts on the port |
1838 | * @ap: ATA channel to manipulate | 1838 | * @ap: ATA channel to manipulate |
1839 | * @qc: affected command (non-NCQ), or NULL | ||
1840 | * | 1839 | * |
1841 | * Most cases require a full reset of the chip's state machine, | 1840 | * Most cases require a full reset of the chip's state machine, |
1842 | * which also performs a COMRESET. | 1841 | * which also performs a COMRESET. |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 031d7b7dee34..564c142b03b0 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -46,7 +46,9 @@ | |||
46 | #include <linux/libata.h> | 46 | #include <linux/libata.h> |
47 | 47 | ||
48 | #define DRV_NAME "sata_sil" | 48 | #define DRV_NAME "sata_sil" |
49 | #define DRV_VERSION "2.3" | 49 | #define DRV_VERSION "2.4" |
50 | |||
51 | #define SIL_DMA_BOUNDARY 0x7fffffffUL | ||
50 | 52 | ||
51 | enum { | 53 | enum { |
52 | SIL_MMIO_BAR = 5, | 54 | SIL_MMIO_BAR = 5, |
@@ -118,6 +120,10 @@ static void sil_dev_config(struct ata_device *dev); | |||
118 | static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); | 120 | static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
119 | static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | 121 | static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
120 | static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed); | 122 | static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed); |
123 | static void sil_qc_prep(struct ata_queued_cmd *qc); | ||
124 | static void sil_bmdma_setup(struct ata_queued_cmd *qc); | ||
125 | static void sil_bmdma_start(struct ata_queued_cmd *qc); | ||
126 | static void sil_bmdma_stop(struct ata_queued_cmd *qc); | ||
121 | static void sil_freeze(struct ata_port *ap); | 127 | static void sil_freeze(struct ata_port *ap); |
122 | static void sil_thaw(struct ata_port *ap); | 128 | static void sil_thaw(struct ata_port *ap); |
123 | 129 | ||
@@ -167,13 +173,22 @@ static struct pci_driver sil_pci_driver = { | |||
167 | }; | 173 | }; |
168 | 174 | ||
169 | static struct scsi_host_template sil_sht = { | 175 | static struct scsi_host_template sil_sht = { |
170 | ATA_BMDMA_SHT(DRV_NAME), | 176 | ATA_BASE_SHT(DRV_NAME), |
177 | /** These controllers support Large Block Transfer which allows | ||
178 | transfer chunks up to 2GB and which cross 64KB boundaries, | ||
179 | therefore the DMA limits are more relaxed than standard ATA SFF. */ | ||
180 | .dma_boundary = SIL_DMA_BOUNDARY, | ||
181 | .sg_tablesize = ATA_MAX_PRD | ||
171 | }; | 182 | }; |
172 | 183 | ||
173 | static struct ata_port_operations sil_ops = { | 184 | static struct ata_port_operations sil_ops = { |
174 | .inherits = &ata_bmdma_port_ops, | 185 | .inherits = &ata_bmdma_port_ops, |
175 | .dev_config = sil_dev_config, | 186 | .dev_config = sil_dev_config, |
176 | .set_mode = sil_set_mode, | 187 | .set_mode = sil_set_mode, |
188 | .bmdma_setup = sil_bmdma_setup, | ||
189 | .bmdma_start = sil_bmdma_start, | ||
190 | .bmdma_stop = sil_bmdma_stop, | ||
191 | .qc_prep = sil_qc_prep, | ||
177 | .freeze = sil_freeze, | 192 | .freeze = sil_freeze, |
178 | .thaw = sil_thaw, | 193 | .thaw = sil_thaw, |
179 | .scr_read = sil_scr_read, | 194 | .scr_read = sil_scr_read, |
@@ -249,6 +264,83 @@ module_param(slow_down, int, 0444); | |||
249 | MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)"); | 264 | MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)"); |
250 | 265 | ||
251 | 266 | ||
267 | static void sil_bmdma_stop(struct ata_queued_cmd *qc) | ||
268 | { | ||
269 | struct ata_port *ap = qc->ap; | ||
270 | void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR]; | ||
271 | void __iomem *bmdma2 = mmio_base + sil_port[ap->port_no].bmdma2; | ||
272 | |||
273 | /* clear start/stop bit - can safely always write 0 */ | ||
274 | iowrite8(0, bmdma2); | ||
275 | |||
276 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | ||
277 | ata_sff_dma_pause(ap); | ||
278 | } | ||
279 | |||
280 | static void sil_bmdma_setup(struct ata_queued_cmd *qc) | ||
281 | { | ||
282 | struct ata_port *ap = qc->ap; | ||
283 | void __iomem *bmdma = ap->ioaddr.bmdma_addr; | ||
284 | |||
285 | /* load PRD table addr. */ | ||
286 | iowrite32(ap->prd_dma, bmdma + ATA_DMA_TABLE_OFS); | ||
287 | |||
288 | /* issue r/w command */ | ||
289 | ap->ops->sff_exec_command(ap, &qc->tf); | ||
290 | } | ||
291 | |||
292 | static void sil_bmdma_start(struct ata_queued_cmd *qc) | ||
293 | { | ||
294 | unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); | ||
295 | struct ata_port *ap = qc->ap; | ||
296 | void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR]; | ||
297 | void __iomem *bmdma2 = mmio_base + sil_port[ap->port_no].bmdma2; | ||
298 | u8 dmactl = ATA_DMA_START; | ||
299 | |||
300 | /* set transfer direction, start host DMA transaction | ||
301 | Note: For Large Block Transfer to work, the DMA must be started | ||
302 | using the bmdma2 register. */ | ||
303 | if (!rw) | ||
304 | dmactl |= ATA_DMA_WR; | ||
305 | iowrite8(dmactl, bmdma2); | ||
306 | } | ||
307 | |||
308 | /* The way God intended PCI IDE scatter/gather lists to look and behave... */ | ||
309 | static void sil_fill_sg(struct ata_queued_cmd *qc) | ||
310 | { | ||
311 | struct scatterlist *sg; | ||
312 | struct ata_port *ap = qc->ap; | ||
313 | struct ata_prd *prd, *last_prd = NULL; | ||
314 | unsigned int si; | ||
315 | |||
316 | prd = &ap->prd[0]; | ||
317 | for_each_sg(qc->sg, sg, qc->n_elem, si) { | ||
318 | /* Note h/w doesn't support 64-bit, so we unconditionally | ||
319 | * truncate dma_addr_t to u32. | ||
320 | */ | ||
321 | u32 addr = (u32) sg_dma_address(sg); | ||
322 | u32 sg_len = sg_dma_len(sg); | ||
323 | |||
324 | prd->addr = cpu_to_le32(addr); | ||
325 | prd->flags_len = cpu_to_le32(sg_len); | ||
326 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, sg_len); | ||
327 | |||
328 | last_prd = prd; | ||
329 | prd++; | ||
330 | } | ||
331 | |||
332 | if (likely(last_prd)) | ||
333 | last_prd->flags_len |= cpu_to_le32(ATA_PRD_EOT); | ||
334 | } | ||
335 | |||
336 | static void sil_qc_prep(struct ata_queued_cmd *qc) | ||
337 | { | ||
338 | if (!(qc->flags & ATA_QCFLAG_DMAMAP)) | ||
339 | return; | ||
340 | |||
341 | sil_fill_sg(qc); | ||
342 | } | ||
343 | |||
252 | static unsigned char sil_get_device_cache_line(struct pci_dev *pdev) | 344 | static unsigned char sil_get_device_cache_line(struct pci_dev *pdev) |
253 | { | 345 | { |
254 | u8 cache_line = 0; | 346 | u8 cache_line = 0; |
@@ -278,7 +370,7 @@ static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed) | |||
278 | if (rc) | 370 | if (rc) |
279 | return rc; | 371 | return rc; |
280 | 372 | ||
281 | ata_link_for_each_dev(dev, link) { | 373 | ata_for_each_dev(dev, link, ALL) { |
282 | if (!ata_dev_enabled(dev)) | 374 | if (!ata_dev_enabled(dev)) |
283 | dev_mode[dev->devno] = 0; /* PIO0/1/2 */ | 375 | dev_mode[dev->devno] = 0; /* PIO0/1/2 */ |
284 | else if (dev->flags & ATA_DFLAG_PIO) | 376 | else if (dev->flags & ATA_DFLAG_PIO) |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 4a597d8c2f70..78b989d202a3 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -582,3 +582,19 @@ int dmi_walk(void (*decode)(const struct dmi_header *)) | |||
582 | return 0; | 582 | return 0; |
583 | } | 583 | } |
584 | EXPORT_SYMBOL_GPL(dmi_walk); | 584 | EXPORT_SYMBOL_GPL(dmi_walk); |
585 | |||
586 | /** | ||
587 | * dmi_match - compare a string to the dmi field (if exists) | ||
588 | * | ||
589 | * Returns true if the requested field equals to the str (including NULL). | ||
590 | */ | ||
591 | bool dmi_match(enum dmi_field f, const char *str) | ||
592 | { | ||
593 | const char *info = dmi_get_system_info(f); | ||
594 | |||
595 | if (info == NULL || str == NULL) | ||
596 | return info == str; | ||
597 | |||
598 | return !strcmp(info, str); | ||
599 | } | ||
600 | EXPORT_SYMBOL_GPL(dmi_match); | ||
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 2bfda178f274..34161907b2f8 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -47,6 +47,7 @@ extern int dmi_name_in_vendors(const char *str); | |||
47 | extern int dmi_name_in_serial(const char *str); | 47 | extern int dmi_name_in_serial(const char *str); |
48 | extern int dmi_available; | 48 | extern int dmi_available; |
49 | extern int dmi_walk(void (*decode)(const struct dmi_header *)); | 49 | extern int dmi_walk(void (*decode)(const struct dmi_header *)); |
50 | extern bool dmi_match(enum dmi_field f, const char *str); | ||
50 | 51 | ||
51 | #else | 52 | #else |
52 | 53 | ||
@@ -61,6 +62,8 @@ static inline int dmi_name_in_serial(const char *s) { return 0; } | |||
61 | #define dmi_available 0 | 62 | #define dmi_available 0 |
62 | static inline int dmi_walk(void (*decode)(const struct dmi_header *)) | 63 | static inline int dmi_walk(void (*decode)(const struct dmi_header *)) |
63 | { return -1; } | 64 | { return -1; } |
65 | static inline bool dmi_match(enum dmi_field f, const char *str) | ||
66 | { return false; } | ||
64 | 67 | ||
65 | #endif | 68 | #endif |
66 | 69 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index ed3f26eb5df1..3449de597eff 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -213,10 +213,11 @@ enum { | |||
213 | ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */ | 213 | ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */ |
214 | ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */ | 214 | ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */ |
215 | ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */ | 215 | ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */ |
216 | ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */ | ||
217 | ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ | 216 | ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ |
218 | ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ | 217 | ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ |
219 | ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */ | 218 | ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */ |
219 | ATA_PFLAG_UNLOADING = (1 << 9), /* driver is being unloaded */ | ||
220 | ATA_PFLAG_UNLOADED = (1 << 10), /* driver is unloaded */ | ||
220 | 221 | ||
221 | ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ | 222 | ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ |
222 | ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ | 223 | ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ |
@@ -1285,26 +1286,62 @@ static inline int ata_link_active(struct ata_link *link) | |||
1285 | return ata_tag_valid(link->active_tag) || link->sactive; | 1286 | return ata_tag_valid(link->active_tag) || link->sactive; |
1286 | } | 1287 | } |
1287 | 1288 | ||
1288 | extern struct ata_link *__ata_port_next_link(struct ata_port *ap, | 1289 | /* |
1289 | struct ata_link *link, | 1290 | * Iterators |
1290 | bool dev_only); | 1291 | * |
1292 | * ATA_LITER_* constants are used to select link iteration mode and | ||
1293 | * ATA_DITER_* device iteration mode. | ||
1294 | * | ||
1295 | * For a custom iteration directly using ata_{link|dev}_next(), if | ||
1296 | * @link or @dev, respectively, is NULL, the first element is | ||
1297 | * returned. @dev and @link can be any valid device or link and the | ||
1298 | * next element according to the iteration mode will be returned. | ||
1299 | * After the last element, NULL is returned. | ||
1300 | */ | ||
1301 | enum ata_link_iter_mode { | ||
1302 | ATA_LITER_EDGE, /* if present, PMP links only; otherwise, | ||
1303 | * host link. no slave link */ | ||
1304 | ATA_LITER_HOST_FIRST, /* host link followed by PMP or slave links */ | ||
1305 | ATA_LITER_PMP_FIRST, /* PMP links followed by host link, | ||
1306 | * slave link still comes after host link */ | ||
1307 | }; | ||
1291 | 1308 | ||
1292 | #define __ata_port_for_each_link(link, ap) \ | 1309 | enum ata_dev_iter_mode { |
1293 | for ((link) = __ata_port_next_link((ap), NULL, false); (link); \ | 1310 | ATA_DITER_ENABLED, |
1294 | (link) = __ata_port_next_link((ap), (link), false)) | 1311 | ATA_DITER_ENABLED_REVERSE, |
1312 | ATA_DITER_ALL, | ||
1313 | ATA_DITER_ALL_REVERSE, | ||
1314 | }; | ||
1295 | 1315 | ||
1296 | #define ata_port_for_each_link(link, ap) \ | 1316 | extern struct ata_link *ata_link_next(struct ata_link *link, |
1297 | for ((link) = __ata_port_next_link((ap), NULL, true); (link); \ | 1317 | struct ata_port *ap, |
1298 | (link) = __ata_port_next_link((ap), (link), true)) | 1318 | enum ata_link_iter_mode mode); |
1299 | 1319 | ||
1300 | #define ata_link_for_each_dev(dev, link) \ | 1320 | extern struct ata_device *ata_dev_next(struct ata_device *dev, |
1301 | for ((dev) = (link)->device; \ | 1321 | struct ata_link *link, |
1302 | (dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \ | 1322 | enum ata_dev_iter_mode mode); |
1303 | (dev)++) | 1323 | |
1324 | /* | ||
1325 | * Shortcut notation for iterations | ||
1326 | * | ||
1327 | * ata_for_each_link() iterates over each link of @ap according to | ||
1328 | * @mode. @link points to the current link in the loop. @link is | ||
1329 | * NULL after loop termination. ata_for_each_dev() works the same way | ||
1330 | * except that it iterates over each device of @link. | ||
1331 | * | ||
1332 | * Note that the mode prefixes ATA_{L|D}ITER_ shouldn't need to be | ||
1333 | * specified when using the following shorthand notations. Only the | ||
1334 | * mode itself (EDGE, HOST_FIRST, ENABLED, etc...) should be | ||
1335 | * specified. This not only increases brevity but also makes it | ||
1336 | * impossible to use ATA_LITER_* for device iteration or vice-versa. | ||
1337 | */ | ||
1338 | #define ata_for_each_link(link, ap, mode) \ | ||
1339 | for ((link) = ata_link_next(NULL, (ap), ATA_LITER_##mode); (link); \ | ||
1340 | (link) = ata_link_next((link), (ap), ATA_LITER_##mode)) | ||
1304 | 1341 | ||
1305 | #define ata_link_for_each_dev_reverse(dev, link) \ | 1342 | #define ata_for_each_dev(dev, link, mode) \ |
1306 | for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ | 1343 | for ((dev) = ata_dev_next(NULL, (link), ATA_DITER_##mode); (dev); \ |
1307 | (dev) >= (link)->device || ((dev) = NULL); (dev)--) | 1344 | (dev) = ata_dev_next((dev), (link), ATA_DITER_##mode)) |
1308 | 1345 | ||
1309 | /** | 1346 | /** |
1310 | * ata_ncq_enabled - Test whether NCQ is enabled | 1347 | * ata_ncq_enabled - Test whether NCQ is enabled |