Linux Kernel
3.7.1
|
Go to the source code of this file.
Data Structures | |
struct | ata_scsi_args |
Macros | |
#define | DRV_NAME "libata" |
#define | DRV_VERSION "3.00" /* must be exactly four chars */ |
#define | to_ata_port(d) container_of(d, struct ata_port, tdev) |
Enumerations | |
enum | { ATA_READID_POSTRESET = (1 << 0), ATA_DNXFER_PIO = 0, ATA_DNXFER_DMA = 1, ATA_DNXFER_40C = 2, ATA_DNXFER_FORCE_PIO = 3, ATA_DNXFER_FORCE_PIO0 = 4, ATA_DNXFER_QUIET = (1 << 31) } |
Variables | |
atomic_t | ata_print_id |
int | atapi_passthru16 |
int | libata_fua |
int | libata_noacpi |
int | libata_allow_tpm |
struct device_type | ata_port_type |
#define to_ata_port | ( | d | ) | container_of(d, struct ata_port, tdev) |
anonymous enum |
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.
int ata_cmd_ioctl | ( | struct scsi_device * | scsidev, |
void __user * | arg | ||
) |
ata_cmd_ioctl - Handler for HDIO_DRIVE_CMD ioctl : Device to which we are issuing command
LOCKING: Defined by the SCSI layer. We don't really care.
RETURNS: Zero on success, negative errno on error.
Definition at line 466 of file libata-scsi.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_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.
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_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.
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_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.
ata_eh_about_to_do - about to perform eh_action target ATA link : target ATA dev for per-dev action (can be NULL) : action about to be performed
Called just before performing EH actions to clear related bits in >eh_info such that eh actions are not unnecessarily repeated.
LOCKING: None.
Definition at line 1411 of file libata-eh.c.
ata_eh_acquire - acquire EH ownership : ATA port to acquire EH ownership for
Acquire EH ownership for . This is the basic exclusion mechanism for ports sharing a host. Only one port hanging off the same host can claim the ownership of EH.
LOCKING: EH context.
Definition at line 477 of file libata-eh.c.
ata_eh_autopsy - analyze error and determine recovery action : host port to perform autopsy on
Analyze all links of and determine why they failed and which recovery actions are needed.
LOCKING: Kernel thread context (may sleep).
Definition at line 2236 of file libata-eh.c.
void ata_eh_detach_dev | ( | struct ata_device * | dev | ) |
ata_eh_detach_dev - detach ATA device : ATA device to detach
Detach .
LOCKING: None.
Definition at line 1371 of file libata-eh.c.
ata_eh_done - EH action complete : target ATA port : target ATA dev for per-dev action (can be NULL) : action just completed
Called right after performing EH actions to clear related bits in >eh_context.
LOCKING: None.
Definition at line 1444 of file libata-eh.c.
Definition at line 881 of file libata-eh.c.
ata_eh_finish - finish up EH : host port to finish EH for
Recovery is complete. Clean up EH states and retry or finish failed qcs.
LOCKING: None.
Definition at line 3919 of file libata-eh.c.
int ata_eh_recover | ( | struct ata_port * | ap, |
ata_prereset_fn_t | prereset, | ||
ata_reset_fn_t | softreset, | ||
ata_reset_fn_t | hardreset, | ||
ata_postreset_fn_t | postreset, | ||
struct ata_link ** | r_failed_link | ||
) |
ata_eh_recover - recover host port after error : host port to recover : prereset method (can be NULL) : softreset method (can be NULL) : hardreset method (can be NULL) : postreset method (can be NULL) : out parameter for failed link
This is the alpha and omega, eum and yang, heart and soul of libata exception handling. On entry, actions required to recover each link and hotplug requests are recorded in the link's eh_context. This function executes all the operations with appropriate retrials and fallbacks to resurrect failed devices, detach goners and greet newcomers.
LOCKING: Kernel thread context (may sleep).
RETURNS: 0 on success, -errno on failure.
Definition at line 3690 of file libata-eh.c.
ata_eh_release - release EH ownership : ATA port to release EH ownership for
Release EH ownership for if the caller. The caller must have acquired EH ownership using ata_eh_acquire() previously.
LOCKING: EH context.
Definition at line 494 of file libata-eh.c.
ata_eh_report - report error handling to user : ATA port to report EH about
Report EH to user.
LOCKING: None.
Definition at line 2571 of file libata-eh.c.
int ata_eh_reset | ( | struct ata_link * | link, |
int | classify, | ||
ata_prereset_fn_t | prereset, | ||
ata_reset_fn_t | softreset, | ||
ata_reset_fn_t | hardreset, | ||
ata_postreset_fn_t | postreset | ||
) |
Definition at line 2603 of file libata-eh.c.
int ata_ering_map | ( | struct ata_ering * | ering, |
int(*)(struct ata_ering_entry *, void *) | map_fn, | ||
void * | arg | ||
) |
Definition at line 401 of file libata-eh.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.
ata_get_cmd_descript - get description for ATA command : ATA command code to get description for
Return a textual description of the given command, or NULL if the command is not known.
LOCKING: None
Definition at line 2282 of file libata-eh.c.
void ata_internal_cmd_timed_out | ( | struct ata_device * | dev, |
u8 | cmd | ||
) |
ata_internal_cmd_timed_out - notification for internal command timeout : target device : internal command which timed out
Notify EH that internal command for timed out. This function should be called only for commands whose timeouts are determined using ata_internal_cmd_timeout().
LOCKING: EH context.
Definition at line 362 of file libata-eh.c.
unsigned long ata_internal_cmd_timeout | ( | struct ata_device * | dev, |
u8 | cmd | ||
) |
ata_internal_cmd_timeout - determine timeout for an internal command : target device : internal command to be issued
Determine timeout for internal command for .
LOCKING: EH context.
RETURNS: Determined timeout.
Definition at line 337 of file libata-eh.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.
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.
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 6022 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.
void ata_qc_schedule_eh | ( | struct ata_queued_cmd * | qc | ) |
ata_qc_schedule_eh - schedule qc for error handling : command to schedule error handling for
Schedule error handling for . EH will kick in as soon as other commands are drained.
LOCKING: spin_lock_irqsave(host lock)
Definition at line 967 of file libata-eh.c.
unsigned int ata_read_log_page | ( | struct ata_device * | dev, |
u8 | log, | ||
u8 | page, | ||
void * | buf, | ||
unsigned int | sectors | ||
) |
Definition at line 1503 of file libata-eh.c.
int ata_scsi_add_hosts | ( | struct ata_host * | host, |
struct scsi_host_template * | sht | ||
) |
Definition at line 3582 of file libata-scsi.c.
void ata_scsi_dev_rescan | ( | struct work_struct * | work | ) |
ata_scsi_dev_rescan - initiate scsi_rescan_device() : Pointer to ATA port to perform scsi_rescan_device()
After ATA pass thru (SAT) commands are executed successfully, libata need to propagate the changes to SCSI layer.
LOCKING: Kernel thread context (may sleep).
Definition at line 3950 of file libata-scsi.c.
ata_scsi_error - SCSI layer error handler callback : SCSI host on which error occurred
Handles SCSI-layer-thrown error events.
LOCKING: Inherited from SCSI layer (none, can sleep)
RETURNS: Zero.
Definition at line 588 of file libata-eh.c.
void ata_scsi_hotplug | ( | struct work_struct * | work | ) |
ata_scsi_hotplug - SCSI part of hotplug : Pointer to ATA port to perform SCSI hotplug on
Perform SCSI part of hotplug. It's executed from a separate workqueue after EH completes. This is necessary because SCSI hot plugging requires working EH and hot unplugging is synchronized with hot plugging with a mutex.
LOCKING: Kernel thread context (may sleep).
Definition at line 3840 of file libata-scsi.c.
void ata_scsi_media_change_notify | ( | struct ata_device * | dev | ) |
ata_scsi_media_change_notify - send media change event : Pointer to the disk device with media change event
Tell the block layer to send a media change notification event.
LOCKING: spin_lock_irqsave(host lock)
Definition at line 3821 of file libata-scsi.c.
int ata_scsi_offline_dev | ( | struct ata_device * | dev | ) |
ata_scsi_offline_dev - offline attached SCSI device : ATA device to offline attached SCSI device for
This function is called from ata_eh_hotplug() and responsible for taking the SCSI device attached to offline. This function is called with host lock which protects dev->sdev against clearing.
LOCKING: spin_lock_irqsave(host lock)
RETURNS: 1 if attached SCSI device exists, 0 otherwise.
Definition at line 3722 of file libata-scsi.c.
Definition at line 3633 of file libata-scsi.c.
ata_scsi_timed_out - SCSI layer time out callback : timed out SCSI command
Handles SCSI layer timeout. We race with normal completion of the qc for . If the qc is already gone, we lose and let the scsi command finish (EH_HANDLED). Otherwise, the qc has timed out and EH should be invoked. Prevent ata_qc_complete() from finishing it by setting EH_SCHEDULED and return EH_NOT_HANDLED.
TODO: kill this function once old EH is gone.
LOCKING: Called from timer context
RETURNS: EH_HANDLED or EH_NOT_HANDLED
Definition at line 520 of file libata-eh.c.
int ata_scsi_user_scan | ( | struct Scsi_Host * | shost, |
unsigned int | channel, | ||
unsigned int | id, | ||
unsigned int | lun | ||
) |
ata_scsi_user_scan - indication for user-initiated bus scan : SCSI host to scan : Channel to scan : ID to scan : LUN to scan
This function is called when user explicitly requests bus scan. Set probe pending flag and invoke EH.
LOCKING: SCSI layer (we don't care)
RETURNS: Zero.
Definition at line 3886 of file libata-scsi.c.
int ata_set_mode | ( | struct ata_link * | link, |
struct ata_device ** | r_failed_dev | ||
) |
ata_set_mode - Program timings and issue SET FEATURES - XFER link on which timings will be programmed : out parameter for failed device
Set ATA device disk transfer mode (PIO3, UDMA6, etc.). If ata_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 3210 of file libata-eh.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.
int ata_task_ioctl | ( | struct scsi_device * | scsidev, |
void __user * | arg | ||
) |
ata_task_ioctl - Handler for HDIO_DRIVE_TASK ioctl : Device to which we are issuing command
LOCKING: Defined by the SCSI layer. We don't really care.
RETURNS: Zero on success, negative errno on error.
Definition at line 575 of file libata-scsi.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.
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_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.
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.
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.
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.
Definition at line 1019 of file libata-core.c.
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 device_type ata_port_type |
Definition at line 5468 of file libata-core.c.
atomic_t ata_print_id |
Definition at line 100 of file libata-core.c.
int atapi_passthru16 |
Definition at line 134 of file libata-core.c.
int libata_allow_tpm |
Definition at line 158 of file libata-core.c.
int libata_fua |
Definition at line 138 of file libata-core.c.
int libata_noacpi |
Definition at line 154 of file libata-core.c.