1 | RTEMS BSD USB and TCP/IP Developers Guide |
---|
2 | ========================================= |
---|
3 | Joel Sherrill <joel.sherrill@oarcorp.com> |
---|
4 | :Author Initials: JRS |
---|
5 | :toc: |
---|
6 | :icons: |
---|
7 | :numbered: |
---|
8 | :website: http://www.rtems.org/ |
---|
9 | |
---|
10 | RTEMS uses FreeBSD as the source of its TCP/IP and USB stacks. |
---|
11 | This is a developers guide which captures information on the |
---|
12 | process of merging code from FreeBSD, building this library, |
---|
13 | RTEMS specific support files, and general guidelines on what |
---|
14 | modifications to the FreeBSD source are permitted. |
---|
15 | |
---|
16 | Goals of this effort are: |
---|
17 | |
---|
18 | * Update TCP/IP and provide USB in RTEMS |
---|
19 | * Ease updating to future FreeBSD versions |
---|
20 | * Ease tracking changes in FreeBSD code |
---|
21 | * Minimize manual changes in FreeBSD code |
---|
22 | * Define stable kernel/device driver API which is implemented |
---|
23 | by both RTEMS and FreeBSD. This is the foundation of the port. |
---|
24 | |
---|
25 | We will work to push our changes upstream to the FreeBSD Project |
---|
26 | and minimize changes required at each update point. |
---|
27 | |
---|
28 | ************************************************************** |
---|
29 | This is a work in progress and is very likely to be incomplete. |
---|
30 | Please help by adding to it. |
---|
31 | ************************************************************** |
---|
32 | |
---|
33 | == Source Code Version Information |
---|
34 | |
---|
35 | * FreeBSD 8.2 SVN r255967 |
---|
36 | * RTEMS 4.11 |
---|
37 | - BSP must have support for all new BSD sys sections |
---|
38 | - It is preferable if the BSP uses linkcmds.base. |
---|
39 | - BSP must be from an architecture with Programmable Interrupt Controller |
---|
40 | interrupt model. |
---|
41 | |
---|
42 | The latest port uses the FreeBSD sources as a Git submodule which will |
---|
43 | generally be referred to as the FreeBSD source in this document. Previously a |
---|
44 | FreeBSD 8.2 SVN checkout was used. The SVN checkout command corresponding to |
---|
45 | the current Git submodule commit is this |
---|
46 | svn co http://svn.freebsd.org/base/releng/8.2 -r255967 freebsd-8.2 |
---|
47 | |
---|
48 | == Issues and To Do |
---|
49 | * Per-CPU data should be enabled once the new stack is ready for SMP. |
---|
50 | |
---|
51 | * Per-CPU NETISR(9) should be enabled onece the new stack is ready for SMP. |
---|
52 | |
---|
53 | * Multiple routing tables are not supported. Every FIB value is set to zero |
---|
54 | (= BSD_DEFAULT_FIB). |
---|
55 | |
---|
56 | * Process identifiers are not supported. Every PID value is set to zero |
---|
57 | (= BSD_DEFAULT_PID). |
---|
58 | |
---|
59 | * User credentials are not supported. The following functions allow the |
---|
60 | operation for everyone |
---|
61 | - prison_equal_ip4(), |
---|
62 | - chgsbsize(), |
---|
63 | - cr_cansee(), |
---|
64 | - cr_canseesocket() and |
---|
65 | - cr_canseeinpcb(). |
---|
66 | |
---|
67 | * Sebastian Huber and Joel Sherrill discussed the need for a a basic USB |
---|
68 | functionality test that is known to work on qemu pc. |
---|
69 | |
---|
70 | * Adapt generic IRQ PIC interface code to Simple Vectored Interrupt Model |
---|
71 | so that those architectures can use new TCP/IP and USB code. |
---|
72 | |
---|
73 | * freebsd-userspace/rtems/include/sys/syslog.h is a copy from the old |
---|
74 | RTEMS TCP/IP stack. For some reason, the __printflike markers do not |
---|
75 | compile in this environment. We may want to use the FreeBSD syslog.h |
---|
76 | and get this addressed. |
---|
77 | |
---|
78 | * in_cksum implementations for architectures not supported by FreeBSD. |
---|
79 | This will require figuring out where to put implementations that do |
---|
80 | not originate from FreeBSD and are populated via the script. |
---|
81 | |
---|
82 | * linker section issues: I have undefined symbols for |
---|
83 | `_bsd__start_set_sysinit_set` and `_bsd__stop_set_sysinit_set`. |
---|
84 | Is this the only type of new section magic? What about the old sysctl_set? |
---|
85 | I added this to my linkcmds. |
---|
86 | |
---|
87 | * MAC support functions are not thread-safe ("freebsd/lib/libc/posix1e/mac.c"). |
---|
88 | |
---|
89 | * IFCONFIG(8): IEEE80211 support is disabled. This module depends on a XML |
---|
90 | parser and mmap(). |
---|
91 | |
---|
92 | * get_cyclecount(): The implementation is a security problem. |
---|
93 | |
---|
94 | * What to do with the priority parameter present in the FreeBSD synchronization |
---|
95 | primitives and the thread creation functions? |
---|
96 | |
---|
97 | * TASKQUEUE(9): Support spin mutexes. |
---|
98 | |
---|
99 | * ZONE(9): Review allocator lock usage in rtems-bsd-chunk.c. |
---|
100 | |
---|
101 | * KQUEUE(2): Choose proper lock for global kqueue list. |
---|
102 | |
---|
103 | [listing] |
---|
104 | ---- |
---|
105 | /* sysinit section? */ |
---|
106 | . = ALIGN (16); |
---|
107 | _bsd__start_set_sysinit_set = .; |
---|
108 | *(set_sys_init_*); |
---|
109 | _bsd__stop_set_sysinit_set = .; |
---|
110 | |
---|
111 | ---- |
---|
112 | |
---|
113 | * Why is the interrupt server used? The BSD interrupt handlers can block on |
---|
114 | synchronization primitives like mutexes. This is in contrast to RTEMS |
---|
115 | interrupt service routines. The BSPs using the generic interrupt support must |
---|
116 | implement the `bsp_interrupt_vector_enable()` and |
---|
117 | `bsp_interrupt_vector_disable()` routines. They normally enable/disable a |
---|
118 | particular interrupt source at the interrupt controller. This can be used to |
---|
119 | implement the interrupt server. The interrupt server is a task that wakes-up |
---|
120 | in case an associated interrupt happens. The interrupt source is disabled in |
---|
121 | a generic interrupt handler that wakes-up the interrupt server task. Once the |
---|
122 | postponed interrupt processing is performed in the interrupt server the |
---|
123 | interrupt source is enabled again. |
---|
124 | |
---|
125 | * Convert all BSP linkcmds to use a linkcmds.base so the sections are |
---|
126 | easier to insert. |
---|
127 | |
---|
128 | * rtems-bsd-init-with-irq.c: |
---|
129 | rtems_bsd_initialize_with_interrupt_server() has reference to |
---|
130 | rtems_interrupt_server_initialize() and this method is unimplemented |
---|
131 | - XXX BSP implements pieces |
---|
132 | - BSPs using this software stack must support it apparently. |
---|
133 | - What about Simple Vectored architectures? |
---|
134 | |
---|
135 | * We carried over use of notepad 0 for per task information. This should |
---|
136 | be changed. |
---|
137 | |
---|
138 | * maxproc variable referenced by rtems-bsd-resource.c. What should it |
---|
139 | be set to? |
---|
140 | |
---|
141 | * ngroups_max variable referenced by rtems-bsd-prot.c. - What should |
---|
142 | it be set to? |
---|
143 | |
---|
144 | * NIC Device Drivers |
---|
145 | - Only common PCI NIC drivers have been included in the initial set. These |
---|
146 | do not include any system on chip or ISA drivers. |
---|
147 | - PCI configuration probe does not appear to happen to determine if a |
---|
148 | NIC is in I/O or memory space. We have worked around this by using a |
---|
149 | static hint to tell the fxp driver the correct mode. But this needs to |
---|
150 | be addressed. |
---|
151 | - The ISA drivers require more BSD infrastructure to be addressed. This was |
---|
152 | outside the scope of the initial porting effort. |
---|
153 | |
---|
154 | == FreeBSD Source |
---|
155 | |
---|
156 | You should be able to rely on FreebSD manual pages and documentation |
---|
157 | for details on the code itself. |
---|
158 | |
---|
159 | === Automatically Generated FreeBSD Files |
---|
160 | |
---|
161 | The FreeBSD source tarball includes a file named Makefile.rtems which |
---|
162 | has stanzas to automatically generate some files using awk. For details |
---|
163 | on this, see http://www.freebsd.org/cgi/man.cgi?query=kobj&apropos=0&sektion=0&manpath=FreeBSD+9.0-RELEASE&arch=default&format=html |
---|
164 | |
---|
165 | XXX This needs more detail. |
---|
166 | |
---|
167 | === Rules for Modifying FreeBSD Source |
---|
168 | |
---|
169 | * Only add lines. Subtract code by added "ifndef __rtems__". This makes |
---|
170 | merging easier in the future. |
---|
171 | |
---|
172 | == libbsd Source |
---|
173 | |
---|
174 | === What is in git |
---|
175 | |
---|
176 | The git source is a self-contained kit with FreeBSD and RTEMS components |
---|
177 | pre-merged. The Makefile in this kit is automatically generated. |
---|
178 | |
---|
179 | Any changes to sources in the freebsd or contrib directories will need to |
---|
180 | be merged upstream into our master FreeBSD svn checkout. |
---|
181 | |
---|
182 | The FreeBSD sources managed in the rtems-libbsd git repository (e.g. contrib |
---|
183 | and freebsd directories) contain the "managed" version of the |
---|
184 | FreeBSD source. The FreeBSD SVN source is the "master" version. The |
---|
185 | freebsd-to-rtems.py script is used to transfer files between the two |
---|
186 | trees. In general terms, if you have modified FreeBSD (i.e. anything in the |
---|
187 | freebsd directory) in the rtems-libbsd tree, you will need to run the script |
---|
188 | in "revert" or "reverse" mode using the -R switch. This will copy the source |
---|
189 | back to your local copy of the FreeBSD source so you can run "svn diff" against |
---|
190 | the upstream FreeBSD source. If you want to transfer source files from the |
---|
191 | FreeBSD SVN checkout to the rtems-libbsd tree, then you must run the script in |
---|
192 | "forward" mode (the default). |
---|
193 | |
---|
194 | === Building rtems-libbsd source |
---|
195 | |
---|
196 | You need to configure RTEMS for the desired BSP and install it. The |
---|
197 | following is the script used to build the powerpc/psim BSP for our |
---|
198 | internal testing purposes: |
---|
199 | |
---|
200 | [listing] |
---|
201 | ---- |
---|
202 | #! /bin/sh |
---|
203 | |
---|
204 | cd ${HOME}/newbsd |
---|
205 | rm -rf b-psim |
---|
206 | mkdir b-psim |
---|
207 | cd b-psim |
---|
208 | ../git/rtems/configure --target=powerpc-rtems4.11 \ |
---|
209 | --enable-rtemsbsp=psim --disable-networking \ |
---|
210 | --enable-tests=samples \ |
---|
211 | --prefix=${HOME}/newbsd/bsp-install >c.log 2>&1 && \ |
---|
212 | make >b.log 2>&1 && \ |
---|
213 | make install >i.log 2>&1 |
---|
214 | echo $? |
---|
215 | ---- |
---|
216 | |
---|
217 | Then edit the file config.inc to set RTEMS_MAKEFILE_PATH appropriately |
---|
218 | to indicate the ${prefix}/${target}/${BSP}. Continuing on the above, |
---|
219 | the config.inc used to match the above is: |
---|
220 | |
---|
221 | [listing] |
---|
222 | ---- |
---|
223 | RTEMS_MAKEFILE_PATH = ${HOME}/newbsd/bsp-install/powerpc-rtems4.11/psim/ |
---|
224 | INSTALL_BASE = ${HOME}/newbsd/install |
---|
225 | ---- |
---|
226 | |
---|
227 | The above installs the rtems-libbsd kit into a separate place from |
---|
228 | RTEMS and the BSP. The rtems-libbsd tests are built against an installed |
---|
229 | image of the rtems-libbsd. By keeping it in a separate installation point |
---|
230 | from RTEMS itself, this makes it easier to remove a libbsd installation |
---|
231 | and have a clean test point. |
---|
232 | |
---|
233 | [listing] |
---|
234 | ---- |
---|
235 | make |
---|
236 | make install |
---|
237 | make -C testsuite |
---|
238 | ---- |
---|
239 | |
---|
240 | At this point, we expect multiple linker errors. That is what we are |
---|
241 | currently working on. |
---|
242 | |
---|
243 | === Organization |
---|
244 | |
---|
245 | The top level directory contains a few directories and files. The following |
---|
246 | are important to understand: |
---|
247 | |
---|
248 | * freebsd-to-rtems.py - script to convert to and free FreeBSD and RTEMS trees |
---|
249 | * Makefile - automatically generated |
---|
250 | * contrib/ - from FreeBSD by script. |
---|
251 | * freebsd/ - from FreeBSD by script. |
---|
252 | * rtemsbsd/ - RTEMS specific implementations of FreeBSD kernel support routines. |
---|
253 | * testsuite/ - RTEMS specific tests |
---|
254 | * libbsd.txt - Documentation in Asciidoc |
---|
255 | |
---|
256 | == Moving Code Between FreeBSD SVN and rtems-libbsd |
---|
257 | |
---|
258 | The script freebsd-to-rtems.py is used to copy code from FreeBSD to the |
---|
259 | rtems-libbsd tree and to reverse this process. This script attempts to |
---|
260 | automate this process as much as possible and performs some transformations |
---|
261 | on the FreeBSD code. Its command line arguments are shown below: |
---|
262 | |
---|
263 | [listing] |
---|
264 | ---- |
---|
265 | freebsd-to-rtems.py [args] |
---|
266 | -?|-h|--help print this and exit |
---|
267 | -d|--dry-run run program but no modifications |
---|
268 | -D|--diff provide diff of files between trees |
---|
269 | -e|--early-exit evaluate arguments, print results, and exit |
---|
270 | -m|--makefile just generate Makefile |
---|
271 | -R|--reverse default FreeBSD -> RTEMS, reverse that |
---|
272 | -r|--rtems RTEMS directory |
---|
273 | -f|--freebsd FreeBSD directory |
---|
274 | -v|--verbose enable verbose output mode |
---|
275 | ---- |
---|
276 | |
---|
277 | In its default mode of operation, freebsd-to-rtems.py is used to copy code |
---|
278 | from FreeBSD to the rtems-libbsd tree and perform transformations. In forward |
---|
279 | mode, the script may be requested to just generate the Makefile. |
---|
280 | |
---|
281 | In "reverse mode", this script undoes those transformations and copies |
---|
282 | the source code back to the FreeBSD SVN tree. This allows us to do |
---|
283 | 'svn diff', evaluate changes made by the RTEMS Project, and report changes |
---|
284 | back to FreeBSD upstream. |
---|
285 | |
---|
286 | In either mode, the script may be asked to perform a dry-run or be verbose. |
---|
287 | Also, in either mode, the script is also smart enough to avoid copying over |
---|
288 | files which have not changed. This means that the timestamps of files are |
---|
289 | not changed unless the contents change. The script will also report the |
---|
290 | number of files which changed. In verbose mode, the script will print |
---|
291 | the name of the files which are changed. |
---|
292 | |
---|
293 | The following is an example forward run with no changes. |
---|
294 | |
---|
295 | [listing] |
---|
296 | ---- |
---|
297 | $ ~/newbsd/git/libbsd-8.2/freebsd-to-rtems.py \ |
---|
298 | -r /home/joel/newbsd/git/libbsd-8.2 \ |
---|
299 | -f /home/joel/newbsd/libbsd/freebsd-8.2 -v |
---|
300 | Verbose: yes |
---|
301 | Dry Run: no |
---|
302 | Only Generate Makefile: no |
---|
303 | RTEMS Directory: /home/joel/newbsd/git/libbsd-8.2 |
---|
304 | FreeBSD Directory: /home/joel/newbsd/libbsd/freebsd-8.2 |
---|
305 | Direction: forward |
---|
306 | Generating into /home/joel/newbsd/git/libbsd-8.2 |
---|
307 | 0 files were changed. |
---|
308 | ---- |
---|
309 | |
---|
310 | The script may also be used to generate a diff in either forward or reverse |
---|
311 | direction. |
---|
312 | |
---|
313 | == Initialization of rtems-libbsd |
---|
314 | |
---|
315 | The initialization of the rtems-libbsd is based on the FreeBSD SYSINIT(9) |
---|
316 | infrastructure. The key to initializing a system is to ensure that the desired |
---|
317 | device drivers are explicitly pulled into the linked application. This plus |
---|
318 | linking against the libbsd library will pull in the necessary FreeBSD |
---|
319 | infrastructure. |
---|
320 | |
---|
321 | The FreeBSD kernel is not a library like the RTEMS kernel. It is a bunch of |
---|
322 | object files linked together. If we have a library, then creating the |
---|
323 | executable is simple. We begin with a start symbol and recursively resolve all |
---|
324 | references. With a bunch of object files linked together we need a different |
---|
325 | mechanism. Most object files don't know each other. Lets say we have a driver |
---|
326 | module. The rest of the system has no references to this driver module. The |
---|
327 | driver module needs a way to tell the rest of the system: Hey, kernel I am |
---|
328 | here, please use my services! |
---|
329 | |
---|
330 | This registration of independent components is performed by SYSINIT(9) and |
---|
331 | specializations: |
---|
332 | |
---|
333 | http://www.freebsd.org/cgi/man.cgi?query=SYSINIT |
---|
334 | |
---|
335 | The SYSINIT(9) uses some global data structures that are placed in a certain |
---|
336 | section. In the linker command file we need this: |
---|
337 | |
---|
338 | [listing] |
---|
339 | ---- |
---|
340 | .robsdsets : { |
---|
341 | _bsd__start_set_modmetadata_set = .; |
---|
342 | *(_bsd_set_modmetadata_set); |
---|
343 | _bsd__stop_set_modmetadata_set = .; |
---|
344 | _bsd__start_set_sysctl_set = .; |
---|
345 | *(_bsd_set_sysctl_set); |
---|
346 | _bsd__stop_set_sysctl_set = .; |
---|
347 | } > REGION_RODATA AT > REGION_RODATA_LOAD |
---|
348 | |
---|
349 | .rwbsdsets : { |
---|
350 | _bsd__start_set_sysinit_set = .; |
---|
351 | *(_bsd_set_sysinit_set); |
---|
352 | _bsd__stop_set_sysinit_set = .; |
---|
353 | } > REGION_DATA AT > REGION_DATA_LOAD |
---|
354 | ---- |
---|
355 | |
---|
356 | Here you can see, that these global data structures are collected into |
---|
357 | continuous memory areas. This memory area can be identified by start and stop |
---|
358 | symbols. This constructs a table of uniform items. |
---|
359 | |
---|
360 | The low level FreeBSD code calls at some time during the initialization the |
---|
361 | mi_startup() function (machine independent startup). This function will sort |
---|
362 | the SYSINIT(9) set and call handler functions which perform further |
---|
363 | initialization. The last step is the scheduler invocation. |
---|
364 | |
---|
365 | The SYSINIT(9) routines are run in mi_startup() which is called by |
---|
366 | rtems_bsd_initialize(). |
---|
367 | |
---|
368 | This is also explained in "The Design and Implementation of the FreeBSD |
---|
369 | Operating System" section 14.3 "Kernel Initialization". |
---|
370 | |
---|
371 | In RTEMS we have a library and not a bunch of object files. Thus we need a way |
---|
372 | to pull-in the desired services out of the libbsd. Here the |
---|
373 | "rtems-bsd-sysinit.h" comes into play. The SYSINIT(9) macros have been |
---|
374 | modified and extended for RTEMS in "sys/kernel.h": |
---|
375 | |
---|
376 | [listing] |
---|
377 | ---- |
---|
378 | #ifndef __rtems__ |
---|
379 | #define C_SYSINIT(uniquifier, subsystem, order, func, ident) \ |
---|
380 | static struct sysinit uniquifier ## _sys_init = { \ |
---|
381 | subsystem, \ |
---|
382 | order, \ |
---|
383 | func, \ |
---|
384 | (ident) \ |
---|
385 | }; \ |
---|
386 | DATA_SET(sysinit_set,uniquifier ## _sys_init) |
---|
387 | #else /* __rtems__ */ |
---|
388 | #define SYSINIT_ENTRY_NAME(uniquifier) \ |
---|
389 | _bsd_ ## uniquifier ## _sys_init |
---|
390 | #define SYSINIT_REFERENCE_NAME(uniquifier) \ |
---|
391 | _bsd_ ## uniquifier ## _sys_init_ref |
---|
392 | #define C_SYSINIT(uniquifier, subsystem, order, func, ident) \ |
---|
393 | struct sysinit SYSINIT_ENTRY_NAME(uniquifier) = { \ |
---|
394 | subsystem, \ |
---|
395 | order, \ |
---|
396 | func, \ |
---|
397 | (ident) \ |
---|
398 | }; \ |
---|
399 | DATA_SET(sysinit_set,SYSINIT_ENTRY_NAME(uniquifier)) |
---|
400 | #define SYSINIT_REFERENCE(uniquifier) \ |
---|
401 | extern struct sysinit SYSINIT_ENTRY_NAME(uniquifier); \ |
---|
402 | static struct sysinit const * const \ |
---|
403 | SYSINIT_REFERENCE_NAME(uniquifier) __used \ |
---|
404 | = &SYSINIT_ENTRY_NAME(uniquifier) |
---|
405 | #define SYSINIT_MODULE_REFERENCE(mod) \ |
---|
406 | SYSINIT_REFERENCE(mod ## module) |
---|
407 | #define SYSINIT_DRIVER_REFERENCE(driver, bus) \ |
---|
408 | SYSINIT_MODULE_REFERENCE(driver ## _ ## bus) |
---|
409 | #endif /* __rtems__ */ |
---|
410 | ---- |
---|
411 | |
---|
412 | Here you see that the SYSINIT(9) entries are no longer static. The |
---|
413 | *_REFERENCE() macros will create references to the corresponding modules which |
---|
414 | are later resolved by the linker. The application has to provide an object |
---|
415 | file with references to all required FreeBSD modules. |
---|
416 | |
---|
417 | The FreeBSD device model is quite elaborated (with follow-ups): |
---|
418 | |
---|
419 | http://www.freebsd.org/cgi/man.cgi?query=driver |
---|
420 | |
---|
421 | The devices form a tree with the Nexus device at a high-level. This Nexus |
---|
422 | device is architecture specific in FreeBSD. In RTEMS we have our own Nexus |
---|
423 | device, see "rtems-bsd-nexus.c". It uses a table to add child devices: |
---|
424 | |
---|
425 | [listing] |
---|
426 | ---- |
---|
427 | const char *const _bsd_nexus_devices [] = { |
---|
428 | #ifdef NEED_USB_OHCI |
---|
429 | "ohci", |
---|
430 | #endif |
---|
431 | #ifdef NEED_USB_EHCI |
---|
432 | "ehci", |
---|
433 | #endif |
---|
434 | #ifdef NEED_SDHC |
---|
435 | "sdhci", |
---|
436 | #endif |
---|
437 | NULL |
---|
438 | }; |
---|
439 | ---- |
---|
440 | |
---|
441 | This table must be provided by the application. |
---|
442 | |
---|
443 | === SYSCTL_NODE Example |
---|
444 | |
---|
445 | During development, we had an undefined reference to |
---|
446 | _bsd_sysctl__net_children that we had trouble tracking down. Thanks to |
---|
447 | Chris Johns, we located it. He explained how to read SYSCTL_NODE |
---|
448 | definitions. This line from freebsd/netinet/in_proto.c is attempting |
---|
449 | to add the "inet" node to the parent node "_net". |
---|
450 | |
---|
451 | [listing] |
---|
452 | ---- |
---|
453 | SYSCTL_NODE(_net, PF_INET, inet, CTLFLAG_RW, 0, |
---|
454 | "Internet Family"); |
---|
455 | ---- |
---|
456 | |
---|
457 | Our problem was that we could not find where _bsd_sysctl__net_children |
---|
458 | was defined. Chris suggested that when in doubt compile with -save-temps |
---|
459 | and look at the preprocessed .i files. But he did not need that. He |
---|
460 | explained that this the symbol name _bsd_sysctl__net_children was |
---|
461 | automatically generated by a SYSCTL_NODE as follows: |
---|
462 | |
---|
463 | * _bsd_ - added by RTEMS modifications to SYSCTL_NODE macro |
---|
464 | * sysctl_ - boilerplace added by SYSCTL_NODE macro |
---|
465 | * "" - empty string for parent node |
---|
466 | * net - name of SYSCTL_NODE |
---|
467 | * children - added by SYSCTL macros |
---|
468 | |
---|
469 | This was all generated by a support macro declaring the node as this: |
---|
470 | |
---|
471 | [listing] |
---|
472 | ---- |
---|
473 | struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name); |
---|
474 | ---- |
---|
475 | |
---|
476 | Given this information, we located this SYSCTL_NODE declaration in |
---|
477 | kern/kern_mib.c |
---|
478 | |
---|
479 | [listing] |
---|
480 | ---- |
---|
481 | SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0, |
---|
482 | "High kernel, proc, limits &c"); |
---|
483 | ---- |
---|
484 | |
---|
485 | == Core FreeBSD APIs and RTEMS Replacements == |
---|
486 | |
---|
487 | === SX(9) (Shared/exclusive locks) === |
---|
488 | |
---|
489 | http://www.freebsd.org/cgi/man.cgi?query=sx |
---|
490 | |
---|
491 | Binary semaphores (this neglects the ability to allow shared access). |
---|
492 | |
---|
493 | === MUTEX(9) (Mutual exclusion) === |
---|
494 | |
---|
495 | http://www.freebsd.org/cgi/man.cgi?query=mutex |
---|
496 | |
---|
497 | Binary semaphores (not recursive mutexes are not supported this way). |
---|
498 | |
---|
499 | === RWLOCK(9) (Reader/writer lock) === |
---|
500 | |
---|
501 | http://www.freebsd.org/cgi/man.cgi?query=rwlock |
---|
502 | |
---|
503 | POSIX r/w lock. |
---|
504 | |
---|
505 | === RMLOCK(9) (Reader/writer lock optimized for mostly read access patterns) === |
---|
506 | |
---|
507 | Note: This object was implemented as a wrapper for RWLOCK in the rm_lock header file. |
---|
508 | |
---|
509 | http://www.freebsd.org/cgi/man.cgi?query=rmlock |
---|
510 | |
---|
511 | POSIX r/w lock. |
---|
512 | |
---|
513 | === CONDVAR(9) (Condition variables) === |
---|
514 | |
---|
515 | http://www.freebsd.org/cgi/man.cgi?query=condvar |
---|
516 | |
---|
517 | POSIX condition variables with modifications (hack). |
---|
518 | |
---|
519 | === CALLOUT(9) (Timer functions) === |
---|
520 | |
---|
521 | http://www.freebsd.org/cgi/man.cgi?query=callout |
---|
522 | |
---|
523 | Timer server. |
---|
524 | |
---|
525 | === TASKQUEUE(9) (Asynchronous task execution) === |
---|
526 | |
---|
527 | http://www.freebsd.org/cgi/man.cgi?query=taskqueue |
---|
528 | |
---|
529 | TBD. |
---|
530 | |
---|
531 | === KTHREAD(9), KPROC(9) (Tasks) === |
---|
532 | |
---|
533 | http://www.freebsd.org/cgi/man.cgi?query=kthread |
---|
534 | |
---|
535 | http://www.freebsd.org/cgi/man.cgi?query=kproc |
---|
536 | |
---|
537 | Tasks. |
---|
538 | |
---|
539 | === ZONE(9) (Zone allocator) === |
---|
540 | |
---|
541 | http://www.freebsd.org/cgi/man.cgi?query=zone |
---|
542 | |
---|
543 | TBD. |
---|
544 | |
---|
545 | === devfs (Device file system) === |
---|
546 | |
---|
547 | Dummy, IMFS or new implementation (currently dummy). |
---|
548 | |
---|
549 | === psignal (Signals) === |
---|
550 | |
---|
551 | TBD. Seems to be not needed. |
---|
552 | |
---|
553 | === poll, select === |
---|
554 | |
---|
555 | TBD. Seems to be not needed. |
---|
556 | |
---|
557 | === RMAN(9) (Resource management) === |
---|
558 | |
---|
559 | http://www.freebsd.org/cgi/man.cgi?query=rman |
---|
560 | |
---|
561 | TBD. Seems to be not needed. |
---|
562 | |
---|
563 | === DEVCLASS(9), DEVICE(9), DRIVER(9), MAKE_DEV(9) (Device management) === |
---|
564 | |
---|
565 | http://www.freebsd.org/cgi/man.cgi?query=devclass |
---|
566 | |
---|
567 | http://www.freebsd.org/cgi/man.cgi?query=device |
---|
568 | |
---|
569 | http://www.freebsd.org/cgi/man.cgi?query=driver |
---|
570 | |
---|
571 | http://www.freebsd.org/cgi/man.cgi?query=make_dev |
---|
572 | |
---|
573 | Use FreeBSD implementation as far as possible. FreeBSD has a nice API for |
---|
574 | dynamic device handling. It may be interesting for RTEMS to use this API |
---|
575 | internally in the future. |
---|
576 | |
---|
577 | === BUS_SPACE(9), BUS_DMA(9) (Bus and DMA access) === |
---|
578 | |
---|
579 | http://www.freebsd.org/cgi/man.cgi?query=bus_space |
---|
580 | |
---|
581 | http://www.freebsd.org/cgi/man.cgi?query=bus_dma |
---|
582 | |
---|
583 | Likely BSP dependent. A default implementation for memory mapped linear access |
---|
584 | is easy to provide. The current heap implementation supports all properties |
---|
585 | demanded by bus_dma (including the boundary constraint). |
---|
586 | |
---|
587 | == RTEMS Replacements by File Description == |
---|
588 | |
---|
589 | Note: Files with a status of USB are used by the USB test and have at least |
---|
590 | been partially tested. If they contain both USB and Nic, then they are used |
---|
591 | by both and MAY contain methods that have not been tested yet. Files that |
---|
592 | are only used by the Nic test are the most suspect. |
---|
593 | |
---|
594 | [listing] |
---|
595 | ---- |
---|
596 | rtems-libbsd File: rtems-bsd-assert.c |
---|
597 | FreeBSD File: rtems-bsd-config.h redefines BSD_ASSERT. |
---|
598 | Description: This file contains the support method rtems_bsd_assert_func(). |
---|
599 | Status: USB, Nic |
---|
600 | |
---|
601 | rtems-libbsd File: rtems-bsd-autoconf.c |
---|
602 | FreeBSD File: FreeBSD has BSP specific autoconf.c |
---|
603 | Description: This file contains configuration methods that are used to setup the system. |
---|
604 | Status: USB |
---|
605 | |
---|
606 | rtems-libbsd File: rtems-bsd-bus-dma.c |
---|
607 | FreeBSD File: FreeBSD has BSP specific busdma_machdep.c |
---|
608 | Description: |
---|
609 | Status: USB, Nic |
---|
610 | |
---|
611 | rtems-libbsd File: rtems-bsd-bus-dma-mbuf.c |
---|
612 | FreeBSD File: FreeBSD has BSP specific busdma_machdep.c |
---|
613 | Description: |
---|
614 | Status: Nic |
---|
615 | |
---|
616 | rtems-libbsd File: rtems-bsd-callout.c |
---|
617 | FreeBSD File: kern/kern_timeout.c |
---|
618 | Description: |
---|
619 | Status: USB, Nic |
---|
620 | |
---|
621 | rtems-libbsd File: rtems-bsd-cam.c |
---|
622 | FreeBSD File: cam/cam_sim.c |
---|
623 | Description: |
---|
624 | Status: USB |
---|
625 | |
---|
626 | rtems-libbsd File: rtems-bsd-condvar.c |
---|
627 | FreeBSD File: kern/kern_condvar.c |
---|
628 | Description: |
---|
629 | Status: USB |
---|
630 | |
---|
631 | rtems-libbsd File: rtems-bsd-copyinout.c |
---|
632 | FreeBSD File: bsp specific copyinout.c ) |
---|
633 | Description: Note: The FreeBSD file is split with some methods being in rtems-bsd-support |
---|
634 | Status: Nic |
---|
635 | |
---|
636 | rtems-libbsd File: rtems-bsd-delay.c |
---|
637 | FreeBSD File: bsp specific file with multiple names |
---|
638 | Description: |
---|
639 | Status: USB, Nic |
---|
640 | |
---|
641 | rtems-libbsd File: rtems-bsd-descrip.c |
---|
642 | FreeBSD File: kern/kern_descrip.c |
---|
643 | Description: |
---|
644 | Status: Nic |
---|
645 | |
---|
646 | rtems-libbsd File: rtems-bsd-generic.c |
---|
647 | FreeBSD File: kern/sys_generic.c |
---|
648 | Description: |
---|
649 | Status: Nic |
---|
650 | |
---|
651 | rtems-libbsd File: rtems-bsd-init.c |
---|
652 | FreeBSD File: N/A |
---|
653 | Description: |
---|
654 | Status: USB, Nic |
---|
655 | |
---|
656 | rtems-libbsd File: rtems-bsd-init-with-irq.c |
---|
657 | FreeBSD File: N/A |
---|
658 | Description: |
---|
659 | Status: USB, Nic |
---|
660 | |
---|
661 | rtems-libbsd File: rtems-bsd-jail.c |
---|
662 | FreeBSD File: kern/kern_jail.c |
---|
663 | Description: |
---|
664 | Status: USB, Nic |
---|
665 | |
---|
666 | rtems-libbsd File: rtems-bsd-lock.c |
---|
667 | FreeBSD File: kern/subr_lock.c |
---|
668 | Description: |
---|
669 | Status: USB, Nic |
---|
670 | |
---|
671 | rtems-libbsd File: rtems-bsd-log.c |
---|
672 | FreeBSD File: kern/subr_prf.c |
---|
673 | Description: |
---|
674 | Status: Nic |
---|
675 | |
---|
676 | rtems-libbsd File: rtems-bsd-malloc.c |
---|
677 | FreeBSD File: kern/kern_malloc.c |
---|
678 | Description: |
---|
679 | Status: USB, Nic |
---|
680 | |
---|
681 | rtems-libbsd File: rtems-bsd-mutex.c |
---|
682 | FreeBSD File: kern/kern_mutex.c |
---|
683 | Description: |
---|
684 | Status: USB, Nic |
---|
685 | |
---|
686 | rtems-libbsd File: rtems-bsd-newproc.c |
---|
687 | FreeBSD File: N/A |
---|
688 | Description: |
---|
689 | Status: Nic |
---|
690 | |
---|
691 | rtems-libbsd File: rtems-bsd-nexus.c |
---|
692 | FreeBSD File: bsp specific nexus.c |
---|
693 | Description: |
---|
694 | Status: USB |
---|
695 | |
---|
696 | rtems-libbsd File: rtems-bsd-panic.c |
---|
697 | FreeBSD File: boot/common/panic.c |
---|
698 | Description: |
---|
699 | Status: USB, Nic |
---|
700 | |
---|
701 | rtems-libbsd File: rtems-bsd-rwlock.c |
---|
702 | FreeBSD File: kern_rwlock.c |
---|
703 | Description: |
---|
704 | Status: USB, Nic |
---|
705 | |
---|
706 | rtems-libbsd File: rtems-bsd-shell.c |
---|
707 | FreeBSD File: N/A |
---|
708 | Description: |
---|
709 | Status: USB |
---|
710 | |
---|
711 | rtems-libbsd File: rtems-bsd-signal.c |
---|
712 | FreeBSD File: kern/kern_sig.c |
---|
713 | Description: |
---|
714 | Status: Nic |
---|
715 | |
---|
716 | rtems-libbsd File: rtems-bsd-smp.c |
---|
717 | FreeBSD File: N/A |
---|
718 | Description: |
---|
719 | Status: Nic |
---|
720 | |
---|
721 | rtems-libbsd File: rtems-bsd-support.c |
---|
722 | FreeBSD File: bsp specific copyinout.c |
---|
723 | Description: Note: the FreeBSD file is split with some methods being in rtems-bsd-copyinout. |
---|
724 | Status: USB, Nic |
---|
725 | |
---|
726 | rtems-libbsd File: rtems-bsd-sx.c |
---|
727 | FreeBSD File: kern/kern_sx.c |
---|
728 | Description: Status: USB, Nic |
---|
729 | |
---|
730 | rtems-libbsd File: rtems-bsd-synch.c |
---|
731 | FreeBSD File: kern/kern_synch.c |
---|
732 | Description: |
---|
733 | Status: USB, Nic |
---|
734 | |
---|
735 | rtems-libbsd File: rtems-bsd-syscalls.c |
---|
736 | FreeBSD File: User API for kern/uipc_syscalls.c |
---|
737 | Description: |
---|
738 | Status: Nic |
---|
739 | |
---|
740 | rtems-libbsd File: rtems-bsd-sysctlbyname.c |
---|
741 | FreeBSD File: User API for sysctlbyname(3) |
---|
742 | Description: |
---|
743 | Status: |
---|
744 | |
---|
745 | rtems-libbsd File: rtems-bsd-sysctl.c |
---|
746 | FreeBSD File: User API for sysctl(8) |
---|
747 | Description: |
---|
748 | Status: |
---|
749 | |
---|
750 | rtems-libbsd File: rtems-bsd-sysctlnametomib.c |
---|
751 | FreeBSD File: User API for sysctlnametomib |
---|
752 | Description: |
---|
753 | Status: |
---|
754 | |
---|
755 | rtems-libbsd File: rtems-bsd-taskqueue.c |
---|
756 | FreeBSD File: kern/subr_taskqueue.c |
---|
757 | Description: |
---|
758 | Status: Nic |
---|
759 | |
---|
760 | rtems-libbsd File: rtems-bsd-thread.c |
---|
761 | FreeBSD File: kern/kern_kthread.c |
---|
762 | Description: |
---|
763 | Status: USB, Nic |
---|
764 | |
---|
765 | rtems-libbsd File: rtems-bsd-timeout.c |
---|
766 | FreeBSD File: kern/kern_timeout.c |
---|
767 | Description: |
---|
768 | Status: Nic |
---|
769 | |
---|
770 | rtems-libbsd File: rtems-bsd-timesupport.c |
---|
771 | FreeBSD File: kern/kern_clock.c |
---|
772 | Description: |
---|
773 | Status: Nic |
---|
774 | |
---|
775 | rtems-libbsd File: rtems-bsd-vm_glue.c |
---|
776 | FreeBSD File: vm/vm_glue.c |
---|
777 | Description: |
---|
778 | Status: USB, Nic |
---|
779 | ---- |
---|
780 | |
---|
781 | == Notes by File == |
---|
782 | |
---|
783 | altq_subr.c - Arbitrary choices were made in this file that RTEMS would |
---|
784 | not support tsc frequency change. Additionally, the clock frequency |
---|
785 | for machclk_freq is always measured for RTEMS. |
---|
786 | |
---|
787 | conf.h - In order to add make_dev and destroy_dev, variables in the cdev |
---|
788 | structure that were not being used were conditionally compiled out. The |
---|
789 | capability of supporting children did not appear to be needed and was |
---|
790 | not implemented in the rtems version of these routines. |
---|
791 | |
---|
792 | == NICs Status == |
---|
793 | |
---|
794 | [listing] |
---|
795 | ---- |
---|
796 | Driver Symbol Status |
---|
797 | ====== ====== ====== |
---|
798 | RealTek _bsd_re_pcimodule_sys_init Links |
---|
799 | EtherExpress _bsd_fxp_pcimodule_sys_init Links |
---|
800 | DEC tulip _bsd_dc_pcimodule_sys_init Links |
---|
801 | Broadcom BCM57xxx _bsd_bce_pcimodule_sys_init Links |
---|
802 | Broadcom BCM4401 _bsd_bfe_pcimodule_sys_init Links |
---|
803 | Broadcom BCM570x _bsd_bge_pcimodule_sys_init Needs Symbols (A) |
---|
804 | E1000 IGB _bsd_igb_pcimodule_sys_init Links |
---|
805 | E1000 EM _bsd_em_pcimodule_sys_init Links |
---|
806 | ---- |
---|
807 | |
---|
808 | |
---|
809 | Symbols (A) |
---|
810 | pci_get_vpd_ident |
---|
811 | |
---|
812 | == Problems to report to FreeBSD == |
---|
813 | |
---|
814 | The MMAP_NOT_AVAILABLE define is inverted on its usage. When it is |
---|
815 | defined the mmap method is called. Additionally, it is not used |
---|
816 | thoroughly. It is not used in the unmap portion of the source. |
---|
817 | The file rec_open.c uses the define MMAP_NOT_AVAILABLE to wrap |
---|
818 | the call to mmap and file rec_close.c uses the munmap method. |
---|
819 | |
---|
820 | |
---|
821 | |
---|