libATA Developer's Guide

Jeff Garzik

The contents of this file are subject to the Open Software License version 1.1 that can be found at http://www.opensource.org/licenses/osl-1.1.txt and is included herein by reference.

Alternatively, the contents of this file may be used under the terms of the GNU General Public License version 2 (the "GPL") as distributed in the kernel source COPYING file, in which case the provisions of the GPL are applicable instead of the above. If you wish to allow the use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the OSL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the OSL or the GPL.


Table of Contents
1. Thanks
2. libata Library
ata_tf_load_pio --  send taskfile registers to host controller
ata_tf_load_mmio --  send taskfile registers to host controller
ata_exec_command_pio --  issue ATA command to host controller
ata_exec_command_mmio --  issue ATA command to host controller
ata_tf_read_pio --  input device's ATA taskfile shadow registers
ata_tf_read_mmio --  input device's ATA taskfile shadow registers
ata_check_status_pio --  Read device status reg & clear interrupt
ata_check_status_mmio --  Read device status reg & clear interrupt
ata_tf_to_fis --  Convert ATA taskfile to SATA FIS structure
ata_tf_from_fis --  Convert SATA FIS to ATA taskfile
ata_dev_id_string --  Convert IDENTIFY DEVICE page into string
ata_port_probe -- 
sata_phy_reset -- 
ata_port_disable -- 
ata_bus_reset --  reset host port and associated ATA channel
ata_fill_sg -- 
ata_eng_timeout --  Handle timeout of queued command
ata_qc_complete --  Complete an active ATA command
ata_bmdma_setup_mmio --  Set up PCI IDE BMDMA transaction (MMIO)
ata_bmdma_start_mmio --  Start a PCI IDE BMDMA transaction (MMIO)
ata_bmdma_setup_pio --  Set up PCI IDE BMDMA transaction (PIO)
ata_bmdma_start_pio --  Start a PCI IDE BMDMA transaction (PIO)
ata_host_intr --  Handle host interrupt for given (port, task)
ata_interrupt --  Default ATA host interrupt handler
ata_device_add -- 
ata_scsi_detect -- 
ata_scsi_release --  SCSI layer callback hook for host unload
ata_std_ports --  initialize ioaddr with standard port offsets.
ata_pci_init_one --  Initialize/register PCI IDE host controller
ata_pci_remove_one --  PCI layer callback for device removal
ata_add_to_probe_list --  add an entry to the list of things
3. libata Core Internals
ata_thr_state_name --  convert thread state enum to string
msleep --  sleep for a number of milliseconds
ata_exec --  issue ATA command to host controller
ata_tf_to_host --  issue ATA taskfile to host controller
ata_tf_to_host_nolock --  issue ATA taskfile to host controller
ata_prot_to_cmd --  determine which read/write opcodes to use
ata_dev_set_protocol --  set taskfile protocol and r/w commands
ata_udma_string --  convert UDMA bit offset to string
ata_pio_devchk --  PATA device presence detection
ata_mmio_devchk --  PATA device presence detection
ata_dev_devchk --  PATA device presence detection
ata_dev_classify --  determine device type based on ATA-spec signature
ata_dev_try_classify --  Parse returned ATA device signature
__ata_dev_select --  Select device 0/1 on ATA bus
ata_dev_select --  Select device 0/1 on ATA bus
ata_dump_id --  IDENTIFY DEVICE info debugging output
ata_dev_identify --  obtain IDENTIFY x DEVICE page
ata_port_reset -- 
ata_set_mode --  Program timings and issue SET FEATURES - XFER
ata_busy_sleep --  sleep until BSY clears, or timeout
ata_bus_edd -- 
ata_host_set_pio -- 
ata_host_set_udma -- 
ata_dev_set_xfermode --  Issue SET FEATURES - XFER MODE command
ata_dev_set_udma --  Set ATA device's transfer mode to Ultra DMA
ata_dev_set_pio --  Set ATA device's transfer mode to PIO
ata_sg_clean -- 
ata_sg_setup_one -- 
ata_sg_setup -- 
ata_pio_poll -- 
ata_pio_complete -- 
ata_pio_sector -- 
ata_qc_new --  Request an available ATA command, for queueing
ata_qc_new_init --  Request an available ATA command, and initialize it
ata_qc_issue --  issue taskfile to device
ata_qc_issue_prot --  issue taskfile to device in proto-dependent manner
ata_dma_complete --  Complete an active ATA BMDMA command
ata_thread_iter -- 
atapi_packet_task --  Write CDB bytes to hardware
ata_host_remove --  Unregister SCSI host structure with upper layers
ata_host_init --  Initialize an ata_port structure
ata_host_add --  Attach low-level ATA driver to system
ata_init -- 
4. libata SCSI translation/emulation
ata_std_bios_param --  generic bios head/sector/cylinder calculator used by sd.
ata_scsi_error --  SCSI layer error handler callback
ata_scsi_queuecmd --  Issue SCSI cdb to libata-managed device
ata_scsi_qc_new --  acquire new ata_queued_cmd reference
ata_to_sense_error --  convert ATA error to SCSI error
ata_scsi_rw_xlat --  Translate SCSI r/w command into an ATA one
ata_scsi_translate --  Translate then issue SCSI command to ATA device
ata_scsi_rbuf_get --  Map response buffer.
ata_scsi_rbuf_put --  Unmap response buffer.
ata_scsi_rbuf_fill --  wrapper for SCSI command simulators
ata_scsiop_inq_std --  Simulate INQUIRY command
ata_scsiop_inq_00 --  Simulate INQUIRY EVPD page 0, list of pages
ata_scsiop_inq_80 --  Simulate INQUIRY EVPD page 80, device serial number
ata_scsiop_inq_83 --  Simulate INQUIRY EVPD page 83, device identity
ata_scsiop_noop -- 
ata_msense_push --  Push data onto MODE SENSE data output buffer
ata_msense_caching --  Simulate MODE SENSE caching info page
ata_msense_ctl_mode --  Simulate MODE SENSE control mode page
ata_msense_rw_recovery --  Simulate MODE SENSE r/w error recovery page
ata_scsiop_mode_sense --  Simulate MODE SENSE 6, 10 commands
ata_scsiop_read_cap --  Simulate READ CAPACITY[ 16] commands
ata_scsiop_report_luns --  Simulate REPORT LUNS command
ata_scsi_badcmd --  End a SCSI request with an error
atapi_xlat --  Initialize PACKET taskfile
ata_scsi_find_dev --  lookup ata_device from scsi_cmnd
ata_get_xlat_func --  check if SCSI to ATA translation is possible
ata_scsi_dump_cdb --  dump SCSI command contents to dmesg
ata_scsi_simulate --  simulate SCSI command on ATA device
5. ata_sil Internals
sil_dev_config --  Apply device/host-specific errata fixups