diff options
-rw-r--r-- | Documentation/DocBook/libata.tmpl | 104 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 2 |
2 files changed, 81 insertions, 25 deletions
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index f869b03929db..e97c32314541 100644 --- a/Documentation/DocBook/libata.tmpl +++ b/Documentation/DocBook/libata.tmpl | |||
@@ -169,6 +169,22 @@ void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); | |||
169 | 169 | ||
170 | </sect2> | 170 | </sect2> |
171 | 171 | ||
172 | <sect2><title>PIO data read/write</title> | ||
173 | <programlisting> | ||
174 | void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); | ||
175 | </programlisting> | ||
176 | |||
177 | <para> | ||
178 | All bmdma-style drivers must implement this hook. This is the low-level | ||
179 | operation that actually copies the data bytes during a PIO data | ||
180 | transfer. | ||
181 | Typically the driver | ||
182 | will choose one of ata_pio_data_xfer_noirq(), ata_pio_data_xfer(), or | ||
183 | ata_mmio_data_xfer(). | ||
184 | </para> | ||
185 | |||
186 | </sect2> | ||
187 | |||
172 | <sect2><title>ATA command execute</title> | 188 | <sect2><title>ATA command execute</title> |
173 | <programlisting> | 189 | <programlisting> |
174 | void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); | 190 | void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); |
@@ -204,11 +220,10 @@ command. | |||
204 | <programlisting> | 220 | <programlisting> |
205 | u8 (*check_status)(struct ata_port *ap); | 221 | u8 (*check_status)(struct ata_port *ap); |
206 | u8 (*check_altstatus)(struct ata_port *ap); | 222 | u8 (*check_altstatus)(struct ata_port *ap); |
207 | u8 (*check_err)(struct ata_port *ap); | ||
208 | </programlisting> | 223 | </programlisting> |
209 | 224 | ||
210 | <para> | 225 | <para> |
211 | Reads the Status/AltStatus/Error ATA shadow register from | 226 | Reads the Status/AltStatus ATA shadow register from |
212 | hardware. On some hardware, reading the Status register has | 227 | hardware. On some hardware, reading the Status register has |
213 | the side effect of clearing the interrupt condition. | 228 | the side effect of clearing the interrupt condition. |
214 | Most drivers for taskfile-based hardware use | 229 | Most drivers for taskfile-based hardware use |
@@ -269,23 +284,6 @@ void (*set_mode) (struct ata_port *ap); | |||
269 | 284 | ||
270 | </sect2> | 285 | </sect2> |
271 | 286 | ||
272 | <sect2><title>Reset ATA bus</title> | ||
273 | <programlisting> | ||
274 | void (*phy_reset) (struct ata_port *ap); | ||
275 | </programlisting> | ||
276 | |||
277 | <para> | ||
278 | The very first step in the probe phase. Actions vary depending | ||
279 | on the bus type, typically. After waking up the device and probing | ||
280 | for device presence (PATA and SATA), typically a soft reset | ||
281 | (SRST) will be performed. Drivers typically use the helper | ||
282 | functions ata_bus_reset() or sata_phy_reset() for this hook. | ||
283 | Many SATA drivers use sata_phy_reset() or call it from within | ||
284 | their own phy_reset() functions. | ||
285 | </para> | ||
286 | |||
287 | </sect2> | ||
288 | |||
289 | <sect2><title>Control PCI IDE BMDMA engine</title> | 287 | <sect2><title>Control PCI IDE BMDMA engine</title> |
290 | <programlisting> | 288 | <programlisting> |
291 | void (*bmdma_setup) (struct ata_queued_cmd *qc); | 289 | void (*bmdma_setup) (struct ata_queued_cmd *qc); |
@@ -354,16 +352,74 @@ int (*qc_issue) (struct ata_queued_cmd *qc); | |||
354 | 352 | ||
355 | </sect2> | 353 | </sect2> |
356 | 354 | ||
357 | <sect2><title>Timeout (error) handling</title> | 355 | <sect2><title>Exception and probe handling (EH)</title> |
358 | <programlisting> | 356 | <programlisting> |
359 | void (*eng_timeout) (struct ata_port *ap); | 357 | void (*eng_timeout) (struct ata_port *ap); |
358 | void (*phy_reset) (struct ata_port *ap); | ||
359 | </programlisting> | ||
360 | |||
361 | <para> | ||
362 | Deprecated. Use ->error_handler() instead. | ||
363 | </para> | ||
364 | |||
365 | <programlisting> | ||
366 | void (*freeze) (struct ata_port *ap); | ||
367 | void (*thaw) (struct ata_port *ap); | ||
368 | </programlisting> | ||
369 | |||
370 | <para> | ||
371 | ata_port_freeze() is called when HSM violations or some other | ||
372 | condition disrupts normal operation of the port. A frozen port | ||
373 | is not allowed to perform any operation until the port is | ||
374 | thawed, which usually follows a successful reset. | ||
375 | </para> | ||
376 | |||
377 | <para> | ||
378 | The optional ->freeze() callback can be used for freezing the port | ||
379 | hardware-wise (e.g. mask interrupt and stop DMA engine). If a | ||
380 | port cannot be frozen hardware-wise, the interrupt handler | ||
381 | must ack and clear interrupts unconditionally while the port | ||
382 | is frozen. | ||
383 | </para> | ||
384 | <para> | ||
385 | The optional ->thaw() callback is called to perform the opposite of ->freeze(): | ||
386 | prepare the port for normal operation once again. Unmask interrupts, | ||
387 | start DMA engine, etc. | ||
388 | </para> | ||
389 | |||
390 | <programlisting> | ||
391 | void (*error_handler) (struct ata_port *ap); | ||
392 | </programlisting> | ||
393 | |||
394 | <para> | ||
395 | ->error_handler() is a driver's hook into probe, hotplug, and recovery | ||
396 | and other exceptional conditions. The primary responsibility of an | ||
397 | implementation is to call ata_do_eh() or ata_bmdma_drive_eh() with a set | ||
398 | of EH hooks as arguments: | ||
399 | </para> | ||
400 | |||
401 | <para> | ||
402 | 'prereset' hook (may be NULL) is called during an EH reset, before any other actions | ||
403 | are taken. | ||
404 | </para> | ||
405 | |||
406 | <para> | ||
407 | 'postreset' hook (may be NULL) is called after the EH reset is performed. Based on | ||
408 | existing conditions, severity of the problem, and hardware capabilities, | ||
409 | </para> | ||
410 | |||
411 | <para> | ||
412 | Either 'softreset' (may be NULL) or 'hardreset' (may be NULL) will be | ||
413 | called to perform the low-level EH reset. | ||
414 | </para> | ||
415 | |||
416 | <programlisting> | ||
417 | void (*post_internal_cmd) (struct ata_queued_cmd *qc); | ||
360 | </programlisting> | 418 | </programlisting> |
361 | 419 | ||
362 | <para> | 420 | <para> |
363 | This is a high level error handling function, called from the | 421 | Perform any hardware-specific actions necessary to finish processing |
364 | error handling thread, when a command times out. Most newer | 422 | after executing a probe-time or EH-time command via ata_exec_internal(). |
365 | hardware will implement its own error handling code here. IDE BMDMA | ||
366 | drivers may use the helper function ata_eng_timeout(). | ||
367 | </para> | 423 | </para> |
368 | 424 | ||
369 | </sect2> | 425 | </sect2> |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index d73cb3672d6a..89c3fbe6e67c 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -3496,7 +3496,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
3496 | 3496 | ||
3497 | /** | 3497 | /** |
3498 | * ata_mmio_data_xfer - Transfer data by MMIO | 3498 | * ata_mmio_data_xfer - Transfer data by MMIO |
3499 | * @dev: device for this I/O | 3499 | * @adev: device for this I/O |
3500 | * @buf: data buffer | 3500 | * @buf: data buffer |
3501 | * @buflen: buffer length | 3501 | * @buflen: buffer length |
3502 | * @write_data: read/write | 3502 | * @write_data: read/write |