]> git.ipfire.org Git - thirdparty/ipxe.git/log
thirdparty/ipxe.git
3 days ago[crypto] Generalise rsa_parse_integer() to asn1_enter_unsigned() coverity_scan master
Michael Brown [Thu, 11 Dec 2025 15:02:28 +0000 (15:02 +0000)] 
[crypto] Generalise rsa_parse_integer() to asn1_enter_unsigned()

ECDSA signature values and private keys are fixed-length unsigned
integers modulo N (the group order of the elliptic curve) and are
therefore most naturally represented in ASN.1 using ASN1_OCTET_STRING.

Private key representations do use ASN1_OCTET_STRING, but signature
values tend to use ASN1_INTEGER, which adds no value but does ensure
that the encoding becomes variable-length and requires handling a
pointless extra zero byte if the MSB of the unsigned value happens to
be set.

RSA also makes use of ASN1_INTEGER for modulus and exponent values.
Generalise the existing rsa_parse_integer() to asn1_enter_unsigned()
to allow this code to be reused for ECDSA.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 days ago[crypto] Allow for addition of arbitrary Weierstrass curve points
Michael Brown [Sat, 6 Dec 2025 16:59:29 +0000 (16:59 +0000)] 
[crypto] Allow for addition of arbitrary Weierstrass curve points

ECDSA verification requires the ability to add two arbitrary curve
points (as well as the ability to multiply a curve point by a scalar).

Add an elliptic curve method to perform arbitrary point addition.
Pass in curve points as affine coordinates: this will require some
redundant conversions between affine coorfinates and the internal
representation as projective coordinates in Montgomery form, but keeps
the API as simple as possible.  Since we do not expect to perform a
high volume of ECDSA signature verifications, these redundant
calculations are an acceptable cost for keeping the code simple.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
9 days ago[crypto] Split out Weierstrass point initialisation and finalisation
Michael Brown [Fri, 5 Dec 2025 16:08:49 +0000 (16:08 +0000)] 
[crypto] Split out Weierstrass point initialisation and finalisation

Prepare for adding an operation to add arbitrary curve points by
splitting out initialisation and finalisation from the multiplication
operation.

Pass explicit temporary buffer pointers to weierstrass_init() and
weierstrass_done(), to ensure that stack consumption does not increase
as a result of splitting out this functionality.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
9 days ago[crypto] Expose the (prime) group order as an elliptic curve property
Michael Brown [Fri, 5 Dec 2025 14:47:55 +0000 (14:47 +0000)] 
[crypto] Expose the (prime) group order as an elliptic curve property

ECDSA requires knowledge of the group order of the base point, and is
defined only for curves with a prime group order (e.g. the NIST
curves).

Add the group order as an explicit property of an elliptic curve, and
add tests to verify that the order is correct.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
9 days ago[crypto] Verify that weierstrass_multiply() result is not point at infinity
Michael Brown [Fri, 5 Dec 2025 14:50:57 +0000 (14:50 +0000)] 
[crypto] Verify that weierstrass_multiply() result is not point at infinity

The point at infinity cannot be represented in affine coordinates, and
so cannot be returned as a valid result from weierstrass_multiply().

The implementation uses projective coordinates internally, in which a
point at infinity is represented by a zero Z-coordinate.  Treat a zero
Z-coordinate as an invalid result.

The projective coordinates are calculated modulo 4N, and so a zero
value may be represented as 0, N, 2N, or 3N.  To minimise code size,
defer the test until after inverting the Z co-ordinate via Fermat's
little theorem via bigint_mod_exp_ladder() (which will calculate the
inverse of zero as zero, and will always produce a result strictly
modulo N).

Defer the test further until after converting the result back to
affine coordinates, to allow the debug message showing the
multiplication result to be printed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
9 days ago[test] Allow for elliptic curve tests other than multiplication
Michael Brown [Fri, 5 Dec 2025 13:17:58 +0000 (13:17 +0000)] 
[test] Allow for elliptic curve tests other than multiplication

Rename elliptic_ok() to elliptic_multiply_ok() etc, to create
namespace for tests of other elliptic curve operations.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
9 days ago[crypto] Expose the base point as an explicit elliptic curve property
Michael Brown [Fri, 5 Dec 2025 13:00:12 +0000 (13:00 +0000)] 
[crypto] Expose the base point as an explicit elliptic curve property

Add the generator base point as an explicit property of an elliptic
curve, and remove the ability to pass a NULL to elliptic_multiply() to
imply the use of the generator base point.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
10 days ago[http] Abort connections after a long period of inactivity
Michael Brown [Thu, 4 Dec 2025 13:52:08 +0000 (13:52 +0000)] 
[http] Abort connections after a long period of inactivity

Once an HTTP download has started (i.e. once all request headers have
been sent), we generally have no more data to transmit.  If an HTTP
connection dies silently (e.g. due to a network failure, a NIC driver
bug, or a server crash) then there is no mechanism that will currently
detect this situation by default.

We do send TCP keep-alives (to maintain state in intermediate routers
and firewalls), but we do not attempt to elicit a response from the
server.  RFC 9293 explicitly states that the absence of a response to
a TCP keep-alive probe must not be interpreted as indicating a dead
connection, since TCP cannot guarantee reliable delivery of packets
that do not advance the sequence number.

