[PATCH] Minor libata documentation patch

I fleshed out libata.tmpl a bit while I was taking notes.

authored by Edward Falk and committed by Jeff Garzik 8b2af8f0 c7b645f9

+93 -3
+93 -3
Documentation/DocBook/libata.tmpl
··· 84 84 Called from ata_bus_probe() and ata_bus_reset() error paths, 85 85 as well as when unregistering from the SCSI module (rmmod, hot 86 86 unplug). 87 + This function should do whatever needs to be done to take the 88 + port out of use. In most cases, ata_port_disable() can be used 89 + as this hook. 90 + </para> 91 + <para> 92 + Called from ata_bus_probe() on a failed probe. 93 + Called from ata_bus_reset() on a failed bus reset. 94 + Called from ata_scsi_release(). 87 95 </para> 88 96 89 97 </sect2> ··· 105 97 Called after IDENTIFY [PACKET] DEVICE is issued to each device 106 98 found. Typically used to apply device-specific fixups prior to 107 99 issue of SET FEATURES - XFER MODE, and prior to operation. 100 + </para> 101 + <para> 102 + Called by ata_device_add() after ata_dev_identify() determines 103 + a device is present. 104 + </para> 105 + <para> 106 + This entry may be specified as NULL in ata_port_operations. 108 107 </para> 109 108 110 109 </sect2> ··· 150 135 registers / DMA buffers. ->tf_read() is called to read the 151 136 hardware registers / DMA buffers, to obtain the current set of 152 137 taskfile register values. 138 + Most drivers for taskfile-based hardware (PIO or MMIO) use 139 + ata_tf_load() and ata_tf_read() for these hooks. 153 140 </para> 154 141 155 142 </sect2> ··· 164 147 <para> 165 148 causes an ATA command, previously loaded with 166 149 ->tf_load(), to be initiated in hardware. 150 + Most drivers for taskfile-based hardware use ata_exec_command() 151 + for this hook. 167 152 </para> 168 153 169 154 </sect2> ··· 179 160 Allow low-level driver to filter ATA PACKET commands, returning a status 180 161 indicating whether or not it is OK to use DMA for the supplied PACKET 181 162 command. 163 + </para> 164 + <para> 165 + This hook may be specified as NULL, in which case libata will 166 + assume that atapi dma can be supported. 182 167 </para> 183 168 184 169 </sect2> ··· 198 175 Reads the Status/AltStatus/Error ATA shadow register from 199 176 hardware. On some hardware, reading the Status register has 200 177 the side effect of clearing the interrupt condition. 178 + Most drivers for taskfile-based hardware use 179 + ata_check_status() for this hook. 180 + </para> 181 + <para> 182 + Note that because this is called from ata_device_add(), at 183 + least a dummy function that clears device interrupts must be 184 + provided for all drivers, even if the controller doesn't 185 + actually have a taskfile status register. 201 186 </para> 202 187 203 188 </sect2> ··· 219 188 Issues the low-level hardware command(s) that causes one of N 220 189 hardware devices to be considered 'selected' (active and 221 190 available for use) on the ATA bus. This generally has no 222 - meaning on FIS-based devices. 191 + meaning on FIS-based devices. 192 + </para> 193 + <para> 194 + Most drivers for taskfile-based hardware use 195 + ata_std_dev_select() for this hook. Controllers which do not 196 + support second drives on a port (such as SATA contollers) will 197 + use ata_noop_dev_select(). 223 198 </para> 224 199 225 200 </sect2> ··· 241 204 for device presence (PATA and SATA), typically a soft reset 242 205 (SRST) will be performed. Drivers typically use the helper 243 206 functions ata_bus_reset() or sata_phy_reset() for this hook. 207 + Many SATA drivers use sata_phy_reset() or call it from within 208 + their own phy_reset() functions. 244 209 </para> 245 210 246 211 </sect2> ··· 266 227 These hooks are typically either no-ops, or simply not implemented, in 267 228 FIS-based drivers. 268 229 </para> 230 + <para> 231 + Most legacy IDE drivers use ata_bmdma_setup() for the bmdma_setup() 232 + hook. ata_bmdma_setup() will write the pointer to the PRD table to 233 + the IDE PRD Table Address register, enable DMA in the DMA Command 234 + register, and call exec_command() to begin the transfer. 235 + </para> 236 + <para> 237 + Most legacy IDE drivers use ata_bmdma_start() for the bmdma_start() 238 + hook. ata_bmdma_start() will write the ATA_DMA_START flag to the DMA 239 + Command register. 240 + </para> 241 + <para> 242 + Many legacy IDE drivers use ata_bmdma_stop() for the bmdma_stop() 243 + hook. ata_bmdma_stop() clears the ATA_DMA_START flag in the DMA 244 + command register. 245 + </para> 246 + <para> 247 + Many legacy IDE drivers use ata_bmdma_status() as the bmdma_status() hook. 248 + </para> 269 249 270 250 </sect2> 271 251 ··· 307 249 and S/G tables have been prepared. IDE BMDMA drivers use the 308 250 helper function ata_qc_issue_prot() for taskfile protocol-based 309 251 dispatch. More advanced drivers implement their own ->qc_issue. 252 + </para> 253 + <para> 254 + ata_qc_issue_prot() calls ->tf_load(), ->bmdma_setup(), and 255 + ->bmdma_start() as necessary to initiate a transfer. 310 256 </para> 311 257 312 258 </sect2> ··· 341 279 before the interrupt handler is registered, to be sure hardware 342 280 is quiet. 343 281 </para> 282 + <para> 283 + The second argument, dev_instance, should be cast to a pointer 284 + to struct ata_host_set. 285 + </para> 286 + <para> 287 + Most legacy IDE drivers use ata_interrupt() for the 288 + irq_handler hook, which scans all ports in the host_set, 289 + determines which queued command was active (if any), and calls 290 + ata_host_intr(ap,qc). 291 + </para> 292 + <para> 293 + Most legacy IDE drivers use ata_bmdma_irq_clear() for the 294 + irq_clear() hook, which simply clears the interrupt and error 295 + flags in the DMA status register. 296 + </para> 344 297 345 298 </sect2> 346 299 ··· 369 292 <para> 370 293 Read and write standard SATA phy registers. Currently only used 371 294 if ->phy_reset hook called the sata_phy_reset() helper function. 295 + sc_reg is one of SCR_STATUS, SCR_CONTROL, SCR_ERROR, or SCR_ACTIVE. 372 296 </para> 373 297 374 298 </sect2> ··· 385 307 ->port_start() is called just after the data structures for each 386 308 port are initialized. Typically this is used to alloc per-port 387 309 DMA buffers / tables / rings, enable DMA engines, and similar 388 - tasks. 310 + tasks. Some drivers also use this entry point as a chance to 311 + allocate driver-private memory for ap->private_data. 312 + </para> 313 + <para> 314 + Many drivers use ata_port_start() as this hook or call 315 + it from their own port_start() hooks. ata_port_start() 316 + allocates space for a legacy IDE PRD table and returns. 389 317 </para> 390 318 <para> 391 319 ->port_stop() is called after ->host_stop(). It's sole function 392 320 is to release DMA/memory resources, now that they are no longer 393 - actively being used. 321 + actively being used. Many drivers also free driver-private 322 + data from port at this time. 323 + </para> 324 + <para> 325 + Many drivers use ata_port_stop() as this hook, which frees the 326 + PRD table. 394 327 </para> 395 328 <para> 396 329 ->host_stop() is called after all ->port_stop() calls 397 330 have completed. The hook must finalize hardware shutdown, release DMA 398 331 and other resources, etc. 332 + This hook may be specified as NULL, in which case it is not called. 399 333 </para> 400 334 401 335 </sect2>