Linux Kernel
3.7.1
|
#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 |
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) |
#define ATA_BASE_SHT | ( | drv_name | ) |
#define ata_dev_dbg | ( | dev, | |
fmt, | |||
... | |||
) | ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__) |
#define ata_dev_notice | ( | dev, | |
fmt, | |||
... | |||
) | ata_dev_printk(dev, KERN_NOTICE, fmt, ##__VA_ARGS__) |
#define ata_dev_warn | ( | dev, | |
fmt, | |||
... | |||
) | ata_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__) |
#define ATA_DEVICE_CLEAR_BEGIN offsetof(struct ata_device, n_sectors) |
#define ATA_DEVICE_CLEAR_END offsetof(struct ata_device, ering) |
#define ata_link_dbg | ( | link, | |
fmt, | |||
... | |||
) | ata_link_printk(link, KERN_DEBUG, fmt, ##__VA_ARGS__) |
#define ata_link_notice | ( | link, | |
fmt, | |||
... | |||
) | ata_link_printk(link, KERN_NOTICE, fmt, ##__VA_ARGS__) |
#define ata_link_warn | ( | link, | |
fmt, | |||
... | |||
) | ata_link_printk(link, KERN_WARNING, fmt, ##__VA_ARGS__) |
#define ata_msg_ctl | ( | p | ) | ((p)->msg_enable & ATA_MSG_CTL) |
#define ata_msg_drv | ( | p | ) | ((p)->msg_enable & ATA_MSG_DRV) |
#define ata_msg_err | ( | p | ) | ((p)->msg_enable & ATA_MSG_ERR) |
#define ata_msg_info | ( | p | ) | ((p)->msg_enable & ATA_MSG_INFO) |
#define ata_msg_intr | ( | p | ) | ((p)->msg_enable & ATA_MSG_INTR) |
#define ata_msg_malloc | ( | p | ) | ((p)->msg_enable & ATA_MSG_MALLOC) |
#define ata_msg_probe | ( | p | ) | ((p)->msg_enable & ATA_MSG_PROBE) |
#define ata_msg_warn | ( | p | ) | ((p)->msg_enable & ATA_MSG_WARN) |
#define ATA_NCQ_SHT | ( | drv_name | ) |
#define ata_port_dbg | ( | ap, | |
fmt, | |||
... | |||
) | ata_port_printk(ap, KERN_DEBUG, fmt, ##__VA_ARGS__) |
#define ata_port_err | ( | ap, | |
fmt, | |||
... | |||
) | ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__) |
#define ata_port_info | ( | ap, | |
fmt, | |||
... | |||
) | ata_port_printk(ap, KERN_INFO, fmt, ##__VA_ARGS__) |
#define ata_port_notice | ( | ap, | |
fmt, | |||
... | |||
) | ata_port_printk(ap, KERN_NOTICE, fmt, ##__VA_ARGS__) |
#define ata_port_warn | ( | ap, | |
fmt, | |||
... | |||
) | ata_port_printk(ap, KERN_WARNING, fmt, ##__VA_ARGS__) |
#define sata_pmp_error_handler ata_std_error_handler |
#define sata_pmp_port_ops sata_port_ops |
#define sata_pmp_qc_defer_cmd_switch ata_std_qc_defer |
typedef void(* ata_qc_cb_t)(struct ata_queued_cmd *qc) |
anonymous enum |
anonymous enum |
enum ata_dev_iter_mode |
enum ata_link_iter_mode |
enum ata_lpm_hints |
enum ata_lpm_policy |
enum ata_xfer_mask |
enum hsm_task_states |
enum sw_activity |
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 | ( | 3 | , |
4 | |||
) | const |
__printf | ( | 2 | , |
3 | |||
) |
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.
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.
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.
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.
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.
|
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.
|
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.
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.
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.
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.
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.
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.
|
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.
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.
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.
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.
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.
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.
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.
|
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.
Definition at line 3501 of file libata-eh.c.
ata_link_offline - test whether the given link is offline ATA link to test
Definition at line 5267 of file libata-core.c.
ata_link_online - test whether the given link is online ATA link to test
Definition at line 5241 of file libata-core.c.
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.
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.
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.
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.
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.
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.
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.
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.
Definition at line 6608 of file libata-core.c.
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.
|
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.
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.
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.
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.
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.
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.
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 | ) |
Definition at line 711 of file libata-scsi.c.
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.
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.
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.
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.
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.
ata_std_prereset - prepare for reset ATA link to be reset : deadline jiffies for the operation
Definition at line 3680 of file libata-core.c.
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.
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.
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.
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.
|
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.
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.
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.
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.
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.
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 | ||
) |
sata_link_debounce - debounce SATA phy status ATA link to debounce SATA phy status for : timing parameters { interval, duratinon, timeout } in msec : deadline jiffies for the operation
Definition at line 3478 of file libata-core.c.
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
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.
sata_scr_read - read SCR register of the specified port ATA link to read SCR for : SCR to read : Place to store read value
Definition at line 5107 of file libata-core.c.
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.
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.
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.
sata_set_spd - set SATA spd according to spd limit Link to set SATA spd for
Definition at line 2845 of file libata-core.c.
Definition at line 3834 of file libata-core.c.
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 |
Definition at line 76 of file libata-core.c.
Definition at line 77 of file libata-core.c.
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.