aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/libata.tmpl58
-rw-r--r--drivers/scsi/libata-core.c57
2 files changed, 83 insertions, 32 deletions
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl
index 773ae9fd99dc..41053aed41f4 100644
--- a/Documentation/DocBook/libata.tmpl
+++ b/Documentation/DocBook/libata.tmpl
@@ -14,7 +14,7 @@
14 </authorgroup> 14 </authorgroup>
15 15
16 <copyright> 16 <copyright>
17 <year>2003</year> 17 <year>2003-2005</year>
18 <holder>Jeff Garzik</holder> 18 <holder>Jeff Garzik</holder>
19 </copyright> 19 </copyright>
20 20
@@ -145,14 +145,25 @@ void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf);
145 </para> 145 </para>
146 146
147 <programlisting> 147 <programlisting>
148int (*check_atapi_dma) (struct ata_queued_cmd *qc);
149 </programlisting>
150
151 <para>
152Allow low-level driver to filter ATA PACKET commands, returning a status
153indicating whether or not it is OK to use DMA for the supplied PACKET
154command.
155 </para>
156
157 <programlisting>
148u8 (*check_status)(struct ata_port *ap); 158u8 (*check_status)(struct ata_port *ap);
149void (*dev_select)(struct ata_port *ap, unsigned int device); 159u8 (*check_altstatus)(struct ata_port *ap);
160u8 (*check_err)(struct ata_port *ap);
150 </programlisting> 161 </programlisting>
151 162
152 <para> 163 <para>
153 Reads the Status ATA shadow register from hardware. On some 164 Reads the Status/AltStatus/Error ATA shadow register from
154 hardware, this has the side effect of clearing the interrupt 165 hardware. On some hardware, reading the Status register has
155 condition. 166 the side effect of clearing the interrupt condition.
156 </para> 167 </para>
157 168
158 <programlisting> 169 <programlisting>
@@ -162,7 +173,8 @@ void (*dev_select)(struct ata_port *ap, unsigned int device);
162 <para> 173 <para>
163 Issues the low-level hardware command(s) that causes one of N 174 Issues the low-level hardware command(s) that causes one of N
164 hardware devices to be considered 'selected' (active and 175 hardware devices to be considered 'selected' (active and
165 available for use) on the ATA bus. 176 available for use) on the ATA bus. This generally has no
177meaning on FIS-based devices.
166 </para> 178 </para>
167 179
168 <programlisting> 180 <programlisting>
@@ -180,12 +192,20 @@ void (*phy_reset) (struct ata_port *ap);
180 <programlisting> 192 <programlisting>
181void (*bmdma_setup) (struct ata_queued_cmd *qc); 193void (*bmdma_setup) (struct ata_queued_cmd *qc);
182void (*bmdma_start) (struct ata_queued_cmd *qc); 194void (*bmdma_start) (struct ata_queued_cmd *qc);
195void (*bmdma_stop) (struct ata_port *ap);
196u8 (*bmdma_status) (struct ata_port *ap);
183 </programlisting> 197 </programlisting>
184 198
185 <para> 199 <para>
186 When setting up an IDE BMDMA transaction, these hooks arm 200When setting up an IDE BMDMA transaction, these hooks arm
187 (->bmdma_setup) and fire (->bmdma_start) the hardware's DMA 201(->bmdma_setup), fire (->bmdma_start), and halt (->bmdma_stop)
188 engine. 202the hardware's DMA engine. ->bmdma_status is used to read the standard
203PCI IDE DMA Status register.
204 </para>
205
206 <para>
207These hooks are typically either no-ops, or simply not implemented, in
208FIS-based drivers.
189 </para> 209 </para>
190 210
191 <programlisting> 211 <programlisting>
@@ -205,9 +225,7 @@ int (*qc_issue) (struct ata_queued_cmd *qc);
205 ->qc_issue is used to make a command active, once the hardware 225 ->qc_issue is used to make a command active, once the hardware
206 and S/G tables have been prepared. IDE BMDMA drivers use the 226 and S/G tables have been prepared. IDE BMDMA drivers use the
207 helper function ata_qc_issue_prot() for taskfile protocol-based 227 helper function ata_qc_issue_prot() for taskfile protocol-based
208 dispatch. More advanced drivers roll their own ->qc_issue 228 dispatch. More advanced drivers implement their own ->qc_issue.
209 implementation, using this as the "issue new ATA command to
210 hardware" hook.
211 </para> 229 </para>
212 230
213 <programlisting> 231 <programlisting>
@@ -215,8 +233,10 @@ void (*eng_timeout) (struct ata_port *ap);
215 </programlisting> 233 </programlisting>
216 234
217 <para> 235 <para>
218 This is a high level error handling function, called from the 236This is a high level error handling function, called from the
219 error handling thread, when a command times out. 237error handling thread, when a command times out. Most newer
238hardware will implement its own error handling code here. IDE BMDMA
239drivers may use the helper function ata_eng_timeout().
220 </para> 240 </para>
221 241
222 <programlisting> 242 <programlisting>
@@ -255,15 +275,15 @@ void (*host_stop) (struct ata_host_set *host_set);
255 tasks. 275 tasks.
256 </para> 276 </para>
257 <para> 277 <para>
258 ->host_stop() is called when the rmmod or hot unplug process
259 begins. The hook must stop all hardware interrupts, DMA
260 engines, etc.
261 </para>
262 <para>
263 ->port_stop() is called after ->host_stop(). It's sole function 278 ->port_stop() is called after ->host_stop(). It's sole function
264 is to release DMA/memory resources, now that they are no longer 279 is to release DMA/memory resources, now that they are no longer
265 actively being used. 280 actively being used.
266 </para> 281 </para>
282 <para>
283 ->host_stop() is called after all ->port_stop() calls
284have completed. The hook must finalize hardware shutdown, release DMA
285and other resources, etc.
286 </para>
267 287
268 </sect1> 288 </sect1>
269 </chapter> 289 </chapter>
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 63d3f70d06e1..4d707d06a5d1 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1241,10 +1241,14 @@ void ata_port_probe(struct ata_port *ap)
1241} 1241}
1242 1242
1243/** 1243/**
1244 * __sata_phy_reset - 1244 * __sata_phy_reset - Wake/reset a low-level SATA PHY
1245 * @ap: 1245 * @ap: SATA port associated with target SATA PHY.
1246 * 1246 *
1247 * LOCKING: 1247 * This function issues commands to standard SATA Sxxx
1248 * PHY registers, to wake up the phy (and device), and
1249 * clear any reset condition.
1250 *
1251 * LOCKING: None. Serialized during ata_bus_probe().
1248 * 1252 *
1249 */ 1253 */
1250void __sata_phy_reset(struct ata_port *ap) 1254void __sata_phy_reset(struct ata_port *ap)
@@ -1289,10 +1293,13 @@ void __sata_phy_reset(struct ata_port *ap)
1289} 1293}
1290 1294
1291/** 1295/**
1292 * __sata_phy_reset - 1296 * sata_phy_reset - Reset SATA bus.
1293 * @ap: 1297 * @ap: SATA port associated with target SATA PHY.
1294 * 1298 *
1295 * LOCKING: 1299 * This function resets the SATA bus, and then probes
1300 * the bus for devices.
1301 *
1302 * LOCKING: None. Serialized during ata_bus_probe().
1296 * 1303 *
1297 */ 1304 */
1298void sata_phy_reset(struct ata_port *ap) 1305void sata_phy_reset(struct ata_port *ap)
@@ -1304,10 +1311,16 @@ void sata_phy_reset(struct ata_port *ap)
1304} 1311}
1305 1312
1306/** 1313/**
1307 * ata_port_disable - 1314 * ata_port_disable - Disable port.
1308 * @ap: 1315 * @ap: Port to be disabled.
1309 * 1316 *
1310 * LOCKING: 1317 * Modify @ap data structure such that the system
1318 * thinks that the entire port is disabled, and should
1319 * never attempt to probe or communicate with devices
1320 * on this port.
1321 *
1322 * LOCKING: host_set lock, or some other form of
1323 * serialization.
1311 */ 1324 */
1312 1325
1313void ata_port_disable(struct ata_port *ap) 1326void ata_port_disable(struct ata_port *ap)
@@ -1416,7 +1429,9 @@ static void ata_host_set_dma(struct ata_port *ap, u8 xfer_mode,
1416 * ata_set_mode - Program timings and issue SET FEATURES - XFER 1429 * ata_set_mode - Program timings and issue SET FEATURES - XFER
1417 * @ap: port on which timings will be programmed 1430 * @ap: port on which timings will be programmed
1418 * 1431 *
1419 * LOCKING: 1432 * Set ATA device disk transfer mode (PIO3, UDMA6, etc.).
1433 *
1434 * LOCKING: None. Serialized during ata_bus_probe().
1420 * 1435 *
1421 */ 1436 */
1422static void ata_set_mode(struct ata_port *ap) 1437static void ata_set_mode(struct ata_port *ap)
@@ -1467,7 +1482,10 @@ err_out:
1467 * @tmout_pat: impatience timeout 1482 * @tmout_pat: impatience timeout
1468 * @tmout: overall timeout 1483 * @tmout: overall timeout
1469 * 1484 *
1470 * LOCKING: 1485 * Sleep until ATA Status register bit BSY clears,
1486 * or a timeout occurs.
1487 *
1488 * LOCKING: None.
1471 * 1489 *
1472 */ 1490 */
1473 1491
@@ -1556,7 +1574,7 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask)
1556 * ata_bus_edd - 1574 * ata_bus_edd -
1557 * @ap: 1575 * @ap:
1558 * 1576 *
1559 * LOCKING: 1577 * LOCKING: None. Serialized during ata_bus_probe().
1560 * 1578 *
1561 */ 1579 */
1562 1580
@@ -1909,7 +1927,10 @@ static int ata_choose_xfer_mode(struct ata_port *ap,
1909 * @ap: Port associated with device @dev 1927 * @ap: Port associated with device @dev
1910 * @dev: Device to which command will be sent 1928 * @dev: Device to which command will be sent
1911 * 1929 *
1912 * LOCKING: 1930 * Issue SET FEATURES - XFER MODE command to device @dev
1931 * on port @ap.
1932 *
1933 * LOCKING: None. Serialized during ata_bus_probe().
1913 */ 1934 */
1914 1935
1915static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) 1936static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev)
@@ -1981,7 +2002,11 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
1981 * ata_fill_sg - Fill PCI IDE PRD table 2002 * ata_fill_sg - Fill PCI IDE PRD table
1982 * @qc: Metadata associated with taskfile to be transferred 2003 * @qc: Metadata associated with taskfile to be transferred
1983 * 2004 *
2005 * Fill PCI IDE PRD (scatter-gather) table with segments
2006 * associated with the current disk command.
2007 *
1984 * LOCKING: 2008 * LOCKING:
2009 * spin_lock_irqsave(host_set lock)
1985 * 2010 *
1986 */ 2011 */
1987static void ata_fill_sg(struct ata_queued_cmd *qc) 2012static void ata_fill_sg(struct ata_queued_cmd *qc)
@@ -2028,6 +2053,10 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
2028 * ata_check_atapi_dma - Check whether ATAPI DMA can be supported 2053 * ata_check_atapi_dma - Check whether ATAPI DMA can be supported
2029 * @qc: Metadata associated with taskfile to check 2054 * @qc: Metadata associated with taskfile to check
2030 * 2055 *
2056 * Allow low-level driver to filter ATA PACKET commands, returning
2057 * a status indicating whether or not it is OK to use DMA for the
2058 * supplied PACKET command.
2059 *
2031 * LOCKING: 2060 * LOCKING:
2032 * RETURNS: 0 when ATAPI DMA can be used 2061 * RETURNS: 0 when ATAPI DMA can be used
2033 * nonzero otherwise 2062 * nonzero otherwise
@@ -2046,6 +2075,8 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
2046 * ata_qc_prep - Prepare taskfile for submission 2075 * ata_qc_prep - Prepare taskfile for submission
2047 * @qc: Metadata associated with taskfile to be prepared 2076 * @qc: Metadata associated with taskfile to be prepared
2048 * 2077 *
2078 * Prepare ATA taskfile for submission.
2079 *
2049 * LOCKING: 2080 * LOCKING:
2050 * spin_lock_irqsave(host_set lock) 2081 * spin_lock_irqsave(host_set lock)
2051 */ 2082 */