Scripts may use the "--timeout" option to impose an overall time limit
on downloads, but this mechanism is off by default and requires
additional thought and configuration by the user (which goes against
iPXE's general philosophy of being as automatic as possible).

Add an idle connection watchdog timer which will cause the HTTP
download to abort after 120 seconds of inactivity.  Activity is
defined as an I/O buffer being delivered to the HTTP transaction's
upstream data transfer interface.

Downloads over HTTPS may experience a substantial delay until the
first recorded activity, since all TLS negotiation (including
cross-chained certificate downloads and OCSP checks) must complete
before any application data can be sent.  We choose to not reset the
watchdog timer during TLS negotiation, on the basis that 120 seconds
is already an unreasonably long time for a TLS negotiation to take to
complete.  If necessary, resetting the watchdog timer could be
accomplished by having the TLS layer deliver zero-length I/O buffers
(via xfer_seek()) to indicate forward progress being made.

When using PeerDist content encoding, the downloaded content
information is not passed through to the content-decoded interface and
so will not be classed as activity.  Any activity in the individual
PeerDist block downloads (either from peers or as range requests from
the origin server) will be classed as activity in the overall
download, since individual block downloads do not buffer data but
instead pass it through directly via the PeerDist download
multiplexer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
10 days ago[http] Rename connection retry timer
Michael Brown [Thu, 4 Dec 2025 13:47:30 +0000 (13:47 +0000)] 
[http] Rename connection retry timer

Signed-off-by: Michael Brown <mcb30@ipxe.org>
11 days ago[crypto] Allow for OID-identified elliptic curve algorithms
Michael Brown [Thu, 27 Nov 2025 16:39:52 +0000 (16:39 +0000)] 
[crypto] Allow for OID-identified elliptic curve algorithms

Elliptic curves in X.509 certificates are identified via the
id-ecPublicKey object identifier (1.2.840.10045.2.1), with the
specific elliptic curve identified via a second OID in the algorithm
parameters.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
11 days ago[test] Include key matching in existing public-key tests
Michael Brown [Wed, 3 Dec 2025 15:18:37 +0000 (15:18 +0000)] 
[test] Include key matching in existing public-key tests

Signed-off-by: Michael Brown <mcb30@ipxe.org>
12 days ago[crypto] Remove obsolete maximum output length method
Michael Brown [Tue, 2 Dec 2025 13:13:01 +0000 (13:13 +0000)] 
[crypto] Remove obsolete maximum output length method

Now that public-key algorithms use ASN.1 builders to dynamically
allocate the output data, there is no further need for callers to be
able to determine the maximum output length.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
12 days ago[crypto] Construct asymmetric ciphered data using ASN.1 builders
Michael Brown [Tue, 2 Dec 2025 13:12:25 +0000 (13:12 +0000)] 
[crypto] Construct asymmetric ciphered data using ASN.1 builders

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 days ago[crypto] Construct signatures using ASN.1 builders
Michael Brown [Mon, 1 Dec 2025 16:02:54 +0000 (16:02 +0000)] 
[crypto] Construct signatures using ASN.1 builders

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 days ago[crypto] Pass signatures for verification as ASN.1 cursors
Michael Brown [Mon, 1 Dec 2025 14:47:51 +0000 (14:47 +0000)] 
[crypto] Pass signatures for verification as ASN.1 cursors

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 days ago[crypto] Restructure handling of ASN.1 bit strings
Michael Brown [Fri, 28 Nov 2025 13:21:00 +0000 (13:21 +0000)] 
[crypto] Restructure handling of ASN.1 bit strings

Signature values in ASN.1 tend to be encoded as bit strings rather
than octet strings.  In practice, no existent signature scheme uses a
non-integral number of bytes.

Switch to using a standard ASN.1 cursor to hold signature values, to
simplify consuming code.  Restructure the API to treat entering an
ASN.1 bit string in the same way as entering any other ASN.1 type.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 weeks ago[intel] Add PCI IDs for I225 and I226 chipsets
Bert Ezendam [Wed, 26 Nov 2025 14:11:18 +0000 (14:11 +0000)] 
[intel] Add PCI IDs for I225 and I226 chipsets

Identifiers are taken from the pci.ids database.

Signed-off-by: Bert Ezendam <bert.ezendam@alliander.com>
2 weeks ago[efi] Allow for creating devices with no EFI parent device
Michael Brown [Tue, 25 Nov 2025 11:59:03 +0000 (11:59 +0000)] 
[efi] Allow for creating devices with no EFI parent device

On some systems (observed on an AWS m8g.medium instance in eu-west-2),
the UEFI firmware fails to enumerate some of the underlying hardware
devices.  On these systems, we cannot comply with the UEFI device
model by adding our SNP device as a child of the hardware device and
appending to the parent hardware device path, since no parent hardware
device has been created.

Work around these systems by allowing for the creation of SNP devices
with no parent device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 weeks ago[pci] Use runtime selectable PCI I/O API for EFI cloud builds
Michael Brown [Mon, 24 Nov 2025 20:27:53 +0000 (20:27 +0000)] 
[pci] Use runtime selectable PCI I/O API for EFI cloud builds

On some systems (observed on an AWS m8g.medium instance in eu-west-2),
the UEFI firmware omits the PCI host bridge drivers for all but the
first PCI bus.  The observable result is that any devices on other PCI
buses (such as the ENA network device) are not enumerated by the UEFI
firmware and are therefore unusable by iPXE.

Support these systems by switching to using PCIAPI_CLOUD for EFI cloud
builds, trying the EFI PCI I/O API first and falling back to direct
access (via ECAM) for devices that the UEFI firmware has failed to
enumerate itself.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 weeks ago[pci] Allow probing permission to vary by range
Michael Brown [Mon, 24 Nov 2025 23:09:53 +0000 (23:09 +0000)] 
[pci] Allow probing permission to vary by range

Make pci_can_probe() part of the runtime selectable PCI I/O API, and
defer this check to the per-range API.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 weeks ago[pci] Use linker tables for runtime selectable PCI APIs
Michael Brown [Mon, 24 Nov 2025 20:18:52 +0000 (20:18 +0000)] 
[pci] Use linker tables for runtime selectable PCI APIs

Use the linker table mechanism to enumerate the underlying PCI I/O
APIs, to allow PCIAPI_CLOUD to become architecture-independent code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 weeks ago[pci] Allow PCI configuration space access mechanism to vary by range
Michael Brown [Mon, 24 Nov 2025 14:44:53 +0000 (14:44 +0000)] 
[pci] Allow PCI configuration space access mechanism to vary by range

On some systems (observed on an AWS EC2 c7a.medium instance in
eu-west-2), there is no single PCI configuration space access
mechanism that covers all PCI devices.  For example: the ECAM may
provide access only to bus 01 and above, with type 1 accesses required
to access bus 00.

Allow the choice of PCI configuration space access mechanism to be
made on a per-range basis, rather than being made just once in an
initialisation function.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
3 weeks ago[arm] Avoid unaligned accesses for memcpy() and memset()
Michael Brown [Wed, 19 Nov 2025 22:17:14 +0000 (22:17 +0000)] 
[arm] Avoid unaligned accesses for memcpy() and memset()

iPXE runs only in environments that support unaligned accesses to RAM.
However, memcpy() and memset() are also used to write to graphical
framebuffer memory, which may support only aligned accesses on some
CPU architectures such as ARM.

Restructure the 64-bit ARM memcpy() and memset() routines along the
lines of the RISC-V implementations, which split the region into
pre-aligned, aligned, and post-aligned sections.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Wrap a selection of runtime services calls
Michael Brown [Thu, 13 Nov 2025 14:38:12 +0000 (14:38 +0000)] 
[efi] Wrap a selection of runtime services calls

Allow DEBUG=efi_wrap to trace various runtime services calls as well
as the existing boot services calls.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Allow SAN-booted images to be traced via DEBUG=efi_wrap
Michael Brown [Thu, 13 Nov 2025 13:17:25 +0000 (13:17 +0000)] 
[efi] Allow SAN-booted images to be traced via DEBUG=efi_wrap

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Add image security database GUID definition
Michael Brown [Wed, 12 Nov 2025 12:09:40 +0000 (12:09 +0000)] 
[efi] Add image security database GUID definition

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Add Microsoft vendor GUID definition
Michael Brown [Wed, 12 Nov 2025 12:01:37 +0000 (12:01 +0000)] 
[efi] Add Microsoft vendor GUID definition

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Add storage security command protocol header and GUID definition
Michael Brown [Tue, 11 Nov 2025 16:22:21 +0000 (16:22 +0000)] 
[efi] Add storage security command protocol header and GUID definition

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Update to current EDK2 headers
Michael Brown [Tue, 11 Nov 2025 16:18:45 +0000 (16:18 +0000)] 
[efi] Update to current EDK2 headers

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Mark Arm/ProcessorBind.h as a non-imported header
Michael Brown [Tue, 11 Nov 2025 16:14:22 +0000 (16:14 +0000)] 
[efi] Mark Arm/ProcessorBind.h as a non-imported header

Support for ARM32 has been removed from the EDK2 codebase.  However,
we may as well retain the ability to build iPXE for existing EFI
platforms.

Add an iPXE include guard to this file so that the EDK2 header import
script will no longer attempt to import it from the EDK2 tree.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Mark Ip4Config.h as a non-imported header
Michael Brown [Tue, 11 Nov 2025 16:12:26 +0000 (16:12 +0000)] 
[efi] Mark Ip4Config.h as a non-imported header

The Ip4Config.h header has been removed from the EDK2 codebase as
obsolete.  However, we may still encounter it in the wild and so it is
useful to retain the GUID and the corresponding protocol name for
debug messages.

Add an iPXE include guard to this file so that the EDK2 header import
script will no longer attempt to import it from the EDK2 tree.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Mark UgaDraw.h as a non-imported header
Michael Brown [Tue, 11 Nov 2025 16:09:27 +0000 (16:09 +0000)] 
[efi] Mark UgaDraw.h as a non-imported header

The UgaDraw.h header has been removed from the EDK2 codebase as
obsolete.  However, we may still encounter it in the wild and so it is
useful to retain the GUID and the corresponding protocol name for
debug messages.

Add an iPXE include guard to this file so that the EDK2 header import
script will no longer attempt to import it from the EDK2 tree.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Switch back to VA_START() etc macros for EFIAPI functions
Michael Brown [Tue, 11 Nov 2025 14:45:01 +0000 (14:45 +0000)] 
[efi] Switch back to VA_START() etc macros for EFIAPI functions

Commit 670810b ("[efi] Use standard va_args macros instead of
VA_START() etc") fixed a 32-bit RISC-V build error, but broke the
functionality of the InstallMultipleProtocolInterfaces() and
UninstallMultipleProtocolInterfaces() wrapper functions.  GCC does not
automatically check the ABI of the current function when using the
__builtin_va_start() and related macros, and it is therefore necessary
for code to use __builtin_ms_va_start() etc from within functions
marked as EFIAPI.

Since commit 9016f2e ("[efi] Skip including the EDK2 ProcessorBind.h
header for 32-bit RISC-V") has now fixed the original 32-bit RISC-V
build error, we can switch back to using the EDK2 VA_START() etc
macros to obtain the correct behaviour.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[efi] Skip including the EDK2 ProcessorBind.h header for 32-bit RISC-V
Michael Brown [Tue, 11 Nov 2025 14:38:59 +0000 (14:38 +0000)] 
[efi] Skip including the EDK2 ProcessorBind.h header for 32-bit RISC-V

We currently include the EDK2 RiscV64/ProcessorBind.h header when
building for 32-bit RISC-V, as a placeholder since there is no support
for 32-bit RISC-V in upstream EDK2.

This causes errors when attempting to use the EDK2 VA_START() et al
macros, since RiscV64/ProcessorBind.h ends up defining UINTN with a
size different from the size of a pointer.

Fix by falling back to the generic definitions for UINTN etc (as used
for EFI_HOSTONLY) whenever we don't have an architecture-specific
ProcessorBind.h header available.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 weeks ago[pci] Move ECAM pci_can_probe() definition to correct header file
Michael Brown [Tue, 11 Nov 2025 13:13:54 +0000 (13:13 +0000)] 
[pci] Move ECAM pci_can_probe() definition to correct header file

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[spcr] Accept alternative type value for a 16550-compatible UART
Michael Brown [Wed, 5 Nov 2025 20:06:53 +0000 (20:06 +0000)] 
[spcr] Accept alternative type value for a 16550-compatible UART

Some systems (observed on an AWS EC2 m7i.metal-24xl instance in
eu-south-2) use the newer "16550-compatible with parameters defined in
Generic Address Structure" type value.  (There does not appear to be
any particular reason why the newer value needs to be used: the UART
is still a standard 16550 with single-byte registers.)

Accept this additional type value for a 16550-compatible UART.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[acpi] Allow acpi_ioremap() to map a port I/O address
Michael Brown [Wed, 5 Nov 2025 17:39:43 +0000 (17:39 +0000)] 
[acpi] Allow acpi_ioremap() to map a port I/O address

Assume that on any platforms where port I/O is used (i.e. x86), a port
I/O address may be used directly for the combined MMIO and port I/O
accessors without requiring an explicit mapping operation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[ioapi] Allow iounmap() to be called for port I/O addresses
Michael Brown [Wed, 5 Nov 2025 17:29:39 +0000 (17:29 +0000)] 
[ioapi] Allow iounmap() to be called for port I/O addresses

Allow code using the combined MMIO and port I/O accessors to safely
call iounmap() to unmap the MMIO or port I/O region.

In the virtual offset I/O mapping API as used for UEFI, 32-bit BIOS,
and 32-bit RISC-V SBI, iounmap() is a no-op anyway.  In 64-bit RISC-V
SBI, we have no concept of port I/O and so the issue is moot.

This leaves only 64-bit BIOS, where it suffices to simply do nothing
for any pages outside of the chosen MMIO virtual address range.

For symmetry, we implement the equivalent change in the very closely
related RISC-V page management code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[spcr] Use the serial port defined by the ACPI SPCR by default
Michael Brown [Wed, 5 Nov 2025 14:19:56 +0000 (14:19 +0000)] 
[spcr] Use the serial port defined by the ACPI SPCR by default

On platforms where we expect ACPI tables to exist, use the serial port
defined by the ACPI Serial Port Console Redirection (SPCR) table by
default, falling back to the fixed serial port defined at build time.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[spcr] Add support for the ACPI Serial Port Console Redirection table
Michael Brown [Wed, 5 Nov 2025 14:12:57 +0000 (14:12 +0000)] 
[spcr] Add support for the ACPI Serial Port Console Redirection table

The BIOS may provide an ACPI Serial Port Console Redirection (SPCR)
table to describe the serial port to be used for early boot messages.

Add support for parsing the SPCR and instantiating a 16550-based UART.
We do not currently attempt to support other types of UART, since iPXE
does not yet have drivers for other types.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[acpi] Add acpi_ioremap() to map an ACPI-described address
Michael Brown [Wed, 5 Nov 2025 14:07:27 +0000 (14:07 +0000)] 
[acpi] Add acpi_ioremap() to map an ACPI-described address

An ACPI Generic Address Structure (GAS) may be used to describe the
location of a peripheral such as an early boot console.  Add the
relevant definitions and provide acpi_ioremap() as a helper function
to map a region described using this structure.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[uart] Make baud rate a property of the UART
Michael Brown [Wed, 5 Nov 2025 12:16:22 +0000 (12:16 +0000)] 
[uart] Make baud rate a property of the UART

Make the current baud rate (if specified) a property of the UART, to
allow the default_serial_console() function to specify the default
baud rate as well as the default UART device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[uart] Support 16550 UARTs accessed via either MMIO or port I/O
Michael Brown [Tue, 4 Nov 2025 16:43:44 +0000 (16:43 +0000)] 
[uart] Support 16550 UARTs accessed via either MMIO or port I/O

Use the combined accessors ioread8() and iowrite8() to read and write
16550 UART registers, to allow the decision between using MMIO and
port I/O to be made at runtime.

Minimise the increase in code size for x86 by ignoring the register
shift, since this is essentially used only for non-x86 SoCs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
5 weeks ago[ioapi] Provide combined MMIO and port I/O accessors
Michael Brown [Tue, 4 Nov 2025 16:19:03 +0000 (16:19 +0000)] 
[ioapi] Provide combined MMIO and port I/O accessors

Some devices (such as a 16550 UART) may be accessed via either MMIO or
port I/O.  This is currently forced to be a compile-time decision.
For example: we currently access a 16550 UART via port I/O on x86 and
via MMIO on any other platform.

PCI UARTs with MMIO BARs do exist but are not currently supported in
an x86 build of iPXE.  Some AWS EC2 systems (observed on a c6i.metal
instance in eu-west-2) provide only a PCI MMIO UART, and it is
therefore currently impossible to get serial output from iPXE on these
instance types.

Add ioread8(), ioread16(), etc accessors that will select between MMIO
and port I/O at the point of use.  For non-x86 platforms where we
currently have no port I/O support, these simply become wrappers
around the corresponding readb(), readw(), etc MMIO accessors.  On
x86, we use the fairly well-known trick of treating any 16-bit address
(below 64kB) as a port I/O address.

This trick works even in the i386 BIOS build of iPXE (where virtual
addresses are offset from physical addresses by a runtime constant),
since the first 64kB of the virtual address space will correspond to
the iPXE binary itself (along with its uninitialised-data space), and
so must be RAM rather than a valid MMIO address range.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 weeks ago[pci] Disable decoding while setting a BAR value
Michael Brown [Wed, 29 Oct 2025 23:07:32 +0000 (23:07 +0000)] 
[pci] Disable decoding while setting a BAR value

Setting the base address for a 64-bit BAR requires two separate 32-bit
writes to configuration space, and so will necessarily result in the
BAR temporarily holding an invalid partially written address.

Some hypervisors (observed on an AWS EC2 c7a.medium instance in
eu-west-2) will assume that guests will write BAR values only while
decoding is disabled, and may not rebuild MMIO mappings for the guest
if the BAR registers are written while decoding is enabled.  The
effect of this is that MMIO accesses are not routed through to the
device even though inspection from within the guest shows that every
single PCI configuration register has the correct value.  Writes to
the device will be ignored, and reads will return the all-ones pattern
that typically indicates a nonexistent device.

With the ENA network driver now using low latency transmit queues,
this results in the transmit descriptors being lost (since the MMIO
writes to BAR2 never reach the device), which in turn causes the
device to lock up as soon as the transmit doorbell is rung for the
first time.

Fix by disabling decoding of memory and I/O cycles while setting a BAR
address (as we already do while sizing a BAR), so that the invalid
partial address can never be decoded and so that hypervisors will
rebuild MMIO mappings as expected.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 weeks ago[cloud] Display instance type in AWS EC2
Michael Brown [Wed, 29 Oct 2025 13:18:28 +0000 (13:18 +0000)] 
[cloud] Display instance type in AWS EC2

Experiments suggest that the instance type is exposed via the SMBIOS
product name.  Include this information within the default output,
since it is often helpful in debugging.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 weeks ago[ena] Leave queue base address empty when creating a low latency queue
Michael Brown [Mon, 27 Oct 2025 12:41:36 +0000 (12:41 +0000)] 
[ena] Leave queue base address empty when creating a low latency queue

The queue base address is meaningless for a low latency queue, since
the queue entries are written directly to the on-device memory.  Any
non-zero queue base address will be safely ignored by the hardware,
but leaves open the possibility that future revisions could treat it
as an error.

Leave this field as zero, to match the behaviour of the Linux driver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 weeks ago[riscv] Correct page table stride calculation
Michael Brown [Mon, 27 Oct 2025 14:04:08 +0000 (14:04 +0000)] 
[riscv] Correct page table stride calculation

Signed-off-by: Michael Brown <mcb30@ipxe.org>
6 weeks ago[librm] Correct page table stride calculation
Michael Brown [Mon, 27 Oct 2025 14:02:50 +0000 (14:02 +0000)] 
[librm] Correct page table stride calculation

Signed-off-by: Michael Brown <mcb30@ipxe.org>
7 weeks ago[cloud] Display build architecture in AWS EC2
Michael Brown [Mon, 20 Oct 2025 11:35:36 +0000 (12:35 +0100)] 
[cloud] Display build architecture in AWS EC2

On some newer (7th and 8th generation) instance types, the 32-bit
build of iPXE cannot access PCI configuration space since the ECAM is
placed outside of the 32-bit address space.  The visible symptom is
that iPXE fails to detect any network devices.

The public AMIs are all now built as 64-bit binaries, but there is
nothing that prevents the building and importing of a 32-bit AMI.
There are still potentially valid use cases for 32-bit AMIs (e.g. if
planning to use the AMI only for older instance types), and so we
cannot sensibly prevent this error at build time.

Display the build architecture as part of the AWS EC2 embedded script,
to at least allow for easy identification of this particular failure
mode at run time.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
7 weeks ago[cloud] Remove AWS public image access block only if not already unblocked
Michael Brown [Mon, 20 Oct 2025 11:56:34 +0000 (12:56 +0100)] 
[cloud] Remove AWS public image access block only if not already unblocked

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[cloud] Remove AWS public image access block automatically if needed
Michael Brown [Fri, 17 Oct 2025 13:21:06 +0000 (14:21 +0100)] 
[cloud] Remove AWS public image access block automatically if needed

Making images public is blocked by default in new AWS regions.  Remove
this block automatically whenever creating a public image.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[ena] Limit receive queue size to work around hardware bugs
Michael Brown [Fri, 17 Oct 2025 11:35:11 +0000 (12:35 +0100)] 
[ena] Limit receive queue size to work around hardware bugs

Commit a801244 ("[ena] Increase receive ring size to 128 entries")
increased the receive ring size to 128 entries (while leaving the fill
level at 16), since using a smaller receive ring caused unexplained
failures on some instance types.

The original hardware bug that resulted in that commit seems to have
been fixed: experiments suggest that the original failure (observed on
a c6i.large instance in eu-west-2) will no longer reproduce when using
a receive ring containing only 16 entries (as was the case prior to
that commit).

Newer generations of the ENA hardware (observed on an m8i.large
instance in eu-south-2) seem to have a new and exciting hardware bug:
these instance types appear to use a hash of the received packet
header to determine which portion of the (out-of-order) receive ring
to use.  If that portion of the ring happens to be empty (e.g. because
only 32 entries of the 128-entry ring are filled at any one time),
then the packet will be silently dropped.

Work around this new hardware bug by reducing the receive ring size
down to the current fill level of 32 entries.  This appears to work on
all current instance types (but has not been exhaustively tested).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[ena] Increase transmit queue size to match receive fill level
Michael Brown [Fri, 17 Oct 2025 12:24:16 +0000 (13:24 +0100)] 
[ena] Increase transmit queue size to match receive fill level

Avoid running out of transmit descriptors when sending TCP ACKs by
increasing the transmit queue size to match the increased received
fill level.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[ena] Add memory barrier after writing to on-device memory
Michael Brown [Fri, 17 Oct 2025 11:34:03 +0000 (12:34 +0100)] 
[ena] Add memory barrier after writing to on-device memory

Ensure that writes to on-device memory have taken place before writing
to the doorbell register.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[ena] Increase receive fill level
Michael Brown [Thu, 16 Oct 2025 15:33:38 +0000 (16:33 +0100)] 
[ena] Increase receive fill level

Experiments suggest that at least some instance types (observed with
c6i.large in eu-west-2) experience high packet drop rates with only 16
receive buffers allocated.  Increase the fill level to 32 buffers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[ena] Add support for low latency transmit queues
Michael Brown [Thu, 16 Oct 2025 14:58:23 +0000 (15:58 +0100)] 
[ena] Add support for low latency transmit queues

Newer generations of the ENA hardware require the use of low latency
transmit queues, where the submission queues and the initial portion
of the transmitted packet are written to on-device memory via BAR2
instead of being read from host memory.

Detect support for low latency queues and set the placement policy
appropriately.  We attempt the use of low latency queues only if the
device reports that it supports inline headers, 128-byte entries, and
two descriptors prior to the inlined header, on the basis that we
don't care about using low latency queues on older versions of the
hardware since those versions will support normal host memory
submission queues anyway.

We reuse the redundant memory allocated for the submission queue as
the bounce buffer for constructing the descriptors and inlined packet
data, since this avoids needing a separate allocation just for the
bounce buffer.

We construct a metadata submission queue entry prior to the actual
submission queue entry, since experimentation suggests that newer
generations of the hardware require this to be present even though it
conveys no information beyond its own existence.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[ena] Record supported device features
Michael Brown [Thu, 16 Oct 2025 14:53:47 +0000 (15:53 +0100)] 
[ena] Record supported device features

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[ena] Cancel uncompleted transmit buffers on close
Michael Brown [Thu, 16 Oct 2025 15:31:03 +0000 (16:31 +0100)] 
[ena] Cancel uncompleted transmit buffers on close

Avoid spurious assertion failures by ensuring that references to
uncompleted transmit buffers are not retained after the device has
been closed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
8 weeks ago[ena] Map the on-device memory, if present
Michael Brown [Wed, 15 Oct 2025 14:27:03 +0000 (15:27 +0100)] 
[ena] Map the on-device memory, if present

Newer generations of the ENA hardware require the use of low latency
transmit queues, where the submission queues and the initial portion
of the transmitted packet are written to on-device memory via BAR2
instead of being read from host memory.

Prepare for this by mapping the on-device memory BAR.  As with the
register BAR, we may need to steal a base address from the upstream
PCI bridge since the BIOS on some instance types (observed with an
m8i.metal-48xl instance in eu-south-2) will fail to assign an address
to the device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[ena] Add descriptive messages for any admin queue command failures
Michael Brown [Wed, 15 Oct 2025 11:00:42 +0000 (12:00 +0100)] 
[ena] Add descriptive messages for any admin queue command failures

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[pci] Record prefetchable memory window for PCI bridges
Michael Brown [Tue, 14 Oct 2025 17:37:39 +0000 (18:37 +0100)] 
[pci] Record prefetchable memory window for PCI bridges

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[ena] Use pci_bar_set() to place device within bridge memory window
Michael Brown [Tue, 14 Oct 2025 13:44:56 +0000 (14:44 +0100)] 
[ena] Use pci_bar_set() to place device within bridge memory window

Use pci_bar_set() when we need to set a device base address (on
instance types such as c6i.metal where the BIOS fails to do so), so
that 64-bit BARs will be handled automatically.

This particular issue has so far been observed only on 6th generation
instances.  These use 32-bit BARs, and so the lack of support for
handling 64-bit BARs has not caused any observable issue.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[pci] Handle sizing of 64-bit BARs
Michael Brown [Tue, 14 Oct 2025 12:46:54 +0000 (13:46 +0100)] 
[pci] Handle sizing of 64-bit BARs

Provide pci_bar_set() to handle setting the base address for a
potentially 64-bit BAR, and rewrite pci_bar_size() to correctly handle
sizing of 64-bit BARs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[tls] Disable renegotiation unless extended master secret is used
Michael Brown [Sun, 12 Oct 2025 21:37:49 +0000 (22:37 +0100)] 
[tls] Disable renegotiation unless extended master secret is used

RFC 7627 states that renegotiation becomes no longer secure under
various circumstances when the non-extended master secret is used.
The description of the precise set of circumstances is spread across
various points within the document and is not entirely clear.

Avoid a superset of the circumstances in which renegotiation
apparently becomes insecure by refusing renegotiation completely
unless the extended master secret is used.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[tls] Refuse to resume sessions with mismatched master secret methods
Michael Brown [Sun, 12 Oct 2025 21:29:33 +0000 (22:29 +0100)] 
[tls] Refuse to resume sessions with mismatched master secret methods

RFC 7627 section 5.3 states that the client must abort the handshake
if the server attempts to resume a session where the master secret
calculation method stored in the session does not match the method
used for the connection being resumed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[tls] Add support for the Extended Master Secret
Michael Brown [Sun, 12 Oct 2025 21:26:49 +0000 (22:26 +0100)] 
[tls] Add support for the Extended Master Secret

RFC 7627 defines the Extended Master Secret (EMS) as an alternative
calculation that uses the digest of all handshake messages rather than
just the client and server random bytes.

Add support for negotiating the Extended Master Secret extension and
performing the relevant calculation of the master secret.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[tls] Generate master secret only after sending Client Key Exchange
Michael Brown [Sun, 12 Oct 2025 21:20:13 +0000 (22:20 +0100)] 
[tls] Generate master secret only after sending Client Key Exchange

The calculation for the extended master secret as defined in RFC 7627
relies upon the digest of all handshake messages up to and including
the Client Key Exchange.

Facilitate this calculation by generating the master secret only after
sending the Client Key Exchange message.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Rearm interrupts unconditionally on every poll
Michael Brown [Fri, 10 Oct 2025 12:07:05 +0000 (13:07 +0100)] 
[gve] Rearm interrupts unconditionally on every poll

Experimentation suggests that rearming the interrupt once per observed
completion is not sufficient: we still see occasional delays during
which the hardware fails to write out completions.

As described in commit d2e1e59 ("[gve] Use dummy interrupt to trigger
completion writeback in DQO mode"), there is no documentation around
the precise semantics of the interrupt rearming mechanism, and so
experimentation is the only available guide.  Switch to rearming both
TX and RX interrupts unconditionally on every poll, since this
produces better experimental results.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Use raw DMA addresses in descriptors in DQO-QPL mode
Michael Brown [Fri, 10 Oct 2025 11:44:01 +0000 (12:44 +0100)] 
[gve] Use raw DMA addresses in descriptors in DQO-QPL mode

The DQO-QPL operating mode uses registered queue page lists but still
requires the raw DMA address (rather than the linear offset within the
QPL) to be provided in transmit and receive descriptors.

Set the queue page list base device address appropriately.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Report only packet completions for the transmit ring
Michael Brown [Thu, 9 Oct 2025 16:25:25 +0000 (17:25 +0100)] 
[gve] Report only packet completions for the transmit ring

The hardware reports descriptor and packet completions separately for
the transmit ring.  We currently ignore descriptor completions (since
we cannot free up the transmit buffers in the queue page list and
advance the consumer counter until the packet has also completed).

Now that transmit completions are written out immediately (instead of
being delayed until 128 bytes of completions are available), there is
no value in retaining the descriptor completions.

Omit descriptor completions entirely, and reduce the transmit fill
level back down to its original value.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Use dummy interrupt to trigger completion writeback in DQO mode
Michael Brown [Thu, 9 Oct 2025 16:12:20 +0000 (17:12 +0100)] 
[gve] Use dummy interrupt to trigger completion writeback in DQO mode

When operating in the DQO operating mode, the device will defer
writing transmit and receive completions until an entire internal
cacheline (128 bytes) is full, or until an associated interrupt is
asserted.  Since each receive descriptor is 32 bytes, this will cause
received packets to be effectively delayed until up to three further
packets have arrived.  When network traffic volumes are very low (such
as during DHCP, DNS lookups, or TCP handshakes), this typically
induces delays of up to 30 seconds and results in a very poor user
experience.

Work around this hardware problem in the same way as for the Intel
40GbE and 100GbE NICs: by enabling dummy MSI-X interrupts to trick the
hardware into believing that it needs to write out completions to host
memory.

There is no documentation around the interrupt rearming mechanism.
The value written to the interrupt doorbell does not include a
consumer counter value, and so must be relying on some undocumented
ordering constraints.  Comments in the Linux driver source suggest
that the authors believe that the device will automatically and
atomically mask an MSI-X interrupt at the point of asserting it, that
any further interrupts arriving before the doorbell is written will be
recorded in the pending bit array, and that writing the doorbell will
therefore immediately assert a new interrupt if needed.

In the absence of any documentation, choose to rearm the interrupt
once per observed completion.  This is overkill, but is less impactful
than the alternative of rearming the interrupt unconditionally on
every poll.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Add missing memory barriers
Michael Brown [Mon, 6 Oct 2025 15:39:19 +0000 (16:39 +0100)] 
[gve] Add missing memory barriers

Ensure that remainder of completion records are read only after
verifying the generation bit (or sequence number).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[intelxl] Use default dummy MSI-X target address
Michael Brown [Thu, 9 Oct 2025 15:27:49 +0000 (16:27 +0100)] 
[intelxl] Use default dummy MSI-X target address

Use the default dummy MSI-X target address that is now allocated and
configured automatically by pci_msix_enable().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[pci] Map all MSI-X interrupts to a dummy target address by default
Michael Brown [Thu, 9 Oct 2025 15:01:51 +0000 (16:01 +0100)] 
[pci] Map all MSI-X interrupts to a dummy target address by default

Interrupts as such are not used in iPXE, which operates in polling
mode.  However, some network cards (such as the Intel 40GbE and 100GbE
NICs) will defer writing out completions until the point of asserting
an MSI-X interrupt.

From the point of view of the PCI device, asserting an MSI-X interrupt
is just a 32-bit DMA write of an opaque value to an opaque target
address.  The PCI device has no know to know whether or not the target
address corresponds to a real APIC.

We can therefore trick the PCI device into believing that it is
asserting an MSI-X interrupt, by configuring it to write an opaque
32-bit value to a dummy target address in host memory.  This is
sufficient to trigger the associated write of the completions to host
memory.

Allocate a dummy target address when enabling MSI-X on a PCI device,
and map all interrupts to this target address by default.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Select preferred operating mode
Michael Brown [Mon, 6 Oct 2025 13:04:18 +0000 (14:04 +0100)] 
[gve] Select preferred operating mode

Select a preferred operating mode from those advertised as supported
by the device, falling back to the oldest known mode (GQI-QPL) if
no modes are advertised.

Since there are devices in existence that support only QPL addressing,
and since we want to minimise code size, we choose to always use a
single fixed ring buffer even when using raw DMA addressing.  Having
paid this penalty, we therefore choose to prefer QPL over RDA since
this allows the (virtual) hardware to minimise the number of page
table manipulations required.  We similarly prefer GQI over DQO since
this minimises the amount of work we have to do: in particular, the RX
descriptor ring contents can remain untouched for the lifetime of the
device and refills require only a doorbell write.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Add support for out-of-order queues
Michael Brown [Mon, 6 Oct 2025 13:04:11 +0000 (14:04 +0100)] 
[gve] Add support for out-of-order queues

Add support for the "DQO" out-of-order transmit and receive queue
formats.  These are almost entirely different in format and usage (and
even endianness) from the original "GQI" in-order transmit and receive
queues, and arguably should belong to a completely different device
with a different PCI ID.  However, Google chose to essentially crowbar
two unrelated device models into the same virtual hardware, and so we
must handle both of these device models within the same driver.

Most of the new code exists solely to handle the differences in
descriptor sizes and formats.  Out-of-order completions are handled
via a buffer ID ring (as with other devices supporting out-of-order
completions, such as the Xen, Hyper-V, and Amazon virtual NICs).  A
slight twist is that on the transmit datapath (but not the receive
datapath) the Google NIC provides only one completion per packet
instead of one completion per descriptor, and so we must record the
list of chained buffer IDs in a separate array at the time of
transmission.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Cancel pending transmissions when closing device
Michael Brown [Mon, 6 Oct 2025 12:06:06 +0000 (13:06 +0100)] 
[gve] Cancel pending transmissions when closing device

We cancel any pending transmissions when (re)starting the device since
any transmissions that were initiated before the admin queue reset
will not complete.

The network device core will also cancel any pending transmissions
after the device is closed.  If the device is closed with some
transmissions still pending and is then reopened, this will therefore
result in a stale I/O buffer being passed to netdev_tx_complete_err()
when the device is restarted.

This error has not been observed in practice since transmissions
generally complete almost immediately and it is therefore unlikely
that the device will ever be closed with transmissions still pending.
With out-of-order queues, the device seems to delay transmit
completions (with no upper time limit) until a complete batch is
available to be written out as a block of 128 bytes.  It is therefore
very likely that the device will be closed with transmissions still
pending.

Fix by ensuring that we have dropped all references to transmit I/O
buffers before returning from gve_close().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[bnxt] Handle link related async events 1535/head
Joseph Wong [Thu, 18 Sep 2025 19:27:43 +0000 (12:27 -0700)] 
[bnxt] Handle link related async events

Handle async events related to link speed change, link speed config
change, and port phy config changes.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
2 months ago[gve] Allow for descriptor and completion lengths to vary by mode
Michael Brown [Mon, 29 Sep 2025 14:00:11 +0000 (15:00 +0100)] 
[gve] Allow for descriptor and completion lengths to vary by mode

The descriptors and completions in the DQO operating mode are not the
same sizes as the equivalent structures in the GQI operating mode.
Allow the queue stride size to vary by operating mode (and therefore
to be known only after reading the device descriptor and selecting the
operating mode).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Rename GQI-specific data structures and constants
Michael Brown [Mon, 29 Sep 2025 13:58:42 +0000 (14:58 +0100)] 
[gve] Rename GQI-specific data structures and constants

Rename data structures and constants that are specific to the GQI
operating mode, to allow for a cleaner separation from other operating
modes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Allow for out-of-order buffer consumption
Michael Brown [Mon, 29 Sep 2025 11:41:06 +0000 (12:41 +0100)] 
[gve] Allow for out-of-order buffer consumption

We currently assume that the buffer index is equal to the descriptor
ring index, which is correct only for in-order queues.

Out-of-order queues will include a buffer tag value that is copied
from the descriptor to the completion.  Redefine the data buffers as
being indexed by this tag value (rather than by the descriptor ring
index), and add a circular ring buffer to allow for tags to be reused
in whatever order they are released by the hardware.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Add support for raw DMA addressing
Michael Brown [Fri, 26 Sep 2025 11:33:19 +0000 (12:33 +0100)] 
[gve] Add support for raw DMA addressing

Raw DMA addressing allows the transmit and receive descriptors to
provide the DMA address of the data buffer directly, without requiring
the use of a pre-registered queue page list.  It is modelled in the
device as a magic "raw DMA" queue page list (with QPL ID 0xffffffff)
covering the whole of the DMA address space.

When using raw DMA addressing, the transmit and receive datapaths
could use the normal pattern of mapping I/O buffers directly, and
avoid copying packet data into and out of the fixed queue page list
ring buffer.  However, since we must retain support for queue page
list addressing (which requires this additional copying), we choose to
minimise code size by continuing to use the fixed ring buffer even
when using raw DMA addressing.

Add support for using raw DMA addressing by setting the queue page
list base device address appropriately, omitting the commands to
register and unregister the queue page lists, and specifying the raw
DMA QPL ID when creating the TX and RX queues.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Add concept of a queue page list base device address
Michael Brown [Mon, 29 Sep 2025 11:04:13 +0000 (12:04 +0100)] 
[gve] Add concept of a queue page list base device address

Allow for the existence of a queue page list where the base device
address is non-zero, as will be the case for the raw DMA addressing
(RDA) operating mode.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Set descriptor and completion ring sizes when creating queues
Michael Brown [Mon, 29 Sep 2025 11:37:25 +0000 (12:37 +0100)] 
[gve] Set descriptor and completion ring sizes when creating queues

The "create TX queue" and "create RX queue" commands have fields for
the descriptor and completion ring sizes, which are currently left
unpopulated since they are not required for the original GQI-QPL
operating mode.

Populate these fields, and allow for the possibility that a transmit
completion ring exists (which will be the case when using the DQO
operating mode).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Add concept of operating mode
Michael Brown [Mon, 29 Sep 2025 10:46:15 +0000 (11:46 +0100)] 
[gve] Add concept of operating mode

The GVE family supports two incompatible descriptor queue formats:

  * GQI: in-order descriptor queues
  * DQO: out-of-order descriptor queues

and two addressing modes:

  * QPL: pre-registered queue page list addressing
  * RDA: raw DMA addressing

All four combinations (GQI-QPL, GQI-RDA, DQO-QPL, and DQO-RDA) are
theoretically supported by the Linux driver, which is essentially the
only public reference provided by Google.  The original versions of
the GVE NIC supported only GQI-QPL mode, and so the iPXE driver is
written to target this mode, on the assumption that it would continue
to be supported by all models of the GVE NIC.

This assumption turns out to be incorrect: Google does not deem it
necessary to retain backwards compatibility.  Some newer machine types
(such as a4-highgpu-8g) support only the DQO-RDA operating mode.

Add a definition of operating mode, and pass this as an explicit
parameter to the "configure device resources" admin queue command.  We
choose a representation that subtracts one from the value passed in
this command, since this happens to allow us to decompose the mode
into two independent bits (one representing the use of DQO descriptor
format, one representing the use of QPL addressing).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Remove separate concept of "packet descriptor"
Michael Brown [Mon, 29 Sep 2025 13:45:32 +0000 (14:45 +0100)] 
[gve] Remove separate concept of "packet descriptor"

The Linux driver occasionally uses the terminology "packet descriptor"
to refer to the portion of the descriptor excluding the buffer
address.  This is not a helpful separation, and merely adds
complexity.

Simplify the code by removing this artifical separation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[gve] Parse option list returned in device descriptor
Michael Brown [Thu, 25 Sep 2025 13:42:19 +0000 (14:42 +0100)] 
[gve] Parse option list returned in device descriptor

Provide space for the device to return its list of supported options.
Parse the option list and record the existence of each option in a
support bitmask.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 months ago[bnxt] Add error recovery support 1508/head
Joseph Wong [Fri, 29 Aug 2025 10:02:00 +0000 (10:02 +0000)] 
[bnxt] Add error recovery support

Add support to advertise adapter error recovery support to the
firmware.  Implement error recovery operations if adapter fault is
detected.  Refactor memory allocation to better align with probe and
open functions.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
3 months ago[efi] Use current boot option as a fallback for obtaining the boot URI
Michael Brown [Thu, 28 Aug 2025 14:35:00 +0000 (15:35 +0100)] 
[efi] Use current boot option as a fallback for obtaining the boot URI

Some systems (observed with a Lenovo X1) fail to populate the loaded
image device path with a Uri() component when performing a UEFI HTTP
boot, instead creating a broken loaded image device path that
represents a DHCP+TFTP boot that has not actually taken place.

If no URI is found within the loaded image device path, then fall back
to looking for a URI within the current boot option.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
3 months ago[efi] Add ability to extract device path from an EFI load option
Michael Brown [Thu, 28 Aug 2025 14:34:32 +0000 (15:34 +0100)] 
[efi] Add ability to extract device path from an EFI load option

An EFI boot option (stored in a BootXXXX variable) comprises an
EFI_LOAD_OPTION structure, which includes some undefined number of EFI
device paths.  (The structure is extremely messy and awkward to parse
in C, but that's par for the course with EFI.)

Add a function to extract the first device path from an EFI load
option, along with wrapper functions to read and extract the first
device path from an EFI boot variable.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
3 months ago[libc] Add wcsnlen()
Michael Brown [Thu, 28 Aug 2025 14:12:41 +0000 (15:12 +0100)] 
[libc] Add wcsnlen()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
3 months ago[efi] Drag in MNP driver whenever SNP driver is present
Michael Brown [Wed, 27 Aug 2025 12:12:11 +0000 (13:12 +0100)] 
[efi] Drag in MNP driver whenever SNP driver is present

The chainloaded-device-only "snponly" driver already drags in support
for driving SNP, NII, and MNP devices, on the basis that the user
generally doesn't care which UEFI API is used and just wants to boot
from the same network device that was used to load iPXE.

The multi-device "snp" driver already drags in support for driving SNP
and NII devices, but does not drag in support for MNP devices.

There is essentially zero code size overhead to dragging in support
for MNP devices, since this support is always present in any iPXE
application build anyway (as part of the code to download
"autoexec.ipxe" prior to installing our own drivers).

Minimise surprise by dragging in support for MNP devices whenever
using the "snp" driver, following the same reasoning used for the
"snponly" driver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 months ago[bnxt] Update CQ doorbell type 1509/head
Joseph Wong [Wed, 13 Aug 2025 11:36:20 +0000 (12:36 +0100)] 
[bnxt] Update CQ doorbell type

Update completion queue doorbell to a non-arming type, since polling
is used.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
4 months ago[dwgpio] Use fdt_reg() to get GPIO port numbers
Michael Brown [Thu, 7 Aug 2025 14:43:58 +0000 (15:43 +0100)] 
[dwgpio] Use fdt_reg() to get GPIO port numbers

DesignWare GPIO port numbers are represented as unsized single-entry
regions.  Use fdt_reg() to obtain the GPIO port number, rather than
requiring access to a region cell size specification stored in the
port group structure.

This allows the field name "regs" in the port group structure to be
repurposed to hold the I/O register base address, which then matches
the common usage in other drivers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 months ago[fdt] Provide fdt_reg() for unsized single-entry regions
Michael Brown [Thu, 7 Aug 2025 14:41:42 +0000 (15:41 +0100)] 
[fdt] Provide fdt_reg() for unsized single-entry regions

Many region types (e.g. I2C bus addresses) can only ever contain a
single region with no size cells specified.  Provide fdt_reg() to
reduce boilerplate in this common use case.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 months ago[cmdline] Show commands in alphabetical order
Michael Brown [Wed, 6 Aug 2025 15:29:32 +0000 (16:29 +0100)] 
[cmdline] Show commands in alphabetical order

Commands were originally ordered by functional group (e.g. keeping the
image management commands together), with arrays used to impose a
functionally meaningful order within the group.

As the number of commands and functional groups has expanded over the
years, this has become essentially useless as an organising principle.
Switch to sorting commands alphabetically (using the linker table
mechanism).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 months ago[digest] Treat inability to acquire an image as a fatal error
Michael Brown [Wed, 6 Aug 2025 13:54:30 +0000 (14:54 +0100)] 
[digest] Treat inability to acquire an image as a fatal error

The "md5sum" and "sha1sum" commands were originally intended solely as
debugging utilities, and would return success (with a warning message)
even if the specified images did not exist.

To minimise surprise and to be consistent with other commands, treat
the inability to acquire an image as a fatal error.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 months ago[digest] Add "--set" option to store digest value in a setting
Michael Brown [Wed, 6 Aug 2025 13:07:00 +0000 (14:07 +0100)] 
[digest] Add "--set" option to store digest value in a setting

Allow the result of a digest calculation to be stored in a named
setting.  This allows for digest verification in scripts using e.g.:

  set expected:hexraw cb05def203386f2b33685d177d9f04e3e3d70dd4
  sha1sum --set actual 1mb
  iseq ${expected} ${actual} || goto checksum_bad

Note that digest verification alone cannot be used to set the trusted
execution status of an image.  The only way to mark an image as
trusted is to use the "imgverify" command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
4 months ago[github] Extend sponsorship link
Michael Brown [Wed, 6 Aug 2025 12:31:00 +0000 (13:31 +0100)] 
[github] Extend sponsorship link

Add Christian Nilsson <nikize@gmail.com> as a project sponsorship
recipient, to reflect the enormous amount of time invested in
responding to issues and pull requests.

Signed-off-by: Michael Brown <mcb30@ipxe.org>