diff options
author | Tejun Heo <htejun@gmail.com> | 2007-08-06 05:36:22 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:30 -0400 |
commit | 9af5c9c97dc9d599281778864c72b385f0c63341 (patch) | |
tree | 8359986bd42c4a9a5b1993078aa9ee4c7971ac3d | |
parent | 640fdb504941fa2b9f6f274716fc9f97f2bf6bff (diff) |
libata-link: introduce ata_link
Introduce ata_link. It abstracts PHY and sits between ata_port and
ata_device. This new level of abstraction is necessary to support
SATA Port Multiplier, which basically adds a bunch of links (PHYs) to
a ATA host port. Fields related to command execution, spd_limit and
EH are per-link and thus moved to ata_link.
This patch only defines the host link. Multiple link handling will be
added later. Also, a lot of ap->link derefences are added but many of
them will be removed as each part is converted to deal directly with
ata_link instead of ata_port.
This patch introduces no behavior change.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
33 files changed, 280 insertions, 255 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index c16820325d7b..c72fa468a697 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1064,7 +1064,7 @@ static int ahci_do_softreset(struct ata_port *ap, unsigned int *class, | |||
1064 | ata_port_printk(ap, KERN_WARNING, | 1064 | ata_port_printk(ap, KERN_WARNING, |
1065 | "failed to reset engine (errno=%d)", rc); | 1065 | "failed to reset engine (errno=%d)", rc); |
1066 | 1066 | ||
1067 | ata_tf_init(ap->device, &tf); | 1067 | ata_tf_init(ap->link.device, &tf); |
1068 | 1068 | ||
1069 | /* issue the first D2H Register FIS */ | 1069 | /* issue the first D2H Register FIS */ |
1070 | msecs = 0; | 1070 | msecs = 0; |
@@ -1132,7 +1132,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class, | |||
1132 | ahci_stop_engine(ap); | 1132 | ahci_stop_engine(ap); |
1133 | 1133 | ||
1134 | /* clear D2H reception area to properly wait for D2H FIS */ | 1134 | /* clear D2H reception area to properly wait for D2H FIS */ |
1135 | ata_tf_init(ap->device, &tf); | 1135 | ata_tf_init(ap->link.device, &tf); |
1136 | tf.command = 0x80; | 1136 | tf.command = 0x80; |
1137 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); | 1137 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); |
1138 | 1138 | ||
@@ -1159,7 +1159,7 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class, | |||
1159 | 1159 | ||
1160 | ahci_stop_engine(ap); | 1160 | ahci_stop_engine(ap); |
1161 | 1161 | ||
1162 | rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->eh_context), | 1162 | rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->link.eh_context), |
1163 | deadline); | 1163 | deadline); |
1164 | 1164 | ||
1165 | /* vt8251 needs SError cleared for the port to operate */ | 1165 | /* vt8251 needs SError cleared for the port to operate */ |
@@ -1278,7 +1278,7 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) | |||
1278 | static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | 1278 | static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) |
1279 | { | 1279 | { |
1280 | struct ahci_port_priv *pp = ap->private_data; | 1280 | struct ahci_port_priv *pp = ap->private_data; |
1281 | struct ata_eh_info *ehi = &ap->eh_info; | 1281 | struct ata_eh_info *ehi = &ap->link.eh_info; |
1282 | unsigned int err_mask = 0, action = 0; | 1282 | unsigned int err_mask = 0, action = 0; |
1283 | struct ata_queued_cmd *qc; | 1283 | struct ata_queued_cmd *qc; |
1284 | u32 serror; | 1284 | u32 serror; |
@@ -1332,7 +1332,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
1332 | ehi->serror |= serror; | 1332 | ehi->serror |= serror; |
1333 | ehi->action |= action; | 1333 | ehi->action |= action; |
1334 | 1334 | ||
1335 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1335 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1336 | if (qc) | 1336 | if (qc) |
1337 | qc->err_mask |= err_mask; | 1337 | qc->err_mask |= err_mask; |
1338 | else | 1338 | else |
@@ -1347,7 +1347,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
1347 | static void ahci_port_intr(struct ata_port *ap) | 1347 | static void ahci_port_intr(struct ata_port *ap) |
1348 | { | 1348 | { |
1349 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; | 1349 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; |
1350 | struct ata_eh_info *ehi = &ap->eh_info; | 1350 | struct ata_eh_info *ehi = &ap->link.eh_info; |
1351 | struct ahci_port_priv *pp = ap->private_data; | 1351 | struct ahci_port_priv *pp = ap->private_data; |
1352 | u32 status, qc_active; | 1352 | u32 status, qc_active; |
1353 | int rc, known_irq = 0; | 1353 | int rc, known_irq = 0; |
@@ -1360,7 +1360,7 @@ static void ahci_port_intr(struct ata_port *ap) | |||
1360 | return; | 1360 | return; |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | if (ap->sactive) | 1363 | if (ap->link.sactive) |
1364 | qc_active = readl(port_mmio + PORT_SCR_ACT); | 1364 | qc_active = readl(port_mmio + PORT_SCR_ACT); |
1365 | else | 1365 | else |
1366 | qc_active = readl(port_mmio + PORT_CMD_ISSUE); | 1366 | qc_active = readl(port_mmio + PORT_CMD_ISSUE); |
@@ -1380,7 +1380,7 @@ static void ahci_port_intr(struct ata_port *ap) | |||
1380 | /* if !NCQ, ignore. No modern ATA device has broken HSM | 1380 | /* if !NCQ, ignore. No modern ATA device has broken HSM |
1381 | * implementation for non-NCQ commands. | 1381 | * implementation for non-NCQ commands. |
1382 | */ | 1382 | */ |
1383 | if (!ap->sactive) | 1383 | if (!ap->link.sactive) |
1384 | return; | 1384 | return; |
1385 | 1385 | ||
1386 | if (status & PORT_IRQ_D2H_REG_FIS) { | 1386 | if (status & PORT_IRQ_D2H_REG_FIS) { |
@@ -1433,7 +1433,7 @@ static void ahci_port_intr(struct ata_port *ap) | |||
1433 | if (!known_irq) | 1433 | if (!known_irq) |
1434 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " | 1434 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " |
1435 | "(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n", | 1435 | "(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n", |
1436 | status, ap->active_tag, ap->sactive); | 1436 | status, ap->link.active_tag, ap->link.sactive); |
1437 | } | 1437 | } |
1438 | 1438 | ||
1439 | static void ahci_irq_clear(struct ata_port *ap) | 1439 | static void ahci_irq_clear(struct ata_port *ap) |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 945466954724..b5e390ff5bd8 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -53,7 +53,7 @@ static int generic_set_mode(struct ata_port *ap, struct ata_device **unused) | |||
53 | dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | 53 | dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); |
54 | 54 | ||
55 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 55 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
56 | struct ata_device *dev = &ap->device[i]; | 56 | struct ata_device *dev = &ap->link.device[i]; |
57 | if (ata_dev_enabled(dev)) { | 57 | if (ata_dev_enabled(dev)) { |
58 | /* We don't really care */ | 58 | /* We don't really care */ |
59 | dev->pio_mode = XFER_PIO_0; | 59 | dev->pio_mode = XFER_PIO_0; |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index c059f78ad944..0023ac4ff496 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -44,7 +44,8 @@ static void ata_acpi_associate_sata_port(struct ata_port *ap) | |||
44 | { | 44 | { |
45 | acpi_integer adr = SATA_ADR(ap->port_no, NO_PORT_MULT); | 45 | acpi_integer adr = SATA_ADR(ap->port_no, NO_PORT_MULT); |
46 | 46 | ||
47 | ap->device->acpi_handle = acpi_get_child(ap->host->acpi_handle, adr); | 47 | ap->link.device->acpi_handle = |
48 | acpi_get_child(ap->host->acpi_handle, adr); | ||
48 | } | 49 | } |
49 | 50 | ||
50 | static void ata_acpi_associate_ide_port(struct ata_port *ap) | 51 | static void ata_acpi_associate_ide_port(struct ata_port *ap) |
@@ -60,7 +61,7 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap) | |||
60 | max_devices++; | 61 | max_devices++; |
61 | 62 | ||
62 | for (i = 0; i < max_devices; i++) { | 63 | for (i = 0; i < max_devices; i++) { |
63 | struct ata_device *dev = &ap->device[i]; | 64 | struct ata_device *dev = &ap->link.device[i]; |
64 | 65 | ||
65 | dev->acpi_handle = acpi_get_child(ap->acpi_handle, i); | 66 | dev->acpi_handle = acpi_get_child(ap->acpi_handle, i); |
66 | } | 67 | } |
@@ -182,10 +183,10 @@ static int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm) | |||
182 | /* Buffers for id may need byteswapping ? */ | 183 | /* Buffers for id may need byteswapping ? */ |
183 | in_params[1].type = ACPI_TYPE_BUFFER; | 184 | in_params[1].type = ACPI_TYPE_BUFFER; |
184 | in_params[1].buffer.length = 512; | 185 | in_params[1].buffer.length = 512; |
185 | in_params[1].buffer.pointer = (u8 *)ap->device[0].id; | 186 | in_params[1].buffer.pointer = (u8 *)ap->link.device[0].id; |
186 | in_params[2].type = ACPI_TYPE_BUFFER; | 187 | in_params[2].type = ACPI_TYPE_BUFFER; |
187 | in_params[2].buffer.length = 512; | 188 | in_params[2].buffer.length = 512; |
188 | in_params[2].buffer.pointer = (u8 *)ap->device[1].id; | 189 | in_params[2].buffer.pointer = (u8 *)ap->link.device[1].id; |
189 | 190 | ||
190 | input.count = 3; | 191 | input.count = 3; |
191 | input.pointer = in_params; | 192 | input.pointer = in_params; |
@@ -226,7 +227,7 @@ static int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm) | |||
226 | static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, | 227 | static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, |
227 | void **ptr_to_free) | 228 | void **ptr_to_free) |
228 | { | 229 | { |
229 | struct ata_port *ap = dev->ap; | 230 | struct ata_port *ap = dev->link->ap; |
230 | acpi_status status; | 231 | acpi_status status; |
231 | struct acpi_buffer output; | 232 | struct acpi_buffer output; |
232 | union acpi_object *out_obj; | 233 | union acpi_object *out_obj; |
@@ -320,7 +321,7 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, | |||
320 | static int taskfile_load_raw(struct ata_device *dev, | 321 | static int taskfile_load_raw(struct ata_device *dev, |
321 | const struct ata_acpi_gtf *gtf) | 322 | const struct ata_acpi_gtf *gtf) |
322 | { | 323 | { |
323 | struct ata_port *ap = dev->ap; | 324 | struct ata_port *ap = dev->link->ap; |
324 | struct ata_taskfile tf, rtf; | 325 | struct ata_taskfile tf, rtf; |
325 | unsigned int err_mask; | 326 | unsigned int err_mask; |
326 | 327 | ||
@@ -424,7 +425,7 @@ static int ata_acpi_exec_tfs(struct ata_device *dev) | |||
424 | */ | 425 | */ |
425 | static int ata_acpi_push_id(struct ata_device *dev) | 426 | static int ata_acpi_push_id(struct ata_device *dev) |
426 | { | 427 | { |
427 | struct ata_port *ap = dev->ap; | 428 | struct ata_port *ap = dev->link->ap; |
428 | int err; | 429 | int err; |
429 | acpi_status status; | 430 | acpi_status status; |
430 | struct acpi_object_list input; | 431 | struct acpi_object_list input; |
@@ -519,7 +520,7 @@ void ata_acpi_on_resume(struct ata_port *ap) | |||
519 | 520 | ||
520 | /* schedule _GTF */ | 521 | /* schedule _GTF */ |
521 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 522 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
522 | ap->device[i].flags |= ATA_DFLAG_ACPI_PENDING; | 523 | ap->link.device[i].flags |= ATA_DFLAG_ACPI_PENDING; |
523 | } | 524 | } |
524 | 525 | ||
525 | /** | 526 | /** |
@@ -538,8 +539,8 @@ void ata_acpi_on_resume(struct ata_port *ap) | |||
538 | */ | 539 | */ |
539 | int ata_acpi_on_devcfg(struct ata_device *dev) | 540 | int ata_acpi_on_devcfg(struct ata_device *dev) |
540 | { | 541 | { |
541 | struct ata_port *ap = dev->ap; | 542 | struct ata_port *ap = dev->link->ap; |
542 | struct ata_eh_context *ehc = &ap->eh_context; | 543 | struct ata_eh_context *ehc = &ap->link.eh_context; |
543 | int acpi_sata = ap->flags & ATA_FLAG_ACPI_SATA; | 544 | int acpi_sata = ap->flags & ATA_FLAG_ACPI_SATA; |
544 | int rc; | 545 | int rc; |
545 | 546 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 772be09b4689..dd2de485124a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -235,7 +235,7 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev) | |||
235 | if (dev->flags & ATA_DFLAG_PIO) { | 235 | if (dev->flags & ATA_DFLAG_PIO) { |
236 | tf->protocol = ATA_PROT_PIO; | 236 | tf->protocol = ATA_PROT_PIO; |
237 | index = dev->multi_count ? 0 : 8; | 237 | index = dev->multi_count ? 0 : 8; |
238 | } else if (lba48 && (dev->ap->flags & ATA_FLAG_PIO_LBA48)) { | 238 | } else if (lba48 && (dev->link->ap->flags & ATA_FLAG_PIO_LBA48)) { |
239 | /* Unable to use DMA due to host limitation */ | 239 | /* Unable to use DMA due to host limitation */ |
240 | tf->protocol = ATA_PROT_PIO; | 240 | tf->protocol = ATA_PROT_PIO; |
241 | index = dev->multi_count ? 0 : 8; | 241 | index = dev->multi_count ? 0 : 8; |
@@ -604,7 +604,7 @@ static const char *sata_spd_string(unsigned int spd) | |||
604 | void ata_dev_disable(struct ata_device *dev) | 604 | void ata_dev_disable(struct ata_device *dev) |
605 | { | 605 | { |
606 | if (ata_dev_enabled(dev)) { | 606 | if (ata_dev_enabled(dev)) { |
607 | if (ata_msg_drv(dev->ap)) | 607 | if (ata_msg_drv(dev->link->ap)) |
608 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); | 608 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); |
609 | ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | | 609 | ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | |
610 | ATA_DNXFER_QUIET); | 610 | ATA_DNXFER_QUIET); |
@@ -735,7 +735,7 @@ ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err) | |||
735 | /* see if device passed diags: if master then continue and warn later */ | 735 | /* see if device passed diags: if master then continue and warn later */ |
736 | if (err == 0 && device == 0) | 736 | if (err == 0 && device == 0) |
737 | /* diagnostic fail : do nothing _YET_ */ | 737 | /* diagnostic fail : do nothing _YET_ */ |
738 | ap->device[device].horkage |= ATA_HORKAGE_DIAGNOSTIC; | 738 | ap->link.device[device].horkage |= ATA_HORKAGE_DIAGNOSTIC; |
739 | else if (err == 1) | 739 | else if (err == 1) |
740 | /* do nothing */ ; | 740 | /* do nothing */ ; |
741 | else if ((device == 0) && (err == 0x81)) | 741 | else if ((device == 0) && (err == 0x81)) |
@@ -1150,7 +1150,7 @@ void ata_dev_select(struct ata_port *ap, unsigned int device, | |||
1150 | ap->ops->dev_select(ap, device); | 1150 | ap->ops->dev_select(ap, device); |
1151 | 1151 | ||
1152 | if (wait) { | 1152 | if (wait) { |
1153 | if (can_sleep && ap->device[device].class == ATA_DEV_ATAPI) | 1153 | if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI) |
1154 | msleep(150); | 1154 | msleep(150); |
1155 | ata_wait_idle(ap); | 1155 | ata_wait_idle(ap); |
1156 | } | 1156 | } |
@@ -1346,7 +1346,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1346 | int dma_dir, struct scatterlist *sg, | 1346 | int dma_dir, struct scatterlist *sg, |
1347 | unsigned int n_elem) | 1347 | unsigned int n_elem) |
1348 | { | 1348 | { |
1349 | struct ata_port *ap = dev->ap; | 1349 | struct ata_link *link = dev->link; |
1350 | struct ata_port *ap = link->ap; | ||
1350 | u8 command = tf->command; | 1351 | u8 command = tf->command; |
1351 | struct ata_queued_cmd *qc; | 1352 | struct ata_queued_cmd *qc; |
1352 | unsigned int tag, preempted_tag; | 1353 | unsigned int tag, preempted_tag; |
@@ -1386,11 +1387,11 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1386 | qc->dev = dev; | 1387 | qc->dev = dev; |
1387 | ata_qc_reinit(qc); | 1388 | ata_qc_reinit(qc); |
1388 | 1389 | ||
1389 | preempted_tag = ap->active_tag; | 1390 | preempted_tag = link->active_tag; |
1390 | preempted_sactive = ap->sactive; | 1391 | preempted_sactive = link->sactive; |
1391 | preempted_qc_active = ap->qc_active; | 1392 | preempted_qc_active = ap->qc_active; |
1392 | ap->active_tag = ATA_TAG_POISON; | 1393 | link->active_tag = ATA_TAG_POISON; |
1393 | ap->sactive = 0; | 1394 | link->sactive = 0; |
1394 | ap->qc_active = 0; | 1395 | ap->qc_active = 0; |
1395 | 1396 | ||
1396 | /* prepare & issue qc */ | 1397 | /* prepare & issue qc */ |
@@ -1467,8 +1468,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1467 | err_mask = qc->err_mask; | 1468 | err_mask = qc->err_mask; |
1468 | 1469 | ||
1469 | ata_qc_free(qc); | 1470 | ata_qc_free(qc); |
1470 | ap->active_tag = preempted_tag; | 1471 | link->active_tag = preempted_tag; |
1471 | ap->sactive = preempted_sactive; | 1472 | link->sactive = preempted_sactive; |
1472 | ap->qc_active = preempted_qc_active; | 1473 | ap->qc_active = preempted_qc_active; |
1473 | 1474 | ||
1474 | /* XXX - Some LLDDs (sata_mv) disable port on command failure. | 1475 | /* XXX - Some LLDDs (sata_mv) disable port on command failure. |
@@ -1566,7 +1567,7 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
1566 | { | 1567 | { |
1567 | /* Controller doesn't support IORDY. Probably a pointless check | 1568 | /* Controller doesn't support IORDY. Probably a pointless check |
1568 | as the caller should know this */ | 1569 | as the caller should know this */ |
1569 | if (adev->ap->flags & ATA_FLAG_NO_IORDY) | 1570 | if (adev->link->ap->flags & ATA_FLAG_NO_IORDY) |
1570 | return 0; | 1571 | return 0; |
1571 | /* PIO3 and higher it is mandatory */ | 1572 | /* PIO3 and higher it is mandatory */ |
1572 | if (adev->pio_mode > XFER_PIO_2) | 1573 | if (adev->pio_mode > XFER_PIO_2) |
@@ -1622,7 +1623,7 @@ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev) | |||
1622 | int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | 1623 | int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, |
1623 | unsigned int flags, u16 *id) | 1624 | unsigned int flags, u16 *id) |
1624 | { | 1625 | { |
1625 | struct ata_port *ap = dev->ap; | 1626 | struct ata_port *ap = dev->link->ap; |
1626 | unsigned int class = *p_class; | 1627 | unsigned int class = *p_class; |
1627 | struct ata_taskfile tf; | 1628 | struct ata_taskfile tf; |
1628 | unsigned int err_mask = 0; | 1629 | unsigned int err_mask = 0; |
@@ -1774,13 +1775,14 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1774 | 1775 | ||
1775 | static inline u8 ata_dev_knobble(struct ata_device *dev) | 1776 | static inline u8 ata_dev_knobble(struct ata_device *dev) |
1776 | { | 1777 | { |
1777 | return ((dev->ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); | 1778 | struct ata_port *ap = dev->link->ap; |
1779 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); | ||
1778 | } | 1780 | } |
1779 | 1781 | ||
1780 | static void ata_dev_config_ncq(struct ata_device *dev, | 1782 | static void ata_dev_config_ncq(struct ata_device *dev, |
1781 | char *desc, size_t desc_sz) | 1783 | char *desc, size_t desc_sz) |
1782 | { | 1784 | { |
1783 | struct ata_port *ap = dev->ap; | 1785 | struct ata_port *ap = dev->link->ap; |
1784 | int hdepth = 0, ddepth = ata_id_queue_depth(dev->id); | 1786 | int hdepth = 0, ddepth = ata_id_queue_depth(dev->id); |
1785 | 1787 | ||
1786 | if (!ata_id_has_ncq(dev->id)) { | 1788 | if (!ata_id_has_ncq(dev->id)) { |
@@ -1817,8 +1819,8 @@ static void ata_dev_config_ncq(struct ata_device *dev, | |||
1817 | */ | 1819 | */ |
1818 | int ata_dev_configure(struct ata_device *dev) | 1820 | int ata_dev_configure(struct ata_device *dev) |
1819 | { | 1821 | { |
1820 | struct ata_port *ap = dev->ap; | 1822 | struct ata_port *ap = dev->link->ap; |
1821 | struct ata_eh_context *ehc = &ap->eh_context; | 1823 | struct ata_eh_context *ehc = &dev->link->eh_context; |
1822 | int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; | 1824 | int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; |
1823 | const u16 *id = dev->id; | 1825 | const u16 *id = dev->id; |
1824 | unsigned int xfer_mask; | 1826 | unsigned int xfer_mask; |
@@ -2116,7 +2118,7 @@ int ata_bus_probe(struct ata_port *ap) | |||
2116 | ap->ops->phy_reset(ap); | 2118 | ap->ops->phy_reset(ap); |
2117 | 2119 | ||
2118 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2120 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2119 | dev = &ap->device[i]; | 2121 | dev = &ap->link.device[i]; |
2120 | 2122 | ||
2121 | if (!(ap->flags & ATA_FLAG_DISABLED) && | 2123 | if (!(ap->flags & ATA_FLAG_DISABLED) && |
2122 | dev->class != ATA_DEV_UNKNOWN) | 2124 | dev->class != ATA_DEV_UNKNOWN) |
@@ -2133,14 +2135,14 @@ int ata_bus_probe(struct ata_port *ap) | |||
2133 | state is undefined. Record the mode */ | 2135 | state is undefined. Record the mode */ |
2134 | 2136 | ||
2135 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 2137 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
2136 | ap->device[i].pio_mode = XFER_PIO_0; | 2138 | ap->link.device[i].pio_mode = XFER_PIO_0; |
2137 | 2139 | ||
2138 | /* read IDENTIFY page and configure devices. We have to do the identify | 2140 | /* read IDENTIFY page and configure devices. We have to do the identify |
2139 | specific sequence bass-ackwards so that PDIAG- is released by | 2141 | specific sequence bass-ackwards so that PDIAG- is released by |
2140 | the slave device */ | 2142 | the slave device */ |
2141 | 2143 | ||
2142 | for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) { | 2144 | for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) { |
2143 | dev = &ap->device[i]; | 2145 | dev = &ap->link.device[i]; |
2144 | 2146 | ||
2145 | if (tries[i]) | 2147 | if (tries[i]) |
2146 | dev->class = classes[i]; | 2148 | dev->class = classes[i]; |
@@ -2162,13 +2164,13 @@ int ata_bus_probe(struct ata_port *ap) | |||
2162 | this in the normal order so that the user doesn't get confused */ | 2164 | this in the normal order so that the user doesn't get confused */ |
2163 | 2165 | ||
2164 | for(i = 0; i < ATA_MAX_DEVICES; i++) { | 2166 | for(i = 0; i < ATA_MAX_DEVICES; i++) { |
2165 | dev = &ap->device[i]; | 2167 | dev = &ap->link.device[i]; |
2166 | if (!ata_dev_enabled(dev)) | 2168 | if (!ata_dev_enabled(dev)) |
2167 | continue; | 2169 | continue; |
2168 | 2170 | ||
2169 | ap->eh_context.i.flags |= ATA_EHI_PRINTINFO; | 2171 | ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; |
2170 | rc = ata_dev_configure(dev); | 2172 | rc = ata_dev_configure(dev); |
2171 | ap->eh_context.i.flags &= ~ATA_EHI_PRINTINFO; | 2173 | ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; |
2172 | if (rc) | 2174 | if (rc) |
2173 | goto fail; | 2175 | goto fail; |
2174 | } | 2176 | } |
@@ -2179,7 +2181,7 @@ int ata_bus_probe(struct ata_port *ap) | |||
2179 | goto fail; | 2181 | goto fail; |
2180 | 2182 | ||
2181 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 2183 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
2182 | if (ata_dev_enabled(&ap->device[i])) | 2184 | if (ata_dev_enabled(&ap->link.device[i])) |
2183 | return 0; | 2185 | return 0; |
2184 | 2186 | ||
2185 | /* no device present, disable port */ | 2187 | /* no device present, disable port */ |
@@ -2344,8 +2346,8 @@ void sata_phy_reset(struct ata_port *ap) | |||
2344 | 2346 | ||
2345 | struct ata_device *ata_dev_pair(struct ata_device *adev) | 2347 | struct ata_device *ata_dev_pair(struct ata_device *adev) |
2346 | { | 2348 | { |
2347 | struct ata_port *ap = adev->ap; | 2349 | struct ata_link *link = adev->link; |
2348 | struct ata_device *pair = &ap->device[1 - adev->devno]; | 2350 | struct ata_device *pair = &link->device[1 - adev->devno]; |
2349 | if (!ata_dev_enabled(pair)) | 2351 | if (!ata_dev_enabled(pair)) |
2350 | return NULL; | 2352 | return NULL; |
2351 | return pair; | 2353 | return pair; |
@@ -2366,8 +2368,8 @@ struct ata_device *ata_dev_pair(struct ata_device *adev) | |||
2366 | 2368 | ||
2367 | void ata_port_disable(struct ata_port *ap) | 2369 | void ata_port_disable(struct ata_port *ap) |
2368 | { | 2370 | { |
2369 | ap->device[0].class = ATA_DEV_NONE; | 2371 | ap->link.device[0].class = ATA_DEV_NONE; |
2370 | ap->device[1].class = ATA_DEV_NONE; | 2372 | ap->link.device[1].class = ATA_DEV_NONE; |
2371 | ap->flags |= ATA_FLAG_DISABLED; | 2373 | ap->flags |= ATA_FLAG_DISABLED; |
2372 | } | 2374 | } |
2373 | 2375 | ||
@@ -2400,9 +2402,9 @@ int sata_down_spd_limit(struct ata_port *ap) | |||
2400 | if (rc == 0) | 2402 | if (rc == 0) |
2401 | spd = (sstatus >> 4) & 0xf; | 2403 | spd = (sstatus >> 4) & 0xf; |
2402 | else | 2404 | else |
2403 | spd = ap->sata_spd; | 2405 | spd = ap->link.sata_spd; |
2404 | 2406 | ||
2405 | mask = ap->sata_spd_limit; | 2407 | mask = ap->link.sata_spd_limit; |
2406 | if (mask <= 1) | 2408 | if (mask <= 1) |
2407 | return -EINVAL; | 2409 | return -EINVAL; |
2408 | 2410 | ||
@@ -2422,7 +2424,7 @@ int sata_down_spd_limit(struct ata_port *ap) | |||
2422 | if (!mask) | 2424 | if (!mask) |
2423 | return -EINVAL; | 2425 | return -EINVAL; |
2424 | 2426 | ||
2425 | ap->sata_spd_limit = mask; | 2427 | ap->link.sata_spd_limit = mask; |
2426 | 2428 | ||
2427 | ata_port_printk(ap, KERN_WARNING, "limiting SATA link speed to %s\n", | 2429 | ata_port_printk(ap, KERN_WARNING, "limiting SATA link speed to %s\n", |
2428 | sata_spd_string(fls(mask))); | 2430 | sata_spd_string(fls(mask))); |
@@ -2434,10 +2436,10 @@ static int __sata_set_spd_needed(struct ata_port *ap, u32 *scontrol) | |||
2434 | { | 2436 | { |
2435 | u32 spd, limit; | 2437 | u32 spd, limit; |
2436 | 2438 | ||
2437 | if (ap->sata_spd_limit == UINT_MAX) | 2439 | if (ap->link.sata_spd_limit == UINT_MAX) |
2438 | limit = 0; | 2440 | limit = 0; |
2439 | else | 2441 | else |
2440 | limit = fls(ap->sata_spd_limit); | 2442 | limit = fls(ap->link.sata_spd_limit); |
2441 | 2443 | ||
2442 | spd = (*scontrol >> 4) & 0xf; | 2444 | spd = (*scontrol >> 4) & 0xf; |
2443 | *scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4); | 2445 | *scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4); |
@@ -2450,7 +2452,7 @@ static int __sata_set_spd_needed(struct ata_port *ap, u32 *scontrol) | |||
2450 | * @ap: Port in question | 2452 | * @ap: Port in question |
2451 | * | 2453 | * |
2452 | * Test whether the spd limit in SControl matches | 2454 | * Test whether the spd limit in SControl matches |
2453 | * @ap->sata_spd_limit. This function is used to determine | 2455 | * @ap->link.sata_spd_limit. This function is used to determine |
2454 | * whether hardreset is necessary to apply SATA spd | 2456 | * whether hardreset is necessary to apply SATA spd |
2455 | * configuration. | 2457 | * configuration. |
2456 | * | 2458 | * |
@@ -2749,7 +2751,7 @@ int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel) | |||
2749 | 2751 | ||
2750 | static int ata_dev_set_mode(struct ata_device *dev) | 2752 | static int ata_dev_set_mode(struct ata_device *dev) |
2751 | { | 2753 | { |
2752 | struct ata_eh_context *ehc = &dev->ap->eh_context; | 2754 | struct ata_eh_context *ehc = &dev->link->eh_context; |
2753 | unsigned int err_mask; | 2755 | unsigned int err_mask; |
2754 | int rc; | 2756 | int rc; |
2755 | 2757 | ||
@@ -2809,7 +2811,7 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2809 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2811 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2810 | unsigned int pio_mask, dma_mask; | 2812 | unsigned int pio_mask, dma_mask; |
2811 | 2813 | ||
2812 | dev = &ap->device[i]; | 2814 | dev = &ap->link.device[i]; |
2813 | 2815 | ||
2814 | if (!ata_dev_enabled(dev)) | 2816 | if (!ata_dev_enabled(dev)) |
2815 | continue; | 2817 | continue; |
@@ -2830,7 +2832,7 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2830 | 2832 | ||
2831 | /* step 2: always set host PIO timings */ | 2833 | /* step 2: always set host PIO timings */ |
2832 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2834 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2833 | dev = &ap->device[i]; | 2835 | dev = &ap->link.device[i]; |
2834 | if (!ata_dev_enabled(dev)) | 2836 | if (!ata_dev_enabled(dev)) |
2835 | continue; | 2837 | continue; |
2836 | 2838 | ||
@@ -2848,7 +2850,7 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2848 | 2850 | ||
2849 | /* step 3: set host DMA timings */ | 2851 | /* step 3: set host DMA timings */ |
2850 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2852 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2851 | dev = &ap->device[i]; | 2853 | dev = &ap->link.device[i]; |
2852 | 2854 | ||
2853 | if (!ata_dev_enabled(dev) || !dev->dma_mode) | 2855 | if (!ata_dev_enabled(dev) || !dev->dma_mode) |
2854 | continue; | 2856 | continue; |
@@ -2861,7 +2863,7 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2861 | 2863 | ||
2862 | /* step 4: update devices' xfer mode */ | 2864 | /* step 4: update devices' xfer mode */ |
2863 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2865 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2864 | dev = &ap->device[i]; | 2866 | dev = &ap->link.device[i]; |
2865 | 2867 | ||
2866 | /* don't update suspended devices' xfer mode */ | 2868 | /* don't update suspended devices' xfer mode */ |
2867 | if (!ata_dev_enabled(dev)) | 2869 | if (!ata_dev_enabled(dev)) |
@@ -3142,6 +3144,7 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
3142 | 3144 | ||
3143 | void ata_bus_reset(struct ata_port *ap) | 3145 | void ata_bus_reset(struct ata_port *ap) |
3144 | { | 3146 | { |
3147 | struct ata_device *device = ap->link.device; | ||
3145 | struct ata_ioports *ioaddr = &ap->ioaddr; | 3148 | struct ata_ioports *ioaddr = &ap->ioaddr; |
3146 | unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; | 3149 | unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; |
3147 | u8 err; | 3150 | u8 err; |
@@ -3177,19 +3180,19 @@ void ata_bus_reset(struct ata_port *ap) | |||
3177 | /* | 3180 | /* |
3178 | * determine by signature whether we have ATA or ATAPI devices | 3181 | * determine by signature whether we have ATA or ATAPI devices |
3179 | */ | 3182 | */ |
3180 | ap->device[0].class = ata_dev_try_classify(ap, 0, &err); | 3183 | device[0].class = ata_dev_try_classify(ap, 0, &err); |
3181 | if ((slave_possible) && (err != 0x81)) | 3184 | if ((slave_possible) && (err != 0x81)) |
3182 | ap->device[1].class = ata_dev_try_classify(ap, 1, &err); | 3185 | device[1].class = ata_dev_try_classify(ap, 1, &err); |
3183 | 3186 | ||
3184 | /* is double-select really necessary? */ | 3187 | /* is double-select really necessary? */ |
3185 | if (ap->device[1].class != ATA_DEV_NONE) | 3188 | if (device[1].class != ATA_DEV_NONE) |
3186 | ap->ops->dev_select(ap, 1); | 3189 | ap->ops->dev_select(ap, 1); |
3187 | if (ap->device[0].class != ATA_DEV_NONE) | 3190 | if (device[0].class != ATA_DEV_NONE) |
3188 | ap->ops->dev_select(ap, 0); | 3191 | ap->ops->dev_select(ap, 0); |
3189 | 3192 | ||
3190 | /* if no devices were detected, disable this port */ | 3193 | /* if no devices were detected, disable this port */ |
3191 | if ((ap->device[0].class == ATA_DEV_NONE) && | 3194 | if ((device[0].class == ATA_DEV_NONE) && |
3192 | (ap->device[1].class == ATA_DEV_NONE)) | 3195 | (device[1].class == ATA_DEV_NONE)) |
3193 | goto err_out; | 3196 | goto err_out; |
3194 | 3197 | ||
3195 | if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) { | 3198 | if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) { |
@@ -3331,7 +3334,7 @@ int sata_phy_resume(struct ata_port *ap, const unsigned long *params, | |||
3331 | */ | 3334 | */ |
3332 | int ata_std_prereset(struct ata_port *ap, unsigned long deadline) | 3335 | int ata_std_prereset(struct ata_port *ap, unsigned long deadline) |
3333 | { | 3336 | { |
3334 | struct ata_eh_context *ehc = &ap->eh_context; | 3337 | struct ata_eh_context *ehc = &ap->link.eh_context; |
3335 | const unsigned long *timing = sata_ehc_deb_timing(ehc); | 3338 | const unsigned long *timing = sata_ehc_deb_timing(ehc); |
3336 | int rc; | 3339 | int rc; |
3337 | 3340 | ||
@@ -3503,7 +3506,7 @@ int sata_port_hardreset(struct ata_port *ap, const unsigned long *timing, | |||
3503 | int sata_std_hardreset(struct ata_port *ap, unsigned int *class, | 3506 | int sata_std_hardreset(struct ata_port *ap, unsigned int *class, |
3504 | unsigned long deadline) | 3507 | unsigned long deadline) |
3505 | { | 3508 | { |
3506 | const unsigned long *timing = sata_ehc_deb_timing(&ap->eh_context); | 3509 | const unsigned long *timing = sata_ehc_deb_timing(&ap->link.eh_context); |
3507 | int rc; | 3510 | int rc; |
3508 | 3511 | ||
3509 | DPRINTK("ENTER\n"); | 3512 | DPRINTK("ENTER\n"); |
@@ -3652,7 +3655,7 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, | |||
3652 | int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags) | 3655 | int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags) |
3653 | { | 3656 | { |
3654 | unsigned int class = dev->class; | 3657 | unsigned int class = dev->class; |
3655 | u16 *id = (void *)dev->ap->sector_buf; | 3658 | u16 *id = (void *)dev->link->ap->sector_buf; |
3656 | int rc; | 3659 | int rc; |
3657 | 3660 | ||
3658 | /* read ID data */ | 3661 | /* read ID data */ |
@@ -3837,7 +3840,7 @@ static int ata_dma_blacklisted(const struct ata_device *dev) | |||
3837 | * DMA blacklist those ATAPI devices with CDB-intr (and use PIO) | 3840 | * DMA blacklist those ATAPI devices with CDB-intr (and use PIO) |
3838 | * if the LLDD handles only interrupts in the HSM_ST_LAST state. | 3841 | * if the LLDD handles only interrupts in the HSM_ST_LAST state. |
3839 | */ | 3842 | */ |
3840 | if ((dev->ap->flags & ATA_FLAG_PIO_POLLING) && | 3843 | if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) && |
3841 | (dev->flags & ATA_DFLAG_CDB_INTR)) | 3844 | (dev->flags & ATA_DFLAG_CDB_INTR)) |
3842 | return 1; | 3845 | return 1; |
3843 | return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0; | 3846 | return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0; |
@@ -3857,7 +3860,8 @@ static int ata_dma_blacklisted(const struct ata_device *dev) | |||
3857 | */ | 3860 | */ |
3858 | static void ata_dev_xfermask(struct ata_device *dev) | 3861 | static void ata_dev_xfermask(struct ata_device *dev) |
3859 | { | 3862 | { |
3860 | struct ata_port *ap = dev->ap; | 3863 | struct ata_link *link = dev->link; |
3864 | struct ata_port *ap = link->ap; | ||
3861 | struct ata_host *host = ap->host; | 3865 | struct ata_host *host = ap->host; |
3862 | unsigned long xfer_mask; | 3866 | unsigned long xfer_mask; |
3863 | 3867 | ||
@@ -4482,7 +4486,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4482 | void ata_data_xfer(struct ata_device *adev, unsigned char *buf, | 4486 | void ata_data_xfer(struct ata_device *adev, unsigned char *buf, |
4483 | unsigned int buflen, int write_data) | 4487 | unsigned int buflen, int write_data) |
4484 | { | 4488 | { |
4485 | struct ata_port *ap = adev->ap; | 4489 | struct ata_port *ap = adev->link->ap; |
4486 | unsigned int words = buflen >> 1; | 4490 | unsigned int words = buflen >> 1; |
4487 | 4491 | ||
4488 | /* Transfer multiple of 2 bytes */ | 4492 | /* Transfer multiple of 2 bytes */ |
@@ -5188,7 +5192,7 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | |||
5188 | 5192 | ||
5189 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) | 5193 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) |
5190 | { | 5194 | { |
5191 | struct ata_port *ap = dev->ap; | 5195 | struct ata_port *ap = dev->link->ap; |
5192 | struct ata_queued_cmd *qc; | 5196 | struct ata_queued_cmd *qc; |
5193 | 5197 | ||
5194 | qc = ata_qc_new(ap); | 5198 | qc = ata_qc_new(ap); |
@@ -5231,6 +5235,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
5231 | void __ata_qc_complete(struct ata_queued_cmd *qc) | 5235 | void __ata_qc_complete(struct ata_queued_cmd *qc) |
5232 | { | 5236 | { |
5233 | struct ata_port *ap = qc->ap; | 5237 | struct ata_port *ap = qc->ap; |
5238 | struct ata_link *link = qc->dev->link; | ||
5234 | 5239 | ||
5235 | WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ | 5240 | WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ |
5236 | WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE)); | 5241 | WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE)); |
@@ -5240,9 +5245,9 @@ void __ata_qc_complete(struct ata_queued_cmd *qc) | |||
5240 | 5245 | ||
5241 | /* command should be marked inactive atomically with qc completion */ | 5246 | /* command should be marked inactive atomically with qc completion */ |
5242 | if (qc->tf.protocol == ATA_PROT_NCQ) | 5247 | if (qc->tf.protocol == ATA_PROT_NCQ) |
5243 | ap->sactive &= ~(1 << qc->tag); | 5248 | link->sactive &= ~(1 << qc->tag); |
5244 | else | 5249 | else |
5245 | ap->active_tag = ATA_TAG_POISON; | 5250 | link->active_tag = ATA_TAG_POISON; |
5246 | 5251 | ||
5247 | /* atapi: mark qc as inactive to prevent the interrupt handler | 5252 | /* atapi: mark qc as inactive to prevent the interrupt handler |
5248 | * from completing the command twice later, before the error handler | 5253 | * from completing the command twice later, before the error handler |
@@ -5411,19 +5416,20 @@ static inline int ata_should_dma_map(struct ata_queued_cmd *qc) | |||
5411 | void ata_qc_issue(struct ata_queued_cmd *qc) | 5416 | void ata_qc_issue(struct ata_queued_cmd *qc) |
5412 | { | 5417 | { |
5413 | struct ata_port *ap = qc->ap; | 5418 | struct ata_port *ap = qc->ap; |
5419 | struct ata_link *link = qc->dev->link; | ||
5414 | 5420 | ||
5415 | /* Make sure only one non-NCQ command is outstanding. The | 5421 | /* Make sure only one non-NCQ command is outstanding. The |
5416 | * check is skipped for old EH because it reuses active qc to | 5422 | * check is skipped for old EH because it reuses active qc to |
5417 | * request ATAPI sense. | 5423 | * request ATAPI sense. |
5418 | */ | 5424 | */ |
5419 | WARN_ON(ap->ops->error_handler && ata_tag_valid(ap->active_tag)); | 5425 | WARN_ON(ap->ops->error_handler && ata_tag_valid(link->active_tag)); |
5420 | 5426 | ||
5421 | if (qc->tf.protocol == ATA_PROT_NCQ) { | 5427 | if (qc->tf.protocol == ATA_PROT_NCQ) { |
5422 | WARN_ON(ap->sactive & (1 << qc->tag)); | 5428 | WARN_ON(link->sactive & (1 << qc->tag)); |
5423 | ap->sactive |= 1 << qc->tag; | 5429 | link->sactive |= 1 << qc->tag; |
5424 | } else { | 5430 | } else { |
5425 | WARN_ON(ap->sactive); | 5431 | WARN_ON(link->sactive); |
5426 | ap->active_tag = qc->tag; | 5432 | link->active_tag = qc->tag; |
5427 | } | 5433 | } |
5428 | 5434 | ||
5429 | qc->flags |= ATA_QCFLAG_ACTIVE; | 5435 | qc->flags |= ATA_QCFLAG_ACTIVE; |
@@ -5606,7 +5612,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
5606 | inline unsigned int ata_host_intr (struct ata_port *ap, | 5612 | inline unsigned int ata_host_intr (struct ata_port *ap, |
5607 | struct ata_queued_cmd *qc) | 5613 | struct ata_queued_cmd *qc) |
5608 | { | 5614 | { |
5609 | struct ata_eh_info *ehi = &ap->eh_info; | 5615 | struct ata_eh_info *ehi = &ap->link.eh_info; |
5610 | u8 status, host_stat = 0; | 5616 | u8 status, host_stat = 0; |
5611 | 5617 | ||
5612 | VPRINTK("ata%u: protocol %d task_state %d\n", | 5618 | VPRINTK("ata%u: protocol %d task_state %d\n", |
@@ -5721,7 +5727,7 @@ irqreturn_t ata_interrupt (int irq, void *dev_instance) | |||
5721 | !(ap->flags & ATA_FLAG_DISABLED)) { | 5727 | !(ap->flags & ATA_FLAG_DISABLED)) { |
5722 | struct ata_queued_cmd *qc; | 5728 | struct ata_queued_cmd *qc; |
5723 | 5729 | ||
5724 | qc = ata_qc_from_tag(ap, ap->active_tag); | 5730 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
5725 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && | 5731 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && |
5726 | (qc->flags & ATA_QCFLAG_ACTIVE)) | 5732 | (qc->flags & ATA_QCFLAG_ACTIVE)) |
5727 | handled |= ata_host_intr(ap, qc); | 5733 | handled |= ata_host_intr(ap, qc); |
@@ -5921,8 +5927,8 @@ static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, | |||
5921 | } | 5927 | } |
5922 | 5928 | ||
5923 | ap->pflags |= ATA_PFLAG_PM_PENDING; | 5929 | ap->pflags |= ATA_PFLAG_PM_PENDING; |
5924 | ap->eh_info.action |= action; | 5930 | ap->link.eh_info.action |= action; |
5925 | ap->eh_info.flags |= ehi_flags; | 5931 | ap->link.eh_info.flags |= ehi_flags; |
5926 | 5932 | ||
5927 | ata_port_schedule_eh(ap); | 5933 | ata_port_schedule_eh(ap); |
5928 | 5934 | ||
@@ -6026,12 +6032,13 @@ int ata_port_start(struct ata_port *ap) | |||
6026 | */ | 6032 | */ |
6027 | void ata_dev_init(struct ata_device *dev) | 6033 | void ata_dev_init(struct ata_device *dev) |
6028 | { | 6034 | { |
6029 | struct ata_port *ap = dev->ap; | 6035 | struct ata_link *link = dev->link; |
6036 | struct ata_port *ap = link->ap; | ||
6030 | unsigned long flags; | 6037 | unsigned long flags; |
6031 | 6038 | ||
6032 | /* SATA spd limit is bound to the first device */ | 6039 | /* SATA spd limit is bound to the first device */ |
6033 | ap->sata_spd_limit = ap->hw_sata_spd_limit; | 6040 | link->sata_spd_limit = link->hw_sata_spd_limit; |
6034 | ap->sata_spd = 0; | 6041 | link->sata_spd = 0; |
6035 | 6042 | ||
6036 | /* High bits of dev->flags are used to record warm plug | 6043 | /* High bits of dev->flags are used to record warm plug |
6037 | * requests which occur asynchronously. Synchronize using | 6044 | * requests which occur asynchronously. Synchronize using |
@@ -6080,8 +6087,8 @@ struct ata_port *ata_port_alloc(struct ata_host *host) | |||
6080 | ap->host = host; | 6087 | ap->host = host; |
6081 | ap->dev = host->dev; | 6088 | ap->dev = host->dev; |
6082 | 6089 | ||
6083 | ap->hw_sata_spd_limit = UINT_MAX; | 6090 | ap->link.hw_sata_spd_limit = UINT_MAX; |
6084 | ap->active_tag = ATA_TAG_POISON; | 6091 | ap->link.active_tag = ATA_TAG_POISON; |
6085 | ap->last_ctl = 0xFF; | 6092 | ap->last_ctl = 0xFF; |
6086 | 6093 | ||
6087 | #if defined(ATA_VERBOSE_DEBUG) | 6094 | #if defined(ATA_VERBOSE_DEBUG) |
@@ -6104,9 +6111,11 @@ struct ata_port *ata_port_alloc(struct ata_host *host) | |||
6104 | 6111 | ||
6105 | ap->cbl = ATA_CBL_NONE; | 6112 | ap->cbl = ATA_CBL_NONE; |
6106 | 6113 | ||
6114 | ap->link.ap = ap; | ||
6115 | |||
6107 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 6116 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
6108 | struct ata_device *dev = &ap->device[i]; | 6117 | struct ata_device *dev = &ap->link.device[i]; |
6109 | dev->ap = ap; | 6118 | dev->link = &ap->link; |
6110 | dev->devno = i; | 6119 | dev->devno = i; |
6111 | ata_dev_init(dev); | 6120 | ata_dev_init(dev); |
6112 | } | 6121 | } |
@@ -6402,9 +6411,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6402 | if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) { | 6411 | if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) { |
6403 | int spd = (scontrol >> 4) & 0xf; | 6412 | int spd = (scontrol >> 4) & 0xf; |
6404 | if (spd) | 6413 | if (spd) |
6405 | ap->hw_sata_spd_limit &= (1 << spd) - 1; | 6414 | ap->link.hw_sata_spd_limit &= (1 << spd) - 1; |
6406 | } | 6415 | } |
6407 | ap->sata_spd_limit = ap->hw_sata_spd_limit; | 6416 | ap->link.sata_spd_limit = ap->link.hw_sata_spd_limit; |
6408 | 6417 | ||
6409 | /* report the secondary IRQ for second channel legacy */ | 6418 | /* report the secondary IRQ for second channel legacy */ |
6410 | irq_line = host->irq; | 6419 | irq_line = host->irq; |
@@ -6436,7 +6445,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6436 | 6445 | ||
6437 | /* probe */ | 6446 | /* probe */ |
6438 | if (ap->ops->error_handler) { | 6447 | if (ap->ops->error_handler) { |
6439 | struct ata_eh_info *ehi = &ap->eh_info; | 6448 | struct ata_eh_info *ehi = &ap->link.eh_info; |
6440 | unsigned long flags; | 6449 | unsigned long flags; |
6441 | 6450 | ||
6442 | ata_port_probe(ap); | 6451 | ata_port_probe(ap); |
@@ -6560,7 +6569,7 @@ void ata_port_detach(struct ata_port *ap) | |||
6560 | spin_lock_irqsave(ap->lock, flags); | 6569 | spin_lock_irqsave(ap->lock, flags); |
6561 | 6570 | ||
6562 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 6571 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
6563 | ata_dev_disable(&ap->device[i]); | 6572 | ata_dev_disable(&ap->link.device[i]); |
6564 | 6573 | ||
6565 | spin_unlock_irqrestore(ap->lock, flags); | 6574 | spin_unlock_irqrestore(ap->lock, flags); |
6566 | 6575 | ||
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index ac6ceed4bb60..e2681f56ed44 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -195,7 +195,7 @@ static int ata_ering_map(struct ata_ering *ering, | |||
195 | 195 | ||
196 | static unsigned int ata_eh_dev_action(struct ata_device *dev) | 196 | static unsigned int ata_eh_dev_action(struct ata_device *dev) |
197 | { | 197 | { |
198 | struct ata_eh_context *ehc = &dev->ap->eh_context; | 198 | struct ata_eh_context *ehc = &dev->link->eh_context; |
199 | 199 | ||
200 | return ehc->i.action | ehc->i.dev_action[dev->devno]; | 200 | return ehc->i.action | ehc->i.dev_action[dev->devno]; |
201 | } | 201 | } |
@@ -261,7 +261,7 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd) | |||
261 | 261 | ||
262 | ret = EH_HANDLED; | 262 | ret = EH_HANDLED; |
263 | spin_lock_irqsave(ap->lock, flags); | 263 | spin_lock_irqsave(ap->lock, flags); |
264 | qc = ata_qc_from_tag(ap, ap->active_tag); | 264 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
265 | if (qc) { | 265 | if (qc) { |
266 | WARN_ON(qc->scsicmd != cmd); | 266 | WARN_ON(qc->scsicmd != cmd); |
267 | qc->flags |= ATA_QCFLAG_EH_SCHEDULED; | 267 | qc->flags |= ATA_QCFLAG_EH_SCHEDULED; |
@@ -371,9 +371,9 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
371 | /* fetch & clear EH info */ | 371 | /* fetch & clear EH info */ |
372 | spin_lock_irqsave(ap->lock, flags); | 372 | spin_lock_irqsave(ap->lock, flags); |
373 | 373 | ||
374 | memset(&ap->eh_context, 0, sizeof(ap->eh_context)); | 374 | memset(&ap->link.eh_context, 0, sizeof(ap->link.eh_context)); |
375 | ap->eh_context.i = ap->eh_info; | 375 | ap->link.eh_context.i = ap->link.eh_info; |
376 | memset(&ap->eh_info, 0, sizeof(ap->eh_info)); | 376 | memset(&ap->link.eh_info, 0, sizeof(ap->link.eh_info)); |
377 | 377 | ||
378 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; | 378 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; |
379 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; | 379 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; |
@@ -409,7 +409,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
409 | } | 409 | } |
410 | 410 | ||
411 | /* this run is complete, make sure EH info is clear */ | 411 | /* this run is complete, make sure EH info is clear */ |
412 | memset(&ap->eh_info, 0, sizeof(ap->eh_info)); | 412 | memset(&ap->link.eh_info, 0, sizeof(ap->link.eh_info)); |
413 | 413 | ||
414 | /* Clear host_eh_scheduled while holding ap->lock such | 414 | /* Clear host_eh_scheduled while holding ap->lock such |
415 | * that if exception occurs after this point but | 415 | * that if exception occurs after this point but |
@@ -420,7 +420,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
420 | 420 | ||
421 | spin_unlock_irqrestore(ap->lock, flags); | 421 | spin_unlock_irqrestore(ap->lock, flags); |
422 | } else { | 422 | } else { |
423 | WARN_ON(ata_qc_from_tag(ap, ap->active_tag) == NULL); | 423 | WARN_ON(ata_qc_from_tag(ap, ap->link.active_tag) == NULL); |
424 | ap->ops->eng_timeout(ap); | 424 | ap->ops->eng_timeout(ap); |
425 | } | 425 | } |
426 | 426 | ||
@@ -575,7 +575,7 @@ void ata_eng_timeout(struct ata_port *ap) | |||
575 | { | 575 | { |
576 | DPRINTK("ENTER\n"); | 576 | DPRINTK("ENTER\n"); |
577 | 577 | ||
578 | ata_qc_timeout(ata_qc_from_tag(ap, ap->active_tag)); | 578 | ata_qc_timeout(ata_qc_from_tag(ap, ap->link.active_tag)); |
579 | 579 | ||
580 | DPRINTK("EXIT\n"); | 580 | DPRINTK("EXIT\n"); |
581 | } | 581 | } |
@@ -922,7 +922,7 @@ void ata_eh_qc_retry(struct ata_queued_cmd *qc) | |||
922 | */ | 922 | */ |
923 | static void ata_eh_detach_dev(struct ata_device *dev) | 923 | static void ata_eh_detach_dev(struct ata_device *dev) |
924 | { | 924 | { |
925 | struct ata_port *ap = dev->ap; | 925 | struct ata_port *ap = dev->link->ap; |
926 | unsigned long flags; | 926 | unsigned long flags; |
927 | 927 | ||
928 | ata_dev_disable(dev); | 928 | ata_dev_disable(dev); |
@@ -937,8 +937,8 @@ static void ata_eh_detach_dev(struct ata_device *dev) | |||
937 | } | 937 | } |
938 | 938 | ||
939 | /* clear per-dev EH actions */ | 939 | /* clear per-dev EH actions */ |
940 | ata_eh_clear_action(dev, &ap->eh_info, ATA_EH_PERDEV_MASK); | 940 | ata_eh_clear_action(dev, &dev->link->eh_info, ATA_EH_PERDEV_MASK); |
941 | ata_eh_clear_action(dev, &ap->eh_context.i, ATA_EH_PERDEV_MASK); | 941 | ata_eh_clear_action(dev, &dev->link->eh_context.i, ATA_EH_PERDEV_MASK); |
942 | 942 | ||
943 | spin_unlock_irqrestore(ap->lock, flags); | 943 | spin_unlock_irqrestore(ap->lock, flags); |
944 | } | 944 | } |
@@ -950,8 +950,8 @@ static void ata_eh_detach_dev(struct ata_device *dev) | |||
950 | * @action: action about to be performed | 950 | * @action: action about to be performed |
951 | * | 951 | * |
952 | * Called just before performing EH actions to clear related bits | 952 | * Called just before performing EH actions to clear related bits |
953 | * in @ap->eh_info such that eh actions are not unnecessarily | 953 | * in @ap->link.eh_info such that eh actions are not |
954 | * repeated. | 954 | * unnecessarily repeated. |
955 | * | 955 | * |
956 | * LOCKING: | 956 | * LOCKING: |
957 | * None. | 957 | * None. |
@@ -960,8 +960,8 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev, | |||
960 | unsigned int action) | 960 | unsigned int action) |
961 | { | 961 | { |
962 | unsigned long flags; | 962 | unsigned long flags; |
963 | struct ata_eh_info *ehi = &ap->eh_info; | 963 | struct ata_eh_info *ehi = &ap->link.eh_info; |
964 | struct ata_eh_context *ehc = &ap->eh_context; | 964 | struct ata_eh_context *ehc = &ap->link.eh_context; |
965 | 965 | ||
966 | spin_lock_irqsave(ap->lock, flags); | 966 | spin_lock_irqsave(ap->lock, flags); |
967 | 967 | ||
@@ -993,7 +993,7 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev, | |||
993 | * @action: action just completed | 993 | * @action: action just completed |
994 | * | 994 | * |
995 | * Called right after performing EH actions to clear related bits | 995 | * Called right after performing EH actions to clear related bits |
996 | * in @ap->eh_context. | 996 | * in @ap->link.eh_context. |
997 | * | 997 | * |
998 | * LOCKING: | 998 | * LOCKING: |
999 | * None. | 999 | * None. |
@@ -1001,13 +1001,15 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev, | |||
1001 | static void ata_eh_done(struct ata_port *ap, struct ata_device *dev, | 1001 | static void ata_eh_done(struct ata_port *ap, struct ata_device *dev, |
1002 | unsigned int action) | 1002 | unsigned int action) |
1003 | { | 1003 | { |
1004 | struct ata_eh_context *ehc = &ap->link.eh_context; | ||
1005 | |||
1004 | /* if reset is complete, clear all reset actions & reset modifier */ | 1006 | /* if reset is complete, clear all reset actions & reset modifier */ |
1005 | if (action & ATA_EH_RESET_MASK) { | 1007 | if (action & ATA_EH_RESET_MASK) { |
1006 | action |= ATA_EH_RESET_MASK; | 1008 | action |= ATA_EH_RESET_MASK; |
1007 | ap->eh_context.i.flags &= ~ATA_EHI_RESET_MODIFIER_MASK; | 1009 | ehc->i.flags &= ~ATA_EHI_RESET_MODIFIER_MASK; |
1008 | } | 1010 | } |
1009 | 1011 | ||
1010 | ata_eh_clear_action(dev, &ap->eh_context.i, action); | 1012 | ata_eh_clear_action(dev, &ehc->i, action); |
1011 | } | 1013 | } |
1012 | 1014 | ||
1013 | /** | 1015 | /** |
@@ -1101,7 +1103,7 @@ static unsigned int ata_read_log_page(struct ata_device *dev, | |||
1101 | static int ata_eh_read_log_10h(struct ata_device *dev, | 1103 | static int ata_eh_read_log_10h(struct ata_device *dev, |
1102 | int *tag, struct ata_taskfile *tf) | 1104 | int *tag, struct ata_taskfile *tf) |
1103 | { | 1105 | { |
1104 | u8 *buf = dev->ap->sector_buf; | 1106 | u8 *buf = dev->link->ap->sector_buf; |
1105 | unsigned int err_mask; | 1107 | unsigned int err_mask; |
1106 | u8 csum; | 1108 | u8 csum; |
1107 | int i; | 1109 | int i; |
@@ -1155,7 +1157,7 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) | |||
1155 | { | 1157 | { |
1156 | struct ata_device *dev = qc->dev; | 1158 | struct ata_device *dev = qc->dev; |
1157 | unsigned char *sense_buf = qc->scsicmd->sense_buffer; | 1159 | unsigned char *sense_buf = qc->scsicmd->sense_buffer; |
1158 | struct ata_port *ap = dev->ap; | 1160 | struct ata_port *ap = dev->link->ap; |
1159 | struct ata_taskfile tf; | 1161 | struct ata_taskfile tf; |
1160 | u8 cdb[ATAPI_CDB_LEN]; | 1162 | u8 cdb[ATAPI_CDB_LEN]; |
1161 | 1163 | ||
@@ -1206,7 +1208,7 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) | |||
1206 | */ | 1208 | */ |
1207 | static void ata_eh_analyze_serror(struct ata_port *ap) | 1209 | static void ata_eh_analyze_serror(struct ata_port *ap) |
1208 | { | 1210 | { |
1209 | struct ata_eh_context *ehc = &ap->eh_context; | 1211 | struct ata_eh_context *ehc = &ap->link.eh_context; |
1210 | u32 serror = ehc->i.serror; | 1212 | u32 serror = ehc->i.serror; |
1211 | unsigned int err_mask = 0, action = 0; | 1213 | unsigned int err_mask = 0, action = 0; |
1212 | 1214 | ||
@@ -1248,8 +1250,8 @@ static void ata_eh_analyze_serror(struct ata_port *ap) | |||
1248 | */ | 1250 | */ |
1249 | static void ata_eh_analyze_ncq_error(struct ata_port *ap) | 1251 | static void ata_eh_analyze_ncq_error(struct ata_port *ap) |
1250 | { | 1252 | { |
1251 | struct ata_eh_context *ehc = &ap->eh_context; | 1253 | struct ata_eh_context *ehc = &ap->link.eh_context; |
1252 | struct ata_device *dev = ap->device; | 1254 | struct ata_device *dev = ap->link.device; |
1253 | struct ata_queued_cmd *qc; | 1255 | struct ata_queued_cmd *qc; |
1254 | struct ata_taskfile tf; | 1256 | struct ata_taskfile tf; |
1255 | int tag, rc; | 1257 | int tag, rc; |
@@ -1259,7 +1261,7 @@ static void ata_eh_analyze_ncq_error(struct ata_port *ap) | |||
1259 | return; | 1261 | return; |
1260 | 1262 | ||
1261 | /* is it NCQ device error? */ | 1263 | /* is it NCQ device error? */ |
1262 | if (!ap->sactive || !(ehc->i.err_mask & AC_ERR_DEV)) | 1264 | if (!ap->link.sactive || !(ehc->i.err_mask & AC_ERR_DEV)) |
1263 | return; | 1265 | return; |
1264 | 1266 | ||
1265 | /* has LLDD analyzed already? */ | 1267 | /* has LLDD analyzed already? */ |
@@ -1281,7 +1283,7 @@ static void ata_eh_analyze_ncq_error(struct ata_port *ap) | |||
1281 | return; | 1283 | return; |
1282 | } | 1284 | } |
1283 | 1285 | ||
1284 | if (!(ap->sactive & (1 << tag))) { | 1286 | if (!(ap->link.sactive & (1 << tag))) { |
1285 | ata_port_printk(ap, KERN_ERR, "log page 10h reported " | 1287 | ata_port_printk(ap, KERN_ERR, "log page 10h reported " |
1286 | "inactive tag %d\n", tag); | 1288 | "inactive tag %d\n", tag); |
1287 | return; | 1289 | return; |
@@ -1497,7 +1499,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io, | |||
1497 | /* speed down? */ | 1499 | /* speed down? */ |
1498 | if (verdict & ATA_EH_SPDN_SPEED_DOWN) { | 1500 | if (verdict & ATA_EH_SPDN_SPEED_DOWN) { |
1499 | /* speed down SATA link speed if possible */ | 1501 | /* speed down SATA link speed if possible */ |
1500 | if (sata_down_spd_limit(dev->ap) == 0) { | 1502 | if (sata_down_spd_limit(dev->link->ap) == 0) { |
1501 | action |= ATA_EH_HARDRESET; | 1503 | action |= ATA_EH_HARDRESET; |
1502 | goto done; | 1504 | goto done; |
1503 | } | 1505 | } |
@@ -1528,7 +1530,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io, | |||
1528 | * SATA. Consider it only for PATA. | 1530 | * SATA. Consider it only for PATA. |
1529 | */ | 1531 | */ |
1530 | if ((verdict & ATA_EH_SPDN_FALLBACK_TO_PIO) && (dev->spdn_cnt >= 2) && | 1532 | if ((verdict & ATA_EH_SPDN_FALLBACK_TO_PIO) && (dev->spdn_cnt >= 2) && |
1531 | (dev->ap->cbl != ATA_CBL_SATA) && | 1533 | (dev->link->ap->cbl != ATA_CBL_SATA) && |
1532 | (dev->xfer_shift != ATA_SHIFT_PIO)) { | 1534 | (dev->xfer_shift != ATA_SHIFT_PIO)) { |
1533 | if (ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO) == 0) { | 1535 | if (ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO) == 0) { |
1534 | dev->spdn_cnt = 0; | 1536 | dev->spdn_cnt = 0; |
@@ -1557,7 +1559,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, int is_io, | |||
1557 | */ | 1559 | */ |
1558 | static void ata_eh_autopsy(struct ata_port *ap) | 1560 | static void ata_eh_autopsy(struct ata_port *ap) |
1559 | { | 1561 | { |
1560 | struct ata_eh_context *ehc = &ap->eh_context; | 1562 | struct ata_eh_context *ehc = &ap->link.eh_context; |
1561 | unsigned int all_err_mask = 0; | 1563 | unsigned int all_err_mask = 0; |
1562 | int tag, is_io = 0; | 1564 | int tag, is_io = 0; |
1563 | u32 serror; | 1565 | u32 serror; |
@@ -1656,7 +1658,7 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1656 | */ | 1658 | */ |
1657 | static void ata_eh_report(struct ata_port *ap) | 1659 | static void ata_eh_report(struct ata_port *ap) |
1658 | { | 1660 | { |
1659 | struct ata_eh_context *ehc = &ap->eh_context; | 1661 | struct ata_eh_context *ehc = &ap->link.eh_context; |
1660 | const char *frozen, *desc; | 1662 | const char *frozen, *desc; |
1661 | int tag, nr_failed = 0; | 1663 | int tag, nr_failed = 0; |
1662 | 1664 | ||
@@ -1685,15 +1687,15 @@ static void ata_eh_report(struct ata_port *ap) | |||
1685 | if (ehc->i.dev) { | 1687 | if (ehc->i.dev) { |
1686 | ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x " | 1688 | ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x " |
1687 | "SAct 0x%x SErr 0x%x action 0x%x%s\n", | 1689 | "SAct 0x%x SErr 0x%x action 0x%x%s\n", |
1688 | ehc->i.err_mask, ap->sactive, ehc->i.serror, | 1690 | ehc->i.err_mask, ap->link.sactive, |
1689 | ehc->i.action, frozen); | 1691 | ehc->i.serror, ehc->i.action, frozen); |
1690 | if (desc) | 1692 | if (desc) |
1691 | ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc); | 1693 | ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc); |
1692 | } else { | 1694 | } else { |
1693 | ata_port_printk(ap, KERN_ERR, "exception Emask 0x%x " | 1695 | ata_port_printk(ap, KERN_ERR, "exception Emask 0x%x " |
1694 | "SAct 0x%x SErr 0x%x action 0x%x%s\n", | 1696 | "SAct 0x%x SErr 0x%x action 0x%x%s\n", |
1695 | ehc->i.err_mask, ap->sactive, ehc->i.serror, | 1697 | ehc->i.err_mask, ap->link.sactive, |
1696 | ehc->i.action, frozen); | 1698 | ehc->i.serror, ehc->i.action, frozen); |
1697 | if (desc) | 1699 | if (desc) |
1698 | ata_port_printk(ap, KERN_ERR, "%s\n", desc); | 1700 | ata_port_printk(ap, KERN_ERR, "%s\n", desc); |
1699 | } | 1701 | } |
@@ -1775,7 +1777,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify, | |||
1775 | ata_prereset_fn_t prereset, ata_reset_fn_t softreset, | 1777 | ata_prereset_fn_t prereset, ata_reset_fn_t softreset, |
1776 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) | 1778 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) |
1777 | { | 1779 | { |
1778 | struct ata_eh_context *ehc = &ap->eh_context; | 1780 | struct ata_eh_context *ehc = &ap->link.eh_context; |
1779 | unsigned int *classes = ehc->classes; | 1781 | unsigned int *classes = ehc->classes; |
1780 | int verbose = !(ehc->i.flags & ATA_EHI_QUIET); | 1782 | int verbose = !(ehc->i.flags & ATA_EHI_QUIET); |
1781 | int try = 0; | 1783 | int try = 0; |
@@ -1804,7 +1806,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify, | |||
1804 | if (rc == -ENOENT) { | 1806 | if (rc == -ENOENT) { |
1805 | ata_port_printk(ap, KERN_DEBUG, | 1807 | ata_port_printk(ap, KERN_DEBUG, |
1806 | "port disabled. ignoring.\n"); | 1808 | "port disabled. ignoring.\n"); |
1807 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | 1809 | ehc->i.action &= ~ATA_EH_RESET_MASK; |
1808 | 1810 | ||
1809 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 1811 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
1810 | classes[i] = ATA_DEV_NONE; | 1812 | classes[i] = ATA_DEV_NONE; |
@@ -1907,11 +1909,11 @@ static int ata_eh_reset(struct ata_port *ap, int classify, | |||
1907 | * controller state is undefined. Record the mode. | 1909 | * controller state is undefined. Record the mode. |
1908 | */ | 1910 | */ |
1909 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 1911 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
1910 | ap->device[i].pio_mode = XFER_PIO_0; | 1912 | ap->link.device[i].pio_mode = XFER_PIO_0; |
1911 | 1913 | ||
1912 | /* record current link speed */ | 1914 | /* record current link speed */ |
1913 | if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0) | 1915 | if (sata_scr_read(ap, SCR_STATUS, &sstatus) == 0) |
1914 | ap->sata_spd = (sstatus >> 4) & 0xf; | 1916 | ap->link.sata_spd = (sstatus >> 4) & 0xf; |
1915 | 1917 | ||
1916 | if (postreset) | 1918 | if (postreset) |
1917 | postreset(ap, classes); | 1919 | postreset(ap, classes); |
@@ -1929,7 +1931,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify, | |||
1929 | static int ata_eh_revalidate_and_attach(struct ata_port *ap, | 1931 | static int ata_eh_revalidate_and_attach(struct ata_port *ap, |
1930 | struct ata_device **r_failed_dev) | 1932 | struct ata_device **r_failed_dev) |
1931 | { | 1933 | { |
1932 | struct ata_eh_context *ehc = &ap->eh_context; | 1934 | struct ata_eh_context *ehc = &ap->link.eh_context; |
1933 | struct ata_device *dev; | 1935 | struct ata_device *dev; |
1934 | unsigned int new_mask = 0; | 1936 | unsigned int new_mask = 0; |
1935 | unsigned long flags; | 1937 | unsigned long flags; |
@@ -1944,7 +1946,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1944 | for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) { | 1946 | for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) { |
1945 | unsigned int action, readid_flags = 0; | 1947 | unsigned int action, readid_flags = 0; |
1946 | 1948 | ||
1947 | dev = &ap->device[i]; | 1949 | dev = &ap->link.device[i]; |
1948 | action = ata_eh_dev_action(dev); | 1950 | action = ata_eh_dev_action(dev); |
1949 | 1951 | ||
1950 | if (ehc->i.flags & ATA_EHI_DID_RESET) | 1952 | if (ehc->i.flags & ATA_EHI_DID_RESET) |
@@ -2004,7 +2006,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
2004 | * device detection messages backwards. | 2006 | * device detection messages backwards. |
2005 | */ | 2007 | */ |
2006 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2008 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2007 | dev = &ap->device[i]; | 2009 | dev = &ap->link.device[i]; |
2008 | 2010 | ||
2009 | if (!(new_mask & (1 << i))) | 2011 | if (!(new_mask & (1 << i))) |
2010 | continue; | 2012 | continue; |
@@ -2036,7 +2038,7 @@ static int ata_port_nr_enabled(struct ata_port *ap) | |||
2036 | int i, cnt = 0; | 2038 | int i, cnt = 0; |
2037 | 2039 | ||
2038 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 2040 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
2039 | if (ata_dev_enabled(&ap->device[i])) | 2041 | if (ata_dev_enabled(&ap->link.device[i])) |
2040 | cnt++; | 2042 | cnt++; |
2041 | return cnt; | 2043 | return cnt; |
2042 | } | 2044 | } |
@@ -2046,14 +2048,14 @@ static int ata_port_nr_vacant(struct ata_port *ap) | |||
2046 | int i, cnt = 0; | 2048 | int i, cnt = 0; |
2047 | 2049 | ||
2048 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 2050 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
2049 | if (ap->device[i].class == ATA_DEV_UNKNOWN) | 2051 | if (ap->link.device[i].class == ATA_DEV_UNKNOWN) |
2050 | cnt++; | 2052 | cnt++; |
2051 | return cnt; | 2053 | return cnt; |
2052 | } | 2054 | } |
2053 | 2055 | ||
2054 | static int ata_eh_skip_recovery(struct ata_port *ap) | 2056 | static int ata_eh_skip_recovery(struct ata_port *ap) |
2055 | { | 2057 | { |
2056 | struct ata_eh_context *ehc = &ap->eh_context; | 2058 | struct ata_eh_context *ehc = &ap->link.eh_context; |
2057 | int i; | 2059 | int i; |
2058 | 2060 | ||
2059 | /* thaw frozen port, resume link and recover failed devices */ | 2061 | /* thaw frozen port, resume link and recover failed devices */ |
@@ -2063,7 +2065,7 @@ static int ata_eh_skip_recovery(struct ata_port *ap) | |||
2063 | 2065 | ||
2064 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ | 2066 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ |
2065 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2067 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2066 | struct ata_device *dev = &ap->device[i]; | 2068 | struct ata_device *dev = &ap->link.device[i]; |
2067 | 2069 | ||
2068 | if (dev->class == ATA_DEV_UNKNOWN && | 2070 | if (dev->class == ATA_DEV_UNKNOWN && |
2069 | ehc->classes[dev->devno] != ATA_DEV_NONE) | 2071 | ehc->classes[dev->devno] != ATA_DEV_NONE) |
@@ -2075,8 +2077,8 @@ static int ata_eh_skip_recovery(struct ata_port *ap) | |||
2075 | 2077 | ||
2076 | static void ata_eh_handle_dev_fail(struct ata_device *dev, int err) | 2078 | static void ata_eh_handle_dev_fail(struct ata_device *dev, int err) |
2077 | { | 2079 | { |
2078 | struct ata_port *ap = dev->ap; | 2080 | struct ata_port *ap = dev->link->ap; |
2079 | struct ata_eh_context *ehc = &ap->eh_context; | 2081 | struct ata_eh_context *ehc = &dev->link->eh_context; |
2080 | 2082 | ||
2081 | ehc->tries[dev->devno]--; | 2083 | ehc->tries[dev->devno]--; |
2082 | 2084 | ||
@@ -2149,7 +2151,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2149 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | 2151 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
2150 | ata_postreset_fn_t postreset) | 2152 | ata_postreset_fn_t postreset) |
2151 | { | 2153 | { |
2152 | struct ata_eh_context *ehc = &ap->eh_context; | 2154 | struct ata_eh_context *ehc = &ap->link.eh_context; |
2153 | struct ata_device *dev; | 2155 | struct ata_device *dev; |
2154 | int i, rc; | 2156 | int i, rc; |
2155 | 2157 | ||
@@ -2157,7 +2159,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2157 | 2159 | ||
2158 | /* prep for recovery */ | 2160 | /* prep for recovery */ |
2159 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2161 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2160 | dev = &ap->device[i]; | 2162 | dev = &ap->link.device[i]; |
2161 | 2163 | ||
2162 | ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; | 2164 | ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; |
2163 | 2165 | ||
@@ -2240,7 +2242,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2240 | out: | 2242 | out: |
2241 | if (rc) { | 2243 | if (rc) { |
2242 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 2244 | for (i = 0; i < ATA_MAX_DEVICES; i++) |
2243 | ata_dev_disable(&ap->device[i]); | 2245 | ata_dev_disable(&ap->link.device[i]); |
2244 | } | 2246 | } |
2245 | 2247 | ||
2246 | DPRINTK("EXIT, rc=%d\n", rc); | 2248 | DPRINTK("EXIT, rc=%d\n", rc); |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index e83647651b31..ec0e2638200e 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1368,14 +1368,14 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | |||
1368 | case ATA_CMD_SET_FEATURES: | 1368 | case ATA_CMD_SET_FEATURES: |
1369 | if ((qc->tf.feature == SETFEATURES_WC_ON) || | 1369 | if ((qc->tf.feature == SETFEATURES_WC_ON) || |
1370 | (qc->tf.feature == SETFEATURES_WC_OFF)) { | 1370 | (qc->tf.feature == SETFEATURES_WC_OFF)) { |
1371 | ap->eh_info.action |= ATA_EH_REVALIDATE; | 1371 | ap->link.eh_info.action |= ATA_EH_REVALIDATE; |
1372 | ata_port_schedule_eh(ap); | 1372 | ata_port_schedule_eh(ap); |
1373 | } | 1373 | } |
1374 | break; | 1374 | break; |
1375 | 1375 | ||
1376 | case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ | 1376 | case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ |
1377 | case ATA_CMD_SET_MULTI: /* multi_count changed */ | 1377 | case ATA_CMD_SET_MULTI: /* multi_count changed */ |
1378 | ap->eh_info.action |= ATA_EH_REVALIDATE; | 1378 | ap->link.eh_info.action |= ATA_EH_REVALIDATE; |
1379 | ata_port_schedule_eh(ap); | 1379 | ata_port_schedule_eh(ap); |
1380 | break; | 1380 | break; |
1381 | } | 1381 | } |
@@ -1439,14 +1439,14 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | |||
1439 | */ | 1439 | */ |
1440 | static int ata_scmd_need_defer(struct ata_device *dev, int is_io) | 1440 | static int ata_scmd_need_defer(struct ata_device *dev, int is_io) |
1441 | { | 1441 | { |
1442 | struct ata_port *ap = dev->ap; | 1442 | struct ata_link *link = dev->link; |
1443 | int is_ncq = is_io && ata_ncq_enabled(dev); | 1443 | int is_ncq = is_io && ata_ncq_enabled(dev); |
1444 | 1444 | ||
1445 | if (is_ncq) { | 1445 | if (is_ncq) { |
1446 | if (!ata_tag_valid(ap->active_tag)) | 1446 | if (!ata_tag_valid(link->active_tag)) |
1447 | return 0; | 1447 | return 0; |
1448 | } else { | 1448 | } else { |
1449 | if (!ata_tag_valid(ap->active_tag) && !ap->sactive) | 1449 | if (!ata_tag_valid(link->active_tag) && !link->sactive) |
1450 | return 0; | 1450 | return 0; |
1451 | } | 1451 | } |
1452 | return 1; | 1452 | return 1; |
@@ -2426,7 +2426,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2426 | static struct ata_device * ata_find_dev(struct ata_port *ap, int id) | 2426 | static struct ata_device * ata_find_dev(struct ata_port *ap, int id) |
2427 | { | 2427 | { |
2428 | if (likely(id < ATA_MAX_DEVICES)) | 2428 | if (likely(id < ATA_MAX_DEVICES)) |
2429 | return &ap->device[id]; | 2429 | return &ap->link.device[id]; |
2430 | return NULL; | 2430 | return NULL; |
2431 | } | 2431 | } |
2432 | 2432 | ||
@@ -2458,7 +2458,7 @@ static int ata_scsi_dev_enabled(struct ata_device *dev) | |||
2458 | if (unlikely(!ata_dev_enabled(dev))) | 2458 | if (unlikely(!ata_dev_enabled(dev))) |
2459 | return 0; | 2459 | return 0; |
2460 | 2460 | ||
2461 | if (!atapi_enabled || (dev->ap->flags & ATA_FLAG_NO_ATAPI)) { | 2461 | if (!atapi_enabled || (dev->link->ap->flags & ATA_FLAG_NO_ATAPI)) { |
2462 | if (unlikely(dev->class == ATA_DEV_ATAPI)) { | 2462 | if (unlikely(dev->class == ATA_DEV_ATAPI)) { |
2463 | ata_dev_printk(dev, KERN_WARNING, | 2463 | ata_dev_printk(dev, KERN_WARNING, |
2464 | "WARNING: ATAPI is %s, device ignored.\n", | 2464 | "WARNING: ATAPI is %s, device ignored.\n", |
@@ -2961,7 +2961,7 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) | |||
2961 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2961 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2962 | struct scsi_device *sdev; | 2962 | struct scsi_device *sdev; |
2963 | 2963 | ||
2964 | dev = &ap->device[i]; | 2964 | dev = &ap->link.device[i]; |
2965 | 2965 | ||
2966 | if (!ata_dev_enabled(dev) || dev->sdev) | 2966 | if (!ata_dev_enabled(dev) || dev->sdev) |
2967 | continue; | 2967 | continue; |
@@ -2978,7 +2978,7 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) | |||
2978 | * whether all devices are attached. | 2978 | * whether all devices are attached. |
2979 | */ | 2979 | */ |
2980 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2980 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2981 | dev = &ap->device[i]; | 2981 | dev = &ap->link.device[i]; |
2982 | if (ata_dev_enabled(dev) && !dev->sdev) | 2982 | if (ata_dev_enabled(dev) && !dev->sdev) |
2983 | break; | 2983 | break; |
2984 | } | 2984 | } |
@@ -3049,7 +3049,7 @@ int ata_scsi_offline_dev(struct ata_device *dev) | |||
3049 | */ | 3049 | */ |
3050 | static void ata_scsi_remove_dev(struct ata_device *dev) | 3050 | static void ata_scsi_remove_dev(struct ata_device *dev) |
3051 | { | 3051 | { |
3052 | struct ata_port *ap = dev->ap; | 3052 | struct ata_port *ap = dev->link->ap; |
3053 | struct scsi_device *sdev; | 3053 | struct scsi_device *sdev; |
3054 | unsigned long flags; | 3054 | unsigned long flags; |
3055 | 3055 | ||
@@ -3123,7 +3123,7 @@ void ata_scsi_hotplug(struct work_struct *work) | |||
3123 | 3123 | ||
3124 | /* unplug detached devices */ | 3124 | /* unplug detached devices */ |
3125 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 3125 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
3126 | struct ata_device *dev = &ap->device[i]; | 3126 | struct ata_device *dev = &ap->link.device[i]; |
3127 | unsigned long flags; | 3127 | unsigned long flags; |
3128 | 3128 | ||
3129 | if (!(dev->flags & ATA_DFLAG_DETACHED)) | 3129 | if (!(dev->flags & ATA_DFLAG_DETACHED)) |
@@ -3162,6 +3162,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, | |||
3162 | unsigned int id, unsigned int lun) | 3162 | unsigned int id, unsigned int lun) |
3163 | { | 3163 | { |
3164 | struct ata_port *ap = ata_shost_to_port(shost); | 3164 | struct ata_port *ap = ata_shost_to_port(shost); |
3165 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
3165 | unsigned long flags; | 3166 | unsigned long flags; |
3166 | int rc = 0; | 3167 | int rc = 0; |
3167 | 3168 | ||
@@ -3175,15 +3176,15 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, | |||
3175 | spin_lock_irqsave(ap->lock, flags); | 3176 | spin_lock_irqsave(ap->lock, flags); |
3176 | 3177 | ||
3177 | if (id == SCAN_WILD_CARD) { | 3178 | if (id == SCAN_WILD_CARD) { |
3178 | ap->eh_info.probe_mask |= (1 << ATA_MAX_DEVICES) - 1; | 3179 | ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; |
3179 | ap->eh_info.action |= ATA_EH_SOFTRESET; | 3180 | ehi->action |= ATA_EH_SOFTRESET; |
3180 | } else { | 3181 | } else { |
3181 | struct ata_device *dev = ata_find_dev(ap, id); | 3182 | struct ata_device *dev = ata_find_dev(ap, id); |
3182 | 3183 | ||
3183 | if (dev) { | 3184 | if (dev) { |
3184 | ap->eh_info.probe_mask |= 1 << dev->devno; | 3185 | ehi->probe_mask |= 1 << dev->devno; |
3185 | ap->eh_info.action |= ATA_EH_SOFTRESET; | 3186 | ehi->action |= ATA_EH_SOFTRESET; |
3186 | ap->eh_info.flags |= ATA_EHI_RESUME_LINK; | 3187 | ehi->flags |= ATA_EHI_RESUME_LINK; |
3187 | } else | 3188 | } else |
3188 | rc = -EINVAL; | 3189 | rc = -EINVAL; |
3189 | } | 3190 | } |
@@ -3220,7 +3221,7 @@ void ata_scsi_dev_rescan(struct work_struct *work) | |||
3220 | spin_lock_irqsave(ap->lock, flags); | 3221 | spin_lock_irqsave(ap->lock, flags); |
3221 | 3222 | ||
3222 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 3223 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
3223 | struct ata_device *dev = &ap->device[i]; | 3224 | struct ata_device *dev = &ap->link.device[i]; |
3224 | struct scsi_device *sdev = dev->sdev; | 3225 | struct scsi_device *sdev = dev->sdev; |
3225 | 3226 | ||
3226 | if (!ata_dev_enabled(dev) || !sdev) | 3227 | if (!ata_dev_enabled(dev) || !sdev) |
@@ -3359,7 +3360,7 @@ EXPORT_SYMBOL_GPL(ata_sas_port_destroy); | |||
3359 | int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap) | 3360 | int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap) |
3360 | { | 3361 | { |
3361 | ata_scsi_sdev_config(sdev); | 3362 | ata_scsi_sdev_config(sdev); |
3362 | ata_scsi_dev_config(sdev, ap->device); | 3363 | ata_scsi_dev_config(sdev, ap->link.device); |
3363 | return 0; | 3364 | return 0; |
3364 | } | 3365 | } |
3365 | EXPORT_SYMBOL_GPL(ata_sas_slave_configure); | 3366 | EXPORT_SYMBOL_GPL(ata_sas_slave_configure); |
@@ -3382,8 +3383,8 @@ int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | |||
3382 | 3383 | ||
3383 | ata_scsi_dump_cdb(ap, cmd); | 3384 | ata_scsi_dump_cdb(ap, cmd); |
3384 | 3385 | ||
3385 | if (likely(ata_scsi_dev_enabled(ap->device))) | 3386 | if (likely(ata_scsi_dev_enabled(ap->link.device))) |
3386 | rc = __ata_scsi_queuecmd(cmd, done, ap->device); | 3387 | rc = __ata_scsi_queuecmd(cmd, done, ap->link.device); |
3387 | else { | 3388 | else { |
3388 | cmd->result = (DID_BAD_TARGET << 16); | 3389 | cmd->result = (DID_BAD_TARGET << 16); |
3389 | done(cmd); | 3390 | done(cmd); |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 8023167bbbeb..2100cd61ed69 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -445,7 +445,7 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
445 | unsigned long flags; | 445 | unsigned long flags; |
446 | int thaw = 0; | 446 | int thaw = 0; |
447 | 447 | ||
448 | qc = __ata_qc_from_tag(ap, ap->active_tag); | 448 | qc = __ata_qc_from_tag(ap, ap->link.active_tag); |
449 | if (qc && !(qc->flags & ATA_QCFLAG_FAILED)) | 449 | if (qc && !(qc->flags & ATA_QCFLAG_FAILED)) |
450 | qc = NULL; | 450 | qc = NULL; |
451 | 451 | ||
@@ -909,7 +909,7 @@ unsigned long ata_pci_default_filter(struct ata_device *adev, unsigned long xfer | |||
909 | /* Filter out DMA modes if the device has been configured by | 909 | /* Filter out DMA modes if the device has been configured by |
910 | the BIOS as PIO only */ | 910 | the BIOS as PIO only */ |
911 | 911 | ||
912 | if (adev->ap->ioaddr.bmdma_addr == 0) | 912 | if (adev->link->ap->ioaddr.bmdma_addr == 0) |
913 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 913 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
914 | return xfer_mask; | 914 | return xfer_mask; |
915 | } | 915 | } |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 5d8b91e70ecd..ece1a28f0a4a 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -391,7 +391,7 @@ static void it821x_passthru_dev_select(struct ata_port *ap, | |||
391 | { | 391 | { |
392 | struct it821x_dev *itdev = ap->private_data; | 392 | struct it821x_dev *itdev = ap->private_data; |
393 | if (itdev && device != itdev->last_device) { | 393 | if (itdev && device != itdev->last_device) { |
394 | struct ata_device *adev = &ap->device[device]; | 394 | struct ata_device *adev = &ap->link.device[device]; |
395 | it821x_program(ap, adev, itdev->pio[adev->devno]); | 395 | it821x_program(ap, adev, itdev->pio[adev->devno]); |
396 | itdev->last_device = device; | 396 | itdev->last_device = device; |
397 | } | 397 | } |
@@ -464,7 +464,7 @@ static int it821x_smart_set_mode(struct ata_port *ap, struct ata_device **unused | |||
464 | int i; | 464 | int i; |
465 | 465 | ||
466 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 466 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
467 | struct ata_device *dev = &ap->device[i]; | 467 | struct ata_device *dev = &ap->link.device[i]; |
468 | if (ata_dev_enabled(dev)) { | 468 | if (ata_dev_enabled(dev)) { |
469 | /* We don't really care */ | 469 | /* We don't really care */ |
470 | dev->pio_mode = XFER_PIO_0; | 470 | dev->pio_mode = XFER_PIO_0; |
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index 5dea3584c6c2..3e2b8ce5fa37 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
@@ -31,7 +31,7 @@ static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error) | |||
31 | int i; | 31 | int i; |
32 | 32 | ||
33 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 33 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
34 | struct ata_device *dev = &ap->device[i]; | 34 | struct ata_device *dev = &ap->link.device[i]; |
35 | if (ata_dev_enabled(dev)) { | 35 | if (ata_dev_enabled(dev)) { |
36 | ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); | 36 | ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); |
37 | dev->pio_mode = XFER_PIO_0; | 37 | dev->pio_mode = XFER_PIO_0; |
@@ -49,7 +49,7 @@ static void ixp4xx_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, | |||
49 | unsigned int i; | 49 | unsigned int i; |
50 | unsigned int words = buflen >> 1; | 50 | unsigned int words = buflen >> 1; |
51 | u16 *buf16 = (u16 *) buf; | 51 | u16 *buf16 = (u16 *) buf; |
52 | struct ata_port *ap = adev->ap; | 52 | struct ata_port *ap = adev->link->ap; |
53 | void __iomem *mmio = ap->ioaddr.data_addr; | 53 | void __iomem *mmio = ap->ioaddr.data_addr; |
54 | struct ixp4xx_pata_data *data = ap->host->dev->platform_data; | 54 | struct ixp4xx_pata_data *data = ap->host->dev->platform_data; |
55 | 55 | ||
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index edffc25d2d3f..4bcc0ae8d108 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -112,7 +112,7 @@ static int legacy_set_mode(struct ata_port *ap, struct ata_device **unused) | |||
112 | int i; | 112 | int i; |
113 | 113 | ||
114 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 114 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
115 | struct ata_device *dev = &ap->device[i]; | 115 | struct ata_device *dev = &ap->link.device[i]; |
116 | if (ata_dev_enabled(dev)) { | 116 | if (ata_dev_enabled(dev)) { |
117 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); | 117 | ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); |
118 | dev->pio_mode = XFER_PIO_0; | 118 | dev->pio_mode = XFER_PIO_0; |
@@ -256,7 +256,7 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
256 | 256 | ||
257 | static void pdc_data_xfer_vlb(struct ata_device *adev, unsigned char *buf, unsigned int buflen, int write_data) | 257 | static void pdc_data_xfer_vlb(struct ata_device *adev, unsigned char *buf, unsigned int buflen, int write_data) |
258 | { | 258 | { |
259 | struct ata_port *ap = adev->ap; | 259 | struct ata_port *ap = adev->link->ap; |
260 | int slop = buflen & 3; | 260 | int slop = buflen & 3; |
261 | unsigned long flags; | 261 | unsigned long flags; |
262 | 262 | ||
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index f89bdfde16d0..f8234d7fd825 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c | |||
@@ -340,8 +340,8 @@ static int optidma_set_mode(struct ata_port *ap, struct ata_device **r_failed) | |||
340 | pci_read_config_byte(pdev, 0x43, &r); | 340 | pci_read_config_byte(pdev, 0x43, &r); |
341 | 341 | ||
342 | r &= (0x0F << nybble); | 342 | r &= (0x0F << nybble); |
343 | r |= (optidma_make_bits43(&ap->device[0]) + | 343 | r |= (optidma_make_bits43(&ap->link.device[0]) + |
344 | (optidma_make_bits43(&ap->device[0]) << 2)) << nybble; | 344 | (optidma_make_bits43(&ap->link.device[0]) << 2)) << nybble; |
345 | pci_write_config_byte(pdev, 0x43, r); | 345 | pci_write_config_byte(pdev, 0x43, r); |
346 | } | 346 | } |
347 | return rc; | 347 | return rc; |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 0f2b027624d6..890f649ddcce 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -67,8 +67,8 @@ struct ata_pcmcia_info { | |||
67 | 67 | ||
68 | static int pcmcia_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | 68 | static int pcmcia_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) |
69 | { | 69 | { |
70 | struct ata_device *master = &ap->device[0]; | 70 | struct ata_device *master = &ap->link.device[0]; |
71 | struct ata_device *slave = &ap->device[1]; | 71 | struct ata_device *slave = &ap->link.device[1]; |
72 | 72 | ||
73 | if (!ata_dev_enabled(master) || !ata_dev_enabled(slave)) | 73 | if (!ata_dev_enabled(master) || !ata_dev_enabled(slave)) |
74 | return ata_do_set_mode(ap, r_failed_dev); | 74 | return ata_do_set_mode(ap, r_failed_dev); |
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index bb64a986e8f5..fa780509a1dc 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -486,7 +486,7 @@ static int pdc2027x_set_mode(struct ata_port *ap, struct ata_device **r_failed) | |||
486 | return i; | 486 | return i; |
487 | 487 | ||
488 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 488 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
489 | struct ata_device *dev = &ap->device[i]; | 489 | struct ata_device *dev = &ap->link.device[i]; |
490 | 490 | ||
491 | if (ata_dev_enabled(dev)) { | 491 | if (ata_dev_enabled(dev)) { |
492 | 492 | ||
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 5086d03f2d7c..e89656bffa84 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
@@ -35,7 +35,7 @@ static int pata_platform_set_mode(struct ata_port *ap, struct ata_device **unuse | |||
35 | int i; | 35 | int i; |
36 | 36 | ||
37 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 37 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
38 | struct ata_device *dev = &ap->device[i]; | 38 | struct ata_device *dev = &ap->link.device[i]; |
39 | 39 | ||
40 | if (ata_dev_enabled(dev)) { | 40 | if (ata_dev_enabled(dev)) { |
41 | /* We don't really care */ | 41 | /* We don't really care */ |
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index 1998c19e8743..ec2206e820ac 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
@@ -126,7 +126,7 @@ static unsigned int qdi_qc_issue_prot(struct ata_queued_cmd *qc) | |||
126 | 126 | ||
127 | static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned int buflen, int write_data) | 127 | static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned int buflen, int write_data) |
128 | { | 128 | { |
129 | struct ata_port *ap = adev->ap; | 129 | struct ata_port *ap = adev->link->ap; |
130 | int slop = buflen & 3; | 130 | int slop = buflen & 3; |
131 | 131 | ||
132 | if (ata_id_has_dword_io(adev->id)) { | 132 | if (ata_id_has_dword_io(adev->id)) { |
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index 7632fcb070ca..57363c0ce068 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
@@ -39,7 +39,7 @@ static int rz1000_set_mode(struct ata_port *ap, struct ata_device **unused) | |||
39 | int i; | 39 | int i; |
40 | 40 | ||
41 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 41 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
42 | struct ata_device *dev = &ap->device[i]; | 42 | struct ata_device *dev = &ap->link.device[i]; |
43 | if (ata_dev_enabled(dev)) { | 43 | if (ata_dev_enabled(dev)) { |
44 | /* We don't really care */ | 44 | /* We don't really care */ |
45 | dev->pio_mode = XFER_PIO_0; | 45 | dev->pio_mode = XFER_PIO_0; |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 2d048ef25a5a..aab068fbb7bc 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -785,7 +785,7 @@ static u8 scc_bmdma_status (struct ata_port *ap) | |||
785 | static void scc_data_xfer (struct ata_device *adev, unsigned char *buf, | 785 | static void scc_data_xfer (struct ata_device *adev, unsigned char *buf, |
786 | unsigned int buflen, int write_data) | 786 | unsigned int buflen, int write_data) |
787 | { | 787 | { |
788 | struct ata_port *ap = adev->ap; | 788 | struct ata_port *ap = adev->link->ap; |
789 | unsigned int words = buflen >> 1; | 789 | unsigned int words = buflen >> 1; |
790 | unsigned int i; | 790 | unsigned int i; |
791 | u16 *buf16 = (u16 *) buf; | 791 | u16 *buf16 = (u16 *) buf; |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index cce2834b2b60..9d6f81d52e18 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -84,7 +84,7 @@ static int sis_short_ata40(struct pci_dev *dev) | |||
84 | 84 | ||
85 | static int sis_old_port_base(struct ata_device *adev) | 85 | static int sis_old_port_base(struct ata_device *adev) |
86 | { | 86 | { |
87 | return 0x40 + (4 * adev->ap->port_no) + (2 * adev->devno); | 87 | return 0x40 + (4 * adev->link->ap->port_no) + (2 * adev->devno); |
88 | } | 88 | } |
89 | 89 | ||
90 | /** | 90 | /** |
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index 83abfeca4057..c37570330073 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c | |||
@@ -94,7 +94,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
94 | 94 | ||
95 | static void winbond_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned int buflen, int write_data) | 95 | static void winbond_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned int buflen, int write_data) |
96 | { | 96 | { |
97 | struct ata_port *ap = adev->ap; | 97 | struct ata_port *ap = adev->link->ap; |
98 | int slop = buflen & 3; | 98 | int slop = buflen & 3; |
99 | 99 | ||
100 | if (ata_id_has_dword_io(adev->id)) { | 100 | if (ata_id_has_dword_io(adev->id)) { |
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index c95c1bf7df37..064a3b505609 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c | |||
@@ -485,7 +485,7 @@ static inline unsigned int adma_intr_pkt(struct ata_host *host) | |||
485 | pp = ap->private_data; | 485 | pp = ap->private_data; |
486 | if (!pp || pp->state != adma_state_pkt) | 486 | if (!pp || pp->state != adma_state_pkt) |
487 | continue; | 487 | continue; |
488 | qc = ata_qc_from_tag(ap, ap->active_tag); | 488 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
489 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { | 489 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
490 | if (status & aPERR) | 490 | if (status & aPERR) |
491 | qc->err_mask |= AC_ERR_HOST_BUS; | 491 | qc->err_mask |= AC_ERR_HOST_BUS; |
@@ -500,7 +500,7 @@ static inline unsigned int adma_intr_pkt(struct ata_host *host) | |||
500 | if (!qc->err_mask) | 500 | if (!qc->err_mask) |
501 | ata_qc_complete(qc); | 501 | ata_qc_complete(qc); |
502 | else { | 502 | else { |
503 | struct ata_eh_info *ehi = &ap->eh_info; | 503 | struct ata_eh_info *ehi = &ap->link.eh_info; |
504 | ata_ehi_clear_desc(ehi); | 504 | ata_ehi_clear_desc(ehi); |
505 | ata_ehi_push_desc(ehi, | 505 | ata_ehi_push_desc(ehi, |
506 | "ADMA-status 0x%02X", status); | 506 | "ADMA-status 0x%02X", status); |
@@ -529,7 +529,7 @@ static inline unsigned int adma_intr_mmio(struct ata_host *host) | |||
529 | struct adma_port_priv *pp = ap->private_data; | 529 | struct adma_port_priv *pp = ap->private_data; |
530 | if (!pp || pp->state != adma_state_mmio) | 530 | if (!pp || pp->state != adma_state_mmio) |
531 | continue; | 531 | continue; |
532 | qc = ata_qc_from_tag(ap, ap->active_tag); | 532 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
533 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { | 533 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
534 | 534 | ||
535 | /* check main status, clearing INTRQ */ | 535 | /* check main status, clearing INTRQ */ |
@@ -545,7 +545,8 @@ static inline unsigned int adma_intr_mmio(struct ata_host *host) | |||
545 | if (!qc->err_mask) | 545 | if (!qc->err_mask) |
546 | ata_qc_complete(qc); | 546 | ata_qc_complete(qc); |
547 | else { | 547 | else { |
548 | struct ata_eh_info *ehi = &ap->eh_info; | 548 | struct ata_eh_info *ehi = |
549 | &ap->link.eh_info; | ||
549 | ata_ehi_clear_desc(ehi); | 550 | ata_ehi_clear_desc(ehi); |
550 | ata_ehi_push_desc(ehi, | 551 | ata_ehi_push_desc(ehi, |
551 | "status 0x%02X", status); | 552 | "status 0x%02X", status); |
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index fdbed8ecdfc2..3c0ef7a2f2fe 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -285,7 +285,7 @@ static void inic_irq_clear(struct ata_port *ap) | |||
285 | static void inic_host_intr(struct ata_port *ap) | 285 | static void inic_host_intr(struct ata_port *ap) |
286 | { | 286 | { |
287 | void __iomem *port_base = inic_port_base(ap); | 287 | void __iomem *port_base = inic_port_base(ap); |
288 | struct ata_eh_info *ehi = &ap->eh_info; | 288 | struct ata_eh_info *ehi = &ap->link.eh_info; |
289 | u8 irq_stat; | 289 | u8 irq_stat; |
290 | 290 | ||
291 | /* fetch and clear irq */ | 291 | /* fetch and clear irq */ |
@@ -293,7 +293,8 @@ static void inic_host_intr(struct ata_port *ap) | |||
293 | writeb(irq_stat, port_base + PORT_IRQ_STAT); | 293 | writeb(irq_stat, port_base + PORT_IRQ_STAT); |
294 | 294 | ||
295 | if (likely(!(irq_stat & PIRQ_ERR))) { | 295 | if (likely(!(irq_stat & PIRQ_ERR))) { |
296 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); | 296 | struct ata_queued_cmd *qc = |
297 | ata_qc_from_tag(ap, ap->link.active_tag); | ||
297 | 298 | ||
298 | if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) { | 299 | if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) { |
299 | ata_chk_status(ap); /* clear ATA interrupt */ | 300 | ata_chk_status(ap); /* clear ATA interrupt */ |
@@ -421,7 +422,7 @@ static int inic_hardreset(struct ata_port *ap, unsigned int *class, | |||
421 | { | 422 | { |
422 | void __iomem *port_base = inic_port_base(ap); | 423 | void __iomem *port_base = inic_port_base(ap); |
423 | void __iomem *idma_ctl = port_base + PORT_IDMA_CTL; | 424 | void __iomem *idma_ctl = port_base + PORT_IDMA_CTL; |
424 | const unsigned long *timing = sata_ehc_deb_timing(&ap->eh_context); | 425 | const unsigned long *timing = sata_ehc_deb_timing(&ap->link.eh_context); |
425 | u16 val; | 426 | u16 val; |
426 | int rc; | 427 | int rc; |
427 | 428 | ||
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index d9832e234e44..246e7c5fdce8 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -1415,7 +1415,7 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
1415 | struct mv_host_priv *hpriv = ap->host->private_data; | 1415 | struct mv_host_priv *hpriv = ap->host->private_data; |
1416 | unsigned int edma_enabled = (pp->pp_flags & MV_PP_FLAG_EDMA_EN); | 1416 | unsigned int edma_enabled = (pp->pp_flags & MV_PP_FLAG_EDMA_EN); |
1417 | unsigned int action = 0, err_mask = 0; | 1417 | unsigned int action = 0, err_mask = 0; |
1418 | struct ata_eh_info *ehi = &ap->eh_info; | 1418 | struct ata_eh_info *ehi = &ap->link.eh_info; |
1419 | 1419 | ||
1420 | ata_ehi_clear_desc(ehi); | 1420 | ata_ehi_clear_desc(ehi); |
1421 | 1421 | ||
@@ -1508,7 +1508,7 @@ static void mv_intr_pio(struct ata_port *ap) | |||
1508 | return; | 1508 | return; |
1509 | 1509 | ||
1510 | /* get active ATA command */ | 1510 | /* get active ATA command */ |
1511 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1511 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1512 | if (unlikely(!qc)) /* no active tag */ | 1512 | if (unlikely(!qc)) /* no active tag */ |
1513 | return; | 1513 | return; |
1514 | if (qc->tf.flags & ATA_TFLAG_POLLING) /* polling; we don't own qc */ | 1514 | if (qc->tf.flags & ATA_TFLAG_POLLING) /* polling; we don't own qc */ |
@@ -1543,7 +1543,7 @@ static void mv_intr_edma(struct ata_port *ap) | |||
1543 | 1543 | ||
1544 | /* 50xx: get active ATA command */ | 1544 | /* 50xx: get active ATA command */ |
1545 | if (IS_GEN_I(hpriv)) | 1545 | if (IS_GEN_I(hpriv)) |
1546 | tag = ap->active_tag; | 1546 | tag = ap->link.active_tag; |
1547 | 1547 | ||
1548 | /* Gen II/IIE: get active ATA command via tag, to enable | 1548 | /* Gen II/IIE: get active ATA command via tag, to enable |
1549 | * support for queueing. this works transparently for | 1549 | * support for queueing. this works transparently for |
@@ -1646,7 +1646,7 @@ static void mv_host_intr(struct ata_host *host, u32 relevant, unsigned int hc) | |||
1646 | if (unlikely(have_err_bits)) { | 1646 | if (unlikely(have_err_bits)) { |
1647 | struct ata_queued_cmd *qc; | 1647 | struct ata_queued_cmd *qc; |
1648 | 1648 | ||
1649 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1649 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1650 | if (qc && (qc->tf.flags & ATA_TFLAG_POLLING)) | 1650 | if (qc && (qc->tf.flags & ATA_TFLAG_POLLING)) |
1651 | continue; | 1651 | continue; |
1652 | 1652 | ||
@@ -1688,14 +1688,14 @@ static void mv_pci_error(struct ata_host *host, void __iomem *mmio) | |||
1688 | for (i = 0; i < host->n_ports; i++) { | 1688 | for (i = 0; i < host->n_ports; i++) { |
1689 | ap = host->ports[i]; | 1689 | ap = host->ports[i]; |
1690 | if (!ata_port_offline(ap)) { | 1690 | if (!ata_port_offline(ap)) { |
1691 | ehi = &ap->eh_info; | 1691 | ehi = &ap->link.eh_info; |
1692 | ata_ehi_clear_desc(ehi); | 1692 | ata_ehi_clear_desc(ehi); |
1693 | if (!printed++) | 1693 | if (!printed++) |
1694 | ata_ehi_push_desc(ehi, | 1694 | ata_ehi_push_desc(ehi, |
1695 | "PCI err cause 0x%08x", err_cause); | 1695 | "PCI err cause 0x%08x", err_cause); |
1696 | err_mask = AC_ERR_HOST_BUS; | 1696 | err_mask = AC_ERR_HOST_BUS; |
1697 | ehi->action = ATA_EH_HARDRESET; | 1697 | ehi->action = ATA_EH_HARDRESET; |
1698 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1698 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1699 | if (qc) | 1699 | if (qc) |
1700 | qc->err_mask |= err_mask; | 1700 | qc->err_mask |= err_mask; |
1701 | else | 1701 | else |
@@ -2269,7 +2269,7 @@ comreset_retry: | |||
2269 | static int mv_prereset(struct ata_port *ap, unsigned long deadline) | 2269 | static int mv_prereset(struct ata_port *ap, unsigned long deadline) |
2270 | { | 2270 | { |
2271 | struct mv_port_priv *pp = ap->private_data; | 2271 | struct mv_port_priv *pp = ap->private_data; |
2272 | struct ata_eh_context *ehc = &ap->eh_context; | 2272 | struct ata_eh_context *ehc = &ap->link.eh_context; |
2273 | int rc; | 2273 | int rc; |
2274 | 2274 | ||
2275 | rc = mv_stop_dma(ap); | 2275 | rc = mv_stop_dma(ap); |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 40dc73139858..df4d50dcffbc 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -594,7 +594,7 @@ static int nv_adma_slave_config(struct scsi_device *sdev) | |||
594 | /* Not a proper libata device, ignore */ | 594 | /* Not a proper libata device, ignore */ |
595 | return rc; | 595 | return rc; |
596 | 596 | ||
597 | if (ap->device[sdev->id].class == ATA_DEV_ATAPI) { | 597 | if (ap->link.device[sdev->id].class == ATA_DEV_ATAPI) { |
598 | /* | 598 | /* |
599 | * NVIDIA reports that ADMA mode does not support ATAPI commands. | 599 | * NVIDIA reports that ADMA mode does not support ATAPI commands. |
600 | * Therefore ATAPI commands are sent through the legacy interface. | 600 | * Therefore ATAPI commands are sent through the legacy interface. |
@@ -711,7 +711,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err) | |||
711 | flags & (NV_CPB_RESP_ATA_ERR | | 711 | flags & (NV_CPB_RESP_ATA_ERR | |
712 | NV_CPB_RESP_CMD_ERR | | 712 | NV_CPB_RESP_CMD_ERR | |
713 | NV_CPB_RESP_CPB_ERR)))) { | 713 | NV_CPB_RESP_CPB_ERR)))) { |
714 | struct ata_eh_info *ehi = &ap->eh_info; | 714 | struct ata_eh_info *ehi = &ap->link.eh_info; |
715 | int freeze = 0; | 715 | int freeze = 0; |
716 | 716 | ||
717 | ata_ehi_clear_desc(ehi); | 717 | ata_ehi_clear_desc(ehi); |
@@ -747,7 +747,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err) | |||
747 | DPRINTK("Completing qc from tag %d\n",cpb_num); | 747 | DPRINTK("Completing qc from tag %d\n",cpb_num); |
748 | ata_qc_complete(qc); | 748 | ata_qc_complete(qc); |
749 | } else { | 749 | } else { |
750 | struct ata_eh_info *ehi = &ap->eh_info; | 750 | struct ata_eh_info *ehi = &ap->link.eh_info; |
751 | /* Notifier bits set without a command may indicate the drive | 751 | /* Notifier bits set without a command may indicate the drive |
752 | is misbehaving. Raise host state machine violation on this | 752 | is misbehaving. Raise host state machine violation on this |
753 | condition. */ | 753 | condition. */ |
@@ -764,7 +764,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err) | |||
764 | 764 | ||
765 | static int nv_host_intr(struct ata_port *ap, u8 irq_stat) | 765 | static int nv_host_intr(struct ata_port *ap, u8 irq_stat) |
766 | { | 766 | { |
767 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); | 767 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag); |
768 | 768 | ||
769 | /* freeze if hotplugged */ | 769 | /* freeze if hotplugged */ |
770 | if (unlikely(irq_stat & (NV_INT_ADDED | NV_INT_REMOVED))) { | 770 | if (unlikely(irq_stat & (NV_INT_ADDED | NV_INT_REMOVED))) { |
@@ -817,7 +817,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
817 | if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) { | 817 | if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) { |
818 | u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804) | 818 | u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804) |
819 | >> (NV_INT_PORT_SHIFT * i); | 819 | >> (NV_INT_PORT_SHIFT * i); |
820 | if(ata_tag_valid(ap->active_tag)) | 820 | if(ata_tag_valid(ap->link.active_tag)) |
821 | /** NV_INT_DEV indication seems unreliable at times | 821 | /** NV_INT_DEV indication seems unreliable at times |
822 | at least in ADMA mode. Force it on always when a | 822 | at least in ADMA mode. Force it on always when a |
823 | command is active, to prevent losing interrupts. */ | 823 | command is active, to prevent losing interrupts. */ |
@@ -852,7 +852,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
852 | NV_ADMA_STAT_HOTUNPLUG | | 852 | NV_ADMA_STAT_HOTUNPLUG | |
853 | NV_ADMA_STAT_TIMEOUT | | 853 | NV_ADMA_STAT_TIMEOUT | |
854 | NV_ADMA_STAT_SERROR))) { | 854 | NV_ADMA_STAT_SERROR))) { |
855 | struct ata_eh_info *ehi = &ap->eh_info; | 855 | struct ata_eh_info *ehi = &ap->link.eh_info; |
856 | 856 | ||
857 | ata_ehi_clear_desc(ehi); | 857 | ata_ehi_clear_desc(ehi); |
858 | __ata_ehi_push_desc(ehi, "ADMA status 0x%08x: ", status ); | 858 | __ata_ehi_push_desc(ehi, "ADMA status 0x%08x: ", status ); |
@@ -879,10 +879,10 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
879 | u32 check_commands; | 879 | u32 check_commands; |
880 | int pos, error = 0; | 880 | int pos, error = 0; |
881 | 881 | ||
882 | if(ata_tag_valid(ap->active_tag)) | 882 | if(ata_tag_valid(ap->link.active_tag)) |
883 | check_commands = 1 << ap->active_tag; | 883 | check_commands = 1 << ap->link.active_tag; |
884 | else | 884 | else |
885 | check_commands = ap->sactive; | 885 | check_commands = ap->link.sactive; |
886 | 886 | ||
887 | /** Check CPBs for completed commands */ | 887 | /** Check CPBs for completed commands */ |
888 | while ((pos = ffs(check_commands)) && !error) { | 888 | while ((pos = ffs(check_commands)) && !error) { |
@@ -1333,7 +1333,7 @@ static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance) | |||
1333 | !(ap->flags & ATA_FLAG_DISABLED)) { | 1333 | !(ap->flags & ATA_FLAG_DISABLED)) { |
1334 | struct ata_queued_cmd *qc; | 1334 | struct ata_queued_cmd *qc; |
1335 | 1335 | ||
1336 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1336 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1337 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) | 1337 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) |
1338 | handled += ata_host_intr(ap, qc); | 1338 | handled += ata_host_intr(ap, qc); |
1339 | else | 1339 | else |
@@ -1485,7 +1485,7 @@ static void nv_adma_error_handler(struct ata_port *ap) | |||
1485 | int i; | 1485 | int i; |
1486 | u16 tmp; | 1486 | u16 tmp; |
1487 | 1487 | ||
1488 | if(ata_tag_valid(ap->active_tag) || ap->sactive) { | 1488 | if(ata_tag_valid(ap->link.active_tag) || ap->link.sactive) { |
1489 | u32 notifier = readl(mmio + NV_ADMA_NOTIFIER); | 1489 | u32 notifier = readl(mmio + NV_ADMA_NOTIFIER); |
1490 | u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR); | 1490 | u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR); |
1491 | u32 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL); | 1491 | u32 gen_ctl = readl(pp->gen_block + NV_ADMA_GEN_CTL); |
@@ -1501,8 +1501,8 @@ static void nv_adma_error_handler(struct ata_port *ap) | |||
1501 | 1501 | ||
1502 | for( i=0;i<NV_ADMA_MAX_CPBS;i++) { | 1502 | for( i=0;i<NV_ADMA_MAX_CPBS;i++) { |
1503 | struct nv_adma_cpb *cpb = &pp->cpb[i]; | 1503 | struct nv_adma_cpb *cpb = &pp->cpb[i]; |
1504 | if( (ata_tag_valid(ap->active_tag) && i == ap->active_tag) || | 1504 | if( (ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) || |
1505 | ap->sactive & (1 << i) ) | 1505 | ap->link.sactive & (1 << i) ) |
1506 | ata_port_printk(ap, KERN_ERR, | 1506 | ata_port_printk(ap, KERN_ERR, |
1507 | "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", | 1507 | "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", |
1508 | i, cpb->ctl_flags, cpb->resp_flags); | 1508 | i, cpb->ctl_flags, cpb->resp_flags); |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 25698cf0dce0..620d0675d18a 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -626,7 +626,7 @@ static void pdc_post_internal_cmd(struct ata_queued_cmd *qc) | |||
626 | static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, | 626 | static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, |
627 | u32 port_status, u32 err_mask) | 627 | u32 port_status, u32 err_mask) |
628 | { | 628 | { |
629 | struct ata_eh_info *ehi = &ap->eh_info; | 629 | struct ata_eh_info *ehi = &ap->link.eh_info; |
630 | unsigned int ac_err_mask = 0; | 630 | unsigned int ac_err_mask = 0; |
631 | 631 | ||
632 | ata_ehi_clear_desc(ehi); | 632 | ata_ehi_clear_desc(ehi); |
@@ -773,7 +773,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance) | |||
773 | tmp = hotplug_status & (0x11 << ata_no); | 773 | tmp = hotplug_status & (0x11 << ata_no); |
774 | if (tmp && ap && | 774 | if (tmp && ap && |
775 | !(ap->flags & ATA_FLAG_DISABLED)) { | 775 | !(ap->flags & ATA_FLAG_DISABLED)) { |
776 | struct ata_eh_info *ehi = &ap->eh_info; | 776 | struct ata_eh_info *ehi = &ap->link.eh_info; |
777 | ata_ehi_clear_desc(ehi); | 777 | ata_ehi_clear_desc(ehi); |
778 | ata_ehi_hotplugged(ehi); | 778 | ata_ehi_hotplugged(ehi); |
779 | ata_ehi_push_desc(ehi, "hotplug_status %#x", tmp); | 779 | ata_ehi_push_desc(ehi, "hotplug_status %#x", tmp); |
@@ -788,7 +788,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance) | |||
788 | !(ap->flags & ATA_FLAG_DISABLED)) { | 788 | !(ap->flags & ATA_FLAG_DISABLED)) { |
789 | struct ata_queued_cmd *qc; | 789 | struct ata_queued_cmd *qc; |
790 | 790 | ||
791 | qc = ata_qc_from_tag(ap, ap->active_tag); | 791 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
792 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) | 792 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) |
793 | handled += pdc_host_intr(ap, qc); | 793 | handled += pdc_host_intr(ap, qc); |
794 | } | 794 | } |
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index 5e1dfdda698f..ef1ad69c26ed 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c | |||
@@ -404,7 +404,7 @@ static inline unsigned int qs_intr_pkt(struct ata_host *host) | |||
404 | struct qs_port_priv *pp = ap->private_data; | 404 | struct qs_port_priv *pp = ap->private_data; |
405 | if (!pp || pp->state != qs_state_pkt) | 405 | if (!pp || pp->state != qs_state_pkt) |
406 | continue; | 406 | continue; |
407 | qc = ata_qc_from_tag(ap, ap->active_tag); | 407 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
408 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { | 408 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
409 | switch (sHST) { | 409 | switch (sHST) { |
410 | case 0: /* successful CPB */ | 410 | case 0: /* successful CPB */ |
@@ -437,7 +437,7 @@ static inline unsigned int qs_intr_mmio(struct ata_host *host) | |||
437 | struct qs_port_priv *pp = ap->private_data; | 437 | struct qs_port_priv *pp = ap->private_data; |
438 | if (!pp || pp->state != qs_state_mmio) | 438 | if (!pp || pp->state != qs_state_mmio) |
439 | continue; | 439 | continue; |
440 | qc = ata_qc_from_tag(ap, ap->active_tag); | 440 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
441 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { | 441 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
442 | 442 | ||
443 | /* check main status, clearing INTRQ */ | 443 | /* check main status, clearing INTRQ */ |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 8c72e714b456..2ddbe4cc71e4 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -312,7 +312,7 @@ static int sil_set_mode (struct ata_port *ap, struct ata_device **r_failed) | |||
312 | return rc; | 312 | return rc; |
313 | 313 | ||
314 | for (i = 0; i < 2; i++) { | 314 | for (i = 0; i < 2; i++) { |
315 | dev = &ap->device[i]; | 315 | dev = &ap->link.device[i]; |
316 | if (!ata_dev_enabled(dev)) | 316 | if (!ata_dev_enabled(dev)) |
317 | dev_mode[i] = 0; /* PIO0/1/2 */ | 317 | dev_mode[i] = 0; /* PIO0/1/2 */ |
318 | else if (dev->flags & ATA_DFLAG_PIO) | 318 | else if (dev->flags & ATA_DFLAG_PIO) |
@@ -374,8 +374,8 @@ static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
374 | 374 | ||
375 | static void sil_host_intr(struct ata_port *ap, u32 bmdma2) | 375 | static void sil_host_intr(struct ata_port *ap, u32 bmdma2) |
376 | { | 376 | { |
377 | struct ata_eh_info *ehi = &ap->eh_info; | 377 | struct ata_eh_info *ehi = &ap->link.eh_info; |
378 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); | 378 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag); |
379 | u8 status; | 379 | u8 status; |
380 | 380 | ||
381 | if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) { | 381 | if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) { |
@@ -394,8 +394,8 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) | |||
394 | * repeat probing needlessly. | 394 | * repeat probing needlessly. |
395 | */ | 395 | */ |
396 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { | 396 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { |
397 | ata_ehi_hotplugged(&ap->eh_info); | 397 | ata_ehi_hotplugged(&ap->link.eh_info); |
398 | ap->eh_info.serror |= serror; | 398 | ap->link.eh_info.serror |= serror; |
399 | } | 399 | } |
400 | 400 | ||
401 | goto freeze; | 401 | goto freeze; |
@@ -562,8 +562,8 @@ static void sil_thaw(struct ata_port *ap) | |||
562 | */ | 562 | */ |
563 | static void sil_dev_config(struct ata_device *dev) | 563 | static void sil_dev_config(struct ata_device *dev) |
564 | { | 564 | { |
565 | struct ata_port *ap = dev->ap; | 565 | struct ata_port *ap = dev->link->ap; |
566 | int print_info = ap->eh_context.i.flags & ATA_EHI_PRINTINFO; | 566 | int print_info = ap->link.eh_context.i.flags & ATA_EHI_PRINTINFO; |
567 | unsigned int n, quirks = 0; | 567 | unsigned int n, quirks = 0; |
568 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; | 568 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; |
569 | 569 | ||
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 233e88693395..2d8334e7921d 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -456,7 +456,7 @@ static int sil24_tag(int tag) | |||
456 | 456 | ||
457 | static void sil24_dev_config(struct ata_device *dev) | 457 | static void sil24_dev_config(struct ata_device *dev) |
458 | { | 458 | { |
459 | void __iomem *port = dev->ap->ioaddr.cmd_addr; | 459 | void __iomem *port = dev->link->ap->ioaddr.cmd_addr; |
460 | 460 | ||
461 | if (dev->cdb_len == 16) | 461 | if (dev->cdb_len == 16) |
462 | writel(PORT_CS_CDB16, port + PORT_CTRL_STAT); | 462 | writel(PORT_CS_CDB16, port + PORT_CTRL_STAT); |
@@ -609,7 +609,7 @@ static int sil24_do_softreset(struct ata_port *ap, unsigned int *class, | |||
609 | if (time_after(deadline, jiffies)) | 609 | if (time_after(deadline, jiffies)) |
610 | timeout_msec = jiffies_to_msecs(deadline - jiffies); | 610 | timeout_msec = jiffies_to_msecs(deadline - jiffies); |
611 | 611 | ||
612 | ata_tf_init(ap->device, &tf); /* doesn't really matter */ | 612 | ata_tf_init(ap->link.device, &tf); /* doesn't really matter */ |
613 | rc = sil24_exec_polled_cmd(ap, pmp, &tf, 0, PRB_CTRL_SRST, | 613 | rc = sil24_exec_polled_cmd(ap, pmp, &tf, 0, PRB_CTRL_SRST, |
614 | timeout_msec); | 614 | timeout_msec); |
615 | if (rc == -EBUSY) { | 615 | if (rc == -EBUSY) { |
@@ -804,7 +804,7 @@ static void sil24_error_intr(struct ata_port *ap) | |||
804 | { | 804 | { |
805 | void __iomem *port = ap->ioaddr.cmd_addr; | 805 | void __iomem *port = ap->ioaddr.cmd_addr; |
806 | struct sil24_port_priv *pp = ap->private_data; | 806 | struct sil24_port_priv *pp = ap->private_data; |
807 | struct ata_eh_info *ehi = &ap->eh_info; | 807 | struct ata_eh_info *ehi = &ap->link.eh_info; |
808 | int freeze = 0; | 808 | int freeze = 0; |
809 | u32 irq_stat; | 809 | u32 irq_stat; |
810 | 810 | ||
@@ -856,7 +856,7 @@ static void sil24_error_intr(struct ata_port *ap) | |||
856 | } | 856 | } |
857 | 857 | ||
858 | /* record error info */ | 858 | /* record error info */ |
859 | qc = ata_qc_from_tag(ap, ap->active_tag); | 859 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
860 | if (qc) { | 860 | if (qc) { |
861 | sil24_read_tf(ap, qc->tag, &pp->tf); | 861 | sil24_read_tf(ap, qc->tag, &pp->tf); |
862 | qc->err_mask |= err_mask; | 862 | qc->err_mask |= err_mask; |
@@ -910,7 +910,7 @@ static inline void sil24_host_intr(struct ata_port *ap) | |||
910 | if (rc > 0) | 910 | if (rc > 0) |
911 | return; | 911 | return; |
912 | if (rc < 0) { | 912 | if (rc < 0) { |
913 | struct ata_eh_info *ehi = &ap->eh_info; | 913 | struct ata_eh_info *ehi = &ap->link.eh_info; |
914 | ehi->err_mask |= AC_ERR_HSM; | 914 | ehi->err_mask |= AC_ERR_HSM; |
915 | ehi->action |= ATA_EH_SOFTRESET; | 915 | ehi->action |= ATA_EH_SOFTRESET; |
916 | ata_port_freeze(ap); | 916 | ata_port_freeze(ap); |
@@ -921,7 +921,7 @@ static inline void sil24_host_intr(struct ata_port *ap) | |||
921 | if (!(ap->flags & SIL24_FLAG_PCIX_IRQ_WOC) && ata_ratelimit()) | 921 | if (!(ap->flags & SIL24_FLAG_PCIX_IRQ_WOC) && ata_ratelimit()) |
922 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " | 922 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " |
923 | "(slot_stat 0x%x active_tag %d sactive 0x%x)\n", | 923 | "(slot_stat 0x%x active_tag %d sactive 0x%x)\n", |
924 | slot_stat, ap->active_tag, ap->sactive); | 924 | slot_stat, ap->link.active_tag, ap->link.sactive); |
925 | } | 925 | } |
926 | 926 | ||
927 | static irqreturn_t sil24_interrupt(int irq, void *dev_instance) | 927 | static irqreturn_t sil24_interrupt(int irq, void *dev_instance) |
@@ -963,7 +963,7 @@ static irqreturn_t sil24_interrupt(int irq, void *dev_instance) | |||
963 | 963 | ||
964 | static void sil24_error_handler(struct ata_port *ap) | 964 | static void sil24_error_handler(struct ata_port *ap) |
965 | { | 965 | { |
966 | struct ata_eh_context *ehc = &ap->eh_context; | 966 | struct ata_eh_context *ehc = &ap->link.eh_context; |
967 | 967 | ||
968 | if (sil24_init_port(ap)) { | 968 | if (sil24_init_port(ap)) { |
969 | ata_eh_freeze_port(ap); | 969 | ata_eh_freeze_port(ap); |
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index 97aefdd87be4..12691f091933 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -854,7 +854,7 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance) | |||
854 | !(ap->flags & ATA_FLAG_DISABLED)) { | 854 | !(ap->flags & ATA_FLAG_DISABLED)) { |
855 | struct ata_queued_cmd *qc; | 855 | struct ata_queued_cmd *qc; |
856 | 856 | ||
857 | qc = ata_qc_from_tag(ap, ap->active_tag); | 857 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
858 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) | 858 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) |
859 | handled += pdc20621_host_intr(ap, qc, (i > 4), | 859 | handled += pdc20621_host_intr(ap, qc, (i > 4), |
860 | mmio_base); | 860 | mmio_base); |
@@ -881,7 +881,7 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
881 | 881 | ||
882 | spin_lock_irqsave(&host->lock, flags); | 882 | spin_lock_irqsave(&host->lock, flags); |
883 | 883 | ||
884 | qc = ata_qc_from_tag(ap, ap->active_tag); | 884 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
885 | 885 | ||
886 | switch (qc->tf.protocol) { | 886 | switch (qc->tf.protocol) { |
887 | case ATA_PROT_DMA: | 887 | case ATA_PROT_DMA: |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 57fd30de8f0d..78a6833af713 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -296,7 +296,7 @@ static void svia_noop_freeze(struct ata_port *ap) | |||
296 | */ | 296 | */ |
297 | static int vt6420_prereset(struct ata_port *ap, unsigned long deadline) | 297 | static int vt6420_prereset(struct ata_port *ap, unsigned long deadline) |
298 | { | 298 | { |
299 | struct ata_eh_context *ehc = &ap->eh_context; | 299 | struct ata_eh_context *ehc = &ap->link.eh_context; |
300 | unsigned long timeout = jiffies + (HZ * 5); | 300 | unsigned long timeout = jiffies + (HZ * 5); |
301 | u32 sstatus, scontrol; | 301 | u32 sstatus, scontrol; |
302 | int online; | 302 | int online; |
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c index 1920915dfa2c..9586b8b51cea 100644 --- a/drivers/ata/sata_vsc.c +++ b/drivers/ata/sata_vsc.c | |||
@@ -240,7 +240,7 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap) | |||
240 | return; | 240 | return; |
241 | } | 241 | } |
242 | 242 | ||
243 | qc = ata_qc_from_tag(ap, ap->active_tag); | 243 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
244 | if (qc && likely(!(qc->tf.flags & ATA_TFLAG_POLLING))) | 244 | if (qc && likely(!(qc->tf.flags & ATA_TFLAG_POLLING))) |
245 | handled = ata_host_intr(ap, qc); | 245 | handled = ata_host_intr(ap, qc); |
246 | 246 | ||
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index f142eafb6fc7..affd77aafb23 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -4988,14 +4988,14 @@ static void ipr_ata_phy_reset(struct ata_port *ap) | |||
4988 | switch(res->cfgte.proto) { | 4988 | switch(res->cfgte.proto) { |
4989 | case IPR_PROTO_SATA: | 4989 | case IPR_PROTO_SATA: |
4990 | case IPR_PROTO_SAS_STP: | 4990 | case IPR_PROTO_SAS_STP: |
4991 | ap->device[0].class = ATA_DEV_ATA; | 4991 | ap->link.device[0].class = ATA_DEV_ATA; |
4992 | break; | 4992 | break; |
4993 | case IPR_PROTO_SATA_ATAPI: | 4993 | case IPR_PROTO_SATA_ATAPI: |
4994 | case IPR_PROTO_SAS_STP_ATAPI: | 4994 | case IPR_PROTO_SAS_STP_ATAPI: |
4995 | ap->device[0].class = ATA_DEV_ATAPI; | 4995 | ap->link.device[0].class = ATA_DEV_ATAPI; |
4996 | break; | 4996 | break; |
4997 | default: | 4997 | default: |
4998 | ap->device[0].class = ATA_DEV_UNKNOWN; | 4998 | ap->link.device[0].class = ATA_DEV_UNKNOWN; |
4999 | ap->ops->port_disable(ap); | 4999 | ap->ops->port_disable(ap); |
5000 | break; | 5000 | break; |
5001 | }; | 5001 | }; |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 5e573efcf0a7..1d6503d85f02 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -249,17 +249,17 @@ static void sas_ata_phy_reset(struct ata_port *ap) | |||
249 | switch (dev->sata_dev.command_set) { | 249 | switch (dev->sata_dev.command_set) { |
250 | case ATA_COMMAND_SET: | 250 | case ATA_COMMAND_SET: |
251 | SAS_DPRINTK("%s: Found ATA device.\n", __FUNCTION__); | 251 | SAS_DPRINTK("%s: Found ATA device.\n", __FUNCTION__); |
252 | ap->device[0].class = ATA_DEV_ATA; | 252 | ap->link.device[0].class = ATA_DEV_ATA; |
253 | break; | 253 | break; |
254 | case ATAPI_COMMAND_SET: | 254 | case ATAPI_COMMAND_SET: |
255 | SAS_DPRINTK("%s: Found ATAPI device.\n", __FUNCTION__); | 255 | SAS_DPRINTK("%s: Found ATAPI device.\n", __FUNCTION__); |
256 | ap->device[0].class = ATA_DEV_ATAPI; | 256 | ap->link.device[0].class = ATA_DEV_ATAPI; |
257 | break; | 257 | break; |
258 | default: | 258 | default: |
259 | SAS_DPRINTK("%s: Unknown SATA command set: %d.\n", | 259 | SAS_DPRINTK("%s: Unknown SATA command set: %d.\n", |
260 | __FUNCTION__, | 260 | __FUNCTION__, |
261 | dev->sata_dev.command_set); | 261 | dev->sata_dev.command_set); |
262 | ap->device[0].class = ATA_DEV_UNKNOWN; | 262 | ap->link.device[0].class = ATA_DEV_UNKNOWN; |
263 | break; | 263 | break; |
264 | } | 264 | } |
265 | 265 | ||
@@ -317,7 +317,7 @@ static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in, | |||
317 | dev->sata_dev.serror = val; | 317 | dev->sata_dev.serror = val; |
318 | break; | 318 | break; |
319 | case SCR_ACTIVE: | 319 | case SCR_ACTIVE: |
320 | dev->sata_dev.ap->sactive = val; | 320 | dev->sata_dev.ap->link.sactive = val; |
321 | break; | 321 | break; |
322 | default: | 322 | default: |
323 | return -EINVAL; | 323 | return -EINVAL; |
@@ -342,7 +342,7 @@ static int sas_ata_scr_read(struct ata_port *ap, unsigned int sc_reg_in, | |||
342 | *val = dev->sata_dev.serror; | 342 | *val = dev->sata_dev.serror; |
343 | return 0; | 343 | return 0; |
344 | case SCR_ACTIVE: | 344 | case SCR_ACTIVE: |
345 | *val = dev->sata_dev.ap->sactive; | 345 | *val = dev->sata_dev.ap->link.sactive; |
346 | return 0; | 346 | return 0; |
347 | default: | 347 | default: |
348 | return -EINVAL; | 348 | return -EINVAL; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index a67bb9075e9b..ca4493125fa0 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -436,7 +436,7 @@ struct ata_ering { | |||
436 | }; | 436 | }; |
437 | 437 | ||
438 | struct ata_device { | 438 | struct ata_device { |
439 | struct ata_port *ap; | 439 | struct ata_link *link; |
440 | unsigned int devno; /* 0 or 1 */ | 440 | unsigned int devno; /* 0 or 1 */ |
441 | unsigned long flags; /* ATA_DFLAG_xxx */ | 441 | unsigned long flags; /* ATA_DFLAG_xxx */ |
442 | unsigned int horkage; /* List of broken features */ | 442 | unsigned int horkage; /* List of broken features */ |
@@ -510,6 +510,24 @@ struct ata_acpi_gtm { | |||
510 | u32 flags; | 510 | u32 flags; |
511 | } __packed; | 511 | } __packed; |
512 | 512 | ||
513 | struct ata_link { | ||
514 | struct ata_port *ap; | ||
515 | |||
516 | unsigned int active_tag; /* active tag on this link */ | ||
517 | u32 sactive; /* active NCQ commands */ | ||
518 | |||
519 | unsigned int hw_sata_spd_limit; | ||
520 | unsigned int sata_spd_limit; | ||
521 | unsigned int sata_spd; /* current SATA PHY speed */ | ||
522 | |||
523 | /* record runtime error info, protected by host_set lock */ | ||
524 | struct ata_eh_info eh_info; | ||
525 | /* EH context */ | ||
526 | struct ata_eh_context eh_context; | ||
527 | |||
528 | struct ata_device device[ATA_MAX_DEVICES]; | ||
529 | }; | ||
530 | |||
513 | struct ata_port { | 531 | struct ata_port { |
514 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ | 532 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ |
515 | const struct ata_port_operations *ops; | 533 | const struct ata_port_operations *ops; |
@@ -533,23 +551,12 @@ struct ata_port { | |||
533 | unsigned int mwdma_mask; | 551 | unsigned int mwdma_mask; |
534 | unsigned int udma_mask; | 552 | unsigned int udma_mask; |
535 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ | 553 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ |
536 | unsigned int hw_sata_spd_limit; | ||
537 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ | ||
538 | unsigned int sata_spd; /* current SATA PHY speed */ | ||
539 | |||
540 | /* record runtime error info, protected by host lock */ | ||
541 | struct ata_eh_info eh_info; | ||
542 | /* EH context owned by EH */ | ||
543 | struct ata_eh_context eh_context; | ||
544 | |||
545 | struct ata_device device[ATA_MAX_DEVICES]; | ||
546 | 554 | ||
547 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; | 555 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; |
548 | unsigned long qc_allocated; | 556 | unsigned long qc_allocated; |
549 | unsigned int qc_active; | 557 | unsigned int qc_active; |
550 | 558 | ||
551 | unsigned int active_tag; | 559 | struct ata_link link; /* host default link */ |
552 | u32 sactive; | ||
553 | 560 | ||
554 | struct ata_port_stats stats; | 561 | struct ata_port_stats stats; |
555 | struct ata_host *host; | 562 | struct ata_host *host; |
@@ -912,8 +919,11 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
912 | #define ata_port_printk(ap, lv, fmt, args...) \ | 919 | #define ata_port_printk(ap, lv, fmt, args...) \ |
913 | printk(lv"ata%u: "fmt, (ap)->print_id , ##args) | 920 | printk(lv"ata%u: "fmt, (ap)->print_id , ##args) |
914 | 921 | ||
922 | #define ata_link_printk(link, lv, fmt, args...) \ | ||
923 | printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args) | ||
924 | |||
915 | #define ata_dev_printk(dev, lv, fmt, args...) \ | 925 | #define ata_dev_printk(dev, lv, fmt, args...) \ |
916 | printk(lv"ata%u.%02u: "fmt, (dev)->ap->print_id, (dev)->devno , ##args) | 926 | printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, (dev)->devno , ##args) |
917 | 927 | ||
918 | /* | 928 | /* |
919 | * ata_eh_info helpers | 929 | * ata_eh_info helpers |
@@ -1149,7 +1159,7 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf) | |||
1149 | { | 1159 | { |
1150 | memset(tf, 0, sizeof(*tf)); | 1160 | memset(tf, 0, sizeof(*tf)); |
1151 | 1161 | ||
1152 | tf->ctl = dev->ap->ctl; | 1162 | tf->ctl = dev->link->ap->ctl; |
1153 | if (dev->devno == 0) | 1163 | if (dev->devno == 0) |
1154 | tf->device = ATA_DEVICE_OBS; | 1164 | tf->device = ATA_DEVICE_OBS; |
1155 | else | 1165 | else |