About The Author And The Technical Reviewer |
|
xvii | |
Foreword |
|
xix | |
|
Acknowledgments |
|
xxi | |
Introduction |
|
xxiii | |
|
|
xxiii | |
|
|
xxiv | |
|
|
xxiv | |
|
|
xxv | |
1 Building And Running Modules |
|
1 | (16) |
|
|
1 | (1) |
|
|
2 | (3) |
|
|
2 | (1) |
|
|
3 | (2) |
|
|
5 | (1) |
|
|
6 | (1) |
|
|
7 | (3) |
|
|
7 | (1) |
|
Character Device Switch Table |
|
|
8 | (1) |
|
make_dev and destroy_dev Functions |
|
|
9 | (1) |
|
|
10 | (5) |
|
|
12 | (1) |
|
|
13 | (1) |
|
|
14 | (1) |
|
|
15 | (1) |
|
|
15 | (1) |
|
|
15 | (1) |
|
|
16 | (1) |
2 Allocating Memory |
|
17 | (10) |
|
Memory Management Routines |
|
|
17 | (2) |
|
|
19 | (1) |
|
|
19 | (1) |
|
|
20 | (1) |
|
Tying Everything Together |
|
|
20 | (2) |
|
Contiguous Physical Memory Management Routines |
|
|
22 | (1) |
|
A Straightforward Example |
|
|
23 | (2) |
|
|
25 | (2) |
3 Device Communication And Control |
|
27 | (26) |
|
|
28 | (1) |
|
|
29 | (1) |
|
|
30 | (7) |
|
|
34 | (1) |
|
echo_set_buffer_size Function |
|
|
35 | (1) |
|
|
36 | (1) |
|
|
36 | (1) |
|
|
37 | (1) |
|
|
37 | (3) |
|
|
40 | (1) |
|
Implementing sysctls, Part 1 |
|
|
41 | (3) |
|
sysctl Context Management Routines |
|
|
44 | (1) |
|
|
44 | (3) |
|
SYSCTL_STATIC_CHILDREN Macro |
|
|
47 | (1) |
|
|
47 | (1) |
|
Implementing sysctls, Part 2 |
|
|
47 | (5) |
|
sysctl_set_buffer_size Function |
|
|
50 | (2) |
|
|
52 | (1) |
|
|
52 | (1) |
4 Thread Synchronization |
|
53 | (30) |
|
A Simple Synchronization Problem |
|
|
54 | (1) |
|
A More Complex Synchronization Problem |
|
|
54 | (11) |
|
|
58 | (1) |
|
|
58 | (1) |
|
|
59 | (1) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
61 | (4) |
|
Preventing Race Conditions |
|
|
65 | (1) |
|
|
65 | (1) |
|
|
65 | (1) |
|
|
66 | (1) |
|
Mutex Management Routines |
|
|
66 | (2) |
|
|
68 | (5) |
|
|
71 | (1) |
|
|
72 | (1) |
|
|
73 | (1) |
|
Shared/Exclusive Lock Management Routines |
|
|
73 | (2) |
|
Implementing Shared/Exclusive Locks |
|
|
75 | (3) |
|
|
78 | (1) |
|
Reader/Writer Lock Management Routines |
|
|
78 | (1) |
|
|
79 | (1) |
|
Condition Variable Management Routines |
|
|
80 | (1) |
|
|
81 | (1) |
|
Avoid Recursing on Exclusive Locks |
|
|
81 | (1) |
|
Avoid Holding Exclusive Locks for Long Periods of Time |
|
|
82 | (1) |
|
|
82 | (1) |
5 Delaying Execution |
|
83 | (16) |
|
Voluntary Context Switching, or Sleeping |
|
|
83 | (2) |
|
Implementing Sleeps and Condition Variables |
|
|
85 | (7) |
|
|
88 | (1) |
|
|
89 | (1) |
|
|
90 | (1) |
|
sysctl_debug_sleep_test Function |
|
|
91 | (1) |
|
|
91 | (1) |
|
|
92 | (1) |
|
|
92 | (2) |
|
|
94 | (2) |
|
Callouts and Race Conditions |
|
|
96 | (1) |
|
|
96 | (2) |
|
|
97 | (1) |
|
Taskqueue Management Routines |
|
|
97 | (1) |
|
|
98 | (1) |
6 Case Study: Virtual Null Modem |
|
99 | (14) |
|
|
100 | (1) |
|
|
100 | (12) |
|
|
103 | (1) |
|
|
104 | (1) |
|
|
105 | (1) |
|
|
106 | (1) |
|
|
106 | (2) |
|
|
108 | (1) |
|
|
108 | (1) |
|
|
109 | (2) |
|
|
111 | (1) |
|
|
111 | (1) |
|
|
112 | (1) |
|
|
112 | (1) |
7 Newbus And Resource Allocation |
|
113 | (12) |
|
Autoconfiguration and Newbus Drivers |
|
|
113 | (4) |
|
|
114 | (1) |
|
|
115 | (1) |
|
|
116 | (1) |
|
Tying Everything Together |
|
|
117 | (5) |
|
|
120 | (1) |
|
|
120 | (1) |
|
|
121 | (1) |
|
|
121 | (1) |
|
|
122 | (1) |
|
Hardware Resource Management |
|
|
122 | (2) |
|
|
124 | (1) |
8 Interrupt Handling |
|
125 | (16) |
|
Registering an Interrupt Handler |
|
|
125 | (1) |
|
Interrupt Handlers in FreeBSD |
|
|
126 | (1) |
|
Implementing an Interrupt Handler |
|
|
127 | (11) |
|
|
132 | (1) |
|
|
132 | (1) |
|
|
133 | (1) |
|
|
134 | (1) |
|
|
134 | (1) |
|
|
135 | (1) |
|
|
136 | (1) |
|
|
136 | (1) |
|
|
137 | (1) |
|
|
138 | (1) |
|
Generating Interrupts on the Parallel Port |
|
|
138 | (1) |
|
|
139 | (2) |
9 Case Study: Parallel Port Printer Driver |
|
141 | (24) |
|
|
141 | (22) |
|
|
146 | (1) |
|
|
146 | (1) |
|
|
147 | (1) |
|
|
148 | (1) |
|
|
148 | (2) |
|
|
150 | (1) |
|
|
151 | (2) |
|
|
153 | (1) |
|
|
154 | (2) |
|
|
156 | (2) |
|
|
158 | (1) |
|
|
158 | (1) |
|
|
159 | (1) |
|
|
160 | (2) |
|
lpt_request ppbus Function |
|
|
162 | (1) |
|
lpt_release_ppbus Function |
|
|
162 | (1) |
|
|
163 | (2) |
10 Managing And Using Resources |
|
165 | (18) |
|
|
165 | (7) |
|
Reading from I/O Ports and I/O Memory |
|
|
166 | (1) |
|
Writing to I/O Ports and I/O Memory |
|
|
167 | (2) |
|
|
169 | (3) |
|
|
172 | (1) |
|
Tying Everything Together |
|
|
172 | (10) |
|
|
177 | (1) |
|
|
177 | (1) |
|
|
178 | (1) |
|
|
178 | (1) |
|
|
179 | (1) |
|
|
180 | (1) |
|
|
180 | (1) |
|
|
181 | (1) |
|
|
182 | (1) |
11 Case Study: Intelligent Platform Management Interface Driver |
|
183 | (10) |
|
|
183 | (8) |
|
|
185 | (1) |
|
|
186 | (1) |
|
|
187 | (2) |
|
|
189 | (1) |
|
ipmi2_pci_attach Function |
|
|
189 | (2) |
|
|
191 | (2) |
12 Direct Memory Access |
|
193 | (14) |
|
|
194 | (3) |
|
Initiating a DMA Data Transfer |
|
|
196 | (1) |
|
|
196 | (1) |
|
|
197 | (1) |
|
|
198 | (1) |
|
DMA Map Management Routines, Part 1 |
|
|
199 | (1) |
|
Loading (DMA) Buffers into DMA Maps |
|
|
199 | (3) |
|
bus_dma_segment Structures |
|
|
199 | (1) |
|
|
200 | (1) |
|
bus_dmamap_load_mbuf Function |
|
|
201 | (1) |
|
bus_dmamap_load_mbuf sg Function |
|
|
201 | (1) |
|
bus_dmamap_load_uio Function |
|
|
202 | (1) |
|
bus dmamap_unload Function |
|
|
202 | (1) |
|
DMA Map Management Routines, Part 2 |
|
|
202 | (1) |
|
A Straightforward Example |
|
|
203 | (2) |
|
Synchronizing DMA Buffers |
|
|
205 | (1) |
|
|
205 | (2) |
13 Storage Drivers |
|
207 | (18) |
|
|
207 | (3) |
|
|
208 | (1) |
|
|
209 | (1) |
|
Mandatory Media Properties |
|
|
209 | (1) |
|
Optional Media Properties |
|
|
209 | (1) |
|
|
210 | (1) |
|
disk Structure Management Routines |
|
|
210 | (1) |
|
|
210 | (2) |
|
|
212 | (1) |
|
Tying Everything Together |
|
|
213 | (10) |
|
|
217 | (1) |
|
at45d_delayed attach Function |
|
|
218 | (1) |
|
|
219 | (1) |
|
at45d_wait_for_device_ready Function |
|
|
220 | (1) |
|
at45d_get status Function |
|
|
220 | (1) |
|
|
221 | (1) |
|
|
221 | (2) |
|
Block I/O Completion Routines |
|
|
223 | (1) |
|
|
223 | (2) |
14 Common Access Method |
|
225 | (32) |
|
|
226 | (1) |
|
A (Somewhat) Simple Example |
|
|
227 | (15) |
|
|
234 | (1) |
|
|
235 | (1) |
|
|
236 | (2) |
|
|
238 | (1) |
|
|
238 | (2) |
|
|
240 | (2) |
|
SIM Registration Routines |
|
|
242 | (1) |
|
|
242 | (1) |
|
|
242 | (1) |
|
xpt_bus_register Function |
|
|
243 | (1) |
|
|
243 | (12) |
|
|
243 | (2) |
|
|
245 | (1) |
|
|
246 | (3) |
|
|
249 | (1) |
|
|
250 | (5) |
|
|
255 | (1) |
|
|
255 | (2) |
15 USB Drivers |
|
257 | (26) |
|
|
257 | (1) |
|
|
258 | (1) |
|
USB Configuration Structures |
|
|
259 | (3) |
|
|
260 | (1) |
|
|
260 | (1) |
|
|
261 | (1) |
|
USB Transfers (in FreeBSD) |
|
|
262 | (2) |
|
USB Configuration Structure Management Routines |
|
|
264 | (1) |
|
|
265 | (1) |
|
Tying Everything Together |
|
|
266 | (16) |
|
|
270 | (1) |
|
|
271 | (2) |
|
|
273 | (1) |
|
|
273 | (1) |
|
|
274 | (1) |
|
|
275 | (1) |
|
|
276 | (1) |
|
|
276 | (1) |
|
|
277 | (1) |
|
|
277 | (1) |
|
|
278 | (1) |
|
ulpt_start_write Function |
|
|
278 | (1) |
|
|
278 | (1) |
|
ulpt_write_callback Function |
|
|
279 | (1) |
|
ulpt_read_callback Function |
|
|
280 | (1) |
|
ulpt_status_callback Function |
|
|
281 | (1) |
|
|
282 | (1) |
16 Network Drivers, Part 1: Data Structures |
|
283 | (16) |
|
Network Interface Structures |
|
|
283 | (3) |
|
Network Interface Structure Management Routines |
|
|
286 | (3) |
|
|
287 | (1) |
|
|
288 | (1) |
|
Network Interface Media Structures |
|
|
289 | (1) |
|
Network Interface Media Structure Management Routines |
|
|
289 | (2) |
|
|
291 | (2) |
|
|
293 | (1) |
|
Message Signaled Interrupts |
|
|
294 | (1) |
|
|
294 | (3) |
|
|
297 | (1) |
|
|
297 | (2) |
17 Network Drivers, Part 2: Packet Reception And Transmission |
|
299 | (10) |
|
|
299 | (5) |
|
|
300 | (3) |
|
|
303 | (1) |
|
|
304 | (3) |
|
|
304 | (1) |
|
|
305 | (2) |
|
|
307 | (1) |
|
|
308 | (1) |
References |
|
309 | (2) |
Index |
|
311 | |