summaryrefslogtreecommitdiffstats
path: root/sys/boot/efi
Commit message (Collapse)AuthorAgeFilesLines
* MFC: r303039manu2016-07-261-0/+4
| | | | | | | Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial console. Approved by: re (gjb)
* boot1.efi: fix assignment / comparison expressionemaste2016-07-041-1/+1
| | | | | | | PR: 210706 Submitted by: David Binderman <dcb314@hotmail.com> Approved by: re (kib) MFC after: 1 week
* Print a message when disks are found but no logical partition aremanu2016-06-171-3/+6
| | | | | | | reported by EFI implementation. This address comment on r301714. Approved by: re (gjb), andrew (mentor) Differential Revision: https://reviews.freebsd.org/D6787
* Print a message when the efi disk isn't a logical partition.manu2016-06-091-1/+4
| | | | | Approved by: andrew (mentor) Differential Revision: https://reviews.freebsd.org/D6782
* Also set -fshort-wchar on arm64, this fixes parsing strings from UEFI,andrew2016-06-081-0/+4
| | | | | | e.g. on the command line. Sponsored by: ABT Systems Ltd
* Print the newline character along with the carriage return when TERM_EMU isandrew2016-06-081-2/+1
| | | | | | disabled. Without this we print all lines over top of each other. Sponsored by: ABT Systems Ltd
* Allow libefi to be built with TERM_EMU undefined. There were a few placesandrew2016-06-081-1/+8
| | | | | | | | | | where we assumed TERM_EMU was defined but didn't check. Fix these by also including them under the ifdefs. As HO is called from loader we need a null implementation so loader.efi doesn't need to know which version of libefi it is building against. Sponsored by: ABT Systems Ltd
* Use the UEFI event timer to update the time on arm and arm64. The currentandrew2016-06-049-5/+121
| | | | | | | | | code uses the GetTime function from the Runtime Service, however this has been shown to not return a useable time on many arm64 UEFI implementations. Reviewed by: jhb, smh Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D6709
* If the I/O offset and length is multiple of the media size thenambrisko2016-05-271-3/+6
| | | | | | | | directly pass the request otherwise use a buffer that is a multiple of the media size. This speeds up I/O quite a bit when using large transfer sizes on 4Kn disks etc. MFC after: 1 week
* Fix unit number of EFI net interfaces and ignore psuedo network interfaces.jhb2016-05-262-25/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In r277943, the efinet_match() routine was changed to use an off by one when matching network interfaces. The effect was that using "net1" actually used the device attached to "net0". Digging into the hardware that needed this workaround more, I found that UEFI was creating two simple network protocol devices for each physical NIC. The first device was a "raw" Ethernet device and the second device was a "IP" device that used the IP protocol on top of the underlying "raw" device. The PXE code in the firmware used the "IP" device to pull across the loader.efi, so currdev was set to "net1" when booting from the physical interface "net0". (The loaded image's device handle referenced the "IP" device that "net1" claimed.) However, the IP device isn't suitable for doing raw packet I/O (and the current code to open devices exclusively actually turns the "IP" devices off on these systems). To fix, change the efinet driver to only attach to "raw" devices. This is determined by fetching the DEVICE_PATH for each handle which supports the simple network protocol and examining the last node in the path. If the last node in the path is a MAC address, the device is assumed to be a "raw" device and is added as a 'netX' device. If the last node is not a MAC address, the device is ignored. However, this causes a new problem as the device handle associated with the loaded image no longer matches any of the handles enumerated by efinet for systems that load the image via the "IP" device. To handle this case, expand the logic that resolves currdev from the loaded image in main(). First, the existing logic of looking for a handle that matches the loaded image's handle is tried. If that fails, the device path of the handle that loaded the loaded image is fetched via efi_lookup_image_devpath(). This device path is then walked from the end up to the beginning using efi_handle_lookup() to fetch the handle associated with a path. If the handle is found and is a known handle, then that is used as currdev. The effect for machines that load the image via the "IP" device is that the first lookup fails (the handle for the "IP" device isn't claimed by efinet), but walking up the image's device path finds the handle of the raw MAC device which is used as currdev. With these fixes in place, the hack to subtract 1 from the unit can now be removed, so that setting currdev to 'net0' actually uses 'net0'. PR: 202097 Tested by: ambrisko Sponsored by: Cisco Systems
* Use a unique error message if we fail to find the simple network protocol.jhb2016-05-261-1/+8
| | | | | | | | While here, fix the various net driver callbacks to return early instead of crashing if this fails. (The 'init' callback from the netif interface doesn't return an error if the protocol lookup fails.) Sponsored by: Cisco Systems
* Apply the printf %S band-aid for efinet.c to fix the arm64 build.jhb2016-05-261-0/+7
|
* Remove second copy of the -Wno-format band-aid for printf %S.jhb2016-05-261-4/+0
|
* Use routines from the recently added devpath.c.jhb2016-05-261-19/+4
| | | | | | | These efipart layer did several devpath related operations inline. This just switches it over to using shared code for working with device paths. Sponsored by: Cisco Systems
* Output the device path description for EFI network devices.jhb2016-05-261-3/+8
| | | | | | | | Lookup the DEVICE_PATH for each EFI network device handle and output the string description using printf with '%S'. To honor the pager, the newline at the end of each line is still output with pager_output(). Sponsored by: Cisco Systems
* Add some routines for working with EFI DEVICE_PATH objects.jhb2016-05-263-2/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - efi_lookup_devpath() uses the DEVICE_PATH_PROTOCOL to obtain the DEVICE_PATH for a given EFI handle. - efi_lookup_image_devpath() uses the LOADED_IMAGE_DEVICE_PATH_PROTOCOL to lookup the device path of the device used to load a loaded image. - efi_devpath_name() uses the DEVICE_PATH_TO_TEXT_PROTOCOL to generate a string description of a device path. The returned string is a CHAR16 string that can be printed via the recently added '%S' format in libstand's printf(). Note that the returned string is returned in allocated storage that should be freed by calling efi_free_devpath_name(). - efi_devpath_last_node() walks a DEVICE_PATH returning a pointer to the final node in the path (not counting the terminating node). That is, it returns a pointer to the last meaninful node in a DEVICE_PATH. - efi_devpath_trim() generates a new DEVICE_PATH from an existing DEVICE_PATH. The new DEVICE_PATH does not include the last non-terminating node in the original path. If the original DEVICE_PATH only contains the terminating node, this function returns NULL. The caller is responsible for freeing the returned DEVICE_PATH via free(). - efi_devpath_handle() attempts to find a handle that corresponds to a given device path. However, if nodes at the end of the device path do not have valid handles associated with them, this function will return a handle that matches a node earlier in the device path. In particular, this function returns a handle for the node closest to the end of the device path which has a valid handle. Sponsored by: Cisco Systems
* efi loader: Match format string to EFI_ERROR_CODE()cem2016-05-251-2/+2
| | | | | | Silence a format specifier warning. Sponsored by: EMC / Isilon Storage Division
* Large improvements to efi-show (though some weird problemsimp2016-05-201-64/+40
| | | | | linger). We now print only printable characters for the values and we print ascii strings as strings.
* Implement efi-set and efi-unsetimp2016-05-201-3/+67
|
* Cleanup to use %S.imp2016-05-201-18/+4
|
* Fix logic error so UEFI variables are reported correctlyimp2016-05-191-6/+8
| | | | without error at the end.
* Minor spelling fixes.pfg2016-05-181-4/+4
|
* Fix several instances where the boot loader ignored pager_outputimp2016-05-185-17/+48
| | | | | | | return value when it could return 1 (indicating we should stop). Fix a few instances of pager_open() / pager_close() not being called. Actually use these routines for the environment variable printing code I just committed.
* Fix build breakage on arm64 by papering over the problem. We implementimp2016-05-181-0/+7
| | | | | | a slightly non-standard %S that's more useful in the UEFI environment, so ignore printf errors. There's no good cast to use. We'll need to revisit this in the future.
* Implement UEFI set environment variable, as well as exporting the EFIimp2016-05-173-6/+257
| | | | | | | | version. This is also scriptable, though additional scripting will be needed. Differential Review: https://reviews.freebsd.org/D4494 MFC After: 3 days
* It sure would be nice to use printf with wide strings. Implement %S toimp2016-05-171-1/+1
| | | | | | | do that. The C_WIDEOUT flag indicates that the console supports it. Mark the EFI console as supporting this. MFC After: 3 days
* libefi: Tag an unreachable switch default.pfg2016-05-161-0/+2
| | | | | | | | Coverity reports an uninitialized "len" in case the switch defaults without hitting any case. Respect the original intent and quell the false positive with the relatively new __unreachable() builtin. CID: 1347796
* efipart: Support an arbitrary number of partitionscem2016-05-051-5/+6
| | | | | | | | | | Don't crash if the user has more than 31 of them. A follow-up to r298230. Reviewed by: allanjude Relnotes: maybe Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6212
* bcache read ahead may attempt to read past end of diskallanjude2016-05-011-1/+9
| | | | | | | | | | The new bcache code does not know the size of the disk, and therefore may attempt to read past the end of the disk while trying to fill its read-ahead cache. This is usually not an issue, it fails gracefully on all of my machines, but some BIOSes seem to retry the reads for up to 30 seconds each, resulting in a long stall during boot Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: jhb, np Differential Revision: https://reviews.freebsd.org/D6109
* sys/boot: spelling fixes in comments.pfg2016-04-307-9/+9
| | | | No functional change.
* sys/boot: use our nitems() macro when it is available through param.h.pfg2016-04-191-1/+1
| | | | | | No functional change, only trivial cases are done in this sweep, Discussed in: freebsd-current
* A new implementation of the loader block cacheallanjude2016-04-183-7/+58
| | | | | | | | | | | | | | | | | The block cache implementation in loader has proven to be almost useless, and in worst case even slowing down the disk reads due to insufficient cache size and extra memory copy. Also the current cache implementation does not cache reads from CDs, or work with zfs built on top of multiple disks. Instead of an LRU, this code uses a simple hash (O(1) read from cache), and instead of a single global cache, a separate cache per block device. The cache also implements limited read-ahead to increase performance. To simplify read ahead management, the read ahead will not wrap over bcache end, so in worst case, single block physical read will be performed to fill the last block in bcache. Booting from a virtual CD over IPMI: 0ms latency, before: 27 second, after: 7 seconds 60ms latency, before: over 12 minutes, after: under 5 minutes. Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: delphij (previous version), emaste (previous version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D4713
* Deprecate using hints.acpi.0.rsdp to communicate the RSDP to theimp2016-04-141-0/+17
| | | | | | | | | | | | | | | | | system. This uses the hints mechnanism. This mostly works today because when there's no static hints (the default), this value can be fetched from the hint. When there is a static hints file, the hint passed from the boot loader to the kernel is ignored, but for the BIOS case we're able to find it anyway. However, with UEFI, the fallback doesn't work, so we get a panic instead. Switch to acpi.rsdp and use TUNABLE_ULONG_FETCH instead. Continue to generate the old values to allow for transitions. In addition, fall back to the old method if the new method isn't present. Add comments about all this. Differential Revision: https://reviews.freebsd.org/D5866
* boot1: regenerate FAT templates after r297871emaste2016-04-125-78/+81
| | | | Sponsored by: The FreeBSD Foundation
* boot1.efifat: provide a fallback startup.nshemaste2016-04-121-0/+2
| | | | | | | | | | | | In case the firmware falls through to executing startup.sh, populate it with the name of our boot loader. In normal operation this should not be necessary but may allow the system to boot if it would otherwise just remain at a shell prompt. Reviewed by: andrew, imp, smh MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5878
* ms_abi is supported with gcc 4.5 or newer, so build it with gcc if itimp2016-03-151-4/+4
| | | | is 4.5 or newer.
* boot/efi: Prefer nm to objdumpemaste2016-03-122-6/+6
| | | | | | | | | | | | Both objdump and nm are equally capable of reporting undefined symbols. This gets us a step closer to building without binutils as we have an nm implementation from ELF Tool Chain. Reviewed by: bdrewery MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5613
* Print the correct size of loader.efi when failing to load it into memory.andrew2016-03-121-1/+1
| | | | | Obtained from: AsiaBSDCon Sponsored by: ABT Systems Ltd
* Add more .NOMETA missed in r291320bdrewery2016-03-113-5/+5
| | | | Sponsored by: EMC / Isilon Storage Division
* boot1.efi: use += to append to LDFLAGSemaste2016-03-081-1/+1
| | | | | This is for consistency with loader.efi's Makefile and simplifies some out-of-tree experimentation.
* DIRDEPS_BUILD: Regenerate without local dependencies.bdrewery2016-02-241-2/+0
| | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division
* Make efi_time and EFI_GetTimeOfDay static, neither are used by other partsandrew2016-02-212-3/+2
| | | | | | of the efi code. Sponsored by: ABT Systems Ltd
* Add a missing call to dev_cleanup from the arm64 loader.efi.andrew2016-02-201-0/+2
| | | | Sponsored by: ABT Systems Ltd
* Remove dd xfer stats emitted during buildworldemaste2016-02-181-1/+2
| | | | They result in gratuitous differences when comparing build log output.
* DIRDEPS_BUILD: Update dependencies.bdrewery2016-02-161-0/+2
| | | | Sponsored by: EMC / Isilon Storage Division
* Ensure the bss is aligned to a 4-byte address as we use 4-byte alignedandrew2016-02-091-1/+3
| | | | | | | | | stores to clear it. While here reduce the alignment of the data from 4k to 16 byte aligned. This should be more than enough, without wasting too much space. Sponsored by: ABT Systems Ltd
* Implement -P for boot loader. It's a bit easier to implement here thanimp2016-02-081-3/+93
| | | | | | | | | | | in boot1, like is normally done. When a keyboard appears in the UEFI device tree, assume -D -h, just like on a BIOS boot. # It is unclear if an ACPI keyboard appearing in the tree means there's # a real keyboard or not. A USB keyboard doesn't seem to appear unless # it is really there. Differential Revision: https://reviews.freebsd.org/D5223
* Fix EFI platform build failuressmh2016-02-061-1/+1
| | | | | | | | | | | With warnings now enabled some plaforms where failing due to warnings. * Fix st_size printed as a size_t when its actually an off_t. * Fix pointer conversion in load_elf for some 32bit platforms due to 64bit off in ef. MFC after: 2 days X-MFC-With: Sponsored by: Multiplay
* Fix EFI multi device boot supportsmh2016-02-055-181/+517
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix EFI boot support when presented with multiple valid boot partitions across multiple devices. It now prefers to boot from partitions that are present on the underlying device that the boot1 image was loaded from. This means that it will boot from the partitions on device the user chose from EFI boot menu in preference to those on other devices. Also fixed is the recovery from a failed attempt to boot, from a seemingly valid partition, by continuing to trying all other available partitions no matter what the error. boot1 now use * to signify a partition what was accepted from the preferred device and + otherwise. Finally some error messages where improved and DPRINTF's with slowed boot to aid debugging. ZFS will still be preferred over UFS when both are available on the boot device. Reviewed by: imp MFC after: 1 week Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D5108
* Still open the network interface when EFI_OPEN_PROTOCOL_EXCLUSIVE failed.andrew2016-02-031-2/+2
| | | | Not all UEFI implementations support this protocol.
OpenPOWER on IntegriCloud