Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
libata.h File Reference
#include <linux/delay.h>
#include <linux/jiffies.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
#include <linux/scatterlist.h>
#include <linux/io.h>
#include <linux/ata.h>
#include <linux/workqueue.h>
#include <scsi/scsi_host.h>
#include <linux/acpi.h>
#include <linux/cdrom.h>
#include <linux/sched.h>
#include <asm-generic/libata-portmap.h>

Go to the source code of this file.

Data Structures

struct  ata_host
 
struct  ata_queued_cmd
 
struct  ata_port_stats
 
struct  ata_ering_entry
 
struct  ata_ering
 
struct  ata_device
 
struct  ata_eh_info
 
struct  ata_eh_context
 
struct  ata_acpi_drive
 
struct  ata_acpi_gtm
 
struct  ata_link
 
struct  ata_port
 
struct  ata_port_operations
 
struct  ata_port_info
 
struct  ata_timing
 

Macros

#define DPRINTK(fmt, args...)
 
#define VPRINTK(fmt, args...)
 
#define BPRINTK(fmt, args...)   if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
 
#define ata_print_version_once(dev, version)
 
#define HAVE_LIBATA_MSG   1
 
#define ata_msg_drv(p)   ((p)->msg_enable & ATA_MSG_DRV)
 
#define ata_msg_info(p)   ((p)->msg_enable & ATA_MSG_INFO)
 
#define ata_msg_probe(p)   ((p)->msg_enable & ATA_MSG_PROBE)
 
#define ata_msg_warn(p)   ((p)->msg_enable & ATA_MSG_WARN)
 
#define ata_msg_malloc(p)   ((p)->msg_enable & ATA_MSG_MALLOC)
 
#define ata_msg_ctl(p)   ((p)->msg_enable & ATA_MSG_CTL)
 
#define ata_msg_intr(p)   ((p)->msg_enable & ATA_MSG_INTR)
 
#define ata_msg_err(p)   ((p)->msg_enable & ATA_MSG_ERR)
 
#define ATA_TAG_POISON   0xfafbfcfdU
 
#define ATA_DEVICE_CLEAR_BEGIN   offsetof(struct ata_device, n_sectors)
 
#define ATA_DEVICE_CLEAR_END   offsetof(struct ata_device, ering)
 
#define ATA_LINK_CLEAR_BEGIN   offsetof(struct ata_link, active_tag)
 
#define ATA_LINK_CLEAR_END   offsetof(struct ata_link, device[0])
 
#define ATA_OP_NULL   (void *)(unsigned long)(-ENOENT)
 
#define ATA_BASE_SHT(drv_name)
 
#define ATA_NCQ_SHT(drv_name)
 
#define ata_port_err(ap, fmt,...)   ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)
 
#define ata_port_warn(ap, fmt,...)   ata_port_printk(ap, KERN_WARNING, fmt, ##__VA_ARGS__)
 
#define ata_port_notice(ap, fmt,...)   ata_port_printk(ap, KERN_NOTICE, fmt, ##__VA_ARGS__)
 
#define ata_port_info(ap, fmt,...)   ata_port_printk(ap, KERN_INFO, fmt, ##__VA_ARGS__)
 
#define ata_port_dbg(ap, fmt,...)   ata_port_printk(ap, KERN_DEBUG, fmt, ##__VA_ARGS__)
 
#define ata_link_err(link, fmt,...)   ata_link_printk(link, KERN_ERR, fmt, ##__VA_ARGS__)
 
#define ata_link_warn(link, fmt,...)   ata_link_printk(link, KERN_WARNING, fmt, ##__VA_ARGS__)
 
#define ata_link_notice(link, fmt,...)   ata_link_printk(link, KERN_NOTICE, fmt, ##__VA_ARGS__)
 
#define ata_link_info(link, fmt,...)   ata_link_printk(link, KERN_INFO, fmt, ##__VA_ARGS__)
 
#define ata_link_dbg(link, fmt,...)   ata_link_printk(link, KERN_DEBUG, fmt, ##__VA_ARGS__)
 
#define ata_dev_err(dev, fmt,...)   ata_dev_printk(dev, KERN_ERR, fmt, ##__VA_ARGS__)
 
#define ata_dev_warn(dev, fmt,...)   ata_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)
 
#define ata_dev_notice(dev, fmt,...)   ata_dev_printk(dev, KERN_NOTICE, fmt, ##__VA_ARGS__)
 
#define ata_dev_info(dev, fmt,...)   ata_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
 
#define ata_dev_dbg(dev, fmt,...)   ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)
 
#define ata_for_each_link(link, ap, mode)
 
#define ata_for_each_dev(dev, link, mode)
 
#define sata_pmp_port_ops   sata_port_ops
 
#define sata_pmp_qc_defer_cmd_switch   ata_std_qc_defer
 
#define sata_pmp_error_handler   ata_std_error_handler
 

Typedefs

typedef void(* ata_qc_cb_t )(struct ata_queued_cmd *qc)
 
typedef int(* ata_prereset_fn_t )(struct ata_link *link, unsigned long deadline)
 
typedef int(* ata_reset_fn_t )(struct ata_link *link, unsigned int *classes, unsigned long deadline)
 
typedef void(* ata_postreset_fn_t )(struct ata_link *link, unsigned int *classes)
 

Enumerations

enum  {
  ATA_MSG_DRV = 0x0001, ATA_MSG_INFO = 0x0002, ATA_MSG_PROBE = 0x0004, ATA_MSG_WARN = 0x0008,
  ATA_MSG_MALLOC = 0x0010, ATA_MSG_CTL = 0x0020, ATA_MSG_INTR = 0x0040, ATA_MSG_ERR = 0x0080
}
 
