Commit 0cba632b authored by Jeff Garzik's avatar Jeff Garzik

libata: doc updates

parent 780a87f7
...@@ -58,26 +58,6 @@ ...@@ -58,26 +58,6 @@
</para> </para>
</chapter> </chapter>
<chapter id="libataThanks">
<title>Thanks</title>
<para>
The bulk of the ATA knowledge comes thanks to long conversations with
Andre Hedrick (www.linux-ide.org), and long hours pondering the ATA
and SCSI specifications.
</para>
<para>
Thanks to Alan Cox for pointing out similarities
between SATA and SCSI, and in general for motivation to hack on
libata.
</para>
<para>
libata's device detection
method, ata_pio_devchk, and in general all the early probing was
based on extensive study of Hale Landis's probe/reset code in his
ATADRVR driver (www.ata-atapi.com).
</para>
</chapter>
<chapter id="libataDriverApi"> <chapter id="libataDriverApi">
<title>libata Driver API</title> <title>libata Driver API</title>
<sect1> <sect1>
...@@ -314,4 +294,24 @@ and other resources, etc. ...@@ -314,4 +294,24 @@ and other resources, etc.
!Idrivers/scsi/sata_sil.c !Idrivers/scsi/sata_sil.c
</chapter> </chapter>
<chapter id="libataThanks">
<title>Thanks</title>
<para>
The bulk of the ATA knowledge comes thanks to long conversations with
Andre Hedrick (www.linux-ide.org), and long hours pondering the ATA
and SCSI specifications.
</para>
<para>
Thanks to Alan Cox for pointing out similarities
between SATA and SCSI, and in general for motivation to hack on
libata.
</para>
<para>
libata's device detection
method, ata_pio_devchk, and in general all the early probing was
based on extensive study of Hale Landis's probe/reset code in his
ATADRVR driver (www.ata-atapi.com).
</para>
</chapter>
</book> </book>
...@@ -663,15 +663,6 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -663,15 +663,6 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
return ata_pci_init_one(pdev, port_info, n_ports); return ata_pci_init_one(pdev, port_info, n_ports);
} }
/**
* piix_init -
*
* LOCKING:
*
* RETURNS:
*
*/
static int __init piix_init(void) static int __init piix_init(void)
{ {
int rc; int rc;
...@@ -687,13 +678,6 @@ static int __init piix_init(void) ...@@ -687,13 +678,6 @@ static int __init piix_init(void)
return 0; return 0;
} }
/**
* piix_exit -
*
* LOCKING:
*
*/
static void __exit piix_exit(void) static void __exit piix_exit(void)
{ {
pci_unregister_driver(&piix_pci_driver); pci_unregister_driver(&piix_pci_driver);
......
...@@ -1190,7 +1190,12 @@ err_out: ...@@ -1190,7 +1190,12 @@ err_out:
* ata_bus_probe - Reset and probe ATA bus * ata_bus_probe - Reset and probe ATA bus
* @ap: Bus to probe * @ap: 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: * LOCKING:
* PCI/etc. bus probe sem.
* *
* RETURNS: * RETURNS:
* Zero on success, non-zero on error. * Zero on success, non-zero on error.
...@@ -1229,10 +1234,14 @@ err_out: ...@@ -1229,10 +1234,14 @@ err_out:
} }
/** /**
* ata_port_probe - * ata_port_probe - Mark port as enabled
* @ap: * @ap: Port for which we indicate enablement
* *
* LOCKING: * Modify @ap data structure such that the system
* thinks that the entire port is enabled.
*
* LOCKING: host_set lock, or some other form of
* serialization.
*/ */
void ata_port_probe(struct ata_port *ap) void ata_port_probe(struct ata_port *ap)
...@@ -1248,7 +1257,8 @@ void ata_port_probe(struct ata_port *ap) ...@@ -1248,7 +1257,8 @@ void ata_port_probe(struct ata_port *ap)
* PHY registers, to wake up the phy (and device), and * PHY registers, to wake up the phy (and device), and
* clear any reset condition. * clear any reset condition.
* *
* LOCKING: None. Serialized during ata_bus_probe(). * LOCKING:
* PCI/etc. bus probe sem.
* *
*/ */
void __sata_phy_reset(struct ata_port *ap) void __sata_phy_reset(struct ata_port *ap)
...@@ -1299,7 +1309,8 @@ void __sata_phy_reset(struct ata_port *ap) ...@@ -1299,7 +1309,8 @@ void __sata_phy_reset(struct ata_port *ap)
* This function resets the SATA bus, and then probes * This function resets the SATA bus, and then probes
* the bus for devices. * the bus for devices.
* *
* LOCKING: None. Serialized during ata_bus_probe(). * LOCKING:
* PCI/etc. bus probe sem.
* *
*/ */
void sata_phy_reset(struct ata_port *ap) void sata_phy_reset(struct ata_port *ap)
...@@ -1431,7 +1442,8 @@ static void ata_host_set_dma(struct ata_port *ap, u8 xfer_mode, ...@@ -1431,7 +1442,8 @@ static void ata_host_set_dma(struct ata_port *ap, u8 xfer_mode,
* *
* Set ATA device disk transfer mode (PIO3, UDMA6, etc.). * Set ATA device disk transfer mode (PIO3, UDMA6, etc.).
* *
* LOCKING: None. Serialized during ata_bus_probe(). * LOCKING:
* PCI/etc. bus probe sem.
* *
*/ */
static void ata_set_mode(struct ata_port *ap) static void ata_set_mode(struct ata_port *ap)
...@@ -1571,10 +1583,14 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask) ...@@ -1571,10 +1583,14 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask)
} }
/** /**
* ata_bus_edd - * ata_bus_edd - Issue EXECUTE DEVICE DIAGNOSTIC command.
* @ap: * @ap: Port to reset and probe
*
* Use the EXECUTE DEVICE DIAGNOSTIC command to reset and
* probe the bus. Not often used these days.
* *
* LOCKING: None. Serialized during ata_bus_probe(). * LOCKING:
* PCI/etc. bus probe sem.
* *
*/ */
...@@ -1651,8 +1667,8 @@ static unsigned int ata_bus_softreset(struct ata_port *ap, ...@@ -1651,8 +1667,8 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
* the device is ATA or ATAPI. * the device is ATA or ATAPI.
* *
* LOCKING: * LOCKING:
* Inherited from caller. Some functions called by this function * PCI/etc. bus probe sem.
* obtain the host_set lock. * Obtains host_set lock.
* *
* SIDE EFFECTS: * SIDE EFFECTS:
* Sets ATA_FLAG_PORT_DISABLED if bus reset fails. * Sets ATA_FLAG_PORT_DISABLED if bus reset fails.
...@@ -1894,7 +1910,11 @@ static int fgb(u32 bitmap) ...@@ -1894,7 +1910,11 @@ static int fgb(u32 bitmap)
* @xfer_mode_out: (output) SET FEATURES - XFER MODE code * @xfer_mode_out: (output) SET FEATURES - XFER MODE code
* @xfer_shift_out: (output) bit shift that selects this mode * @xfer_shift_out: (output) bit shift that selects this mode
* *
* Based on host and device capabilities, determine the
* maximum transfer mode that is amenable to all.
*
* LOCKING: * LOCKING:
* PCI/etc. bus probe sem.
* *
* RETURNS: * RETURNS:
* Zero on success, negative on error. * Zero on success, negative on error.
...@@ -1930,7 +1950,8 @@ static int ata_choose_xfer_mode(struct ata_port *ap, ...@@ -1930,7 +1950,8 @@ static int ata_choose_xfer_mode(struct ata_port *ap,
* Issue SET FEATURES - XFER MODE command to device @dev * Issue SET FEATURES - XFER MODE command to device @dev
* on port @ap. * on port @ap.
* *
* LOCKING: None. Serialized during ata_bus_probe(). * LOCKING:
* PCI/etc. bus probe sem.
*/ */
static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev)
...@@ -1968,10 +1989,13 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) ...@@ -1968,10 +1989,13 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev)
} }
/** /**
* ata_sg_clean - * ata_sg_clean - Unmap DMA memory associated with command
* @qc: * @qc: Command containing DMA memory to be released
*
* Unmap all mapped DMA memory associated with this command.
* *
* LOCKING: * LOCKING:
* spin_lock_irqsave(host_set lock)
*/ */
static void ata_sg_clean(struct ata_queued_cmd *qc) static void ata_sg_clean(struct ata_queued_cmd *qc)
...@@ -2058,6 +2082,8 @@ static void ata_fill_sg(struct ata_queued_cmd *qc) ...@@ -2058,6 +2082,8 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
* supplied PACKET command. * supplied PACKET command.
* *
* LOCKING: * LOCKING:
* spin_lock_irqsave(host_set lock)
*
* RETURNS: 0 when ATAPI DMA can be used * RETURNS: 0 when ATAPI DMA can be used
* nonzero otherwise * nonzero otherwise
*/ */
...@@ -2088,6 +2114,19 @@ void ata_qc_prep(struct ata_queued_cmd *qc) ...@@ -2088,6 +2114,19 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
ata_fill_sg(qc); ata_fill_sg(qc);
} }
/**
* ata_sg_init_one - Associate command with memory buffer
* @qc: Command to be associated
* @buf: Memory buffer
* @buflen: Length of memory buffer, in bytes.
*
* Initialize the data-related elements of queued_cmd @qc
* to point to a single memory buffer, @buf of byte length @buflen.
*
* LOCKING:
* spin_lock_irqsave(host_set lock)
*/
void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
{ {
struct scatterlist *sg; struct scatterlist *sg;
...@@ -2105,6 +2144,20 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) ...@@ -2105,6 +2144,20 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
sg->length = buflen; sg->length = buflen;
} }
/**
* ata_sg_init - Associate command with scatter-gather table.
* @qc: Command to be associated
* @sg: Scatter-gather table.
* @n_elem: Number of elements in s/g table.
*
* Initialize the data-related elements of queued_cmd @qc
* to point to a scatter-gather table @sg, containing @n_elem
* elements.
*
* LOCKING:
* spin_lock_irqsave(host_set lock)
*/
void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
unsigned int n_elem) unsigned int n_elem)
{ {
...@@ -2114,14 +2167,16 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, ...@@ -2114,14 +2167,16 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
} }
/** /**
* ata_sg_setup_one - * ata_sg_setup_one - DMA-map the memory buffer associated with a command.
* @qc: * @qc: Command with memory buffer to be mapped.
*
* DMA-map the memory buffer associated with queued_cmd @qc.
* *
* LOCKING: * LOCKING:
* spin_lock_irqsave(host_set lock) * spin_lock_irqsave(host_set lock)
* *
* RETURNS: * RETURNS:
* * Zero on success, negative on error.
*/ */
static int ata_sg_setup_one(struct ata_queued_cmd *qc) static int ata_sg_setup_one(struct ata_queued_cmd *qc)
...@@ -2146,13 +2201,16 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) ...@@ -2146,13 +2201,16 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
} }
/** /**
* ata_sg_setup - * ata_sg_setup - DMA-map the scatter-gather table associated with a command.
* @qc: * @qc: Command with scatter-gather table to be mapped.
*
* DMA-map the scatter-gather table associated with queued_cmd @qc.
* *
* LOCKING: * LOCKING:
* spin_lock_irqsave(host_set lock) * spin_lock_irqsave(host_set lock)
* *
* RETURNS: * RETURNS:
* Zero on success, negative on error.
* *
*/ */
...@@ -2182,6 +2240,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) ...@@ -2182,6 +2240,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
* @ap: * @ap:
* *
* LOCKING: * LOCKING:
* None. (executing in kernel thread context)
* *
* RETURNS: * RETURNS:
* *
...@@ -2229,6 +2288,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap) ...@@ -2229,6 +2288,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
* @ap: * @ap:
* *
* LOCKING: * LOCKING:
* None. (executing in kernel thread context)
*/ */
static void ata_pio_complete (struct ata_port *ap) static void ata_pio_complete (struct ata_port *ap)
...@@ -2446,6 +2506,7 @@ err_out: ...@@ -2446,6 +2506,7 @@ err_out:
* @ap: * @ap:
* *
* LOCKING: * LOCKING:
* None. (executing in kernel thread context)
*/ */
static void ata_pio_block(struct ata_port *ap) static void ata_pio_block(struct ata_port *ap)
...@@ -2614,6 +2675,7 @@ static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, ...@@ -2614,6 +2675,7 @@ static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
* transaction completed successfully. * transaction completed successfully.
* *
* LOCKING: * LOCKING:
* Inherited from SCSI layer (none, can sleep)
*/ */
static void ata_qc_timeout(struct ata_queued_cmd *qc) static void ata_qc_timeout(struct ata_queued_cmd *qc)
...@@ -2723,6 +2785,7 @@ out: ...@@ -2723,6 +2785,7 @@ out:
* @dev: Device from whom we request an available command structure * @dev: Device from whom we request an available command structure
* *
* LOCKING: * LOCKING:
* None.
*/ */
static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
...@@ -2748,6 +2811,7 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) ...@@ -2748,6 +2811,7 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
* @dev: Device from whom we request an available command structure * @dev: Device from whom we request an available command structure
* *
* LOCKING: * LOCKING:
* None.
*/ */
struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
...@@ -2812,6 +2876,7 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc) ...@@ -2812,6 +2876,7 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc)
* in case something prevents using it. * in case something prevents using it.
* *
* LOCKING: * LOCKING:
* spin_lock_irqsave(host_set lock)
* *
*/ */
void ata_qc_free(struct ata_queued_cmd *qc) void ata_qc_free(struct ata_queued_cmd *qc)
...@@ -2825,9 +2890,13 @@ void ata_qc_free(struct ata_queued_cmd *qc) ...@@ -2825,9 +2890,13 @@ void ata_qc_free(struct ata_queued_cmd *qc)
/** /**
* ata_qc_complete - Complete an active ATA command * ata_qc_complete - Complete an active ATA command
* @qc: Command to complete * @qc: Command to complete
* @drv_stat: ATA status register contents * @drv_stat: ATA Status register contents
*
* Indicate to the mid and upper layers that an ATA
* command has completed, with either an ok or not-ok status.
* *
* LOCKING: * LOCKING:
* spin_lock_irqsave(host_set lock)
* *
*/ */
...@@ -3234,13 +3303,18 @@ idle_irq: ...@@ -3234,13 +3303,18 @@ idle_irq:
/** /**
* ata_interrupt - Default ATA host interrupt handler * ata_interrupt - Default ATA host interrupt handler
* @irq: irq line * @irq: irq line (unused)
* @dev_instance: pointer to our host information structure * @dev_instance: pointer to our ata_host_set information structure
* @regs: unused * @regs: unused
* *
* Default interrupt handler for PCI IDE devices. Calls
* ata_host_intr() for each port that is not disabled.
*
* LOCKING: * LOCKING:
* Obtains host_set lock during operation.
* *
* RETURNS: * RETURNS:
* IRQ_NONE or IRQ_HANDLED.
* *
*/ */
...@@ -3381,7 +3455,11 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) ...@@ -3381,7 +3455,11 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
* @ent: Probe information provided by low-level driver * @ent: Probe information provided by low-level driver
* @port_no: Port number associated with this ata_port * @port_no: Port number associated with this ata_port
* *
* Initialize a new ata_port structure, and its associated
* scsi_host.
*
* LOCKING: * LOCKING:
* Inherited from caller.
* *
*/ */
...@@ -3436,9 +3514,13 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, ...@@ -3436,9 +3514,13 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
* @host_set: Collections of ports to which we add * @host_set: Collections of ports to which we add
* @port_no: Port number associated with this host * @port_no: Port number associated with this host
* *
* Attach low-level ATA driver to system.
*
* LOCKING: * LOCKING:
* PCI/etc. bus probe sem.
* *
* RETURNS: * RETURNS:
* New ata_port on success, for NULL on error.
* *
*/ */
...@@ -3471,12 +3553,22 @@ err_out: ...@@ -3471,12 +3553,22 @@ err_out:
} }
/** /**
* ata_device_add - * ata_device_add - Register hardware device with ATA and SCSI layers
* @ent: * @ent: Probe information describing hardware device to be registered
*
* This function processes the information provided in the probe
* information struct @ent, allocates the necessary ATA and SCSI
* host information structures, initializes them, and registers
* everything with requisite kernel subsystems.
*
* This function requests irqs, probes the ATA bus, and probes
* the SCSI bus.
* *
* LOCKING: * LOCKING:
* PCI/etc. bus probe sem.
* *
* RETURNS: * RETURNS:
* Number of ports registered. Zero on error (no ports registered).
* *
*/ */
...@@ -3755,6 +3847,7 @@ ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port, ...@@ -3755,6 +3847,7 @@ ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port,
* Inherited from PCI layer (may sleep). * Inherited from PCI layer (may sleep).
* *
* RETURNS: * RETURNS:
* Zero on success, negative on errno-based value on error.
* *
*/ */
...@@ -3974,15 +4067,6 @@ int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits) ...@@ -3974,15 +4067,6 @@ int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits)
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
/**
* ata_init -
*
* LOCKING:
*
* RETURNS:
*
*/
static int __init ata_init(void) static int __init ata_init(void)
{ {
ata_wq = create_workqueue("ata"); ata_wq = create_workqueue("ata");
......
...@@ -947,7 +947,7 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, ...@@ -947,7 +947,7 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
} }
/** /**
* ata_scsiop_noop - * ata_scsiop_noop - Command handler that simply returns success.
* @args: device IDENTIFY data / SCSI command of interest. * @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent. * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
* @buflen: Response buffer length. * @buflen: Response buffer length.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment