path: root/sys/tools
Commit message (Collapse)AuthorAgeFilesLines
* syscalls.master: Add a new syscall type: RESERVEDBrooks Davis2021-01-261-8/+15
| | | | | | | | | RESERVED syscall number are reserved for local/vendor use. RESERVED is identical to UNIMPL except that comments are ignored. Reviewed by: kevans Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27988
* Switch to the new device-tree vendor treeEmmanuel Vadot2021-01-152-6/+4
| | | | | | | | | | | | | The old vendor tree was never fully merged and doing partial merge isn't supported with git subtree merge so a new one was created. Switch the build to use the new DTS from sys/contrib/device-tree This also bump the DTS used to be in sync with Linux 5.9 While here change the way to get the linux version, simply hardcode the value in sys/dts/freebsd-compatible.dts and use awk to get that to put it in the CFLAGS. As a bonus we now have the bindings docs available in sys/contrib/device-tree/Bindings/ so no need to link to the Linux repo or to the vendor tree.
* sys/tools: Add a tool for generating arm and arm64 kernel images.Michal Meloun2020-12-301-0/+190
| | | | | | | | This tool can generate kernel images without changing the offsets in the final executable. It replaces the ELF header by properly sized zeroed block then emits a relative jump to _start(for 'v7jump' or 'v8jump' option) or the booti header (for 'v8booti' option) to the beginning of the converted file. Submited by: ian
* Use a template assembly file for firmware object files.John Baldwin2020-12-171-2/+2
| | | | | | | | | | | | | | | | | | | | | Similar to r366897, this uses the .incbin directive to pull in a firmware file's contents into a .fwo file. The same scheme for computing symbol names from the filename is used as before to maximize compatiblity and not require rebuilding existing .fwo files for NO_CLEAN builds. Using ld -o binary requires extra hacks in linkers to either specify ABI options (e.g. soft- vs hard-float) or to ignore ABI incompatiblities when linking certain objects (e.g. object files with only data). Using the compiler driver avoids the need for these hacks as the compiler driver is able to set all the appropriate ABI options. Reviewed by: imp, markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27579 Notes: svn path=/head/; revision=368739
* Brand our DTS with the Linux version it was imported fromEmmanuel Vadot2020-10-101-1/+3
| | | | | | | | | | | | DTS must be synced with the kernel, add a freebsd,dts-version string in the root node of each DTS that we compile so we can later in the kernel check that it contain a correct value. Reviewed by: imp, mmel Differential Revision: https://reviews.freebsd.org/D26724 Notes: svn path=/head/; revision=366599
* Make makesyscalls.lua initialize 'struct sysent' entries using c99Edward Tomasz Napierala2020-09-251-10/+17
| | | | | | | | | | | | designated initializers. This makes it easier to modify 'struct sysent' layout. Reviewed by: kevans Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26530 Notes: svn path=/head/; revision=366145
* Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions.Michal Meloun2020-09-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | One problem with the bus_space_read_N() and bus_space_write_N() family of functions is that they provide no protection against exceptions which can occur when no physical hardware or device responds to the read or write cycles. In such a situation, the system typically would panic due to a kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() family of functions provide a mechanism to handle these exceptions gracefully without the risk of crashing the system. Typical example is access to PCI(e) configuration space in bus enumeration function on badly implemented PCI(e) root complexes (RK3399 or Neoverse N1 N1SDP and/or access to PCI(e) register when device is in deep sleep state. This commit adds a real implementation for arm64 only. The remaining architectures have bus_space_peek()/bus_space_poke() emulated by using bus_space_read()/bus_space_write() (without exception handling). MFC after: 1 month Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D25371 Notes: svn path=/head/; revision=365899
* makesyscalls.lua: improve syscall ordering validationKyle Evans2020-08-041-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two separate issues here: 1.) #if/#else wasn't taken into account at all for maxsyscall figures, but 2.) We didn't validate contiguous syscall numbers anyways... This kind of inconsistency is bad as we don't currently ensure explicit indexing of, e.g., the sysent array if one syscall is unimplemented/missing. This could be fixed and might be more robust, but it's also good to have the "documentation" that comes from being explicit as to what the missing syscalls are. The new version looks much like the awk version; stash off the current 'last highest syscall seen' if we hit an #if, restore to that if we hit an #else, and make sure that we're explicitly always defining the next syscall. The logic at the tail end of process_syscall_def that moves maxsyscall has been 'cleaned up' a little since we're now ensuring that it's monotonically increasing earlier in the function. At the moment I think it's unlikely we'd see range-definitions that are not UNIMPL, but there's no reason to specifically handle that case for bumping maxsyscall there. This change was provoked by reading the commit message for r363832 and realizing that this validation hadn't been included in the initial rewrite to lua. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D25945 Notes: svn path=/head/; revision=363869
* vfs: inline vops if there are no pre/post associated callsMateusz Guzik2020-07-301-1/+42
| | | | | | | | | | This removes a level of indirection from frequently used methods, most notably VOP_LOCK1 and VOP_UNLOCK1. Tested by: pho Notes: svn path=/head/; revision=363708
* vfs: stop null checking routines in vop wrappersMateusz Guzik2020-01-261-5/+7
| | | | | | | | | | | Calls to vop_bypass pass the same argument, but type casted to something else. Thus by replacing NULL routines with vop_bypass we avoid a runtime check. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23357 Notes: svn path=/head/; revision=357131
* Add a 'SINGLETON' directive to kobj interface definitionJustin Hibbits2020-01-181-1/+9
| | | | | | | | | | | | | | | | Summary: This makes the interface described in the definition file act like a pseudo-IFUNC service, by caching the found method locally. Applying this to the PowerPC MMU definitions, it yields a significant (15-20%) performance improvement, seen in both a 'make buildworld' and a parallel build of LLVM, on a POWER9 system. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D23245 Notes: svn path=/head/; revision=356860
* makesyscalls.lua: generate all files in /tmp, write into place at the endKyle Evans2020-01-101-13/+23
| | | | | | | | | | | | | | | | This makes makesyscalls.lua more parallel-friendly, or at least not as hostile to the idea. We get into situations where we're running parallel if we end up with MAKE_JOBS>1 entering any of the sysent targets, since each output file is recognized a distinct build step that needs to be executed. Another commit will add some .ORDER to further improve the situation. Reported by: jhb Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D23098 Notes: svn path=/head/; revision=356603
* vfs: allow tail call optimisation in vops in the common caseMateusz Guzik2019-12-161-7/+11
| | | | | | | | | | | | | | | Most frequently used vops boil down to checking SDT probes, doing the call and checking again. There is no vop_post/pre in their case but the check after the call prevents tail call optimisation from taking place. Instead, check once upfront. Kernels with debug or vops with non-empty vop_post still don't short circuit. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D22739 Notes: svn path=/head/; revision=355791
* vfs: flatten vop vectorsMateusz Guzik2019-12-161-5/+38
| | | | | | | | | | | | | | | This eliminates the following loop from all VOP calls: while(vop != NULL && \ vop->vop_spare2 == NULL && vop->vop_bypass == NULL) vop = vop->vop_default; Reviewed by: jeff Tesetd by: pho Differential Revision: https://reviews.freebsd.org/D22738 Notes: svn path=/head/; revision=355790
* makesyscalls.lua: trim trailing spaces/commas from argsKyle Evans2019-12-111-0/+1
| | | | | | | | | | | | | These are insignificant as far as declarations go, and we've historically allowed it. fhlinkat in ^/sys/kern/syscalls.master, for example, currently has a trailing comma after its final argument that this version of makesyscalls is ignoring (not by conscious decision). Fix it for now by actively stripping off trailing whitespace/commas until we decide to actively prohibit it. Notes: svn path=/head/; revision=355628
* makesyscalls.lua: improve config processingKyle Evans2019-12-061-8/+45
| | | | | | | | | | | | | | | | | | | The current version will strip out #include directives appearing inside strings, which is clearly wrong. Improve the processing entirely in the following ways: - Strip only whole-line comments on every single iteration - Abort if we see a malformed line that doesn't match the key=value format - For quoted (backtick or double quote) strings, we'll advance to the end of the key=value pair and make sure there's not extra stuff left over - For unquoted key=value pairs, we'll strip any trailing comments and verify there's no internal whitespace This has revealed the caveat that key/value pairs can't even include escaped quotes (and haven't been able to). I don't know if this is actually problematic, as we're usually looking at cases like "#include <foo>" or raw identifiers.The current version will strip out #include directives appearing inside strings, which is clearly wrong. Improve the processing entirely in the following ways: Reviewed and noticed by: brooks Differential Revision: https://reviews.freebsd.org/D22698 Notes: svn path=/head/; revision=355468
* Add makesyscalls.lua, a rewrite of makesyscalls.shKyle Evans2019-11-171-0/+1322
| | | | | | | | | | | | | | | | | | | | | This currently requires a suitable lua + luafilesystem + luaposix from the ports tree to build. Discussion is underway in D21893 to add a suitable lua to the base system, cleverly disguised and out of the way of normal consumers. makesyscalls.sh is a good target for rewrite into lua as it's currently a sh+sed+awk script that can be difficult to add on to, at times. For instance, adding a new COMPAT* option (that mimicks the behaivor of most other COMPAT* options) requires a fairly substantial amount of copy/paste; see r352693 for instance. Attempts to generate part of the awk script for COMPAT* handling was (very kindly) rejected with a desire to just rewrite the script in a single language that can handle all of it. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D21775 Notes: svn path=/head/; revision=354786
* fw_stub.awk: use @generated tag in generated filesEd Maste2019-09-111-1/+3
| | | | | | | | | | Multiple tools use @generated to identify generated files (for example, in a review Phabricator will by default hide diffs in enerated files). Use the @generated tag in makesyscalls.sh as we've done for other generated files. Notes: svn path=/head/; revision=352213
* Add SDIO support.Bjoern A. Zeeb2019-06-081-0/+265
| | | | | | | | | | | | | | | | | | | | Add a CAM-Newbus SDIO support module. This works provides a newbus infrastructure for device drivers wanting to use SDIO. On the lower end while it is connected by newbus to SDHCI, it talks CAM using the MMCCAM framework to get to it. This also duplicates the usbdevs framework to equally create sdiodev header files with #defines for "vendors" and "products". Submitted by: kibab (initial work, see https://reviews.freebsd.org/D12467) Reviewed by: kibab, imp (comments on earlier version) MFC after: 6 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19749 Notes: svn path=/head/; revision=348805
* Avoid literal @generated tag in file-generating scriptsEd Maste2019-05-082-2/+8
| | | | | | | | | | | We don't want the generator itself tagged as a generated file. Reviewed by: cem Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20182 Notes: svn path=/head/; revision=347328
* Use @generated tag in generated filesEd Maste2019-05-072-2/+2
| | | | | | | | | | | | Multiple tools use @generated to identify generated files (for example, in a review Phabricator will by default hide diffs in generated files). Use the @generated tag in makeobjops.awk and vnode_if.awk as we've done for other generated files. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=347224
* make_dtb.sh: Use $CPP instead of assuming that cpp is in $PATHAlex Richardson2018-12-142-10/+12
| | | | | | | | | | | | | This fixes building in CheriBSD with a strict tmp path since we don't bootstrap a cpp but pass the full path to clang-cpp instead. While touching this file also fix all shellcheck warnings in make_dtb.sh. Reviewed By: manu Differential Revision: https://reviews.freebsd.org/D18376 Notes: svn path=/head/; revision=342105
* Use ${ECHO} in dtb/dtbo build, pass in from dtb.mk for -sKyle Evans2018-11-092-2/+4
| | | | | | | | Reported by: sbruno MFC after: 3 days Notes: svn path=/head/; revision=340297
* embed_mfs.sh: replace some compound statements with conventional ifsEd Maste2018-11-021-3/+12
| | | | | | | Use the more readable form - there's no need to try being clever. Notes: svn path=/head/; revision=340082
* Only call sigdeferstop() for NFS.Konstantin Belousov2018-10-231-2/+3
| | | | | | | | | | | | | | | | | | | | Use bypass to catch any NFS VOP dispatch and route it through the wrapper which does sigdeferstop() and then dispatches original VOP. NFS does not need a bypass below it, which is not supported. The vop offset in the vop_vector is added since otherwise it is impossible to get vop_op_t from the internal table, and I did not wanted to create the layered fs only to wrap NFS VOPs. VFS_OP()s wrap is straightforward. Requested and reviewed by: mjg (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D17658 Notes: svn path=/head/; revision=339672
* make_dtb: Always add root directory in the include pathEmmanuel Vadot2018-08-231-2/+2
| | | | | | | | Some arch like arm and arm64 share DTS files, add the root dts directory to the include paths. Notes: svn path=/head/; revision=338246
* Add dtb overlays supportEmmanuel Vadot2018-03-241-0/+26
| | | | | | | | | | | | | | | | | | | | | | DTB Overlays are useful to change/add nodes to a dtb without the need to modify it. Add support for building dtbo during buildkernel. The goal of DTBO present in the FreeBSD source tree is to fill a gap in time when we submit changes upstream (Linux). Instead of waiting 2 to 4 months we can add a DTBO in tree in the meantime. This is not for adding DTBO for capes/hat/addon boards, those will be better to put in a ports. This is also not for enabling a i2c/spi/pwm controller on certain pins, each user have a different use case for those (which pins to use etc ...) and we cannot have all possible configuration. Add a dtbo for sun8i-h3-sid which add the SID node missing in upstream dts. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D14782 Notes: svn path=/head/; revision=331499
* Avoid using \$. It's an unknown escape sequence. Some awks warn aboutWarner Losh2018-01-281-8/+0
| | | | | | | | that. Instead, simply remove the sequence entirely because we never commit the generated files. Notes: svn path=/head/; revision=328507
* embed_mfs: correctly test grep return valueEd Maste2018-01-031-1/+1
| | | | | | | | | Reported by: br MFC with: r326992 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=327526
* Teach makeobjops.awk to accept PROLOG and EPILOG blocks beforeColin Percival2017-12-311-3/+21
| | | | | | | | | | | METHOD and STATICMETHOD declarations; that code will be inserted into the dispatch function before and after the method call. Use this functionality and the TSLOG framework to record DEVICE_ATTACH and DEVICE_PROBE entry/exit timestamps. Notes: svn path=/head/; revision=327428
* embed_mfs: support embedding mfs into loaderEd Maste2017-12-191-9/+32
| | | | | | | | | | | | | | | | | | The script originally supported embedding an mfs into ELF files or any other type of file, because it searched for magic strings to mark the beginning and end of the embeddable section. It was later modified to read the section offset and length via readelf, which made it work for ELF only. Restore the ability to update arbitrary file types by using the readelf technique for ELF, and the magic string technique for all others (including PE/COFF files like loader.efi). Submitted by: Zakary Nafziger <worldofzak@gmail.com> MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12746 Notes: svn path=/head/; revision=326992
* sys: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2711-0/+22
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326272
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-202-0/+4
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* Move sys/boot/fdt/dts to sys/dts and adjust scripts.Warner Losh2017-11-141-2/+2
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325826
* embed_mfs: add error handling, usageEd Maste2017-10-171-1/+10
| | | | | | | | | | | | Ensure that we are called with two arguments, and that the output file is writable. Also, if we cannot find the mfs section report the output file name rather than "kernel", as this script may be used with other than kernels. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=324707
* make.conf: Add the possibility to use another DTCEmmanuel Vadot2017-06-171-1/+3
| | | | | | | | | | | Add a make.conf DTC variable that control which DTC (Device Tree Compiler) to use. Reviewed by: bdrewery, imp Differential Revision: https://reviews.freebsd.org/D9577 Notes: svn path=/head/; revision=320064
* Declare the "snd_fxdiv_table" once. This shaves around 24Kbytes ofHans Petter Selasky2017-05-251-2/+5
| | | | | | | | | binary data from sound.ko and the kernel. MFC after: 3 days Notes: svn path=/head/; revision=318860
* Increase the allowed maximum number of audio channels from 31 to 127Hans Petter Selasky2017-05-241-3/+3
| | | | | | | | | | | | | in the PCM feeder mixer. Without this change a value of 32 channels is treated like zero, due to using a mask of 0x1f, causing a kernel assert when trying to playback bitperfect 32-channel audio. Also update the AWK script which is generating the division tables to handle more than 18 channels. This commit complements r282650. MFC after: 3 days Notes: svn path=/head/; revision=318820
* [fdt] Make DTBs generated by make_dtb.sh overlay-readyOleksandr Tymoshenko2017-03-101-1/+1
| | | | | | | | Generate symbols node when compiling dts files so they can be modified during boot-time by applying overlays. Notes: svn path=/head/; revision=315031
* Renumber copyright clause 4Warner Losh2017-02-282-2/+2
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Replace using of objdump with elfdumpLi-Wen Hsu2017-01-101-3/+3
| | | | | | | | | | | | | | | | | In-tree objdump is too old to dump new ELF headers. But for example if we use: `make CROSS_TOOLCHAIN=riscv64-gcc TARGET_ARCH=riscv64` and do not specify CROSS_BINUTILS_PREFIX in env, embed_mfs.sh cannot find the correct objdump. This patch just replaces using of objdump with elfdump to collect needed information. Later we may also put an ELFDUMP in CROSSENV and use it in embed_mfs.sh . Reviewed by: emaste, br MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D9062 Notes: svn path=/head/; revision=311881
* Consider CROSS_BINUTILS_PREFIX environment variable so we use correctRuslan Bukin2016-08-101-1/+1
| | | | | | | | | | objdump. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Notes: svn path=/head/; revision=303915
* Fix MFS builds when both MD_ROOT_SIZE and MFS_IMAGE are specifiedAdrian Chadd2016-02-021-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | MD_ROOT_SIZE and embed_mfs.sh were basically retired as part of https://reviews.freebsd.org/D2903 . However, when building a kernel with 'options MD_ROOT_SIZE' specified, this results in a non-working MFS, as within sys/dev/md/md.c we fall within the wrong # ifdef. This patch implements the following: * Allow kernels to be built without the MD_ROOT_SIZE option, which results in a kernel built as per D2903. * Allow kernels to be built with the MD_ROOT_SIZE option, which results in a kernel built similarly to the pre-D2903 way, with the following differences: * The MFS is now put in a separate section within the kernel (oldmfs, so it differs from the mfs section introduced by D2903). * embed_mfs.sh is changed, so it looks up the oldmfs section within the kernel, gets its size and offset, sees if the MFS will fit within the allocated oldmfs section and only if all is well does a dd of the MFS image into the kernel. Submitted by: Stanislav Galabov <sgalabov@gmail.com> Reviewed by: brooks, imp Differential Revision: https://reviews.freebsd.org/D5093 Notes: svn path=/head/; revision=295137
* Rename the /usr/share/doc/legal files to driver.LICENSE to work aroundBryan Drewery2015-10-161-1/+1
| | | | | | | | | | | | | | | | bug of installing 'realtek' and 'intel_iwn' as files rather then as a 'LICENSE' file in their directories. Also add obsolete entries for the older names and names that existed in head for a period of time. Suggested by: jmg X-MFC-With: r289391 MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289399
* save some bytes by using more concise SDT_PROBE<n> instead of SDT_PROBEAndriy Gapon2015-09-281-2/+2
| | | | | | | | | | | | SDT_PROBE requires 5 parameters whereas SDT_PROBE<n> requires n parameters where n is typically smaller than 5. Perhaps SDT_PROBE should be made a private implementation detail. MFC after: 20 days Notes: svn path=/head/; revision=288336
* Allow the make_dtb script to work outside of a "make buildkernel" contextIan Lepore2014-08-301-0/+4
| | | | | | | | | by setting MACHINE from uname -m if it's not set already. Reviewed by: imp, tuexen Notes: svn path=/head/; revision=270863
* Call cpp with -P to avoid printing line markings.Rui Paulo2014-06-101-1/+1
| | | | Notes: svn path=/head/; revision=267319
* Fix logic error. <blush>Warner Losh2014-04-301-1/+1
| | | | | | | Submitted by: ian@ Notes: svn path=/head/; revision=265163
* Turns out this .if evaluated not in the context of the makedtb targetWarner Losh2014-04-301-0/+5
| | | | | | | | sometimes due to Makefile expansion rules. Make the test for things being NULL elsewhere... Notes: svn path=/head/; revision=265162
* Allow FDT_DTS_FILE to be a list, either in the makedtb target, or in aWarner Losh2014-04-301-3/+7
| | | | | | | | | | kernel config file. If you also want to have a static DTB compiled into your kernel, however, it cannot be a list. We have no mechanism in the kernel for picking one, so that doesn't make sense and will result in a compile-time error. Notes: svn path=/head/; revision=265154