enum  {
  LIBATA_MAX_PRD = ATA_MAX_PRD / 2, LIBATA_DUMB_MAX_PRD = ATA_MAX_PRD / 4, ATA_DEF_QUEUE = 1, ATA_MAX_QUEUE = 32,
  ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, ATA_SHORT_PAUSE = 16, ATAPI_MAX_DRAIN = 16 << 10, ATA_ALL_DEVICES = (1 << ATA_MAX_DEVICES) - 1,
  ATA_SHT_EMULATED = 1, ATA_SHT_CMD_PER_LUN = 1, ATA_SHT_THIS_ID = -1, ATA_SHT_USE_CLUSTERING = 1,
  ATA_DFLAG_LBA = (1 << 0), ATA_DFLAG_LBA48 = (1 << 1), ATA_DFLAG_CDB_INTR = (1 << 2), ATA_DFLAG_NCQ = (1 << 3),
  ATA_DFLAG_FLUSH_EXT = (1 << 4), ATA_DFLAG_ACPI_PENDING = (1 << 5), ATA_DFLAG_ACPI_FAILED = (1 << 6), ATA_DFLAG_AN = (1 << 7),
  ATA_DFLAG_DMADIR = (1 << 10), ATA_DFLAG_CFG_MASK = (1 << 12) - 1, ATA_DFLAG_PIO = (1 << 12), ATA_DFLAG_NCQ_OFF = (1 << 13),
  ATA_DFLAG_SLEEPING = (1 << 15), ATA_DFLAG_DUBIOUS_XFER = (1 << 16), ATA_DFLAG_NO_UNLOAD = (1 << 17), ATA_DFLAG_UNLOCK_HPA = (1 << 18),
  ATA_DFLAG_INIT_MASK = (1 << 24) - 1, ATA_DFLAG_DETACH = (1 << 24), ATA_DFLAG_DETACHED = (1 << 25), ATA_DFLAG_DA = (1 << 26),
  ATA_DFLAG_DEVSLP = (1 << 27), ATA_DEV_UNKNOWN = 0, ATA_DEV_ATA = 1, ATA_DEV_ATA_UNSUP = 2,
  ATA_DEV_ATAPI = 3, ATA_DEV_ATAPI_UNSUP = 4, ATA_DEV_PMP = 5, ATA_DEV_PMP_UNSUP = 6,
  ATA_DEV_SEMB = 7, ATA_DEV_SEMB_UNSUP = 8, ATA_DEV_NONE = 9, ATA_LFLAG_NO_HRST = (1 << 1),
  ATA_LFLAG_NO_SRST = (1 << 2), ATA_LFLAG_ASSUME_ATA = (1 << 3), ATA_LFLAG_ASSUME_SEMB = (1 << 4), ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB,
  ATA_LFLAG_NO_RETRY = (1 << 5), ATA_LFLAG_DISABLED = (1 << 6), ATA_LFLAG_SW_ACTIVITY = (1 << 7), ATA_LFLAG_NO_LPM = (1 << 8),
  ATA_LFLAG_RST_ONCE = (1 << 9), ATA_FLAG_SLAVE_POSS = (1 << 0), ATA_FLAG_SATA = (1 << 1), ATA_FLAG_NO_ATAPI = (1 << 6),
  ATA_FLAG_PIO_DMA = (1 << 7), ATA_FLAG_PIO_LBA48 = (1 << 8), ATA_FLAG_PIO_POLLING = (1 << 9), ATA_FLAG_NCQ = (1 << 10),
  ATA_FLAG_NO_POWEROFF_SPINDOWN = (1 << 11), ATA_FLAG_NO_HIBERNATE_SPINDOWN = (1 << 12), ATA_FLAG_DEBUGMSG = (1 << 13), ATA_FLAG_FPDMA_AA = (1 << 14),
  ATA_FLAG_IGN_SIMPLEX = (1 << 15), ATA_FLAG_NO_IORDY = (1 << 16), ATA_FLAG_ACPI_SATA = (1 << 17), ATA_FLAG_AN = (1 << 18),
  ATA_FLAG_PMP = (1 << 19), ATA_FLAG_EM = (1 << 21), ATA_FLAG_SW_ACTIVITY = (1 << 22), ATA_FLAG_NO_DIPM = (1 << 23),
  ATA_PFLAG_EH_PENDING = (1 << 0), ATA_PFLAG_EH_IN_PROGRESS = (1 << 1), ATA_PFLAG_FROZEN = (1 << 2), ATA_PFLAG_RECOVERED = (1 << 3),
  ATA_PFLAG_LOADING = (1 << 4), ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), ATA_PFLAG_INITIALIZING = (1 << 7), ATA_PFLAG_RESETTING = (1 << 8),
  ATA_PFLAG_UNLOADING = (1 << 9), ATA_PFLAG_UNLOADED = (1 << 10), ATA_PFLAG_SUSPENDED = (1 << 17), ATA_PFLAG_PM_PENDING = (1 << 18),
  ATA_PFLAG_INIT_GTM_VALID = (1 << 19), ATA_PFLAG_PIO32 = (1 << 20), ATA_PFLAG_PIO32CHANGE = (1 << 21), ATA_QCFLAG_ACTIVE = (1 << 0),
  ATA_QCFLAG_DMAMAP = (1 << 1), ATA_QCFLAG_IO = (1 << 3), ATA_QCFLAG_RESULT_TF = (1 << 4), ATA_QCFLAG_CLEAR_EXCL = (1 << 5),
  ATA_QCFLAG_QUIET = (1 << 6), ATA_QCFLAG_RETRY = (1 << 7), ATA_QCFLAG_FAILED = (1 << 16), ATA_QCFLAG_SENSE_VALID = (1 << 17),
  ATA_QCFLAG_EH_SCHEDULED = (1 << 18), ATA_HOST_SIMPLEX = (1 << 0), ATA_HOST_STARTED = (1 << 1), ATA_HOST_PARALLEL_SCAN = (1 << 2),
  ATA_HOST_IGNORE_ATA = (1 << 3), ATA_TMOUT_BOOT = 30000, ATA_TMOUT_BOOT_QUICK = 7000, ATA_TMOUT_INTERNAL_QUICK = 5000,
  ATA_TMOUT_MAX_PARK = 30000, ATA_TMOUT_FF_WAIT_LONG = 2000, ATA_TMOUT_FF_WAIT = 800, ATA_WAIT_AFTER_RESET = 150,
  ATA_TMOUT_PMP_SRST_WAIT = 5000, BUS_UNKNOWN = 0, BUS_DMA = 1, BUS_IDLE = 2,
  BUS_NOINTR = 3, BUS_NODATA = 4, BUS_TIMER = 5, BUS_PIO = 6,
  BUS_EDD = 7, BUS_IDENTIFY = 8, BUS_PACKET = 9, PORT_UNKNOWN = 0,
  PORT_ENABLED = 1, PORT_DISABLED = 2, ATA_NR_PIO_MODES = 7, ATA_NR_MWDMA_MODES = 5,
  ATA_NR_UDMA_MODES = 8, ATA_SHIFT_PIO = 0, ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES, ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES,
  ATA_DMA_PAD_SZ = 4, ATA_ERING_SIZE = 32, ATA_DEFER_LINK = 1, ATA_DEFER_PORT = 2,
  ATA_EH_DESC_LEN = 80, ATA_EH_REVALIDATE = (1 << 0), ATA_EH_SOFTRESET = (1 << 1), ATA_EH_HARDRESET = (1 << 2),
  ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, ATA_EH_ENABLE_LINK = (1 << 3), ATA_EH_PARK = (1 << 5), ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK,
  ATA_EH_ALL_ACTIONS, ATA_EHI_HOTPLUGGED = (1 << 0), ATA_EHI_NO_AUTOPSY = (1 << 2), ATA_EHI_QUIET = (1 << 3),
  ATA_EHI_NO_RECOVERY = (1 << 4), ATA_EHI_DID_SOFTRESET = (1 << 16), ATA_EHI_DID_HARDRESET = (1 << 17), ATA_EHI_PRINTINFO = (1 << 18),
  ATA_EHI_SETMODE = (1 << 19), ATA_EHI_POST_SETMODE = (1 << 20), ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, ATA_EHI_TO_SLAVE_MASK = ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET,
  ATA_EH_MAX_TRIES = 5, ATA_LINK_RESUME_TRIES = 5, ATA_PROBE_MAX_TRIES = 3, ATA_EH_DEV_TRIES = 3,
  ATA_EH_PMP_TRIES = 5, ATA_EH_PMP_LINK_TRIES = 3, SATA_PMP_RW_TIMEOUT = 3000, ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6,
  ATA_HORKAGE_DIAGNOSTIC = (1 << 0), ATA_HORKAGE_NODMA = (1 << 1), ATA_HORKAGE_NONCQ = (1 << 2), ATA_HORKAGE_MAX_SEC_128 = (1 << 3),
  ATA_HORKAGE_BROKEN_HPA = (1 << 4), ATA_HORKAGE_DISABLE = (1 << 5), ATA_HORKAGE_HPA_SIZE = (1 << 6), ATA_HORKAGE_IVB = (1 << 8),
  ATA_HORKAGE_STUCK_ERR = (1 << 9), ATA_HORKAGE_BRIDGE_OK = (1 << 10), ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), ATA_HORKAGE_FIRMWARE_WARN = (1 << 12),
  ATA_HORKAGE_1_5_GBPS = (1 << 13), ATA_HORKAGE_NOSETXFER = (1 << 14), ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), ATA_HORKAGE_DUMP_ID = (1 << 16),
  ATA_DMA_MASK_ATA = (1 << 0), ATA_DMA_MASK_ATAPI = (1 << 1), ATA_DMA_MASK_CFA = (1 << 2), ATAPI_READ = 0,
  ATAPI_WRITE = 1, ATAPI_READ_CD = 2, ATAPI_PASS_THRU = 3, ATAPI_MISC = 4,
  ATA_TIMING_SETUP = (1 << 0), ATA_TIMING_ACT8B = (1 << 1), ATA_TIMING_REC8B = (1 << 2), ATA_TIMING_CYC8B = (1 << 3),
  ATA_TIMING_8BIT, ATA_TIMING_ACTIVE = (1 << 4), ATA_TIMING_RECOVER = (1 << 5), ATA_TIMING_DMACK_HOLD = (1 << 6),
  ATA_TIMING_CYCLE = (1 << 7), ATA_TIMING_UDMA = (1 << 8), ATA_TIMING_ALL, ATA_ACPI_FILTER_SETXFER = 1 << 0,
  ATA_ACPI_FILTER_LOCK = 1 << 1, ATA_ACPI_FILTER_DIPM = 1 << 2, ATA_ACPI_FILTER_FPDMA_OFFSET = 1 << 3, ATA_ACPI_FILTER_FPDMA_AA = 1 << 4,
  ATA_ACPI_FILTER_DEFAULT
}
 
enum  ata_xfer_mask { ATA_MASK_PIO, ATA_MASK_MWDMA, ATA_MASK_UDMA }
 
enum  hsm_task_states {
  HSM_ST_IDLE, HSM_ST_FIRST, HSM_ST, HSM_ST_LAST,
  HSM_ST_ERR
}
 
enum  ata_completion_errors {
  AC_ERR_DEV = (1 << 0), AC_ERR_HSM = (1 << 1), AC_ERR_TIMEOUT = (1 << 2), AC_ERR_MEDIA = (1 << 3),
  AC_ERR_ATA_BUS = (1 << 4), AC_ERR_HOST_BUS = (1 << 5), AC_ERR_SYSTEM = (1 << 6), AC_ERR_INVALID = (1 << 7),
  AC_ERR_OTHER = (1 << 8), AC_ERR_NODEV_HINT = (1 << 9), AC_ERR_NCQ = (1 << 10)
}
 
enum  ata_lpm_policy { ATA_LPM_UNKNOWN, ATA_LPM_MAX_POWER, ATA_LPM_MED_POWER, ATA_LPM_MIN_POWER }
 
enum  ata_lpm_hints { ATA_LPM_EMPTY = (1 << 0), ATA_LPM_HIPM = (1 << 1) }
 
enum  sw_activity { OFF, BLINK_ON, BLINK_OFF }
 
enum  ata_link_iter_mode { ATA_LITER_EDGE, ATA_LITER_HOST_FIRST, ATA_LITER_PMP_FIRST }
 
enum  ata_dev_iter_mode { ATA_DITER_ENABLED, ATA_DITER_ENABLED_REVERSE, ATA_DITER_ALL, ATA_DITER_ALL_REVERSE }
 

Functions

int sata_set_spd (struct ata_link *link)
 
int ata_std_prereset (struct ata_link *link, unsigned long deadline)
 
int ata_wait_after_reset (struct ata_link *link, unsigned long deadline, int(*check_ready)(struct ata_link *link))
 
int sata_link_debounce (struct ata_link *link, const unsigned long *params, unsigned long deadline)
 
int sata_link_resume (struct ata_link *link, const unsigned long *params, unsigned long deadline)
 
int sata_link_scr_lpm (struct ata_link *link, enum ata_lpm_policy policy, bool spm_wakeup)
 
int sata_link_hardreset (struct ata_link *link, const unsigned long *timing, unsigned long deadline, bool *online, int(*check_ready)(struct ata_link *))
 
int sata_std_hardreset (struct ata_link *link, unsigned int *class, unsigned long deadline)
 
void ata_std_postreset (struct ata_link *link, unsigned int *classes)
 
struct ata_hostata_host_alloc (struct device *dev, int max_ports)
 
struct ata_hostata_host_alloc_pinfo (struct device *dev, const struct ata_port_info *const *ppi, int n_ports)
 
int ata_slave_link_init (struct ata_port *ap)
 
int ata_host_start (struct ata_host *host)
 
int ata_host_register (struct ata_host *host, struct scsi_host_template *sht)
 
int ata_host_activate (struct ata_host *host, int irq, irq_handler_t irq_handler, unsigned long irq_flags, struct scsi_host_template *sht)
 
void ata_host_detach (struct ata_host *host)
 
void ata_host_init (struct ata_host *, struct device *, struct ata_port_operations *)
 
int ata_scsi_detect (struct scsi_host_template *sht)
 
int ata_scsi_ioctl (struct scsi_device *dev, int cmd, void __user *arg)
 
int ata_scsi_queuecmd (struct Scsi_Host *h, struct scsi_cmnd *cmd)
 
int ata_sas_scsi_ioctl (struct ata_port *ap, struct scsi_device *dev, int cmd, void __user *arg)
 
void ata_sas_port_destroy (struct ata_port *)
 
struct ata_portata_sas_port_alloc (struct ata_host *, struct ata_port_info *, struct Scsi_Host *)
 
void ata_sas_async_probe (struct ata_port *ap)
 
int ata_sas_sync_probe (struct ata_port *ap)
 
int ata_sas_port_init (struct ata_port *)
 
int ata_sas_port_start (struct ata_port *ap)
 
void ata_sas_port_stop (struct ata_port *ap)
 
