aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-02-23[dns] Always start DNS queries using the first configured DNS serverdns_primaryMichael Brown1-5/+4
We currently define the active DNS server as a global variable. All queries will start by attempting to contact the active DNS server, and the active DNS server will be changed only if we fail to get a response. This effectively treats the DNS server list as expressing a weak preference ordering: we will try servers in order, but once we have found a working server we will stick with that server for as long as it continues to respond to queries. Some sites are misconfigured to hand out DNS servers that do not have a consistent worldview. For example: the site may hand out two DNS server addresses, the first being an internal DNS server (which is able to resolve names in private DNS domains) and the second being a public DNS server such as 8.8.8.8 (which will correctly return NXDOMAIN for any private DNS domains). This type of configuration is fundamentally broken and should never be used, since any DNS resolver performing a query for a name within a private DNS domain may obtain a spurious NXDOMAIN response for a valid private DNS name. Work around these broken configurations by treating the DNS server list as expressing a strong preference ordering, and always starting DNS queries from the first server in the list (rather than maintaining a global concept of the active server). This will have the debatable benefit of converting permanent spurious NXDOMAIN errors into transient spurious NXDOMAIN errors, which can at least be worked around at a higher level (e.g. by retrying a download in a loop within an iPXE script). The cost of always starting DNS queries from the first server in the list is a slight delay introduced when the first server is genuinely unavailable. This should be negligible in practice since DNS queries are relatively infrequent and the failover expiry time is short. Treating the DNS server list as a preference ordering is permitted by the language of RFC 2132, which defines DHCP option 6 as a list in which "[DNS] servers SHOULD be listed in order of preference". No specification defines a precise algorithm for how this preference order should be applied in practice: this new approach seems as good as any. Requested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-16[console] Include mappings for AltGr-Shift-<key>Michael Brown20-3/+118
The BIOS console's interpretation of LShift+RShift as equivalent to AltGr requires the shifted ASCII characters to be present in the AltGr mapping table, to allow AltGr-Shift-<key> to be interpreted in the same way as AltGr-<key>. For keyboard layouts that have different ASCII characters for AltGr-<key> and AltGr-Shift-<key>, this will potentially leave the character for AltGr-<key> inaccessible via the BIOS console if the BIOS requires the use of the LShift+RShift workaround. This theoretically affects the numeric keys in the Lithuanian ("lt") keyboard layout (where the numerals are accessed via AltGr-<key> and punctuation characters via AltGr-Shift-<key>), but the simple workaround for that keyboard layout is to avoid using AltGr and Shift entirely since the unmodified numeric keys are not remapped anyway. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-16[console] Support changing keyboard map at runtimeMichael Brown4-2/+174
Provide the special keyboard map named "dynamic" which allows the active keyboard map to be selected at runtime via the ${keymap} setting, e.g.: #define KEYBOARD_MAP dynamic iPXE> set keymap uk Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-16[settings] Always process all settings applicatorsMichael Brown1-7/+3
Settings applicators are entirely independent, and there is no reason why a failure in one applicator should prevent other applicators from being processed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-16[console] Ensure that US keyboard map appears at start of linker tableMichael Brown3-3/+7
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-16[xsigo] Avoid storing unused uninitialised fields in gateway addressMichael Brown1-0/+1
As reported by Coverity, xsmp_rx_xve_modify() currently passes a partially initialised struct ib_address_vector to xve_update_tca() and thence to eoib_set_gateway(), which uses memcpy() to store the whole structure including the (unused and unneeded) uninitialised fields. Silence the Coverity warning by zeroing the whole structure. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-16[pci] Ensure that pci_read_config() initialises all fieldsMichael Brown1-0/+5
As per the general pattern for initialisation functions in iPXE, pci_init() saves code size by assuming that the caller has already zeroed the underlying storage (e.g. as part of zeroing a larger containing structure). There are several places within the code where pci_init() is deliberately used to initialise a transient struct pci_device without zeroing the entire structure, because the calling code knows that only the PCI bus:dev.fn address is required to be initialised (e.g. when reading from PCI configuration space). Ensure that using pci_init() followed by pci_read_config() will fully initialise the struct pci_device even if the caller did not previously zero the underlying storage, since Coverity reports that there are several places in the code that rely upon this. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-16[image] Do not clear current working URI when executing embedded imageMichael Brown1-2/+5
Embedded images do not have an associated URI. This currently causes the current working URI (cwuri) to be cleared when starting an embedded image. If the current working URI has been set via a ${next-server} setting from a cached DHCP packet then this will result in unexpected behaviour. An attempt by the embedded script to use a relative URI to download files from the TFTP server will fail with the error: Could not start download: Operation not supported (ipxe.org/3c092083) Rerunning the "dhcp" command will not fix this error, since the TFTP settings applicator will not see any change to the ${next-server} setting and so will not reset the current working URI. Fix by setting the current working URI to the image's URI only if the image actually has an associated URI. Debugged-by: Ignat Korchagin <ignat@cloudflare.com> Originally-fixed-by: Ignat Korchagin <ignat@cloudflare.com> Tested-by: Ignat Korchagin <ignat@cloudflare.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Fix definition of unreachability for remapped keysMichael Brown19-23/+137
The AltGr remapping table is constructed to include only keys that are not reachable after applying the basic remapping table. The logic currently fails to include keys that are omitted entirely from the basic remapping table since they would map to a non-ASCII character. Fix this logic by allowing the remapping tables to include null mappings, which are then elided only at the point of constructing the C code fragment. Reported-by: Christian Nilsson <nikize@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Add Swedish "se" keymapMichael Brown1-0/+53
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[build] Avoid invoking genkeymap.py via PerlMichael Brown2-1/+2
The build process currently invokes the Python genkeymap.py script via the Perl executable. Strangely, this appears to work. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Ensure that all ASCII characters are reachable in all keymapsMichael Brown1-0/+6
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Remove "az" keymapMichael Brown1-40/+0
The "az" keymap has several unreachable ASCII characters, with no obvious closest equivalent keys. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Fix unreachable characters in "mt" keymapMichael Brown2-1/+5
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Fix unreachable characters in "il" keymapMichael Brown2-0/+7
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Treat dead keys as producing their ASCII equivalentsMichael Brown15-7/+61
Treat dead keys in target keymaps as producing the closest equivalent ASCII character, since many of these characters are otherwise unrepresented on the keyboard. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Support AltGr to access ASCII characters via remappingMichael Brown37-5/+332
Several keyboard layouts define ASCII characters as accessible only via the AltGr modifier. Add support for this modifier to ensure that all ASCII characters are accessible. Experiments suggest that the BIOS console is likely to fail to generate ASCII characters when the AltGr key is pressed. Work around this limitation by accepting LShift+RShift (which will definitely produce an ASCII character) as a synonym for AltGr. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Centralise handling of key modifiersMichael Brown6-37/+116
Handle Ctrl and CapsLock key modifiers within key_remap(), to provide consistent behaviour across different console types. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-15[console] Allow for named keyboard mappingsMichael Brown33-130/+373
Separate the concept of a keyboard mapping from a list of remapped keys, to allow for the possibility of supporting multiple keyboard mappings at runtime. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-14[tables] Add ability to declare static table start and end markersMichael Brown1-0/+27
The compound statement expression within __table_entries() prevents the use of top-level declarations such as static struct thing *things = table_start ( THINGS ); Define TABLE_START() and TABLE_END() macros that can be used as: static TABLE_START ( things_start, THINGS ); static struct thing *things = things_start; Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10[console] Handle remapping of scancode 86Michael Brown28-6/+93
The key with scancode 86 appears in the position between left shift and Z on a US keyboard, where it typically fails to exist entirely. Most US keyboard maps define this nonexistent key as generating "\|", with the notable exception of "loadkeys" which instead reports it as generating "<>". Both of these mapping choices duplicate keys that exist elsewhere in the map, which causes problems for our ASCII-based remapping mechanism. Work around these quirks by treating the key as generating "\|" with the high bit set, and making it subject to remapping. Where the BIOS generates "\|" as expected, this allows us to remap to the correct ASCII value. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10[console] Update genkeymap to work with current databasesMichael Brown25-485/+434
Rewrite genkeymap.pl in Python with added sanity checks, and update the list of keyboard mappings to remove those no longer supported by the underlying "loadkeys" tool. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10[efi] Support keyboard remapping via the EFI consoleMichael Brown1-0/+8
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10[usb] Handle upper/lower case and Ctrl-<key> after applying remappingMichael Brown1-6/+11
Some keyboard layouts (e.g. "fr") swap letter and punctuation keys. Apply the logic for upper and lower case and for Ctrl-<key> only after applying remapping, in order to handle these layouts correctly. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10[usb] Support keyboard remapping via the native USB keyboard driverMichael Brown1-0/+5
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10[console] Avoid attempting to remap numeric keypad on BIOS consoleMichael Brown1-3/+18
To minimise code size, our keyboard mapping works on the basis of allowing the BIOS to convert the keyboard scancode into an ASCII character and then remapping the ASCII character. This causes problems with keyboard layouts such as "fr" that swap the shifted and unshifted digit keys, since the ASCII-based remapping will spuriously remap the numeric keypad (which produces the same ASCII values as the digit keys). Fix by checking that the keyboard scancode is within the range of keys that vary between keyboard mappings before attempting to remap the ASCII character. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10[console] Generalise bios_keymap() as key_remap()Michael Brown3-17/+55
Allow the keyboard remapping functionality to be exposed to consoles other than the BIOS console. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-10[efi] Enable IMAGE_GZIP by default for AArch64Michael Brown1-0/+4
AArch64 kernels tend to be distributed as gzip compressed images. Enable IMAGE_GZIP by default for AArch64 to avoid the need for uncompressed images to be provided. Originally-implemented-by: Alessandro Di Stefano <aleskandro@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-02-02[prefix] Fix use of writable code segment on 486 and earlier CPUsfix486Michael Brown1-4/+10
In real mode, code segments are always writable. In protected mode, code segments can never be writable. The precise implementation of this attribute differs between CPU generations, with subtly different behaviour arising on the transitions from protected mode to real mode. At the point of transition (when the PE bit is cleared in CR0) the hidden portion of the %cs descriptor will retain whatever attributes were in place for the protected-mode code segment, including the fact that the segment is not writable. The immediately following code will perform a far control flow transfer (such as ljmp or lret) in order to load a real-mode value into %cs. On the Pentium and later CPUs, the retained protected-mode attributes will be ignored for any accesses via %cs while the CPU is in real mode. A write via %cs will therefore be allowed even though the hidden portion of the %cs descriptor still describes a non-writable segment. On the 486 and earlier CPUs, the retained protected-mode attributes will not be ignored for accesses via %cs. A write via %cs will therefore cause a CPU fault. To obtain normal real-mode behaviour (i.e. a writable %cs descriptor), special logic is added to the ljmp instruction that populates the hidden portion of the %cs descriptor with real-mode attributes when a far jump is executed in real mode. The result is that writes via %cs will cause a CPU fault until the first ljmp instruction is executed, after which writes via %cs will be allowed as expected in real mode. The transition code in libprefix.S currently uses lret to load a real-mode value into %cs after clearing the PE bit. Experimentation shows that only the ljmp instruction will work to load real-mode attributes into the hidden portion of the %cs descriptor: other far control flow transfers (such as lret, lcall, or int) do not do so. When running on a 486 or earlier CPU, this results in code within libprefix.S running with a non-writable code segment after a mode transition, which in turn results in a CPU fault when real-mode code in liba20.S attempts to write to %cs:enable_a20_method. Fix by constructing and executing an ljmp instruction, to trigger the relevant descriptor population logic on 486 and earlier CPUs. This ljmp instruction is constructed on the stack, since the .prefix section may be executing directly from ROM (or from memory that the BIOS has write-protected in order to emulate an ISA ROM region) and so cannot be modified. Reported-by: Nikolai Zhubr <n-a-zhubr@yandex.ru> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-18[efi] Attempt to fetch autoexec script via TFTPMichael Brown1-0/+176
Attempt to fetch the autoexec.ipxe script via TFTP using the PXE base code protocol installed on the loaded image's device handle, if present. This provides a generic alternative to the use of an embedded script for chainloaded binaries, which is particularly useful in a UEFI Secure Boot environment since it allows the script to be modified without the need to sign a new binary. As a side effect, this also provides a third method for breaking the PXE chainloading loop (as an alternative to requiring an embedded script or custom DHCP server configuration). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-18[efi] Allow for autoexec scripts that are not located in a filesystemMichael Brown1-21/+41
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-13[uri] Allow for relative URIs that include colons within the pathuricolonMichael Brown2-5/+20
RFC3986 allows for colons to appear within the path component of a relative URI, but iPXE will currently parse such URIs incorrectly by interpreting the text before the colon as the URI scheme. Fix by checking for valid characters when identifying the URI scheme. Deliberately deviate from the RFC3986 definition of valid characters by accepting "_" (which was incorrectly used in the iPXE-specific "ib_srp" URI scheme and so must be accepted for compatibility with existing deployments), and by omitting the code to check for characters that are not used in any URI scheme supported by iPXE. Reported-by: Ignat Korchagin <ignat@cloudflare.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-13[efi] Include Secure Boot Advanced Targeting (SBAT) metadatasbatMichael Brown9-0/+139
SBAT defines an encoding for security generation numbers stored as a CSV file within a special ".sbat" section in the signed binary. If a Secure Boot exploit is discovered then the generation number will be incremented alongside the corresponding fix. Platforms may then record the minimum generation number required for any given product. This allows for an efficient revocation mechanism that consumes minimal flash storage space (in contrast to the DBX mechanism, which allows for only a single-digit number of revocation events to ever take place across all possible signed binaries). Add SBAT metadata to iPXE EFI binaries to support this mechanism. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-13[build] Ensure version.%.o is always rebuilt as expectedMichael Brown1-2/+2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-13[doc] Update user-visible ipxe.org URIs to use HTTPSMichael Brown7-20/+20
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-11[efi] Do not align VirtualSize for .reloc and .debug sectionsMichael Brown1-9/+9
As of commit f1e9e2b ("[efi] Align EFI image sections by page size"), the VirtualSize fields for the .reloc and .debug sections have been rounded up to the (4kB) image alignment. This breaks the PE relocation logic in the UEFI shim, which requires the VirtualSize field to exactly match the size as recorded in the data directory. Fix by setting the VirtualSize field to the unaligned size of the section, as is already done for normal PE sections (i.e. those other than .reloc and .debug). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-04[settings] Support formatting UUIDs as little-endian GUIDsguidMichael Brown4-6/+31
The RFC4122 specification defines UUIDs as being in network byte order, but an unfortunately significant amount of (mostly Microsoft) software treats them as having the first three fields in little-endian byte order. In an ideal world, any server-side software that compares UUIDs for equality would perform an endian-insensitive comparison (analogous to comparing strings for equality using a case-insensitive comparison), and would therefore not care about byte order differences. Define a setting type name ":guid" to allow a UUID setting to be formatted in little-endian order, to simplify interoperability with server-side software that expects such a formatting. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-25[efi] Disable EFI watchdog timer when shutting down to boot an OSMichael Brown1-0/+34
The UEFI specification mandates that the EFI watchdog timer should be disabled by the platform firmware as part of the ExitBootServices() call, but some platforms (e.g. Hyper-V) are observed to occasionally forget to do so, resulting in a reboot approximately five minutes after starting the operating system. Work around these firmware bugs by disabling the watchdog timer ourselves. Requested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-23[efi] Run ExitBootServices shutdown hook at TPL_NOTIFYshutdown_tpl_notifyMichael Brown6-11/+36
On some systems (observed with the Thunderbolt ports on a ThinkPad X1 Extreme Gen3 and a ThinkPad P53), if the IOMMU is enabled then the system firmware will install an ExitBootServices notification event that disables bus mastering on the Thunderbolt xHCI controller and all PCI bridges, and destroys any extant IOMMU mappings. This leaves the xHCI controller unable to perform any DMA operations. As described in commit 236299b ("[xhci] Avoid DMA during shutdown if firmware has disabled bus mastering"), any subsequent DMA operation attempted by the xHCI controller will end up completing after the operating system kernel has reenabled bus mastering, resulting in a DMA operation to an area of memory that the hardware is no longer permitted to access and, on Windows with the Driver Verifier enabled, a STOP 0xE6 (DRIVER_VERIFIER_DMA_VIOLATION). That commit avoids triggering any DMA attempts during the shutdown of the xHCI controller itself. However, this is not a complete solution since any attached and opened USB device (e.g. a USB NIC) may asynchronously trigger DMA attempts that happen to occur after bus mastering has been disabled but before we reset the xHCI controller. Avoid this problem by installing our own ExitBootServices notification event at TPL_NOTIFY, thereby causing it to be invoked before the firmware's own ExitBootServices notification event that disables bus mastering. This unsurprisingly causes the shutdown hook itself to be invoked at TPL_NOTIFY, which causes a fatal error when later code attempts to raise the TPL to TPL_CALLBACK (which is a lower TPL). Work around this problem by redefining the "internal" iPXE TPL to be variable, and set this internal TPL to TPL_NOTIFY when the shutdown hook is invoked. Avoid calling into an underlying SNP protocol instance from within our shutdown hook at TPL_NOTIFY, since the underlying SNP driver may attempt to raise the TPL to TPL_CALLBACK (which would cause a fatal error). Failing to shut down the underlying SNP device is safe to do since the underlying device must, in any case, have installed its own ExitBootServices hook if any shutdown actions are required. Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-23[build] Include EFI system partition table entry in isohybrid imagesMichael Brown1-0/+3
Add the "--uefi" option when invoking isohybrid on an EFI-bootable image, to create a partition mapping to the EFI system partition embedded within the ISO image. This allows the resulting isohybrid image to be booted on UEFI systems that will not recognise an El Torito boot catalog on a non-CDROM device. Originally-fixed-by: Christian Hesse <mail@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-22[efi] Raise TPL during driver unload entry pointMichael Brown1-0/+7
The efi_unload() function is currently missing the calls to raise and restore the TPL. This has the side effect of causing iPXE to return from the driver unload entry point at TPL_CALLBACK, which will cause unexpected behaviour (typically a system lockup) shortly afterwards. Fix by adding the missing calls to raise and restore the TPL. Debugged-by: Petr Borsodi <petr.borsodi@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-22[intel] Add PCI ID for Intel X553 0x15e4Benedikt Braunger1-0/+1
Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-21[efi] Modify global system table when wrapping a loaded imageMichael Brown2-44/+57
The EFI loaded image protocol allows an image to be provided with a custom system table, and we currently use this mechanism to wrap any boot services calls made by the loaded image in order to provide strace-like debugging via DEBUG=efi_wrap. The ExitBootServices() call will modify the global system table, leaving the loaded image using a system table that is no longer current. When DEBUG=efi_wrap is used, this generally results in the machine locking up at the point that the loaded operating system calls ExitBootServices(). Fix by modifying the global EFI system table to point to our wrapper functions, instead of providing a custom system table via the loaded image protocol. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-21[efi] Do not attempt to use console output after ExitBootServices()Michael Brown1-3/+6
A successful call to ExitBootServices() will result in the EFI console becoming unusable. Ensure that the EFI wrapper produces a complete line of debug output before calling the wrapped ExitBootServices() method, and attempt subsequent debug output only if the call fails. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-12[xhci] Avoid DMA during shutdown if firmware has disabled bus masteringMichael Brown1-0/+22
On some systems (observed with the Thunderbolt ports on a ThinkPad X1 Extreme Gen3 and a ThinkPad P53), the system firmware will disable bus mastering on the xHCI controller and all PCI bridges at the point that ExitBootServices() is called if the IOMMU is enabled. This leaves the xHCI controller unable to shut down cleanly since all commands will fail with a timeout. Commit 85eb961 ("[xhci] Allow for permanent failure of the command mechanism") allows us to detect that this has happened and respond cleanly. However, some unidentified hardware component (either the xHCI controller or one of the PCI bridges) seems to manage to enqueue the attempted DMA operation and eventually complete it after the operating system kernel has reenabled bus mastering. This results in a DMA operation to an area of memory that the hardware is no longer permitted to access. On Windows with the Driver Verifier enabled, this will result in a STOP 0xE6 (DRIVER_VERIFIER_DMA_VIOLATION). Work around this problem by detecting when bus mastering has been disabled, and immediately failing the device to avoid initiating any further DMA attempts. Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-11-12[uri] Retain original encodings for path, query, and fragment fieldsuriMichael Brown5-75/+148
iPXE decodes any percent-encoded characters during the URI parsing stage, thereby allowing protocol implementations to consume the raw field values directly without further decoding. When reconstructing a URI string for use in an HTTP request line, the percent-encoding is currently reapplied in a reversible way: we guarantee that our reconstructed URI string could be decoded to give the same raw field values. This technically violates RFC3986, which states that "URIs that differ in the replacement of a reserved character with its corresponding percent-encoded octet are not equivalent". Experiments show that several HTTP server applications will attach meaning to the choice of whether or not a particular character was percent-encoded, even when the percent-encoding is unnecessary from the perspective of parsing the URI into its component fields. Fix by storing the originally encoded substrings for the path, query, and fragment fields and using these original encoded versions when reconstructing a URI string. The path field is also stored as a decoded string, for use by protocols such as TFTP that communicate using raw strings rather than URI-encoded strings. All other fields (such as the username and password) continue to be stored only in their decoded versions since nothing ever needs to know the originally encoded versions of these fields. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-10-28[xhci] Allow for permanent failure of the command mechanismxhci_failMichael Brown2-2/+51
Some xHCI controllers (observed with the Thunderbolt ports on a ThinkPad X1 Extreme Gen3 and a ThinkPad P53) seem to suffer a catastrophic failure at the point that ExitBootServices() is called if the IOMMU is enabled. The symptoms appear to be consistent with another UEFI driver (e.g. the IOMMU driver, or the Thunderbolt driver) having torn down the DMA mappings, leaving the xHCI controller unable to write to host memory. The observable effect is that all commands fail with a timeout, and attempts to abort command execution similarly fail since the xHCI controller is unable to report the abort completion. Check for failure to abort a command, and respond by performing a full device reset (as recommended by the xHCI specification) and by marking the device as permanently failed. Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-10-28[virtio] Update driver to use DMA APIAaron Young5-31/+69
Signed-off-by: Aaron Young <aaron.young@oracle.com>
2021-09-10[readline] Extend maximum read line length to 1024 charactersMichael Brown1-7/+17
Realistic Linux kernel command lines may exceed our current 256 character limit for interactively edited commands or settings. Switch from stack allocation to heap allocation, and increase the limit to 1024 characters. Requested-by: Matteo Guglielmi <Matteo.Guglielmi@dalco.ch> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-09-09[ecm] Use ACPI-provided system-specific MAC address if presentMichael Brown1-0/+9
Use the "system MAC address" provided within the DSDT/SSDT if such an address is available and has not already been assigned to a network device. Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>