1 <?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" []
>
5 <book id=
"LinuxKernelAPI">
7 <title>The Linux Kernel API
</title>
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
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.
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,
33 For more details see the file COPYING in the source
34 distribution of Linux.
42 <title>Data Types
</title>
43 <sect1><title>Doubly Linked Lists
</title>
44 !Iinclude/linux/list.h
49 <title>Basic C Library Functions
</title>
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.
59 <sect1><title>String Conversions
</title>
61 !Finclude/linux/kernel.h kstrtol
62 !Finclude/linux/kernel.h kstrtoul
65 <sect1><title>String Manipulation
</title>
66 <!-- All functions are exported at now
71 <sect1><title>Bit Operations
</title>
72 !Iarch/x86/include/asm/bitops.h
76 <chapter id=
"kernel-lib">
77 <title>Basic Kernel Library Functions
</title>
80 The Linux kernel provides more basic utility functions.
83 <sect1><title>Bitmap Operations
</title>
88 <sect1><title>Command-line Parsing
</title>
92 <sect1 id=
"crc"><title>CRC Functions
</title>
100 <sect1 id=
"idr"><title>idr/ida Functions
</title>
101 !Pinclude/linux/idr.h idr sync
102 !Plib/idr.c IDA description
108 <title>Memory Management in Linux
</title>
109 <sect1><title>The Slab Cache
</title>
110 !Iinclude/linux/slab.h
114 <sect1><title>User Space Memory Access
</title>
115 !Iarch/x86/include/asm/uaccess_32.h
116 !Earch/x86/lib/usercopy_32.c
118 <sect1><title>More Memory Management Functions
</title>
126 !Emm/page-writeback.c
133 <title>Kernel IPC facilities
</title>
135 <sect1><title>IPC utilities
</title>
141 <title>FIFO Buffer
</title>
142 <sect1><title>kfifo interface
</title>
143 !Iinclude/linux/kfifo.h
147 <chapter id=
"relayfs">
148 <title>relay interface support
</title>
151 Relay interface support
152 is designed to provide an efficient mechanism for tools and
153 facilities to relay large amounts of data from kernel space to
157 <sect1><title>relay interface
</title>
163 <chapter id=
"modload">
164 <title>Module Support
</title>
165 <sect1><title>Module Loading
</title>
168 <sect1><title>Inter Module support
</title>
170 Refer to the file kernel/module.c for more information.
172 <!-- FIXME: Removed for now since no structured comments in source
178 <chapter id=
"hardware">
179 <title>Hardware Interfaces
</title>
180 <sect1><title>Interrupt Handling
</title>
181 !Ekernel/irq/manage.c
184 <sect1><title>DMA Channels
</title>
188 <sect1><title>Resources Management
</title>
193 <sect1><title>MTRR Handling
</title>
194 !Earch/x86/kernel/cpu/mtrr/main.c
197 <sect1><title>PCI Support Library
</title>
199 !Edrivers/pci/pci-driver.c
200 !Edrivers/pci/remove.c
201 !Edrivers/pci/search.c
204 !Edrivers/pci/access.c
206 !Edrivers/pci/htirq.c
207 <!-- FIXME: Removed for now since no structured comments in source
208 X!Edrivers/pci/hotplug.c
210 !Edrivers/pci/probe.c
214 !Idrivers/pci/pci-sysfs.c
216 <sect1><title>PCI Hotplug Support Library
</title>
217 !Edrivers/pci/hotplug/pci_hotplug_core.c
221 <chapter id=
"firmware">
222 <title>Firmware Interfaces
</title>
223 <sect1><title>DMI Interfaces
</title>
224 !Edrivers/firmware/dmi_scan.c
226 <sect1><title>EDD Interfaces
</title>
227 !Idrivers/firmware/edd.c
231 <chapter id=
"security">
232 <title>Security Framework
</title>
233 !Isecurity/security.c
238 <title>Audit Interfaces
</title>
241 !Ikernel/auditfilter.c
244 <chapter id=
"accounting">
245 <title>Accounting Framework
</title>
249 <chapter id=
"blkdev">
250 <title>Block Devices
</title>
255 !Eblock/blk-settings.c
261 !Eblock/blk-integrity.c
262 !Ikernel/trace/blktrace.c
267 <chapter id=
"chrdev">
268 <title>Char devices
</title>
272 <chapter id=
"miscdev">
273 <title>Miscellaneous Devices
</title>
274 !Edrivers/char/misc.c
278 <title>Clock Framework
</title>
281 The clock framework defines programming interfaces to support
282 software management of the system clock tree.
283 This framework is widely used with System-On-Chip (SOC) platforms
284 to support power management and various devices which may need
286 Note that these
"clocks" don't relate to timekeeping or real
287 time clocks (RTCs), each of which have separate frameworks.
288 These
<structname>struct clk
</structname> instances may be used
289 to manage for example a
96 MHz signal that is used to shift bits
290 into and out of peripherals or busses, or otherwise trigger
291 synchronous state machine transitions in system hardware.
295 Power management is supported by explicit software clock gating:
296 unused clocks are disabled, so the system doesn't waste power
297 changing the state of transistors that aren't in active use.
298 On some systems this may be backed by hardware clock gating,
299 where clocks are gated without being disabled in software.
300 Sections of chips that are powered but not clocked may be able
301 to retain their last state.
302 This low power state is often called a
<emphasis>retention
304 This mode still incurs leakage currents, especially with finer
305 circuit geometries, but for CMOS circuits power is mostly used
306 by clocked state changes.
310 Power-aware drivers only enable their clocks when the device
311 they manage is in active use. Also, system sleep states often
312 differ according to which clock domains are active: while a
313 "standby" state may allow wakeup from several active domains, a
314 "mem" (suspend-to-RAM) state may require a more wholesale shutdown
315 of clocks derived from higher speed PLLs and oscillators, limiting
316 the number of possible wakeup event sources. A driver's suspend
317 method may need to be aware of system-specific clock constraints
318 on the target sleep state.
322 Some platforms support programmable clock generators. These
323 can be used by external chips of various kinds, such as other
324 CPUs, multimedia codecs, and devices with strict requirements
325 for interface clocking.
328 !Iinclude/linux/clk.h