blob: a20c6f6fffc32aabb214c24ff9f53d477a265f69 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001<?xml version="1.0" encoding="UTF-8"?>
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" []>
4
5<book id="LinuxKernelAPI">
6 <bookinfo>
7 <title>The Linux Kernel API</title>
8
9 <legalnotice>
10 <para>
11 This documentation is free software; you can redistribute
12 it and/or modify it under the terms of the GNU General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later
15 version.
16 </para>
17
18 <para>
19 This program is distributed in the hope that it will be
20 useful, but WITHOUT ANY WARRANTY; without even the implied
21 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 See the GNU General Public License for more details.
23 </para>
24
25 <para>
26 You should have received a copy of the GNU General Public
27 License along with this program; if not, write to the Free
28 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 MA 02111-1307 USA
30 </para>
31
32 <para>
33 For more details see the file COPYING in the source
34 distribution of Linux.
35 </para>
36 </legalnotice>
37 </bookinfo>
38
39<toc></toc>
40
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 <chapter id="adt">
42 <title>Data Types</title>
43 <sect1><title>Doubly Linked Lists</title>
44!Iinclude/linux/list.h
45 </sect1>
46 </chapter>
47
48 <chapter id="libc">
49 <title>Basic C Library Functions</title>
50
51 <para>
52 When writing drivers, you cannot in general use routines which are
53 from the C Library. Some of the functions have been found generally
54 useful and they are listed below. The behaviour of these functions
55 may vary slightly from those defined by ANSI, and these deviations
56 are noted in the text.
57 </para>
58
59 <sect1><title>String Conversions</title>
60!Ilib/vsprintf.c
61!Elib/vsprintf.c
62 </sect1>
63 <sect1><title>String Manipulation</title>
Pavel Pisa4dc3b162005-05-01 08:59:25 -070064<!-- All functions are exported at now
65X!Ilib/string.c
66 -->
Linus Torvalds1da177e2005-04-16 15:20:36 -070067!Elib/string.c
68 </sect1>
69 <sect1><title>Bit Operations</title>
Randy Dunlapa1a739c2008-10-25 17:24:36 -070070!Iarch/x86/include/asm/bitops.h
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 </sect1>
Randy Dunlap28e83ba2006-06-25 05:48:58 -070072 </chapter>
73
74 <chapter id="kernel-lib">
75 <title>Basic Kernel Library Functions</title>
76
77 <para>
78 The Linux kernel provides more basic utility functions.
79 </para>
80
Randy Dunlap6e1907ff2006-06-25 05:48:57 -070081 <sect1><title>Bitmap Operations</title>
82!Elib/bitmap.c
83!Ilib/bitmap.c
84 </sect1>
Randy Dunlap28e83ba2006-06-25 05:48:58 -070085
86 <sect1><title>Command-line Parsing</title>
87!Elib/cmdline.c
88 </sect1>
Randy Dunlap2f721002006-06-25 05:48:59 -070089
Jan Nikitenkoad241522007-07-17 04:04:03 -070090 <sect1 id="crc"><title>CRC Functions</title>
91!Elib/crc7.c
Randy Dunlap2f721002006-06-25 05:48:59 -070092!Elib/crc16.c
Jan Nikitenkoad241522007-07-17 04:04:03 -070093!Elib/crc-itu-t.c
Randy Dunlap2f721002006-06-25 05:48:59 -070094!Elib/crc32.c
95!Elib/crc-ccitt.c
96 </sect1>
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 </chapter>
98
99 <chapter id="mm">
100 <title>Memory Management in Linux</title>
101 <sect1><title>The Slab Cache</title>
Paul Drynoff800590f2006-06-23 02:03:48 -0700102!Iinclude/linux/slab.h
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103!Emm/slab.c
104 </sect1>
105 <sect1><title>User Space Memory Access</title>
Randy Dunlapa1a739c2008-10-25 17:24:36 -0700106!Iarch/x86/include/asm/uaccess_32.h
Randy Dunlapf3cf31a2007-10-12 21:17:23 -0700107!Earch/x86/lib/usercopy_32.c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 </sect1>
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700109 <sect1><title>More Memory Management Functions</title>
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700110!Emm/readahead.c
111!Emm/filemap.c
112!Emm/memory.c
113!Emm/vmalloc.c
Randy Dunlap88ca3b92006-10-04 02:15:25 -0700114!Imm/page_alloc.c
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700115!Emm/mempool.c
Randy Dunlapa80a438b2008-02-06 16:29:55 -0800116!Emm/dmapool.c
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700117!Emm/page-writeback.c
118!Emm/truncate.c
119 </sect1>
120 </chapter>
121
122
123 <chapter id="ipc">
124 <title>Kernel IPC facilities</title>
125
126 <sect1><title>IPC utilities</title>
127!Iipc/util.c
128 </sect1>
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 </chapter>
130
131 <chapter id="kfifo">
132 <title>FIFO Buffer</title>
133 <sect1><title>kfifo interface</title>
134!Iinclude/linux/kfifo.h
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 </sect1>
136 </chapter>
137
Randy Dunlap5b217fa2006-09-29 01:59:10 -0700138 <chapter id="relayfs">
139 <title>relay interface support</title>
140
141 <para>
142 Relay interface support
143 is designed to provide an efficient mechanism for tools and
144 facilities to relay large amounts of data from kernel space to
145 user space.
146 </para>
147
148 <sect1><title>relay interface</title>
149!Ekernel/relay.c
150!Ikernel/relay.c
151 </sect1>
152 </chapter>
153
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 <chapter id="modload">
155 <title>Module Support</title>
156 <sect1><title>Module Loading</title>
157!Ekernel/kmod.c
158 </sect1>
159 <sect1><title>Inter Module support</title>
160 <para>
161 Refer to the file kernel/module.c for more information.
162 </para>
163<!-- FIXME: Removed for now since no structured comments in source
164X!Ekernel/module.c
165-->
166 </sect1>
167 </chapter>
168
169 <chapter id="hardware">
170 <title>Hardware Interfaces</title>
171 <sect1><title>Interrupt Handling</title>
Randy Dunlap8f2709b2005-11-07 01:01:05 -0800172!Ekernel/irq/manage.c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 </sect1>
174
Randy Dunlapeed34d02006-10-03 01:13:50 -0700175 <sect1><title>DMA Channels</title>
176!Ekernel/dma.c
177 </sect1>
178
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700179 <sect1><title>Resources Management</title>
Randy Dunlap2b549602006-07-30 03:03:40 -0700180!Ikernel/resource.c
Randy Dunlape1ca66d2006-10-03 01:13:51 -0700181!Ekernel/resource.c
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700182 </sect1>
183
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 <sect1><title>MTRR Handling</title>
Randy Dunlapf3cf31a2007-10-12 21:17:23 -0700185!Earch/x86/kernel/cpu/mtrr/main.c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 </sect1>
Randy Dunlapb0ef3712006-06-25 05:49:18 -0700187
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 <sect1><title>PCI Support Library</title>
189!Edrivers/pci/pci.c
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700190!Edrivers/pci/pci-driver.c
191!Edrivers/pci/remove.c
Randy Dunlapd75763d2006-07-30 03:03:41 -0700192!Edrivers/pci/search.c
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700193!Edrivers/pci/msi.c
194!Edrivers/pci/bus.c
Randy Dunlapcffb2fa2009-04-10 15:17:50 -0700195!Edrivers/pci/access.c
196!Edrivers/pci/irq.c
197!Edrivers/pci/htirq.c
Randy Dunlapf05aab82005-10-23 11:58:19 -0700198<!-- FIXME: Removed for now since no structured comments in source
199X!Edrivers/pci/hotplug.c
200-->
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700201!Edrivers/pci/probe.c
Randy Dunlapcffb2fa2009-04-10 15:17:50 -0700202!Edrivers/pci/slot.c
Pavel Pisa4dc3b162005-05-01 08:59:25 -0700203!Edrivers/pci/rom.c
Yu Zhao15b49be2009-03-20 11:25:18 +0800204!Edrivers/pci/iov.c
Randy Dunlapcffb2fa2009-04-10 15:17:50 -0700205!Idrivers/pci/pci-sysfs.c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 </sect1>
207 <sect1><title>PCI Hotplug Support Library</title>
208!Edrivers/pci/hotplug/pci_hotplug_core.c
209 </sect1>
210 <sect1><title>MCA Architecture</title>
211 <sect2><title>MCA Device Functions</title>
212 <para>
Randy Dunlapf3cf31a2007-10-12 21:17:23 -0700213 Refer to the file arch/x86/kernel/mca_32.c for more information.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 </para>
215<!-- FIXME: Removed for now since no structured comments in source
Randy Dunlapf3cf31a2007-10-12 21:17:23 -0700216X!Earch/x86/kernel/mca_32.c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217-->
218 </sect2>
219 <sect2><title>MCA Bus DMA</title>
Randy Dunlapa1a739c2008-10-25 17:24:36 -0700220!Iarch/x86/include/asm/mca_dma.h
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 </sect2>
222 </sect1>
223 </chapter>
224
Randy Dunlapb0ef3712006-06-25 05:49:18 -0700225 <chapter id="firmware">
226 <title>Firmware Interfaces</title>
227 <sect1><title>DMI Interfaces</title>
228!Edrivers/firmware/dmi_scan.c
229 </sect1>
Randy Dunlap6e8c8182007-02-10 01:46:03 -0800230 <sect1><title>EDD Interfaces</title>
231!Idrivers/firmware/edd.c
232 </sect1>
Randy Dunlapb0ef3712006-06-25 05:49:18 -0700233 </chapter>
234
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 <chapter id="security">
236 <title>Security Framework</title>
James Morris20510f22007-10-16 23:31:32 -0700237!Isecurity/security.c
Randy Dunlap3f23d812008-08-17 21:44:22 -0700238!Esecurity/inode.c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 </chapter>
240
Randy Dunlap862f5f02006-06-23 02:05:52 -0700241 <chapter id="audit">
242 <title>Audit Interfaces</title>
243!Ekernel/audit.c
244!Ikernel/auditsc.c
245!Ikernel/auditfilter.c
246 </chapter>
247
248 <chapter id="accounting">
249 <title>Accounting Framework</title>
250!Ikernel/acct.c
251 </chapter>
252
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253 <chapter id="blkdev">
254 <title>Block Devices</title>
Randy Dunlapcaf03fe2008-01-30 11:51:00 -0800255!Eblock/blk-core.c
Randy Dunlap5d87a052008-02-20 09:01:22 +0100256!Iblock/blk-core.c
Randy Dunlapcaf03fe2008-01-30 11:51:00 -0800257!Eblock/blk-map.c
258!Iblock/blk-sysfs.c
259!Eblock/blk-settings.c
260!Eblock/blk-exec.c
261!Eblock/blk-barrier.c
262!Eblock/blk-tag.c
Randy Dunlap5d87a052008-02-20 09:01:22 +0100263!Iblock/blk-tag.c
Randy Dunlap710027a2008-08-19 20:13:11 +0200264!Eblock/blk-integrity.c
Randy Dunlap88cacbb2009-04-05 15:45:34 -0700265!Ikernel/trace/blktrace.c
Randy Dunlap710027a2008-08-19 20:13:11 +0200266!Iblock/genhd.c
267!Eblock/genhd.c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 </chapter>
269
Jonathan Corbetcf3e43d2006-09-29 02:00:44 -0700270 <chapter id="chrdev">
271 <title>Char devices</title>
272!Efs/char_dev.c
273 </chapter>
274
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 <chapter id="miscdev">
276 <title>Miscellaneous Devices</title>
277!Edrivers/char/misc.c
278 </chapter>
279
David Brownelle275ac42008-04-28 02:11:56 -0700280 <chapter id="clk">
281 <title>Clock Framework</title>
282
283 <para>
284 The clock framework defines programming interfaces to support
285 software management of the system clock tree.
286 This framework is widely used with System-On-Chip (SOC) platforms
287 to support power management and various devices which may need
288 custom clock rates.
289 Note that these "clocks" don't relate to timekeeping or real
290 time clocks (RTCs), each of which have separate frameworks.
291 These <structname>struct clk</structname> instances may be used
292 to manage for example a 96 MHz signal that is used to shift bits
293 into and out of peripherals or busses, or otherwise trigger
294 synchronous state machine transitions in system hardware.
295 </para>
296
297 <para>
298 Power management is supported by explicit software clock gating:
299 unused clocks are disabled, so the system doesn't waste power
300 changing the state of transistors that aren't in active use.
301 On some systems this may be backed by hardware clock gating,
302 where clocks are gated without being disabled in software.
303 Sections of chips that are powered but not clocked may be able
304 to retain their last state.
305 This low power state is often called a <emphasis>retention
306 mode</emphasis>.
307 This mode still incurs leakage currents, especially with finer
308 circuit geometries, but for CMOS circuits power is mostly used
309 by clocked state changes.
310 </para>
311
312 <para>
313 Power-aware drivers only enable their clocks when the device
314 they manage is in active use. Also, system sleep states often
315 differ according to which clock domains are active: while a
316 "standby" state may allow wakeup from several active domains, a
317 "mem" (suspend-to-RAM) state may require a more wholesale shutdown
318 of clocks derived from higher speed PLLs and oscillators, limiting
319 the number of possible wakeup event sources. A driver's suspend
320 method may need to be aware of system-specific clock constraints
321 on the target sleep state.
322 </para>
323
324 <para>
325 Some platforms support programmable clock generators. These
326 can be used by external chips of various kinds, such as other
327 CPUs, multimedia codecs, and devices with strict requirements
328 for interface clocking.
329 </para>
330
331!Iinclude/linux/clk.h
332 </chapter>
333
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334</book>