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