int ata_sas_slave_configure (struct scsi_device *, struct ata_port *)
 
int ata_sas_queuecmd (struct scsi_cmnd *cmd, struct ata_port *ap)
 
int sata_scr_valid (struct ata_link *link)
 
int sata_scr_read (struct ata_link *link, int reg, u32 *val)
 
int sata_scr_write (struct ata_link *link, int reg, u32 val)
 
int sata_scr_write_flush (struct ata_link *link, int reg, u32 val)
 
bool ata_link_online (struct ata_link *link)
 
bool ata_link_offline (struct ata_link *link)
 
int ata_ratelimit (void)
 
void ata_msleep (struct ata_port *ap, unsigned int msecs)
 
u32 ata_wait_register (struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, unsigned long interval, unsigned long timeout)
 
int atapi_cmd_type (u8 opcode)
 
void ata_tf_to_fis (const struct ata_taskfile *tf, u8 pmp, int is_cmd, u8 *fis)
 
void ata_tf_from_fis (const u8 *fis, struct ata_taskfile *tf)
 
unsigned long ata_pack_xfermask (unsigned long pio_mask, unsigned long mwdma_mask, unsigned long udma_mask)
 
void ata_unpack_xfermask (unsigned long xfer_mask, unsigned long *pio_mask, unsigned long *mwdma_mask, unsigned long *udma_mask)
 
u8 ata_xfer_mask2mode (unsigned long xfer_mask)
 
unsigned long ata_xfer_mode2mask (u8 xfer_mode)
 
int ata_xfer_mode2shift (unsigned long xfer_mode)
 
const charata_mode_string (unsigned long xfer_mask)
 
unsigned long ata_id_xfermask (const u16 *id)
 
int ata_std_qc_defer (struct ata_queued_cmd *qc)
 
void ata_noop_qc_prep (struct ata_queued_cmd *qc)
 
void ata_sg_init (struct ata_queued_cmd *qc, struct scatterlist *sg, unsigned int n_elem)
 
unsigned int ata_dev_classify (const struct ata_taskfile *tf)
 
void ata_dev_disable (struct ata_device *adev)
 
void ata_id_string (const u16 *id, unsigned char *s, unsigned int ofs, unsigned int len)
 
void ata_id_c_string (const u16 *id, unsigned char *s, unsigned int ofs, unsigned int len)
 
unsigned int ata_do_dev_read_id (struct ata_device *dev, struct ata_taskfile *tf, u16 *id)
 
void ata_qc_complete (struct ata_queued_cmd *qc)
 
int ata_qc_complete_multiple (struct ata_port *ap, u32 qc_active)
 
void ata_scsi_simulate (struct ata_device *dev, struct scsi_cmnd *cmd)
 
int ata_std_bios_param (struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int geom[])
 
void ata_scsi_unlock_native_capacity (struct scsi_device *sdev)
 
int ata_scsi_slave_config (struct scsi_device *sdev)
 
void ata_scsi_slave_destroy (struct scsi_device *sdev)
 
int ata_scsi_change_queue_depth (struct scsi_device *sdev, int queue_depth, int reason)
 
int __ata_change_queue_depth (struct ata_port *ap, struct scsi_device *sdev, int queue_depth, int reason)
 
struct ata_deviceata_dev_pair (struct ata_device *adev)
 
int ata_do_set_mode (struct ata_link *link, struct ata_device **r_failed_dev)
 
void ata_scsi_port_error_handler (struct Scsi_Host *host, struct ata_port *ap)
 
void ata_scsi_cmd_error_handler (struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q)
 
int ata_cable_40wire (struct ata_port *ap)
 
int ata_cable_80wire (struct ata_port *ap)
 
int ata_cable_sata (struct ata_port *ap)
 
int ata_cable_ignore (struct ata_port *ap)
 
int ata_cable_unknown (struct ata_port *ap)
 
unsigned int ata_pio_need_iordy (const struct ata_device *)
 
struct ata_timingata_timing_find_mode (u8 xfer_mode)
 
int ata_timing_compute (struct ata_device *, unsigned short, struct ata_timing *, int, int)
 
void ata_timing_merge (const struct ata_timing *, const struct ata_timing *, struct ata_timing *, unsigned int)
 
u8 ata_timing_cycle2mode (unsigned int xfer_shift, int cycle)
 
void ata_port_schedule_eh (struct ata_port *ap)
 
void ata_port_wait_eh (struct ata_port *ap)
 
int ata_link_abort (struct ata_link *link)
 
int ata_port_abort (struct ata_port *ap)
 
int ata_port_freeze (struct ata_port *ap)
 
int sata_async_notification (struct ata_port *ap)
 
void ata_eh_freeze_port (struct ata_port *ap)
 
void ata_eh_thaw_port (struct ata_port *ap)
 
void ata_eh_qc_complete (struct ata_queued_cmd *qc)
 
void ata_eh_qc_retry (struct ata_queued_cmd *qc)
 
void ata_eh_analyze_ncq_error (struct ata_link *link)
 
void ata_do_eh (struct ata_port *ap, ata_prereset_fn_t prereset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
 
void ata_std_error_handler (struct ata_port *ap)
 
void ata_std_sched_eh (struct ata_port *ap)
 
void ata_std_end_eh (struct ata_port *ap)
 
int ata_link_nr_enabled (struct ata_link *link)
 
 __printf (3, 4) int ata_port_printk(const struct ata_port *ap
 
void ata_print_version (const struct device *dev, const char *version)
 
 __printf (2, 3) void __ata_ehi_push_desc(struct ata_eh_info *ehi
 
const char const char void ata_ehi_clear_desc (struct ata_eh_info *ehi)
 
struct ata_linkata_link_next (struct ata_link *link, struct ata_port *ap, enum ata_link_iter_mode mode)
 
struct ata_deviceata_dev_next (struct ata_device *dev, struct ata_link *link, enum ata_dev_iter_mode mode)
 

Variables

struct device_attribute dev_attr_link_power_management_policy
 
struct device_attribute dev_attr_unload_heads
 
struct device_attribute dev_attr_em_message_type
 
struct device_attribute dev_attr_em_message
 
struct device_attribute dev_attr_sw_activity
 
struct ata_acpi_drive __packed
 
const unsigned long sata_deb_timing_normal []
 
const unsigned long sata_deb_timing_hotplug []
 
const unsigned long sata_deb_timing_long []
 
struct ata_port_operations ata_dummy_port_ops
 
struct ata_port_info ata_dummy_port_info
 
struct ata_port_operations ata_base_port_ops
 
struct ata_port_operations sata_port_ops
 
struct device_attributeata_common_sdev_attrs []
 
const charlevel
 
const char const charfmt
 

Macro Definition Documentation

#define ATA_BASE_SHT (   drv_name)
Value:
.module = THIS_MODULE, \
.name = drv_name, \
.ioctl = ata_scsi_ioctl, \
.queuecommand = ata_scsi_queuecmd, \
.can_queue = ATA_DEF_QUEUE, \
.this_id = ATA_SHT_THIS_ID, \
.cmd_per_lun = ATA_SHT_CMD_PER_LUN, \
.emulated = ATA_SHT_EMULATED, \
.use_clustering = ATA_SHT_USE_CLUSTERING, \
.proc_name = drv_name, \
.slave_configure = ata_scsi_slave_config, \
.slave_destroy = ata_scsi_slave_destroy, \
.bios_param = ata_std_bios_param, \
.unlock_native_capacity = ata_scsi_unlock_native_capacity, \
.sdev_attrs = ata_common_sdev_attrs

Definition at line 1215 of file libata.h.

#define ata_dev_dbg (   dev,
  fmt,
  ... 
)    ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)

Definition at line 1321 of file libata.h.

#define ata_dev_err (   dev,
  fmt,
  ... 
)    ata_dev_printk(dev, KERN_ERR, fmt, ##__VA_ARGS__)

Definition at line 1313 of file libata.h.

#define ata_dev_info (   dev,
  fmt,
  ... 
)    ata_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)

Definition at line 1319 of file libata.h.

#define ata_dev_notice (   dev,
  fmt,
  ... 
)    ata_dev_printk(dev, KERN_NOTICE, fmt, ##__VA_ARGS__)

Definition at line 1317 of file libata.h.

#define ata_dev_warn (   dev,
  fmt,
  ... 
)    ata_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)

Definition at line 1315 of file libata.h.

#define ATA_DEVICE_CLEAR_BEGIN   offsetof(struct ata_device, n_sectors)

Definition at line 666 of file libata.h.

#define ATA_DEVICE_CLEAR_END   offsetof(struct ata_device, ering)

Definition at line 667 of file libata.h.

