summaryrefslogtreecommitdiff
path: root/sys/boot/efi/libefi
Commit message (Collapse)AuthorAgeFilesLines
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-1418-4138/+0
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325834
* Install the 4th files in sys/boot/forth instead of each loaderWarner Losh2017-11-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Also, move generation of loader.help into loader.mk. Set HELP_FILES= to disable this (so we only install one help file, for now). At the same time remove some duplicate -I lines. Fix several FILES= and CLEANFILES= into the += form since we're touching both of those in the .mk files. Make sure we only build one loader.help file per platform in a unified way (we were building many on some, with the last to install winning, though often they were the same text). Also, we're now installing loader.rc and menu.rc everywhere. arm and mips uboot installed these as menu.rc.sample, but there's no need since the loader.rc for those platforms doesn't do menu.rc processing by default. pcibios.4th is now installed everywhere, but will failsafe on non x86 platforms (it isn't loaded by default anywhere). These changes are too intertwined to do separately since aspects of each are required to have a bug-free commit. Sponsored by: Netflix Notes: svn path=/head/; revision=325694
* loader.efi: efi_devpath_is_prefix should return boolToomas Soome2017-11-101-8/+8
| | | | | | | | | | | efi_devpath_is_prefix() is currently returning values 0 or 1, which means it really should return bool. Additionally, use unsigned len, because we only get unsigned values from DevicePathNodeLength(). Notes: svn path=/head/; revision=325641
* efipart_strategy is using wrong offset with >512B sectorsToomas Soome2017-11-011-1/+5
| | | | | | | | | | | The strategy() calls are assuming 512B sectors, so we need to adjust the offset accordingly. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D12849 Notes: svn path=/head/; revision=325286
* For amd64, compile both zfs and zfs32 libraries.Warner Losh2017-10-301-3/+1
| | | | | | | | | | | | We have a separate copy of zfs for userboot. However, we don't need it if we compile both 32 and 64 bit ZFS libraries. Remove redunant copies of zfs related .o files now that both versions are available. Introduce ZFSSRC and use it everywhere. Sponsored by: Netflix Notes: svn path=/head/; revision=325175
* Define new EFI variablesWarner Losh2017-10-291-8/+8
| | | | | | | | | | | Define EFISRC, EFIINC and EFIINCMD. Use them, as well as using other symbols defined in defs.mk. Prefer <bsd.init.mk> to ../../Makefile.inc or <src.opts.mk>. Sponsored by: Netflix Notes: svn path=/head/; revision=325093
* Revert "Unify boot1 with loader" change r324646Warner Losh2017-10-172-191/+2
| | | | | | | | | | | | | | Back out the unification commit to boot1. There's some issues on the arm and arm64 platforms that need to be addressed with code changes. There's also a discussion on arch@ about the future of boot1.efi vs just using loader.efi that needs to play out. So take a pause on these changes until the arm issues can be fixed and it's clear boot1.efi will survive into FreeBSD 12. OK'd by: Eric@meatspace Notes: svn path=/head/; revision=324709
* LOADER_foo_SUPPORTEDWarner Losh2017-10-161-0/+1
| | | | Notes: svn path=/head/; revision=324653
* Move all the ficl common code into ficl.mkWarner Losh2017-10-161-1/+0
| | | | | | | | There's a number of copies of basically identical code to enable building forth in /boot/loader. Move it all into ficl.mk. Notes: svn path=/head/; revision=324652
* Rename top level Makefile.ficl to ficl.mk.Warner Losh2017-10-161-1/+1
| | | | Notes: svn path=/head/; revision=324648
* Unify boot1 with loaderWarner Losh2017-10-162-2/+191
| | | | | | | | | | | Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor to use the common efi_main.c. Submitted by: Eric McCorkle Differential Revision: https://reviews.freebsd.org/D10447 Notes: svn path=/head/; revision=324646
* Rather than laying whack-a-mole with including the path to stand.h,Warner Losh2017-10-101-1/+0
| | | | | | | | | | always include it. Remove places where we explicitly include it. This also helps reduce the 'cut-and-paste' factor of these Makefiles. Sponsored by: Netflix Notes: svn path=/head/; revision=324460
* Define SASRC and use itWarner Losh2017-10-091-1/+1
| | | | | | | | | | | | Define SASRC to point to the current libstand sources. Include ../Makefile.inc early enough in a few places so we can .include "${SASRC}/Makefile" and have it work. Create a new pass-up Makefile.inc in sys/boot/userboot to allow this pattern to work. Sponsored by: Netflix Notes: svn path=/head/; revision=324450
* Encapsulate ZFS preferences into efi_zfs_is_preferredWarner Losh2017-10-061-4/+1
| | | | | | | | | | | Move the retrieval of the image information into loader's main instead of doing it in efizfs.c Differential Revision: https://reviews.freebsd.org/D12564 Submitted by: Eric McCorkle Notes: svn path=/head/; revision=324360
* Add efi_devpath_is_prefixWarner Losh2017-10-061-0/+29
| | | | | | | | | | efi_devpath_is_prefix determines if a path matches a passed-in prefix. Differential Revision: https://reviews.freebsd.org/D12564 Submitted by: Eric McCorkle Notes: svn path=/head/; revision=324359
* libefi: efipart_floppy() will should not pass acpi pointer if the HID test failsToomas Soome2017-09-251-2/+2
| | | | | | | The current efipart_floppy() implementation is leaking the acpi pointer. Notes: svn path=/head/; revision=323991
* libefi: define EISA PNP constantsToomas Soome2017-09-221-3/+8
| | | | | | | Define EISA PNP constants and use them, also fix ID for 0x701 Notes: svn path=/head/; revision=323909
* libefi: efipart_hdinfo_add_filepath should check strtol resultToomas Soome2017-09-221-0/+7
| | | | | | | Use errno for error checking. Notes: svn path=/head/; revision=323908
* libefi: efipart.c cstyle fix for efipart_print_common()Toomas Soome2017-09-221-1/+2
| | | | | | | The else statement should have { } Notes: svn path=/head/; revision=323907
* libefi: efipart_strategy() should return ENXIO when there is no mediaToomas Soome2017-09-221-1/+1
| | | | | | | | We should return ENXIO to indicate the situation with device present, but no media. Notes: svn path=/head/; revision=323906
* libefi: efi_devpath_match local len should be unsignedToomas Soome2017-09-221-2/+2
| | | | | | | DevicePathNodeLength() will always return unsigned value. Notes: svn path=/head/; revision=323895
* libefi: efipart.c should use calloc()Toomas Soome2017-09-211-10/+5
| | | | | | | | The device specific *_add functions are using malloc() + memset, should use calloc instead. Notes: svn path=/head/; revision=323886
* libefi: efi_devpath_match() should return boolToomas Soome2017-09-212-9/+9
| | | | | | | | The current implementation of efi_devpath_match() is returning values 0 or 1, so it should be updated to return bool. Notes: svn path=/head/; revision=323885
* libefi: devicename.c cleanupsToomas Soome2017-09-211-16/+20
| | | | | | | | Remove duplicated free()+return statements, default unit to 0 and improve strtol error processing. Notes: svn path=/head/; revision=323867
* libefi: efipart_realstrategy rsize pointer may be NULLToomas Soome2017-09-131-1/+2
| | | | | | | Need to check rsize before dereferencing it. Notes: svn path=/head/; revision=323541
* libefi: efipart_open should check the status from disk_openToomas Soome2017-09-121-2/+13
| | | | | | | | | | In case of error from disk_open(), we should clean up properly. Reviewed by: allanjude, imp Differential Revision: https://reviews.freebsd.org/D12340 Notes: svn path=/head/; revision=323497
* loader.efi: chain loader should provide proper device handleToomas Soome2017-09-102-44/+40
| | | | | | | | | | | | Since the efipart rewrite, the chain command was looking for device handle using interface applicable only for net devices. Disk partitions and zfs pools need their own approach to find the proper handle. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D12287 Notes: svn path=/head/; revision=323389
* Be consistent and do return (1);Warner Losh2017-09-071-1/+1
| | | | | | | | Noticed by: tsoome@ Sponsored by: Netflix Notes: svn path=/head/; revision=323272
* ucs2lenWarner Losh2017-09-071-0/+11
| | | | | | | | | | | | | Rename boot1's wcslen to ucs2len, which we can't use in userland because wchar in userland is unsigned, not short. Move it into efichar.c. Also spell '* 2' as '* sizeof(efi_char)' and add 1 for the trailing NUL to transition the FreeBSD boot env vars to being NUL terminated on the same line... Sponsored by: Netflix Notes: svn path=/head/; revision=323258
* Make efichar.c routines available to libefi.Warner Losh2017-08-312-1/+7
| | | | | | | | | Make efichar.c routines available to libefi as well as libefivar. Define LIBEFI when building so we can conditionally include stand.h vs the normal userland stuff. Notes: svn path=/head/; revision=323062
* Link in libefi for boot1Warner Losh2017-08-261-1/+4
| | | | | | | | | | | Add libefi to the list of libraries we'll link in. Move EFI table definitions back to libefi so we don't have drift between the two efi_main routines. Sponsored by: Netflix Notes: svn path=/head/; revision=322938
* Move efi_main into efi/loaderWarner Losh2017-08-261-150/+1
| | | | | | | | | | | | | Move the efi_main routine out of libefi into sys/boot/efi/loader. Since boot1 has its own efi_main routine, this effectively prevents boot1 from linking with libefi. By moving it out, we can share code better (though though some refactoring with boot1's efi_main and loader.efi's efi_main is definitely in order). Sponsored by: Netflix Notes: svn path=/head/; revision=322930
* libefi/time.c cstyle cleanupToomas Soome2017-08-051-165/+178
| | | | | | | | | | | | libefi/time.c is mix of different styles, this update does cleanup. Also fix 0 versus NULL, and zero the tv structure for case we get error from UEFI firmware. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D11861 Notes: svn path=/head/; revision=322074
* Move EFI fmtdev functionality to libefiWarner Losh2017-08-042-1/+216
| | | | | | | | | | | This patch moves code necessary for the fmtdev functionality from loader to libefi, allowing other applications to make use of it Submitted by: Eric McCorkle Differential Revision: https://reviews.freebsd.org/D11862 Notes: svn path=/head/; revision=322056
* Add EFI utility functions to libefiWarner Losh2017-08-042-39/+138
| | | | | | | | | | | This patch adds additional EFI utility functions to convert errno values to EFI_STATUS errors, as well as EFI times to UNIX times. Submitted by: Eric McCorkle Differential Revision: https://reviews.freebsd.org/D11858 Notes: svn path=/head/; revision=322040
* Move EFI ZFS functions to libefiWarner Losh2017-08-042-1/+119
| | | | | | | | | | | This patch moves some EFI ZFS functions from loader to libefi, allowing them to be used by anything that links against libefi. Submitted by: Eric McCorkle Differential Revision: https://reviews.freebsd.org/D11855 Notes: svn path=/head/; revision=322039
* Add definitions and utilities for EFI driversWarner Losh2017-08-042-1/+92
| | | | | | | | | | | This patch adds definitions and utility code for creating EFI drivers using the EFI_DRIVER_BINDING_PROTOCOL. Submitted by: Eric McCorkle Differential Revision: https://reviews.freebsd.org/D11852 Notes: svn path=/head/; revision=322038
* Always set the receive mask in loader.efi. Some UEFI implementations setAndrew Turner2017-07-271-9/+8
| | | | | | | | | | | | | | | | this to be too restrictive. We need to have both broadcast and unicast enabled for loader to work. Set them in all cases to ensure this is true. This allows the Cavium ThunderX 2s in the netperf cluster to netboot using a USB NIC. PR: 221001 Reviewed by: emaste, tsoome Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11732 Notes: svn path=/head/; revision=321621
* Integer underflow in efipart_realstrategy when I/O starts after end of diskAllan Jude2017-07-011-1/+10
| | | | | | | | | | | | | | | | | This fixes an integer underflow in efipart_realstrategy, which causes crashes when an I/O operation's start point is after the end of the disk. This can happen when trying to detect filesystems on very small disks. This can occur if a BIOS freebsd-boot partition exists on a system when the EFI loader is being used. PR: 219000 Submitted by: Eric McCorkle <eric@metricspace.net> Reviewed by: cem (previous version), tsoome (previous version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D10559 Notes: svn path=/head/; revision=320553
* loader: network read reworkToomas Soome2017-05-062-42/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current read from network is working from up to down - we have some protocol needing the data from the network, so we build the buffer space for that protocol, add the extra space for headers and pass this buffer down to be filled by nif get call in hope, we have guessed the incoming packet size right. Amazingly enough this approach mostly does work, but not always... So, this update does work from down to up - we allocate buffer (based on MTU or frame size info), fill it up, and pass on for upper layers. The obvious problem is that when we should free the buffer - if at all. In the current implementation the upper layer will free the packet on error or when the packet is no longer needed. While working on the issue, the additional issue did pop up - the bios implementation does not have generic get/put interface but is using pxe udpsend/udpreceive instead. So the udp calls are gone and undi interface is implemented instead. Which in turn means slight other changes as we do not need to have duplicated pxe implementation and can just use dev_net. To align packet content, the actual read from nic is using shifted buffer by ETHER_ALIGN (2). Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10232 Notes: svn path=/head/; revision=317887
* loader: F_READ/F_WRITE should be checked against masked flagToomas Soome2017-04-181-1/+1
| | | | | | | | | | | | | | | | | | The work to make it possible to avoid bcache via using F_NORA modifier did miss the fact that not all loader platforms are using the bcache, and so it is possible the modifier is not cleared, as bcache strategy function is not used. For fix, we make sure the checks are dont with masked flag. This patch does fix boot for platforms which do not use bcache. Reported by: emaste Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D10422 Notes: svn path=/head/; revision=317097
* Do not use -msoft-float with intention of disabling FP on aarch64Alexander Kabaev2017-04-071-1/+1
| | | | | | | | | | | GNU GCC does does recognise it as a valid option and we already use -mgeneral-regs-only that has the desired effect. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D10306 Notes: svn path=/head/; revision=316625
* loader: efipart should check disk size from partition tableToomas Soome2017-03-301-9/+28
| | | | | | | | | | | | | | | | | | | | | | While testing 32bit UEFI OVMF (which has bug about how the disk size is presented), I did witness the errors from blkio->ReadBlocks(). It became apparent we can not entirely trust UEFI interfaces either, so additional checks are needed. So we use disk_ioctl(DIOCGMEDIASIZE) for disks, with fallback of Media->LastBlock for other media. In addition, we need to check if there is media present. + small fixes for error printout, and avoiding multiple blk * 512. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D10197 Notes: svn path=/head/; revision=316279
* loader: remove open_disk cacheToomas Soome2017-03-161-4/+2
| | | | | | | | | | | | | | | | | | As we provide the disk size verification and correction via disk_ioctl and disk state provided by disk_open(), we can not share the partition state in disk_devdesc structure. Also the sharing does make a lot of sense with ufs, as only one partition is open at any given time, but zfs pools do keep the disk devices open. To make sure we do get the correct information about the open device, just remove the cache. Reviewed by: allanjude, smh Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D9757 Notes: svn path=/head/; revision=315408
* Share UCS2/UTF8 routines between boot loader and userland.Warner Losh2017-03-091-0/+186
| | | | | | | | | | 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
* sys: Replace zero with NULL for pointers.Pedro F. Giffuni2017-02-221-2/+2
| | | | | | | | | Found with: devel/coccinelle MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D9694 Notes: svn path=/head/; revision=314068
* loader: cstyle fixes and DIOCGMEDIASIZE should use uint64_tToomas Soome2017-02-131-8/+8
| | | | | | | | | | | | Cleaned up some spaces where tabs should be. efipart_ioctl() DIOCGMEDIASIZE needs to use uint64_t, not off_t Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D9562 Notes: svn path=/head/; revision=313710
* loader: implement MEDIA_FILEPATH_DP support in efipartToomas Soome2017-02-111-0/+89
| | | | | | | | | | | | | | | The efipart rework did break the ARM systems as the new code is using more exact filters to sort the devices and we need to add support for MEDIA_FILEPATH_DP device paths. PR: 216940 Reported by: karl@denninger.net Reviewed by: allanjude, manu Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D9520 Notes: svn path=/head/; revision=313645
* loader: possible NULL pointer dereference in efipart.cToomas Soome2017-02-081-1/+3
| | | | | | | | | | | | | | | | | Fix bugs found by Coverity in efipart.c. The Issue is that efi_devpath_last_node() can return NULL pointer, and therefore we should check for it. In real life we really do not expect to see it to happen, so we will just error out from the test. CID: 1371004 Reported by: Coverity Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D9490 Notes: svn path=/head/; revision=313442
* efipart is also using the '%S' printf format, add -Wno-format for it.Emmanuel Vadot2017-02-071-0/+1
| | | | | | | This fix building for armv6. Notes: svn path=/head/; revision=313389