Linux Kernel
3.7.1
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/spinlock.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/suspend.h>
#include <linux/workqueue.h>
#include <linux/scatterlist.h>
#include <linux/io.h>
#include <linux/async.h>
#include <linux/log2.h>
#include <linux/slab.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
#include <linux/libata.h>
#include <asm/byteorder.h>
#include <linux/cdrom.h>
#include <linux/ratelimit.h>
#include <linux/pm_runtime.h>
#include "libata.h"
#include "libata-transport.h"
Go to the source code of this file.
Data Structures | |
struct | ata_force_param |
struct | ata_force_ent |
struct | ata_xfer_ent |
struct | ata_blacklist_entry |
Macros | |
#define | ENOUGH(v, unit) (((v)-1)/(unit)+1) |
#define | EZ(v, unit) ((v)?ENOUGH(v, unit):0) |
Variables | |
const unsigned long | sata_deb_timing_normal [] = { 5, 100, 2000 } |
const unsigned long | sata_deb_timing_hotplug [] = { 25, 500, 2000 } |
const unsigned long | sata_deb_timing_long [] = { 100, 2000, 5000 } |
struct ata_port_operations | ata_base_port_ops |
struct ata_port_operations | sata_port_ops |
atomic_t | ata_print_id = ATOMIC_INIT(0) |
int | atapi_passthru16 = 1 |
int | libata_fua = 0 |
int | libata_noacpi = 0 |
int | libata_allow_tpm = 0 |
struct device_type | ata_port_type |
struct ata_port_operations | ata_dummy_port_ops |
struct ata_port_info | ata_dummy_port_info |
Definition at line 6003 of file libata-core.c.
void __ata_qc_complete | ( | struct ata_queued_cmd * | qc | ) |
Definition at line 4788 of file libata-core.c.
int ata_build_rw_tf | ( | struct ata_taskfile * | tf, |
struct ata_device * | dev, | ||
u64 | block, | ||
u32 | n_block, | ||
unsigned int | tf_flags, | ||
unsigned int | tag | ||
) |
ata_build_rw_tf - Build ATA taskfile for given read/write request : Target ATA taskfile : ATA device belongs to : Block address : Number of blocks : RW/FUA etc... : tag
LOCKING: None.
Build ATA taskfile for read/write request described by , , and on .
RETURNS:
0 on success, -ERANGE if the request is too large for , -EINVAL if the request is invalid.
Definition at line 746 of file libata-core.c.
ata_bus_probe - Reset and probe ATA bus : Bus to probe
Master ATA bus probing function. Initiates a hardware-dependent bus reset, then attempts to identify any devices found on the bus.
LOCKING: PCI/etc. bus probe sem.
RETURNS: Zero on success, negative errno otherwise.
Definition at line 2543 of file libata-core.c.
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.
int ata_dev_configure | ( | struct ata_device * | dev | ) |
ata_dev_configure - Configure the specified ATA/ATAPI device : Target device to configure
Configure according to ->id. Generic and low-level driver specific fixups are also applied.
LOCKING: Kernel thread context (may sleep)
RETURNS: 0 on success, -errno otherwise
Definition at line 2151 of file libata-core.c.
void ata_dev_init | ( | struct ata_device * | dev | ) |
ata_dev_init - Initialize an ata_device structure : Device structure to initialize
Initialize in preparation for probing.
LOCKING: Inherited from caller.
Definition at line 5484 of file libata-core.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.
|
read |
ata_dev_phys_link - find physical link for a device : ATA device to look up physical link for
Look up physical link which is attached to. Note that this is different from ->link only when is on slave link. For all other cases, it's the same as ->link.
LOCKING: Don't care.
RETURNS: Pointer to the found physical link.
Definition at line 303 of file libata-core.c.
Definition at line 6759 of file libata-core.c.
int ata_dev_read_id | ( | struct ata_device * | dev, |
unsigned int * | p_class, | ||
unsigned int | flags, | ||
u16 * | id | ||
) |
ata_dev_read_id - Read ID data from the specified device : target device : pointer to class of the target device (may be changed) : ATA_READID_* flags : buffer to read IDENTIFY data into
Read ID data from the specified device. ATA_CMD_ID_ATA is performed on ATA devices and ATA_CMD_ID_ATAPI on ATAPI devices. This function also issues ATA_CMD_INIT_DEV_PARAMS for pre-ATA4 drives.
FIXME: ATA_CMD_ID_ATA is optional for early drives and right now we abort if we hit that case.
LOCKING: Kernel thread context (may sleep)
RETURNS: 0 on success, -errno otherwise.
Definition at line 1862 of file libata-core.c.
int ata_dev_reread_id | ( | struct ata_device * | dev, |
unsigned int | readid_flags | ||
) |
ata_dev_reread_id - Re-read IDENTIFY data : target ATA device : read ID flags
Re-read IDENTIFY page and make sure is still attached to the port.
LOCKING: Kernel thread context (may sleep)
RETURNS: 0 on success, negative errno otherwise
Definition at line 3937 of file libata-core.c.
int ata_dev_revalidate | ( | struct ata_device * | dev, |
unsigned int | new_class, | ||
unsigned int | readid_flags | ||
) |
ata_dev_revalidate - Revalidate ATA device : device to revalidate : new class code : read ID flags
Re-read IDENTIFY page, make sure is still attached to the port and reconfigure it according to the new IDENTIFY page.
LOCKING: Kernel thread context (may sleep)
RETURNS: 0 on success, negative errno otherwise
Definition at line 3971 of file libata-core.c.
unsigned int ata_dev_set_feature | ( | struct ata_device * | dev, |
u8 | enable, | ||
u8 | feature | ||
) |
ata_dev_set_feature - Issue SET FEATURES - SATA FEATURES : Device to which command will be sent : Whether to enable or disable the feature : The sector count represents the feature to set
Issue SET FEATURES - SATA FEATURES command to device on port with sector count
LOCKING: PCI/etc. bus probe sem.
RETURNS: 0 on success, AC_ERR_* mask otherwise.
Definition at line 4478 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.
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.
unsigned int ata_do_simple_cmd | ( | struct ata_device * | dev, |
u8 | cmd | ||
) |
ata_do_simple_cmd - execute simple internal command : Device to which the command is sent : Opcode to execute
Execute a 'simple' command, that only consists of the opcode 'cmd' itself, without filling any other registers
LOCKING: Kernel thread context (may sleep).
RETURNS: Zero on success, AC_ERR_* mask on failure
Definition at line 1755 of file libata-core.c.
int ata_down_xfermask_limit | ( | struct ata_device * | dev, |
unsigned int | sel | ||
) |
ata_down_xfermask_limit - adjust dev xfer masks downward : Device to adjust xfer masks : ATA_DNXFER_* selector
Adjust xfer masks of downward. Note that this function does not apply the change. Invoking ata_set_mode() afterwards will apply the limit.
LOCKING: Inherited from caller.
RETURNS: 0 on success, negative errno on failure
Definition at line 3094 of file libata-core.c.
unsigned ata_exec_internal | ( | struct ata_device * | dev, |
struct ata_taskfile * | tf, | ||
const u8 * | cdb, | ||
int | dma_dir, | ||
void * | buf, | ||
unsigned int | buflen, | ||
unsigned long | timeout | ||
) |
ata_exec_internal - execute libata internal command : Device to which the command is sent : Taskfile registers for the command and the result : CDB for packet command : Data tranfer direction of the command : Data buffer of the command : Length of data buffer : Timeout in msecs (0 for default)
Wrapper around ata_exec_internal_sg() which takes simple buffer instead of sg list.
LOCKING: None. Should be called with kernel context, might sleep.
RETURNS: Zero on success, AC_ERR_* mask on failure
Definition at line 1722 of file libata-core.c.
unsigned ata_exec_internal_sg | ( | struct ata_device * | dev, |
struct ata_taskfile * | tf, | ||
const u8 * | cdb, | ||
int | dma_dir, | ||
struct scatterlist * | sgl, | ||
unsigned int | n_elem, | ||
unsigned long | timeout | ||
) |
ata_exec_internal_sg - execute libata internal command : Device to which the command is sent : Taskfile registers for the command and the result : CDB for packet command : Data tranfer direction of the command : sg list for the data buffer of the command : Number of sg entries : Timeout in msecs (0 for default)
Executes libata internal command with timeout. contains command on entry and result on return. Timeout and error conditions are reported via return value. No recovery action is taken after a command times out. It's caller's duty to clean up after timeout.
LOCKING: None. Should be called with kernel context, might sleep.
RETURNS: Zero on success, AC_ERR_* mask on failure
Definition at line 1543 of file libata-core.c.
ata_force_cbl - force cable type according to libata.force : ATA port of interest
Force cable type according to libata.force and whine about it. The last entry which has matching port number is used, so it can be specified as part of device force parameters. For example, both "a:40c,1.00:udma4" and "1.00:40c,udma4" have the same effect.
LOCKING: EH context.
Definition at line 327 of file libata-core.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_init - Initialize an ata_link structure : ATA port link is attached to Link structure to initialize : Port multiplier port number
Initialize
LOCKING: Kernel thread context (may sleep)
Definition at line 5521 of file libata-core.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.
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.
Definition at line 6734 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.
ata_phys_link_offline - test whether the given link is offline ATA link to test
Definition at line 5215 of file libata-core.c.
ata_phys_link_online - test whether the given link is online ATA link to test
Definition at line 5191 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_alloc - allocate and initialize basic ATA port resources : ATA host this allocated port belongs to
Allocate and initialize basic ATA port resources.
RETURNS: Allocate ATA port on success, NULL on failure.
LOCKING: Inherited from calling layer (may sleep).
Definition at line 5592 of file libata-core.c.
Definition at line 6714 of file libata-core.c.
Definition at line 6022 of file libata-core.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.
void ata_qc_free | ( | struct ata_queued_cmd * | qc | ) |
ata_qc_free - free unused ata_queued_cmd : Command to complete
Designed to free unused ata_queued_cmd object in case something prevents using it.
LOCKING: spin_lock_irqsave(host lock)
Definition at line 4772 of file libata-core.c.
void ata_qc_issue | ( | struct ata_queued_cmd * | qc | ) |
ata_qc_issue - issue taskfile to device : command to issue to device
Prepare an ATA command to submission to device. This includes mapping the data into a DMA-able area, filling in the S/G table, and finally writing the taskfile to hardware, starting the command.
LOCKING: spin_lock_irqsave(host lock)
Definition at line 5010 of file libata-core.c.
|
read |
ata_qc_new_init - Request an available ATA command, and initialize it : Device from whom we request an available command structure
LOCKING: None.
Definition at line 4745 of file libata-core.c.
Definition at line 6608 of file libata-core.c.
void ata_sg_clean | ( | struct ata_queued_cmd * | qc | ) |
ata_sg_clean - Unmap DMA memory associated with command : Command containing DMA memory to be released
Unmap all mapped DMA memory associated with this command.
LOCKING: spin_lock_irqsave(host lock)
Definition at line 4552 of file libata-core.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.
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.
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.
u64 ata_tf_read_block | ( | struct ata_taskfile * | tf, |
struct ata_device * | dev | ||
) |
ata_tf_read_block - Read block address from ATA taskfile : ATA taskfile of interest : ATA device belongs to
LOCKING: None.
Read block address from . This function can handle all three address formats - LBA, LBA48 and CHS. tf->protocol and flags select the address format to use.
RETURNS: Block address read from .
Definition at line 692 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.
u64 ata_tf_to_lba | ( | const struct ata_taskfile * | tf | ) |
Definition at line 1188 of file libata-core.c.
u64 ata_tf_to_lba48 | ( | const struct ata_taskfile * | tf | ) |
Definition at line 1174 of file libata-core.c.
int ata_timing_compute | ( | struct ata_device * | adev, |
unsigned short | speed, | ||
struct ata_timing * | t, | ||
int | T, | ||
int | UT | ||
) |
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 * | a, |
const struct ata_timing * | b, | ||
struct ata_timing * | m, | ||
unsigned int | what | ||
) |
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.
int ata_wait_ready | ( | struct ata_link * | link, |
unsigned long | deadline, | ||
int(*)(struct ata_link *link) | check_ready | ||
) |
ata_wait_ready - wait for link to become ready link to be waited on : deadline jiffies for the operation : callback to check link readiness
Definition at line 3367 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.
int atapi_check_dma | ( | struct ata_queued_cmd * | qc | ) |
atapi_check_dma - Check whether ATAPI DMA can be supported : Metadata associated with taskfile to check
Allow low-level driver to filter ATA PACKET commands, returning a status indicating whether or not it is OK to use DMA for the supplied PACKET command.
LOCKING: spin_lock_irqsave(host lock)
RETURNS: 0 when ATAPI DMA can be used nonzero otherwise
Definition at line 4583 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.
EXPORT_SYMBOL | ( | ata_port_printk | ) |
EXPORT_SYMBOL | ( | ata_link_printk | ) |
EXPORT_SYMBOL | ( | ata_dev_printk | ) |
EXPORT_SYMBOL | ( | ata_print_version | ) |
EXPORT_SYMBOL_GPL | ( | ata_dev_set_feature | ) |
EXPORT_SYMBOL_GPL | ( | sata_deb_timing_normal | ) |
EXPORT_SYMBOL_GPL | ( | sata_deb_timing_hotplug | ) |
EXPORT_SYMBOL_GPL | ( | sata_deb_timing_long | ) |
EXPORT_SYMBOL_GPL | ( | ata_base_port_ops | ) |
EXPORT_SYMBOL_GPL | ( | sata_port_ops | ) |
EXPORT_SYMBOL_GPL | ( | ata_dummy_port_ops | ) |
EXPORT_SYMBOL_GPL | ( | ata_dummy_port_info | ) |
EXPORT_SYMBOL_GPL | ( | ata_link_next | ) |
EXPORT_SYMBOL_GPL | ( | ata_dev_next | ) |
EXPORT_SYMBOL_GPL | ( | ata_std_bios_param | ) |
EXPORT_SYMBOL_GPL | ( | ata_scsi_unlock_native_capacity | ) |
EXPORT_SYMBOL_GPL | ( | ata_host_init | ) |
EXPORT_SYMBOL_GPL | ( | ata_host_alloc | ) |
EXPORT_SYMBOL_GPL | ( | ata_host_alloc_pinfo | ) |
EXPORT_SYMBOL_GPL | ( | ata_slave_link_init | ) |
EXPORT_SYMBOL_GPL | ( | ata_host_start | ) |
EXPORT_SYMBOL_GPL | ( | ata_host_register | ) |
EXPORT_SYMBOL_GPL | ( | ata_host_activate | ) |
EXPORT_SYMBOL_GPL | ( | ata_host_detach | ) |
EXPORT_SYMBOL_GPL | ( | ata_sg_init | ) |
EXPORT_SYMBOL_GPL | ( | ata_qc_complete | ) |
EXPORT_SYMBOL_GPL | ( | ata_qc_complete_multiple | ) |
EXPORT_SYMBOL_GPL | ( | atapi_cmd_type | ) |
EXPORT_SYMBOL_GPL | ( | ata_tf_to_fis | ) |
EXPORT_SYMBOL_GPL | ( | ata_tf_from_fis | ) |
EXPORT_SYMBOL_GPL | ( | ata_pack_xfermask | ) |
EXPORT_SYMBOL_GPL | ( | ata_unpack_xfermask | ) |
EXPORT_SYMBOL_GPL | ( | ata_xfer_mask2mode | ) |
EXPORT_SYMBOL_GPL | ( | ata_xfer_mode2mask | ) |
EXPORT_SYMBOL_GPL | ( | ata_xfer_mode2shift | ) |
EXPORT_SYMBOL_GPL | ( | ata_mode_string | ) |
EXPORT_SYMBOL_GPL | ( | ata_id_xfermask | ) |
EXPORT_SYMBOL_GPL | ( | ata_do_set_mode | ) |
EXPORT_SYMBOL_GPL | ( | ata_std_qc_defer | ) |
EXPORT_SYMBOL_GPL | ( | ata_noop_qc_prep | ) |
EXPORT_SYMBOL_GPL | ( | ata_dev_disable | ) |
EXPORT_SYMBOL_GPL | ( | sata_set_spd | ) |
EXPORT_SYMBOL_GPL | ( | ata_wait_after_reset | ) |
EXPORT_SYMBOL_GPL | ( | sata_link_debounce | ) |
EXPORT_SYMBOL_GPL | ( | sata_link_resume | ) |
EXPORT_SYMBOL_GPL | ( | sata_link_scr_lpm | ) |
EXPORT_SYMBOL_GPL | ( | ata_std_prereset | ) |
EXPORT_SYMBOL_GPL | ( | sata_link_hardreset | ) |
EXPORT_SYMBOL_GPL | ( | sata_std_hardreset | ) |
EXPORT_SYMBOL_GPL | ( | ata_std_postreset | ) |
EXPORT_SYMBOL_GPL | ( | ata_dev_classify | ) |
EXPORT_SYMBOL_GPL | ( | ata_dev_pair | ) |
EXPORT_SYMBOL_GPL | ( | ata_ratelimit | ) |
EXPORT_SYMBOL_GPL | ( | ata_msleep | ) |
EXPORT_SYMBOL_GPL | ( | ata_wait_register | ) |
EXPORT_SYMBOL_GPL | ( | ata_scsi_queuecmd | ) |
EXPORT_SYMBOL_GPL | ( | ata_scsi_slave_config | ) |
EXPORT_SYMBOL_GPL | ( | ata_scsi_slave_destroy | ) |
EXPORT_SYMBOL_GPL | ( | ata_scsi_change_queue_depth | ) |
EXPORT_SYMBOL_GPL | ( | __ata_change_queue_depth | ) |
EXPORT_SYMBOL_GPL | ( | sata_scr_valid | ) |
EXPORT_SYMBOL_GPL | ( | sata_scr_read | ) |
EXPORT_SYMBOL_GPL | ( | sata_scr_write | ) |
EXPORT_SYMBOL_GPL | ( | sata_scr_write_flush | ) |
EXPORT_SYMBOL_GPL | ( | ata_link_online | ) |
EXPORT_SYMBOL_GPL | ( | ata_link_offline | ) |
EXPORT_SYMBOL_GPL | ( | ata_id_string | ) |
EXPORT_SYMBOL_GPL | ( | ata_id_c_string | ) |
EXPORT_SYMBOL_GPL | ( | ata_do_dev_read_id | ) |
EXPORT_SYMBOL_GPL | ( | ata_scsi_simulate | ) |
EXPORT_SYMBOL_GPL | ( | ata_pio_need_iordy | ) |
EXPORT_SYMBOL_GPL | ( | ata_timing_find_mode | ) |
EXPORT_SYMBOL_GPL | ( | ata_timing_compute | ) |
EXPORT_SYMBOL_GPL | ( | ata_timing_merge | ) |
EXPORT_SYMBOL_GPL | ( | ata_timing_cycle2mode | ) |
EXPORT_SYMBOL_GPL | ( | __ata_ehi_push_desc | ) |
EXPORT_SYMBOL_GPL | ( | ata_ehi_push_desc | ) |
EXPORT_SYMBOL_GPL | ( | ata_ehi_clear_desc | ) |
EXPORT_SYMBOL_GPL | ( | ata_port_desc | ) |
EXPORT_SYMBOL_GPL | ( | ata_port_schedule_eh | ) |
EXPORT_SYMBOL_GPL | ( | ata_link_abort | ) |
EXPORT_SYMBOL_GPL | ( | ata_port_abort | ) |
EXPORT_SYMBOL_GPL | ( | ata_port_freeze | ) |
EXPORT_SYMBOL_GPL | ( | sata_async_notification | ) |
EXPORT_SYMBOL_GPL | ( | ata_eh_freeze_port | ) |
EXPORT_SYMBOL_GPL | ( | ata_eh_thaw_port | ) |
EXPORT_SYMBOL_GPL | ( | ata_eh_qc_complete | ) |
EXPORT_SYMBOL_GPL | ( | ata_eh_qc_retry | ) |
EXPORT_SYMBOL_GPL | ( | ata_eh_analyze_ncq_error | ) |
EXPORT_SYMBOL_GPL | ( | ata_do_eh | ) |
EXPORT_SYMBOL_GPL | ( | ata_std_error_handler | ) |
EXPORT_SYMBOL_GPL | ( | ata_cable_40wire | ) |
EXPORT_SYMBOL_GPL | ( | ata_cable_80wire | ) |
EXPORT_SYMBOL_GPL | ( | ata_cable_unknown | ) |
EXPORT_SYMBOL_GPL | ( | ata_cable_ignore | ) |
EXPORT_SYMBOL_GPL | ( | ata_cable_sata | ) |
MODULE_AUTHOR | ( | "Jeff Garzik" | ) |
module_exit | ( | ata_exit | ) |
MODULE_LICENSE | ( | "GPL" | ) |
module_param | ( | atapi_enabled | , |
int | , | ||
0444 | |||
) |
module_param | ( | atapi_dmadir | , |
int | , | ||
0444 | |||
) |
module_param | ( | atapi_passthru16 | , |
int | , | ||
0444 | |||
) |
module_param | ( | ata_probe_timeout | , |
int | , | ||
0444 | |||
) |
module_param | ( | atapi_an | , |
int | , | ||
0444 | |||
) |
module_param_named | ( | fua | , |
libata_fua | , | ||
int | , | ||
0444 | |||
) |
module_param_named | ( | ignore_hpa | , |
ata_ignore_hpa | , | ||
int | , | ||
0644 | |||
) |
module_param_named | ( | noacpi | , |
libata_noacpi | , | ||
int | , | ||
0444 | |||
) |
module_param_named | ( | allow_tpm | , |
libata_allow_tpm | , | ||
int | , | ||
0444 | |||
) |
MODULE_PARM_DESC | ( | force | , |
"Force ATA configurations including cable | type, | ||
link speed and transfer mode(see Documentation/kernel-parameters.txt for details)" | |||
) |
MODULE_PARM_DESC | ( | atapi_passthru16 | , |
"Enable ATA_16 passthru for ATAPI devices (0=off, 1=on [default])" | |||
) |
MODULE_PARM_DESC | ( | fua | , |
"FUA support (0=off [default], 1=on)" | |||
) |
MODULE_PARM_DESC | ( | ignore_hpa | , |
"Ignore HPA limit (0=keep BIOS limits, 1=ignore limits, using full disk)" | |||
) |
MODULE_PARM_DESC | ( | noacpi | , |
"Disable the use of ACPI in probe/suspend/resume (0=off [default], 1=on)" | |||
) |
MODULE_PARM_DESC | ( | atapi_an | , |
"Enable ATAPI AN media presence notification (0=0ff [default], 1=on)" | |||
) |
MODULE_VERSION | ( | DRV_VERSION | ) |
sata_down_spd_limit - adjust SATA spd limit downward Link to adjust SATA spd limit for : Additional limit
Definition at line 2728 of file libata-core.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.
sata_link_init_spd - Initialize link->sata_spd_limit Link to configure sata_spd_limit for
Initialize >[hw_]sata_spd_limit to the currently configured value.
LOCKING: Kernel thread context (may sleep).
RETURNS: 0 on success, -errno on failure.
Definition at line 5560 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 1019 of file libata-core.c.
Definition at line 3834 of file libata-core.c.
subsys_initcall | ( | ata_init | ) |
swap_buf_le16 - swap halves of 16-bit words in place : Buffer to swap : Number of 16-bit words in buffer.
Swap halves of 16-bit words if needed to convert from little-endian byte order to native cpu byte order, or vice-versa.
LOCKING: Inherited from caller.
Definition at line 4697 of file libata-core.c.
struct ata_port_operations ata_base_port_ops |
Definition at line 79 of file libata-core.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_type ata_port_type |
Definition at line 5468 of file libata-core.c.
atomic_t ata_print_id = ATOMIC_INIT(0) |
Definition at line 100 of file libata-core.c.
int atapi_passthru16 = 1 |
Definition at line 134 of file libata-core.c.
int libata_allow_tpm = 0 |
Definition at line 158 of file libata-core.c.
int libata_fua = 0 |
Definition at line 138 of file libata-core.c.
int libata_noacpi = 0 |
Definition at line 154 of file libata-core.c.
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.