Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
libata-sff.c File Reference
#include <linux/kernel.h>
#include <linux/gfp.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/libata.h>
#include <linux/highmem.h>
#include "libata.h"

Go to the source code of this file.

Functions

 EXPORT_SYMBOL_GPL (ata_sff_port_ops)
 
u8 ata_sff_check_status (struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL (ata_sff_check_status)
 
void ata_sff_pause (struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL (ata_sff_pause)
 
void ata_sff_dma_pause (struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL (ata_sff_dma_pause)
 
int ata_sff_busy_sleep (struct ata_port *ap, unsigned long tmout_pat, unsigned long tmout)
 
 EXPORT_SYMBOL_GPL (ata_sff_busy_sleep)
 
int ata_sff_wait_ready (struct ata_link *link, unsigned long deadline)
 
 EXPORT_SYMBOL_GPL (ata_sff_wait_ready)
 
void ata_sff_dev_select (struct ata_port *ap, unsigned int device)
 
 EXPORT_SYMBOL_GPL (ata_sff_dev_select)
 
void ata_sff_irq_on (struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL (ata_sff_irq_on)
 
void ata_sff_tf_load (struct ata_port *ap, const struct ata_taskfile *tf)
 
 EXPORT_SYMBOL_GPL (ata_sff_tf_load)
 
void ata_sff_tf_read (struct ata_port *ap, struct ata_taskfile *tf)
 
 EXPORT_SYMBOL_GPL (ata_sff_tf_read)
 
void ata_sff_exec_command (struct ata_port *ap, const struct ata_taskfile *tf)
 
 EXPORT_SYMBOL_GPL (ata_sff_exec_command)
 
unsigned int ata_sff_data_xfer (struct ata_device *dev, unsigned char *buf, unsigned int buflen, int rw)
 
 EXPORT_SYMBOL_GPL (ata_sff_data_xfer)
 
unsigned int ata_sff_data_xfer32 (struct ata_device *dev, unsigned char *buf, unsigned int buflen, int rw)
 
 EXPORT_SYMBOL_GPL (ata_sff_data_xfer32)
 
unsigned int ata_sff_data_xfer_noirq (struct ata_device *dev, unsigned char *buf, unsigned int buflen, int rw)
 
 EXPORT_SYMBOL_GPL (ata_sff_data_xfer_noirq)
 
int ata_sff_hsm_move (struct ata_port *ap, struct ata_queued_cmd *qc, u8 status, int in_wq)
 
 EXPORT_SYMBOL_GPL (ata_sff_hsm_move)
 
void ata_sff_queue_work (struct work_struct *work)
 
 EXPORT_SYMBOL_GPL (ata_sff_queue_work)
 
void ata_sff_queue_delayed_work (struct delayed_work *dwork, unsigned long delay)
 
 EXPORT_SYMBOL_GPL (ata_sff_queue_delayed_work)
 
void ata_sff_queue_pio_task (struct ata_link *link, unsigned long delay)
 
 EXPORT_SYMBOL_GPL (ata_sff_queue_pio_task)
 
void ata_sff_flush_pio_task (struct ata_port *ap)
 
unsigned int ata_sff_qc_issue (struct ata_queued_cmd *qc)
 
 EXPORT_SYMBOL_GPL (ata_sff_qc_issue)
 
bool ata_sff_qc_fill_rtf (struct ata_queued_cmd *qc)
 
 EXPORT_SYMBOL_GPL (ata_sff_qc_fill_rtf)
 
unsigned int ata_sff_port_intr (struct ata_port *ap, struct ata_queued_cmd *qc)
 
 EXPORT_SYMBOL_GPL (ata_sff_port_intr)
 
irqreturn_t ata_sff_interrupt (int irq, void *dev_instance)
 
 EXPORT_SYMBOL_GPL (ata_sff_interrupt)
 
void ata_sff_lost_interrupt (struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL (ata_sff_lost_interrupt)
 
void ata_sff_freeze (struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL (ata_sff_freeze)
 
void ata_sff_thaw (struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL (ata_sff_thaw)
 
int ata_sff_prereset (struct ata_link *link, unsigned long deadline)
 
 EXPORT_SYMBOL_GPL (ata_sff_prereset)
 
unsigned int ata_sff_dev_classify (struct ata_device *dev, int present, u8 *r_err)
 
 EXPORT_SYMBOL_GPL (ata_sff_dev_classify)
 
int ata_sff_wait_after_reset (struct ata_link *link, unsigned int devmask, unsigned long deadline)
 
 EXPORT_SYMBOL_GPL (ata_sff_wait_after_reset)
 
int ata_sff_softreset (struct ata_link *link, unsigned int *classes, unsigned long deadline)
 
 EXPORT_SYMBOL_GPL (ata_sff_softreset)
 
int sata_sff_hardreset (struct ata_link *link, unsigned int *class, unsigned long deadline)
 
 EXPORT_SYMBOL_GPL (sata_sff_hardreset)
 
void ata_sff_postreset (struct ata_link *link, unsigned int *classes)
 
 EXPORT_SYMBOL_GPL (ata_sff_postreset)
 
void ata_sff_drain_fifo (struct ata_queued_cmd *qc)
 
 EXPORT_SYMBOL_GPL (ata_sff_drain_fifo)
 
void ata_sff_error_handler (struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL (ata_sff_error_handler)
 
void ata_sff_std_ports (struct ata_ioports *ioaddr)
 
 EXPORT_SYMBOL_GPL (ata_sff_std_ports)
 
void ata_sff_port_init (struct ata_port *ap)
 
int __init ata_sff_init (void)
 
void ata_sff_exit (void)
 

Variables

struct ata_port_operations ata_sff_port_ops
 

Function Documentation

int ata_sff_busy_sleep ( struct ata_port ap,
unsigned long  tmout_pat,
unsigned long  tmout 
)

ata_sff_busy_sleep - sleep until BSY clears, or timeout : port containing status register to be polled : impatience timeout in msecs : overall timeout in msecs

Sleep until ATA Status register bit BSY clears, or a timeout occurs.

LOCKING: Kernel thread context (may sleep).

RETURNS: 0 on success, -errno otherwise.

Definition at line 215 of file libata-sff.c.

u8 ata_sff_check_status ( struct ata_port ap)

ata_sff_check_status - Read device status reg & clear interrupt : port where the device is

Reads ATA taskfile status register for currently-selected device and return its value. This also clears pending interrupts from this device

LOCKING: Inherited from caller.

Definition at line 84 of file libata-sff.c.

unsigned int ata_sff_data_xfer ( struct ata_device dev,
unsigned char buf,
unsigned int  buflen,
int  rw 
)

ata_sff_data_xfer - Transfer data by PIO : device to target : data buffer : buffer length : read/write

Transfer data from/to the device data register by PIO.

LOCKING: Inherited from caller.

RETURNS: Bytes consumed.

Definition at line 558 of file libata-sff.c.

unsigned int ata_sff_data_xfer32 ( struct ata_device dev,
unsigned char buf,
unsigned int  buflen,
int  rw 
)

ata_sff_data_xfer32 - Transfer data by PIO : device to target : data buffer : buffer length : read/write

Transfer data from/to the device data register by PIO using 32bit I/O operations.

LOCKING: Inherited from caller.

RETURNS: Bytes consumed.

Definition at line 613 of file libata-sff.c.

unsigned int ata_sff_data_xfer_noirq ( struct ata_device dev,
unsigned char buf,
unsigned int  buflen,
int  rw 
)

ata_sff_data_xfer_noirq - Transfer data by PIO : device to target : data buffer : buffer length : read/write

Transfer data from/to the device data register by PIO. Do the transfer with interrupts disabled.

LOCKING: Inherited from caller.

RETURNS: Bytes consumed.

Definition at line 675 of file libata-sff.c.

unsigned int ata_sff_dev_classify ( struct ata_device dev,
int  present,
u8 r_err 
)

ata_sff_dev_classify - Parse returned ATA device signature : ATA device to classify (starting at zero) : device seems present : Value of error register on completion

After an event – SRST, E.D.D., or SATA COMRESET – occurs, an ATA/ATAPI-defined set of values is placed in the ATA shadow registers, indicating the results of device detection and diagnostics.

Select the ATA device, and read the values from the ATA shadow registers. Then parse according to the Error register value, and the spec-defined values examined by ata_dev_classify().

LOCKING: caller.

RETURNS: Device type - ATA_DEV_ATA, ATA_DEV_ATAPI or ATA_DEV_NONE.

Definition at line 1877 of file libata-sff.c.

void ata_sff_dev_select ( struct ata_port ap,
unsigned int  device 
)

ata_sff_dev_select - Select device 0/1 on ATA bus : ATA channel to manipulate : ATA device (numbered from zero) to select

Use the method defined in the ATA specification to make either device 0, or device 1, active on the ATA channel. Works with both PIO and MMIO.

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

LOCKING: caller.

Definition at line 318 of file libata-sff.c.

void ata_sff_dma_pause ( struct ata_port ap)

ata_sff_dma_pause - Pause before commencing DMA : Port to pause for.

Perform I/O fencing and ensure sufficient cycle delays occur for the HDMA1:0 transition

Definition at line 185 of file libata-sff.c.

void ata_sff_drain_fifo ( struct ata_queued_cmd qc)

ata_sff_drain_fifo - Stock FIFO drain logic for SFF controllers : command

Drain the FIFO and device of any stuck data following a command failing to complete. In some cases this is necessary before a reset will recover the device.

Definition at line 2159 of file libata-sff.c.

void ata_sff_error_handler ( struct ata_port ap)

ata_sff_error_handler - Stock error handler for SFF controller : port to handle error for

Stock error handler for SFF controller. It can handle both PATA and SATA controllers. Many controllers should be able to use this EH as-is or with some added handling before and after.

LOCKING: Kernel thread context (may sleep)

Definition at line 2193 of file libata-sff.c.

void ata_sff_exec_command ( struct ata_port ap,
const struct ata_taskfile tf 
)

ata_sff_exec_command - issue ATA command to host controller : port to which command is being issued : ATA taskfile register set

Issues ATA command, with proper synchronization with interrupt handler / other threads.

LOCKING: spin_lock_irqsave(host lock)

Definition at line 515 of file libata-sff.c.

void ata_sff_exit ( void  )

Definition at line 3343 of file libata-sff.c.

void ata_sff_flush_pio_task ( struct ata_port ap)

Definition at line 1331 of file libata-sff.c.

void ata_sff_freeze ( struct ata_port ap)

ata_sff_freeze - Freeze SFF controller port : port to freeze

Freeze SFF controller port.

LOCKING: Inherited from caller.

Definition at line 1733 of file libata-sff.c.

int ata_sff_hsm_move ( struct ata_port ap,
struct ata_queued_cmd qc,
u8  status,
int  in_wq 
)

ata_sff_hsm_move - move the HSM to the next state. : the target ata_port : qc on going : current device status : 1 if called from workqueue, 0 otherwise

RETURNS: 1 when poll next status needed, 0 otherwise.

Definition at line 1046 of file libata-sff.c.

int __init ata_sff_init ( void  )

Definition at line 3334 of file libata-sff.c.

irqreturn_t ata_sff_interrupt ( int  irq,
void dev_instance 
)

ata_sff_interrupt - Default SFF ATA host interrupt handler : irq line (unused) : pointer to our ata_host information structure

Default interrupt handler for PCI IDE devices. Calls ata_sff_port_intr() for each port that is not disabled.

LOCKING: Obtains host lock during operation.

RETURNS: IRQ_NONE or IRQ_HANDLED.

Definition at line 1679 of file libata-sff.c.

void ata_sff_irq_on ( struct ata_port ap)

ata_sff_irq_on - Enable interrupts on a port. : Port on which interrupts are enabled.

Enable interrupts on a legacy IDE device using MMIO or PIO, wait for idle, clear any pending interrupts.

Note: may NOT be used as the sff_irq_on() entry in ata_port_operations.

LOCKING: Inherited from caller.

Definition at line 382 of file libata-sff.c.

void ata_sff_lost_interrupt ( struct ata_port ap)

ata_sff_lost_interrupt - Check for an apparent lost interrupt : port that appears to have timed out

Called from the libata error handlers when the core code suspects an interrupt has been lost. If it has complete anything we can and then return. Interface must support altstatus for this faster recovery to occur.

Locking: Caller holds host lock

Definition at line 1698 of file libata-sff.c.

void ata_sff_pause ( struct ata_port ap)

ata_sff_pause - Flush writes and wait 400nS : Port to pause for.

CAUTION: If we have an mmio device with no ctl and no altstatus method this will fail. No such devices are known to exist.

LOCKING: Inherited from caller.

Definition at line 170 of file libata-sff.c.

void ata_sff_port_init ( struct ata_port ap)

ata_sff_port_init - Initialize SFF/BMDMA ATA port : Port to initialize

Called on port allocation to initialize SFF/BMDMA specific fields.

LOCKING: None.

Definition at line 3327 of file libata-sff.c.

unsigned int ata_sff_port_intr ( struct ata_port ap,
struct ata_queued_cmd qc 
)

ata_sff_port_intr - Handle SFF port interrupt : Port on which interrupt arrived (possibly...) : Taskfile currently active in engine

Handle port interrupt for given queued command.

LOCKING: spin_lock_irqsave(host lock)

RETURNS: One if interrupt was handled, zero if not (shared irq).

Definition at line 1587 of file libata-sff.c.

void ata_sff_postreset ( struct ata_link link,
unsigned int classes 
)

ata_sff_postreset - SFF postreset callback the target SFF ata_link : classes of attached devices

This function is invoked after a successful reset. It first calls ata_std_postreset() and performs SFF specific postreset processing.

LOCKING: Kernel thread context (may sleep)

Definition at line 2123 of file libata-sff.c.

int ata_sff_prereset ( struct ata_link link,
unsigned long  deadline 
)
bool ata_sff_qc_fill_rtf ( struct ata_queued_cmd qc)

ata_sff_qc_fill_rtf - fill result TF using ->sff_tf_read : qc to fill result TF for

is finished and result TF needs to be filled. Fill it using ->sff_tf_read.

LOCKING: spin_lock_irqsave(host lock)

RETURNS: true indicating that result TF is successfully filled.

Definition at line 1502 of file libata-sff.c.

unsigned int ata_sff_qc_issue ( struct ata_queued_cmd qc)

ata_sff_qc_issue - issue taskfile to a SFF controller : command to issue to device

This function issues a PIO or NODATA command to a SFF controller.

LOCKING: spin_lock_irqsave(host lock)

RETURNS: Zero on success, AC_ERR_* mask on failure

Definition at line 1408 of file libata-sff.c.

void ata_sff_queue_delayed_work ( struct delayed_work dwork,
unsigned long  delay 
)

Definition at line 1312 of file libata-sff.c.

void ata_sff_queue_pio_task ( struct ata_link link,
unsigned long  delay 
)

Definition at line 1318 of file libata-sff.c.

void ata_sff_queue_work ( struct work_struct work)

Definition at line 1306 of file libata-sff.c.

int ata_sff_softreset ( struct ata_link link,
unsigned int classes,
unsigned long  deadline 
)

ata_sff_softreset - reset host port via ATA SRST ATA link to reset : resulting classes of attached devices : deadline jiffies for the operation

Reset host port using ATA SRST.

LOCKING: Kernel thread context (may sleep)

RETURNS: 0 on success, -errno otherwise.

Definition at line 2037 of file libata-sff.c.

void ata_sff_std_ports ( struct ata_ioports *  ioaddr)

ata_sff_std_ports - initialize ioaddr with standard port offsets. : IO address structure to be initialized

Utility function which initializes data_addr, error_addr, feature_addr, nsect_addr, lbal_addr, lbam_addr, lbah_addr, device_addr, status_addr, and command_addr to standard offsets relative to cmd_addr.

Does not set ctl_addr, altstatus_addr, bmdma_addr, or scr_addr.

Definition at line 2243 of file libata-sff.c.

void ata_sff_tf_load ( struct ata_port ap,
const struct ata_taskfile tf 
)

ata_sff_tf_load - send taskfile registers to host controller : Port to which output is sent : ATA taskfile register set

Outputs ATA taskfile to standard ATA host controller.

LOCKING: Inherited from caller.

Definition at line 413 of file libata-sff.c.

void ata_sff_tf_read ( struct ata_port ap,
struct ata_taskfile tf 
)

ata_sff_tf_read - input device's ATA taskfile shadow registers : Port from which input is read : ATA taskfile register set for storing input

Reads ATA taskfile registers for currently-selected device into . Assumes the device has a fully SFF compliant task file layout and behaviour. If you device does not (eg has a different status method) then you will need to provide a replacement tf_read

LOCKING: Inherited from caller.

Definition at line 476 of file libata-sff.c.

void ata_sff_thaw ( struct ata_port ap)

ata_sff_thaw - Thaw SFF controller port : port to thaw

Thaw SFF controller port.

LOCKING: Inherited from caller.

Definition at line 1761 of file libata-sff.c.

int ata_sff_wait_after_reset ( struct ata_link link,
unsigned int  devmask,
unsigned long  deadline 
)

ata_sff_wait_after_reset - wait for devices to become ready after reset SFF link which is just reset : mask of present devices : deadline jiffies for the operation

Wait devices attached to SFF become ready after reset. It contains preceding 150ms wait to avoid accessing TF status register too early. LOCKING: Kernel thread context (may sleep). RETURNS: 0 on success, -ENODEV if some or all of devices in don't seem to exist. -errno on other errors.

Definition at line 1944 of file libata-sff.c.

int ata_sff_wait_ready ( struct ata_link link,
unsigned long  deadline 
)

ata_sff_wait_ready - sleep until BSY clears, or timeout SFF link to wait ready status for : deadline jiffies for the operation

Sleep until ATA Status register bit BSY clears, or timeout occurs.

LOCKING: Kernel thread context (may sleep).

RETURNS: 0 on success, -errno otherwise.

Definition at line 277 of file libata-sff.c.

EXPORT_SYMBOL_GPL ( ata_sff_port_ops  )
EXPORT_SYMBOL_GPL ( ata_sff_check_status  )
EXPORT_SYMBOL_GPL ( ata_sff_pause  )
EXPORT_SYMBOL_GPL ( ata_sff_dma_pause  )
EXPORT_SYMBOL_GPL ( ata_sff_busy_sleep  )
EXPORT_SYMBOL_GPL ( ata_sff_wait_ready  )
EXPORT_SYMBOL_GPL ( ata_sff_dev_select  )
EXPORT_SYMBOL_GPL ( ata_sff_irq_on  )
EXPORT_SYMBOL_GPL ( ata_sff_tf_load  )
EXPORT_SYMBOL_GPL ( ata_sff_tf_read  )
EXPORT_SYMBOL_GPL ( ata_sff_exec_command  )
EXPORT_SYMBOL_GPL ( ata_sff_data_xfer  )
EXPORT_SYMBOL_GPL ( ata_sff_data_xfer32  )
EXPORT_SYMBOL_GPL ( ata_sff_data_xfer_noirq  )
EXPORT_SYMBOL_GPL ( ata_sff_hsm_move  )
EXPORT_SYMBOL_GPL ( ata_sff_queue_work  )
EXPORT_SYMBOL_GPL ( ata_sff_queue_delayed_work  )
EXPORT_SYMBOL_GPL ( ata_sff_queue_pio_task  )
EXPORT_SYMBOL_GPL ( ata_sff_qc_issue  )
EXPORT_SYMBOL_GPL ( ata_sff_qc_fill_rtf  )
EXPORT_SYMBOL_GPL ( ata_sff_port_intr  )
EXPORT_SYMBOL_GPL ( ata_sff_interrupt  )
EXPORT_SYMBOL_GPL ( ata_sff_lost_interrupt  )
EXPORT_SYMBOL_GPL ( ata_sff_freeze  )
EXPORT_SYMBOL_GPL ( ata_sff_thaw  )
EXPORT_SYMBOL_GPL ( ata_sff_prereset  )
EXPORT_SYMBOL_GPL ( ata_sff_dev_classify  )
EXPORT_SYMBOL_GPL ( ata_sff_wait_after_reset  )
EXPORT_SYMBOL_GPL ( ata_sff_softreset  )
EXPORT_SYMBOL_GPL ( sata_sff_hardreset  )
EXPORT_SYMBOL_GPL ( ata_sff_postreset  )
EXPORT_SYMBOL_GPL ( ata_sff_drain_fifo  )
EXPORT_SYMBOL_GPL ( ata_sff_error_handler  )
EXPORT_SYMBOL_GPL ( ata_sff_std_ports  )
int sata_sff_hardreset ( struct ata_link link,
unsigned int class,
unsigned long  deadline 
)

Definition at line 2093 of file libata-sff.c.

Variable Documentation

struct ata_port_operations ata_sff_port_ops
Initial value:
= {
.inherits = &ata_base_port_ops,
.qc_prep = ata_noop_qc_prep,
.qc_issue = ata_sff_qc_issue,
.qc_fill_rtf = ata_sff_qc_fill_rtf,
.freeze = ata_sff_freeze,
.thaw = ata_sff_thaw,
.prereset = ata_sff_prereset,
.softreset = ata_sff_softreset,
.hardreset = sata_sff_hardreset,
.postreset = ata_sff_postreset,
.error_handler = ata_sff_error_handler,
.sff_dev_select = ata_sff_dev_select,
.sff_check_status = ata_sff_check_status,
.sff_tf_load = ata_sff_tf_load,
.sff_tf_read = ata_sff_tf_read,
.sff_exec_command = ata_sff_exec_command,
.sff_data_xfer = ata_sff_data_xfer,
.sff_drain_fifo = ata_sff_drain_fifo,
.lost_interrupt = ata_sff_lost_interrupt,
}

Definition at line 46 of file libata-sff.c.