#define ata_for_each_dev (   dev,
  link,
  mode 
)
Value:
for ((dev) = ata_dev_next(NULL, (link), ATA_DITER_##mode); (dev); \
(dev) = ata_dev_next((dev), (link), ATA_DITER_##mode))

Definition at line 1466 of file libata.h.

#define ata_for_each_link (   link,
  ap,
  mode 
)
Value:
for ((link) = ata_link_next(NULL, (ap), ATA_LITER_##mode); (link); \
(link) = ata_link_next((link), (ap), ATA_LITER_##mode))

Definition at line 1462 of file libata.h.

#define ATA_LINK_CLEAR_BEGIN   offsetof(struct ata_link, active_tag)

Definition at line 731 of file libata.h.

#define ATA_LINK_CLEAR_END   offsetof(struct ata_link, device[0])

Definition at line 732 of file libata.h.

#define ata_link_dbg (   link,
  fmt,
  ... 
)    ata_link_printk(link, KERN_DEBUG, fmt, ##__VA_ARGS__)

Definition at line 1310 of file libata.h.

#define ata_link_err (   link,
  fmt,
  ... 
)    ata_link_printk(link, KERN_ERR, fmt, ##__VA_ARGS__)

Definition at line 1302 of file libata.h.

#define ata_link_info (   link,
  fmt,
  ... 
)    ata_link_printk(link, KERN_INFO, fmt, ##__VA_ARGS__)

Definition at line 1308 of file libata.h.

#define ata_link_notice (   link,
  fmt,
  ... 
)    ata_link_printk(link, KERN_NOTICE, fmt, ##__VA_ARGS__)

Definition at line 1306 of file libata.h.

#define ata_link_warn (   link,
  fmt,
  ... 
)    ata_link_printk(link, KERN_WARNING, fmt, ##__VA_ARGS__)

Definition at line 1304 of file libata.h.

#define ata_msg_ctl (   p)    ((p)->msg_enable & ATA_MSG_CTL)

Definition at line 106 of file libata.h.

#define ata_msg_drv (   p)    ((p)->msg_enable & ATA_MSG_DRV)

Definition at line 101 of file libata.h.

#define ata_msg_err (   p)    ((p)->msg_enable & ATA_MSG_ERR)

Definition at line 108 of file libata.h.

#define ata_msg_info (   p)    ((p)->msg_enable & ATA_MSG_INFO)

Definition at line 102 of file libata.h.

#define ata_msg_intr (   p)    ((p)->msg_enable & ATA_MSG_INTR)

Definition at line 107 of file libata.h.

#define ata_msg_malloc (   p)    ((p)->msg_enable & ATA_MSG_MALLOC)

Definition at line 105 of file libata.h.

#define ata_msg_probe (   p)    ((p)->msg_enable & ATA_MSG_PROBE)

Definition at line 103 of file libata.h.

#define ata_msg_warn (   p)    ((p)->msg_enable & ATA_MSG_WARN)

Definition at line 104 of file libata.h.

#define ATA_NCQ_SHT (   drv_name)
Value:
ATA_BASE_SHT(drv_name), \
.change_queue_depth = ata_scsi_change_queue_depth

Definition at line 1232 of file libata.h.

#define ATA_OP_NULL   (void *)(unsigned long)(-ENOENT)

Definition at line 814 of file libata.h.

#define ata_port_dbg (   ap,
  fmt,
  ... 
)    ata_port_printk(ap, KERN_DEBUG, fmt, ##__VA_ARGS__)

Definition at line 1299 of file libata.h.

#define ata_port_err (   ap,
  fmt,
  ... 
)    ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)

Definition at line 1291 of file libata.h.

#define ata_port_info (   ap,
  fmt,
  ... 
)    ata_port_printk(ap, KERN_INFO, fmt, ##__VA_ARGS__)

Definition at line 1297 of file libata.h.

#define ata_port_notice (   ap,
  fmt,
  ... 
)    ata_port_printk(ap, KERN_NOTICE, fmt, ##__VA_ARGS__)

Definition at line 1295 of file libata.h.

#define ata_port_warn (   ap,
  fmt,
  ... 
)    ata_port_printk(ap, KERN_WARNING, fmt, ##__VA_ARGS__)

Definition at line 1293 of file libata.h.

#define ata_print_version_once (   dev,
  version 
)
Value:
({ \
static bool __print_once; \
if (!__print_once) { \
__print_once = true; \
ata_print_version(dev, version); \
} \
})

Definition at line 77 of file libata.h.

#define ATA_TAG_POISON   0xfafbfcfdU

Definition at line 120 of file libata.h.

#define BPRINTK (   fmt,
  args... 
)    if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)

Definition at line 75 of file libata.h.

#define DPRINTK (   fmt,
  args... 
)

Definition at line 71 of file libata.h.

#define HAVE_LIBATA_MSG   1

Definition at line 88 of file libata.h.

#define sata_pmp_error_handler   ata_std_error_handler

Definition at line 1637 of file libata.h.

#define sata_pmp_port_ops   sata_port_ops

Definition at line 1635 of file libata.h.

#define sata_pmp_qc_defer_cmd_switch   ata_std_qc_defer

Definition at line 1636 of file libata.h.

#define VPRINTK (   fmt,
  args... 
)

Definition at line 72 of file libata.h.

Typedef Documentation

typedef void(* ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes)

Definition at line 504 of file libata.h.

typedef int(* ata_prereset_fn_t)(struct ata_link *link, unsigned long deadline)

Definition at line 501 of file libata.h.

typedef void(* ata_qc_cb_t)(struct ata_queued_cmd *qc)

Definition at line 500 of file libata.h.

typedef int(* ata_reset_fn_t)(struct ata_link *link, unsigned int *classes, unsigned long deadline)

Definition at line 502 of file libata.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
ATA_MSG_DRV 
ATA_MSG_INFO 
ATA_MSG_PROBE 
ATA_MSG_WARN 
ATA_MSG_MALLOC 
ATA_MSG_CTL 
ATA_MSG_INTR 
ATA_MSG_ERR 

Definition at line 90 of file libata.h.

anonymous enum
Enumerator:
LIBATA_MAX_PRD 
LIBATA_DUMB_MAX_PRD 
ATA_DEF_QUEUE 
ATA_MAX_QUEUE 
ATA_TAG_INTERNAL 
ATA_SHORT_PAUSE 
ATAPI_MAX_DRAIN 
ATA_ALL_DEVICES 
ATA_SHT_EMULATED 
ATA_SHT_CMD_PER_LUN 
ATA_SHT_THIS_ID 
ATA_SHT_USE_CLUSTERING 
ATA_DFLAG_LBA 
ATA_DFLAG_LBA48 
ATA_DFLAG_CDB_INTR 
ATA_DFLAG_NCQ 
ATA_DFLAG_FLUSH_EXT 
ATA_DFLAG_ACPI_PENDING 
ATA_DFLAG_ACPI_FAILED 
ATA_DFLAG_AN 
ATA_DFLAG_DMADIR 
ATA_DFLAG_CFG_MASK 
ATA_DFLAG_PIO 
ATA_DFLAG_NCQ_OFF 
ATA_DFLAG_SLEEPING 
ATA_DFLAG_DUBIOUS_XFER 
ATA_DFLAG_NO_UNLOAD 
ATA_DFLAG_UNLOCK_HPA 
ATA_DFLAG_INIT_MASK 
ATA_DFLAG_DETACH 
ATA_DFLAG_DETACHED 
ATA_DFLAG_DA 
ATA_DFLAG_DEVSLP 
ATA_DEV_UNKNOWN 
ATA_DEV_ATA 
ATA_DEV_ATA_UNSUP 
ATA_DEV_ATAPI 
ATA_DEV_ATAPI_UNSUP 
ATA_DEV_PMP 
ATA_DEV_PMP_UNSUP 
ATA_DEV_SEMB 
ATA_DEV_SEMB_UNSUP 
ATA_DEV_NONE 
ATA_LFLAG_NO_HRST 
ATA_LFLAG_NO_SRST 
ATA_LFLAG_ASSUME_ATA 
ATA_LFLAG_ASSUME_SEMB 
ATA_LFLAG_ASSUME_CLASS 
ATA_LFLAG_NO_RETRY 
ATA_LFLAG_DISABLED 
ATA_LFLAG_SW_ACTIVITY 
ATA_LFLAG_NO_LPM 
ATA_LFLAG_RST_ONCE 
ATA_FLAG_SLAVE_POSS 
ATA_FLAG_SATA 
ATA_FLAG_NO_ATAPI 
ATA_FLAG_PIO_DMA 
ATA_FLAG_PIO_LBA48 
ATA_FLAG_PIO_POLLING 
ATA_FLAG_NCQ 
ATA_FLAG_NO_POWEROFF_SPINDOWN 
ATA_FLAG_NO_HIBERNATE_SPINDOWN 
ATA_FLAG_DEBUGMSG 
ATA_FLAG_FPDMA_AA 
ATA_FLAG_IGN_SIMPLEX 
ATA_FLAG_NO_IORDY 
ATA_FLAG_ACPI_SATA 
ATA_FLAG_AN 
ATA_FLAG_PMP 
ATA_FLAG_EM 
ATA_FLAG_SW_ACTIVITY 
ATA_FLAG_NO_DIPM 
ATA_PFLAG_EH_PENDING 
ATA_PFLAG_EH_IN_PROGRESS 
ATA_PFLAG_FROZEN 
ATA_PFLAG_RECOVERED 
ATA_PFLAG_LOADING 
ATA_PFLAG_SCSI_HOTPLUG 
ATA_PFLAG_INITIALIZING 
ATA_PFLAG_RESETTING 
ATA_PFLAG_UNLOADING 
ATA_PFLAG_UNLOADED 
ATA_PFLAG_SUSPENDED 
ATA_PFLAG_PM_PENDING 
ATA_PFLAG_INIT_GTM_VALID 
ATA_PFLAG_PIO32 
ATA_PFLAG_PIO32CHANGE 
ATA_QCFLAG_ACTIVE 
ATA_QCFLAG_DMAMAP 
ATA_QCFLAG_IO 
ATA_QCFLAG_RESULT_TF 
ATA_QCFLAG_CLEAR_EXCL 
ATA_QCFLAG_QUIET 
ATA_QCFLAG_RETRY 
ATA_QCFLAG_FAILED 
ATA_QCFLAG_SENSE_VALID 
ATA_QCFLAG_EH_SCHEDULED 
ATA_HOST_SIMPLEX 
ATA_HOST_STARTED 
ATA_HOST_PARALLEL_SCAN 
ATA_HOST_IGNORE_ATA 
ATA_TMOUT_BOOT 
ATA_TMOUT_BOOT_QUICK 
ATA_TMOUT_INTERNAL_QUICK 
ATA_TMOUT_MAX_PARK 
ATA_TMOUT_FF_WAIT_LONG 
ATA_TMOUT_FF_WAIT 
ATA_WAIT_AFTER_RESET 
ATA_TMOUT_PMP_SRST_WAIT 
BUS_UNKNOWN 
BUS_DMA 
BUS_IDLE 
BUS_NOINTR 
BUS_NODATA 
BUS_TIMER 
BUS_PIO 
BUS_EDD 
BUS_IDENTIFY 
BUS_PACKET 
PORT_UNKNOWN 
PORT_ENABLED 
PORT_DISABLED 
ATA_NR_PIO_MODES 
ATA_NR_MWDMA_MODES 
ATA_NR_UDMA_MODES 
ATA_SHIFT_PIO 
ATA_SHIFT_MWDMA 
ATA_SHIFT_UDMA 
ATA_DMA_PAD_SZ 
ATA_ERING_SIZE 
ATA_DEFER_LINK 
ATA_DEFER_PORT 
ATA_EH_DESC_LEN 
ATA_EH_REVALIDATE 
ATA_EH_SOFTRESET 
ATA_EH_HARDRESET 
ATA_EH_RESET 
ATA_EH_ENABLE_LINK 
ATA_EH_PARK 
ATA_EH_PERDEV_MASK 
ATA_EH_ALL_ACTIONS 
ATA_EHI_HOTPLUGGED 
ATA_EHI_NO_AUTOPSY 
ATA_EHI_QUIET 
ATA_EHI_NO_RECOVERY 
ATA_EHI_DID_SOFTRESET 
ATA_EHI_DID_HARDRESET 
ATA_EHI_PRINTINFO 
ATA_EHI_SETMODE 
ATA_EHI_POST_SETMODE 
ATA_EHI_DID_RESET 
ATA_EHI_TO_SLAVE_MASK 
ATA_EH_MAX_TRIES 
ATA_LINK_RESUME_TRIES 
ATA_PROBE_MAX_TRIES 
ATA_EH_DEV_TRIES 
ATA_EH_PMP_TRIES 
ATA_EH_PMP_LINK_TRIES 
SATA_PMP_RW_TIMEOUT 
ATA_EH_CMD_TIMEOUT_TABLE_SIZE 
ATA_HORKAGE_DIAGNOSTIC 
ATA_HORKAGE_NODMA 
ATA_HORKAGE_NONCQ 
ATA_HORKAGE_MAX_SEC_128 
ATA_HORKAGE_BROKEN_HPA 
ATA_HORKAGE_DISABLE 
ATA_HORKAGE_HPA_SIZE 
ATA_HORKAGE_IVB 
ATA_HORKAGE_STUCK_ERR 
ATA_HORKAGE_BRIDGE_OK 
ATA_HORKAGE_ATAPI_MOD16_DMA 
ATA_HORKAGE_FIRMWARE_WARN 
ATA_HORKAGE_1_5_GBPS 
ATA_HORKAGE_NOSETXFER 
ATA_HORKAGE_BROKEN_FPDMA_AA 
ATA_HORKAGE_DUMP_ID 
ATA_DMA_MASK_ATA 
ATA_DMA_MASK_ATAPI 
ATA_DMA_MASK_CFA 
ATAPI_READ 
ATAPI_WRITE 
ATAPI_READ_CD 
ATAPI_PASS_THRU 
ATAPI_MISC 
ATA_TIMING_SETUP 
ATA_TIMING_ACT8B 
ATA_TIMING_REC8B 
ATA_TIMING_CYC8B 
ATA_TIMING_8BIT 
ATA_TIMING_ACTIVE 
ATA_TIMING_RECOVER 
ATA_TIMING_DMACK_HOLD 
ATA_TIMING_CYCLE 
ATA_TIMING_UDMA 
ATA_TIMING_ALL 
ATA_ACPI_FILTER_SETXFER 
ATA_ACPI_FILTER_LOCK 
ATA_ACPI_FILTER_DIPM 
ATA_ACPI_FILTER_FPDMA_OFFSET 
ATA_ACPI_FILTER_FPDMA_AA 
ATA_ACPI_FILTER_DEFAULT 

