2541
2541
dev->pio_mode = XFER_PIO_0;
2542
2542
dev->flags &= ~ATA_DFLAG_SLEEPING;
2544
if (!ata_phys_link_offline(ata_dev_phys_link(dev))) {
2545
/* apply class override */
2546
if (lflags & ATA_LFLAG_ASSUME_ATA)
2547
classes[dev->devno] = ATA_DEV_ATA;
2548
else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2549
classes[dev->devno] = ATA_DEV_SEMB_UNSUP;
2551
classes[dev->devno] = ATA_DEV_NONE;
2544
if (ata_phys_link_offline(ata_dev_phys_link(dev)))
2547
/* apply class override */
2548
if (lflags & ATA_LFLAG_ASSUME_ATA)
2549
classes[dev->devno] = ATA_DEV_ATA;
2550
else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2551
classes[dev->devno] = ATA_DEV_SEMB_UNSUP;
2554
2554
/* record current link speed */
2581
2581
slave->eh_info.serror = 0;
2582
2582
spin_unlock_irqrestore(link->ap->lock, flags);
2584
/* Make sure onlineness and classification result correspond.
2585
* Make sure onlineness and classification result correspond.
2585
2586
* Hotplug could have happened during reset and some
2586
2587
* controllers fail to wait while a drive is spinning up after
2587
2588
* being hotplugged causing misdetection. By cross checking
2588
* link onlineness and classification result, those conditions
2589
* can be reliably detected and retried.
2589
* link on/offlineness and classification result, those
2590
* conditions can be reliably detected and retried.
2591
2592
nr_unknown = 0;
2592
2593
ata_for_each_dev(dev, link, ALL) {
2593
/* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */
2594
if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
2595
classes[dev->devno] = ATA_DEV_NONE;
2596
if (ata_phys_link_online(ata_dev_phys_link(dev)))
2594
if (ata_phys_link_online(ata_dev_phys_link(dev))) {
2595
if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
2596
ata_dev_printk(dev, KERN_DEBUG, "link online "
2597
"but device misclassifed\n");
2598
classes[dev->devno] = ATA_DEV_NONE;
2601
} else if (ata_phys_link_offline(ata_dev_phys_link(dev))) {
2602
if (ata_class_enabled(classes[dev->devno]))
2603
ata_dev_printk(dev, KERN_DEBUG, "link offline, "
2604
"clearing class %d to NONE\n",
2605
classes[dev->devno]);
2606
classes[dev->devno] = ATA_DEV_NONE;
2607
} else if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
2608
ata_dev_printk(dev, KERN_DEBUG, "link status unknown, "
2609
"clearing UNKNOWN to NONE\n");
2610
classes[dev->devno] = ATA_DEV_NONE;
2601
2614
if (classify && nr_unknown) {
2602
2615
if (try < max_tries) {
2603
2616
ata_link_printk(link, KERN_WARNING, "link online but "
2604
"device misclassified, retrying\n");
2617
"%d devices misclassified, retrying\n",
2605
2619
failed_link = link;
2609
2623
ata_link_printk(link, KERN_WARNING,
2610
"link online but device misclassified, "
2611
"device detection might fail\n");
2624
"link online but %d devices misclassified, "
2625
"device detection might fail\n", nr_unknown);
2614
2628
/* reset successful, schedule revalidation */