summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/interface
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into openslxopenslxSimon Rettberg2026-01-2829-834/+366Star
|\
| * [pci] Use linker tables for runtime selectable PCI APIsMichael Brown2025-11-242-271/+1Star
| | | | | | | | | | | | | | 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>
| * [pci] Allow PCI configuration space access mechanism to vary by rangeMichael Brown2025-11-241-48/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * [init] Show initialisation function names in debug messagesMichael Brown2025-07-156-0/+6
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [pxe] Use a weak symbol for isapnp_read_portMichael Brown2025-06-241-1/+1
| | | | | | | | | | | | | | Use a weak symbol for isapnp_read_port used in pxe_preboot.c, rather than relying on a common symbol. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uart] Allow for dynamically registered 16550 UARTsMichael Brown2025-06-221-3/+1Star
| | | | | | | | | | | | | | Use the generic UART driver-private data pointer, rather than embedding the generic UART within the 16550 UART structure. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uart] Allow for the existence of non-16550 UARTsMichael Brown2025-06-201-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * [memmap] Rename addr/last fields to min/max for clarityMichael Brown2025-05-231-3/+3
| | | | | | | | | | | | | | | | 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-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * [bios] Use generic external heap based on the system memory mapMichael Brown2025-05-192-248/+2Star
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [bios] Use memmap_describe() to find an external heap locationMichael Brown2025-05-161-16/+14Star
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [memmap] Use memmap_dump_all() to dump debug memory mapsMichael Brown2025-05-162-9/+6Star
| | | | | | | | | | | | | | | | There are several places where get_memmap() is called solely to produce debug output. Replace these with calls to memmap_dump_all() (which will be a no-op unless debugging is enabled). Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [bios] Describe umalloc() heap as an in-use memory areaMichael Brown2025-05-163-12/+40
| | | | | | | | | | | | | | Use the concept of an in-use memory region defined as part of the system memory map API to describe the umalloc() heap. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [bios] Update to use the generic system memory map APIMichael Brown2025-05-163-63/+97
| | | | | | | | | | | | | | | | 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>
| * [bios] Rename memmap.c to int15.cMichael Brown2025-05-141-0/+0
| | | | | | | | | | | | | | Create namespace for an architecture-independent memmap.c by renaming the BIOS-specific memmap.c to int15.c. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [build] Formalise mechanism for accessing absolute symbolsMichael Brown2025-05-092-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a position-dependent executable, where all addresses are fixed at link time, we can use the standard technique as documented by GNU ld to get the value of an absolute symbol, e.g.: extern char _my_symbol[]; printf ( "Absolute symbol value is %x\n", ( ( int ) _my_symbol ) ); This technique may not work in a position-independent executable. When dynamic relocations are applied, the runtime addresses will no longer be equal to the link-time addresses. If the code to obtain the address of _my_symbol uses PC-relative addressing, then it will calculate the runtime "address" of the absolute symbol, which will no longer be equal the the link-time "address" (i.e. the correct value) of the absolute symbol. Define macros ABS_SYMBOL(), ABS_VALUE_INIT(), and ABS_VALUE() that provide access to the correct values of absolute symbols even in position-independent code, and use these macros wherever absolute symbols are accessed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Generalise librm's virt_offset mechanism for RISC-VMichael Brown2025-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The virtual offset memory model used for i386-pcbios and x86_64-pcbios can be generalised to also cover riscv32-sbi and riscv64-sbi. In both architectures, the 32-bit builds will use a circular map of the 32-bit address space, and the 64-bit builds will use an identity map for the relevant portion of the physical address space, with iPXE itself placed in the negative (kernel) address space. Generalise and document the virt_offset mechanism, and set it as the default for both PCBIOS and SBI platforms. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [build] Constrain PHYS_CODE() and REAL_CODE() to use i386 registersMichael Brown2025-05-082-5/+5
| | | | | | | | | | | | | | | | | | Inline assembly using PHYS_CODE() or REAL_CODE() must use the "R" constraint rather than the "r" constraint to ensure that the compiler chooses registers that will be valid for the 32-bit or 16-bit assembly code fragment. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Reduce scope of included uaccess.h headerMichael Brown2025-04-301-1/+0Star
| | | | | | | | | | | | | | | | | | The uaccess.h header is no longer required for any code that touches external ("user") memory, since such memory accesses are now performed through pointer dereferences. Reduce the number of files including this header. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Remove redundant copy_from_user() and copy_to_user()Michael Brown2025-04-309-0/+9
| | | | | | | | | | | | | | Remove the now-redundant copy_from_user() and copy_to_user() wrapper functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [comboot] Remove userptr_t from COM32 API implementationMichael Brown2025-04-291-6/+6
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [comboot] Remove userptr_t from COMBOOT API implementationMichael Brown2025-04-281-39/+21Star
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [reboot] Generalise warm reboot indicator to a flags bitmaskMichael Brown2025-04-281-5/+5
| | | | | | | | | | | | | | Allow for the possibility of additional reboot types by extending the reboot() function to use a flags bitmask rather than a single flag. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [fbcon] Remove userptr_t from framebuffer console driversMichael Brown2025-04-251-20/+17Star
| | | | | | | | | | | | | | | | | | | | | | | | Simplify the framebuffer console drivers by assuming that the raw framebuffer, character cell array, background picture, and glyph data are all directly accessible via pointer dereferences. In particular, this avoids the need to copy each glyph during drawing: the VESA framebuffer driver can simply return a pointer to the glyph data stored in the video ROM. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [pxe] Remove userptr_t from PXE file API implementationMichael Brown2025-04-251-37/+17Star
| | | | | | | | | | | | | | Simplify the PXE file API implementation by assuming that all string buffers are directly accessible via pointer dereferences. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [pxe] Remove userptr_t from PXE API call dispatcherMichael Brown2025-04-251-18/+10Star
| | | | | | | | | | | | | | | | | | Simplify the PXE API call dispatcher code by assuming that the PXE parameter block is accessible via a direct pointer dereference. This avoids the need for the API call dispatcher to know the size of the parameter block. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [block] Remove userptr_t from block device abstractionMichael Brown2025-04-241-9/+8Star
| | | | | | | | | | | | | | Simplify the block device code by assuming that all read/write buffers are directly accessible via pointer dereferences. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Remove trivial uses of userptr_tMichael Brown2025-04-243-15/+11Star
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [umalloc] Remove userptr_t from user memory allocationsMichael Brown2025-04-231-23/+19Star
| | | | | | | | | | | | | | | | Use standard void pointers for umalloc(), urealloc(), and ufree(), with the "u" prefix retained to indicate that these allocations are made from external ("user") memory rather than from the internal heap. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [smbios] Remove userptr_t from SMBIOS structure parsingMichael Brown2025-04-231-19/+17Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Simplify the SMBIOS structure parsing code by assuming that all structure content is fully accessible via pointer dereferences. In particular, this allows the convoluted find_smbios_structure() and read_smbios_structure() to be combined into a single function smbios_structure() that just returns a direct pointer to the SMBIOS structure, with smbios_string() similarly now returning a direct pointer to the relevant string. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [acpi] Remove userptr_t from ACPI table parsingMichael Brown2025-04-223-30/+30
| | | | | | | | | | | | | | Simplify the ACPI table parsing code by assuming that all table content is fully accessible via pointer dereferences. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Remove redundant read_user()Michael Brown2025-04-212-5/+6
| | | | | | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Replace real_to_user() with real_to_virt()Michael Brown2025-04-2110-26/+26
| | | | | | | | | | | | | | | | Remove the intermediate concept of a user pointer from real address conversion, leaving real_to_virt() as the directly implemented function. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Remove user_to_phys() and phys_to_user()Michael Brown2025-04-219-34/+34
| | | | | | | | | | | | | | | | Remove the intermediate concept of a user pointer from physical address conversions, leaving virt_to_phys() and phys_to_virt() as the directly implemented functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Remove redundant memcpy_user() and related string functionsMichael Brown2025-04-214-27/+23Star
| | | | | | | | | | | | | | | | | | | | The memcpy_user(), memmove_user(), memcmp_user(), memset_user(), and strlen_user() functions are now just straightforward wrappers around the corresponding standard library functions. Remove these redundant wrappers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Remove redundant userptr_add() and userptr_diff()Michael Brown2025-04-201-5/+5
| | | | | | | | | | | | | | | | | | The userptr_add() and userptr_diff() functions are now just straightforward wrappers around addition and subtraction. Remove these redundant wrappers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [uaccess] Add explicit casts to and from userptr_t where neededMichael Brown2025-04-201-1/+1
| | | | | | | | | | | | | | Allow for the possibility of userptr_t becoming a pointer type by adding explicit casts where necessary. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [rng] Restore state of IRQ 8 and PIE when disabling entropy gatheringMichael Brown2025-03-141-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Legacy IRQ 8 appears to be enabled by default on some platforms. If iPXE selects the RTC entropy source, this will currently result in the RTC IRQ 8 being unconditionally disabled. This can break assumptions made by BIOSes or subsequent bootloaders: in particular, the FreeBSD loader may lock up at the point of starting its default 10-second countdown when it calls INT 15,86. Fix by restoring the previous state of IRQ 8 instead of disabling it unconditionally. Note that we do not need to disable IRQ 8 around the point of hooking (or unhooking) the ISR, since this code will be executing in iPXE's normal state of having interrupts disabled anyway. Also restore the previous state of the RTC periodic interrupt enable, rather than disabling it unconditionally. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [efi] Centralise definition of efi_cpu_nap()Michael Brown2024-09-131-57/+0Star
| | | | | | | | | | | | | | | | | | Define a cpu_halt() function which is architecture-specific but platform-independent, and merge the multiple architecture-specific implementations of the EFI cpu_nap() function into a single central efi_cpu_nap() that uses cpu_halt() if applicable. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [pci] Separate permission to probe buses from bus:dev.fn range discoveryMichael Brown2024-08-152-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UEFI device model requires us to not probe the PCI bus directly, but instead to wait to be offered the opportunity to drive devices via our driver service binding handle. We currently inhibit PCI bus probing by having pci_discover() return an empty range when using the EFI PCI I/O API. This has the unwanted side effect that scanning the bus manually using the "pciscan" command will also fail to discover any devices. Separate out the concept of being allowed to probe PCI buses from the mechanism for discovering PCI bus:dev.fn address ranges, so that this limitation may be removed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* | Merge branch 'master' into openslxSimon Rettberg2024-04-121-0/+173
|\|
| * [build] Fix building on older versions of gccMichael Brown2024-03-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Older versions of gcc (observed with gcc 4.8.5 on CentOS 7) complain about having the label "err_ioremap" at the end of a compound statement in bios_mp_start_all(). The label is correctly placed, since it immediately follows the iounmap() that would be required to undo a successful ioremap() in the non-error case. Fix by adding an explicit "return" immediately after the label. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [bios] Provide a multiprocessor API for BIOSMichael Brown2024-03-151-0/+172
| | | | | | | | | | | | | | | | Provide an implementation of the iPXE multiprocessor API for BIOS, based on sending broadcast INIT and SIPI interprocessor interrupts to start up all application processors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* | Merge branch 'aqc1xx' into openslxSimon Rettberg2024-04-126-119/+186
|\|
| * [block] Allow for additional SAN boot parameters alongside filenameMichael Brown2024-03-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The drive specification alone does not necessarily contain enough information to perform a SAN boot (or local disk boot) under UEFI. If the next-stage bootloader is installed in the EFI system partition under a non-standard name (e.g. "\EFI\debian\grubx64.efi") then this explicit boot filename must also be specified. Generalise this concept to use a "SAN boot configuration parameters" structure (currently containing only the optional explicit boot filename), to allow for easy expansion to provide other parameters such as the partition UUID or volume label. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [block] Use drive number as debug message stream IDMichael Brown2024-03-041-101/+109
| | | | | | | | | | | | | | | | | | | | | | | | We currently use the SAN device pointer as the debug message stream identifier. This pointer is not always available: for example, when booting from a local disk there is no underlying SAN device. Switch to using the drive number as the debug message colour stream identifier, so that all block device debug messages may be colourised consistently. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [efi] Fix hang during ExitBootServices()Ross Lagerwall2024-01-311-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ExitBootServices() invokes efi_shutdown_hook(), there may be nothing to generate an interrupt since the timer is disabled in the first step of ExitBootServices(). Additionally, for VMs OVMF masks everything from the PIC (except the timer) by default. This means that calling cpu_nap() may hang indefinitely. This was seen in practice in netfront_reset() when running in a VM on XenServer. Fix this by skipping the halt if an EFI shutdown is in progress. Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [build] Fix building with newer binutilsMichael Brown2024-01-142-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Newer versions of the GNU assembler (observed with binutils 2.41) will complain about the ".arch i386" in files assembled with "as --64", with the message "Error: 64bit mode not supported on 'i386'". In files such as stack.S that contain no instructions to be assembled, the ".arch i386" is redundant and may be removed entirely. In the remaining files, fix by moving ".arch i386" below the relevant ".code16" or ".code32" directive, so that the assembler is no longer expecting 64-bit instructions to be used by the time that the ".arch i386" directive is encountered. Reported-by: Ali Mustakim <alim@forwardcomputers.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [build] Remove unnecessary ".text" directivesMichael Brown2024-01-141-1/+0Star
| | | | | | | | | | | | | | | | | | The .text directive is entirely redundant when followed by a .section directive giving an explicit section name and attributes. Remove these unnecessary directives to simplify the code. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [smbios] Support scanning for the 64-bit SMBIOS3 entry pointMichael Brown2023-12-291-2/+53
| | | | | | | | | | | | | | | | | | | | Support scanning for the 64-bit SMBIOS3 entry point in addition to the 32-bit SMBIOS2 entry point. Prefer use of the 32-bit entry point if present, since this is guaranteed to be within accessible memory. Signed-off-by: Michael Brown <mcb30@ipxe.org>