summaryrefslogtreecommitdiffstats
path: root/src/core
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into openslxopenslxSimon Rettberg2026-01-2893-1210/+3847
|\
| * [build] Mark more reviewed files as permitted for UEFI Secure BootMichael Brown2026-01-141-0/+1
| | | | | | | | | | | | | | | | | | Mark dynamic keyboard map support and the "pciscan", "usbscan", and "time" commands as permitted for UEFI Secure Boot, on the basis that these features have previously been present in binaries signed by Microsoft. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [build] Mark known reviewed files as permitted for UEFI Secure BootMichael Brown2026-01-1411-0/+11
| | | | | | | | | | | | | | | | | | Some past security reviews carried out for UEFI Secure Boot signing submissions have covered specific drivers or functional areas of iPXE. Mark all of the files comprising these areas as permitted for UEFI Secure Boot. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [build] Mark core files as permitted for UEFI Secure BootMichael Brown2026-01-1460-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | Mark all files used in a standard build of bin-x86_64-efi/snponly.efi as permitted for UEFI Secure Boot. These files represent the core functionality of iPXE that is guaranteed to have been included in every binary that was previously subject to a security review and signed by Microsoft. It is therefore legitimate to assume that at least these files have already been reviewed to the required standard multiple times. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [malloc] Increase heap size to 4MBMichael Brown2026-01-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2d180ce ("[tcp] Update maximum window size to 2MB") increased the TCP window size to avoid filling the TCP window on typical modern links. The total heap size is only 512kB. Given that RX I/O buffers are typically subject to alignment constraints, it is plausible that we may be able to actually buffer only 256kB of data before having to discard queued out-of-order packets. On a low latency network, this behaviour is not a problem: the sender will rapidly retransmit the lost or discarded packets. On a high latency network, the sender's congestion control algorithm will end up calculating a congestion window that is substantially smaller than our advertised 2MB, which will result in a drastic reduction in actual throughput. We do not want to increase the heap size arbitrarily, since we still have the constraint that memory used by iPXE may be permanently lost to the operating system (depending on how the operating system is booted). However, the cost of keeping the heap size down to 512kB is no longer acceptable given that large downloads over high-speed wide-area networks are now routine. Increase the heap size from 512kB to 4MB. This should be sufficient to hold an entire 2MB TCP window for a single connection under most sensible conditions. For example: * 1460-byte MSS => 1436 packets => 2872kB of 2kB RX I/O buffers * 8960-byte MSS => 234 packets => 3744kB of 16kB RX I/O buffers The notable exception is that of a network where jumbo frames are in use, but the TCP connection ends up using a standard 1460-byte MSS. If this is found to be an issue in practice, then one possible solution would be to shrink (or reallocate) I/O buffers for out-of-order queued data. Experimentation shows that before this change, an induced latency of 25ms (representative of a typical connection to a public cloud provider) would cause the download speed to vary unpredictably between 2MB/s and 25MB/s. After this change, the speed in this test scenario remains consistently high at 25MB/s. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [spcr] Accept alternative type value for a 16550-compatible UARTMichael Brown2025-11-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * [acpi] Allow acpi_ioremap() to map a port I/O addressMichael Brown2025-11-051-0/+2
| | | | | | | | | | | | | | | | 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>
| * [spcr] Add support for the ACPI Serial Port Console Redirection tableMichael Brown2025-11-052-2/+164
| | | | | | | | | | | | | | | | | | | | | | 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>
| * [acpi] Add acpi_ioremap() to map an ACPI-described addressMichael Brown2025-11-051-0/+19
| | | | | | | | | | | | | | | | | | 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>
| * [uart] Make baud rate a property of the UARTMichael Brown2025-11-053-7/+14
| | | | | | | | | | | | | | | | 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>
| * [libc] Add wcsnlen()Michael Brown2025-08-281-3/+16
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdt] Provide fdt_reg() for unsized single-entry regionsMichael Brown2025-08-071-0/+49
| | | | | | | | | | | | | | | | 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>
| * [cmdline] Show commands in alphabetical orderMichael Brown2025-08-061-20/+5Star
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * [gpio] Add a framework for GPIO controllersMichael Brown2025-08-051-0/+165
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdt] Use phandle as device locationMichael Brown2025-08-041-51/+22Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Consumption of phandles will be in the form of locating a functional device (e.g. a GPIO device, or an I2C device, or a reset controller) by phandle, rather than locating the device tree node to which the phandle refers. Repurpose fdt_phandle() to obtain the phandle value (instead of searching by phandle), and record this value as the bus location within the generic device structure. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [serial] Explicitly initialise serial console UART to NULLMichael Brown2025-07-301-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | When debugging is enabled for the device tree or memory map parsing code, the active serial console UART variable will be accessed during early initialisation, before the .bss section has been zeroed. Place this variable in the .data section (by providing an explicit initialiser), so that reading this variable is well defined even during early initialisation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdt] Add ability to locate node by phandleMichael Brown2025-07-221-0/+51
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [init] Show initialisation function names in debug messagesMichael Brown2025-07-159-1/+11
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [riscv] Invalidate data cache on completed RX DMA buffersMichael Brown2025-07-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The data cache must be invalidated twice for RX DMA buffers: once before passing ownership to the DMA device (in case the cache happens to contain dirty data that will be written back at an undefined future point), and once after receiving ownership from the DMA device (in case the CPU happens to have speculatively accessed data in the buffer while it was owned by the hardware). Only the used portion of the buffer needs to be invalidated after completion, since we do not care about data within the unused portion. Update the DMA API to include the used length as an additional parameter to dma_unmap(), and add the necessary second cache invalidation pass to the RISC-V DMA API implementation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [dma] Use virtual addresses for dma_map()Michael Brown2025-07-081-3/+3
| | | | | | | | | | | | | | | | | | | | Cache management operations must generally be performed on virtual addresses rather than physical addresses. Change the address parameter in dma_map() to be a virtual address, and make dma() the API-level primitive instead of dma_phys(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [iobuf] Ensure I/O buffer data sits within unshared cachelinesMichael Brown2025-07-071-19/+19
| | | | | | | | | | | | | | | | | | | | | | On platforms where DMA devices are not in the same coherency domain as the CPU cache, we must ensure that DMA I/O buffers do not share cachelines with other data. Align the start and end of I/O buffers to IOB_ZLEN, which is larger than any cacheline size we expect to encounter. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdtcon] Add basic support for FDT-based system serial consoleMichael Brown2025-06-241-0/+108
| | | | | | | | | | | | | | | | Add support for probing a device based on the path or alias found in the "/chosen/stdout-path" node, and using a consequently instantiated UART as the default serial console. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [serial] Allow platform to specify mechanism for identifying consoleMichael Brown2025-06-231-5/+22
| | | | | | | | | | | | | | | | | | Allow the platform configuration to provide a mechanism for identifying the serial console UART. Provide two globally available mechanisms: "null" (i.e. no serial console), and "fixed" (i.e. use whatever is specified by COMCONSOLE in config/serial.h). Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uart] Allow for the existence of non-16550 UARTsMichael Brown2025-06-203-139/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the assumption that all platforms use a fixed number of 16550 UARTs identifiable by a simple numeric index. Create an abstraction allowing for dynamic instantiation and registration of any number of arbitrary UART models. The common case of the serial console on x86 uses a single fixed UART specified at compile time. Avoid unnecessarily dragging in the dynamic instantiation code in this use case by allowing COMCONSOLE to refer to a single static UART object representing the relevant port. When selecting a UART by command-line argument (as used in the "gdbstub serial <port>" command), allow the UART to be specified as either a numeric index (to retain backwards compatiblity) or a case-insensitive port name such as "COM2". Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uart] Remove ability to use frame formats other than 8n1Michael Brown2025-06-173-28/+9Star
| | | | | | | | | | | | | | | | | | | | In the context of serial consoles, the use of any frame formats other than the standard 8 data bits, no parity, and one stop bit is so rare as to be nonexistent. Remove the almost certainly unused support for custom frame formats. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdt] Allow paths and aliases to be terminated with separator charactersMichael Brown2025-06-111-9/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-permitted name characters such as a colon are sometimes used to separate alias names or paths from additional metadata, such as the baud rate for a UART in the "/chosen/stdout-path" property. Support the use of such alias names and paths by allowing any character not permitted in a property name to terminate a property or node name match. (This is a very relaxed matching rule that will produce false positive matches on invalid input, but this is unlikely to cause problems in practice.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdtmem] Limit relocation to 32-bit address spaceMichael Brown2025-06-111-3/+16
| | | | | | | | | | | | | | | | | | Devices with only 32-bit DMA addressing are relatively common even on systems with 64-bit CPUs. Limit relocation of iPXE to 32-bit address space so that I/O buffers and other DMA allocations will be accessible by 32-bit devices. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdt] Provide ability to locate the parent device nodeMichael Brown2025-05-301-1/+95
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [image] Use image name rather than pointer value in all debug messagesMichael Brown2025-05-261-4/+4
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdtmem] Ignore reservation regions with no fixed addressesMichael Brown2025-05-261-0/+4
| | | | | | | | | | | | | | Do not print an error message for unused reservation regions that have no fixed reserved address ranges. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [memmap] Allow explicit colour selection for memory map debug messagesMichael Brown2025-05-252-5/+5
| | | | | | | | | | | | | | | | | | | | | | Provide DBGC_MEMMAP() as a replacement for memmap_dump(), allowing the colour used to match other messages within the same message group. Retain a dedicated colour for output from memmap_dump_all(), on the basis that it is generally most useful to visually compare full memory dumps against previous full memory dumps. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [memmap] Rename addr/last fields to min/max for clarityMichael Brown2025-05-233-31/+32
| | | | | | | | | | | | | | | | Use the terminology "min" and "max" for addresses covered by a memory region descriptor, since this is sufficiently intuitive to generally not require further explanation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uheap] Expose external heap region directlyMichael Brown2025-05-221-22/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | We currently rely on implicit detection of the external heap region. The INT 15 memory map mangler relies on examining the corresponding in-use memory region, and the initrd reshuffler relies on performing a separate detection of the largest free memory block after startup has completed. Replace these with explicit public symbols to describe the external heap region. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uheap] Prevent allocation of blocks with zero physical addressesMichael Brown2025-05-221-2/+2
| | | | | | | | | | | | | | | | | | If the external heap ends up at the top of the system memory map then leave a gap after the heap to ensure that no block ends up being allocated with either a start or end address of zero, since this is frequently confusing to both code and humans. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdtmem] Allow iPXE to be relocated to the top of the address spaceMichael Brown2025-05-221-1/+2
| | | | | | | | | | | | | | Allow for relocation to a region at the very end of the physical address space (where the next address wraps to zero). Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdt] Allow an initrd to be specified when creating a device treeMichael Brown2025-05-211-15/+37
| | | | | | | | | | | | | | Allow an initrd location to be specified in our constructed device tree via the "linux,initrd-start" and "linux,initrd-end" properties. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [image] Use image replacement when executing extracted imagesMichael Brown2025-05-201-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use image_replace() to transfer execution to the extracted image, rather than calling image_exec() directly. This allows the original archive image to be freed immediately if it was marked as an automatically freeable image (e.g. via "chain --autofree"). In particular, this ensures that in the case of an archive image containing another archive image (such as an EFI zboot kernel wrapper image containing a gzip-compressed kernel image), the intermediate extracted image will be freed as early as possible, since extracted images are always marked as automatically freeable. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uheap] Add a generic external heap based on the system memory mapMichael Brown2025-05-192-0/+220
| | | | | | | | | | | | | | | | Add an implementation of umalloc() using the generalised model of a heap, placing the external heap in the largest usable region obtained from the system memory map. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [malloc] Allow heap to specify block and pointer alignmentsMichael Brown2025-05-191-31/+45
| | | | | | | | | | | | | | | | | | | | | | Size-tracked pointers allocated via umalloc() have historically been aligned to a page boundary, as have the edges of the hidden memory region covering the external heap. Allow the block and size-tracked pointer alignments to be specified as heap configuration parameters. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [malloc] Allow for the existence of multiple heapsMichael Brown2025-05-191-96/+172
| | | | | | | | | | | | | | Create a generic model of a heap as a list of free blocks with optional methods for growing and shrinking the heap. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [memmap] Remove now-obsolete get_memmap()Michael Brown2025-05-161-24/+0Star
| | | | | | | | | | | | | | All memory map users have been updated to use the new system memory map API. Remove get_memmap() and its associated definitions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [settings] Use memmap_describe() to construct memory map settingsMichael Brown2025-05-161-26/+30
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [bios] Update to use the generic system memory map APIMichael Brown2025-05-161-0/+25
| | | | | | | | | | | | | | | | Provide an implementation of the system memory map API based on the assorted BIOS INT 15 calls, and a temporary implementation of the legacy get_memmap() function using the new API. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdtmem] Update to use the generic system memory map APIMichael Brown2025-05-161-142/+128Star
| | | | | | | | | | | | | | | | | | Provide an implementation of the system memory map API based on the system device tree, excluding any memory outside the size of the accessible physical address space and defining an in-use region to cover the relocated copy of iPXE and the system device tree. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [memmap] Define an API for managing the system memory mapMichael Brown2025-05-161-0/+114
| | | | | | | | | | | | | | | | | | Define a generic system memory map API, based on the abstraction created for parsing the FDT memory map and adding a concept of hidden in-use memory regions as required to support patching the BIOS INT 15 memory map. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdtmem] Record size of accessible physical address spaceMichael Brown2025-05-141-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | The size of accessible physical address space will be required for the runtime memory map, not just at relocation time. Make this size an additional parameter to fdt_register() (matching the prototype for fdt_relocate()), and record the value for future reference. Note that we cannot simply store the limit in fdt_relocate() since it is called before .data is writable and before .bss is zeroed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [riscv] Avoid potentially overwriting the scratch area during relocationMichael Brown2025-05-131-17/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do not currently describe the temporary page table or the temporary stack as areas to be avoided during relocation of the iPXE image to a new physical address. Perform the copy of the iPXE image and zeroing of the .bss within libprefix.S, after we have no futher use for the temporary page table or the temporary initial stack. Perform the copy and registration of the system device tree in C code after relocation is complete and the new stack (within .bss) has been set up. This provides a clean separation of responsibilities between the RISC-V libprefix.S and the architecture-independent fdtmem.c. The prefix is responsible only for relocating iPXE to the new physical address returned from fdtmem_relocate(), and doesn't need to know or care where fdtmem.c is planning to place the copy of the device tree. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [riscv] Relocate to a safe physical address on startupMichael Brown2025-05-121-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On startup, we may be running from read-only memory. We need to parse the devicetree to obtain the system memory map, and identify a safe location to which we can copy our own binary image along with a stashed copy of the devicetree, and then transfer execution to this new location. Parsing the system memory map realistically requires running C code. This in turn requires a small temporary stack, and some way to ensure that symbol references are valid. We first attempt to enable paging, to make the runtime virtual addresses equal to the link-time virtual addresses. If this fails, then we attempt to apply the compressed relocation records. Assuming that one of these has worked (i.e. that either the CPU supports paging or that our image started execution in writable memory), then we call fdtmem_relocate() to parse the system memory map to find a suitable relocation target address. After the copy we disable paging, jump to the relocated copy, re-enable paging, and reapply relocation records (if needed). At this point, we have a full runtime environment, and can transfer control to normal C code. Provide this functionality as part of libprefix.S, since it is likely to be shared by multiple prefixes. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fdtmem] Add ability to parse FDT memory map for a relocation addressMichael Brown2025-05-111-0/+357
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add code to parse the devicetree memory nodes, memory reservations block, and reserved memory nodes to construct an ordered and non-overlapping description of the system memory map, and use this to identify a suitable address to which iPXE may be relocated at runtime. We choose to place iPXE on a superpage boundary (as required by the paging code), and to use the highest available address within accessible memory. This mirrors the approach taken for x86 BIOS builds, where we have long assumed that any image format that we might need to support may require specific fixed addresses towards the bottom of the memory map, but is very unlikely to require specific fixed addresses towards the top of the memory map (since those addresses may not exist, depending on the amount of installed RAM). Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [riscv] Hold virtual address offset in the thread pointer registerMichael Brown2025-05-113-38/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | iPXE does not make use of any thread-local storage. Use the otherwise unused thread pointer register ("tp") to hold the current value of the virtual address offset, rather than using a global variable. This ensures that virt_offset can be made valid even during very early initialisation (when iPXE may be executing directly from read-only memory and so cannot update a global variable). Signed-off-by: Michael Brown <mcb30@ipxe.org>