···84 Called from ata_bus_probe() and ata_bus_reset() error paths,85 as well as when unregistering from the SCSI module (rmmod, hot86 unplug).0000000087 </para>8889 </sect2>···105 Called after IDENTIFY [PACKET] DEVICE is issued to each device106 found. Typically used to apply device-specific fixups prior to107 issue of SET FEATURES - XFER MODE, and prior to operation.0000000108 </para>109110 </sect2>···150 registers / DMA buffers. ->tf_read() is called to read the151 hardware registers / DMA buffers, to obtain the current set of152 taskfile register values.00153 </para>154155 </sect2>···164 <para>165 causes an ATA command, previously loaded with166 ->tf_load(), to be initiated in hardware.00167 </para>168169 </sect2>···179Allow low-level driver to filter ATA PACKET commands, returning a status180indicating whether or not it is OK to use DMA for the supplied PACKET181command.0000182 </para>183184 </sect2>···198 Reads the Status/AltStatus/Error ATA shadow register from199 hardware. On some hardware, reading the Status register has200 the side effect of clearing the interrupt condition.00000000201 </para>202203 </sect2>···219 Issues the low-level hardware command(s) that causes one of N220 hardware devices to be considered 'selected' (active and221 available for use) on the ATA bus. This generally has no222-meaning on FIS-based devices.000000223 </para>224225 </sect2>···241 for device presence (PATA and SATA), typically a soft reset242 (SRST) will be performed. Drivers typically use the helper243 functions ata_bus_reset() or sata_phy_reset() for this hook.00244 </para>245246 </sect2>···266These hooks are typically either no-ops, or simply not implemented, in267FIS-based drivers.268 </para>0000000000000000000269270 </sect2>271···307 and S/G tables have been prepared. IDE BMDMA drivers use the308 helper function ata_qc_issue_prot() for taskfile protocol-based309 dispatch. More advanced drivers implement their own ->qc_issue.0000310 </para>311312 </sect2>···341 before the interrupt handler is registered, to be sure hardware342 is quiet.343 </para>000000000000000344345 </sect2>346···369 <para>370 Read and write standard SATA phy registers. Currently only used371 if ->phy_reset hook called the sata_phy_reset() helper function.0372 </para>373374 </sect2>···385 ->port_start() is called just after the data structures for each386 port are initialized. Typically this is used to alloc per-port387 DMA buffers / tables / rings, enable DMA engines, and similar388- tasks. 000000389 </para>390 <para>391 ->port_stop() is called after ->host_stop(). It's sole function392 is to release DMA/memory resources, now that they are no longer393- actively being used.00000394 </para>395 <para>396 ->host_stop() is called after all ->port_stop() calls397have completed. The hook must finalize hardware shutdown, release DMA398and other resources, etc.0399 </para>400401 </sect2>
···84 Called from ata_bus_probe() and ata_bus_reset() error paths,85 as well as when unregistering from the SCSI module (rmmod, hot86 unplug).87+ This function should do whatever needs to be done to take the88+ port out of use. In most cases, ata_port_disable() can be used89+ 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().95 </para>9697 </sect2>···97 Called after IDENTIFY [PACKET] DEVICE is issued to each device98 found. Typically used to apply device-specific fixups prior to99 issue of SET FEATURES - XFER MODE, and prior to operation.100+ </para>101+ <para>102+ Called by ata_device_add() after ata_dev_identify() determines103+ a device is present.104+ </para>105+ <para>106+ This entry may be specified as NULL in ata_port_operations.107 </para>108109 </sect2>···135 registers / DMA buffers. ->tf_read() is called to read the136 hardware registers / DMA buffers, to obtain the current set of137 taskfile register values.138+ Most drivers for taskfile-based hardware (PIO or MMIO) use139+ ata_tf_load() and ata_tf_read() for these hooks.140 </para>141142 </sect2>···147 <para>148 causes an ATA command, previously loaded with149 ->tf_load(), to be initiated in hardware.150+ Most drivers for taskfile-based hardware use ata_exec_command()151+ for this hook.152 </para>153154 </sect2>···160Allow low-level driver to filter ATA PACKET commands, returning a status161indicating whether or not it is OK to use DMA for the supplied PACKET162command.163+ </para>164+ <para>165+ This hook may be specified as NULL, in which case libata will166+ assume that atapi dma can be supported.167 </para>168169 </sect2>···175 Reads the Status/AltStatus/Error ATA shadow register from176 hardware. On some hardware, reading the Status register has177 the side effect of clearing the interrupt condition.178+ Most drivers for taskfile-based hardware use179+ ata_check_status() for this hook.180+ </para>181+ <para>182+ Note that because this is called from ata_device_add(), at183+ least a dummy function that clears device interrupts must be184+ provided for all drivers, even if the controller doesn't185+ actually have a taskfile status register.186 </para>187188 </sect2>···188 Issues the low-level hardware command(s) that causes one of N189 hardware devices to be considered 'selected' (active and190 available for use) on the ATA bus. This generally has no191+ meaning on FIS-based devices.192+ </para>193+ <para>194+ Most drivers for taskfile-based hardware use195+ ata_std_dev_select() for this hook. Controllers which do not196+ support second drives on a port (such as SATA contollers) will197+ use ata_noop_dev_select().198 </para>199200 </sect2>···204 for device presence (PATA and SATA), typically a soft reset205 (SRST) will be performed. Drivers typically use the helper206 functions ata_bus_reset() or sata_phy_reset() for this hook.207+ Many SATA drivers use sata_phy_reset() or call it from within208+ their own phy_reset() functions.209 </para>210211 </sect2>···227These hooks are typically either no-ops, or simply not implemented, in228FIS-based drivers.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 to233+the IDE PRD Table Address register, enable DMA in the DMA Command234+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 DMA239+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 DMA244+command register.245+ </para>246+ <para>247+Many legacy IDE drivers use ata_bmdma_status() as the bmdma_status() hook.248+ </para>249250 </sect2>251···249 and S/G tables have been prepared. IDE BMDMA drivers use the250 helper function ata_qc_issue_prot() for taskfile protocol-based251 dispatch. More advanced drivers implement their own ->qc_issue.252+ </para>253+ <para>254+ ata_qc_issue_prot() calls ->tf_load(), ->bmdma_setup(), and255+ ->bmdma_start() as necessary to initiate a transfer.256 </para>257258 </sect2>···279 before the interrupt handler is registered, to be sure hardware280 is quiet.281 </para>282+ <para>283+ The second argument, dev_instance, should be cast to a pointer284+ to struct ata_host_set.285+ </para>286+ <para>287+ Most legacy IDE drivers use ata_interrupt() for the288+ irq_handler hook, which scans all ports in the host_set,289+ determines which queued command was active (if any), and calls290+ ata_host_intr(ap,qc).291+ </para>292+ <para>293+ Most legacy IDE drivers use ata_bmdma_irq_clear() for the294+ irq_clear() hook, which simply clears the interrupt and error295+ flags in the DMA status register.296+ </para>297298 </sect2>299···292 <para>293 Read and write standard SATA phy registers. Currently only used294 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.296 </para>297298 </sect2>···307 ->port_start() is called just after the data structures for each308 port are initialized. Typically this is used to alloc per-port309 DMA buffers / tables / rings, enable DMA engines, and similar310+ tasks. Some drivers also use this entry point as a chance to311+ allocate driver-private memory for ap->private_data.312+ </para>313+ <para>314+ Many drivers use ata_port_start() as this hook or call315+ it from their own port_start() hooks. ata_port_start()316+ allocates space for a legacy IDE PRD table and returns.317 </para>318 <para>319 ->port_stop() is called after ->host_stop(). It's sole function320 is to release DMA/memory resources, now that they are no longer321+ actively being used. Many drivers also free driver-private322+ data from port at this time.323+ </para>324+ <para>325+ Many drivers use ata_port_stop() as this hook, which frees the326+ PRD table.327 </para>328 <para>329 ->host_stop() is called after all ->port_stop() calls330have completed. The hook must finalize hardware shutdown, release DMA331and other resources, etc.332+ This hook may be specified as NULL, in which case it is not called.333 </para>334335 </sect2>