diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-06-08 10:45:45 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-06-08 10:45:45 -0400 |
commit | 364f6c717deef4a3ac4982e670fa9846b43cd060 (patch) | |
tree | 47e3967d6e2220130f2c070e300c97709143b28f /Documentation | |
parent | 4ff4258a3e558814a3d48c50a59cd22f56bbea2f (diff) | |
parent | 1d6757fbff5bc86e94e59ab0d7bdd7e71351d839 (diff) |
Automatic merge with /usr/src/ntfs-2.6.git
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DocBook/libata.tmpl | 156 | ||||
-rw-r--r-- | Documentation/cpu-freq/cpufreq-stats.txt | 128 |
2 files changed, 252 insertions, 32 deletions
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index cf2fce7707da..6df1dfd18b65 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 | ||
@@ -44,30 +44,38 @@ | |||
44 | 44 | ||
45 | <toc></toc> | 45 | <toc></toc> |
46 | 46 | ||
47 | <chapter id="libataThanks"> | 47 | <chapter id="libataIntroduction"> |
48 | <title>Thanks</title> | 48 | <title>Introduction</title> |
49 | <para> | 49 | <para> |
50 | The bulk of the ATA knowledge comes thanks to long conversations with | 50 | libATA is a library used inside the Linux kernel to support ATA host |
51 | Andre Hedrick (www.linux-ide.org). | 51 | controllers and devices. libATA provides an ATA driver API, class |
52 | transports for ATA and ATAPI devices, and SCSI<->ATA translation | ||
53 | for ATA devices according to the T10 SAT specification. | ||
52 | </para> | 54 | </para> |
53 | <para> | 55 | <para> |
54 | Thanks to Alan Cox for pointing out similarities | 56 | This Guide documents the libATA driver API, library functions, library |
55 | between SATA and SCSI, and in general for motivation to hack on | 57 | internals, and a couple sample ATA low-level drivers. |
56 | libata. | ||
57 | </para> | ||
58 | <para> | ||
59 | libata's device detection | ||
60 | method, ata_pio_devchk, and in general all the early probing was | ||
61 | based on extensive study of Hale Landis's probe/reset code in his | ||
62 | ATADRVR driver (www.ata-atapi.com). | ||
63 | </para> | 58 | </para> |
64 | </chapter> | 59 | </chapter> |
65 | 60 | ||
66 | <chapter id="libataDriverApi"> | 61 | <chapter id="libataDriverApi"> |
67 | <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> | ||
68 | <sect1> | 75 | <sect1> |
69 | <title>struct ata_port_operations</title> | 76 | <title>struct ata_port_operations</title> |
70 | 77 | ||
78 | <sect2><title>Disable ATA port</title> | ||
71 | <programlisting> | 79 | <programlisting> |
72 | void (*port_disable) (struct ata_port *); | 80 | void (*port_disable) (struct ata_port *); |
73 | </programlisting> | 81 | </programlisting> |
@@ -78,6 +86,9 @@ void (*port_disable) (struct ata_port *); | |||
78 | unplug). | 86 | unplug). |
79 | </para> | 87 | </para> |
80 | 88 | ||
89 | </sect2> | ||
90 | |||
91 | <sect2><title>Post-IDENTIFY device configuration</title> | ||
81 | <programlisting> | 92 | <programlisting> |
82 | void (*dev_config) (struct ata_port *, struct ata_device *); | 93 | void (*dev_config) (struct ata_port *, struct ata_device *); |
83 | </programlisting> | 94 | </programlisting> |
@@ -88,6 +99,9 @@ void (*dev_config) (struct ata_port *, struct ata_device *); | |||
88 | issue of SET FEATURES - XFER MODE, and prior to operation. | 99 | issue of SET FEATURES - XFER MODE, and prior to operation. |
89 | </para> | 100 | </para> |
90 | 101 | ||
102 | </sect2> | ||
103 | |||
104 | <sect2><title>Set PIO/DMA mode</title> | ||
91 | <programlisting> | 105 | <programlisting> |
92 | void (*set_piomode) (struct ata_port *, struct ata_device *); | 106 | void (*set_piomode) (struct ata_port *, struct ata_device *); |
93 | void (*set_dmamode) (struct ata_port *, struct ata_device *); | 107 | void (*set_dmamode) (struct ata_port *, struct ata_device *); |
@@ -108,6 +122,9 @@ void (*post_set_mode) (struct ata_port *ap); | |||
108 | ->set_dma_mode() is only called if DMA is possible. | 122 | ->set_dma_mode() is only called if DMA is possible. |
109 | </para> | 123 | </para> |
110 | 124 | ||
125 | </sect2> | ||
126 | |||
127 | <sect2><title>Taskfile read/write</title> | ||
111 | <programlisting> | 128 | <programlisting> |
112 | void (*tf_load) (struct ata_port *ap, struct ata_taskfile *tf); | 129 | void (*tf_load) (struct ata_port *ap, struct ata_taskfile *tf); |
113 | void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); | 130 | void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); |
@@ -120,6 +137,9 @@ void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); | |||
120 | taskfile register values. | 137 | taskfile register values. |
121 | </para> | 138 | </para> |
122 | 139 | ||
140 | </sect2> | ||
141 | |||
142 | <sect2><title>ATA command execute</title> | ||
123 | <programlisting> | 143 | <programlisting> |
124 | void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); | 144 | void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); |
125 | </programlisting> | 145 | </programlisting> |
@@ -129,17 +149,37 @@ void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); | |||
129 | ->tf_load(), to be initiated in hardware. | 149 | ->tf_load(), to be initiated in hardware. |
130 | </para> | 150 | </para> |
131 | 151 | ||
152 | </sect2> | ||
153 | |||
154 | <sect2><title>Per-cmd ATAPI DMA capabilities filter</title> | ||
155 | <programlisting> | ||
156 | int (*check_atapi_dma) (struct ata_queued_cmd *qc); | ||
157 | </programlisting> | ||
158 | |||
159 | <para> | ||
160 | Allow low-level driver to filter ATA PACKET commands, returning a status | ||
161 | indicating whether or not it is OK to use DMA for the supplied PACKET | ||
162 | command. | ||
163 | </para> | ||
164 | |||
165 | </sect2> | ||
166 | |||
167 | <sect2><title>Read specific ATA shadow registers</title> | ||
132 | <programlisting> | 168 | <programlisting> |
133 | u8 (*check_status)(struct ata_port *ap); | 169 | u8 (*check_status)(struct ata_port *ap); |
134 | void (*dev_select)(struct ata_port *ap, unsigned int device); | 170 | u8 (*check_altstatus)(struct ata_port *ap); |
171 | u8 (*check_err)(struct ata_port *ap); | ||
135 | </programlisting> | 172 | </programlisting> |
136 | 173 | ||
137 | <para> | 174 | <para> |
138 | Reads the Status ATA shadow register from hardware. On some | 175 | Reads the Status/AltStatus/Error ATA shadow register from |
139 | hardware, this has the side effect of clearing the interrupt | 176 | hardware. On some hardware, reading the Status register has |
140 | condition. | 177 | the side effect of clearing the interrupt condition. |
141 | </para> | 178 | </para> |
142 | 179 | ||
180 | </sect2> | ||
181 | |||
182 | <sect2><title>Select ATA device on bus</title> | ||
143 | <programlisting> | 183 | <programlisting> |
144 | void (*dev_select)(struct ata_port *ap, unsigned int device); | 184 | void (*dev_select)(struct ata_port *ap, unsigned int device); |
145 | </programlisting> | 185 | </programlisting> |
@@ -147,9 +187,13 @@ void (*dev_select)(struct ata_port *ap, unsigned int device); | |||
147 | <para> | 187 | <para> |
148 | Issues the low-level hardware command(s) that causes one of N | 188 | Issues the low-level hardware command(s) that causes one of N |
149 | hardware devices to be considered 'selected' (active and | 189 | hardware devices to be considered 'selected' (active and |
150 | available for use) on the ATA bus. | 190 | available for use) on the ATA bus. This generally has no |
191 | meaning on FIS-based devices. | ||
151 | </para> | 192 | </para> |
152 | 193 | ||
194 | </sect2> | ||
195 | |||
196 | <sect2><title>Reset ATA bus</title> | ||
153 | <programlisting> | 197 | <programlisting> |
154 | void (*phy_reset) (struct ata_port *ap); | 198 | void (*phy_reset) (struct ata_port *ap); |
155 | </programlisting> | 199 | </programlisting> |
@@ -162,17 +206,31 @@ void (*phy_reset) (struct ata_port *ap); | |||
162 | functions ata_bus_reset() or sata_phy_reset() for this hook. | 206 | functions ata_bus_reset() or sata_phy_reset() for this hook. |
163 | </para> | 207 | </para> |
164 | 208 | ||
209 | </sect2> | ||
210 | |||
211 | <sect2><title>Control PCI IDE BMDMA engine</title> | ||
165 | <programlisting> | 212 | <programlisting> |
166 | void (*bmdma_setup) (struct ata_queued_cmd *qc); | 213 | void (*bmdma_setup) (struct ata_queued_cmd *qc); |
167 | void (*bmdma_start) (struct ata_queued_cmd *qc); | 214 | void (*bmdma_start) (struct ata_queued_cmd *qc); |
215 | void (*bmdma_stop) (struct ata_port *ap); | ||
216 | u8 (*bmdma_status) (struct ata_port *ap); | ||
168 | </programlisting> | 217 | </programlisting> |
169 | 218 | ||
170 | <para> | 219 | <para> |
171 | When setting up an IDE BMDMA transaction, these hooks arm | 220 | When setting up an IDE BMDMA transaction, these hooks arm |
172 | (->bmdma_setup) and fire (->bmdma_start) the hardware's DMA | 221 | (->bmdma_setup), fire (->bmdma_start), and halt (->bmdma_stop) |
173 | engine. | 222 | the hardware's DMA engine. ->bmdma_status is used to read the standard |
223 | PCI IDE DMA Status register. | ||
174 | </para> | 224 | </para> |
175 | 225 | ||
226 | <para> | ||
227 | These hooks are typically either no-ops, or simply not implemented, in | ||
228 | FIS-based drivers. | ||
229 | </para> | ||
230 | |||
231 | </sect2> | ||
232 | |||
233 | <sect2><title>High-level taskfile hooks</title> | ||
176 | <programlisting> | 234 | <programlisting> |
177 | void (*qc_prep) (struct ata_queued_cmd *qc); | 235 | void (*qc_prep) (struct ata_queued_cmd *qc); |
178 | int (*qc_issue) (struct ata_queued_cmd *qc); | 236 | int (*qc_issue) (struct ata_queued_cmd *qc); |
@@ -190,20 +248,26 @@ int (*qc_issue) (struct ata_queued_cmd *qc); | |||
190 | ->qc_issue is used to make a command active, once the hardware | 248 | ->qc_issue is used to make a command active, once the hardware |
191 | and S/G tables have been prepared. IDE BMDMA drivers use the | 249 | and S/G tables have been prepared. IDE BMDMA drivers use the |
192 | helper function ata_qc_issue_prot() for taskfile protocol-based | 250 | helper function ata_qc_issue_prot() for taskfile protocol-based |
193 | dispatch. More advanced drivers roll their own ->qc_issue | 251 | dispatch. More advanced drivers implement their own ->qc_issue. |
194 | implementation, using this as the "issue new ATA command to | ||
195 | hardware" hook. | ||
196 | </para> | 252 | </para> |
197 | 253 | ||
254 | </sect2> | ||
255 | |||
256 | <sect2><title>Timeout (error) handling</title> | ||
198 | <programlisting> | 257 | <programlisting> |
199 | void (*eng_timeout) (struct ata_port *ap); | 258 | void (*eng_timeout) (struct ata_port *ap); |
200 | </programlisting> | 259 | </programlisting> |
201 | 260 | ||
202 | <para> | 261 | <para> |
203 | This is a high level error handling function, called from the | 262 | This is a high level error handling function, called from the |
204 | error handling thread, when a command times out. | 263 | error handling thread, when a command times out. Most newer |
264 | hardware will implement its own error handling code here. IDE BMDMA | ||
265 | drivers may use the helper function ata_eng_timeout(). | ||
205 | </para> | 266 | </para> |
206 | 267 | ||
268 | </sect2> | ||
269 | |||
270 | <sect2><title>Hardware interrupt handling</title> | ||
207 | <programlisting> | 271 | <programlisting> |
208 | irqreturn_t (*irq_handler)(int, void *, struct pt_regs *); | 272 | irqreturn_t (*irq_handler)(int, void *, struct pt_regs *); |
209 | void (*irq_clear) (struct ata_port *); | 273 | void (*irq_clear) (struct ata_port *); |
@@ -216,6 +280,9 @@ void (*irq_clear) (struct ata_port *); | |||
216 | is quiet. | 280 | is quiet. |
217 | </para> | 281 | </para> |
218 | 282 | ||
283 | </sect2> | ||
284 | |||
285 | <sect2><title>SATA phy read/write</title> | ||
219 | <programlisting> | 286 | <programlisting> |
220 | u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg); | 287 | u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg); |
221 | void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, | 288 | void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, |
@@ -227,6 +294,9 @@ void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, | |||
227 | if ->phy_reset hook called the sata_phy_reset() helper function. | 294 | if ->phy_reset hook called the sata_phy_reset() helper function. |
228 | </para> | 295 | </para> |
229 | 296 | ||
297 | </sect2> | ||
298 | |||
299 | <sect2><title>Init and shutdown</title> | ||
230 | <programlisting> | 300 | <programlisting> |
231 | int (*port_start) (struct ata_port *ap); | 301 | int (*port_start) (struct ata_port *ap); |
232 | void (*port_stop) (struct ata_port *ap); | 302 | void (*port_stop) (struct ata_port *ap); |
@@ -240,15 +310,17 @@ void (*host_stop) (struct ata_host_set *host_set); | |||
240 | tasks. | 310 | tasks. |
241 | </para> | 311 | </para> |
242 | <para> | 312 | <para> |
243 | ->host_stop() is called when the rmmod or hot unplug process | ||
244 | begins. The hook must stop all hardware interrupts, DMA | ||
245 | engines, etc. | ||
246 | </para> | ||
247 | <para> | ||
248 | ->port_stop() is called after ->host_stop(). It's sole function | 313 | ->port_stop() is called after ->host_stop(). It's sole function |
249 | is to release DMA/memory resources, now that they are no longer | 314 | is to release DMA/memory resources, now that they are no longer |
250 | actively being used. | 315 | actively being used. |
251 | </para> | 316 | </para> |
317 | <para> | ||
318 | ->host_stop() is called after all ->port_stop() calls | ||
319 | have completed. The hook must finalize hardware shutdown, release DMA | ||
320 | and other resources, etc. | ||
321 | </para> | ||
322 | |||
323 | </sect2> | ||
252 | 324 | ||
253 | </sect1> | 325 | </sect1> |
254 | </chapter> | 326 | </chapter> |
@@ -279,4 +351,24 @@ void (*host_stop) (struct ata_host_set *host_set); | |||
279 | !Idrivers/scsi/sata_sil.c | 351 | !Idrivers/scsi/sata_sil.c |
280 | </chapter> | 352 | </chapter> |
281 | 353 | ||
354 | <chapter id="libataThanks"> | ||
355 | <title>Thanks</title> | ||
356 | <para> | ||
357 | The bulk of the ATA knowledge comes thanks to long conversations with | ||
358 | Andre Hedrick (www.linux-ide.org), and long hours pondering the ATA | ||
359 | and SCSI specifications. | ||
360 | </para> | ||
361 | <para> | ||
362 | Thanks to Alan Cox for pointing out similarities | ||
363 | between SATA and SCSI, and in general for motivation to hack on | ||
364 | libata. | ||
365 | </para> | ||
366 | <para> | ||
367 | libata's device detection | ||
368 | method, ata_pio_devchk, and in general all the early probing was | ||
369 | based on extensive study of Hale Landis's probe/reset code in his | ||
370 | ATADRVR driver (www.ata-atapi.com). | ||
371 | </para> | ||
372 | </chapter> | ||
373 | |||
282 | </book> | 374 | </book> |
diff --git a/Documentation/cpu-freq/cpufreq-stats.txt b/Documentation/cpu-freq/cpufreq-stats.txt new file mode 100644 index 000000000000..e2d1e760b4ba --- /dev/null +++ b/Documentation/cpu-freq/cpufreq-stats.txt | |||
@@ -0,0 +1,128 @@ | |||
1 | |||
2 | CPU frequency and voltage scaling statictics in the Linux(TM) kernel | ||
3 | |||
4 | |||
5 | L i n u x c p u f r e q - s t a t s d r i v e r | ||
6 | |||
7 | - information for users - | ||
8 | |||
9 | |||
10 | Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
11 | |||
12 | Contents | ||
13 | 1. Introduction | ||
14 | 2. Statistics Provided (with example) | ||
15 | 3. Configuring cpufreq-stats | ||
16 | |||
17 | |||
18 | 1. Introduction | ||
19 | |||
20 | cpufreq-stats is a driver that provices CPU frequency statistics for each CPU. | ||
21 | This statistics is provided in /sysfs as a bunch of read_only interfaces. This | ||
22 | interface (when configured) will appear in a seperate directory under cpufreq | ||
23 | in /sysfs (<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/) for each CPU. | ||
24 | Various statistics will form read_only files under this directory. | ||
25 | |||
26 | This driver is designed to be independent of any particular cpufreq_driver | ||
27 | that may be running on your CPU. So, it will work with any cpufreq_driver. | ||
28 | |||
29 | |||
30 | 2. Statistics Provided (with example) | ||
31 | |||
32 | cpufreq stats provides following statistics (explained in detail below). | ||
33 | - time_in_state | ||
34 | - total_trans | ||
35 | - trans_table | ||
36 | |||
37 | All the statistics will be from the time the stats driver has been inserted | ||
38 | to the time when a read of a particular statistic is done. Obviously, stats | ||
39 | driver will not have any information about the the frequcny transitions before | ||
40 | the stats driver insertion. | ||
41 | |||
42 | -------------------------------------------------------------------------------- | ||
43 | <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l | ||
44 | total 0 | ||
45 | drwxr-xr-x 2 root root 0 May 14 16:06 . | ||
46 | drwxr-xr-x 3 root root 0 May 14 15:58 .. | ||
47 | -r--r--r-- 1 root root 4096 May 14 16:06 time_in_state | ||
48 | -r--r--r-- 1 root root 4096 May 14 16:06 total_trans | ||
49 | -r--r--r-- 1 root root 4096 May 14 16:06 trans_table | ||
50 | -------------------------------------------------------------------------------- | ||
51 | |||
52 | - time_in_state | ||
53 | This gives the amount of time spent in each of the frequencies supported by | ||
54 | this CPU. The cat output will have "<frequency> <time>" pair in each line, which | ||
55 | will mean this CPU spent <time> usertime units of time at <frequency>. Output | ||
56 | will have one line for each of the supported freuencies. usertime units here | ||
57 | is 10mS (similar to other time exported in /proc). | ||
58 | |||
59 | -------------------------------------------------------------------------------- | ||
60 | <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state | ||
61 | 3600000 2089 | ||
62 | 3400000 136 | ||
63 | 3200000 34 | ||
64 | 3000000 67 | ||
65 | 2800000 172488 | ||
66 | -------------------------------------------------------------------------------- | ||
67 | |||
68 | |||
69 | - total_trans | ||
70 | This gives the total number of frequency transitions on this CPU. The cat | ||
71 | output will have a single count which is the total number of frequency | ||
72 | transitions. | ||
73 | |||
74 | -------------------------------------------------------------------------------- | ||
75 | <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans | ||
76 | 20 | ||
77 | -------------------------------------------------------------------------------- | ||
78 | |||
79 | - trans_table | ||
80 | This will give a fine grained information about all the CPU frequency | ||
81 | transitions. The cat output here is a two dimensional matrix, where an entry | ||
82 | <i,j> (row i, column j) represents the count of number of transitions from | ||
83 | Freq_i to Freq_j. Freq_i is in descending order with increasing rows and | ||
84 | Freq_j is in descending order with increasing columns. The output here also | ||
85 | contains the actual freq values for each row and column for better readability. | ||
86 | |||
87 | -------------------------------------------------------------------------------- | ||
88 | <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table | ||
89 | From : To | ||
90 | : 3600000 3400000 3200000 3000000 2800000 | ||
91 | 3600000: 0 5 0 0 0 | ||
92 | 3400000: 4 0 2 0 0 | ||
93 | 3200000: 0 1 0 2 0 | ||
94 | 3000000: 0 0 1 0 3 | ||
95 | 2800000: 0 0 0 2 0 | ||
96 | -------------------------------------------------------------------------------- | ||
97 | |||
98 | |||
99 | 3. Configuring cpufreq-stats | ||
100 | |||
101 | To configure cpufreq-stats in your kernel | ||
102 | Config Main Menu | ||
103 | Power management options (ACPI, APM) ---> | ||
104 | CPU Frequency scaling ---> | ||
105 | [*] CPU Frequency scaling | ||
106 | <*> CPU frequency translation statistics | ||
107 | [*] CPU frequency translation statistics details | ||
108 | |||
109 | |||
110 | "CPU Frequency scaling" (CONFIG_CPU_FREQ) should be enabled to configure | ||
111 | cpufreq-stats. | ||
112 | |||
113 | "CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT) provides the | ||
114 | basic statistics which includes time_in_state and total_trans. | ||
115 | |||
116 | "CPU frequency translation statistics details" (CONFIG_CPU_FREQ_STAT_DETAILS) | ||
117 | provides fine grained cpufreq stats by trans_table. The reason for having a | ||
118 | seperate config option for trans_table is: | ||
119 | - trans_table goes against the traditional /sysfs rule of one value per | ||
120 | interface. It provides a whole bunch of value in a 2 dimensional matrix | ||
121 | form. | ||
122 | |||
123 | Once these two options are enabled and your CPU supports cpufrequency, you | ||
124 | will be able to see the CPU frequency statistics in /sysfs. | ||
125 | |||
126 | |||
127 | |||
128 | |||