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>
63 <sect1><title>String Manipulation</title>
64 <!-- All functions are exported at now
69 <sect1><title>Bit Operations</title>
70 !Iarch/x86/include/asm/bitops.h
74 <chapter id="kernel-lib">
75 <title>Basic Kernel Library Functions</title>
78 The Linux kernel provides more basic utility functions.
81 <sect1><title>Bitmap Operations</title>
86 <sect1><title>Command-line Parsing</title>
90 <sect1 id="crc"><title>CRC Functions</title>
100 <title>Memory Management in Linux</title>
101 <sect1><title>The Slab Cache</title>
102 !Iinclude/linux/slab.h
105 <sect1><title>User Space Memory Access</title>
106 !Iarch/x86/include/asm/uaccess_32.h
107 !Earch/x86/lib/usercopy_32.c
109 <sect1><title>More Memory Management Functions</title>
117 !Emm/page-writeback.c
124 <title>Kernel IPC facilities</title>
126 <sect1><title>IPC utilities</title>
132 <title>FIFO Buffer</title>
133 <sect1><title>kfifo interface</title>
134 !Iinclude/linux/kfifo.h
139 <chapter id="relayfs">
140 <title>relay interface support</title>
143 Relay interface support
144 is designed to provide an efficient mechanism for tools and
145 facilities to relay large amounts of data from kernel space to
149 <sect1><title>relay interface</title>
155 <chapter id="modload">
156 <title>Module Support</title>
157 <sect1><title>Module Loading</title>
160 <sect1><title>Inter Module support</title>
162 Refer to the file kernel/module.c for more information.
164 <!-- FIXME: Removed for now since no structured comments in source
170 <chapter id="hardware">
171 <title>Hardware Interfaces</title>
172 <sect1><title>Interrupt Handling</title>
173 !Ekernel/irq/manage.c
176 <sect1><title>DMA Channels</title>
180 <sect1><title>Resources Management</title>
185 <sect1><title>MTRR Handling</title>
186 !Earch/x86/kernel/cpu/mtrr/main.c
189 <sect1><title>PCI Support Library</title>
191 !Edrivers/pci/pci-driver.c
192 !Edrivers/pci/remove.c
193 !Edrivers/pci/search.c
196 !Edrivers/pci/access.c
198 !Edrivers/pci/htirq.c
199 <!-- FIXME: Removed for now since no structured comments in source
200 X!Edrivers/pci/hotplug.c
202 !Edrivers/pci/probe.c
206 !Idrivers/pci/pci-sysfs.c
208 <sect1><title>PCI Hotplug Support Library</title>
209 !Edrivers/pci/hotplug/pci_hotplug_core.c
211 <sect1><title>MCA Architecture</title>
212 <sect2><title>MCA Device Functions</title>
214 Refer to the file arch/x86/kernel/mca_32.c for more information.
216 <!-- FIXME: Removed for now since no structured comments in source
217 X!Earch/x86/kernel/mca_32.c
220 <sect2><title>MCA Bus DMA</title>
221 !Iarch/x86/include/asm/mca_dma.h
226 <chapter id="firmware">
227 <title>Firmware Interfaces</title>
228 <sect1><title>DMI Interfaces</title>
229 !Edrivers/firmware/dmi_scan.c
231 <sect1><title>EDD Interfaces</title>
232 !Idrivers/firmware/edd.c
236 <chapter id="security">
237 <title>Security Framework</title>
238 !Isecurity/security.c
243 <title>Audit Interfaces</title>
246 !Ikernel/auditfilter.c
249 <chapter id="accounting">
250 <title>Accounting Framework</title>
254 <chapter id="blkdev">
255 <title>Block Devices</title>
260 !Eblock/blk-settings.c
262 !Eblock/blk-barrier.c
265 !Eblock/blk-integrity.c
266 !Ikernel/trace/blktrace.c
271 <chapter id="chrdev">
272 <title>Char devices</title>
276 <chapter id="miscdev">
277 <title>Miscellaneous Devices</title>
278 !Edrivers/char/misc.c
282 <title>Clock Framework</title>
285 The clock framework defines programming interfaces to support
286 software management of the system clock tree.
287 This framework is widely used with System-On-Chip (SOC) platforms
288 to support power management and various devices which may need
290 Note that these "clocks" don't relate to timekeeping or real
291 time clocks (RTCs), each of which have separate frameworks.
292 These <structname>struct clk</structname> instances may be used
293 to manage for example a 96 MHz signal that is used to shift bits
294 into and out of peripherals or busses, or otherwise trigger
295 synchronous state machine transitions in system hardware.
299 Power management is supported by explicit software clock gating:
300 unused clocks are disabled, so the system doesn't waste power
301 changing the state of transistors that aren't in active use.
302 On some systems this may be backed by hardware clock gating,
303 where clocks are gated without being disabled in software.
304 Sections of chips that are powered but not clocked may be able
305 to retain their last state.
306 This low power state is often called a <emphasis>retention
308 This mode still incurs leakage currents, especially with finer
309 circuit geometries, but for CMOS circuits power is mostly used
310 by clocked state changes.
314 Power-aware drivers only enable their clocks when the device
315 they manage is in active use. Also, system sleep states often
316 differ according to which clock domains are active: while a
317 "standby" state may allow wakeup from several active domains, a
318 "mem" (suspend-to-RAM) state may require a more wholesale shutdown
319 of clocks derived from higher speed PLLs and oscillators, limiting
320 the number of possible wakeup event sources. A driver's suspend
321 method may need to be aware of system-specific clock constraints
322 on the target sleep state.
326 Some platforms support programmable clock generators. These
327 can be used by external chips of various kinds, such as other
328 CPUs, multimedia codecs, and devices with strict requirements
329 for interface clocking.
332 !Iinclude/linux/clk.h