Lines Matching +full:cd +full:- +full:debounce +full:- +full:delay +full:- +full:ms
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright 2003-2005 Red Hat, Inc. All rights reserved.
4 * Copyright 2003-2005 Jeff Garzik
7 * as Documentation/driver-api/libata.rst
13 #include <linux/delay.h>
16 #include <linux/dma-mapping.h>
28 * Define if arch has non-standard setup. This is a _PCI_ standard
32 #include <asm/libata-portmap.h>
39 * compile-time options: to be removed as soon as all the drivers are
85 #define ata_msg_drv(p) ((p)->msg_enable & ATA_MSG_DRV)
86 #define ata_msg_info(p) ((p)->msg_enable & ATA_MSG_INFO)
87 #define ata_msg_probe(p) ((p)->msg_enable & ATA_MSG_PROBE)
88 #define ata_msg_warn(p) ((p)->msg_enable & ATA_MSG_WARN)
89 #define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
90 #define ata_msg_ctl(p) ((p)->msg_enable & ATA_MSG_CTL)
91 #define ata_msg_intr(p) ((p)->msg_enable & ATA_MSG_INTR)
92 #define ata_msg_err(p) ((p)->msg_enable & ATA_MSG_ERR)
97 return default_msg_enable_bits; /* should be 0x1 - only driver info msgs */ in ata_msg_init()
100 return (1 << dval) - 1; in ata_msg_init()
117 ATA_ALL_DEVICES = (1 << ATA_MAX_DEVICES) - 1,
120 ATA_SHT_THIS_ID = -1,
123 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
126 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
142 ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
145 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
153 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
190 ATA_LFLAG_NO_DB_DELAY = (1 << 11), /* no debounce delay on link resume */
207 ATA_FLAG_FPDMA_AA = (1 << 14), /* driver supports Auto-Activate */
221 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
263 /* bits 24:31 of host->flags are reserved for LLD specific flags */
272 * GoVault needs 2s and iVDR disk HHD424020F7SV00 800ms. 2s
274 * probing is available, 800ms otherwise.
279 /* Spec mandates to wait for ">= 2ms" before checking status
280 * after reset. We wait 150ms, because that was the magic
281 * delay used for ATAPI devices in Hale Landis's ATADRVR, for
285 * perform this magic delay here as well.
287 * Old drivers/ide uses the 2mS rule and then waits for ready.
291 /* If PMP is supported, we have to do follow-up SRST. As some
340 /* return values for ->qc_defer */
349 ATA_EH_SOFTRESET = (1 << 1), /* meaningful only in ->prereset */
350 ATA_EH_HARDRESET = (1 << 2), /* meaningful only in ->prereset */
359 /* ata_eh_info->flags */
365 ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */
366 ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
376 /* max tries if error condition is still set after ->error_handler */
391 * ata_eh_cmd_timeout_table in libata-eh.c.
436 ATAPI_READ_CD = 2, /* READ CD [MSF] */
437 ATAPI_PASS_THRU = 3, /* SAT pass-thru */
462 ATA_ACPI_FILTER_FPDMA_OFFSET = 1 << 3, /* FPDMA non-zero offset */
471 ATA_MASK_PIO = ((1LU << ATA_NR_PIO_MODES) - 1)
473 ATA_MASK_MWDMA = ((1LU << ATA_NR_MWDMA_MODES) - 1)
475 ATA_MASK_UDMA = ((1LU << ATA_NR_UDMA_MODES) - 1)
505 * alter libata-scsi.c (for the ascii descriptions)
575 /* ATA-8 ACS-3 */
702 unsigned int max_sectors; /* per-device max sectors */
705 /* per-dev xfer mask */
748 unsigned int err_mask; /* port-wide err_mask */
813 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
819 /* Flags that change dynamically, protected by ap->lock */
892 * ERR_PTR(-ENOENT). Unfortunately, ERR_PTR doesn't render a constant
895 #define ATA_OP_NULL (void *)(unsigned long)(-ENOENT)
997 * ->inherits must be the last field and all the preceding
1016 unsigned short act8b; /* t2 for 8-bit I/O */
1017 unsigned short rec8b; /* t2i for 8-bit I/O */
1018 unsigned short cyc8b; /* t0 for 8-bit I/O */
1027 * Core layer - drivers/ata/libata-core.c
1059 return (tf->command == ATA_CMD_READ_MULTI) || in is_multi_taskfile()
1060 (tf->command == ATA_CMD_WRITE_MULTI) || in is_multi_taskfile()
1061 (tf->command == ATA_CMD_READ_MULTI_EXT) || in is_multi_taskfile()
1062 (tf->command == ATA_CMD_WRITE_MULTI_EXT) || in is_multi_taskfile()
1063 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); in is_multi_taskfile()
1068 return ap->ops == &ata_dummy_port_ops; in ata_port_is_dummy()
1168 * SATA specific code - drivers/ata/libata-sata.c
1178 if (ehc->i.flags & ATA_EHI_HOTPLUGGED) in sata_ehc_deb_timing()
1204 return -EOPNOTSUPP; in sata_scr_read()
1208 return -EOPNOTSUPP; in sata_scr_write()
1212 return -EOPNOTSUPP; in sata_scr_write_flush()
1214 static inline int sata_set_spd(struct ata_link *link) { return -EOPNOTSUPP; } in sata_set_spd()
1223 return -EOPNOTSUPP; in sata_link_hardreset()
1229 return -EOPNOTSUPP; in sata_link_resume()
1295 * ACPI - drivers/ata/libata-acpi.c
1300 if (ap->pflags & ATA_PFLAG_INIT_GTM_VALID) in ata_acpi_init_gtm()
1301 return &ap->__acpi_init_gtm; in ata_acpi_init_gtm()
1318 return -ENOSYS; in ata_acpi_stm()
1324 return -ENOSYS; in ata_acpi_gtm()
1341 * EH - drivers/ata/libata-eh.c
1430 return ap->flags & ATA_FLAG_PMP; in sata_pmp_supported()
1435 return ap->nr_pmp_links != 0; in sata_pmp_attached()
1440 return link == &link->ap->link || link == link->ap->slave_link; in ata_is_host_link()
1461 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) in sata_srst_pmp()
1463 return link->pmp; in sata_srst_pmp()
1525 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; in ata_ehi_hotplugged()
1526 ehi->flags |= ATA_EHI_HOTPLUGGED; in ata_ehi_hotplugged()
1527 ehi->action |= ATA_EH_RESET | ATA_EH_ENABLE_LINK; in ata_ehi_hotplugged()
1528 ehi->err_mask |= AC_ERR_ATA_BUS; in ata_ehi_hotplugged()
1598 return ata_class_enabled(dev->class); in ata_dev_enabled()
1603 return ata_class_disabled(dev->class); in ata_dev_disabled()
1608 return ata_class_absent(dev->class); in ata_dev_absent()
1616 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS) in ata_link_max_devices()
1623 return ata_tag_valid(link->active_tag) || link->sactive; in ata_link_active()
1673 * impossible to use ATA_LITER_* for device iteration or vice-versa.
1684 * ata_ncq_enabled - Test whether NCQ is enabled
1697 return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF | in ata_ncq_enabled()
1703 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) && in ata_fpdma_dsm_supported()
1704 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] & in ata_fpdma_dsm_supported()
1710 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) && in ata_fpdma_read_log_supported()
1711 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_RD_LOG_OFFSET] & in ata_fpdma_read_log_supported()
1717 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) && in ata_fpdma_zac_mgmt_in_supported()
1718 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_ZAC_MGMT_OFFSET] & in ata_fpdma_zac_mgmt_in_supported()
1724 return (dev->ncq_non_data_cmds[ATA_LOG_NCQ_NON_DATA_ZAC_MGMT_OFFSET] & in ata_fpdma_zac_mgmt_out_supported()
1730 qc->tf.ctl |= ATA_NIEN; in ata_qc_set_polling()
1737 return &ap->qcmd[tag]; in __ata_qc_from_tag()
1746 if (unlikely(!qc) || !ap->ops->error_handler) in ata_qc_from_tag()
1749 if ((qc->flags & (ATA_QCFLAG_ACTIVE | in ata_qc_from_tag()
1758 return qc->nbytes - min(qc->extrabytes, qc->nbytes); in ata_qc_raw_nbytes()
1766 tf->ctl = dev->link->ap->ctl; in ata_tf_init()
1768 tf->ctl = ATA_DEVCTL_OBS; in ata_tf_init()
1770 if (dev->devno == 0) in ata_tf_init()
1771 tf->device = ATA_DEVICE_OBS; in ata_tf_init()
1773 tf->device = ATA_DEVICE_OBS | ATA_DEV1; in ata_tf_init()
1778 qc->dma_dir = DMA_NONE; in ata_qc_reinit()
1779 qc->sg = NULL; in ata_qc_reinit()
1780 qc->flags = 0; in ata_qc_reinit()
1781 qc->cursg = NULL; in ata_qc_reinit()
1782 qc->cursg_ofs = 0; in ata_qc_reinit()
1783 qc->nbytes = qc->extrabytes = qc->curbytes = 0; in ata_qc_reinit()
1784 qc->n_elem = 0; in ata_qc_reinit()
1785 qc->err_mask = 0; in ata_qc_reinit()
1786 qc->sect_size = ATA_SECT_SIZE; in ata_qc_reinit()
1788 ata_tf_init(qc->dev, &qc->tf); in ata_qc_reinit()
1791 qc->result_tf.command = ATA_DRDY; in ata_qc_reinit()
1792 qc->result_tf.feature = 0; in ata_qc_reinit()
1797 return ata_id_wcache_enabled(dev->id) || in ata_try_flush_cache()
1798 ata_id_has_flush(dev->id) || in ata_try_flush_cache()
1799 ata_id_has_flush_ext(dev->id); in ata_try_flush_cache()
1821 return *(struct ata_port **)&host->hostdata[0]; in ata_shost_to_port()
1831 return -ENODEV; in ata_check_ready()
1848 if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4) in ata_using_mwdma()
1855 if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7) in ata_using_udma()
1862 return (adev->dma_mode == 0xFF ? 0 : 1); in ata_dma_enabled()
1866 * PATA timings - drivers/ata/libata-pata-timings.c
1876 * PMP - drivers/ata/libata-pmp.c
1895 * SFF - drivers/ata/libata-sff.c
1929 unsigned long delay);
1930 extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay);
2004 * ata_sff_busy_wait - Wait for a port status register
2023 status = ap->ops->sff_check_status(ap); in ata_sff_busy_wait()
2024 max--; in ata_sff_busy_wait()
2031 * ata_wait_idle - Wait for a port to be idle.
2034 * Waits up to 10ms for port's BUSY and DRQ signals to clear.