Definition at line 122 of file libata.h.

Enumerator:
AC_ERR_DEV 
AC_ERR_HSM 
AC_ERR_TIMEOUT 
AC_ERR_MEDIA 
AC_ERR_ATA_BUS 
AC_ERR_HOST_BUS 
AC_ERR_SYSTEM 
AC_ERR_INVALID 
AC_ERR_OTHER 
AC_ERR_NODEV_HINT 
AC_ERR_NCQ 

Definition at line 462 of file libata.h.

Enumerator:
ATA_DITER_ENABLED 
ATA_DITER_ENABLED_REVERSE 
ATA_DITER_ALL 
ATA_DITER_ALL_REVERSE 

Definition at line 1433 of file libata.h.

Enumerator:
ATA_LITER_EDGE 
ATA_LITER_HOST_FIRST 
ATA_LITER_PMP_FIRST 

Definition at line 1425 of file libata.h.

Enumerator:
ATA_LPM_EMPTY 
ATA_LPM_HIPM 

Definition at line 487 of file libata.h.

Enumerator:
ATA_LPM_UNKNOWN 
ATA_LPM_MAX_POWER 
ATA_LPM_MED_POWER 
ATA_LPM_MIN_POWER 

Definition at line 480 of file libata.h.

Enumerator:
ATA_MASK_PIO 
ATA_MASK_MWDMA 
ATA_MASK_UDMA 

Definition at line 444 of file libata.h.

Enumerator:
HSM_ST_IDLE 
HSM_ST_FIRST 
HSM_ST 
HSM_ST_LAST 
HSM_ST_ERR 

Definition at line 453 of file libata.h.

Enumerator:
OFF 
BLINK_ON 
BLINK_OFF 

Definition at line 512 of file libata.h.

Function Documentation

int __ata_change_queue_depth ( struct ata_port ap,
struct scsi_device sdev,
int  queue_depth,
int  reason 
)

__ata_change_queue_depth - helper for ata_scsi_change_queue_depth : ATA port to which the device change the queue depth : SCSI device to configure queue depth for : new queue depth : calling context

libsas and libata have different approaches for associating a sdev to its ata_port.

Definition at line 1231 of file libata-scsi.c.

__printf ( ,
 
) const
__printf ( ,
 
)
int ata_cable_40wire ( struct ata_port ap)

ata_cable_40wire - return 40 wire cable type : port

Helper method for drivers which want to hardwire 40 wire cable detection.

Definition at line 2474 of file libata-core.c.

int ata_cable_80wire ( struct ata_port ap)

ata_cable_80wire - return 80 wire cable type : port

Helper method for drivers which want to hardwire 80 wire cable detection.

Definition at line 2487 of file libata-core.c.

int ata_cable_ignore ( struct ata_port ap)

ata_cable_ignore - return ignored PATA cable. : port

Helper method for drivers which don't use cable type to limit transfer mode.

Definition at line 2511 of file libata-core.c.

int ata_cable_sata ( struct ata_port ap)

ata_cable_sata - return SATA cable type : port

Helper method for drivers which have SATA cables

Definition at line 2523 of file libata-core.c.

int ata_cable_unknown ( struct ata_port ap)

ata_cable_unknown - return unknown PATA cable. : port

Helper method for drivers which have no PATA cable detection.

Definition at line 2499 of file libata-core.c.

unsigned int ata_dev_classify ( const struct ata_taskfile tf)

ata_dev_classify - determine device type based on ATA-spec signature : ATA taskfile register set for device to be identified

Determine from taskfile register contents whether a device is ATA or ATAPI, as per "Signature and persistence" section of ATA/PI spec (volume 1, sect 5.14).

LOCKING: None.

RETURNS: Device type, ATA_DEV_ATA, ATA_DEV_ATAPI, ATA_DEV_PMP or ATA_DEV_UNKNOWN the event of failure.

Definition at line 1047 of file libata-core.c.

void ata_dev_disable ( struct ata_device dev)

ata_dev_disable - disable ATA device : ATA device to disable

Disable .

Locking: EH context.

Definition at line 1345 of file libata-eh.c.

struct ata_device* ata_dev_next ( struct ata_device dev,
struct ata_link link,
enum ata_dev_iter_mode  mode 
)
read

ata_dev_next - device iteration helper : the previous device, NULL to start ATA link containing devices to iterate : iteration mode, one of ATA_DITER_*

LOCKING: Host lock or EH context.

RETURNS: Pointer to the next device.

Definition at line 248 of file libata-core.c.

struct ata_device* ata_dev_pair ( struct ata_device adev)
read

ata_dev_pair - return other device on cable : device

Obtain the other device on the same cable, or if none is present NULL is returned

Definition at line 2699 of file libata-core.c.

unsigned int ata_do_dev_read_id ( struct ata_device dev,
struct ata_taskfile tf,
u16 id 
)

ata_do_dev_read_id - default ID read method : device : proposed taskfile : data buffer

Issue the identify taskfile and hand back the buffer containing identify data. For some RAID controllers and for pre ATA devices this function is wrapped or replaced by the driver

Definition at line 1834 of file libata-core.c.

void ata_do_eh ( struct ata_port ap,
ata_prereset_fn_t  prereset,
ata_reset_fn_t  softreset,
ata_reset_fn_t  hardreset,
ata_postreset_fn_t  postreset 
)

ata_do_eh - do standard error handling : host port to handle error for

: prereset method (can be NULL) : softreset method (can be NULL) : hardreset method (can be NULL) : postreset method (can be NULL)

Perform standard error handling sequence.

LOCKING: Kernel thread context (may sleep).

Definition at line 3969 of file libata-eh.c.

int ata_do_set_mode ( struct ata_link link,
struct ata_device **  r_failed_dev 
)

ata_do_set_mode - Program timings and issue SET FEATURES - XFER link on which timings will be programmed : out parameter for failed device

Standard implementation of the function used to tune and set ATA device disk transfer mode (PIO3, UDMA6, etc.). If ata_dev_set_mode() fails, pointer to the failing device is returned in .

LOCKING: PCI/etc. bus probe sem.

RETURNS: 0 on success, negative errno otherwise

Definition at line 3265 of file libata-core.c.

void ata_eh_analyze_ncq_error ( struct ata_link link)

ata_eh_analyze_ncq_error - analyze NCQ error ATA link to analyze NCQ error for

Read log page 10h, determine the offending qc and acquire error status TF. For NCQ device errors, all LLDDs have to do is setting AC_ERR_DEV in ehi->err_mask. This function takes care of the rest.

LOCKING: Kernel thread context (may sleep).

Definition at line 1727 of file libata-eh.c.

void ata_eh_freeze_port ( struct ata_port ap)

ata_eh_freeze_port - EH helper to freeze port : ATA port to freeze

Freeze .

LOCKING: None.

Definition at line 1243 of file libata-eh.c.

void ata_eh_qc_complete ( struct ata_queued_cmd qc)

ata_eh_qc_complete - Complete an active ATA command from EH : Command to complete

Indicate to the mid and upper layers that an ATA command has completed. To be used from EH.

Definition at line 1310 of file libata-eh.c.

void ata_eh_qc_retry ( struct ata_queued_cmd qc)

ata_eh_qc_retry - Tell midlayer to retry an ATA command after EH : Command to retry

Indicate to the mid and upper layers that an ATA command should be retried. To be used from EH.

SCSI midlayer limits the number of retries to scmd->allowed. scmd->retries is decremented for commands which get retried due to unrelated failures (qc->err_mask is zero).

Definition at line 1328 of file libata-eh.c.

