summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/efi
Commit message (Collapse)AuthorAgeFilesLines
* [efi] Blacklist the Dell Ip4ConfigDxe driverMichael Brown2019-02-191-0/+13
| | | | | | | | | | | | | | | | | | On a Dell OptiPlex 7010, calling DisconnectController() on the LOM device handle will lock up the system. Debugging shows that execution is trapped in an infinite loop that is somehow trying to reconnect drivers (without going via ConnectController()). The problem can be reproduced in the UEFI shell with no iPXE code present, by using the "disconnect" command. Experimentation shows that the only fix is to unload (rather than just disconnect) the "Ip4ConfigDxe" driver. Add the concept of a blacklist of UEFI drivers that will be automatically unloaded when iPXE runs as an application, and add the Dell Ip4ConfigDxe driver to this blacklist. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rng] Use fixed-point calculations for min-entropy quantitiesMichael Brown2018-03-201-2/+2
| | | | | | | | | | | | | | We currently perform various min-entropy calculations using build-time floating-point arithmetic. No floating-point code ends up in the final binary, since the results are eventually converted to integers and asserted to be compile-time constants. Though this mechanism is undoubtedly cute, it inhibits us from using "-mno-sse" to prevent the use of SSE registers by the compiler. Fix by using fixed-point arithmetic instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add missing FILE_LICENCE declarationsMichael Brown2017-12-292-0/+4
| | | | | | | Add missing FILE_LICENCE declarations to EFI headers based on the corresponding source file. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Provide access to ACPI tablesMichael Brown2017-05-232-0/+66
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add efi_sprintf() and efi_vsprintf()Michael Brown2017-04-121-0/+23
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add EFI_ACPI_TABLE_PROTOCOL header and GUID definitionMichael Brown2017-03-102-0/+130
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Update to current EDK2 headersMichael Brown2017-03-1014-44/+1233
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Centralise "san-drive" settingMichael Brown2017-03-071-9/+0Star
| | | | | | | | | | | | The concept of the SAN drive number is meaningful only in a BIOS environment, where it represents the INT13 drive number (0x80 for the first hard disk). We retain this concept in a UEFI environment to allow for a simple way for iPXE commands to refer to SAN drives. Centralise the concept of the default drive number, since it is shared between all supported environments. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Allow timer to be selected at runtimeMichael Brown2017-01-261-36/+0Star
| | | | | | | | | | | | | | | | | | | | | | Allow the active timer (providing udelay() and currticks()) to be selected at runtime based on probing during the INIT_EARLY stage of initialisation. TICKS_PER_SEC is now a fixed compile-time constant for all builds, and is independent of the underlying clock tick rate. We choose the value 1024 to allow multiplications and divisions on seconds to be converted to bit shifts. TICKS_PER_MS is defined as 1, allowing multiplications and divisions on milliseconds to be omitted entirely. The 2% inaccuracy in this definition is negligible when using the standard BIOS timer (running at around 18.2Hz). TIMER_RDTSC now checks for a constant TSC before claiming to be a usable timer. (This timer can be tested in KVM via the command-line option "-cpu host,+invtsc".) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Work around temporal anomaly encountered during ExitBootServices()Michael Brown2016-12-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | EFI provides no clean way for device drivers to shut down in preparation for handover to a booted operating system. The platform firmware simply doesn't bother to call the drivers' Stop() methods. Instead, drivers must register an EVT_SIGNAL_EXIT_BOOT_SERVICES event to be signalled when ExitBootServices() is called, and clean up without any reference to the EFI driver model. Unfortunately, all timers silently stop working when ExitBootServices() is called. Even more unfortunately, and for no discernible reason, this happens before any EVT_SIGNAL_EXIT_BOOT_SERVICES events are signalled. The net effect of this entertaining design choice is that any timeout loops on the shutdown path (e.g. for gracefully closing outstanding TCP connections) may wait indefinitely. There is no way to report failure from currticks(), since the API lazily assumes that the host system continues to travel through time in the usual direction. Work around EFI's violation of this assumption by falling back to a simple free-running monotonic counter. Debugged-by: Maor Dickman <maord@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add basic EFI SAN booting capabilityMichael Brown2016-11-171-0/+27
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add EFI_BLOCK_IO2_PROTOCOL header and GUID definitionMichael Brown2016-10-172-0/+209
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Update to current EDK2 headersMichael Brown2016-10-1615-46/+401
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Mark AppleNetBoot.h as a native iPXE headerMichael Brown2016-10-161-3/+3
| | | | | | | | | AppleNetBoot.h is not taken from the EDK2 codebase and so cannot be imported using include/ipxe/efi/import.pl. Mark as a native iPXE header (by changing the include guard) to avoid breaking the import process. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Install the HII config access protocol on a child of the SNP handleLaszlo Ersek2016-07-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In edk2, there are several drivers that associate HII forms (and corresponding config access protocol instances) with each individual network device. (In this context, "network device" means the EFI handle on which the SNP protocol is installed, and on which the device path ending with the MAC() node is installed also.) Such edk2 drivers are, for example: Ip4Dxe, HttpBootDxe, VlanConfigDxe. In UEFI, any given handle can carry at most one instance of a specific protocol (see e.g. the specification of the InstallProtocolInterface() boot service). This implies that the class of drivers mentioned above can't install their EFI_HII_CONFIG_ACCESS_PROTOCOL instances on the SNP handle directly -- they would conflict with each other. Accordingly, each of those edk2 drivers creates a "private" child handle under the SNP handle, and installs its config access protocol (and corresponding HII package list) on its child handle. The device path for the child handle is traditionally derived by appending a Hardware Vendor Device Path node after the MAC() node. The VenHw() nodes in question consist of a GUID (by definition), and no trailing data (by choice). The purpose of these VenHw() nodes is only that all the child nodes can be uniquely identified by device path. At the moment iPXE does not follow this pattern. It doesn't run into a conflict when it installs its EFI_HII_CONFIG_ACCESS_PROTOCOL directly on the SNP handle, but that's only because iPXE is the sole driver not following the pattern. This behavior seems risky (one might call it a "latent bug"); better align iPXE with the edk2 custom. Cc: Michael Brown <mcb30@ipxe.org> Cc: Gary Lin <glin@suse.com> Cc: Ladi Prosek <lprosek@redhat.com> Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/13494/focus=13532 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ladi Prosek <lprosek@redhat.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Expose DHCP packets via the Apple NetBoot protocolMichael Brown2016-05-292-0/+47
| | | | | | | | Mac OS X uses non-standard EFI protocols to obtain the DHCP packets from the UEFI firmware. Originally-implemented-by: Michael Kuron <m.kuron@gmx.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Use a timer event to generate the currticks() timerMichael Brown2016-05-042-302/+18Star
| | | | | | | | | | | | | | We currently use the EFI_CPU_ARCH_PROTOCOL's GetTimerValue() method to generate the currticks() timer, calibrated against a 1ms delay from the boot services Stall() method. This does not work on ARM platforms, where GetTimerValue() is an empty stub which just returns EFI_UNSUPPORTED. Fix by instead creating a periodic timer event, and using this event to increment a current tick counter. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add processor binding headers for ARM and AArch64Michael Brown2016-03-133-0/+329
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Update to current EDK2 headersMichael Brown2016-03-1313-42/+123
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Centralise EFI file system info GUIDsMichael Brown2015-12-091-0/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Import EFI_HII_FONT_PROTOCOL definitionsMichael Brown2015-10-073-0/+831
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Update to current EDK2 headersMichael Brown2015-10-0728-373/+12442
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Expose unused USB devices via EFI_USB_IO_PROTOCOLMichael Brown2015-09-141-0/+80
| | | | | | | Allow the UEFI platform firmware to provide drivers for unrecognised devices, by exposing our own implementation of EFI_USB_IO_PROTOCOL. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Include a copy of the device path within struct efi_deviceMichael Brown2015-09-131-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Provide efi_devpath_len()Michael Brown2015-09-131-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add USB headers and GUID definitionsMichael Brown2015-09-065-0/+1992
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Implement the EFI_PXE_BASE_CODE_PROTOCOLMichael Brown2015-09-021-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many UEFI NBPs expect to find an EFI_PXE_BASE_CODE_PROTOCOL installed in addition to the EFI_SIMPLE_NETWORK_PROTOCOL. Most NBPs use the EFI_PXE_BASE_CODE_PROTOCOL only to retrieve the cached DHCP packets. This implementation has been tested with grub.efi, shim.efi, syslinux.efi, and wdsmgfw.efi. Some methods (such as Discover() and Arp()) are not used by any known NBP and so have not (yet) been implemented. Usage notes for the tested bootstraps are: - grub.efi uses EFI_PXE_BASE_CODE_PROTOCOL only to retrieve the cached DHCP packet, and uses no other methods. - shim.efi uses EFI_PXE_BASE_CODE_PROTOCOL to retrieve the cached DHCP packet and to retrieve the next NBP via the Mtftp() method. If shim.efi was downloaded via HTTP (or other non-TFTP protocol) then shim.efi will blindly call Mtftp() with an HTTP URI as the filename: this allows the next NBP (e.g. grubx64.efi) to also be transparently retrieved by HTTP. shim.efi can also use the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL to retrieve files previously loaded by "imgfetch" or similar commands in iPXE. The current implementation of shim.efi will use the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL only if it does not find an EFI_PXE_BASE_CODE_PROTOCOL; this patch therefore prevents this usage of our EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. This logic could be trivially reversed in shim.efi if needed. - syslinux.efi uses EFI_PXE_BASE_CODE_PROTOCOL only to retrieve the cached DHCP packet. Versions 6.03 and earlier have a bug which may cause syslinux.efi to attach to the wrong NIC if there are multiple NICs in the system (or if the UEFI firmware supports IPv6). - wdsmgfw.efi (ab)uses EFI_PXE_BASE_CODE_PROTOCOL to retrieve the cached DHCP packets, and to send and retrieve UDP packets via the UdpWrite() and UdpRead() methods. (This was presumably done in order to minimise the amount of benefit obtainable by switching to UEFI, by replicating all of the design mistakes present in the original PXE specification.) The EFI_DOWNGRADE_UX configuration option remains available for now, until this implementation has received more widespread testing. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow calls to efi_snp_claim() and efi_snp_release() to be nestedMichael Brown2015-09-011-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add definitions of GUIDs observed when booting wdsmgfw.efiMichael Brown2015-09-013-0/+358
| | | | | | | Add definitions of protocols observed to be used by wdsmgfw.efi, and add a handle name type for ConIn, ConOut, and StdErr. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Improve efi_wrap debuggingMichael Brown2015-08-271-0/+4
| | | | | | | Add debug wrappers for more boot services functions, and print symbolic values rather than raw numbers where possible. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Mark EFI debug transcription functions as __attribute__ (( pure ))Michael Brown2015-08-271-3/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add definitions of GUIDs observed when booting shim.efi and grub.efiMichael Brown2015-08-274-0/+667
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Hold off watchdog timer while runningMichael Brown2015-08-031-0/+31
| | | | | | | | | | | | | | | | UEFI platforms may provide a watchdog timer, which will reboot the machine if an operating system takes more than five minutes to load. This can cause long-lived iPXE downloads (or interactive shell sessions) to unexpectedly reboot. Fix by resetting the watchdog timer every ten seconds while the iPXE main processing loop continues to run. Reported-by: Bradley B Williams <bradleybwilliams@swbell.net> Reported-by: John Clark <john.r.clark.3@gmail.com> Reported-by: wdriever@gmail.com Reported-by: Charlie Beima <cbeima@indiana.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Fix receive and transmit completion reportingMichael Brown2015-07-221-14/+13Star
| | | | | | | | | | | | | | | | Fix the TxBuf value filled in by GetStatus() to report the transmit buffer address as required by the (now clarified) specification. Simplify "interrupt" handling in GetStatus() to report only that one or more packets have been transmitted or received; there is no need to report one GetStatus() "interrupt" per packet. Simplify receive handling to dequeue received packets immediately from the network device into an internal list (thereby avoiding the hacks previously used to determine when to report new packet arrivals). Originally-fixed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Use the EFI_RNG_PROTOCOL as an entropy source if availableMichael Brown2015-04-141-0/+158
| | | | | | | | | | | | | | | Entropy gathering via timer ticks is slow under UEFI (of the order of 20-30 seconds on some machines). Use the EFI_RNG_PROTOCOL if available, to speed up the process of entropy gathering. Note that some implementations (including EDK2) will fail if we request fewer than 32 random bytes at a time, and that the RNG protocol provides no guarantees about the amount of entropy provided by a call to GetRNG(). We take the (hopefully pessimistic) view that a 32-byte block returned by GetRNG() will contain at least the 1.3 bits of entropy claimed by min_entropy_per_sample(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add EFI time sourceMichael Brown2015-04-141-0/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add EFI entropy sourceMichael Brown2015-04-141-0/+35
| | | | | Originally-implemented-by: Jarrod Johnson <jbjohnso@us.ibm.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-0214-14/+14
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add NII / UNDI driverMichael Brown2014-10-162-0/+840
| | | | | | | | | | | | | | | | | | | | | | | Some UEFI network drivers provide a software UNDI interface which is exposed via the Network Interface Identifier Protocol (NII), rather than providing a Simple Network Protocol (SNP). The UEFI platform firmware will usually include the SnpDxe driver, which attaches to NII and provides an SNP interface. The SNP interface is usually provided on the same handle as the underlying NII device. This causes problems for our EFI driver model: when efi_driver_connect() detaches existing drivers from the handle it will cause the SNP interface to be uninstalled, and so our SNP driver will not be able to attach to the handle. The platform firmware will eventually reattach the SnpDxe driver and may attach us to the SNP handle, but we have no way to prevent other drivers from attaching first. Fix by providing a driver which can attach directly to the NII protocol, using the software UNDI interface to drive the network device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Update to current EDK2 headersMichael Brown2014-10-165-15/+60
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Generalise snpnet_dev_info() to efi_device_info()Michael Brown2014-10-161-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add definitions of GUIDs observed when chainloading from Intel driverMichael Brown2014-09-2510-0/+4123
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Centralise definitions of more protocol GUIDsMichael Brown2014-09-251-0/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Avoid returning uninitialised data from PCI configuration space readsMichael Brown2014-09-041-0/+3
| | | | | | | | Under UEFI, reads from PCI configuration space may fail. If this happens, we should return all-ones (which will mimic the behaviour of an absent PCI device). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Wrap any images loaded by our wrapped imageMichael Brown2014-08-291-2/+1Star
| | | | | | | | | | | | Propagate our modified EFI system table to any images loaded by the image that we wrap, thereby allowing us to observe boot services calls made by all subsequent EFI images. Also show details of intercepted ExitBootServices() calls. When wrapping is used, exiting boot services will almost certainly fail, but this at least allows us to see when it happens. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add definitions of GUIDs observed during Windows bootMichael Brown2014-08-216-0/+3773
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Generalise snpnet_pci_info() to efi_locate_device()Michael Brown2014-08-061-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Move abstract device path and handle functions to efi_utils.cMichael Brown2014-08-062-4/+19
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Open device path protocol only at point of useMichael Brown2014-08-062-8/+2Star
| | | | | | | | | | | | Some EFI 1.10 systems (observed on an Apple iMac) do not allow us to open the device path protocol with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER and so we cannot maintain a safe, long-lived pointer to the device path. Work around this by instead opening the device path protocol with an attribute of EFI_OPEN_PROTOCOL_GET_PROTOCOL whenever we need to use it. Debugged-by: Curtis Larsen <larsen@dixie.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Provide centralised definitions of commonly-used GUIDsMichael Brown2014-08-061-0/+16
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>