Commit Graph

7253 Commits

Author SHA1 Message Date
Michael Brown f7fe2b319e [cachedhcp] Set current working URI to cached DHCP filename
For a UEFI HTTP boot, we set the current working URI based on the
loaded image device path.  The autoexec.ipxe script will be fetched
from the same directory as the iPXE binary itself.

For a BIOS or UEFI PXE boot, we do not explicitly set a current
working URI, but rely on the fact that registering the cached DHCP
settings block will cause the TFTP code to set the current working URI
to "tftp://${next-server}/".  The autoexec.ipxe script will therefore
be fetched from the default directory (which is most probably the root
directory) of the TFTP server.

When using a UEFI shim, the shim will always fetch iPXE from the same
directory as the shim itself.  This leads to a somewhat unintuitive
requirement for a UEFI PXE boot: the shim and iPXE must be placed in
the same directory, but the corresponding autoexec.ipxe script must be
placed in the root directory.

As with the loaded image device path for a UEFI HTTP boot, the
existence of a cached DHCP packet gives us a way to construct the URI
of our own binary.  We can therefore choose to use this to set the
current working URI, so that the autoexec.ipxe script may be placed in
the same directory as the iPXE binary itself.  This is the least
surprising location, and avoids the need for lengthy explanations in
documentation.

Choose to set the current working URI at the point that the cached
DHCP packet is recorded, rather than the point at which it is applied
and registered as a settings block.  This avoids some awkward corner
cases (such as failing to find a matching network device for the
DHCPACK), and naturally ensures that we retrieve the next-server
address and filename from the same DHCP packet.  We rely on the order
in which cached DHCP packets are recorded to impose a priority
ordering: later packets (e.g. PxeBSACK) will override earlier ones.

To avoid breaking existing setups that do place the autoexec.ipxe
script in the root directory, we modify the fetching logic to first
attempt to retrieve autoexec.ipxe from the current working URI, then
from the root directory of that URI.

