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.
435 ATAPI_READ_CD = 2, /* READ CD [MSF] */
436 ATAPI_PASS_THRU = 3, /* SAT pass-thru */
461 ATA_ACPI_FILTER_FPDMA_OFFSET = 1 << 3, /* FPDMA non-zero offset */
470 ATA_MASK_PIO = ((1LU << ATA_NR_PIO_MODES) - 1)
472 ATA_MASK_MWDMA = ((1LU << ATA_NR_MWDMA_MODES) - 1)
474 ATA_MASK_UDMA = ((1LU << ATA_NR_UDMA_MODES) - 1)
504 * alter libata-scsi.c (for the ascii descriptions)
574 /* ATA-8 ACS-3 */
701 unsigned int max_sectors; /* per-device max sectors */
704 /* per-dev xfer mask */
747 unsigned int err_mask; /* port-wide err_mask */
812 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
818 /* Flags that change dynamically, protected by ap->lock */
891 * ERR_PTR(-ENOENT). Unfortunately, ERR_PTR doesn't render a constant
894 #define ATA_OP_NULL (void *)(unsigned long)(-ENOENT)
996 * ->inherits must be the last field and all the preceding
1015 unsigned short act8b; /* t2 for 8-bit I/O */
1016 unsigned short rec8b; /* t2i for 8-bit I/O */
1017 unsigned short cyc8b; /* t0 for 8-bit I/O */
1026 * Core layer - drivers/ata/libata-core.c
1058 return (tf->command == ATA_CMD_READ_MULTI) || in is_multi_taskfile()
1059 (tf->command == ATA_CMD_WRITE_MULTI) || in is_multi_taskfile()
1060 (tf->command == ATA_CMD_READ_MULTI_EXT) || in is_multi_taskfile()
1061 (tf->command == ATA_CMD_WRITE_MULTI_EXT) || in is_multi_taskfile()
1062 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); in is_multi_taskfile()
1067 return ap->ops == &ata_dummy_port_ops; in ata_port_is_dummy()
1167 * SATA specific code - drivers/ata/libata-sata.c
1177 if (ehc->i.flags & ATA_EHI_HOTPLUGGED) in sata_ehc_deb_timing()
1203 return -EOPNOTSUPP; in sata_scr_read()
1207 return -EOPNOTSUPP; in sata_scr_write()
1211 return -EOPNOTSUPP; in sata_scr_write_flush()
1213 static inline int sata_set_spd(struct ata_link *link) { return -EOPNOTSUPP; } in sata_set_spd()
1222 return -EOPNOTSUPP; in sata_link_hardreset()
1228 return -EOPNOTSUPP; in sata_link_resume()
1294 * ACPI - drivers/ata/libata-acpi.c
1299 if (ap->pflags & ATA_PFLAG_INIT_GTM_VALID) in ata_acpi_init_gtm()
1300 return &ap->__acpi_init_gtm; in ata_acpi_init_gtm()
1317 return -ENOSYS; in ata_acpi_stm()
1323 return -ENOSYS; in ata_acpi_gtm()
1340 * EH - drivers/ata/libata-eh.c
1429 return ap->flags & ATA_FLAG_PMP; in sata_pmp_supported()
1434 return ap->nr_pmp_links != 0; in sata_pmp_attached()
1439 return link == &link->ap->link || link == link->ap->slave_link; in ata_is_host_link()
1460 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) in sata_srst_pmp()
1462 return link->pmp; in sata_srst_pmp()
1524 ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; in ata_ehi_hotplugged()
1525 ehi->flags |= ATA_EHI_HOTPLUGGED; in ata_ehi_hotplugged()
1526 ehi->action |= ATA_EH_RESET | ATA_EH_ENABLE_LINK; in ata_ehi_hotplugged()
1527 ehi->err_mask |= AC_ERR_ATA_BUS; in ata_ehi_hotplugged()
1597 return ata_class_enabled(dev->class); in ata_dev_enabled()
1602 return ata_class_disabled(dev->class); in ata_dev_disabled()
1607 return ata_class_absent(dev->class); in ata_dev_absent()
1615 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS) in ata_link_max_devices()
1622 return ata_tag_valid(link->active_tag) || link->sactive; in ata_link_active()
1672 * impossible to use ATA_LITER_* for device iteration or vice-versa.
1683 * ata_ncq_enabled - Test whether NCQ is enabled
1696 return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF | in ata_ncq_enabled()
1702 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) && in ata_fpdma_dsm_supported()
1703 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] & in ata_fpdma_dsm_supported()
1709 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) && in ata_fpdma_read_log_supported()
1710 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_RD_LOG_OFFSET] & in ata_fpdma_read_log_supported()
1716 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) && in ata_fpdma_zac_mgmt_in_supported()
1717 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_ZAC_MGMT_OFFSET] & in ata_fpdma_zac_mgmt_in_supported()
1723 return (dev->ncq_non_data_cmds[ATA_LOG_NCQ_NON_DATA_ZAC_MGMT_OFFSET] & in ata_fpdma_zac_mgmt_out_supported()
1729 qc->tf.ctl |= ATA_NIEN; in ata_qc_set_polling()
1736 return &ap->qcmd[tag]; in __ata_qc_from_tag()
1745 if (unlikely(!qc) || !ap->ops->error_handler) in ata_qc_from_tag()
1748 if ((qc->flags & (ATA_QCFLAG_ACTIVE | in ata_qc_from_tag()
1757 return qc->nbytes - min(qc->extrabytes, qc->nbytes); in ata_qc_raw_nbytes()
1765 tf->ctl = dev->link->ap->ctl; in ata_tf_init()
1767 tf->ctl = ATA_DEVCTL_OBS; in ata_tf_init()
1769 if (dev->devno == 0) in ata_tf_init()
1770 tf->device = ATA_DEVICE_OBS; in ata_tf_init()
1772 tf->device = ATA_DEVICE_OBS | ATA_DEV1; in ata_tf_init()
1777 qc->dma_dir = DMA_NONE; in ata_qc_reinit()
1778 qc->sg = NULL; in ata_qc_reinit()
1779 qc->flags = 0; in ata_qc_reinit()
1780 qc->cursg = NULL; in ata_qc_reinit()
1781 qc->cursg_ofs = 0; in ata_qc_reinit()
1782 qc->nbytes = qc->extrabytes = qc->curbytes = 0; in ata_qc_reinit()
1783 qc->n_elem = 0; in ata_qc_reinit()
1784 qc->err_mask = 0; in ata_qc_reinit()
1785 qc->sect_size = ATA_SECT_SIZE; in ata_qc_reinit()
1787 ata_tf_init(qc->dev, &qc->tf); in ata_qc_reinit()
1790 qc->result_tf.command = ATA_DRDY; in ata_qc_reinit()
1791 qc->result_tf.feature = 0; in ata_qc_reinit()
1796 return ata_id_wcache_enabled(dev->id) || in ata_try_flush_cache()
1797 ata_id_has_flush(dev->id) || in ata_try_flush_cache()
1798 ata_id_has_flush_ext(dev->id); in ata_try_flush_cache()
1820 return *(struct ata_port **)&host->hostdata[0]; in ata_shost_to_port()
1830 return -ENODEV; in ata_check_ready()
1847 if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4) in ata_using_mwdma()
1854 if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7) in ata_using_udma()
1861 return (adev->dma_mode == 0xFF ? 0 : 1); in ata_dma_enabled()
1865 * PATA timings - drivers/ata/libata-pata-timings.c
1875 * PMP - drivers/ata/libata-pmp.c
1894 * SFF - drivers/ata/libata-sff.c
1928 unsigned long delay);
1929 extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay);
2003 * ata_sff_busy_wait - Wait for a port status register
2022 status = ap->ops->sff_check_status(ap); in ata_sff_busy_wait()
2023 max--; in ata_sff_busy_wait()
2030 * ata_wait_idle - Wait for a port to be idle.
2033 * Waits up to 10ms for port's BUSY and DRQ signals to clear.