void ata_eh_thaw_port ( struct ata_port ap)

ata_port_thaw_port - EH helper to thaw port : ATA port to thaw

Thaw frozen port .

LOCKING: None.

Definition at line 1264 of file libata-eh.c.

const char const char void ata_ehi_clear_desc ( struct ata_eh_info ehi)

ata_ehi_clear_desc - clean error description : target EHI

Clear ->desc.

LOCKING: spin_lock_irqsave(host lock)

Definition at line 235 of file libata-eh.c.

int ata_host_activate ( struct ata_host host,
int  irq,
irq_handler_t  irq_handler,
unsigned long  irq_flags,
struct scsi_host_template sht 
)

ata_host_activate - start host, request IRQ and register it : target ATA host : IRQ to request : irq_handler used when requesting IRQ : irq_flags used when requesting IRQ : scsi_host_template to use when registering the host

After allocating an ATA host and initializing it, most libata LLDs perform three steps to activate the host - start host, request IRQ and register it. This helper takes necessasry arguments and performs the three steps in one go.

An invalid IRQ skips the IRQ registration and expects the host to have set polling mode on the port. In this case, should be NULL.

LOCKING: Inherited from calling layer (may sleep).

RETURNS: 0 on success, -errno otherwise.

Definition at line 6178 of file libata-core.c.

struct ata_host* ata_host_alloc ( struct device dev,
int  max_ports 
)
read

ata_host_alloc - allocate and init basic ATA host resources : generic device this host is associated with : maximum number of ATA ports associated with this host

Allocate and initialize basic ATA host resources. LLD calls this function to allocate a host, initializes it fully and attaches it using ata_host_register().

ports are allocated and host->n_ports is initialized to . The caller is allowed to decrease host->n_ports before calling ata_host_register(). The unused ports will be automatically freed on registration.

RETURNS: Allocate ATA host on success, NULL on failure.

LOCKING: Inherited from calling layer (may sleep).

Definition at line 5683 of file libata-core.c.

struct ata_host* ata_host_alloc_pinfo ( struct device dev,
const struct ata_port_info *const ppi,
int  n_ports 
)
read

ata_host_alloc_pinfo - alloc host and init with port_info array : generic device this host is associated with : array of ATA port_info to initialize host with : number of ATA ports attached to this host

Allocate ATA host and initialize with info from . If NULL terminated, may contain fewer entries than . The last entry will be used for the remaining ports.

RETURNS: Allocate ATA host on success, NULL on failure.

LOCKING: Inherited from calling layer (may sleep).

Definition at line 5745 of file libata-core.c.

void ata_host_detach ( struct ata_host host)

ata_host_detach - Detach all ports of an ATA host : Host to detach

Detach all ports of .

LOCKING: Kernel thread context (may sleep).

Definition at line 6263 of file libata-core.c.

void ata_host_init ( struct ata_host host,
struct device dev,
struct ata_port_operations ops 
)

ata_sas_host_init - Initialize a host struct for sas (ipr, libsas) : host to initialize : device host is attached to : port_ops

Definition at line 5994 of file libata-core.c.

int ata_host_register ( struct ata_host host,
struct scsi_host_template sht 
)

ata_host_register - register initialized ATA host : ATA host to register : template for SCSI host

Register initialized ATA host. is allocated using ata_host_alloc() and fully initialized by LLD. This function starts ports, registers with ATA and SCSI layers and probe registered devices.

LOCKING: Inherited from calling layer (may sleep).

RETURNS: 0 on success, -errno otherwise.

Definition at line 6076 of file libata-core.c.

int ata_host_start ( struct ata_host host)

ata_host_start - start and freeze ports of an ATA host : ATA host to start ports for

Start and then freeze ports of . Started status is recorded in host->flags, so this function can be called multiple times. Ports are guaranteed to get started only once. If host->ops isn't initialized yet, its set to the first non-dummy port ops.

LOCKING: Inherited from calling layer (may sleep).

RETURNS: 0 if all ports are started successfully, -errno otherwise.

Definition at line 5923 of file libata-core.c.

void ata_id_c_string ( const u16 id,
unsigned char s,
unsigned int  ofs,
unsigned int  len 
)

ata_id_c_string - Convert IDENTIFY DEVICE page into C string : IDENTIFY DEVICE results we will examine : string into which data is output : offset into identify device page : length of string to return. must be an odd number.

This function is identical to ata_id_string except that it trims trailing spaces and terminates the resulting string with null. must be actual maximum length (even number) + 1.

LOCKING: caller.

Definition at line 1144 of file libata-core.c.

void ata_id_string ( const u16 id,
unsigned char s,
unsigned int  ofs,
unsigned int  len 
)

ata_id_string - Convert IDENTIFY DEVICE page into string : IDENTIFY DEVICE results we will examine : string into which data is output : offset into identify device page : length of string to return. must be an even number.

The strings in the IDENTIFY DEVICE page are broken up into 16-bit chunks. Run through the string, and output each 8-bit chunk linearly, regardless of platform.

LOCKING: caller.

Definition at line 1109 of file libata-core.c.

unsigned long ata_id_xfermask ( const u16 id)

ata_id_xfermask - Compute xfermask from the given IDENTIFY data : IDENTIFY data to compute xfer mask from

Compute the xfermask for this device. This is not as trivial as it seems if we must consider early devices correctly.

FIXME: pre IDE drive timing (do we care ?).

LOCKING: None.

RETURNS: Computed xfermask

Definition at line 1460 of file libata-core.c.

int ata_link_abort ( struct ata_link link)

ata_link_abort - abort all qc's on the link ATA link to abort qc's for

Abort all active qc's active on schedule EH. LOCKING: spin_lock_irqsave(host lock) RETURNS: Number of aborted qc's.

Definition at line 1083 of file libata-eh.c.

struct ata_link* ata_link_next ( struct ata_link link,
struct ata_port ap,
enum ata_link_iter_mode  mode 
)
read

ata_link_next - link iteration helper the previous link, NULL to start : ATA port containing links to iterate : iteration mode, one of ATA_LITER_*

LOCKING: Host lock or EH context.

RETURNS: Pointer to the next link.

Definition at line 189 of file libata-core.c.

int ata_link_nr_enabled ( struct ata_link link)

Definition at line 3501 of file libata-eh.c.

bool ata_link_offline ( struct ata_link link)
bool ata_link_online ( struct ata_link link)
const char* ata_mode_string ( unsigned long  xfer_mask)

ata_mode_string - convert xfer_mask to string : mask of bits supported; only highest bit counts.

Determine string which represents the highest speed (highest bit in ).

LOCKING: None.

RETURNS: Constant C string representing highest speed listed in , or the constant C string "<n/a>".

Definition at line 987 of file libata-core.c.

void ata_msleep ( struct ata_port ap,
unsigned int  msecs 
)

ata_msleep - ATA EH owner aware msleep : ATA port to attribute the sleep to : duration to sleep in milliseconds

Sleeps . If the current task is owner of 's EH, the ownership is released before going to sleep and reacquired after the sleep is complete. IOW, other ports sharing the ->host will be allowed to own the EH while this task is sleeping.

LOCKING: Might sleep.

Definition at line 6627 of file libata-core.c.

void ata_noop_qc_prep ( struct ata_queued_cmd qc)

Definition at line 4630 of file libata-core.c.

unsigned long ata_pack_xfermask ( unsigned long  pio_mask,
unsigned long  mwdma_mask,
unsigned long  udma_mask 
)

ata_pack_xfermask - Pack pio, mwdma and udma masks into xfer_mask : pio_mask : mwdma_mask : udma_mask

Pack , and into a single unsigned int xfer_mask.

LOCKING: None.

RETURNS: Packed xfer_mask.

Definition at line 864 of file libata-core.c.

unsigned int ata_pio_need_iordy ( const struct ata_device adev)

ata_pio_need_iordy - check if iordy needed : ATA device

Check if the current speed of the device requires IORDY. Used by various controllers for chip configuration.

Definition at line 1775 of file libata-core.c.

int ata_port_abort ( struct ata_port ap)

ata_port_abort - abort all qc's on the port : ATA port to abort qc's for

Abort all active qc's of and schedule EH.

LOCKING: spin_lock_irqsave(host_set lock)

RETURNS: Number of aborted qc's.

Definition at line 1100 of file libata-eh.c.

int ata_port_freeze ( struct ata_port ap)

ata_port_freeze - abort & freeze port : ATA port to freeze

Abort and freeze . The freeze operation must be called first, because some hardware requires special operations before the taskfile registers are accessible.

LOCKING: spin_lock_irqsave(host lock)

RETURNS: Number of aborted commands.

Definition at line 1149 of file libata-eh.c.

void ata_port_schedule_eh ( struct ata_port ap)

ata_port_schedule_eh - schedule error handling without a qc : ATA port to schedule EH for

Schedule error handling for . EH will kick in as soon as all commands are drained.

LOCKING: spin_lock_irqsave(host lock)

Definition at line 1040 of file libata-eh.c.

void ata_port_wait_eh ( struct ata_port ap)

ata_port_wait_eh - Wait for the currently pending EH to complete : Port to wait EH for

Wait until the currently pending EH is complete.

LOCKING: Kernel thread context (may sleep).

Definition at line 842 of file libata-eh.c.

void ata_print_version ( const struct device dev,
const char version 
)

Definition at line 6781 of file libata-core.c.

void ata_qc_complete ( struct ata_queued_cmd qc)

ata_qc_complete - Complete an active ATA command : Command to complete

Indicate to the mid and upper layers that an ATA command has completed, with either an ok or not-ok status.

Refrain from calling this function multiple times when successfully completing multiple NCQ commands. ata_qc_complete_multiple() should be used instead, which will properly update IRQ expect state.

LOCKING: spin_lock_irqsave(host lock)

Definition at line 4863 of file libata-core.c.

int ata_qc_complete_multiple ( struct ata_port ap,
u32  qc_active 
)

ata_qc_complete_multiple - Complete multiple qcs successfully : port in question : new qc_active mask

Complete in-flight commands. This functions is meant to be called from low-level driver's interrupt routine to complete requests normally. ap->qc_active and is compared and commands are completed accordingly.

Always use this function when completing multiple NCQ commands from IRQ handlers instead of calling ata_qc_complete() multiple times to keep IRQ expect status properly in sync.

LOCKING: spin_lock_irqsave(host lock)

