diff options
-rw-r--r-- | drivers/ata/libata-core.c | 202 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 142 | ||||
-rw-r--r-- | drivers/ata/libata.h | 3 | ||||
-rw-r--r-- | include/linux/libata.h | 8 |
4 files changed, 303 insertions, 52 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 71024e94c576..6eed58e35e12 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -179,13 +179,20 @@ struct ata_link *__ata_port_next_link(struct ata_port *ap, | |||
179 | return &ap->link; | 179 | return &ap->link; |
180 | } | 180 | } |
181 | 181 | ||
182 | /* we just iterated over the host link, what's next? */ | 182 | /* we just iterated over the host master link, what's next? */ |
183 | if (ata_is_host_link(link)) { | 183 | if (link == &ap->link) { |
184 | if (!sata_pmp_attached(ap)) | 184 | if (!sata_pmp_attached(ap)) { |
185 | if (unlikely(ap->slave_link) && !dev_only) | ||
186 | return ap->slave_link; | ||
185 | return NULL; | 187 | return NULL; |
188 | } | ||
186 | return ap->pmp_link; | 189 | return ap->pmp_link; |
187 | } | 190 | } |
188 | 191 | ||
192 | /* slave_link excludes PMP */ | ||
193 | if (unlikely(link == ap->slave_link)) | ||
194 | return NULL; | ||
195 | |||
189 | /* iterate to the next PMP link */ | 196 | /* iterate to the next PMP link */ |
190 | if (++link < ap->pmp_link + ap->nr_pmp_links) | 197 | if (++link < ap->pmp_link + ap->nr_pmp_links) |
191 | return link; | 198 | return link; |
@@ -193,6 +200,31 @@ struct ata_link *__ata_port_next_link(struct ata_port *ap, | |||
193 | } | 200 | } |
194 | 201 | ||
195 | /** | 202 | /** |
203 | * ata_dev_phys_link - find physical link for a device | ||
204 | * @dev: ATA device to look up physical link for | ||
205 | * | ||
206 | * Look up physical link which @dev is attached to. Note that | ||
207 | * this is different from @dev->link only when @dev is on slave | ||
208 | * link. For all other cases, it's the same as @dev->link. | ||
209 | * | ||
210 | * LOCKING: | ||
211 | * Don't care. | ||
212 | * | ||
213 | * RETURNS: | ||
214 | * Pointer to the found physical link. | ||
215 | */ | ||
216 | struct ata_link *ata_dev_phys_link(struct ata_device *dev) | ||
217 | { | ||
218 | struct ata_port *ap = dev->link->ap; | ||
219 | |||
220 | if (!ap->slave_link) | ||
221 | return dev->link; | ||
222 | if (!dev->devno) | ||
223 | return &ap->link; | ||
224 | return ap->slave_link; | ||
225 | } | ||
226 | |||
227 | /** | ||
196 | * ata_force_cbl - force cable type according to libata.force | 228 | * ata_force_cbl - force cable type according to libata.force |
197 | * @ap: ATA port of interest | 229 | * @ap: ATA port of interest |
198 | * | 230 | * |
@@ -235,7 +267,8 @@ void ata_force_cbl(struct ata_port *ap) | |||
235 | * the host link and all fan-out ports connected via PMP. If the | 267 | * the host link and all fan-out ports connected via PMP. If the |
236 | * device part is specified as 0 (e.g. 1.00:), it specifies the | 268 | * device part is specified as 0 (e.g. 1.00:), it specifies the |
237 | * first fan-out link not the host link. Device number 15 always | 269 | * first fan-out link not the host link. Device number 15 always |
238 | * points to the host link whether PMP is attached or not. | 270 | * points to the host link whether PMP is attached or not. If the |
271 | * controller has slave link, device number 16 points to it. | ||
239 | * | 272 | * |
240 | * LOCKING: | 273 | * LOCKING: |
241 | * EH context. | 274 | * EH context. |
@@ -243,12 +276,11 @@ void ata_force_cbl(struct ata_port *ap) | |||
243 | static void ata_force_link_limits(struct ata_link *link) | 276 | static void ata_force_link_limits(struct ata_link *link) |
244 | { | 277 | { |
245 | bool did_spd = false; | 278 | bool did_spd = false; |
246 | int linkno, i; | 279 | int linkno = link->pmp; |
280 | int i; | ||
247 | 281 | ||
248 | if (ata_is_host_link(link)) | 282 | if (ata_is_host_link(link)) |
249 | linkno = 15; | 283 | linkno += 15; |
250 | else | ||
251 | linkno = link->pmp; | ||
252 | 284 | ||
253 | for (i = ata_force_tbl_size - 1; i >= 0; i--) { | 285 | for (i = ata_force_tbl_size - 1; i >= 0; i--) { |
254 | const struct ata_force_ent *fe = &ata_force_tbl[i]; | 286 | const struct ata_force_ent *fe = &ata_force_tbl[i]; |
@@ -295,9 +327,9 @@ static void ata_force_xfermask(struct ata_device *dev) | |||
295 | int alt_devno = devno; | 327 | int alt_devno = devno; |
296 | int i; | 328 | int i; |
297 | 329 | ||
298 | /* allow n.15 for the first device attached to host port */ | 330 | /* allow n.15/16 for devices attached to host port */ |
299 | if (ata_is_host_link(dev->link) && devno == 0) | 331 | if (ata_is_host_link(dev->link)) |
300 | alt_devno = 15; | 332 | alt_devno += 15; |
301 | 333 | ||
302 | for (i = ata_force_tbl_size - 1; i >= 0; i--) { | 334 | for (i = ata_force_tbl_size - 1; i >= 0; i--) { |
303 | const struct ata_force_ent *fe = &ata_force_tbl[i]; | 335 | const struct ata_force_ent *fe = &ata_force_tbl[i]; |
@@ -349,9 +381,9 @@ static void ata_force_horkage(struct ata_device *dev) | |||
349 | int alt_devno = devno; | 381 | int alt_devno = devno; |
350 | int i; | 382 | int i; |
351 | 383 | ||
352 | /* allow n.15 for the first device attached to host port */ | 384 | /* allow n.15/16 for devices attached to host port */ |
353 | if (ata_is_host_link(dev->link) && devno == 0) | 385 | if (ata_is_host_link(dev->link)) |
354 | alt_devno = 15; | 386 | alt_devno += 15; |
355 | 387 | ||
356 | for (i = 0; i < ata_force_tbl_size; i++) { | 388 | for (i = 0; i < ata_force_tbl_size; i++) { |
357 | const struct ata_force_ent *fe = &ata_force_tbl[i]; | 389 | const struct ata_force_ent *fe = &ata_force_tbl[i]; |
@@ -2710,7 +2742,7 @@ static void sata_print_link_status(struct ata_link *link) | |||
2710 | return; | 2742 | return; |
2711 | sata_scr_read(link, SCR_CONTROL, &scontrol); | 2743 | sata_scr_read(link, SCR_CONTROL, &scontrol); |
2712 | 2744 | ||
2713 | if (ata_link_online(link)) { | 2745 | if (ata_phys_link_online(link)) { |
2714 | tmp = (sstatus >> 4) & 0xf; | 2746 | tmp = (sstatus >> 4) & 0xf; |
2715 | ata_link_printk(link, KERN_INFO, | 2747 | ata_link_printk(link, KERN_INFO, |
2716 | "SATA link up %s (SStatus %X SControl %X)\n", | 2748 | "SATA link up %s (SStatus %X SControl %X)\n", |
@@ -3401,6 +3433,12 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline, | |||
3401 | unsigned long nodev_deadline = ata_deadline(start, ATA_TMOUT_FF_WAIT); | 3433 | unsigned long nodev_deadline = ata_deadline(start, ATA_TMOUT_FF_WAIT); |
3402 | int warned = 0; | 3434 | int warned = 0; |
3403 | 3435 | ||
3436 | /* Slave readiness can't be tested separately from master. On | ||
3437 | * M/S emulation configuration, this function should be called | ||
3438 | * only on the master and it will handle both master and slave. | ||
3439 | */ | ||
3440 | WARN_ON(link == link->ap->slave_link); | ||
3441 | |||
3404 | if (time_after(nodev_deadline, deadline)) | 3442 | if (time_after(nodev_deadline, deadline)) |
3405 | nodev_deadline = deadline; | 3443 | nodev_deadline = deadline; |
3406 | 3444 | ||
@@ -3622,7 +3660,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline) | |||
3622 | } | 3660 | } |
3623 | 3661 | ||
3624 | /* no point in trying softreset on offline link */ | 3662 | /* no point in trying softreset on offline link */ |
3625 | if (ata_link_offline(link)) | 3663 | if (ata_phys_link_offline(link)) |
3626 | ehc->i.action &= ~ATA_EH_SOFTRESET; | 3664 | ehc->i.action &= ~ATA_EH_SOFTRESET; |
3627 | 3665 | ||
3628 | return 0; | 3666 | return 0; |
@@ -3700,7 +3738,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, | |||
3700 | if (rc) | 3738 | if (rc) |
3701 | goto out; | 3739 | goto out; |
3702 | /* if link is offline nothing more to do */ | 3740 | /* if link is offline nothing more to do */ |
3703 | if (ata_link_offline(link)) | 3741 | if (ata_phys_link_offline(link)) |
3704 | goto out; | 3742 | goto out; |
3705 | 3743 | ||
3706 | /* Link is online. From this point, -ENODEV too is an error. */ | 3744 | /* Link is online. From this point, -ENODEV too is an error. */ |
@@ -4965,7 +5003,7 @@ int sata_scr_write_flush(struct ata_link *link, int reg, u32 val) | |||
4965 | } | 5003 | } |
4966 | 5004 | ||
4967 | /** | 5005 | /** |
4968 | * ata_link_online - test whether the given link is online | 5006 | * ata_phys_link_online - test whether the given link is online |
4969 | * @link: ATA link to test | 5007 | * @link: ATA link to test |
4970 | * | 5008 | * |
4971 | * Test whether @link is online. Note that this function returns | 5009 | * Test whether @link is online. Note that this function returns |
@@ -4978,7 +5016,7 @@ int sata_scr_write_flush(struct ata_link *link, int reg, u32 val) | |||
4978 | * RETURNS: | 5016 | * RETURNS: |
4979 | * True if the port online status is available and online. | 5017 | * True if the port online status is available and online. |
4980 | */ | 5018 | */ |
4981 | bool ata_link_online(struct ata_link *link) | 5019 | bool ata_phys_link_online(struct ata_link *link) |
4982 | { | 5020 | { |
4983 | u32 sstatus; | 5021 | u32 sstatus; |
4984 | 5022 | ||
@@ -4989,7 +5027,7 @@ bool ata_link_online(struct ata_link *link) | |||
4989 | } | 5027 | } |
4990 | 5028 | ||
4991 | /** | 5029 | /** |
4992 | * ata_link_offline - test whether the given link is offline | 5030 | * ata_phys_link_offline - test whether the given link is offline |
4993 | * @link: ATA link to test | 5031 | * @link: ATA link to test |
4994 | * | 5032 | * |
4995 | * Test whether @link is offline. Note that this function | 5033 | * Test whether @link is offline. Note that this function |
@@ -5002,7 +5040,7 @@ bool ata_link_online(struct ata_link *link) | |||
5002 | * RETURNS: | 5040 | * RETURNS: |
5003 | * True if the port offline status is available and offline. | 5041 | * True if the port offline status is available and offline. |
5004 | */ | 5042 | */ |
5005 | bool ata_link_offline(struct ata_link *link) | 5043 | bool ata_phys_link_offline(struct ata_link *link) |
5006 | { | 5044 | { |
5007 | u32 sstatus; | 5045 | u32 sstatus; |
5008 | 5046 | ||
@@ -5012,6 +5050,58 @@ bool ata_link_offline(struct ata_link *link) | |||
5012 | return false; | 5050 | return false; |
5013 | } | 5051 | } |
5014 | 5052 | ||
5053 | /** | ||
5054 | * ata_link_online - test whether the given link is online | ||
5055 | * @link: ATA link to test | ||
5056 | * | ||
5057 | * Test whether @link is online. This is identical to | ||
5058 | * ata_phys_link_online() when there's no slave link. When | ||
5059 | * there's a slave link, this function should only be called on | ||
5060 | * the master link and will return true if any of M/S links is | ||
5061 | * online. | ||
5062 | * | ||
5063 | * LOCKING: | ||
5064 | * None. | ||
5065 | * | ||
5066 | * RETURNS: | ||
5067 | * True if the port online status is available and online. | ||
5068 | */ | ||
5069 | bool ata_link_online(struct ata_link *link) | ||
5070 | { | ||
5071 | struct ata_link *slave = link->ap->slave_link; | ||
5072 | |||
5073 | WARN_ON(link == slave); /* shouldn't be called on slave link */ | ||
5074 | |||
5075 | return ata_phys_link_online(link) || | ||
5076 | (slave && ata_phys_link_online(slave)); | ||
5077 | } | ||
5078 | |||
5079 | /** | ||
5080 | * ata_link_offline - test whether the given link is offline | ||
5081 | * @link: ATA link to test | ||
5082 | * | ||
5083 | * Test whether @link is offline. This is identical to | ||
5084 | * ata_phys_link_offline() when there's no slave link. When | ||
5085 | * there's a slave link, this function should only be called on | ||
5086 | * the master link and will return true if both M/S links are | ||
5087 | * offline. | ||
5088 | * | ||
5089 | * LOCKING: | ||
5090 | * None. | ||
5091 | * | ||
5092 | * RETURNS: | ||
5093 | * True if the port offline status is available and offline. | ||
5094 | */ | ||
5095 | bool ata_link_offline(struct ata_link *link) | ||
5096 | { | ||
5097 | struct ata_link *slave = link->ap->slave_link; | ||
5098 | |||
5099 | WARN_ON(link == slave); /* shouldn't be called on slave link */ | ||
5100 | |||
5101 | return ata_phys_link_offline(link) && | ||
5102 | (!slave || ata_phys_link_offline(slave)); | ||
5103 | } | ||
5104 | |||
5015 | #ifdef CONFIG_PM | 5105 | #ifdef CONFIG_PM |
5016 | static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, | 5106 | static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, |
5017 | unsigned int action, unsigned int ehi_flags, | 5107 | unsigned int action, unsigned int ehi_flags, |
@@ -5151,11 +5241,11 @@ int ata_port_start(struct ata_port *ap) | |||
5151 | */ | 5241 | */ |
5152 | void ata_dev_init(struct ata_device *dev) | 5242 | void ata_dev_init(struct ata_device *dev) |
5153 | { | 5243 | { |
5154 | struct ata_link *link = dev->link; | 5244 | struct ata_link *link = ata_dev_phys_link(dev); |
5155 | struct ata_port *ap = link->ap; | 5245 | struct ata_port *ap = link->ap; |
5156 | unsigned long flags; | 5246 | unsigned long flags; |
5157 | 5247 | ||
5158 | /* SATA spd limit is bound to the first device */ | 5248 | /* SATA spd limit is bound to the attached device, reset together */ |
5159 | link->sata_spd_limit = link->hw_sata_spd_limit; | 5249 | link->sata_spd_limit = link->hw_sata_spd_limit; |
5160 | link->sata_spd = 0; | 5250 | link->sata_spd = 0; |
5161 | 5251 | ||
@@ -5318,6 +5408,7 @@ static void ata_host_release(struct device *gendev, void *res) | |||
5318 | scsi_host_put(ap->scsi_host); | 5408 | scsi_host_put(ap->scsi_host); |
5319 | 5409 | ||
5320 | kfree(ap->pmp_link); | 5410 | kfree(ap->pmp_link); |
5411 | kfree(ap->slave_link); | ||
5321 | kfree(ap); | 5412 | kfree(ap); |
5322 | host->ports[i] = NULL; | 5413 | host->ports[i] = NULL; |
5323 | } | 5414 | } |
@@ -5438,6 +5529,68 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev, | |||
5438 | return host; | 5529 | return host; |
5439 | } | 5530 | } |
5440 | 5531 | ||
5532 | /** | ||
5533 | * ata_slave_link_init - initialize slave link | ||
5534 | * @ap: port to initialize slave link for | ||
5535 | * | ||
5536 | * Create and initialize slave link for @ap. This enables slave | ||
5537 | * link handling on the port. | ||
5538 | * | ||
5539 | * In libata, a port contains links and a link contains devices. | ||
5540 | * There is single host link but if a PMP is attached to it, | ||
5541 | * there can be multiple fan-out links. On SATA, there's usually | ||
5542 | * a single device connected to a link but PATA and SATA | ||
5543 | * controllers emulating TF based interface can have two - master | ||
5544 | * and slave. | ||
5545 | * | ||
5546 | * However, there are a few controllers which don't fit into this | ||
5547 | * abstraction too well - SATA controllers which emulate TF | ||
5548 | * interface with both master and slave devices but also have | ||
5549 | * separate SCR register sets for each device. These controllers | ||
5550 | * need separate links for physical link handling | ||
5551 | * (e.g. onlineness, link speed) but should be treated like a | ||
5552 | * traditional M/S controller for everything else (e.g. command | ||
5553 | * issue, softreset). | ||
5554 | * | ||
5555 | * slave_link is libata's way of handling this class of | ||
5556 | * controllers without impacting core layer too much. For | ||
5557 | * anything other than physical link handling, the default host | ||
5558 | * link is used for both master and slave. For physical link | ||
5559 | * handling, separate @ap->slave_link is used. All dirty details | ||
5560 | * are implemented inside libata core layer. From LLD's POV, the | ||
5561 | * only difference is that prereset, hardreset and postreset are | ||
5562 | * called once more for the slave link, so the reset sequence | ||
5563 | * looks like the following. | ||
5564 | * | ||
5565 | * prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) -> | ||
5566 | * softreset(M) -> postreset(M) -> postreset(S) | ||
5567 | * | ||
5568 | * Note that softreset is called only for the master. Softreset | ||
5569 | * resets both M/S by definition, so SRST on master should handle | ||
5570 | * both (the standard method will work just fine). | ||
5571 | * | ||
5572 | * LOCKING: | ||
5573 | * Should be called before host is registered. | ||
5574 | * | ||
5575 | * RETURNS: | ||
5576 | * 0 on success, -errno on failure. | ||
5577 | */ | ||
5578 | int ata_slave_link_init(struct ata_port *ap) | ||
5579 | { | ||
5580 | struct ata_link *link; | ||
5581 | |||
5582 | WARN_ON(ap->slave_link); | ||
5583 | WARN_ON(ap->flags & ATA_FLAG_PMP); | ||
5584 | |||
5585 | link = kzalloc(sizeof(*link), GFP_KERNEL); | ||
5586 | if (!link) | ||
5587 | return -ENOMEM; | ||
5588 | |||
5589 | ata_link_init(ap, link, 1); | ||
5590 | ap->slave_link = link; | ||
5591 | return 0; | ||
5592 | } | ||
5593 | |||
5441 | static void ata_host_stop(struct device *gendev, void *res) | 5594 | static void ata_host_stop(struct device *gendev, void *res) |
5442 | { | 5595 | { |
5443 | struct ata_host *host = dev_get_drvdata(gendev); | 5596 | struct ata_host *host = dev_get_drvdata(gendev); |
@@ -5664,6 +5817,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
5664 | 5817 | ||
5665 | /* init sata_spd_limit to the current value */ | 5818 | /* init sata_spd_limit to the current value */ |
5666 | sata_link_init_spd(&ap->link); | 5819 | sata_link_init_spd(&ap->link); |
5820 | if (ap->slave_link) | ||
5821 | sata_link_init_spd(ap->slave_link); | ||
5667 | 5822 | ||
5668 | /* print per-port info to dmesg */ | 5823 | /* print per-port info to dmesg */ |
5669 | xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, | 5824 | xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, |
@@ -6289,6 +6444,7 @@ EXPORT_SYMBOL_GPL(ata_std_bios_param); | |||
6289 | EXPORT_SYMBOL_GPL(ata_host_init); | 6444 | EXPORT_SYMBOL_GPL(ata_host_init); |
6290 | EXPORT_SYMBOL_GPL(ata_host_alloc); | 6445 | EXPORT_SYMBOL_GPL(ata_host_alloc); |
6291 | EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo); | 6446 | EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo); |
6447 | EXPORT_SYMBOL_GPL(ata_slave_link_init); | ||
6292 | EXPORT_SYMBOL_GPL(ata_host_start); | 6448 | EXPORT_SYMBOL_GPL(ata_host_start); |
6293 | EXPORT_SYMBOL_GPL(ata_host_register); | 6449 | EXPORT_SYMBOL_GPL(ata_host_register); |
6294 | EXPORT_SYMBOL_GPL(ata_host_activate); | 6450 | EXPORT_SYMBOL_GPL(ata_host_activate); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c1db2f234d2e..99037a4860d9 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1756,7 +1756,7 @@ static unsigned int ata_eh_speed_down_verdict(struct ata_device *dev) | |||
1756 | static unsigned int ata_eh_speed_down(struct ata_device *dev, | 1756 | static unsigned int ata_eh_speed_down(struct ata_device *dev, |
1757 | unsigned int eflags, unsigned int err_mask) | 1757 | unsigned int eflags, unsigned int err_mask) |
1758 | { | 1758 | { |
1759 | struct ata_link *link = dev->link; | 1759 | struct ata_link *link = ata_dev_phys_link(dev); |
1760 | int xfer_ok = 0; | 1760 | int xfer_ok = 0; |
1761 | unsigned int verdict; | 1761 | unsigned int verdict; |
1762 | unsigned int action = 0; | 1762 | unsigned int action = 0; |
@@ -1880,7 +1880,8 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1880 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 1880 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
1881 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 1881 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
1882 | 1882 | ||
1883 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) | 1883 | if (!(qc->flags & ATA_QCFLAG_FAILED) || |
1884 | ata_dev_phys_link(qc->dev) != link) | ||
1884 | continue; | 1885 | continue; |
1885 | 1886 | ||
1886 | /* inherit upper level err_mask */ | 1887 | /* inherit upper level err_mask */ |
@@ -1967,6 +1968,23 @@ void ata_eh_autopsy(struct ata_port *ap) | |||
1967 | ata_port_for_each_link(link, ap) | 1968 | ata_port_for_each_link(link, ap) |
1968 | ata_eh_link_autopsy(link); | 1969 | ata_eh_link_autopsy(link); |
1969 | 1970 | ||
1971 | /* Handle the frigging slave link. Autopsy is done similarly | ||
1972 | * but actions and flags are transferred over to the master | ||
1973 | * link and handled from there. | ||
1974 | */ | ||
1975 | if (ap->slave_link) { | ||
1976 | struct ata_eh_context *mehc = &ap->link.eh_context; | ||
1977 | struct ata_eh_context *sehc = &ap->slave_link->eh_context; | ||
1978 | |||
1979 | ata_eh_link_autopsy(ap->slave_link); | ||
1980 | |||
1981 | ata_eh_about_to_do(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS); | ||
1982 | mehc->i.action |= sehc->i.action; | ||
1983 | mehc->i.dev_action[1] |= sehc->i.dev_action[1]; | ||
1984 | mehc->i.flags |= sehc->i.flags; | ||
1985 | ata_eh_done(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS); | ||
1986 | } | ||
1987 | |||
1970 | /* Autopsy of fanout ports can affect host link autopsy. | 1988 | /* Autopsy of fanout ports can affect host link autopsy. |
1971 | * Perform host link autopsy last. | 1989 | * Perform host link autopsy last. |
1972 | */ | 1990 | */ |
@@ -2001,7 +2019,8 @@ static void ata_eh_link_report(struct ata_link *link) | |||
2001 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 2019 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
2002 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 2020 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
2003 | 2021 | ||
2004 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link || | 2022 | if (!(qc->flags & ATA_QCFLAG_FAILED) || |
2023 | ata_dev_phys_link(qc->dev) != link || | ||
2005 | ((qc->flags & ATA_QCFLAG_QUIET) && | 2024 | ((qc->flags & ATA_QCFLAG_QUIET) && |
2006 | qc->err_mask == AC_ERR_DEV)) | 2025 | qc->err_mask == AC_ERR_DEV)) |
2007 | continue; | 2026 | continue; |
@@ -2068,7 +2087,7 @@ static void ata_eh_link_report(struct ata_link *link) | |||
2068 | char cdb_buf[70] = ""; | 2087 | char cdb_buf[70] = ""; |
2069 | 2088 | ||
2070 | if (!(qc->flags & ATA_QCFLAG_FAILED) || | 2089 | if (!(qc->flags & ATA_QCFLAG_FAILED) || |
2071 | qc->dev->link != link || !qc->err_mask) | 2090 | ata_dev_phys_link(qc->dev) != link || !qc->err_mask) |
2072 | continue; | 2091 | continue; |
2073 | 2092 | ||
2074 | if (qc->dma_dir != DMA_NONE) { | 2093 | if (qc->dma_dir != DMA_NONE) { |
@@ -2160,12 +2179,14 @@ void ata_eh_report(struct ata_port *ap) | |||
2160 | } | 2179 | } |
2161 | 2180 | ||
2162 | static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | 2181 | static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, |
2163 | unsigned int *classes, unsigned long deadline) | 2182 | unsigned int *classes, unsigned long deadline, |
2183 | bool clear_classes) | ||
2164 | { | 2184 | { |
2165 | struct ata_device *dev; | 2185 | struct ata_device *dev; |
2166 | 2186 | ||
2167 | ata_link_for_each_dev(dev, link) | 2187 | if (clear_classes) |
2168 | classes[dev->devno] = ATA_DEV_UNKNOWN; | 2188 | ata_link_for_each_dev(dev, link) |
2189 | classes[dev->devno] = ATA_DEV_UNKNOWN; | ||
2169 | 2190 | ||
2170 | return reset(link, classes, deadline); | 2191 | return reset(link, classes, deadline); |
2171 | } | 2192 | } |
@@ -2187,17 +2208,20 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2187 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) | 2208 | ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) |
2188 | { | 2209 | { |
2189 | struct ata_port *ap = link->ap; | 2210 | struct ata_port *ap = link->ap; |
2211 | struct ata_link *slave = ap->slave_link; | ||
2190 | struct ata_eh_context *ehc = &link->eh_context; | 2212 | struct ata_eh_context *ehc = &link->eh_context; |
2213 | struct ata_eh_context *sehc = &slave->eh_context; | ||
2191 | unsigned int *classes = ehc->classes; | 2214 | unsigned int *classes = ehc->classes; |
2192 | unsigned int lflags = link->flags; | 2215 | unsigned int lflags = link->flags; |
2193 | int verbose = !(ehc->i.flags & ATA_EHI_QUIET); | 2216 | int verbose = !(ehc->i.flags & ATA_EHI_QUIET); |
2194 | int max_tries = 0, try = 0; | 2217 | int max_tries = 0, try = 0; |
2218 | struct ata_link *failed_link; | ||
2195 | struct ata_device *dev; | 2219 | struct ata_device *dev; |
2196 | unsigned long deadline, now; | 2220 | unsigned long deadline, now; |
2197 | ata_reset_fn_t reset; | 2221 | ata_reset_fn_t reset; |
2198 | unsigned long flags; | 2222 | unsigned long flags; |
2199 | u32 sstatus; | 2223 | u32 sstatus; |
2200 | int nr_known, rc; | 2224 | int nr_unknown, rc; |
2201 | 2225 | ||
2202 | /* | 2226 | /* |
2203 | * Prepare to reset | 2227 | * Prepare to reset |
@@ -2252,8 +2276,30 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2252 | } | 2276 | } |
2253 | 2277 | ||
2254 | if (prereset) { | 2278 | if (prereset) { |
2255 | rc = prereset(link, | 2279 | unsigned long deadline = ata_deadline(jiffies, |
2256 | ata_deadline(jiffies, ATA_EH_PRERESET_TIMEOUT)); | 2280 | ATA_EH_PRERESET_TIMEOUT); |
2281 | |||
2282 | if (slave) { | ||
2283 | sehc->i.action &= ~ATA_EH_RESET; | ||
2284 | sehc->i.action |= ehc->i.action; | ||
2285 | } | ||
2286 | |||
2287 | rc = prereset(link, deadline); | ||
2288 | |||
2289 | /* If present, do prereset on slave link too. Reset | ||
2290 | * is skipped iff both master and slave links report | ||
2291 | * -ENOENT or clear ATA_EH_RESET. | ||
2292 | */ | ||
2293 | if (slave && (rc == 0 || rc == -ENOENT)) { | ||
2294 | int tmp; | ||
2295 | |||
2296 | tmp = prereset(slave, deadline); | ||
2297 | if (tmp != -ENOENT) | ||
2298 | rc = tmp; | ||
2299 | |||
2300 | ehc->i.action |= sehc->i.action; | ||
2301 | } | ||
2302 | |||
2257 | if (rc) { | 2303 | if (rc) { |
2258 | if (rc == -ENOENT) { | 2304 | if (rc == -ENOENT) { |
2259 | ata_link_printk(link, KERN_DEBUG, | 2305 | ata_link_printk(link, KERN_DEBUG, |
@@ -2302,25 +2348,51 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2302 | else | 2348 | else |
2303 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; | 2349 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; |
2304 | 2350 | ||
2305 | rc = ata_do_reset(link, reset, classes, deadline); | 2351 | rc = ata_do_reset(link, reset, classes, deadline, true); |
2306 | if (rc && rc != -EAGAIN) | 2352 | if (rc && rc != -EAGAIN) { |
2353 | failed_link = link; | ||
2307 | goto fail; | 2354 | goto fail; |
2355 | } | ||
2356 | |||
2357 | /* hardreset slave link if existent */ | ||
2358 | if (slave && reset == hardreset) { | ||
2359 | int tmp; | ||
2360 | |||
2361 | if (verbose) | ||
2362 | ata_link_printk(slave, KERN_INFO, | ||
2363 | "hard resetting link\n"); | ||
2308 | 2364 | ||
2365 | ata_eh_about_to_do(slave, NULL, ATA_EH_RESET); | ||
2366 | tmp = ata_do_reset(slave, reset, classes, deadline, | ||
2367 | false); | ||
2368 | switch (tmp) { | ||
2369 | case -EAGAIN: | ||
2370 | rc = -EAGAIN; | ||
2371 | case 0: | ||
2372 | break; | ||
2373 | default: | ||
2374 | failed_link = slave; | ||
2375 | rc = tmp; | ||
2376 | goto fail; | ||
2377 | } | ||
2378 | } | ||
2379 | |||
2380 | /* perform follow-up SRST if necessary */ | ||
2309 | if (reset == hardreset && | 2381 | if (reset == hardreset && |
2310 | ata_eh_followup_srst_needed(link, rc, classes)) { | 2382 | ata_eh_followup_srst_needed(link, rc, classes)) { |
2311 | /* okay, let's do follow-up softreset */ | ||
2312 | reset = softreset; | 2383 | reset = softreset; |
2313 | 2384 | ||
2314 | if (!reset) { | 2385 | if (!reset) { |
2315 | ata_link_printk(link, KERN_ERR, | 2386 | ata_link_printk(link, KERN_ERR, |
2316 | "follow-up softreset required " | 2387 | "follow-up softreset required " |
2317 | "but no softreset avaliable\n"); | 2388 | "but no softreset avaliable\n"); |
2389 | failed_link = link; | ||
2318 | rc = -EINVAL; | 2390 | rc = -EINVAL; |
2319 | goto fail; | 2391 | goto fail; |
2320 | } | 2392 | } |
2321 | 2393 | ||
2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2394 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2323 | rc = ata_do_reset(link, reset, classes, deadline); | 2395 | rc = ata_do_reset(link, reset, classes, deadline, true); |
2324 | } | 2396 | } |
2325 | } else { | 2397 | } else { |
2326 | if (verbose) | 2398 | if (verbose) |
@@ -2341,7 +2413,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2341 | dev->pio_mode = XFER_PIO_0; | 2413 | dev->pio_mode = XFER_PIO_0; |
2342 | dev->flags &= ~ATA_DFLAG_SLEEPING; | 2414 | dev->flags &= ~ATA_DFLAG_SLEEPING; |
2343 | 2415 | ||
2344 | if (ata_link_offline(link)) | 2416 | if (ata_phys_link_offline(ata_dev_phys_link(dev))) |
2345 | continue; | 2417 | continue; |
2346 | 2418 | ||
2347 | /* apply class override */ | 2419 | /* apply class override */ |
@@ -2354,6 +2426,8 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2354 | /* record current link speed */ | 2426 | /* record current link speed */ |
2355 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) | 2427 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) |
2356 | link->sata_spd = (sstatus >> 4) & 0xf; | 2428 | link->sata_spd = (sstatus >> 4) & 0xf; |
2429 | if (slave && sata_scr_read(slave, SCR_STATUS, &sstatus) == 0) | ||
2430 | slave->sata_spd = (sstatus >> 4) & 0xf; | ||
2357 | 2431 | ||
2358 | /* thaw the port */ | 2432 | /* thaw the port */ |
2359 | if (ata_is_host_link(link)) | 2433 | if (ata_is_host_link(link)) |
@@ -2366,12 +2440,17 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2366 | * reset and here. This race is mediated by cross checking | 2440 | * reset and here. This race is mediated by cross checking |
2367 | * link onlineness and classification result later. | 2441 | * link onlineness and classification result later. |
2368 | */ | 2442 | */ |
2369 | if (postreset) | 2443 | if (postreset) { |
2370 | postreset(link, classes); | 2444 | postreset(link, classes); |
2445 | if (slave) | ||
2446 | postreset(slave, classes); | ||
2447 | } | ||
2371 | 2448 | ||
2372 | /* clear cached SError */ | 2449 | /* clear cached SError */ |
2373 | spin_lock_irqsave(link->ap->lock, flags); | 2450 | spin_lock_irqsave(link->ap->lock, flags); |
2374 | link->eh_info.serror = 0; | 2451 | link->eh_info.serror = 0; |
2452 | if (slave) | ||
2453 | slave->eh_info.serror = 0; | ||
2375 | spin_unlock_irqrestore(link->ap->lock, flags); | 2454 | spin_unlock_irqrestore(link->ap->lock, flags); |
2376 | 2455 | ||
2377 | /* Make sure onlineness and classification result correspond. | 2456 | /* Make sure onlineness and classification result correspond. |
@@ -2381,19 +2460,21 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2381 | * link onlineness and classification result, those conditions | 2460 | * link onlineness and classification result, those conditions |
2382 | * can be reliably detected and retried. | 2461 | * can be reliably detected and retried. |
2383 | */ | 2462 | */ |
2384 | nr_known = 0; | 2463 | nr_unknown = 0; |
2385 | ata_link_for_each_dev(dev, link) { | 2464 | ata_link_for_each_dev(dev, link) { |
2386 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ | 2465 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ |
2387 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) | 2466 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) { |
2388 | classes[dev->devno] = ATA_DEV_NONE; | 2467 | classes[dev->devno] = ATA_DEV_NONE; |
2389 | else | 2468 | if (ata_phys_link_online(ata_dev_phys_link(dev))) |
2390 | nr_known++; | 2469 | nr_unknown++; |
2470 | } | ||
2391 | } | 2471 | } |
2392 | 2472 | ||
2393 | if (classify && !nr_known && ata_link_online(link)) { | 2473 | if (classify && nr_unknown) { |
2394 | if (try < max_tries) { | 2474 | if (try < max_tries) { |
2395 | ata_link_printk(link, KERN_WARNING, "link online but " | 2475 | ata_link_printk(link, KERN_WARNING, "link online but " |
2396 | "device misclassified, retrying\n"); | 2476 | "device misclassified, retrying\n"); |
2477 | failed_link = link; | ||
2397 | rc = -EAGAIN; | 2478 | rc = -EAGAIN; |
2398 | goto fail; | 2479 | goto fail; |
2399 | } | 2480 | } |
@@ -2404,6 +2485,8 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2404 | 2485 | ||
2405 | /* reset successful, schedule revalidation */ | 2486 | /* reset successful, schedule revalidation */ |
2406 | ata_eh_done(link, NULL, ATA_EH_RESET); | 2487 | ata_eh_done(link, NULL, ATA_EH_RESET); |
2488 | if (slave) | ||
2489 | ata_eh_done(slave, NULL, ATA_EH_RESET); | ||
2407 | ehc->last_reset = jiffies; | 2490 | ehc->last_reset = jiffies; |
2408 | ehc->i.action |= ATA_EH_REVALIDATE; | 2491 | ehc->i.action |= ATA_EH_REVALIDATE; |
2409 | 2492 | ||
@@ -2411,6 +2494,8 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2411 | out: | 2494 | out: |
2412 | /* clear hotplug flag */ | 2495 | /* clear hotplug flag */ |
2413 | ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; | 2496 | ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; |
2497 | if (slave) | ||
2498 | sehc->i.flags &= ~ATA_EHI_HOTPLUGGED; | ||
2414 | 2499 | ||
2415 | spin_lock_irqsave(ap->lock, flags); | 2500 | spin_lock_irqsave(ap->lock, flags); |
2416 | ap->pflags &= ~ATA_PFLAG_RESETTING; | 2501 | ap->pflags &= ~ATA_PFLAG_RESETTING; |
@@ -2431,7 +2516,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2431 | if (time_before(now, deadline)) { | 2516 | if (time_before(now, deadline)) { |
2432 | unsigned long delta = deadline - now; | 2517 | unsigned long delta = deadline - now; |
2433 | 2518 | ||
2434 | ata_link_printk(link, KERN_WARNING, | 2519 | ata_link_printk(failed_link, KERN_WARNING, |
2435 | "reset failed (errno=%d), retrying in %u secs\n", | 2520 | "reset failed (errno=%d), retrying in %u secs\n", |
2436 | rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000)); | 2521 | rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000)); |
2437 | 2522 | ||
@@ -2439,8 +2524,13 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2439 | delta = schedule_timeout_uninterruptible(delta); | 2524 | delta = schedule_timeout_uninterruptible(delta); |
2440 | } | 2525 | } |
2441 | 2526 | ||
2442 | if (rc == -EPIPE || try == max_tries - 1) | 2527 | if (try == max_tries - 1) { |
2443 | sata_down_spd_limit(link); | 2528 | sata_down_spd_limit(link); |
2529 | if (slave) | ||
2530 | sata_down_spd_limit(slave); | ||
2531 | } else if (rc == -EPIPE) | ||
2532 | sata_down_spd_limit(failed_link); | ||
2533 | |||
2444 | if (hardreset) | 2534 | if (hardreset) |
2445 | reset = hardreset; | 2535 | reset = hardreset; |
2446 | goto retry; | 2536 | goto retry; |
@@ -2472,7 +2562,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
2472 | if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) { | 2562 | if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) { |
2473 | WARN_ON(dev->class == ATA_DEV_PMP); | 2563 | WARN_ON(dev->class == ATA_DEV_PMP); |
2474 | 2564 | ||
2475 | if (ata_link_offline(link)) { | 2565 | if (ata_phys_link_offline(ata_dev_phys_link(dev))) { |
2476 | rc = -EIO; | 2566 | rc = -EIO; |
2477 | goto err; | 2567 | goto err; |
2478 | } | 2568 | } |
@@ -2697,7 +2787,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2697 | /* This is the last chance, better to slow | 2787 | /* This is the last chance, better to slow |
2698 | * down than lose it. | 2788 | * down than lose it. |
2699 | */ | 2789 | */ |
2700 | sata_down_spd_limit(dev->link); | 2790 | sata_down_spd_limit(ata_dev_phys_link(dev)); |
2701 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); | 2791 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); |
2702 | } | 2792 | } |
2703 | } | 2793 | } |
@@ -2707,7 +2797,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2707 | ata_dev_disable(dev); | 2797 | ata_dev_disable(dev); |
2708 | 2798 | ||
2709 | /* detach if offline */ | 2799 | /* detach if offline */ |
2710 | if (ata_link_offline(dev->link)) | 2800 | if (ata_phys_link_offline(ata_dev_phys_link(dev))) |
2711 | ata_eh_detach_dev(dev); | 2801 | ata_eh_detach_dev(dev); |
2712 | 2802 | ||
2713 | /* schedule probe if necessary */ | 2803 | /* schedule probe if necessary */ |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index ade5c75b6144..e96de96e3020 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -70,6 +70,7 @@ extern int atapi_passthru16; | |||
70 | extern int libata_fua; | 70 | extern int libata_fua; |
71 | extern int libata_noacpi; | 71 | extern int libata_noacpi; |
72 | extern int libata_allow_tpm; | 72 | extern int libata_allow_tpm; |
73 | extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); | ||
73 | extern void ata_force_cbl(struct ata_port *ap); | 74 | extern void ata_force_cbl(struct ata_port *ap); |
74 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); | 75 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); |
75 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); | 76 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); |
@@ -107,6 +108,8 @@ extern void ata_qc_issue(struct ata_queued_cmd *qc); | |||
107 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); | 108 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); |
108 | extern int atapi_check_dma(struct ata_queued_cmd *qc); | 109 | extern int atapi_check_dma(struct ata_queued_cmd *qc); |
109 | extern void swap_buf_le16(u16 *buf, unsigned int buf_words); | 110 | extern void swap_buf_le16(u16 *buf, unsigned int buf_words); |
111 | extern bool ata_phys_link_online(struct ata_link *link); | ||
112 | extern bool ata_phys_link_offline(struct ata_link *link); | ||
110 | extern void ata_dev_init(struct ata_device *dev); | 113 | extern void ata_dev_init(struct ata_device *dev); |
111 | extern void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp); | 114 | extern void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp); |
112 | extern int sata_link_init_spd(struct ata_link *link); | 115 | extern int sata_link_init_spd(struct ata_link *link); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 0c7e6f3c28eb..244ff601559a 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -690,7 +690,8 @@ struct ata_port { | |||
690 | unsigned int qc_active; | 690 | unsigned int qc_active; |
691 | int nr_active_links; /* #links with active qcs */ | 691 | int nr_active_links; /* #links with active qcs */ |
692 | 692 | ||
693 | struct ata_link link; /* host default link */ | 693 | struct ata_link link; /* host default link */ |
694 | struct ata_link *slave_link; /* see ata_slave_link_init() */ | ||
694 | 695 | ||
695 | int nr_pmp_links; /* nr of available PMP links */ | 696 | int nr_pmp_links; /* nr of available PMP links */ |
696 | struct ata_link *pmp_link; /* array of PMP links */ | 697 | struct ata_link *pmp_link; /* array of PMP links */ |
@@ -897,6 +898,7 @@ extern void ata_port_disable(struct ata_port *); | |||
897 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); | 898 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); |
898 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, | 899 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
899 | const struct ata_port_info * const * ppi, int n_ports); | 900 | const struct ata_port_info * const * ppi, int n_ports); |
901 | extern int ata_slave_link_init(struct ata_port *ap); | ||
900 | extern int ata_host_start(struct ata_host *host); | 902 | extern int ata_host_start(struct ata_host *host); |
901 | extern int ata_host_register(struct ata_host *host, | 903 | extern int ata_host_register(struct ata_host *host, |
902 | struct scsi_host_template *sht); | 904 | struct scsi_host_template *sht); |
@@ -1136,7 +1138,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap) | |||
1136 | 1138 | ||
1137 | static inline int ata_is_host_link(const struct ata_link *link) | 1139 | static inline int ata_is_host_link(const struct ata_link *link) |
1138 | { | 1140 | { |
1139 | return link == &link->ap->link; | 1141 | return link == &link->ap->link || link == link->ap->slave_link; |
1140 | } | 1142 | } |
1141 | #else /* CONFIG_SATA_PMP */ | 1143 | #else /* CONFIG_SATA_PMP */ |
1142 | static inline bool sata_pmp_supported(struct ata_port *ap) | 1144 | static inline bool sata_pmp_supported(struct ata_port *ap) |
@@ -1169,7 +1171,7 @@ static inline int sata_srst_pmp(struct ata_link *link) | |||
1169 | printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) | 1171 | printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) |
1170 | 1172 | ||
1171 | #define ata_link_printk(link, lv, fmt, args...) do { \ | 1173 | #define ata_link_printk(link, lv, fmt, args...) do { \ |
1172 | if (sata_pmp_attached((link)->ap)) \ | 1174 | if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \ |
1173 | printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ | 1175 | printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ |
1174 | (link)->pmp , ##args); \ | 1176 | (link)->pmp , ##args); \ |
1175 | else \ | 1177 | else \ |