summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/interface/pcbios
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into openslxopenslxSimon Rettberg2026-01-2819-622/+259Star
|\
| * [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-153-0/+3
| | | | | | | | 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-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-081-3/+3
| | | | | | | | | | | | | | | | | | 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] 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>
| * [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>
| * [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>
| * [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] Replace real_to_user() with real_to_virt()Michael Brown2025-04-214-6/+6
| | | | | | | | | | | | | | | | 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-216-26/+26
| | | | | | | | | | | | | | | | 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-211-2/+2
| | | | | | | | | | | | | | | | | | | | 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>
| * [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-124-118/+180
|\|
| * [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>
| * [build] Fix building with newer binutilsMichael Brown2024-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * [pci] Require discovery of a PCI device when determining usable PCI APIsMichael Brown2023-11-021-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | The PCI cloud API (PCIAPI_CLOUD) currently selects the first PCI API that successfully discovers a PCI device address range. The ECAM API may discover an address range but subsequently be unable to map the configuration space region, which would result in the selected PCI API being unusable. Fix by instead selecting the first PCI API that can be successfully used to discover a PCI device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* | Merge branch 'master' into openslxSimon Rettberg2023-10-062-24/+36
|\|
| * [console] Avoid overlap between special keys and Unicode charactersMichael Brown2023-07-041-24/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The special key range (from KEY_MIN upwards) currently overlaps with the valid range for Unicode characters, and therefore prohibits the use of Unicode key values outside the ASCII range. Create space for Unicode key values by moving the special keys to the range immediately above the maximum valid Unicode character. This allows the existing encoding of special keys as an efficiently packed representation of the equivalent ANSI escape sequence to be maintained almost as-is. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [build] Inhibit linker warnings about an implied executable stackGeert Stappers2023-06-301-0/+1
| | | | | | | | | | | | Signed-off-by: Geert Stappers <stappers@stappers.it> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* | Merge branch 'master' into openslxSimon Rettberg2023-04-042-12/+42
|\|
| * [rng] Allow entropy source to be selected at runtimeMichael Brown2023-02-171-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in commit 3c83843 ("[rng] Check for several functioning RTC interrupts"), experimentation shows that Hyper-V cannot be trusted to reliably generate RTC interrupts. (As noted in commit f3ba0fb ("[hyperv] Provide timer based on the 10MHz time reference count MSR"), Hyper-V appears to suffer from a general problem in reliably generating any legacy interrupts.) An alternative entropy source is therefore required for an image that may be used in a Hyper-V Gen1 virtual machine. The x86 RDRAND instruction provides a suitable alternative entropy source, but may not be supported by all CPUs. We must therefore allow for multiple entropy sources to be compiled in, with the single active entropy source selected only at runtime. Restructure the internal entropy API to allow a working entropy source to be detected and chosen at runtime. Enable the RDRAND entropy source for all x86 builds, since it is likely to be substantially faster than any other source. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [rng] Check for several functioning RTC interruptsMichael Brown2023-02-111-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 74222cd ("[rng] Check for functioning RTC interrupt") added a check that the RTC is capable of generating interrupts via the legacy PIC, since this mechanism appears to be broken in some Hyper-V virtual machines. Experimentation shows that the RTC is sometimes capable of generating a single interrupt, but will then generate no subsequent interrupts. This currently causes rtc_entropy_check() to falsely detect that the entropy gathering mechanism is functional. Fix by checking for several RTC interrupts before declaring that it is a functional entropy source. Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [cachedhcp] Include VLAN tag in filter for applying cached DHCPACKMichael Brown2022-12-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When chainloading iPXE from a VLAN device, the MAC address within the cached DHCPACK will match the MAC address of the trunk device created by iPXE, and the cached DHCPACK will then end up being erroneously applied to the trunk device. This tends to break outbound IPv4 routing, since both the trunk and VLAN devices will have the same assigned IPv4 address. Fix by recording the VLAN tag along with the cached DHCPACK, and treating the VLAN tag as part of the filter used to match the cached DHCPACK against candidate network devices. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* | [vesafb] Map Unicode characters to CP437 if possibleSimon Rettberg2022-10-211-2/+134
| |
* | Merge branch 'master' into openslxSimon Rettberg2022-10-212-7/+206
|\|
| * [pci] Select PCI I/O API at runtime for cloud imagesMichael Brown2022-09-182-0/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pretty much all physical machines and off-the-shelf virtual machines will provide a functional PCI BIOS. We therefore default to using only the PCI BIOS, with no fallback to an alternative mechanism if the PCI BIOS fails. AWS EC2 provides the opportunity to experience some exceptions to this rule. For example, the t3a.nano instances in eu-west-1 have no functional PCI BIOS at all. As of commit 83516ba ("[cloud] Use PCIAPI_DIRECT for cloud images") we therefore use direct Type 1 configuration space accesses in the images built and published for use in the cloud. Recent experience has discovered yet more variation in AWS EC2 instances. For example, some of the metal instance types have multiple PCI host bridges and the direct Type 1 accesses therefore see only a subset of the PCI devices. Attempt to accommodate future such variations by making the PCI I/O API selectable at runtime and choosing ECAM (if available), falling back to the PCI BIOS (if available), then finally falling back to direct Type 1 accesses. This is implemented as a dedicated PCIAPI_CLOUD API, rather than by having the PCI core select a suitable API at runtime (as was done for timers in commit 302f1ee ("[time] Allow timer to be selected at runtime"). The common case will remain that only the PCI BIOS API is required, and we would prefer to retain the optimisations that come from inlining the configuration space accesses in this common case. Cloud images are (at present) disk images rather than ROM images, and so the increased code size required for this design approach in the PCIAPI_CLOUD case is acceptable. Signed-off-by: Michael Brown <mcb30@ipxe.org>
| * [bios] Allow pcibios_discover() to return an empty rangeMichael Brown2022-09-181-3/+5
| | | | | | | | | | | | | | Allow pcibios_discover() to return an empty range if the INT 1A,B101 PCI BIOS installation check call fails. Signed-off-by: Michael Brown <mcb30@ipxe.org>