RETURNS: Number of completed commands on success, -errno otherwise.

Definition at line 4970 of file libata-core.c.

int ata_ratelimit ( void  )

Definition at line 6608 of file libata-core.c.

void ata_sas_async_probe ( struct ata_port ap)

ata_sas_async_probe - simply schedule probing and return : Port to probe

For batch scheduling of probe for sas attached ata devices, assumes the port has already been through ata_sas_port_init()

Definition at line 4063 of file libata-scsi.c.

struct ata_port* ata_sas_port_alloc ( struct ata_host host,
struct ata_port_info port_info,
struct Scsi_Host shost 
)
read

ata_sas_port_alloc - Allocate port for a SAS attached SATA device : ATA host container for all SAS ports : Information from low-level host driver : SCSI host that the scsi device is attached to

LOCKING: PCI/etc. bus probe sem.

RETURNS: ata_port pointer on success / NULL on failure.

Definition at line 3994 of file libata-scsi.c.

void ata_sas_port_destroy ( struct ata_port ap)

ata_sas_port_destroy - Destroy a SATA port allocated by ata_sas_port_alloc : SATA port to destroy

Definition at line 4104 of file libata-scsi.c.

int ata_sas_port_init ( struct ata_port ap)

ata_sas_port_init - Initialize a SATA device : SATA port to initialize

LOCKING: PCI/etc. bus probe sem.

RETURNS: Zero on success, non-zero on error.

Definition at line 4087 of file libata-scsi.c.

int ata_sas_port_start ( struct ata_port ap)

ata_sas_port_start - Set port up for dma. : Port to initialize

Called just after data structures for each port are initialized.

May be used as the port_start() entry in ata_port_operations.

LOCKING: Inherited from caller.

Definition at line 4029 of file libata-scsi.c.

void ata_sas_port_stop ( struct ata_port ap)

ata_port_stop - Undo ata_sas_port_start() : Port to shut down

May be used as the port_stop() entry in ata_port_operations.

LOCKING: Inherited from caller.

Definition at line 4051 of file libata-scsi.c.

int ata_sas_queuecmd ( struct scsi_cmnd cmd,
struct ata_port ap 
)

ata_sas_queuecmd - Issue SCSI cdb to libata-managed device : SCSI command to be sent : ATA port to which the command is being sent

RETURNS: Return value from __ata_scsi_queuecmd() if can be queued, 0 otherwise.

Definition at line 4139 of file libata-scsi.c.

int ata_sas_scsi_ioctl ( struct ata_port ap,
struct scsi_device dev,
int  cmd,
void __user arg 
)

Definition at line 658 of file libata-scsi.c.

int ata_sas_slave_configure ( struct scsi_device sdev,
struct ata_port ap 
)

ata_sas_slave_configure - Default slave_config routine for libata devices : SCSI device to configure : ATA port to which SCSI device is attached

RETURNS: Zero.

Definition at line 4121 of file libata-scsi.c.

int ata_sas_sync_probe ( struct ata_port ap)

Definition at line 4069 of file libata-scsi.c.

int ata_scsi_change_queue_depth ( struct scsi_device sdev,
int  queue_depth,
int  reason 
)

ata_scsi_change_queue_depth - SCSI callback for queue depth config : SCSI device to configure queue depth for : new queue depth : calling context

This is libata standard hostt->change_queue_depth callback. SCSI will call into this callback when user tries to set queue depth via sysfs.

LOCKING: SCSI layer (we don't care)

RETURNS: Newly configured queue depth.

Definition at line 1284 of file libata-scsi.c.

void ata_scsi_cmd_error_handler ( struct Scsi_Host host,
struct ata_port ap,
struct list_head eh_work_q 
)

ata_scsi_cmd_error_handler - error callback for a list of commands : scsi host containing the port : ATA port within the host : list of commands to process

process the given list of commands and return those finished to the ap->eh_done_q. This function is the first part of the libata error handler which processes a given list of failed commands.

Definition at line 622 of file libata-eh.c.

int ata_scsi_detect ( struct scsi_host_template sht)
int ata_scsi_ioctl ( struct scsi_device dev,
int  cmd,
void __user arg 
)

Definition at line 711 of file libata-scsi.c.

void ata_scsi_port_error_handler ( struct Scsi_Host host,
struct ata_port ap 
)

ata_scsi_port_error_handler - recover the port after the commands : SCSI host containing the port : the ATA port

Handle the recovery of the port after all the commands have been recovered.

Definition at line 718 of file libata-eh.c.

int ata_scsi_queuecmd ( struct Scsi_Host shost,
struct scsi_cmnd cmd 
)

ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device : SCSI host of command to be sent : SCSI command to be sent

In some cases, this function translates SCSI commands into ATA taskfiles, and queues the taskfiles to be sent to hardware. In other cases, this function simulates a SCSI device by evaluating and responding to certain SCSI commands. This creates the overall effect of ATA and ATAPI devices appearing as SCSI devices.

LOCKING: ATA host lock

RETURNS: Return value from __ata_scsi_queuecmd() if can be queued, 0 otherwise.

Definition at line 3436 of file libata-scsi.c.

void ata_scsi_simulate ( struct ata_device dev,
struct scsi_cmnd cmd 
)

ata_scsi_simulate - simulate SCSI command on ATA device : the target device : SCSI command being sent to device.

Interprets and directly executes a select list of SCSI commands that can be handled internally.

LOCKING: spin_lock_irqsave(host lock)

Definition at line 3475 of file libata-scsi.c.

int ata_scsi_slave_config ( struct scsi_device sdev)

ata_scsi_slave_config - Set SCSI device attributes : SCSI device to examine

This is called before we actually start reading and writing to the device, to configure certain SCSI mid-layer behaviors.

LOCKING: Defined by SCSI layer. We don't really care.

Definition at line 1167 of file libata-scsi.c.

void ata_scsi_slave_destroy ( struct scsi_device sdev)

ata_scsi_slave_destroy - SCSI device is about to be destroyed : SCSI device to be destroyed

is about to be destroyed for hot/warm unplugging. If this unplugging was initiated by libata as indicated by NULL dev->sdev, this function doesn't have to do anything. Otherwise, SCSI layer initiated warm-unplug is in progress. Clear dev->sdev, schedule the device for ATA detach and invoke EH.

LOCKING: Defined by SCSI layer. We don't really care.

Definition at line 1195 of file libata-scsi.c.

void ata_scsi_unlock_native_capacity ( struct scsi_device sdev)

ata_scsi_unlock_native_capacity - unlock native capacity : SCSI device to adjust device capacity for

This function is called if a partition on extends beyond the end of the device. It requests EH to unlock HPA.

LOCKING: Defined by the SCSI layer. Might sleep.

Definition at line 396 of file libata-scsi.c.

void ata_sg_init ( struct ata_queued_cmd qc,
struct scatterlist sg,
unsigned int  n_elem 
)

ata_sg_init - Associate command with scatter-gather table. : Command to be associated : Scatter-gather table. : Number of elements in s/g table.

Initialize the data-related elements of queued_cmd to point to a scatter-gather table , containing elements.

LOCKING: spin_lock_irqsave(host lock)

Definition at line 4645 of file libata-core.c.

int ata_slave_link_init ( struct ata_port ap)

ata_slave_link_init - initialize slave link : port to initialize slave link for

Create and initialize slave link for . This enables slave link handling on the port.

In libata, a port contains links and a link contains devices. There is single host link but if a PMP is attached to it, there can be multiple fan-out links. On SATA, there's usually a single device connected to a link but PATA and SATA controllers emulating TF based interface can have two - master and slave.

However, there are a few controllers which don't fit into this abstraction too well - SATA controllers which emulate TF interface with both master and slave devices but also have separate SCR register sets for each device. These controllers need separate links for physical link handling (e.g. onlineness, link speed) but should be treated like a traditional M/S controller for everything else (e.g. command issue, softreset).

slave_link is libata's way of handling this class of controllers without impacting core layer too much. For anything other than physical link handling, the default host link is used for both master and slave. For physical link handling, separate ->slave_link is used. All dirty details are implemented inside libata core layer. From LLD's POV, the only difference is that prereset, hardreset and postreset are called once more for the slave link, so the reset sequence looks like the following.

prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) -> softreset(M) -> postreset(M) -> postreset(S)

Note that softreset is called only for the master. Softreset resets both M/S by definition, so SRST on master should handle both (the standard method will work just fine).

LOCKING: Should be called before host is registered.

RETURNS: 0 on success, -errno on failure.

Definition at line 5823 of file libata-core.c.

int ata_std_bios_param ( struct scsi_device sdev,
struct block_device bdev,
sector_t  capacity,
int  geom[] 
)

ata_std_bios_param - generic bios head/sector/cylinder calculator used by sd. : SCSI device for which BIOS geometry is to be determined : block device associated with : capacity of SCSI device : location to which geometry will be output

Generic bios head/sector/cylinder calculator used by sd. Most BIOSes nowadays expect a XXX/255/16 (CHS) mapping. Some situations may arise where the disk is not bootable if this is not used.

LOCKING: Defined by the SCSI layer. We don't really care.

RETURNS: Zero.

Definition at line 375 of file libata-scsi.c.

void ata_std_end_eh ( struct ata_port ap)

ata_std_end_eh - non-libsas ata_ports complete eh with this common routine : ATA port to end EH for

In the libata object model there is a 1:1 mapping of ata_port to shost, so host fields can be directly manipulated under ap->lock, in the libsas case we need to hold a lock at the ha->level to coordinate these events.

LOCKING: spin_lock_irqsave(host lock)

Definition at line 1021 of file libata-eh.c.

void ata_std_error_handler ( struct ata_port ap)

ata_std_error_handler - standard error handler : host port to handle error for

Standard error handler

LOCKING: Kernel thread context (may sleep).

Definition at line 3998 of file libata-eh.c.

void ata_std_postreset ( struct ata_link link,
unsigned int classes 
)

ata_std_postreset - standard postreset callback the target ata_link : classes of attached devices

This function is invoked after a successful reset. Note that the device might have been reset more than once using different reset methods before postreset is invoked.

LOCKING: Kernel thread context (may sleep)

Definition at line 3858 of file libata-core.c.

int ata_std_prereset ( struct ata_link link,
unsigned long  deadline 
)
int ata_std_qc_defer ( struct ata_queued_cmd qc)