As with commit a69afd7 ("[tftp] Use TFTP server URI only if no other
working URI is set"), this is technically a breaking change in
behaviour, but the new behaviour is almost certainly less surprising
than the existing behaviour.  Scripts that rely on the current working
URI being set to the root of the TFTP server can use absolute URIs
(i.e. add an initial slash): this is more explicit and will work on
iPXE builds both before and after this change.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-03-03 11:29:01 +00:00
Michael Brown 559282d5a7 [build] Use Markdown consistently within release notes
Pass both parts of the generated release notes through pandoc, to
ensure some consistency in terms of link styles and line lengths.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-03-02 22:19:52 +00:00
Michael Brown 3680a4ae52 [build] Add support for including a UEFI shim in filesystem images
Add support for loading iPXE via a UEFI shim in ISO and USB images.
Since the iPXE shim's default loader filename is currently "ipxe.efi"
for all CPU architectures, at most one architecture within an image
may use a shim.  (This limitation should be removed in the next signed
release of the iPXE shim.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-03-02 16:49:47 +00:00
Michael Brown 1fbc3bca70 [efi] Automatically open network device matching loaded image device path
It is unintuitive to have to include an "ifopen" at the start of an
autoexec.ipxe script.  Commit efe8126 ("[cachedhcp] Automatically open
network device matching cached DHCPACK") causes the chainloaded device
to be opened automatically, using the cached DHCPACK to identify the
chainloaded device.

In the case of a UEFI HTTP(S) boot, the firmware does not provide
access to the DHCPACK and we are forced to instead extract the very
limited amount of information encoded into the loaded image's device
path.

Mark the device matching the loaded image's device path to be opened
automatically, so that the chainloaded device will be opened in the
same way for both TFTP and HTTP(S) boots.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-03-02 00:08:18 +00:00
Michael Brown a69afd7435 [tftp] Use TFTP server URI only if no other working URI is set
We currently set the working URI to "tftp://${next-server}/" whenever
the value of the next-server setting changes.

Many years ago this was required for the default boot sequence, which
would treat the boot filename as a potentially relative URI.  Since
commit 481a217 ("[autoboot] Retain initial-slash (if present) when
constructing TFTP URIs"), the default boot sequence has always
constructed an absolute URI.

There is still a valid use case for setting the default working URI
based on the value of next-server: it allows command sequences such as

  dhcp && chain ${filename}

or

  set next-server 192.168.0.1
  chain myscript.ipxe

to work as expected.  Note that since "${filename}" may be a relative
path, it is necessary for the current working URI to be the root of
the TFTP server, i.e. "tftp://${next-server}/", rather than the full
path "tftp://${next-server}/${filename}".

In the case of a UEFI HTTP(S) boot, we already have a working URI set
on entry (to be the URI of the iPXE binary itself).  Running "dhcp"
would change this current working URI, which is quite unintuitive.

Similarly, once we start executing an image (e.g. a script), the
current working URI is set to the image's own URI, so that relative
URIs may be used in a script to download files relative to the
location of the script itself.  Running "dhcp" within the script may
or may not change the current working URI: it will happen to do so
only if the TFTP server address happens to change.  This is also
somewhat unintuitive.

Change the behaviour of the TFTP settings applicator to treat the TFTP
server URI as a fallback, to be used only if nothing else has already
set a current working URI.  This is technically a breaking change in
behaviour, but the new behaviour is almost certainly much less
surprising than the existing behaviour.  (Scripts that do genuinely
expect to acquire a new TFTP server address can use full URIs of the
form "tftp://${next-server}/...": this is more explicit and will work
on iPXE builds both before and after this change.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-03-01 19:47:29 +00:00
Michael Brown fa993d5242 [tls] Transmit a closure alert when closing the connection
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-27 13:25:45 +00:00
Michael Brown 4d0b0cd4c7 [tls] Respond to received closure alerts
TLS defines a mechanism for gracefully closing a connection via a
closure alert.  We currently ignore this alert since it is a warning
rather than an error, and warnings are allowed to be ignored.

In almost all cases, a higher-level protocol such as HTTP will already
give us the information required to know when the connection should be
closed.  In the very rare case of an HTTPS server that does not send a
Content-Length header and does not close the TCP connection, only the
closure alert indicates that the whole file has been retrieved.

Handle a received closure alert by gracefully closing the connection.

Reported-by: Tuomo Tanskanen <tuomo.tanskanen@est.tech>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-27 13:22:08 +00:00
Michael Brown efe8126372 [cachedhcp] Automatically open network device matching cached DHCPACK
It is unintuitive to have to include an "ifopen" at the start of an
autoexec.ipxe script.  Provide a mechanism for upper-layer drivers to
mark a network device to be opened automatically upon registration,
and do so for the device to which the cached DHCPACK is applied.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-26 13:11:57 +00:00
Michael Brown 879549da39 [dynui] Allow for duplicate shortcut keys
When searching for a shortcut key, search first from the currently
selected menu item and then from the start of the list.

This allows several ways for a shortcut key to be meaningfully used
multiple times within the same menu.  For example, two sections may
have the same shortcut key:

  item --key s --gap (S)ection 1
  item ...
  item ...
  item --key s --gap (S)ection 2
  item ...

With the above menu, repeated "s" keypresses would cycle through the
sections.

As another example, entries within different sections may have the
same shortcut keys.  For example:

  item --key d --gap (D)ebian
  item --key s debst Debian (s)table release
  item --key u debun Debian (u)nstable release
  item --key f --gap (F)edora
  item --key s fedst Fedora (s)table release
  item --key u fedun Fedora (u)nstable release

With the above menu, a shortcut key sequence such as "f", "s" can be
used to select an entry within a specific section, avoiding the need
to choose shortcut keys that are globally unique within the menu.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-26 12:28:50 +00:00
Joseph Wong ad748f0d92 [bnxt] Update link speed definitions
Add new link speed definitions and remove unused D3 Flow Control
definitions.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
2026-02-25 17:46:10 +00:00
Michael Brown 7ce5dbd76f [efi] Allow for the existence of multiple shim lock protocols
When multiple shims are present in the system (e.g. in a boot chain
such as UEFI -> iPXE shim -> iPXE -> distro shim -> distro kernel),
there may be more than one installed shim lock protocol.

There is no sensible way to identify which shim lock protocol belongs
to which shim.  The shim lock protocol is installed on an anonymous
handle that has no device path, no other form of identifier, and no
connection to any other handle or protocol instance installed by the
shim.

The shim does include some extremely convoluted logic whereby a second
shim will attempt to uninstall a shim lock protocol installed by an
earlier shim.  However, this logic is broken: the second shim calls
UninstallProtocolInterface() with the wrong handle and the wrong
protocol interface pointer.  This logic error is silently ignored
since shim does not bother to check the return status.

Experience shows that there is unfortunately no point in trying to get
a fix for this upstreamed into shim, or even in raising the issue with
the shim project.  We therefore work around the shim bug by calling
all instances of the shim lock protocol, rather than relying on shim
itself to ensure that only one such instance exists.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-25 17:15:05 +00:00
Michael Brown 596c84ce77 [efi] Support the EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE operation
Support getting the size of a TFTP file via the EFI PXE API, as
required for booting OpenBSD.

Debugged-by: Eric Radman <ericshane@eradman.com>
Tested-by: Eric Radman <ericshane@eradman.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-25 00:25:03 +00:00
Michael Brown b48965ae57 [xferbuf] Silently discard data written to a void data transfer buffer
Allow data to be successfully written (and discarded) to a void data
transfer buffer, rather than throwing an error.  This allows a void
data transfer buffer to be used when determining the length of a file
downloaded from a TFTP server that does not support the "tsize" option
defined in RFC 2349.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-25 00:19:20 +00:00
Michael Brown 3194c8ad0a [xferbuf] Record maximum required size
Record the maximum size required when writing into a data transfer
buffer.  This allows the maximum size to be determined even if
allocation fails (e.g. due to a fixed-size buffer or an out-of-memory
condition).

In the case of a fixed-size buffer (which may already be larger than
required), this allows the caller to determine the actual size used
for written data.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-25 00:00:28 +00:00
Michael Brown 9250a9091b [build] Create util/gensrvimg for building network boot server images
In the spirit of util/genfsimg, create a script util/gensrvimg that
can be used to install compiled iPXE binaries to a directory tree
suitable for copying to a TFTP or HTTP server.

The script detects the CPU architecture for each input file and
installs it into the appropriate subdirectory.  Top-level symlinks are
created for each filename, with earlier files taking precedence.

Signed binaries are detected and automatically placed into a Secure
Boot specific subdirectory, thereby allowing the reduced-feature
Secure Boot binaries to coexist with full-feature binaries in a single
installation directory tree.  An iPXE shim may be specified and will
be automatically installed alongside the signed binaries, with the
relevant symlink created for each signed binary.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-24 15:44:15 +00:00
Joseph Wong f0ceb70cb9 [bnxt] Fix memory leak in probe()
Fix potential memory leak in probe() if initialization fails after
HWRM memory has been allocated.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
2026-02-24 10:03:49 +00:00
Joseph Wong a6d393ecc8 [bnxt] Skip unnecessary calls for VFs
Add a check for VFs in HWRM backing store related functions to return
immediately as these function are not needed.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
2026-02-24 09:58:38 +00:00
Dexter Gerig 9443f7a2a7 [tls] Remove current time from client random bytes
TLS versions 1.2 and earlier define a 4-byte gmt_unix_time field as
part of the 32-byte ClientHello random data block, as a (minimal) form
of protection against a broken random number generator.  iPXE has
never set this field to a correct value.  Early versions had only
relative timers and so set this field to zero.  Commit 5da7123 ("[tls]
Include current time within the client random bytes") did set this
field to the current time, but neglected to use the correct byte
ordering.

TLS version 1.3 (defined in RFC 8446) omits the gmt_unix_time field
completely and just defines the whole 32-byte value as random data.

Simplify the code by using the approach defined in RFC 8446.

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-24 09:33:39 +00:00
Christian I. Nilsson 1b6d88d646 [ipv6] Obtain MTU setting from NDP
RA contains MTU setting, this is especially needed in some networks
which don't have a a full 1500 MTU link to IPv6 internet.  Mostly due
to some providers (such as Microsoft Azure) not having a working pMTUd
setup.

Signed-off-by: Christian I. Nilsson <nikize@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-23 23:38:18 +00:00
Joseph Wong 1eb571cef4 [bnxt] Remove access of deprecated link speed variables
Remove access of deprecated link speed variables for 5750x devices.
Update test flag to include CHIP_P5_PLUS when excluding access of
certain NVM variables.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
2026-02-23 12:58:44 +00:00
Joseph Wong a5e4bb98bf [bnxt] Fix typo in function declaration
Fix typo in function declaration.  Duplicate declaration of
bnxt_adv_cq_index().  Modified to include function declaration for
bnxt_adv_nq_index().

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
2026-02-23 12:52:55 +00:00
Joseph Wong df5957ccc9 [bnxt] Fix coding style
Ensure whitespace and indentation adhere to iPXE coding standards.
Fix vertical alignment of multi-line function calls.

No functional changes.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
2026-02-23 12:33:45 +00:00
Joseph Wong 9d6831bb07 [bnxt] Correct port index usage
Use port index value retrieved from the firmware when calling
bnxt_hwrm_queue_qportcfg() to retrieve the queue_id.  This function
is available for all devices.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
2026-02-23 12:27:53 +00:00
Michael Brown 2012ab71de [pxeprefix] Add a minimal iPXE NBP metadata header
There is no fixed structure for a PXE NBP: the format is just an
opaque block of executable code that is loaded into memory verbatim
and executed by jumping to the first byte.  It is consequently
impossible for external code to unambiguously identify a PXE NBP, or
to inspect any metadata about the NBP's functionality.

The first five bytes of an iPXE NBP are already fixed as being an ljmp
instruction that resets the code segment to 0x7c0 and continues
execution from the following byte.  We can extend this to include a
minimal header as follows:

    Offset    Content
    ------    -------
    0         ljmp instruction (0xea)
    1-2       ljmp offset (and therefore length of header)
    3-4       ljmp segment (0x07c0)
    5+        Metadata fields
    \_ 5      CPU architecture (0x32=i386, 0x64=x86_64)
    \_ 6-7    Magic value (0x18ae)

This is backwards-compatible to existing binaries (which effectively
have zero bytes of metadata following the ljmp instruction), and
allows for future expansion by appending metadata fields (with the
ljmp offset used to determine the overall header length and therefore
the presence of further fields).

In this initial version of the header, define a magic value (used to
differentiate an iPXE NBP from other binaries that happen to start
with an ljmp instruction), and a single-byte value that encodes
whether this binary is built for 32-bit or 64-bit CPUs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-22 23:23:37 +00:00
Michael Brown 47467538f0 [build] Use little-endian word values in genfsimg
The genfsimg script extracts 16-bit word values from binary files
using the POSIX-compatible subset of options to "od".  This subset
does not include the "--endian" option supported by GNU od.  The
16-bit values are therefore effectively extracted and compared as byte
sequences.  Since all quantities in PE files are little-endian, this
requires all literals to be written in a byte-reversed form.

Switch to implementing get_word() in a marginally less efficient way
(by issuing two separate calls to get_byte()), so that the value
returned is the real 16-bit word value.  This allows several of the
constants to be written in a more meaningful form (e.g. "8664" for
x86_64, "aa64" for AArch64, etc).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-22 21:32:14 +00:00
Michael Brown 9e0057a864 [build] Allow for generation of all release information
Allow for automatic generation of the release name, release title, and
release notes (derived from the relevant section of the changelog).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-20 15:23:05 +00:00
Michael Brown 8fb90cb403 [build] Allow for construction of a text file containing the version
Add a rule to construct bin/version.txt containing the version number,
to allow a GitHub Actions workflow to verify that a tagged release
embeds a version number that matches the tag.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-19 13:00:19 +00:00
Michael Brown 0cde7ce6df [build] Mark system logger as permitted for UEFI Secure Boot
Reported-by: Christian I. Nilsson <ChristianN@2PintSoftware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-19 12:21:45 +00:00
Michael Brown 2161e976cd [build] Include USB drivers in the all-drivers build by default
Including USB drivers has some unavoidable side effects.  With a BIOS
firmware, attaching the host controller drivers will necessarily
disable the SMM-based USB legacy support which emulates a PS/2
keyboard.  With a UEFI firmware, loading the host controller drivers
may disconnect some of the less compliant vendor USB device drivers.

We have historically erred on the side of caution and avoided
including any USB drivers in the all-drivers build.  Time has moved
on, USB NICs have become more common (especially for laptops, which
now rarely include physical Ethernet ports), and the UEFI Secure Boot
model makes it prohibitively difficult for users to compile their own
binaries to add support for non-default drivers.

Switch to including USB drivers by default in the all-drivers build.
Provide a fallback build target that matches the existing driver set
(i.e. excluding any USB drivers) and can be built using e.g.:

   make bin/ipxe-legacy.iso

   make bin-x86_64-efi/ipxe-legacy.efi

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-13 18:36:14 +00:00
Michael Brown ae8e23a452 [build] Handle all driver list construction via parserom.pl
Handle construction of the EFI, Linux, Xen, and VMBus driver build
rules via parserom.pl to ensure consistency.  In particular, this
allows those drivers to appear in the DRIVERS_SECBOOT list used to
filter out non-permitted drivers in a Secure Boot build.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-13 14:16:44 +00:00
Michael Brown c9158cb32c [build] Mark Xen HVM files as permitted for UEFI Secure Boot
The Xen netfront driver and the core architecture-independent files
such as xenstore.c and xenbus.c are already marked as permitted for
UEFI Secure Boot, but the x86-specific HVM driver (which attaches to
the PCI device and instantiates the Xen devices) is not.

Review the HVM-specific files and mark them as permitted for UEFI
Secure Boot.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-13 14:06:00 +00:00
Michael Brown 6dc991d078 [slirp] Disable warnings for uncleanly deprecated libslirp functions
libslirp introduced a new API for constructing polling lists, to
accommodate Windows platforms where a handle descriptor may be too
large for an int.

Older versions of libslirp do not have the new API calls, and the
older API calls were immediately marked as deprecated, with no
overlap.  We would therefore need to use #ifdef and always have some
code that is deliberately not compiled, depending on the version of
libslirp that we find on the user's system.  This is highly
undesirable.

Work around this by disabling the deprecation warning (which is what
libslirp itself does for the portions of its code that necessarily
touch the deprecated functions).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-12 15:47:32 +00:00
Michael Brown 25429d952d [build] Include PCI drivers only in BIOS and UEFI builds
We currently have no PCI bus abstractions for Linux userspace or for
RISC-V SBI.  Limit PCI drivers to being included in the all-drivers
build only for BIOS and UEFI platforms.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-12 13:29:06 +00:00
Michael Brown 3f12b8b1cf [build] Include devicetree drivers in the SBI all-drivers build
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-12 13:29:06 +00:00
Michael Brown 81da1a1b6c [dt] Add DT_ROM() and DT_ID() macros
Add DT_ROM() and DT_ID() macros following the pattern for PCI_ROM()
and PCI_ID(), to allow for the possibility of including devicetree
network devices within the "all-drivers" build of iPXE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-12 13:29:06 +00:00
Michael Brown 5669c4d52e [build] Include Xen and Hyper-V drivers only in x86 BIOS and UEFI builds
The Xen and Hyper-V drivers cannot be included in the Linux userspace
build since they require MMIO accesses.  Limit these drivers to being
included in the all-drivers build only for BIOS and UEFI platforms.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-12 13:08:06 +00:00
Michael Brown 0992d9b560 [build] Include Linux network drivers in the Linux all-drivers build
Include all three of the Linux-specific network drivers (af_packet,
slirp, and tap) in the all-drivers Linux userspace build.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-12 12:50:18 +00:00
Michael Brown 6e56f7ff25 [linux] Remove unused can_probe field from driver definition
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-12 12:50:18 +00:00
Michael Brown 8a1dd58502 [build] Include ISA drivers only in 32-bit BIOS builds
ISA hardware is vanishingly unlikely to be encountered in anything
other than pre-64-bit x86 hardware with a BIOS firmware.  Exclude the
ISA drivers from all other builds.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-12 11:44:37 +00:00
Michael Brown cf350b8eb7 [build] Filter out non-permitted drivers for UEFI Secure Boot
The all-drivers targets (e.g. ipxe.efi) cannot currently be used in a
Secure Boot build since the permissibility check will (correctly) fail
due to the inclusion of non-permitted drivers.

In a Secure Boot build, filter the all-drivers list to include only
the subset of drivers that are marked as being permitted for UEFI
Secure Boot.

Note that this automatic filter is a convenience shortcut: it is not
the enforcement mechanism.  The filter exists only to provide a
meaningful definition for the otherwise unusable all-drivers targets
in Secure Boot builds.  The enforcement mechanism remains the
permissiblity check introduced in commit 1d5b1d9 ("[build] Fail Secure
Boot builds unless all files are permitted").

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-11 22:51:19 +00:00
Michael Brown 7a2817bbd7 [build] Drag in Xen and Hyper-V support via network device drivers
Include Xen and Hyper-V support in the all-drivers build by dragging
in the netfront and netvsc drivers, since these are the functional
drivers that provide network interfaces.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-11 22:02:23 +00:00
Michael Brown 99a9e6e431 [build] Construct driver rules for USB devices
Parse USB_ROM() lines to create build rules to allow for e.g.

  make bin/smsc9500.usb

(i.e. using the driver name as a build target, rather than having to
use the source file name).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-11 17:34:33 +00:00
Michael Brown e783adcfd4 [build] Construct driver lists for each bus type
Include the underlying bus type (e.g. "pci" or "isa") within the lists
constructed to describe the available drivers, to allow for the
possibility that platforms may want to define a platform-specific
subset of drivers to be present in the all-drivers build.  For
example, non-x86 platforms such as RISC-V SBI do not need to include
the ISA network drivers since the corresponding hardware cannot ever
be present on a RISC-V system.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-11 17:10:57 +00:00
Michael Brown 1523512198 [build] Allow PCI_ROM() and ISA_ROM() to span multiple lines
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-11 16:28:41 +00:00
Michael Brown 4d6c8ab443 [usb] Add USB_ROM() and USB_ID() macros
Add USB_ROM() and USB_ID() macros following the pattern for PCI_ROM()
and PCI_ID(), to allow for the possibility of including USB network
devices within the "all-drivers" build of iPXE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-11 16:07:12 +00:00
Michael Brown 481e043116 [librm] Work around two errata in the 386's "popal" instruction
Detailed experiments show that at least one model of 386 CPU has a
previously undocumented errata in the "popal" instruction.
Specifically: when the stack-address size is 16 bits and the operand
size is 32 bits, the "popal" instruction will erroneously load the
high 16 bits of %esp from the value stored on the stack.

The "movl -20(%esp), %esp" instruction near the end of virt_call()
currently relies on the assumption that the high 16 bits of %esp will
already be zero, since they were set to zero by the "movzwl %bp, %esp"
instruction at the end of prot_to_real() and will not have been
subsequently modified by the "popal".  This 386 CPU errata invalidates
that assumption, with the result that we end up loading the stack
pointer from an essentially undefined memory location.

Fix by inserting a "movzwl %sp, %esp" after the "popal" to explicitly
zero the high 16 bits of %esp.

Inserting this instruction also happens to work around another (known
and documented) errata in the 386, in which the CPU may malfunction if
"popal" is followed immediately by an instruction that uses a base
address register to form an effective address.

Debugged-by: Jaromir Capik <jaromir.capik@email.cz>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-10 10:29:54 +00:00
Michael Brown cd9b44e574 [syslog] Allow port number to be specified for encrypted syslog server
The original implementation in commit 943b300 ("[syslog] Add basic
support for encrypted syslog via TLS") was based on examples found in
the rsyslog documentation rather than on RFC 5425, and unfortunately
used the default syslog port number 514 rather than the syslog-tls
port number 6514 defined in the RFC.

Extend parsing of the syslog server name to allow for an optional port
number (in the relatively intuitive format "server[:port]").  Retain
the existing (and incorrect) default port number to avoid breaking
backwards compatibility with existing setups.

Reported-by: Christian Nilsson <nikize@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-09 12:32:11 +00:00
Michael Brown 18fab8dd84 [loong64] Fix error identifier generation for LoongArch64
The initial code contribution from Loongson defined ASM_NO_PREFIX as
being "a" for this architecture.  This seems to result in small values
such as error line numbers being rendered as "$r0, <value>" rather
than just "<value>".

This seems to hit an undocumented behaviour path in the GNU assembler.
For some reason ".long $r0" is not treated as a syntax error but will
instead be treated as a zero value.  The net effect is therefore that
an extra zero value is emitted before the line number in the einfo
structure, which in turn causes the error information parser to see
all source code line numbers as zero.  (The overall structure remains
valid since the length and all string offsets are encoded within the
structure itself, so nothing breaks when a spurious extra integer
field is appended.)

Fix by setting ASM_NO_PREFIX to the empty string (as for RISC-V),
since there are no literal value prefixes anyway in LoongArch64
assembly.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-05 13:45:19 +00:00
Michael Brown 95e756569a [pci] Ignore invalid subordinate bus numbers
Some systems (observed on a Dell C6615) fail to correctly populate the
subordinate PCI bus number on some PCI bridges.  We do not currently
guard against this behaviour, causing us to subsequently scan through
a huge expanse of the PCI bus:dev.fn address range.

Fix by ignoring the subordinate bus number if it is lower than the
bridge's own bus number.

Reported-by: Anisse Astier <an.astier@criteo.com>
Reported-by: Ahmad Mahagna <ahmhad@nvidia.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-05 12:09:59 +00:00
Michael Brown c18d895704 [efi] Cache identified PCI root bridge I/O protocol handle
Reduce the overhead of PCI configuration space accesses (and the
verbosity of debug messages) by caching the identified PCI root bridge
I/O protocol handle for the most recently accessed PCI device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2026-02-04 14:10:27 +00:00