aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/DocBook')
-rw-r--r--Documentation/DocBook/libata.tmpl57
1 files changed, 57 insertions, 0 deletions
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl
index 77b4a223a86c..6df1dfd18b65 100644
--- a/Documentation/DocBook/libata.tmpl
+++ b/Documentation/DocBook/libata.tmpl
@@ -60,9 +60,22 @@
60 60
61 <chapter id="libataDriverApi"> 61 <chapter id="libataDriverApi">
62 <title>libata Driver API</title> 62 <title>libata Driver API</title>
63 <para>
64 struct ata_port_operations is defined for every low-level libata
65 hardware driver, and it controls how the low-level driver
66 interfaces with the ATA and SCSI layers.
67 </para>
68 <para>
69 FIS-based drivers will hook into the system with ->qc_prep() and
70 ->qc_issue() high-level hooks. Hardware which behaves in a manner
71 similar to PCI IDE hardware may utilize several generic helpers,
72 defining at a bare minimum the bus I/O addresses of the ATA shadow
73 register blocks.
74 </para>
63 <sect1> 75 <sect1>
64 <title>struct ata_port_operations</title> 76 <title>struct ata_port_operations</title>
65 77
78 <sect2><title>Disable ATA port</title>
66 <programlisting> 79 <programlisting>
67void (*port_disable) (struct ata_port *); 80void (*port_disable) (struct ata_port *);
68 </programlisting> 81 </programlisting>
@@ -73,6 +86,9 @@ void (*port_disable) (struct ata_port *);
73 unplug). 86 unplug).
74 </para> 87 </para>
75 88
89 </sect2>
90
91 <sect2><title>Post-IDENTIFY device configuration</title>
76 <programlisting> 92 <programlisting>
77void (*dev_config) (struct ata_port *, struct ata_device *); 93void (*dev_config) (struct ata_port *, struct ata_device *);
78 </programlisting> 94 </programlisting>
@@ -83,6 +99,9 @@ void (*dev_config) (struct ata_port *, struct ata_device *);
83 issue of SET FEATURES - XFER MODE, and prior to operation. 99 issue of SET FEATURES - XFER MODE, and prior to operation.
84 </para> 100 </para>
85 101
102 </sect2>
103
104 <sect2><title>Set PIO/DMA mode</title>
86 <programlisting> 105 <programlisting>
87void (*set_piomode) (struct ata_port *, struct ata_device *); 106void (*set_piomode) (struct ata_port *, struct ata_device *);
88void (*set_dmamode) (struct ata_port *, struct ata_device *); 107void (*set_dmamode) (struct ata_port *, struct ata_device *);
@@ -103,6 +122,9 @@ void (*post_set_mode) (struct ata_port *ap);
103 ->set_dma_mode() is only called if DMA is possible. 122 ->set_dma_mode() is only called if DMA is possible.
104 </para> 123 </para>
105 124
125 </sect2>
126
127 <sect2><title>Taskfile read/write</title>
106 <programlisting> 128 <programlisting>
107void (*tf_load) (struct ata_port *ap, struct ata_taskfile *tf); 129void (*tf_load) (struct ata_port *ap, struct ata_taskfile *tf);
108void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); 130void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
@@ -115,6 +137,9 @@ void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
115 taskfile register values. 137 taskfile register values.
116 </para> 138 </para>
117 139
140 </sect2>
141
142 <sect2><title>ATA command execute</title>
118 <programlisting> 143 <programlisting>
119void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); 144void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf);
120 </programlisting> 145 </programlisting>
@@ -124,6 +149,9 @@ void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf);
124 ->tf_load(), to be initiated in hardware. 149 ->tf_load(), to be initiated in hardware.
125 </para> 150 </para>
126 151
152 </sect2>
153
154 <sect2><title>Per-cmd ATAPI DMA capabilities filter</title>
127 <programlisting> 155 <programlisting>
128int (*check_atapi_dma) (struct ata_queued_cmd *qc); 156int (*check_atapi_dma) (struct ata_queued_cmd *qc);
129 </programlisting> 157 </programlisting>
@@ -134,6 +162,9 @@ indicating whether or not it is OK to use DMA for the supplied PACKET
134command. 162command.
135 </para> 163 </para>
136 164
165 </sect2>
166
167 <sect2><title>Read specific ATA shadow registers</title>
137 <programlisting> 168 <programlisting>
138u8 (*check_status)(struct ata_port *ap); 169u8 (*check_status)(struct ata_port *ap);
139u8 (*check_altstatus)(struct ata_port *ap); 170u8 (*check_altstatus)(struct ata_port *ap);
@@ -146,6 +177,9 @@ u8 (*check_err)(struct ata_port *ap);
146 the side effect of clearing the interrupt condition. 177 the side effect of clearing the interrupt condition.
147 </para> 178 </para>
148 179
180 </sect2>
181
182 <sect2><title>Select ATA device on bus</title>
149 <programlisting> 183 <programlisting>
150void (*dev_select)(struct ata_port *ap, unsigned int device); 184void (*dev_select)(struct ata_port *ap, unsigned int device);
151 </programlisting> 185 </programlisting>
@@ -157,6 +191,9 @@ void (*dev_select)(struct ata_port *ap, unsigned int device);
157meaning on FIS-based devices. 191meaning on FIS-based devices.
158 </para> 192 </para>
159 193
194 </sect2>
195
196 <sect2><title>Reset ATA bus</title>
160 <programlisting> 197 <programlisting>
161void (*phy_reset) (struct ata_port *ap); 198void (*phy_reset) (struct ata_port *ap);
162 </programlisting> 199 </programlisting>
@@ -169,6 +206,9 @@ void (*phy_reset) (struct ata_port *ap);
169 functions ata_bus_reset() or sata_phy_reset() for this hook. 206 functions ata_bus_reset() or sata_phy_reset() for this hook.
170 </para> 207 </para>
171 208
209 </sect2>
210
211 <sect2><title>Control PCI IDE BMDMA engine</title>
172 <programlisting> 212 <programlisting>
173void (*bmdma_setup) (struct ata_queued_cmd *qc); 213void (*bmdma_setup) (struct ata_queued_cmd *qc);
174void (*bmdma_start) (struct ata_queued_cmd *qc); 214void (*bmdma_start) (struct ata_queued_cmd *qc);
@@ -188,6 +228,9 @@ These hooks are typically either no-ops, or simply not implemented, in
188FIS-based drivers. 228FIS-based drivers.
189 </para> 229 </para>
190 230
231 </sect2>
232
233 <sect2><title>High-level taskfile hooks</title>
191 <programlisting> 234 <programlisting>
192void (*qc_prep) (struct ata_queued_cmd *qc); 235void (*qc_prep) (struct ata_queued_cmd *qc);
193int (*qc_issue) (struct ata_queued_cmd *qc); 236int (*qc_issue) (struct ata_queued_cmd *qc);
@@ -208,6 +251,9 @@ int (*qc_issue) (struct ata_queued_cmd *qc);
208 dispatch. More advanced drivers implement their own ->qc_issue. 251 dispatch. More advanced drivers implement their own ->qc_issue.
209 </para> 252 </para>
210 253
254 </sect2>
255
256 <sect2><title>Timeout (error) handling</title>
211 <programlisting> 257 <programlisting>
212void (*eng_timeout) (struct ata_port *ap); 258void (*eng_timeout) (struct ata_port *ap);
213 </programlisting> 259 </programlisting>
@@ -219,6 +265,9 @@ hardware will implement its own error handling code here. IDE BMDMA
219drivers may use the helper function ata_eng_timeout(). 265drivers may use the helper function ata_eng_timeout().
220 </para> 266 </para>
221 267
268 </sect2>
269
270 <sect2><title>Hardware interrupt handling</title>
222 <programlisting> 271 <programlisting>
223irqreturn_t (*irq_handler)(int, void *, struct pt_regs *); 272irqreturn_t (*irq_handler)(int, void *, struct pt_regs *);
224void (*irq_clear) (struct ata_port *); 273void (*irq_clear) (struct ata_port *);
@@ -231,6 +280,9 @@ void (*irq_clear) (struct ata_port *);
231 is quiet. 280 is quiet.
232 </para> 281 </para>
233 282
283 </sect2>
284
285 <sect2><title>SATA phy read/write</title>
234 <programlisting> 286 <programlisting>
235u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg); 287u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg);
236void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, 288void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,
@@ -242,6 +294,9 @@ void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,
242 if ->phy_reset hook called the sata_phy_reset() helper function. 294 if ->phy_reset hook called the sata_phy_reset() helper function.
243 </para> 295 </para>
244 296
297 </sect2>
298
299 <sect2><title>Init and shutdown</title>
245 <programlisting> 300 <programlisting>
246int (*port_start) (struct ata_port *ap); 301int (*port_start) (struct ata_port *ap);
247void (*port_stop) (struct ata_port *ap); 302void (*port_stop) (struct ata_port *ap);
@@ -265,6 +320,8 @@ have completed. The hook must finalize hardware shutdown, release DMA
265and other resources, etc. 320and other resources, etc.
266 </para> 321 </para>
267 322
323 </sect2>
324
268 </sect1> 325 </sect1>
269 </chapter> 326 </chapter>
270 327