ata_std_qc_defer - Check whether a qc needs to be deferred : ATA command in question

Non-NCQ commands cannot run with any other command, NCQ or not. As upper layer only knows the queue depth, we are responsible for maintaining exclusion. This function checks whether a new command can be issued.

LOCKING: spin_lock_irqsave(host lock)

RETURNS: ATA_DEFER_* if deferring is needed, 0 otherwise.

Definition at line 4615 of file libata-core.c.

void ata_std_sched_eh ( struct ata_port ap)

ata_std_sched_eh - non-libsas ata_ports issue eh with this common routine : ATA port to schedule EH for

LOCKING: inherited from ata_port_schedule_eh spin_lock_irqsave(host lock)

Definition at line 995 of file libata-eh.c.

void ata_tf_from_fis ( const u8 fis,
struct ata_taskfile tf 
)

ata_tf_from_fis - Convert SATA FIS to ATA taskfile : Buffer from which data will be input : Taskfile to output

Converts a serial ATA FIS structure to a standard ATA taskfile.

LOCKING: Inherited from caller.

Definition at line 588 of file libata-core.c.

void ata_tf_to_fis ( const struct ata_taskfile tf,
u8  pmp,
int  is_cmd,
u8 fis 
)

ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure : Taskfile to convert : Port multiplier port : This FIS is for command : Buffer into which data will output

Converts a standard ATA taskfile to a Serial ATA FIS structure (Register - Host to Device).

LOCKING: Inherited from caller.

Definition at line 546 of file libata-core.c.

int ata_timing_compute ( struct ata_device ,
unsigned  short,
struct ata_timing ,
int  ,
int   
)

Definition at line 2952 of file libata-core.c.

u8 ata_timing_cycle2mode ( unsigned int  xfer_shift,
int  cycle 
)

ata_timing_cycle2mode - find xfer mode for the specified cycle duration : ATA_SHIFT_* value for transfer type to examine. : cycle duration in ns

Return matching xfer mode for . The returned mode is of the transfer type specified by . If is too slow for , 0xff is returned. If is faster than the fastest known mode, the fasted mode is returned.

LOCKING: None.

RETURNS: Matching xfer_mode, 0xff if no match found.

Definition at line 3044 of file libata-core.c.

struct ata_timing* ata_timing_find_mode ( u8  xfer_mode)
read

Definition at line 2936 of file libata-core.c.

void ata_timing_merge ( const struct ata_timing ,
const struct ata_timing ,
struct ata_timing ,
unsigned  int 
)

Definition at line 2922 of file libata-core.c.

void ata_unpack_xfermask ( unsigned long  xfer_mask,
unsigned long pio_mask,
unsigned long mwdma_mask,
unsigned long udma_mask 
)

ata_unpack_xfermask - Unpack xfer_mask into pio, mwdma and udma masks : xfer_mask to unpack : resulting pio_mask : resulting mwdma_mask : resulting udma_mask

Unpack into , and . Any NULL distination masks will be ignored.

Definition at line 883 of file libata-core.c.

int ata_wait_after_reset ( struct ata_link link,
unsigned long  deadline,
int(*)(struct ata_link *link check_ready 
)

ata_wait_after_reset - wait for link to become ready after reset link to be waited on : deadline jiffies for the operation : callback to check link readiness

Wait for become ready after reset. LOCKING: EH context. RETURNS: 0 if is ready before ; otherwise, -errno.

Definition at line 3448 of file libata-core.c.

u32 ata_wait_register ( struct ata_port ap,
void __iomem reg,
u32  mask,
u32  val,
unsigned long  interval,
unsigned long  timeout 
)

ata_wait_register - wait until register value changes : ATA port to wait register for, can be NULL : IO-mapped register : Mask to apply to read register value : Wait condition : polling interval in milliseconds : timeout in milliseconds

Waiting for some bits of register to change is a common operation for ATA controllers. This function reads 32bit LE IO-mapped register and tests for the following condition.

(* & mask) != val

If the condition is met, it returns; otherwise, the process is repeated after until timeout.

LOCKING: Kernel thread context (may sleep)

RETURNS: The final register value.

Definition at line 6664 of file libata-core.c.

u8 ata_xfer_mask2mode ( unsigned long  xfer_mask)

ata_xfer_mask2mode - Find matching XFER_* for the given xfer_mask : xfer_mask of interest

Return matching XFER_* value for . Only the highest bit of is considered.

LOCKING: None.

RETURNS: Matching XFER_* value, 0xff if no match found.

Definition at line 917 of file libata-core.c.

unsigned long ata_xfer_mode2mask ( u8  xfer_mode)

ata_xfer_mode2mask - Find matching xfer_mask for XFER_* : XFER_* of interest

Return matching xfer_mask for .

LOCKING: None.

RETURNS: Matching xfer_mask, 0 if no match found.

Definition at line 940 of file libata-core.c.

int ata_xfer_mode2shift ( unsigned long  xfer_mode)

ata_xfer_mode2shift - Find matching xfer_shift for XFER_* : XFER_* of interest

Return matching xfer_shift for .

LOCKING: None.

RETURNS: Matching xfer_shift, -1 if no match found.

Definition at line 963 of file libata-core.c.

int atapi_cmd_type ( u8  opcode)

atapi_cmd_type - Determine ATAPI command type from SCSI opcode : SCSI opcode

Determine ATAPI command type from .

LOCKING: None.

RETURNS: ATAPI_{READ|WRITE|READ_CD|PASS_THRU|MISC}

Definition at line 507 of file libata-core.c.

int sata_async_notification ( struct ata_port ap)

sata_async_notification - SATA async notification handler : ATA port where async notification is received

Handler to be called when async notification via SDB FIS is received. This function schedules EH if necessary.

LOCKING: spin_lock_irqsave(host lock)

RETURNS: 1 if EH is scheduled, 0 otherwise.

Definition at line 1174 of file libata-eh.c.

int sata_link_debounce ( struct ata_link link,
const unsigned long params,
unsigned long  deadline 
)
int sata_link_hardreset ( struct ata_link link,
const unsigned long timing,
unsigned long  deadline,
bool online,
int(*)(struct ata_link *)  check_ready 
)

sata_link_hardreset - reset link via SATA phy reset link to reset : timing parameters { interval, duratinon, timeout } in msec : deadline jiffies for the operation : optional out parameter indicating link onlineness : optional callback to check link readiness

SATA phy-reset DET bits of SControl register. After hardreset, link readiness is waited upon using ata_wait_ready() if is specified. LLDs are allowed to not specify and wait itself after this function returns. Device classification is LLD's responsibility. * is set to one iff reset succeeded and is online after reset. LOCKING: Kernel thread context (may sleep) RETURNS: 0 on success, -errno otherwise.

Definition at line 3732 of file libata-core.c.

int sata_link_resume ( struct ata_link link,
const unsigned long params,
unsigned long  deadline 
)

sata_link_resume - resume SATA link ATA link to resume SATA : timing parameters { interval, duratinon, timeout } in msec : deadline jiffies for the operation

Resume SATA phy debounce it. LOCKING: Kernel thread context (may sleep) RETURNS: 0 on success, -errno on failure.

Definition at line 3540 of file libata-core.c.

int sata_link_scr_lpm ( struct ata_link link,
enum ata_lpm_policy  policy,
bool  spm_wakeup 
)

sata_link_scr_lpm - manipulate SControl IPM and SPM fields ATA link to manipulate SControl for : LPM policy to configure : initiate LPM transition to active state

Manipulate the IPM field of the SControl register of to . If is ATA_LPM_MAX_POWER and is true, the SPM field is manipulated to wake up the link. This function also clears PHYRDY_CHG before returning. LOCKING: EH context. RETURNS: 0 on succes, -errno otherwise.

Definition at line 3609 of file libata-core.c.

int sata_scr_read ( struct ata_link link,
int  reg,
u32 val 
)
int sata_scr_valid ( struct ata_link link)

sata_scr_valid - test whether SCRs are accessible ATA link to test SCR accessibility for

Test whether SCRs are accessible for

LOCKING: None.

RETURNS: 1 if SCRs are accessible, 0 otherwise.

Definition at line 5084 of file libata-core.c.

int sata_scr_write ( struct ata_link link,
int  reg,
u32  val 
)

sata_scr_write - write SCR register of the specified port ATA link to write SCR for : SCR to write : value to write

Write to SCR register of This function is guaranteed to succeed if ap->link, the cable type of the port is SATA and the port implements ->scr_read. LOCKING: None if is ap->link. Kernel thread context otherwise. RETURNS: 0 on success, negative errno on failure.

Definition at line 5134 of file libata-core.c.

int sata_scr_write_flush ( struct ata_link link,
int  reg,
u32  val 
)

sata_scr_write_flush - write SCR register of the specified port and flush ATA link to write SCR for : SCR to write : value to write

This function is identical to sata_scr_write() except that this function performs flush after writing to the register.

LOCKING: None if ap->link. Kernel thread context otherwise. RETURNS: 0 on success, negative errno on failure.

Definition at line 5160 of file libata-core.c.

int sata_set_spd ( struct ata_link link)
int sata_std_hardreset ( struct ata_link link,
unsigned int class,
unsigned long  deadline 
)

Definition at line 3834 of file libata-core.c.

Variable Documentation

struct ata_port_operations ata_base_port_ops

Definition at line 79 of file libata-core.c.

struct device_attribute* ata_common_sdev_attrs[]

Definition at line 344 of file libata-scsi.c.

struct ata_port_info ata_dummy_port_info

Definition at line 6707 of file libata-core.c.

struct ata_port_operations ata_dummy_port_ops

Definition at line 6699 of file libata-core.c.

struct device_attribute dev_attr_em_message
struct device_attribute dev_attr_em_message_type
struct device_attribute dev_attr_link_power_management_policy
struct device_attribute dev_attr_sw_activity
struct device_attribute dev_attr_unload_heads
const char* fmt

Definition at line 1282 of file libata.h.

Definition at line 1282 of file libata.h.

const unsigned long sata_deb_timing_hotplug[]

Definition at line 76 of file libata-core.c.

const unsigned long sata_deb_timing_long[]

Definition at line 77 of file libata-core.c.

const unsigned long sata_deb_timing_normal[]

Definition at line 75 of file libata-core.c.

struct ata_port_operations sata_port_ops

Definition at line 87 of file libata-core.c.