Commit 6e8c818829587f001cacae5af4400e4e3aa90a37

Authored by Randy Dunlap
Committed by Linus Torvalds
1 parent 7be2c7c96a

[PATCH] docbook: add edd firmware interfaces

Cleanup kernel-doc notation in drivers/firmware/edd.c.

Add edd.c to DocBook/kernel-api.tmpl.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 8 additions and 3 deletions Inline Diff

Documentation/DocBook/kernel-api.tmpl
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> 3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4 4
5 <book id="LinuxKernelAPI"> 5 <book id="LinuxKernelAPI">
6 <bookinfo> 6 <bookinfo>
7 <title>The Linux Kernel API</title> 7 <title>The Linux Kernel API</title>
8 8
9 <legalnotice> 9 <legalnotice>
10 <para> 10 <para>
11 This documentation is free software; you can redistribute 11 This documentation is free software; you can redistribute
12 it and/or modify it under the terms of the GNU General Public 12 it and/or modify it under the terms of the GNU General Public
13 License as published by the Free Software Foundation; either 13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later 14 version 2 of the License, or (at your option) any later
15 version. 15 version.
16 </para> 16 </para>
17 17
18 <para> 18 <para>
19 This program is distributed in the hope that it will be 19 This program is distributed in the hope that it will be
20 useful, but WITHOUT ANY WARRANTY; without even the implied 20 useful, but WITHOUT ANY WARRANTY; without even the implied
21 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 21 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 See the GNU General Public License for more details. 22 See the GNU General Public License for more details.
23 </para> 23 </para>
24 24
25 <para> 25 <para>
26 You should have received a copy of the GNU General Public 26 You should have received a copy of the GNU General Public
27 License along with this program; if not, write to the Free 27 License along with this program; if not, write to the Free
28 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 28 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 MA 02111-1307 USA 29 MA 02111-1307 USA
30 </para> 30 </para>
31 31
32 <para> 32 <para>
33 For more details see the file COPYING in the source 33 For more details see the file COPYING in the source
34 distribution of Linux. 34 distribution of Linux.
35 </para> 35 </para>
36 </legalnotice> 36 </legalnotice>
37 </bookinfo> 37 </bookinfo>
38 38
39 <toc></toc> 39 <toc></toc>
40 40
41 <chapter id="Basics"> 41 <chapter id="Basics">
42 <title>Driver Basics</title> 42 <title>Driver Basics</title>
43 <sect1><title>Driver Entry and Exit points</title> 43 <sect1><title>Driver Entry and Exit points</title>
44 !Iinclude/linux/init.h 44 !Iinclude/linux/init.h
45 </sect1> 45 </sect1>
46 46
47 <sect1><title>Atomic and pointer manipulation</title> 47 <sect1><title>Atomic and pointer manipulation</title>
48 !Iinclude/asm-i386/atomic.h 48 !Iinclude/asm-i386/atomic.h
49 !Iinclude/asm-i386/unaligned.h 49 !Iinclude/asm-i386/unaligned.h
50 </sect1> 50 </sect1>
51 51
52 <sect1><title>Delaying, scheduling, and timer routines</title> 52 <sect1><title>Delaying, scheduling, and timer routines</title>
53 !Iinclude/linux/sched.h 53 !Iinclude/linux/sched.h
54 !Ekernel/sched.c 54 !Ekernel/sched.c
55 !Ekernel/timer.c 55 !Ekernel/timer.c
56 </sect1> 56 </sect1>
57 <sect1><title>High-resolution timers</title> 57 <sect1><title>High-resolution timers</title>
58 !Iinclude/linux/ktime.h 58 !Iinclude/linux/ktime.h
59 !Iinclude/linux/hrtimer.h 59 !Iinclude/linux/hrtimer.h
60 !Ekernel/hrtimer.c 60 !Ekernel/hrtimer.c
61 </sect1> 61 </sect1>
62 <sect1><title>Workqueues and Kevents</title> 62 <sect1><title>Workqueues and Kevents</title>
63 !Ekernel/workqueue.c 63 !Ekernel/workqueue.c
64 </sect1> 64 </sect1>
65 <sect1><title>Internal Functions</title> 65 <sect1><title>Internal Functions</title>
66 !Ikernel/exit.c 66 !Ikernel/exit.c
67 !Ikernel/signal.c 67 !Ikernel/signal.c
68 !Iinclude/linux/kthread.h 68 !Iinclude/linux/kthread.h
69 !Ekernel/kthread.c 69 !Ekernel/kthread.c
70 </sect1> 70 </sect1>
71 71
72 <sect1><title>Kernel objects manipulation</title> 72 <sect1><title>Kernel objects manipulation</title>
73 <!-- 73 <!--
74 X!Iinclude/linux/kobject.h 74 X!Iinclude/linux/kobject.h
75 --> 75 -->
76 !Elib/kobject.c 76 !Elib/kobject.c
77 </sect1> 77 </sect1>
78 78
79 <sect1><title>Kernel utility functions</title> 79 <sect1><title>Kernel utility functions</title>
80 !Iinclude/linux/kernel.h 80 !Iinclude/linux/kernel.h
81 !Ekernel/printk.c 81 !Ekernel/printk.c
82 !Ekernel/panic.c 82 !Ekernel/panic.c
83 !Ekernel/sys.c 83 !Ekernel/sys.c
84 !Ekernel/rcupdate.c 84 !Ekernel/rcupdate.c
85 </sect1> 85 </sect1>
86 86
87 </chapter> 87 </chapter>
88 88
89 <chapter id="adt"> 89 <chapter id="adt">
90 <title>Data Types</title> 90 <title>Data Types</title>
91 <sect1><title>Doubly Linked Lists</title> 91 <sect1><title>Doubly Linked Lists</title>
92 !Iinclude/linux/list.h 92 !Iinclude/linux/list.h
93 </sect1> 93 </sect1>
94 </chapter> 94 </chapter>
95 95
96 <chapter id="libc"> 96 <chapter id="libc">
97 <title>Basic C Library Functions</title> 97 <title>Basic C Library Functions</title>
98 98
99 <para> 99 <para>
100 When writing drivers, you cannot in general use routines which are 100 When writing drivers, you cannot in general use routines which are
101 from the C Library. Some of the functions have been found generally 101 from the C Library. Some of the functions have been found generally
102 useful and they are listed below. The behaviour of these functions 102 useful and they are listed below. The behaviour of these functions
103 may vary slightly from those defined by ANSI, and these deviations 103 may vary slightly from those defined by ANSI, and these deviations
104 are noted in the text. 104 are noted in the text.
105 </para> 105 </para>
106 106
107 <sect1><title>String Conversions</title> 107 <sect1><title>String Conversions</title>
108 !Ilib/vsprintf.c 108 !Ilib/vsprintf.c
109 !Elib/vsprintf.c 109 !Elib/vsprintf.c
110 </sect1> 110 </sect1>
111 <sect1><title>String Manipulation</title> 111 <sect1><title>String Manipulation</title>
112 <!-- All functions are exported at now 112 <!-- All functions are exported at now
113 X!Ilib/string.c 113 X!Ilib/string.c
114 --> 114 -->
115 !Elib/string.c 115 !Elib/string.c
116 </sect1> 116 </sect1>
117 <sect1><title>Bit Operations</title> 117 <sect1><title>Bit Operations</title>
118 !Iinclude/asm-i386/bitops.h 118 !Iinclude/asm-i386/bitops.h
119 </sect1> 119 </sect1>
120 </chapter> 120 </chapter>
121 121
122 <chapter id="kernel-lib"> 122 <chapter id="kernel-lib">
123 <title>Basic Kernel Library Functions</title> 123 <title>Basic Kernel Library Functions</title>
124 124
125 <para> 125 <para>
126 The Linux kernel provides more basic utility functions. 126 The Linux kernel provides more basic utility functions.
127 </para> 127 </para>
128 128
129 <sect1><title>Bitmap Operations</title> 129 <sect1><title>Bitmap Operations</title>
130 !Elib/bitmap.c 130 !Elib/bitmap.c
131 !Ilib/bitmap.c 131 !Ilib/bitmap.c
132 </sect1> 132 </sect1>
133 133
134 <sect1><title>Command-line Parsing</title> 134 <sect1><title>Command-line Parsing</title>
135 !Elib/cmdline.c 135 !Elib/cmdline.c
136 </sect1> 136 </sect1>
137 137
138 <sect1><title>CRC Functions</title> 138 <sect1><title>CRC Functions</title>
139 !Elib/crc16.c 139 !Elib/crc16.c
140 !Elib/crc32.c 140 !Elib/crc32.c
141 !Elib/crc-ccitt.c 141 !Elib/crc-ccitt.c
142 </sect1> 142 </sect1>
143 </chapter> 143 </chapter>
144 144
145 <chapter id="mm"> 145 <chapter id="mm">
146 <title>Memory Management in Linux</title> 146 <title>Memory Management in Linux</title>
147 <sect1><title>The Slab Cache</title> 147 <sect1><title>The Slab Cache</title>
148 !Iinclude/linux/slab.h 148 !Iinclude/linux/slab.h
149 !Emm/slab.c 149 !Emm/slab.c
150 </sect1> 150 </sect1>
151 <sect1><title>User Space Memory Access</title> 151 <sect1><title>User Space Memory Access</title>
152 !Iinclude/asm-i386/uaccess.h 152 !Iinclude/asm-i386/uaccess.h
153 !Earch/i386/lib/usercopy.c 153 !Earch/i386/lib/usercopy.c
154 </sect1> 154 </sect1>
155 <sect1><title>More Memory Management Functions</title> 155 <sect1><title>More Memory Management Functions</title>
156 !Iinclude/linux/rmap.h 156 !Iinclude/linux/rmap.h
157 !Emm/readahead.c 157 !Emm/readahead.c
158 !Emm/filemap.c 158 !Emm/filemap.c
159 !Emm/memory.c 159 !Emm/memory.c
160 !Emm/vmalloc.c 160 !Emm/vmalloc.c
161 !Imm/page_alloc.c 161 !Imm/page_alloc.c
162 !Emm/mempool.c 162 !Emm/mempool.c
163 !Emm/page-writeback.c 163 !Emm/page-writeback.c
164 !Emm/truncate.c 164 !Emm/truncate.c
165 </sect1> 165 </sect1>
166 </chapter> 166 </chapter>
167 167
168 168
169 <chapter id="ipc"> 169 <chapter id="ipc">
170 <title>Kernel IPC facilities</title> 170 <title>Kernel IPC facilities</title>
171 171
172 <sect1><title>IPC utilities</title> 172 <sect1><title>IPC utilities</title>
173 !Iipc/util.c 173 !Iipc/util.c
174 </sect1> 174 </sect1>
175 </chapter> 175 </chapter>
176 176
177 <chapter id="kfifo"> 177 <chapter id="kfifo">
178 <title>FIFO Buffer</title> 178 <title>FIFO Buffer</title>
179 <sect1><title>kfifo interface</title> 179 <sect1><title>kfifo interface</title>
180 !Iinclude/linux/kfifo.h 180 !Iinclude/linux/kfifo.h
181 !Ekernel/kfifo.c 181 !Ekernel/kfifo.c
182 </sect1> 182 </sect1>
183 </chapter> 183 </chapter>
184 184
185 <chapter id="relayfs"> 185 <chapter id="relayfs">
186 <title>relay interface support</title> 186 <title>relay interface support</title>
187 187
188 <para> 188 <para>
189 Relay interface support 189 Relay interface support
190 is designed to provide an efficient mechanism for tools and 190 is designed to provide an efficient mechanism for tools and
191 facilities to relay large amounts of data from kernel space to 191 facilities to relay large amounts of data from kernel space to
192 user space. 192 user space.
193 </para> 193 </para>
194 194
195 <sect1><title>relay interface</title> 195 <sect1><title>relay interface</title>
196 !Ekernel/relay.c 196 !Ekernel/relay.c
197 !Ikernel/relay.c 197 !Ikernel/relay.c
198 </sect1> 198 </sect1>
199 </chapter> 199 </chapter>
200 200
201 <chapter id="netcore"> 201 <chapter id="netcore">
202 <title>Linux Networking</title> 202 <title>Linux Networking</title>
203 <sect1><title>Networking Base Types</title> 203 <sect1><title>Networking Base Types</title>
204 !Iinclude/linux/net.h 204 !Iinclude/linux/net.h
205 </sect1> 205 </sect1>
206 <sect1><title>Socket Buffer Functions</title> 206 <sect1><title>Socket Buffer Functions</title>
207 !Iinclude/linux/skbuff.h 207 !Iinclude/linux/skbuff.h
208 !Iinclude/net/sock.h 208 !Iinclude/net/sock.h
209 !Enet/socket.c 209 !Enet/socket.c
210 !Enet/core/skbuff.c 210 !Enet/core/skbuff.c
211 !Enet/core/sock.c 211 !Enet/core/sock.c
212 !Enet/core/datagram.c 212 !Enet/core/datagram.c
213 !Enet/core/stream.c 213 !Enet/core/stream.c
214 </sect1> 214 </sect1>
215 <sect1><title>Socket Filter</title> 215 <sect1><title>Socket Filter</title>
216 !Enet/core/filter.c 216 !Enet/core/filter.c
217 </sect1> 217 </sect1>
218 <sect1><title>Generic Network Statistics</title> 218 <sect1><title>Generic Network Statistics</title>
219 !Iinclude/linux/gen_stats.h 219 !Iinclude/linux/gen_stats.h
220 !Enet/core/gen_stats.c 220 !Enet/core/gen_stats.c
221 !Enet/core/gen_estimator.c 221 !Enet/core/gen_estimator.c
222 </sect1> 222 </sect1>
223 <sect1><title>SUN RPC subsystem</title> 223 <sect1><title>SUN RPC subsystem</title>
224 <!-- The !D functionality is not perfect, garbage has to be protected by comments 224 <!-- The !D functionality is not perfect, garbage has to be protected by comments
225 !Dnet/sunrpc/sunrpc_syms.c 225 !Dnet/sunrpc/sunrpc_syms.c
226 --> 226 -->
227 !Enet/sunrpc/xdr.c 227 !Enet/sunrpc/xdr.c
228 !Enet/sunrpc/svcsock.c 228 !Enet/sunrpc/svcsock.c
229 !Enet/sunrpc/sched.c 229 !Enet/sunrpc/sched.c
230 </sect1> 230 </sect1>
231 </chapter> 231 </chapter>
232 232
233 <chapter id="netdev"> 233 <chapter id="netdev">
234 <title>Network device support</title> 234 <title>Network device support</title>
235 <sect1><title>Driver Support</title> 235 <sect1><title>Driver Support</title>
236 !Enet/core/dev.c 236 !Enet/core/dev.c
237 !Enet/ethernet/eth.c 237 !Enet/ethernet/eth.c
238 !Iinclude/linux/etherdevice.h 238 !Iinclude/linux/etherdevice.h
239 <!-- FIXME: Removed for now since no structured comments in source 239 <!-- FIXME: Removed for now since no structured comments in source
240 X!Enet/core/wireless.c 240 X!Enet/core/wireless.c
241 --> 241 -->
242 </sect1> 242 </sect1>
243 <sect1><title>Synchronous PPP</title> 243 <sect1><title>Synchronous PPP</title>
244 !Edrivers/net/wan/syncppp.c 244 !Edrivers/net/wan/syncppp.c
245 </sect1> 245 </sect1>
246 </chapter> 246 </chapter>
247 247
248 <chapter id="modload"> 248 <chapter id="modload">
249 <title>Module Support</title> 249 <title>Module Support</title>
250 <sect1><title>Module Loading</title> 250 <sect1><title>Module Loading</title>
251 !Ekernel/kmod.c 251 !Ekernel/kmod.c
252 </sect1> 252 </sect1>
253 <sect1><title>Inter Module support</title> 253 <sect1><title>Inter Module support</title>
254 <para> 254 <para>
255 Refer to the file kernel/module.c for more information. 255 Refer to the file kernel/module.c for more information.
256 </para> 256 </para>
257 <!-- FIXME: Removed for now since no structured comments in source 257 <!-- FIXME: Removed for now since no structured comments in source
258 X!Ekernel/module.c 258 X!Ekernel/module.c
259 --> 259 -->
260 </sect1> 260 </sect1>
261 </chapter> 261 </chapter>
262 262
263 <chapter id="hardware"> 263 <chapter id="hardware">
264 <title>Hardware Interfaces</title> 264 <title>Hardware Interfaces</title>
265 <sect1><title>Interrupt Handling</title> 265 <sect1><title>Interrupt Handling</title>
266 !Ekernel/irq/manage.c 266 !Ekernel/irq/manage.c
267 </sect1> 267 </sect1>
268 268
269 <sect1><title>DMA Channels</title> 269 <sect1><title>DMA Channels</title>
270 !Ekernel/dma.c 270 !Ekernel/dma.c
271 </sect1> 271 </sect1>
272 272
273 <sect1><title>Resources Management</title> 273 <sect1><title>Resources Management</title>
274 !Ikernel/resource.c 274 !Ikernel/resource.c
275 !Ekernel/resource.c 275 !Ekernel/resource.c
276 </sect1> 276 </sect1>
277 277
278 <sect1><title>MTRR Handling</title> 278 <sect1><title>MTRR Handling</title>
279 !Earch/i386/kernel/cpu/mtrr/main.c 279 !Earch/i386/kernel/cpu/mtrr/main.c
280 </sect1> 280 </sect1>
281 281
282 <sect1><title>PCI Support Library</title> 282 <sect1><title>PCI Support Library</title>
283 !Edrivers/pci/pci.c 283 !Edrivers/pci/pci.c
284 !Edrivers/pci/pci-driver.c 284 !Edrivers/pci/pci-driver.c
285 !Edrivers/pci/remove.c 285 !Edrivers/pci/remove.c
286 !Edrivers/pci/pci-acpi.c 286 !Edrivers/pci/pci-acpi.c
287 !Edrivers/pci/search.c 287 !Edrivers/pci/search.c
288 !Edrivers/pci/msi.c 288 !Edrivers/pci/msi.c
289 !Edrivers/pci/bus.c 289 !Edrivers/pci/bus.c
290 <!-- FIXME: Removed for now since no structured comments in source 290 <!-- FIXME: Removed for now since no structured comments in source
291 X!Edrivers/pci/hotplug.c 291 X!Edrivers/pci/hotplug.c
292 --> 292 -->
293 !Edrivers/pci/probe.c 293 !Edrivers/pci/probe.c
294 !Edrivers/pci/rom.c 294 !Edrivers/pci/rom.c
295 </sect1> 295 </sect1>
296 <sect1><title>PCI Hotplug Support Library</title> 296 <sect1><title>PCI Hotplug Support Library</title>
297 !Edrivers/pci/hotplug/pci_hotplug_core.c 297 !Edrivers/pci/hotplug/pci_hotplug_core.c
298 </sect1> 298 </sect1>
299 <sect1><title>MCA Architecture</title> 299 <sect1><title>MCA Architecture</title>
300 <sect2><title>MCA Device Functions</title> 300 <sect2><title>MCA Device Functions</title>
301 <para> 301 <para>
302 Refer to the file arch/i386/kernel/mca.c for more information. 302 Refer to the file arch/i386/kernel/mca.c for more information.
303 </para> 303 </para>
304 <!-- FIXME: Removed for now since no structured comments in source 304 <!-- FIXME: Removed for now since no structured comments in source
305 X!Earch/i386/kernel/mca.c 305 X!Earch/i386/kernel/mca.c
306 --> 306 -->
307 </sect2> 307 </sect2>
308 <sect2><title>MCA Bus DMA</title> 308 <sect2><title>MCA Bus DMA</title>
309 !Iinclude/asm-i386/mca_dma.h 309 !Iinclude/asm-i386/mca_dma.h
310 </sect2> 310 </sect2>
311 </sect1> 311 </sect1>
312 </chapter> 312 </chapter>
313 313
314 <chapter id="firmware"> 314 <chapter id="firmware">
315 <title>Firmware Interfaces</title> 315 <title>Firmware Interfaces</title>
316 <sect1><title>DMI Interfaces</title> 316 <sect1><title>DMI Interfaces</title>
317 !Edrivers/firmware/dmi_scan.c 317 !Edrivers/firmware/dmi_scan.c
318 </sect1> 318 </sect1>
319 <sect1><title>EDD Interfaces</title>
320 !Idrivers/firmware/edd.c
321 </sect1>
319 </chapter> 322 </chapter>
320 323
321 <chapter id="security"> 324 <chapter id="security">
322 <title>Security Framework</title> 325 <title>Security Framework</title>
323 !Esecurity/security.c 326 !Esecurity/security.c
324 </chapter> 327 </chapter>
325 328
326 <chapter id="audit"> 329 <chapter id="audit">
327 <title>Audit Interfaces</title> 330 <title>Audit Interfaces</title>
328 !Ekernel/audit.c 331 !Ekernel/audit.c
329 !Ikernel/auditsc.c 332 !Ikernel/auditsc.c
330 !Ikernel/auditfilter.c 333 !Ikernel/auditfilter.c
331 </chapter> 334 </chapter>
332 335
333 <chapter id="accounting"> 336 <chapter id="accounting">
334 <title>Accounting Framework</title> 337 <title>Accounting Framework</title>
335 !Ikernel/acct.c 338 !Ikernel/acct.c
336 </chapter> 339 </chapter>
337 340
338 <chapter id="pmfuncs"> 341 <chapter id="pmfuncs">
339 <title>Power Management</title> 342 <title>Power Management</title>
340 !Ekernel/power/pm.c 343 !Ekernel/power/pm.c
341 </chapter> 344 </chapter>
342 345
343 <chapter id="devdrivers"> 346 <chapter id="devdrivers">
344 <title>Device drivers infrastructure</title> 347 <title>Device drivers infrastructure</title>
345 <sect1><title>Device Drivers Base</title> 348 <sect1><title>Device Drivers Base</title>
346 <!-- 349 <!--
347 X!Iinclude/linux/device.h 350 X!Iinclude/linux/device.h
348 --> 351 -->
349 !Edrivers/base/driver.c 352 !Edrivers/base/driver.c
350 !Edrivers/base/core.c 353 !Edrivers/base/core.c
351 !Edrivers/base/class.c 354 !Edrivers/base/class.c
352 !Edrivers/base/firmware_class.c 355 !Edrivers/base/firmware_class.c
353 !Edrivers/base/transport_class.c 356 !Edrivers/base/transport_class.c
354 !Edrivers/base/dmapool.c 357 !Edrivers/base/dmapool.c
355 <!-- Cannot be included, because 358 <!-- Cannot be included, because
356 attribute_container_add_class_device_adapter 359 attribute_container_add_class_device_adapter
357 and attribute_container_classdev_to_container 360 and attribute_container_classdev_to_container
358 exceed allowed 44 characters maximum 361 exceed allowed 44 characters maximum
359 X!Edrivers/base/attribute_container.c 362 X!Edrivers/base/attribute_container.c
360 --> 363 -->
361 !Edrivers/base/sys.c 364 !Edrivers/base/sys.c
362 <!-- 365 <!--
363 X!Edrivers/base/interface.c 366 X!Edrivers/base/interface.c
364 --> 367 -->
365 !Edrivers/base/platform.c 368 !Edrivers/base/platform.c
366 !Edrivers/base/bus.c 369 !Edrivers/base/bus.c
367 </sect1> 370 </sect1>
368 <sect1><title>Device Drivers Power Management</title> 371 <sect1><title>Device Drivers Power Management</title>
369 !Edrivers/base/power/main.c 372 !Edrivers/base/power/main.c
370 !Edrivers/base/power/resume.c 373 !Edrivers/base/power/resume.c
371 !Edrivers/base/power/suspend.c 374 !Edrivers/base/power/suspend.c
372 </sect1> 375 </sect1>
373 <sect1><title>Device Drivers ACPI Support</title> 376 <sect1><title>Device Drivers ACPI Support</title>
374 <!-- Internal functions only 377 <!-- Internal functions only
375 X!Edrivers/acpi/sleep/main.c 378 X!Edrivers/acpi/sleep/main.c
376 X!Edrivers/acpi/sleep/wakeup.c 379 X!Edrivers/acpi/sleep/wakeup.c
377 X!Edrivers/acpi/motherboard.c 380 X!Edrivers/acpi/motherboard.c
378 X!Edrivers/acpi/bus.c 381 X!Edrivers/acpi/bus.c
379 --> 382 -->
380 !Edrivers/acpi/scan.c 383 !Edrivers/acpi/scan.c
381 !Idrivers/acpi/scan.c 384 !Idrivers/acpi/scan.c
382 <!-- No correct structured comments 385 <!-- No correct structured comments
383 X!Edrivers/acpi/pci_bind.c 386 X!Edrivers/acpi/pci_bind.c
384 --> 387 -->
385 </sect1> 388 </sect1>
386 <sect1><title>Device drivers PnP support</title> 389 <sect1><title>Device drivers PnP support</title>
387 !Edrivers/pnp/core.c 390 !Edrivers/pnp/core.c
388 <!-- No correct structured comments 391 <!-- No correct structured comments
389 X!Edrivers/pnp/system.c 392 X!Edrivers/pnp/system.c
390 --> 393 -->
391 !Edrivers/pnp/card.c 394 !Edrivers/pnp/card.c
392 !Edrivers/pnp/driver.c 395 !Edrivers/pnp/driver.c
393 !Edrivers/pnp/manager.c 396 !Edrivers/pnp/manager.c
394 !Edrivers/pnp/support.c 397 !Edrivers/pnp/support.c
395 </sect1> 398 </sect1>
396 </chapter> 399 </chapter>
397 400
398 <chapter id="blkdev"> 401 <chapter id="blkdev">
399 <title>Block Devices</title> 402 <title>Block Devices</title>
400 !Eblock/ll_rw_blk.c 403 !Eblock/ll_rw_blk.c
401 </chapter> 404 </chapter>
402 405
403 <chapter id="chrdev"> 406 <chapter id="chrdev">
404 <title>Char devices</title> 407 <title>Char devices</title>
405 !Efs/char_dev.c 408 !Efs/char_dev.c
406 </chapter> 409 </chapter>
407 410
408 <chapter id="miscdev"> 411 <chapter id="miscdev">
409 <title>Miscellaneous Devices</title> 412 <title>Miscellaneous Devices</title>
410 !Edrivers/char/misc.c 413 !Edrivers/char/misc.c
411 </chapter> 414 </chapter>
412 415
413 <chapter id="parportdev"> 416 <chapter id="parportdev">
414 <title>Parallel Port Devices</title> 417 <title>Parallel Port Devices</title>
415 !Iinclude/linux/parport.h 418 !Iinclude/linux/parport.h
416 !Edrivers/parport/ieee1284.c 419 !Edrivers/parport/ieee1284.c
417 !Edrivers/parport/share.c 420 !Edrivers/parport/share.c
418 !Idrivers/parport/daisy.c 421 !Idrivers/parport/daisy.c
419 </chapter> 422 </chapter>
420 423
421 <chapter id="message_devices"> 424 <chapter id="message_devices">
422 <title>Message-based devices</title> 425 <title>Message-based devices</title>
423 <sect1><title>Fusion message devices</title> 426 <sect1><title>Fusion message devices</title>
424 !Edrivers/message/fusion/mptbase.c 427 !Edrivers/message/fusion/mptbase.c
425 !Idrivers/message/fusion/mptbase.c 428 !Idrivers/message/fusion/mptbase.c
426 !Edrivers/message/fusion/mptscsih.c 429 !Edrivers/message/fusion/mptscsih.c
427 !Idrivers/message/fusion/mptscsih.c 430 !Idrivers/message/fusion/mptscsih.c
428 !Idrivers/message/fusion/mptctl.c 431 !Idrivers/message/fusion/mptctl.c
429 !Idrivers/message/fusion/mptspi.c 432 !Idrivers/message/fusion/mptspi.c
430 !Idrivers/message/fusion/mptfc.c 433 !Idrivers/message/fusion/mptfc.c
431 !Idrivers/message/fusion/mptlan.c 434 !Idrivers/message/fusion/mptlan.c
432 </sect1> 435 </sect1>
433 <sect1><title>I2O message devices</title> 436 <sect1><title>I2O message devices</title>
434 !Iinclude/linux/i2o.h 437 !Iinclude/linux/i2o.h
435 !Idrivers/message/i2o/core.h 438 !Idrivers/message/i2o/core.h
436 !Edrivers/message/i2o/iop.c 439 !Edrivers/message/i2o/iop.c
437 !Idrivers/message/i2o/iop.c 440 !Idrivers/message/i2o/iop.c
438 !Idrivers/message/i2o/config-osm.c 441 !Idrivers/message/i2o/config-osm.c
439 !Edrivers/message/i2o/exec-osm.c 442 !Edrivers/message/i2o/exec-osm.c
440 !Idrivers/message/i2o/exec-osm.c 443 !Idrivers/message/i2o/exec-osm.c
441 !Idrivers/message/i2o/bus-osm.c 444 !Idrivers/message/i2o/bus-osm.c
442 !Edrivers/message/i2o/device.c 445 !Edrivers/message/i2o/device.c
443 !Idrivers/message/i2o/device.c 446 !Idrivers/message/i2o/device.c
444 !Idrivers/message/i2o/driver.c 447 !Idrivers/message/i2o/driver.c
445 !Idrivers/message/i2o/pci.c 448 !Idrivers/message/i2o/pci.c
446 !Idrivers/message/i2o/i2o_block.c 449 !Idrivers/message/i2o/i2o_block.c
447 !Idrivers/message/i2o/i2o_scsi.c 450 !Idrivers/message/i2o/i2o_scsi.c
448 !Idrivers/message/i2o/i2o_proc.c 451 !Idrivers/message/i2o/i2o_proc.c
449 </sect1> 452 </sect1>
450 </chapter> 453 </chapter>
451 454
452 <chapter id="snddev"> 455 <chapter id="snddev">
453 <title>Sound Devices</title> 456 <title>Sound Devices</title>
454 !Iinclude/sound/core.h 457 !Iinclude/sound/core.h
455 !Esound/sound_core.c 458 !Esound/sound_core.c
456 !Iinclude/sound/pcm.h 459 !Iinclude/sound/pcm.h
457 !Esound/core/pcm.c 460 !Esound/core/pcm.c
458 !Esound/core/device.c 461 !Esound/core/device.c
459 !Esound/core/info.c 462 !Esound/core/info.c
460 !Esound/core/rawmidi.c 463 !Esound/core/rawmidi.c
461 !Esound/core/sound.c 464 !Esound/core/sound.c
462 !Esound/core/memory.c 465 !Esound/core/memory.c
463 !Esound/core/pcm_memory.c 466 !Esound/core/pcm_memory.c
464 !Esound/core/init.c 467 !Esound/core/init.c
465 !Esound/core/isadma.c 468 !Esound/core/isadma.c
466 !Esound/core/control.c 469 !Esound/core/control.c
467 !Esound/core/pcm_lib.c 470 !Esound/core/pcm_lib.c
468 !Esound/core/hwdep.c 471 !Esound/core/hwdep.c
469 !Esound/core/pcm_native.c 472 !Esound/core/pcm_native.c
470 !Esound/core/memalloc.c 473 !Esound/core/memalloc.c
471 <!-- FIXME: Removed for now since no structured comments in source 474 <!-- FIXME: Removed for now since no structured comments in source
472 X!Isound/sound_firmware.c 475 X!Isound/sound_firmware.c
473 --> 476 -->
474 </chapter> 477 </chapter>
475 478
476 <chapter id="uart16x50"> 479 <chapter id="uart16x50">
477 <title>16x50 UART Driver</title> 480 <title>16x50 UART Driver</title>
478 !Iinclude/linux/serial_core.h 481 !Iinclude/linux/serial_core.h
479 !Edrivers/serial/serial_core.c 482 !Edrivers/serial/serial_core.c
480 !Edrivers/serial/8250.c 483 !Edrivers/serial/8250.c
481 </chapter> 484 </chapter>
482 485
483 <chapter id="z85230"> 486 <chapter id="z85230">
484 <title>Z85230 Support Library</title> 487 <title>Z85230 Support Library</title>
485 !Edrivers/net/wan/z85230.c 488 !Edrivers/net/wan/z85230.c
486 </chapter> 489 </chapter>
487 490
488 <chapter id="fbdev"> 491 <chapter id="fbdev">
489 <title>Frame Buffer Library</title> 492 <title>Frame Buffer Library</title>
490 493
491 <para> 494 <para>
492 The frame buffer drivers depend heavily on four data structures. 495 The frame buffer drivers depend heavily on four data structures.
493 These structures are declared in include/linux/fb.h. They are 496 These structures are declared in include/linux/fb.h. They are
494 fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. 497 fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
495 The last three can be made available to and from userland. 498 The last three can be made available to and from userland.
496 </para> 499 </para>
497 500
498 <para> 501 <para>
499 fb_info defines the current state of a particular video card. 502 fb_info defines the current state of a particular video card.
500 Inside fb_info, there exists a fb_ops structure which is a 503 Inside fb_info, there exists a fb_ops structure which is a
501 collection of needed functions to make fbdev and fbcon work. 504 collection of needed functions to make fbdev and fbcon work.
502 fb_info is only visible to the kernel. 505 fb_info is only visible to the kernel.
503 </para> 506 </para>
504 507
505 <para> 508 <para>
506 fb_var_screeninfo is used to describe the features of a video card 509 fb_var_screeninfo is used to describe the features of a video card
507 that are user defined. With fb_var_screeninfo, things such as 510 that are user defined. With fb_var_screeninfo, things such as
508 depth and the resolution may be defined. 511 depth and the resolution may be defined.
509 </para> 512 </para>
510 513
511 <para> 514 <para>
512 The next structure is fb_fix_screeninfo. This defines the 515 The next structure is fb_fix_screeninfo. This defines the
513 properties of a card that are created when a mode is set and can't 516 properties of a card that are created when a mode is set and can't
514 be changed otherwise. A good example of this is the start of the 517 be changed otherwise. A good example of this is the start of the
515 frame buffer memory. This "locks" the address of the frame buffer 518 frame buffer memory. This "locks" the address of the frame buffer
516 memory, so that it cannot be changed or moved. 519 memory, so that it cannot be changed or moved.
517 </para> 520 </para>
518 521
519 <para> 522 <para>
520 The last structure is fb_monospecs. In the old API, there was 523 The last structure is fb_monospecs. In the old API, there was
521 little importance for fb_monospecs. This allowed for forbidden things 524 little importance for fb_monospecs. This allowed for forbidden things
522 such as setting a mode of 800x600 on a fix frequency monitor. With 525 such as setting a mode of 800x600 on a fix frequency monitor. With
523 the new API, fb_monospecs prevents such things, and if used 526 the new API, fb_monospecs prevents such things, and if used
524 correctly, can prevent a monitor from being cooked. fb_monospecs 527 correctly, can prevent a monitor from being cooked. fb_monospecs
525 will not be useful until kernels 2.5.x. 528 will not be useful until kernels 2.5.x.
526 </para> 529 </para>
527 530
528 <sect1><title>Frame Buffer Memory</title> 531 <sect1><title>Frame Buffer Memory</title>
529 !Edrivers/video/fbmem.c 532 !Edrivers/video/fbmem.c
530 </sect1> 533 </sect1>
531 <!-- 534 <!--
532 <sect1><title>Frame Buffer Console</title> 535 <sect1><title>Frame Buffer Console</title>
533 X!Edrivers/video/console/fbcon.c 536 X!Edrivers/video/console/fbcon.c
534 </sect1> 537 </sect1>
535 --> 538 -->
536 <sect1><title>Frame Buffer Colormap</title> 539 <sect1><title>Frame Buffer Colormap</title>
537 !Edrivers/video/fbcmap.c 540 !Edrivers/video/fbcmap.c
538 </sect1> 541 </sect1>
539 <!-- FIXME: 542 <!-- FIXME:
540 drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment 543 drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
541 out until somebody adds docs. KAO 544 out until somebody adds docs. KAO
542 <sect1><title>Frame Buffer Generic Functions</title> 545 <sect1><title>Frame Buffer Generic Functions</title>
543 X!Idrivers/video/fbgen.c 546 X!Idrivers/video/fbgen.c
544 </sect1> 547 </sect1>
545 KAO --> 548 KAO -->
546 <sect1><title>Frame Buffer Video Mode Database</title> 549 <sect1><title>Frame Buffer Video Mode Database</title>
547 !Idrivers/video/modedb.c 550 !Idrivers/video/modedb.c
548 !Edrivers/video/modedb.c 551 !Edrivers/video/modedb.c
549 </sect1> 552 </sect1>
550 <sect1><title>Frame Buffer Macintosh Video Mode Database</title> 553 <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
551 !Edrivers/video/macmodes.c 554 !Edrivers/video/macmodes.c
552 </sect1> 555 </sect1>
553 <sect1><title>Frame Buffer Fonts</title> 556 <sect1><title>Frame Buffer Fonts</title>
554 <para> 557 <para>
555 Refer to the file drivers/video/console/fonts.c for more information. 558 Refer to the file drivers/video/console/fonts.c for more information.
556 </para> 559 </para>
557 <!-- FIXME: Removed for now since no structured comments in source 560 <!-- FIXME: Removed for now since no structured comments in source
558 X!Idrivers/video/console/fonts.c 561 X!Idrivers/video/console/fonts.c
559 --> 562 -->
560 </sect1> 563 </sect1>
561 </chapter> 564 </chapter>
562 565
563 <chapter id="input_subsystem"> 566 <chapter id="input_subsystem">
564 <title>Input Subsystem</title> 567 <title>Input Subsystem</title>
565 !Iinclude/linux/input.h 568 !Iinclude/linux/input.h
566 !Edrivers/input/input.c 569 !Edrivers/input/input.c
567 !Edrivers/input/ff-core.c 570 !Edrivers/input/ff-core.c
568 !Edrivers/input/ff-memless.c 571 !Edrivers/input/ff-memless.c
569 </chapter> 572 </chapter>
570 </book> 573 </book>
571 574
drivers/firmware/edd.c
1 /* 1 /*
2 * linux/drivers/firmware/edd.c 2 * linux/drivers/firmware/edd.c
3 * Copyright (C) 2002, 2003, 2004 Dell Inc. 3 * Copyright (C) 2002, 2003, 2004 Dell Inc.
4 * by Matt Domsch <Matt_Domsch@dell.com> 4 * by Matt Domsch <Matt_Domsch@dell.com>
5 * disk signature by Matt Domsch, Andrew Wilks, and Sandeep K. Shandilya 5 * disk signature by Matt Domsch, Andrew Wilks, and Sandeep K. Shandilya
6 * legacy CHS by Patrick J. LoPresti <patl@users.sourceforge.net> 6 * legacy CHS by Patrick J. LoPresti <patl@users.sourceforge.net>
7 * 7 *
8 * BIOS Enhanced Disk Drive Services (EDD) 8 * BIOS Enhanced Disk Drive Services (EDD)
9 * conformant to T13 Committee www.t13.org 9 * conformant to T13 Committee www.t13.org
10 * projects 1572D, 1484D, 1386D, 1226DT 10 * projects 1572D, 1484D, 1386D, 1226DT
11 * 11 *
12 * This code takes information provided by BIOS EDD calls 12 * This code takes information provided by BIOS EDD calls
13 * fn41 - Check Extensions Present and 13 * fn41 - Check Extensions Present and
14 * fn48 - Get Device Parametes with EDD extensions 14 * fn48 - Get Device Parametes with EDD extensions
15 * made in setup.S, copied to safe structures in setup.c, 15 * made in setup.S, copied to safe structures in setup.c,
16 * and presents it in sysfs. 16 * and presents it in sysfs.
17 * 17 *
18 * Please see http://linux.dell.com/edd30/results.html for 18 * Please see http://linux.dell.com/edd30/results.html for
19 * the list of BIOSs which have been reported to implement EDD. 19 * the list of BIOSs which have been reported to implement EDD.
20 * 20 *
21 * This program is free software; you can redistribute it and/or modify 21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License v2.0 as published by 22 * it under the terms of the GNU General Public License v2.0 as published by
23 * the Free Software Foundation 23 * the Free Software Foundation
24 * 24 *
25 * This program is distributed in the hope that it will be useful, 25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details. 28 * GNU General Public License for more details.
29 * 29 *
30 */ 30 */
31 31
32 #include <linux/module.h> 32 #include <linux/module.h>
33 #include <linux/string.h> 33 #include <linux/string.h>
34 #include <linux/types.h> 34 #include <linux/types.h>
35 #include <linux/init.h> 35 #include <linux/init.h>
36 #include <linux/stat.h> 36 #include <linux/stat.h>
37 #include <linux/err.h> 37 #include <linux/err.h>
38 #include <linux/ctype.h> 38 #include <linux/ctype.h>
39 #include <linux/slab.h> 39 #include <linux/slab.h>
40 #include <linux/limits.h> 40 #include <linux/limits.h>
41 #include <linux/device.h> 41 #include <linux/device.h>
42 #include <linux/pci.h> 42 #include <linux/pci.h>
43 #include <linux/blkdev.h> 43 #include <linux/blkdev.h>
44 #include <linux/edd.h> 44 #include <linux/edd.h>
45 45
46 #define EDD_VERSION "0.16" 46 #define EDD_VERSION "0.16"
47 #define EDD_DATE "2004-Jun-25" 47 #define EDD_DATE "2004-Jun-25"
48 48
49 MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>"); 49 MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>");
50 MODULE_DESCRIPTION("sysfs interface to BIOS EDD information"); 50 MODULE_DESCRIPTION("sysfs interface to BIOS EDD information");
51 MODULE_LICENSE("GPL"); 51 MODULE_LICENSE("GPL");
52 MODULE_VERSION(EDD_VERSION); 52 MODULE_VERSION(EDD_VERSION);
53 53
54 #define left (PAGE_SIZE - (p - buf) - 1) 54 #define left (PAGE_SIZE - (p - buf) - 1)
55 55
56 struct edd_device { 56 struct edd_device {
57 unsigned int index; 57 unsigned int index;
58 unsigned int mbr_signature; 58 unsigned int mbr_signature;
59 struct edd_info *info; 59 struct edd_info *info;
60 struct kobject kobj; 60 struct kobject kobj;
61 }; 61 };
62 62
63 struct edd_attribute { 63 struct edd_attribute {
64 struct attribute attr; 64 struct attribute attr;
65 ssize_t(*show) (struct edd_device * edev, char *buf); 65 ssize_t(*show) (struct edd_device * edev, char *buf);
66 int (*test) (struct edd_device * edev); 66 int (*test) (struct edd_device * edev);
67 }; 67 };
68 68
69 /* forward declarations */ 69 /* forward declarations */
70 static int edd_dev_is_type(struct edd_device *edev, const char *type); 70 static int edd_dev_is_type(struct edd_device *edev, const char *type);
71 static struct pci_dev *edd_get_pci_dev(struct edd_device *edev); 71 static struct pci_dev *edd_get_pci_dev(struct edd_device *edev);
72 72
73 static struct edd_device *edd_devices[EDD_MBR_SIG_MAX]; 73 static struct edd_device *edd_devices[EDD_MBR_SIG_MAX];
74 74
75 #define EDD_DEVICE_ATTR(_name,_mode,_show,_test) \ 75 #define EDD_DEVICE_ATTR(_name,_mode,_show,_test) \
76 struct edd_attribute edd_attr_##_name = { \ 76 struct edd_attribute edd_attr_##_name = { \
77 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ 77 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \
78 .show = _show, \ 78 .show = _show, \
79 .test = _test, \ 79 .test = _test, \
80 }; 80 };
81 81
82 static int 82 static int
83 edd_has_mbr_signature(struct edd_device *edev) 83 edd_has_mbr_signature(struct edd_device *edev)
84 { 84 {
85 return edev->index < min_t(unsigned char, edd.mbr_signature_nr, EDD_MBR_SIG_MAX); 85 return edev->index < min_t(unsigned char, edd.mbr_signature_nr, EDD_MBR_SIG_MAX);
86 } 86 }
87 87
88 static int 88 static int
89 edd_has_edd_info(struct edd_device *edev) 89 edd_has_edd_info(struct edd_device *edev)
90 { 90 {
91 return edev->index < min_t(unsigned char, edd.edd_info_nr, EDDMAXNR); 91 return edev->index < min_t(unsigned char, edd.edd_info_nr, EDDMAXNR);
92 } 92 }
93 93
94 static inline struct edd_info * 94 static inline struct edd_info *
95 edd_dev_get_info(struct edd_device *edev) 95 edd_dev_get_info(struct edd_device *edev)
96 { 96 {
97 return edev->info; 97 return edev->info;
98 } 98 }
99 99
100 static inline void 100 static inline void
101 edd_dev_set_info(struct edd_device *edev, int i) 101 edd_dev_set_info(struct edd_device *edev, int i)
102 { 102 {
103 edev->index = i; 103 edev->index = i;
104 if (edd_has_mbr_signature(edev)) 104 if (edd_has_mbr_signature(edev))
105 edev->mbr_signature = edd.mbr_signature[i]; 105 edev->mbr_signature = edd.mbr_signature[i];
106 if (edd_has_edd_info(edev)) 106 if (edd_has_edd_info(edev))
107 edev->info = &edd.edd_info[i]; 107 edev->info = &edd.edd_info[i];
108 } 108 }
109 109
110 #define to_edd_attr(_attr) container_of(_attr,struct edd_attribute,attr) 110 #define to_edd_attr(_attr) container_of(_attr,struct edd_attribute,attr)
111 #define to_edd_device(obj) container_of(obj,struct edd_device,kobj) 111 #define to_edd_device(obj) container_of(obj,struct edd_device,kobj)
112 112
113 static ssize_t 113 static ssize_t
114 edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf) 114 edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)
115 { 115 {
116 struct edd_device *dev = to_edd_device(kobj); 116 struct edd_device *dev = to_edd_device(kobj);
117 struct edd_attribute *edd_attr = to_edd_attr(attr); 117 struct edd_attribute *edd_attr = to_edd_attr(attr);
118 ssize_t ret = -EIO; 118 ssize_t ret = -EIO;
119 119
120 if (edd_attr->show) 120 if (edd_attr->show)
121 ret = edd_attr->show(dev, buf); 121 ret = edd_attr->show(dev, buf);
122 return ret; 122 return ret;
123 } 123 }
124 124
125 static struct sysfs_ops edd_attr_ops = { 125 static struct sysfs_ops edd_attr_ops = {
126 .show = edd_attr_show, 126 .show = edd_attr_show,
127 }; 127 };
128 128
129 static ssize_t 129 static ssize_t
130 edd_show_host_bus(struct edd_device *edev, char *buf) 130 edd_show_host_bus(struct edd_device *edev, char *buf)
131 { 131 {
132 struct edd_info *info; 132 struct edd_info *info;
133 char *p = buf; 133 char *p = buf;
134 int i; 134 int i;
135 135
136 if (!edev) 136 if (!edev)
137 return -EINVAL; 137 return -EINVAL;
138 info = edd_dev_get_info(edev); 138 info = edd_dev_get_info(edev);
139 if (!info || !buf) 139 if (!info || !buf)
140 return -EINVAL; 140 return -EINVAL;
141 141
142 for (i = 0; i < 4; i++) { 142 for (i = 0; i < 4; i++) {
143 if (isprint(info->params.host_bus_type[i])) { 143 if (isprint(info->params.host_bus_type[i])) {
144 p += scnprintf(p, left, "%c", info->params.host_bus_type[i]); 144 p += scnprintf(p, left, "%c", info->params.host_bus_type[i]);
145 } else { 145 } else {
146 p += scnprintf(p, left, " "); 146 p += scnprintf(p, left, " ");
147 } 147 }
148 } 148 }
149 149
150 if (!strncmp(info->params.host_bus_type, "ISA", 3)) { 150 if (!strncmp(info->params.host_bus_type, "ISA", 3)) {
151 p += scnprintf(p, left, "\tbase_address: %x\n", 151 p += scnprintf(p, left, "\tbase_address: %x\n",
152 info->params.interface_path.isa.base_address); 152 info->params.interface_path.isa.base_address);
153 } else if (!strncmp(info->params.host_bus_type, "PCIX", 4) || 153 } else if (!strncmp(info->params.host_bus_type, "PCIX", 4) ||
154 !strncmp(info->params.host_bus_type, "PCI", 3)) { 154 !strncmp(info->params.host_bus_type, "PCI", 3)) {
155 p += scnprintf(p, left, 155 p += scnprintf(p, left,
156 "\t%02x:%02x.%d channel: %u\n", 156 "\t%02x:%02x.%d channel: %u\n",
157 info->params.interface_path.pci.bus, 157 info->params.interface_path.pci.bus,
158 info->params.interface_path.pci.slot, 158 info->params.interface_path.pci.slot,
159 info->params.interface_path.pci.function, 159 info->params.interface_path.pci.function,
160 info->params.interface_path.pci.channel); 160 info->params.interface_path.pci.channel);
161 } else if (!strncmp(info->params.host_bus_type, "IBND", 4) || 161 } else if (!strncmp(info->params.host_bus_type, "IBND", 4) ||
162 !strncmp(info->params.host_bus_type, "XPRS", 4) || 162 !strncmp(info->params.host_bus_type, "XPRS", 4) ||
163 !strncmp(info->params.host_bus_type, "HTPT", 4)) { 163 !strncmp(info->params.host_bus_type, "HTPT", 4)) {
164 p += scnprintf(p, left, 164 p += scnprintf(p, left,
165 "\tTBD: %llx\n", 165 "\tTBD: %llx\n",
166 info->params.interface_path.ibnd.reserved); 166 info->params.interface_path.ibnd.reserved);
167 167
168 } else { 168 } else {
169 p += scnprintf(p, left, "\tunknown: %llx\n", 169 p += scnprintf(p, left, "\tunknown: %llx\n",
170 info->params.interface_path.unknown.reserved); 170 info->params.interface_path.unknown.reserved);
171 } 171 }
172 return (p - buf); 172 return (p - buf);
173 } 173 }
174 174
175 static ssize_t 175 static ssize_t
176 edd_show_interface(struct edd_device *edev, char *buf) 176 edd_show_interface(struct edd_device *edev, char *buf)
177 { 177 {
178 struct edd_info *info; 178 struct edd_info *info;
179 char *p = buf; 179 char *p = buf;
180 int i; 180 int i;
181 181
182 if (!edev) 182 if (!edev)
183 return -EINVAL; 183 return -EINVAL;
184 info = edd_dev_get_info(edev); 184 info = edd_dev_get_info(edev);
185 if (!info || !buf) 185 if (!info || !buf)
186 return -EINVAL; 186 return -EINVAL;
187 187
188 for (i = 0; i < 8; i++) { 188 for (i = 0; i < 8; i++) {
189 if (isprint(info->params.interface_type[i])) { 189 if (isprint(info->params.interface_type[i])) {
190 p += scnprintf(p, left, "%c", info->params.interface_type[i]); 190 p += scnprintf(p, left, "%c", info->params.interface_type[i]);
191 } else { 191 } else {
192 p += scnprintf(p, left, " "); 192 p += scnprintf(p, left, " ");
193 } 193 }
194 } 194 }
195 if (!strncmp(info->params.interface_type, "ATAPI", 5)) { 195 if (!strncmp(info->params.interface_type, "ATAPI", 5)) {
196 p += scnprintf(p, left, "\tdevice: %u lun: %u\n", 196 p += scnprintf(p, left, "\tdevice: %u lun: %u\n",
197 info->params.device_path.atapi.device, 197 info->params.device_path.atapi.device,
198 info->params.device_path.atapi.lun); 198 info->params.device_path.atapi.lun);
199 } else if (!strncmp(info->params.interface_type, "ATA", 3)) { 199 } else if (!strncmp(info->params.interface_type, "ATA", 3)) {
200 p += scnprintf(p, left, "\tdevice: %u\n", 200 p += scnprintf(p, left, "\tdevice: %u\n",
201 info->params.device_path.ata.device); 201 info->params.device_path.ata.device);
202 } else if (!strncmp(info->params.interface_type, "SCSI", 4)) { 202 } else if (!strncmp(info->params.interface_type, "SCSI", 4)) {
203 p += scnprintf(p, left, "\tid: %u lun: %llu\n", 203 p += scnprintf(p, left, "\tid: %u lun: %llu\n",
204 info->params.device_path.scsi.id, 204 info->params.device_path.scsi.id,
205 info->params.device_path.scsi.lun); 205 info->params.device_path.scsi.lun);
206 } else if (!strncmp(info->params.interface_type, "USB", 3)) { 206 } else if (!strncmp(info->params.interface_type, "USB", 3)) {
207 p += scnprintf(p, left, "\tserial_number: %llx\n", 207 p += scnprintf(p, left, "\tserial_number: %llx\n",
208 info->params.device_path.usb.serial_number); 208 info->params.device_path.usb.serial_number);
209 } else if (!strncmp(info->params.interface_type, "1394", 4)) { 209 } else if (!strncmp(info->params.interface_type, "1394", 4)) {
210 p += scnprintf(p, left, "\teui: %llx\n", 210 p += scnprintf(p, left, "\teui: %llx\n",
211 info->params.device_path.i1394.eui); 211 info->params.device_path.i1394.eui);
212 } else if (!strncmp(info->params.interface_type, "FIBRE", 5)) { 212 } else if (!strncmp(info->params.interface_type, "FIBRE", 5)) {
213 p += scnprintf(p, left, "\twwid: %llx lun: %llx\n", 213 p += scnprintf(p, left, "\twwid: %llx lun: %llx\n",
214 info->params.device_path.fibre.wwid, 214 info->params.device_path.fibre.wwid,
215 info->params.device_path.fibre.lun); 215 info->params.device_path.fibre.lun);
216 } else if (!strncmp(info->params.interface_type, "I2O", 3)) { 216 } else if (!strncmp(info->params.interface_type, "I2O", 3)) {
217 p += scnprintf(p, left, "\tidentity_tag: %llx\n", 217 p += scnprintf(p, left, "\tidentity_tag: %llx\n",
218 info->params.device_path.i2o.identity_tag); 218 info->params.device_path.i2o.identity_tag);
219 } else if (!strncmp(info->params.interface_type, "RAID", 4)) { 219 } else if (!strncmp(info->params.interface_type, "RAID", 4)) {
220 p += scnprintf(p, left, "\tidentity_tag: %x\n", 220 p += scnprintf(p, left, "\tidentity_tag: %x\n",
221 info->params.device_path.raid.array_number); 221 info->params.device_path.raid.array_number);
222 } else if (!strncmp(info->params.interface_type, "SATA", 4)) { 222 } else if (!strncmp(info->params.interface_type, "SATA", 4)) {
223 p += scnprintf(p, left, "\tdevice: %u\n", 223 p += scnprintf(p, left, "\tdevice: %u\n",
224 info->params.device_path.sata.device); 224 info->params.device_path.sata.device);
225 } else { 225 } else {
226 p += scnprintf(p, left, "\tunknown: %llx %llx\n", 226 p += scnprintf(p, left, "\tunknown: %llx %llx\n",
227 info->params.device_path.unknown.reserved1, 227 info->params.device_path.unknown.reserved1,
228 info->params.device_path.unknown.reserved2); 228 info->params.device_path.unknown.reserved2);
229 } 229 }
230 230
231 return (p - buf); 231 return (p - buf);
232 } 232 }
233 233
234 /** 234 /**
235 * edd_show_raw_data() - copies raw data to buffer for userspace to parse 235 * edd_show_raw_data() - copies raw data to buffer for userspace to parse
236 * @edev: target edd_device
237 * @buf: output buffer
236 * 238 *
237 * Returns: number of bytes written, or -EINVAL on failure 239 * Returns: number of bytes written, or -EINVAL on failure
238 */ 240 */
239 static ssize_t 241 static ssize_t
240 edd_show_raw_data(struct edd_device *edev, char *buf) 242 edd_show_raw_data(struct edd_device *edev, char *buf)
241 { 243 {
242 struct edd_info *info; 244 struct edd_info *info;
243 ssize_t len = sizeof (info->params); 245 ssize_t len = sizeof (info->params);
244 if (!edev) 246 if (!edev)
245 return -EINVAL; 247 return -EINVAL;
246 info = edd_dev_get_info(edev); 248 info = edd_dev_get_info(edev);
247 if (!info || !buf) 249 if (!info || !buf)
248 return -EINVAL; 250 return -EINVAL;
249 251
250 if (!(info->params.key == 0xBEDD || info->params.key == 0xDDBE)) 252 if (!(info->params.key == 0xBEDD || info->params.key == 0xDDBE))
251 len = info->params.length; 253 len = info->params.length;
252 254
253 /* In case of buggy BIOSs */ 255 /* In case of buggy BIOSs */
254 if (len > (sizeof(info->params))) 256 if (len > (sizeof(info->params)))
255 len = sizeof(info->params); 257 len = sizeof(info->params);
256 258
257 memcpy(buf, &info->params, len); 259 memcpy(buf, &info->params, len);
258 return len; 260 return len;
259 } 261 }
260 262
261 static ssize_t 263 static ssize_t
262 edd_show_version(struct edd_device *edev, char *buf) 264 edd_show_version(struct edd_device *edev, char *buf)
263 { 265 {
264 struct edd_info *info; 266 struct edd_info *info;
265 char *p = buf; 267 char *p = buf;
266 if (!edev) 268 if (!edev)
267 return -EINVAL; 269 return -EINVAL;
268 info = edd_dev_get_info(edev); 270 info = edd_dev_get_info(edev);
269 if (!info || !buf) 271 if (!info || !buf)
270 return -EINVAL; 272 return -EINVAL;
271 273
272 p += scnprintf(p, left, "0x%02x\n", info->version); 274 p += scnprintf(p, left, "0x%02x\n", info->version);
273 return (p - buf); 275 return (p - buf);
274 } 276 }
275 277
276 static ssize_t 278 static ssize_t
277 edd_show_mbr_signature(struct edd_device *edev, char *buf) 279 edd_show_mbr_signature(struct edd_device *edev, char *buf)
278 { 280 {
279 char *p = buf; 281 char *p = buf;
280 p += scnprintf(p, left, "0x%08x\n", edev->mbr_signature); 282 p += scnprintf(p, left, "0x%08x\n", edev->mbr_signature);
281 return (p - buf); 283 return (p - buf);
282 } 284 }
283 285
284 static ssize_t 286 static ssize_t
285 edd_show_extensions(struct edd_device *edev, char *buf) 287 edd_show_extensions(struct edd_device *edev, char *buf)
286 { 288 {
287 struct edd_info *info; 289 struct edd_info *info;
288 char *p = buf; 290 char *p = buf;
289 if (!edev) 291 if (!edev)
290 return -EINVAL; 292 return -EINVAL;
291 info = edd_dev_get_info(edev); 293 info = edd_dev_get_info(edev);
292 if (!info || !buf) 294 if (!info || !buf)
293 return -EINVAL; 295 return -EINVAL;
294 296
295 if (info->interface_support & EDD_EXT_FIXED_DISK_ACCESS) { 297 if (info->interface_support & EDD_EXT_FIXED_DISK_ACCESS) {
296 p += scnprintf(p, left, "Fixed disk access\n"); 298 p += scnprintf(p, left, "Fixed disk access\n");
297 } 299 }
298 if (info->interface_support & EDD_EXT_DEVICE_LOCKING_AND_EJECTING) { 300 if (info->interface_support & EDD_EXT_DEVICE_LOCKING_AND_EJECTING) {
299 p += scnprintf(p, left, "Device locking and ejecting\n"); 301 p += scnprintf(p, left, "Device locking and ejecting\n");
300 } 302 }
301 if (info->interface_support & EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT) { 303 if (info->interface_support & EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT) {
302 p += scnprintf(p, left, "Enhanced Disk Drive support\n"); 304 p += scnprintf(p, left, "Enhanced Disk Drive support\n");
303 } 305 }
304 if (info->interface_support & EDD_EXT_64BIT_EXTENSIONS) { 306 if (info->interface_support & EDD_EXT_64BIT_EXTENSIONS) {
305 p += scnprintf(p, left, "64-bit extensions\n"); 307 p += scnprintf(p, left, "64-bit extensions\n");
306 } 308 }
307 return (p - buf); 309 return (p - buf);
308 } 310 }
309 311
310 static ssize_t 312 static ssize_t
311 edd_show_info_flags(struct edd_device *edev, char *buf) 313 edd_show_info_flags(struct edd_device *edev, char *buf)
312 { 314 {
313 struct edd_info *info; 315 struct edd_info *info;
314 char *p = buf; 316 char *p = buf;
315 if (!edev) 317 if (!edev)
316 return -EINVAL; 318 return -EINVAL;
317 info = edd_dev_get_info(edev); 319 info = edd_dev_get_info(edev);
318 if (!info || !buf) 320 if (!info || !buf)
319 return -EINVAL; 321 return -EINVAL;
320 322
321 if (info->params.info_flags & EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT) 323 if (info->params.info_flags & EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT)
322 p += scnprintf(p, left, "DMA boundary error transparent\n"); 324 p += scnprintf(p, left, "DMA boundary error transparent\n");
323 if (info->params.info_flags & EDD_INFO_GEOMETRY_VALID) 325 if (info->params.info_flags & EDD_INFO_GEOMETRY_VALID)
324 p += scnprintf(p, left, "geometry valid\n"); 326 p += scnprintf(p, left, "geometry valid\n");
325 if (info->params.info_flags & EDD_INFO_REMOVABLE) 327 if (info->params.info_flags & EDD_INFO_REMOVABLE)
326 p += scnprintf(p, left, "removable\n"); 328 p += scnprintf(p, left, "removable\n");
327 if (info->params.info_flags & EDD_INFO_WRITE_VERIFY) 329 if (info->params.info_flags & EDD_INFO_WRITE_VERIFY)
328 p += scnprintf(p, left, "write verify\n"); 330 p += scnprintf(p, left, "write verify\n");
329 if (info->params.info_flags & EDD_INFO_MEDIA_CHANGE_NOTIFICATION) 331 if (info->params.info_flags & EDD_INFO_MEDIA_CHANGE_NOTIFICATION)
330 p += scnprintf(p, left, "media change notification\n"); 332 p += scnprintf(p, left, "media change notification\n");
331 if (info->params.info_flags & EDD_INFO_LOCKABLE) 333 if (info->params.info_flags & EDD_INFO_LOCKABLE)
332 p += scnprintf(p, left, "lockable\n"); 334 p += scnprintf(p, left, "lockable\n");
333 if (info->params.info_flags & EDD_INFO_NO_MEDIA_PRESENT) 335 if (info->params.info_flags & EDD_INFO_NO_MEDIA_PRESENT)
334 p += scnprintf(p, left, "no media present\n"); 336 p += scnprintf(p, left, "no media present\n");
335 if (info->params.info_flags & EDD_INFO_USE_INT13_FN50) 337 if (info->params.info_flags & EDD_INFO_USE_INT13_FN50)
336 p += scnprintf(p, left, "use int13 fn50\n"); 338 p += scnprintf(p, left, "use int13 fn50\n");
337 return (p - buf); 339 return (p - buf);
338 } 340 }
339 341
340 static ssize_t 342 static ssize_t
341 edd_show_legacy_max_cylinder(struct edd_device *edev, char *buf) 343 edd_show_legacy_max_cylinder(struct edd_device *edev, char *buf)
342 { 344 {
343 struct edd_info *info; 345 struct edd_info *info;
344 char *p = buf; 346 char *p = buf;
345 if (!edev) 347 if (!edev)
346 return -EINVAL; 348 return -EINVAL;
347 info = edd_dev_get_info(edev); 349 info = edd_dev_get_info(edev);
348 if (!info || !buf) 350 if (!info || !buf)
349 return -EINVAL; 351 return -EINVAL;
350 352
351 p += snprintf(p, left, "%u\n", info->legacy_max_cylinder); 353 p += snprintf(p, left, "%u\n", info->legacy_max_cylinder);
352 return (p - buf); 354 return (p - buf);
353 } 355 }
354 356
355 static ssize_t 357 static ssize_t
356 edd_show_legacy_max_head(struct edd_device *edev, char *buf) 358 edd_show_legacy_max_head(struct edd_device *edev, char *buf)
357 { 359 {
358 struct edd_info *info; 360 struct edd_info *info;
359 char *p = buf; 361 char *p = buf;
360 if (!edev) 362 if (!edev)
361 return -EINVAL; 363 return -EINVAL;
362 info = edd_dev_get_info(edev); 364 info = edd_dev_get_info(edev);
363 if (!info || !buf) 365 if (!info || !buf)
364 return -EINVAL; 366 return -EINVAL;
365 367
366 p += snprintf(p, left, "%u\n", info->legacy_max_head); 368 p += snprintf(p, left, "%u\n", info->legacy_max_head);
367 return (p - buf); 369 return (p - buf);
368 } 370 }
369 371
370 static ssize_t 372 static ssize_t
371 edd_show_legacy_sectors_per_track(struct edd_device *edev, char *buf) 373 edd_show_legacy_sectors_per_track(struct edd_device *edev, char *buf)
372 { 374 {
373 struct edd_info *info; 375 struct edd_info *info;
374 char *p = buf; 376 char *p = buf;
375 if (!edev) 377 if (!edev)
376 return -EINVAL; 378 return -EINVAL;
377 info = edd_dev_get_info(edev); 379 info = edd_dev_get_info(edev);
378 if (!info || !buf) 380 if (!info || !buf)
379 return -EINVAL; 381 return -EINVAL;
380 382
381 p += snprintf(p, left, "%u\n", info->legacy_sectors_per_track); 383 p += snprintf(p, left, "%u\n", info->legacy_sectors_per_track);
382 return (p - buf); 384 return (p - buf);
383 } 385 }
384 386
385 static ssize_t 387 static ssize_t
386 edd_show_default_cylinders(struct edd_device *edev, char *buf) 388 edd_show_default_cylinders(struct edd_device *edev, char *buf)
387 { 389 {
388 struct edd_info *info; 390 struct edd_info *info;
389 char *p = buf; 391 char *p = buf;
390 if (!edev) 392 if (!edev)
391 return -EINVAL; 393 return -EINVAL;
392 info = edd_dev_get_info(edev); 394 info = edd_dev_get_info(edev);
393 if (!info || !buf) 395 if (!info || !buf)
394 return -EINVAL; 396 return -EINVAL;
395 397
396 p += scnprintf(p, left, "%u\n", info->params.num_default_cylinders); 398 p += scnprintf(p, left, "%u\n", info->params.num_default_cylinders);
397 return (p - buf); 399 return (p - buf);
398 } 400 }
399 401
400 static ssize_t 402 static ssize_t
401 edd_show_default_heads(struct edd_device *edev, char *buf) 403 edd_show_default_heads(struct edd_device *edev, char *buf)
402 { 404 {
403 struct edd_info *info; 405 struct edd_info *info;
404 char *p = buf; 406 char *p = buf;
405 if (!edev) 407 if (!edev)
406 return -EINVAL; 408 return -EINVAL;
407 info = edd_dev_get_info(edev); 409 info = edd_dev_get_info(edev);
408 if (!info || !buf) 410 if (!info || !buf)
409 return -EINVAL; 411 return -EINVAL;
410 412
411 p += scnprintf(p, left, "%u\n", info->params.num_default_heads); 413 p += scnprintf(p, left, "%u\n", info->params.num_default_heads);
412 return (p - buf); 414 return (p - buf);
413 } 415 }
414 416
415 static ssize_t 417 static ssize_t
416 edd_show_default_sectors_per_track(struct edd_device *edev, char *buf) 418 edd_show_default_sectors_per_track(struct edd_device *edev, char *buf)
417 { 419 {
418 struct edd_info *info; 420 struct edd_info *info;
419 char *p = buf; 421 char *p = buf;
420 if (!edev) 422 if (!edev)
421 return -EINVAL; 423 return -EINVAL;
422 info = edd_dev_get_info(edev); 424 info = edd_dev_get_info(edev);
423 if (!info || !buf) 425 if (!info || !buf)
424 return -EINVAL; 426 return -EINVAL;
425 427
426 p += scnprintf(p, left, "%u\n", info->params.sectors_per_track); 428 p += scnprintf(p, left, "%u\n", info->params.sectors_per_track);
427 return (p - buf); 429 return (p - buf);
428 } 430 }
429 431
430 static ssize_t 432 static ssize_t
431 edd_show_sectors(struct edd_device *edev, char *buf) 433 edd_show_sectors(struct edd_device *edev, char *buf)
432 { 434 {
433 struct edd_info *info; 435 struct edd_info *info;
434 char *p = buf; 436 char *p = buf;
435 if (!edev) 437 if (!edev)
436 return -EINVAL; 438 return -EINVAL;
437 info = edd_dev_get_info(edev); 439 info = edd_dev_get_info(edev);
438 if (!info || !buf) 440 if (!info || !buf)
439 return -EINVAL; 441 return -EINVAL;
440 442
441 p += scnprintf(p, left, "%llu\n", info->params.number_of_sectors); 443 p += scnprintf(p, left, "%llu\n", info->params.number_of_sectors);
442 return (p - buf); 444 return (p - buf);
443 } 445 }
444 446
445 447
446 /* 448 /*
447 * Some device instances may not have all the above attributes, 449 * Some device instances may not have all the above attributes,
448 * or the attribute values may be meaningless (i.e. if 450 * or the attribute values may be meaningless (i.e. if
449 * the device is < EDD 3.0, it won't have host_bus and interface 451 * the device is < EDD 3.0, it won't have host_bus and interface
450 * information), so don't bother making files for them. Likewise 452 * information), so don't bother making files for them. Likewise
451 * if the default_{cylinders,heads,sectors_per_track} values 453 * if the default_{cylinders,heads,sectors_per_track} values
452 * are zero, the BIOS doesn't provide sane values, don't bother 454 * are zero, the BIOS doesn't provide sane values, don't bother
453 * creating files for them either. 455 * creating files for them either.
454 */ 456 */
455 457
456 static int 458 static int
457 edd_has_legacy_max_cylinder(struct edd_device *edev) 459 edd_has_legacy_max_cylinder(struct edd_device *edev)
458 { 460 {
459 struct edd_info *info; 461 struct edd_info *info;
460 if (!edev) 462 if (!edev)
461 return 0; 463 return 0;
462 info = edd_dev_get_info(edev); 464 info = edd_dev_get_info(edev);
463 if (!info) 465 if (!info)
464 return 0; 466 return 0;
465 return info->legacy_max_cylinder > 0; 467 return info->legacy_max_cylinder > 0;
466 } 468 }
467 469
468 static int 470 static int
469 edd_has_legacy_max_head(struct edd_device *edev) 471 edd_has_legacy_max_head(struct edd_device *edev)
470 { 472 {
471 struct edd_info *info; 473 struct edd_info *info;
472 if (!edev) 474 if (!edev)
473 return 0; 475 return 0;
474 info = edd_dev_get_info(edev); 476 info = edd_dev_get_info(edev);
475 if (!info) 477 if (!info)
476 return 0; 478 return 0;
477 return info->legacy_max_head > 0; 479 return info->legacy_max_head > 0;
478 } 480 }
479 481
480 static int 482 static int
481 edd_has_legacy_sectors_per_track(struct edd_device *edev) 483 edd_has_legacy_sectors_per_track(struct edd_device *edev)
482 { 484 {
483 struct edd_info *info; 485 struct edd_info *info;
484 if (!edev) 486 if (!edev)
485 return 0; 487 return 0;
486 info = edd_dev_get_info(edev); 488 info = edd_dev_get_info(edev);
487 if (!info) 489 if (!info)
488 return 0; 490 return 0;
489 return info->legacy_sectors_per_track > 0; 491 return info->legacy_sectors_per_track > 0;
490 } 492 }
491 493
492 static int 494 static int
493 edd_has_default_cylinders(struct edd_device *edev) 495 edd_has_default_cylinders(struct edd_device *edev)
494 { 496 {
495 struct edd_info *info; 497 struct edd_info *info;
496 if (!edev) 498 if (!edev)
497 return 0; 499 return 0;
498 info = edd_dev_get_info(edev); 500 info = edd_dev_get_info(edev);
499 if (!info) 501 if (!info)
500 return 0; 502 return 0;
501 return info->params.num_default_cylinders > 0; 503 return info->params.num_default_cylinders > 0;
502 } 504 }
503 505
504 static int 506 static int
505 edd_has_default_heads(struct edd_device *edev) 507 edd_has_default_heads(struct edd_device *edev)
506 { 508 {
507 struct edd_info *info; 509 struct edd_info *info;
508 if (!edev) 510 if (!edev)
509 return 0; 511 return 0;
510 info = edd_dev_get_info(edev); 512 info = edd_dev_get_info(edev);
511 if (!info) 513 if (!info)
512 return 0; 514 return 0;
513 return info->params.num_default_heads > 0; 515 return info->params.num_default_heads > 0;
514 } 516 }
515 517
516 static int 518 static int
517 edd_has_default_sectors_per_track(struct edd_device *edev) 519 edd_has_default_sectors_per_track(struct edd_device *edev)
518 { 520 {
519 struct edd_info *info; 521 struct edd_info *info;
520 if (!edev) 522 if (!edev)
521 return 0; 523 return 0;
522 info = edd_dev_get_info(edev); 524 info = edd_dev_get_info(edev);
523 if (!info) 525 if (!info)
524 return 0; 526 return 0;
525 return info->params.sectors_per_track > 0; 527 return info->params.sectors_per_track > 0;
526 } 528 }
527 529
528 static int 530 static int
529 edd_has_edd30(struct edd_device *edev) 531 edd_has_edd30(struct edd_device *edev)
530 { 532 {
531 struct edd_info *info; 533 struct edd_info *info;
532 int i, nonzero_path = 0; 534 int i, nonzero_path = 0;
533 char c; 535 char c;
534 536
535 if (!edev) 537 if (!edev)
536 return 0; 538 return 0;
537 info = edd_dev_get_info(edev); 539 info = edd_dev_get_info(edev);
538 if (!info) 540 if (!info)
539 return 0; 541 return 0;
540 542
541 if (!(info->params.key == 0xBEDD || info->params.key == 0xDDBE)) { 543 if (!(info->params.key == 0xBEDD || info->params.key == 0xDDBE)) {
542 return 0; 544 return 0;
543 } 545 }
544 546
545 for (i = 30; i <= 73; i++) { 547 for (i = 30; i <= 73; i++) {
546 c = *(((uint8_t *) info) + i + 4); 548 c = *(((uint8_t *) info) + i + 4);
547 if (c) { 549 if (c) {
548 nonzero_path++; 550 nonzero_path++;
549 break; 551 break;
550 } 552 }
551 } 553 }
552 if (!nonzero_path) { 554 if (!nonzero_path) {
553 return 0; 555 return 0;
554 } 556 }
555 557
556 return 1; 558 return 1;
557 } 559 }
558 560
559 561
560 static EDD_DEVICE_ATTR(raw_data, 0444, edd_show_raw_data, edd_has_edd_info); 562 static EDD_DEVICE_ATTR(raw_data, 0444, edd_show_raw_data, edd_has_edd_info);
561 static EDD_DEVICE_ATTR(version, 0444, edd_show_version, edd_has_edd_info); 563 static EDD_DEVICE_ATTR(version, 0444, edd_show_version, edd_has_edd_info);
562 static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions, edd_has_edd_info); 564 static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions, edd_has_edd_info);
563 static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags, edd_has_edd_info); 565 static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags, edd_has_edd_info);
564 static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors, edd_has_edd_info); 566 static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors, edd_has_edd_info);
565 static EDD_DEVICE_ATTR(legacy_max_cylinder, 0444, 567 static EDD_DEVICE_ATTR(legacy_max_cylinder, 0444,
566 edd_show_legacy_max_cylinder, 568 edd_show_legacy_max_cylinder,
567 edd_has_legacy_max_cylinder); 569 edd_has_legacy_max_cylinder);
568 static EDD_DEVICE_ATTR(legacy_max_head, 0444, edd_show_legacy_max_head, 570 static EDD_DEVICE_ATTR(legacy_max_head, 0444, edd_show_legacy_max_head,
569 edd_has_legacy_max_head); 571 edd_has_legacy_max_head);
570 static EDD_DEVICE_ATTR(legacy_sectors_per_track, 0444, 572 static EDD_DEVICE_ATTR(legacy_sectors_per_track, 0444,
571 edd_show_legacy_sectors_per_track, 573 edd_show_legacy_sectors_per_track,
572 edd_has_legacy_sectors_per_track); 574 edd_has_legacy_sectors_per_track);
573 static EDD_DEVICE_ATTR(default_cylinders, 0444, edd_show_default_cylinders, 575 static EDD_DEVICE_ATTR(default_cylinders, 0444, edd_show_default_cylinders,
574 edd_has_default_cylinders); 576 edd_has_default_cylinders);
575 static EDD_DEVICE_ATTR(default_heads, 0444, edd_show_default_heads, 577 static EDD_DEVICE_ATTR(default_heads, 0444, edd_show_default_heads,
576 edd_has_default_heads); 578 edd_has_default_heads);
577 static EDD_DEVICE_ATTR(default_sectors_per_track, 0444, 579 static EDD_DEVICE_ATTR(default_sectors_per_track, 0444,
578 edd_show_default_sectors_per_track, 580 edd_show_default_sectors_per_track,
579 edd_has_default_sectors_per_track); 581 edd_has_default_sectors_per_track);
580 static EDD_DEVICE_ATTR(interface, 0444, edd_show_interface, edd_has_edd30); 582 static EDD_DEVICE_ATTR(interface, 0444, edd_show_interface, edd_has_edd30);
581 static EDD_DEVICE_ATTR(host_bus, 0444, edd_show_host_bus, edd_has_edd30); 583 static EDD_DEVICE_ATTR(host_bus, 0444, edd_show_host_bus, edd_has_edd30);
582 static EDD_DEVICE_ATTR(mbr_signature, 0444, edd_show_mbr_signature, edd_has_mbr_signature); 584 static EDD_DEVICE_ATTR(mbr_signature, 0444, edd_show_mbr_signature, edd_has_mbr_signature);
583 585
584 586
585 /* These are default attributes that are added for every edd 587 /* These are default attributes that are added for every edd
586 * device discovered. There are none. 588 * device discovered. There are none.
587 */ 589 */
588 static struct attribute * def_attrs[] = { 590 static struct attribute * def_attrs[] = {
589 NULL, 591 NULL,
590 }; 592 };
591 593
592 /* These attributes are conditional and only added for some devices. */ 594 /* These attributes are conditional and only added for some devices. */
593 static struct edd_attribute * edd_attrs[] = { 595 static struct edd_attribute * edd_attrs[] = {
594 &edd_attr_raw_data, 596 &edd_attr_raw_data,
595 &edd_attr_version, 597 &edd_attr_version,
596 &edd_attr_extensions, 598 &edd_attr_extensions,
597 &edd_attr_info_flags, 599 &edd_attr_info_flags,
598 &edd_attr_sectors, 600 &edd_attr_sectors,
599 &edd_attr_legacy_max_cylinder, 601 &edd_attr_legacy_max_cylinder,
600 &edd_attr_legacy_max_head, 602 &edd_attr_legacy_max_head,
601 &edd_attr_legacy_sectors_per_track, 603 &edd_attr_legacy_sectors_per_track,
602 &edd_attr_default_cylinders, 604 &edd_attr_default_cylinders,
603 &edd_attr_default_heads, 605 &edd_attr_default_heads,
604 &edd_attr_default_sectors_per_track, 606 &edd_attr_default_sectors_per_track,
605 &edd_attr_interface, 607 &edd_attr_interface,
606 &edd_attr_host_bus, 608 &edd_attr_host_bus,
607 &edd_attr_mbr_signature, 609 &edd_attr_mbr_signature,
608 NULL, 610 NULL,
609 }; 611 };
610 612
611 /** 613 /**
612 * edd_release - free edd structure 614 * edd_release - free edd structure
613 * @kobj: kobject of edd structure 615 * @kobj: kobject of edd structure
614 * 616 *
615 * This is called when the refcount of the edd structure 617 * This is called when the refcount of the edd structure
616 * reaches 0. This should happen right after we unregister, 618 * reaches 0. This should happen right after we unregister,
617 * but just in case, we use the release callback anyway. 619 * but just in case, we use the release callback anyway.
618 */ 620 */
619 621
620 static void edd_release(struct kobject * kobj) 622 static void edd_release(struct kobject * kobj)
621 { 623 {
622 struct edd_device * dev = to_edd_device(kobj); 624 struct edd_device * dev = to_edd_device(kobj);
623 kfree(dev); 625 kfree(dev);
624 } 626 }
625 627
626 static struct kobj_type ktype_edd = { 628 static struct kobj_type ktype_edd = {
627 .release = edd_release, 629 .release = edd_release,
628 .sysfs_ops = &edd_attr_ops, 630 .sysfs_ops = &edd_attr_ops,
629 .default_attrs = def_attrs, 631 .default_attrs = def_attrs,
630 }; 632 };
631 633
632 static decl_subsys(edd,&ktype_edd,NULL); 634 static decl_subsys(edd,&ktype_edd,NULL);
633 635
634 636
635 /** 637 /**
636 * edd_dev_is_type() - is this EDD device a 'type' device? 638 * edd_dev_is_type() - is this EDD device a 'type' device?
637 * @edev 639 * @edev: target edd_device
638 * @type - a host bus or interface identifier string per the EDD spec 640 * @type: a host bus or interface identifier string per the EDD spec
639 * 641 *
640 * Returns 1 (TRUE) if it is a 'type' device, 0 otherwise. 642 * Returns 1 (TRUE) if it is a 'type' device, 0 otherwise.
641 */ 643 */
642 static int 644 static int
643 edd_dev_is_type(struct edd_device *edev, const char *type) 645 edd_dev_is_type(struct edd_device *edev, const char *type)
644 { 646 {
645 struct edd_info *info; 647 struct edd_info *info;
646 if (!edev) 648 if (!edev)
647 return 0; 649 return 0;
648 info = edd_dev_get_info(edev); 650 info = edd_dev_get_info(edev);
649 651
650 if (type && info) { 652 if (type && info) {
651 if (!strncmp(info->params.host_bus_type, type, strlen(type)) || 653 if (!strncmp(info->params.host_bus_type, type, strlen(type)) ||
652 !strncmp(info->params.interface_type, type, strlen(type))) 654 !strncmp(info->params.interface_type, type, strlen(type)))
653 return 1; 655 return 1;
654 } 656 }
655 return 0; 657 return 0;
656 } 658 }
657 659
658 /** 660 /**
659 * edd_get_pci_dev() - finds pci_dev that matches edev 661 * edd_get_pci_dev() - finds pci_dev that matches edev
660 * @edev - edd_device 662 * @edev: edd_device
661 * 663 *
662 * Returns pci_dev if found, or NULL 664 * Returns pci_dev if found, or NULL
663 */ 665 */
664 static struct pci_dev * 666 static struct pci_dev *
665 edd_get_pci_dev(struct edd_device *edev) 667 edd_get_pci_dev(struct edd_device *edev)
666 { 668 {
667 struct edd_info *info = edd_dev_get_info(edev); 669 struct edd_info *info = edd_dev_get_info(edev);
668 670
669 if (edd_dev_is_type(edev, "PCI")) { 671 if (edd_dev_is_type(edev, "PCI")) {
670 return pci_find_slot(info->params.interface_path.pci.bus, 672 return pci_find_slot(info->params.interface_path.pci.bus,
671 PCI_DEVFN(info->params.interface_path.pci.slot, 673 PCI_DEVFN(info->params.interface_path.pci.slot,
672 info->params.interface_path.pci. 674 info->params.interface_path.pci.
673 function)); 675 function));
674 } 676 }
675 return NULL; 677 return NULL;
676 } 678 }
677 679
678 static int 680 static int
679 edd_create_symlink_to_pcidev(struct edd_device *edev) 681 edd_create_symlink_to_pcidev(struct edd_device *edev)
680 { 682 {
681 683
682 struct pci_dev *pci_dev = edd_get_pci_dev(edev); 684 struct pci_dev *pci_dev = edd_get_pci_dev(edev);
683 if (!pci_dev) 685 if (!pci_dev)
684 return 1; 686 return 1;
685 return sysfs_create_link(&edev->kobj,&pci_dev->dev.kobj,"pci_dev"); 687 return sysfs_create_link(&edev->kobj,&pci_dev->dev.kobj,"pci_dev");
686 } 688 }
687 689
688 static inline void 690 static inline void
689 edd_device_unregister(struct edd_device *edev) 691 edd_device_unregister(struct edd_device *edev)
690 { 692 {
691 kobject_unregister(&edev->kobj); 693 kobject_unregister(&edev->kobj);
692 } 694 }
693 695
694 static void edd_populate_dir(struct edd_device * edev) 696 static void edd_populate_dir(struct edd_device * edev)
695 { 697 {
696 struct edd_attribute * attr; 698 struct edd_attribute * attr;
697 int error = 0; 699 int error = 0;
698 int i; 700 int i;
699 701
700 for (i = 0; (attr = edd_attrs[i]) && !error; i++) { 702 for (i = 0; (attr = edd_attrs[i]) && !error; i++) {
701 if (!attr->test || 703 if (!attr->test ||
702 (attr->test && attr->test(edev))) 704 (attr->test && attr->test(edev)))
703 error = sysfs_create_file(&edev->kobj,&attr->attr); 705 error = sysfs_create_file(&edev->kobj,&attr->attr);
704 } 706 }
705 707
706 if (!error) { 708 if (!error) {
707 edd_create_symlink_to_pcidev(edev); 709 edd_create_symlink_to_pcidev(edev);
708 } 710 }
709 } 711 }
710 712
711 static int 713 static int
712 edd_device_register(struct edd_device *edev, int i) 714 edd_device_register(struct edd_device *edev, int i)
713 { 715 {
714 int error; 716 int error;
715 717
716 if (!edev) 718 if (!edev)
717 return 1; 719 return 1;
718 edd_dev_set_info(edev, i); 720 edd_dev_set_info(edev, i);
719 kobject_set_name(&edev->kobj, "int13_dev%02x", 721 kobject_set_name(&edev->kobj, "int13_dev%02x",
720 0x80 + i); 722 0x80 + i);
721 kobj_set_kset_s(edev,edd_subsys); 723 kobj_set_kset_s(edev,edd_subsys);
722 error = kobject_register(&edev->kobj); 724 error = kobject_register(&edev->kobj);
723 if (!error) 725 if (!error)
724 edd_populate_dir(edev); 726 edd_populate_dir(edev);
725 return error; 727 return error;
726 } 728 }
727 729
728 static inline int edd_num_devices(void) 730 static inline int edd_num_devices(void)
729 { 731 {
730 return max_t(unsigned char, 732 return max_t(unsigned char,
731 min_t(unsigned char, EDD_MBR_SIG_MAX, edd.mbr_signature_nr), 733 min_t(unsigned char, EDD_MBR_SIG_MAX, edd.mbr_signature_nr),
732 min_t(unsigned char, EDDMAXNR, edd.edd_info_nr)); 734 min_t(unsigned char, EDDMAXNR, edd.edd_info_nr));
733 } 735 }
734 736
735 /** 737 /**
736 * edd_init() - creates sysfs tree of EDD data 738 * edd_init() - creates sysfs tree of EDD data
737 */ 739 */
738 static int __init 740 static int __init
739 edd_init(void) 741 edd_init(void)
740 { 742 {
741 unsigned int i; 743 unsigned int i;
742 int rc=0; 744 int rc=0;
743 struct edd_device *edev; 745 struct edd_device *edev;
744 746
745 printk(KERN_INFO "BIOS EDD facility v%s %s, %d devices found\n", 747 printk(KERN_INFO "BIOS EDD facility v%s %s, %d devices found\n",
746 EDD_VERSION, EDD_DATE, edd_num_devices()); 748 EDD_VERSION, EDD_DATE, edd_num_devices());
747 749
748 if (!edd_num_devices()) { 750 if (!edd_num_devices()) {
749 printk(KERN_INFO "EDD information not available.\n"); 751 printk(KERN_INFO "EDD information not available.\n");
750 return 1; 752 return 1;
751 } 753 }
752 754
753 rc = firmware_register(&edd_subsys); 755 rc = firmware_register(&edd_subsys);
754 if (rc) 756 if (rc)
755 return rc; 757 return rc;
756 758
757 for (i = 0; i < edd_num_devices() && !rc; i++) { 759 for (i = 0; i < edd_num_devices() && !rc; i++) {
758 edev = kzalloc(sizeof (*edev), GFP_KERNEL); 760 edev = kzalloc(sizeof (*edev), GFP_KERNEL);
759 if (!edev) 761 if (!edev)
760 return -ENOMEM; 762 return -ENOMEM;
761 763
762 rc = edd_device_register(edev, i); 764 rc = edd_device_register(edev, i);
763 if (rc) { 765 if (rc) {
764 kfree(edev); 766 kfree(edev);
765 break; 767 break;
766 } 768 }
767 edd_devices[i] = edev; 769 edd_devices[i] = edev;
768 } 770 }
769 771
770 if (rc) 772 if (rc)
771 firmware_unregister(&edd_subsys); 773 firmware_unregister(&edd_subsys);
772 return rc; 774 return rc;
773 } 775 }
774 776
775 static void __exit 777 static void __exit
776 edd_exit(void) 778 edd_exit(void)
777 { 779 {
778 int i; 780 int i;
779 struct edd_device *edev; 781 struct edd_device *edev;
780 782
781 for (i = 0; i < edd_num_devices(); i++) { 783 for (i = 0; i < edd_num_devices(); i++) {
782 if ((edev = edd_devices[i])) 784 if ((edev = edd_devices[i]))
783 edd_device_unregister(edev); 785 edd_device_unregister(edev);
784 } 786 }
785 firmware_unregister(&edd_subsys); 787 firmware_unregister(&edd_subsys);
786 } 788 }
787 789
788 late_initcall(edd_init); 790 late_initcall(edd_init);
789 module_exit(edd_exit); 791 module_exit(edd_exit);
790 792