aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-05-30 19:49:12 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-05-30 19:49:12 -0400
commit0cba632b737fc2de76934137b8dccf92d9fa4d19 (patch)
treef2de8c9152ca956aaaaad57ddbe9fc373d4b39d7 /drivers/scsi/libata-core.c
parent780a87f71841932db8dbb0f1eb9daf3a973a6bd6 (diff)
libata: doc updates
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r--drivers/scsi/libata-core.c150
1 files changed, 117 insertions, 33 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 4d707d06a5d1..31b2984f379a 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1190,7 +1190,12 @@ err_out:
1190 * ata_bus_probe - Reset and probe ATA bus 1190 * ata_bus_probe - Reset and probe ATA bus
1191 * @ap: Bus to probe 1191 * @ap: Bus to probe
1192 * 1192 *
1193 * Master ATA bus probing function. Initiates a hardware-dependent
1194 * bus reset, then attempts to identify any devices found on
1195 * the bus.
1196 *
1193 * LOCKING: 1197 * LOCKING:
1198 * PCI/etc. bus probe sem.
1194 * 1199 *
1195 * RETURNS: 1200 * RETURNS:
1196 * Zero on success, non-zero on error. 1201 * Zero on success, non-zero on error.
@@ -1229,10 +1234,14 @@ err_out:
1229} 1234}
1230 1235
1231/** 1236/**
1232 * ata_port_probe - 1237 * ata_port_probe - Mark port as enabled
1233 * @ap: 1238 * @ap: Port for which we indicate enablement
1234 * 1239 *
1235 * LOCKING: 1240 * Modify @ap data structure such that the system
1241 * thinks that the entire port is enabled.
1242 *
1243 * LOCKING: host_set lock, or some other form of
1244 * serialization.
1236 */ 1245 */
1237 1246
1238void ata_port_probe(struct ata_port *ap) 1247void ata_port_probe(struct ata_port *ap)
@@ -1248,7 +1257,8 @@ void ata_port_probe(struct ata_port *ap)
1248 * PHY registers, to wake up the phy (and device), and 1257 * PHY registers, to wake up the phy (and device), and
1249 * clear any reset condition. 1258 * clear any reset condition.
1250 * 1259 *
1251 * LOCKING: None. Serialized during ata_bus_probe(). 1260 * LOCKING:
1261 * PCI/etc. bus probe sem.
1252 * 1262 *
1253 */ 1263 */
1254void __sata_phy_reset(struct ata_port *ap) 1264void __sata_phy_reset(struct ata_port *ap)
@@ -1299,7 +1309,8 @@ void __sata_phy_reset(struct ata_port *ap)
1299 * This function resets the SATA bus, and then probes 1309 * This function resets the SATA bus, and then probes
1300 * the bus for devices. 1310 * the bus for devices.
1301 * 1311 *
1302 * LOCKING: None. Serialized during ata_bus_probe(). 1312 * LOCKING:
1313 * PCI/etc. bus probe sem.
1303 * 1314 *
1304 */ 1315 */
1305void sata_phy_reset(struct ata_port *ap) 1316void 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 * 1442 *
1432 * Set ATA device disk transfer mode (PIO3, UDMA6, etc.). 1443 * Set ATA device disk transfer mode (PIO3, UDMA6, etc.).
1433 * 1444 *
1434 * LOCKING: None. Serialized during ata_bus_probe(). 1445 * LOCKING:
1446 * PCI/etc. bus probe sem.
1435 * 1447 *
1436 */ 1448 */
1437static void ata_set_mode(struct ata_port *ap) 1449static 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} 1583}
1572 1584
1573/** 1585/**
1574 * ata_bus_edd - 1586 * ata_bus_edd - Issue EXECUTE DEVICE DIAGNOSTIC command.
1575 * @ap: 1587 * @ap: Port to reset and probe
1588 *
1589 * Use the EXECUTE DEVICE DIAGNOSTIC command to reset and
1590 * probe the bus. Not often used these days.
1576 * 1591 *
1577 * LOCKING: None. Serialized during ata_bus_probe(). 1592 * LOCKING:
1593 * PCI/etc. bus probe sem.
1578 * 1594 *
1579 */ 1595 */
1580 1596
@@ -1651,8 +1667,8 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
1651 * the device is ATA or ATAPI. 1667 * the device is ATA or ATAPI.
1652 * 1668 *
1653 * LOCKING: 1669 * LOCKING:
1654 * Inherited from caller. Some functions called by this function 1670 * PCI/etc. bus probe sem.
1655 * obtain the host_set lock. 1671 * Obtains host_set lock.
1656 * 1672 *
1657 * SIDE EFFECTS: 1673 * SIDE EFFECTS:
1658 * Sets ATA_FLAG_PORT_DISABLED if bus reset fails. 1674 * Sets ATA_FLAG_PORT_DISABLED if bus reset fails.
@@ -1894,7 +1910,11 @@ static int fgb(u32 bitmap)
1894 * @xfer_mode_out: (output) SET FEATURES - XFER MODE code 1910 * @xfer_mode_out: (output) SET FEATURES - XFER MODE code
1895 * @xfer_shift_out: (output) bit shift that selects this mode 1911 * @xfer_shift_out: (output) bit shift that selects this mode
1896 * 1912 *
1913 * Based on host and device capabilities, determine the
1914 * maximum transfer mode that is amenable to all.
1915 *
1897 * LOCKING: 1916 * LOCKING:
1917 * PCI/etc. bus probe sem.
1898 * 1918 *
1899 * RETURNS: 1919 * RETURNS:
1900 * Zero on success, negative on error. 1920 * Zero on success, negative on error.
@@ -1930,7 +1950,8 @@ static int ata_choose_xfer_mode(struct ata_port *ap,
1930 * Issue SET FEATURES - XFER MODE command to device @dev 1950 * Issue SET FEATURES - XFER MODE command to device @dev
1931 * on port @ap. 1951 * on port @ap.
1932 * 1952 *
1933 * LOCKING: None. Serialized during ata_bus_probe(). 1953 * LOCKING:
1954 * PCI/etc. bus probe sem.
1934 */ 1955 */
1935 1956
1936static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) 1957static 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} 1989}
1969 1990
1970/** 1991/**
1971 * ata_sg_clean - 1992 * ata_sg_clean - Unmap DMA memory associated with command
1972 * @qc: 1993 * @qc: Command containing DMA memory to be released
1994 *
1995 * Unmap all mapped DMA memory associated with this command.
1973 * 1996 *
1974 * LOCKING: 1997 * LOCKING:
1998 * spin_lock_irqsave(host_set lock)
1975 */ 1999 */
1976 2000
1977static void ata_sg_clean(struct ata_queued_cmd *qc) 2001static void ata_sg_clean(struct ata_queued_cmd *qc)
@@ -2058,6 +2082,8 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
2058 * supplied PACKET command. 2082 * supplied PACKET command.
2059 * 2083 *
2060 * LOCKING: 2084 * LOCKING:
2085 * spin_lock_irqsave(host_set lock)
2086 *
2061 * RETURNS: 0 when ATAPI DMA can be used 2087 * RETURNS: 0 when ATAPI DMA can be used
2062 * nonzero otherwise 2088 * nonzero otherwise
2063 */ 2089 */
@@ -2088,6 +2114,19 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
2088 ata_fill_sg(qc); 2114 ata_fill_sg(qc);
2089} 2115}
2090 2116
2117/**
2118 * ata_sg_init_one - Associate command with memory buffer
2119 * @qc: Command to be associated
2120 * @buf: Memory buffer
2121 * @buflen: Length of memory buffer, in bytes.
2122 *
2123 * Initialize the data-related elements of queued_cmd @qc
2124 * to point to a single memory buffer, @buf of byte length @buflen.
2125 *
2126 * LOCKING:
2127 * spin_lock_irqsave(host_set lock)
2128 */
2129
2091void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) 2130void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
2092{ 2131{
2093 struct scatterlist *sg; 2132 struct scatterlist *sg;
@@ -2105,6 +2144,20 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
2105 sg->length = buflen; 2144 sg->length = buflen;
2106} 2145}
2107 2146
2147/**
2148 * ata_sg_init - Associate command with scatter-gather table.
2149 * @qc: Command to be associated
2150 * @sg: Scatter-gather table.
2151 * @n_elem: Number of elements in s/g table.
2152 *
2153 * Initialize the data-related elements of queued_cmd @qc
2154 * to point to a scatter-gather table @sg, containing @n_elem
2155 * elements.
2156 *
2157 * LOCKING:
2158 * spin_lock_irqsave(host_set lock)
2159 */
2160
2108void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 2161void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
2109 unsigned int n_elem) 2162 unsigned int n_elem)
2110{ 2163{
@@ -2114,14 +2167,16 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
2114} 2167}
2115 2168
2116/** 2169/**
2117 * ata_sg_setup_one - 2170 * ata_sg_setup_one - DMA-map the memory buffer associated with a command.
2118 * @qc: 2171 * @qc: Command with memory buffer to be mapped.
2172 *
2173 * DMA-map the memory buffer associated with queued_cmd @qc.
2119 * 2174 *
2120 * LOCKING: 2175 * LOCKING:
2121 * spin_lock_irqsave(host_set lock) 2176 * spin_lock_irqsave(host_set lock)
2122 * 2177 *
2123 * RETURNS: 2178 * RETURNS:
2124 * 2179 * Zero on success, negative on error.
2125 */ 2180 */
2126 2181
2127static int ata_sg_setup_one(struct ata_queued_cmd *qc) 2182static 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} 2201}
2147 2202
2148/** 2203/**
2149 * ata_sg_setup - 2204 * ata_sg_setup - DMA-map the scatter-gather table associated with a command.
2150 * @qc: 2205 * @qc: Command with scatter-gather table to be mapped.
2206 *
2207 * DMA-map the scatter-gather table associated with queued_cmd @qc.
2151 * 2208 *
2152 * LOCKING: 2209 * LOCKING:
2153 * spin_lock_irqsave(host_set lock) 2210 * spin_lock_irqsave(host_set lock)
2154 * 2211 *
2155 * RETURNS: 2212 * RETURNS:
2213 * Zero on success, negative on error.
2156 * 2214 *
2157 */ 2215 */
2158 2216
@@ -2182,6 +2240,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
2182 * @ap: 2240 * @ap:
2183 * 2241 *
2184 * LOCKING: 2242 * LOCKING:
2243 * None. (executing in kernel thread context)
2185 * 2244 *
2186 * RETURNS: 2245 * RETURNS:
2187 * 2246 *
@@ -2229,6 +2288,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
2229 * @ap: 2288 * @ap:
2230 * 2289 *
2231 * LOCKING: 2290 * LOCKING:
2291 * None. (executing in kernel thread context)
2232 */ 2292 */
2233 2293
2234static void ata_pio_complete (struct ata_port *ap) 2294static void ata_pio_complete (struct ata_port *ap)
@@ -2446,6 +2506,7 @@ err_out:
2446 * @ap: 2506 * @ap:
2447 * 2507 *
2448 * LOCKING: 2508 * LOCKING:
2509 * None. (executing in kernel thread context)
2449 */ 2510 */
2450 2511
2451static void ata_pio_block(struct ata_port *ap) 2512static 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 * transaction completed successfully. 2675 * transaction completed successfully.
2615 * 2676 *
2616 * LOCKING: 2677 * LOCKING:
2678 * Inherited from SCSI layer (none, can sleep)
2617 */ 2679 */
2618 2680
2619static void ata_qc_timeout(struct ata_queued_cmd *qc) 2681static void ata_qc_timeout(struct ata_queued_cmd *qc)
@@ -2723,6 +2785,7 @@ out:
2723 * @dev: Device from whom we request an available command structure 2785 * @dev: Device from whom we request an available command structure
2724 * 2786 *
2725 * LOCKING: 2787 * LOCKING:
2788 * None.
2726 */ 2789 */
2727 2790
2728static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) 2791static 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 * @dev: Device from whom we request an available command structure 2811 * @dev: Device from whom we request an available command structure
2749 * 2812 *
2750 * LOCKING: 2813 * LOCKING:
2814 * None.
2751 */ 2815 */
2752 2816
2753struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, 2817struct 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 * in case something prevents using it. 2876 * in case something prevents using it.
2813 * 2877 *
2814 * LOCKING: 2878 * LOCKING:
2879 * spin_lock_irqsave(host_set lock)
2815 * 2880 *
2816 */ 2881 */
2817void ata_qc_free(struct ata_queued_cmd *qc) 2882void ata_qc_free(struct ata_queued_cmd *qc)
@@ -2825,9 +2890,13 @@ void ata_qc_free(struct ata_queued_cmd *qc)
2825/** 2890/**
2826 * ata_qc_complete - Complete an active ATA command 2891 * ata_qc_complete - Complete an active ATA command
2827 * @qc: Command to complete 2892 * @qc: Command to complete
2828 * @drv_stat: ATA status register contents 2893 * @drv_stat: ATA Status register contents
2894 *
2895 * Indicate to the mid and upper layers that an ATA
2896 * command has completed, with either an ok or not-ok status.
2829 * 2897 *
2830 * LOCKING: 2898 * LOCKING:
2899 * spin_lock_irqsave(host_set lock)
2831 * 2900 *
2832 */ 2901 */
2833 2902
@@ -3234,13 +3303,18 @@ idle_irq:
3234 3303
3235/** 3304/**
3236 * ata_interrupt - Default ATA host interrupt handler 3305 * ata_interrupt - Default ATA host interrupt handler
3237 * @irq: irq line 3306 * @irq: irq line (unused)
3238 * @dev_instance: pointer to our host information structure 3307 * @dev_instance: pointer to our ata_host_set information structure
3239 * @regs: unused 3308 * @regs: unused
3240 * 3309 *
3310 * Default interrupt handler for PCI IDE devices. Calls
3311 * ata_host_intr() for each port that is not disabled.
3312 *
3241 * LOCKING: 3313 * LOCKING:
3314 * Obtains host_set lock during operation.
3242 * 3315 *
3243 * RETURNS: 3316 * RETURNS:
3317 * IRQ_NONE or IRQ_HANDLED.
3244 * 3318 *
3245 */ 3319 */
3246 3320
@@ -3381,7 +3455,11 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
3381 * @ent: Probe information provided by low-level driver 3455 * @ent: Probe information provided by low-level driver
3382 * @port_no: Port number associated with this ata_port 3456 * @port_no: Port number associated with this ata_port
3383 * 3457 *
3458 * Initialize a new ata_port structure, and its associated
3459 * scsi_host.
3460 *
3384 * LOCKING: 3461 * LOCKING:
3462 * Inherited from caller.
3385 * 3463 *
3386 */ 3464 */
3387 3465
@@ -3436,9 +3514,13 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
3436 * @host_set: Collections of ports to which we add 3514 * @host_set: Collections of ports to which we add
3437 * @port_no: Port number associated with this host 3515 * @port_no: Port number associated with this host
3438 * 3516 *
3517 * Attach low-level ATA driver to system.
3518 *
3439 * LOCKING: 3519 * LOCKING:
3520 * PCI/etc. bus probe sem.
3440 * 3521 *
3441 * RETURNS: 3522 * RETURNS:
3523 * New ata_port on success, for NULL on error.
3442 * 3524 *
3443 */ 3525 */
3444 3526
@@ -3471,12 +3553,22 @@ err_out:
3471} 3553}
3472 3554
3473/** 3555/**
3474 * ata_device_add - 3556 * ata_device_add - Register hardware device with ATA and SCSI layers
3475 * @ent: 3557 * @ent: Probe information describing hardware device to be registered
3558 *
3559 * This function processes the information provided in the probe
3560 * information struct @ent, allocates the necessary ATA and SCSI
3561 * host information structures, initializes them, and registers
3562 * everything with requisite kernel subsystems.
3563 *
3564 * This function requests irqs, probes the ATA bus, and probes
3565 * the SCSI bus.
3476 * 3566 *
3477 * LOCKING: 3567 * LOCKING:
3568 * PCI/etc. bus probe sem.
3478 * 3569 *
3479 * RETURNS: 3570 * RETURNS:
3571 * Number of ports registered. Zero on error (no ports registered).
3480 * 3572 *
3481 */ 3573 */
3482 3574
@@ -3755,6 +3847,7 @@ ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port,
3755 * Inherited from PCI layer (may sleep). 3847 * Inherited from PCI layer (may sleep).
3756 * 3848 *
3757 * RETURNS: 3849 * RETURNS:
3850 * Zero on success, negative on errno-based value on error.
3758 * 3851 *
3759 */ 3852 */
3760 3853
@@ -3974,15 +4067,6 @@ int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits)
3974#endif /* CONFIG_PCI */ 4067#endif /* CONFIG_PCI */
3975 4068
3976 4069
3977/**
3978 * ata_init -
3979 *
3980 * LOCKING:
3981 *
3982 * RETURNS:
3983 *
3984 */
3985
3986static int __init ata_init(void) 4070static int __init ata_init(void)
3987{ 4071{
3988 ata_wq = create_workqueue("ata"); 4072 ata_wq = create_workqueue("ata");