diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/libahci.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 1984a6e89e84..261f86d102e8 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -541,29 +541,11 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) | |||
541 | return -EINVAL; | 541 | return -EINVAL; |
542 | } | 542 | } |
543 | 543 | ||
544 | static int ahci_is_device_present(void __iomem *port_mmio) | ||
545 | { | ||
546 | u8 status = readl(port_mmio + PORT_TFDATA) & 0xff; | ||
547 | |||
548 | /* Make sure PxTFD.STS.BSY and PxTFD.STS.DRQ are 0 */ | ||
549 | if (status & (ATA_BUSY | ATA_DRQ)) | ||
550 | return 0; | ||
551 | |||
552 | /* Make sure PxSSTS.DET is 3h */ | ||
553 | status = readl(port_mmio + PORT_SCR_STAT) & 0xf; | ||
554 | if (status != 3) | ||
555 | return 0; | ||
556 | return 1; | ||
557 | } | ||
558 | |||
559 | void ahci_start_engine(struct ata_port *ap) | 544 | void ahci_start_engine(struct ata_port *ap) |
560 | { | 545 | { |
561 | void __iomem *port_mmio = ahci_port_base(ap); | 546 | void __iomem *port_mmio = ahci_port_base(ap); |
562 | u32 tmp; | 547 | u32 tmp; |
563 | 548 | ||
564 | if (!ahci_is_device_present(port_mmio)) | ||
565 | return; | ||
566 | |||
567 | /* start DMA */ | 549 | /* start DMA */ |
568 | tmp = readl(port_mmio + PORT_CMD); | 550 | tmp = readl(port_mmio + PORT_CMD); |
569 | tmp |= PORT_CMD_START; | 551 | tmp |= PORT_CMD_START; |
@@ -1892,6 +1874,9 @@ static void ahci_error_handler(struct ata_port *ap) | |||
1892 | } | 1874 | } |
1893 | 1875 | ||
1894 | sata_pmp_error_handler(ap); | 1876 | sata_pmp_error_handler(ap); |
1877 | |||
1878 | if (!ata_dev_enabled(ap->link.device)) | ||
1879 | ahci_stop_engine(ap); | ||
1895 | } | 1880 | } |
1896 | 1881 | ||
1897 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) | 1882 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) |