aboutsummaryrefslogtreecommitdiff
path: root/lib/libefivar
Commit message (Collapse)AuthorAgeFilesLines
* libefivar: define MDE_CPU_RISCV64Mitchell Horne2020-07-061-0/+2
| | | | | | | | The necessary definitions from EDK2 are present, so this allows the library to be built on RISC-V. Notes: svn path=/head/; revision=362972
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+1
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* Add additional sanity checks.Warner Losh2019-12-091-0/+9
| | | | Notes: svn path=/head/; revision=355546
* Regularize the Netflix copyrightWarner Losh2019-02-0410-9/+1
| | | | | | | | | | | | | | | Use recent best practices for Copyright form at the top of the license: 1. Remove all the All Rights Reserved clauses on our stuff. Where we piggybacked others, use a separate line to make things clear. 2. Use "Netflix, Inc." everywhere. 3. Use a single line for the copyright for grep friendliness. 4. Use date ranges in all places for our stuff. Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files) Notes: svn path=/head/; revision=343755
* Ensure that the device path is sane before trying to decode and printWarner Losh2018-10-261-1/+8
| | | | | | | | | it. Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=339799
* efivar(3): Fix some typos and improve styleMateusz Piotrowski2018-10-251-18/+40
| | | | | | | | | | | | | | | | | | | | - Fix some typos. - Remove redundant semicolons from the synopsis section. - Stylize variable names and types with Vt and Va respectively. - Use a list to present non-implemented functions. - Sort the order of the sections. - Add a history section. - Use Nm when "libefivar" is mentioned. PR: 232626 Reported by: Tiwei Bie <btw@mail.ustc.edu.cn> Reviewed by: bcr, imp Approved by: krion (mentor, implicit), mat (mentor, implicit) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D17686 Notes: svn path=/head/; revision=339729
* Add efidev(4)/efirt(9)Kyle Evans2018-08-171-0/+2
| | | | | | | | | | | | Document efidev(4), provider of userland access to EFI Runtime Services. A link is created to efirtc(4), which handles the time-of-day clock side. efirt(9) is the kernel side of this. Reviewed by: imp, kib (earlier version) Differential Revision: https://reviews.freebsd.org/D16696 Notes: svn path=/head/; revision=337957
* Fix an obvious 'is odd' check.Warner Losh2018-07-121-1/+1
| | | | | | | | | | | | | len % 1 is always true. Fix StrHexToBytes to do a proper odd length check. This was only called by DevPathFromTextGenericPath, ConvertFromTextVendor and DevPathFromTextMAC, which we've not had a need to actually use just yet. Submitted by: David Binderman PR: 229718 Notes: svn path=/head/; revision=336220
* libefivar: use standard 2-Clause FreeBSD licenseEd Maste2018-03-029-108/+108
| | | | | | | | Approved by: imp Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=330279
* Need to convert '/' back to '\' when creating a path. Ideally, thisWarner Losh2018-01-051-2/+7
| | | | | | | | | | | would be filesystem type dependent, but that's difficult to accomplish and it's unclear how the UEFI firmware will cope. Be conservative and make boot loaders cope instead. Sponsored by: Netflix Notes: svn path=/head/; revision=327575
* Set dp to NULL when we free it, and tree a NULL dp as an errorWarner Losh2018-01-051-0/+1
| | | | | | | | | | | condition. This should prevent a double free. In addition, prevent a leak by freeing dp each loop and when we're done. CID: 1383577 Sponsored by: Netflix Notes: svn path=/head/; revision=327574
* lib: Fix several typos and minor errorsEitan Adler2017-12-271-1/+1
| | | | | | | | | | | - duplicate words - typos - references to old versions of FreeBSD Reviewed by: imp, benno Notes: svn path=/head/; revision=327232
* Ensure that "out" is initialized in all error paths.Mark Johnston2017-12-071-1/+1
| | | | | | | | | Reported by: gcc Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D13402 Notes: svn path=/head/; revision=326658
* Create a function to translate UEFI paths to unix pathsWarner Losh2017-12-024-3/+733
| | | | | | | | | | | | | | | | | | | | efivar_device_path_to_unix_path translates from UEFI to Unix efivar_unix_path_to_device_path translates from Unix to UEFI At present, only HD() device types are supported (both GPT and MBR). CdRom and floppy devices aren't supported. ZFS isn't supported because there's no way in the UEFI standard to specify a ZFS datastore. Network devices aren't supported either. Three forms of Unix path are accepted: /path/to/file (for a mounted filesystem), //path/to/file (uses the EFI partition on the same disk as /), and dev:/path/to/file (for unmounted filesystem). Two forms are produced (the first and last). Sponsored by: Netflix Notes: svn path=/head/; revision=326458
* Add efidp_format_device_path_node to format a single node in a deviceWarner Losh2017-11-262-4/+24
| | | | | | | | | path, much like efidp_format_device_path will format the entire path. Sponsored by: Netflix Notes: svn path=/head/; revision=326231
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-141-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325834
* Simplify the efivar interface a little.Warner Losh2017-11-102-37/+4
| | | | | | | | | | | | | | | | | | | | We started out having Linux compatible libefivar interfaces. This was in anticipation of porting the GPL'd efibootmgr to FreeBSD via a port. However, since we need that functionality in the base, that port isn't going to happened. It also appears that efivar is a private library that's not used much outside a command line util and efibootmgr. Reduce compatibility with the Linux version a little by removing the mode parameter to efi_set_variable (which was unused on FreeBSD, and not set to something useful in the code we'd written). Also remove some efi error routines that were never implemented and existed only to placate early GPL efibootmgr porting experiments. Suggested by: Matt Williams Sponsored by: Netflix Notes: svn path=/head/; revision=325684
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Minor fixes to edge cases in efi_get_next_variable_nameWarner Losh2017-09-131-6/+15
| | | | | | | | | | | | | | | | Fix allocating more memory for the names (unlikely to be needed, but still best to get right) to ask for the length the kernel told use we needed, not the old length of the variable. Mind the proper NUL that we add in the space we allocate. Free the old name string before we allcoate a new one to limit what we leak to the last one (free passed in name for the last one in the list), and detect the last one by rv != 0 and errno == ENOENT, rather then just the former to avoid false positives if errno happens to be ENOENT on entry. Sponsored by: Netflix Notes: svn path=/head/; revision=323519
* Implement efidp_sizeWarner Losh2017-09-072-0/+8
| | | | | | | | | | | | efidp_size will return the size, in bytes, of a EFI device path structure. This is a convenience wrapper in the same style as the other linux routines. It's implemented by GetDevicePathSize from EDK2 we already needed for other things. Sponsored by: Netflix Notes: svn path=/head/; revision=323259
* libefivar: -fno-strict-aliasingRyan Libby2017-09-041-1/+1
| | | | | | | | | | | | | | Avoid dealing with some code that uses type-punned pointers. See D12210 and D12211 for more background. Reviewed by: imp Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12219 Notes: svn path=/head/; revision=323155
* Fix parsing File() nodes in device paths.Warner Losh2017-08-311-11/+8
| | | | | | | | | | | | | | | | | o Add File to the mUefiDevicePathLibDevPathFromTextTable table so we don't include 'File()' in the supposed path name. This happens because of a possible misfeature in the EDK2 code where any path that's not recognized is treated as a File() node. o Convert utf8 input into ucs2 output rather than just copying the utf8 and hoping for the best (no good comes from that). o Remove bogus comment about needing to add 1. The dummy array already is length 1, so that's included in sizeof the struct, so there's no need to add it. Sponsored by: Netflix Notes: svn path=/head/; revision=323057
* Fix printing File() nodes in device paths.Warner Losh2017-08-311-1/+6
| | | | | | | | | | | | Device paths encoded into the FILEPATH_DEVICE_PATH are UCS2 not ASCII/UTF8. Convert to utf8 and print that when printing File paths. Also, since File may be at the end of a long device path, output File() around the path so it doesn't just show up as random nodes that might accidentally match real node paths names and cause errors. Notes: svn path=/head/; revision=323056
* fix typoWarner Losh2017-07-241-1/+1
| | | | Notes: svn path=/head/; revision=321429
* Fix a coverity-discovered NULL pointer dereference.Warner Losh2017-03-231-6/+18
| | | | | | | | | | | | | | | | | | | | | | *** CID 1372598: Null pointer dereferences (FORWARD_NULL) /lib/libefivar/efivar-dp-parse.c: 3612 in UefiDevicePathLibConvertTextToDeviceNode() Dereferencing null pointer "FromText". When ported from Tiano core, I commented this out with an ifdef. That was in error because we're supposed to fallback to a filepath when nothing else patches. Instead, restore the original code, but fix DevPathFromTextFilePath to cope with the conversion to narrow strings. Also, fix the off-by-one error in the size of the memory it allocates. The off by one error is documented in Tiano core bug https://bugzilla.tianocore.org/show_bug.cgi?id=441 CID: 1372598 Sponsored by: Netflix Notes: svn path=/head/; revision=315771
* Define StrCmp in a funky was to be bug-compatible with EDK2 code.Warner Losh2017-03-231-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | Paper over a coverity issue: *** CID 1372592: API usage errors (BAD_COMPARE) /lib/libefivar/efivar-dp-parse.c: 2723 in DevPathFromTextiSCSI() Truncating the result of "strcmp" to "unsigned short" may cause it to be misinterpreted as 0. Note that "strcmp" may return an integer besides -1, 0, or 1. We do this by making StrCmp return either 0 or 1 for equal or not-equal. There's a bug in the DevPathFromTextiSCSI cast of the return value and this workaround will fix it without breaking other users of StrCmp (all of which test for == 0). https://bugzilla.tianocore.org/show_bug.cgi?id=440 has been filed upstream to log this issue. CID: 1372592 Sponsored by: Netflix Notes: svn path=/head/; revision=315770
* Bring in EDK2 routines for printing and parsing device paths.Warner Losh2017-03-0912-2/+7672
| | | | | | | | | | | | | | | | | | | This commit implements the (mostly?) Linux compatible efidp_format_device_path and efidp_parse_device_path APIs. These are the only APIs exposed through this library. However, they are built on code from Tianocore's EDK2 MdePkg. They are brought in as new files here for reasons described in FreeBSD-update. Symbol versioning will be introduced to control what's exported from the EDK2 code. Some structural changes may be necessary when we move to sharing with sys/boot/efi. Sponsored by: Netflix Notes: svn path=/head/; revision=314926
* Share UCS2/UTF8 routines between boot loader and userland.Warner Losh2017-03-094-230/+12
| | | | | | | | | | Move the UCS2 to UTF8 routines over into sys/boot/efi and have libefivar grab them from there. Sponsored by: Netflix Notes: svn path=/head/; revision=314925
* Make sure guid table is compiled before we use it.Warner Losh2017-03-031-0/+2
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=314623
* Only compile the known uuid table once.Warner Losh2017-03-031-0/+4
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=314616
* Move uuid_table definition to efivar.h.Warner Losh2017-03-032-6/+20
| | | | | | | | | Create new function efi_known_guid() to return list of guids. Sponsored by: Netflix Notes: svn path=/head/; revision=314615
* Don't convert ENOENT to nothing for individual lookup, just for theWarner Losh2017-02-251-4/+6
| | | | | | | | | | iterative get_next interface. This prevents efivar(3) from printing 4k of 0's when a variable isn't set. Sponsored by: Netflix Notes: svn path=/head/; revision=314231
* DIRDEPS_BUILD: Connect new dependencies.Bryan Drewery2016-11-131-0/+18
| | | | | | | | MFC after: 2 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=308605
* Fix building on i386 and arm. But 'public domain' headers on the filesWarner Losh2016-10-131-1/+1
| | | | | | | | | | | with no creative content. Include "lost" changes from git: o Use /dev/efi instead of /dev/efidev o Remove redundant NULL checks. Submitted by: kib@, dim@, zbb@, emaste@ Notes: svn path=/head/; revision=307189
* Create libefivar library. This library aims to provideWarner Losh2016-10-116-0/+875
the same API as the GPL'd version of this library. It implements the common Linux API for programatically manipulating UEFI environment varibales using the UEFI Runtime Services the kernel provides. It replaces the old efi library since it is programmed to a different interface, but retails the CHAR16 to UTF-8 and vice versa conversion routines. The new name is to match Linux program's expectations. Differential Revision: https://reviews.freebsd.org/D8128 Reviewed by: kib@, wblock@, Ganael Laplanche Notes: svn path=/head/; revision=307071