summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/include/bits
Commit message (Collapse)AuthorAgeFilesLines
* [time] Add support for the ACPI power management timerMichael Brown2018-03-201-0/+1
| | | | | | | | Allow the ACPI power management timer to be used if enabled via TIMER_ACPI in config/timer.h. This provides an alternative timer on systems where the standard 8254 PIT is unavailable or unreliable. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [acpi] Make acpi_find_rsdt() a per-platform methodMichael Brown2017-05-231-0/+14
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Allow timer to be selected at runtimeMichael Brown2017-01-262-15/+1Star
| | | | | | | | | | | | | | | | | | | | | | Allow the active timer (providing udelay() and currticks()) to be selected at runtime based on probing during the INIT_EARLY stage of initialisation. TICKS_PER_SEC is now a fixed compile-time constant for all builds, and is independent of the underlying clock tick rate. We choose the value 1024 to allow multiplications and divisions on seconds to be converted to bit shifts. TICKS_PER_MS is defined as 1, allowing multiplications and divisions on milliseconds to be omitted entirely. The 2% inaccuracy in this definition is negligible when using the standard BIOS timer (running at around 18.2Hz). TIMER_RDTSC now checks for a constant TSC before claiming to be a usable timer. (This timer can be tested in KVM via the command-line option "-cpu host,+invtsc".) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cpuid] Provide cpuid_supported() to test for supported functionsMichael Brown2017-01-251-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [acpi] Add support for ACPI power offMichael Brown2016-07-111-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rng] Check for functioning RTC interruptMichael Brown2016-07-101-0/+1
| | | | | | | | | | | | | | | | | | | | | On some platforms (observed in a small subset of Microsoft Azure (Hyper-V) virtual machines), the RTC appears to be incapable of generating an interrupt via the legacy PIC. The RTC status registers show that a periodic interrupt has been asserted, but the PIC IRR shows that IRQ8 remains inactive. On such systems, iPXE will currently freeze during the "iPXE initialising devices..." message. Work around this problem by checking that RTC interrupts are being raised before returning from rtc_entropy_enable(). If no interrupt is seen within 100ms, then we assume that the RTC interrupt mechanism is broken. In these circumstances, iPXE will continue to initialise but any subsequent attempt to generate entropy will fail. In particular, HTTPS connections will fail with an error indicating that no entropy is available. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Generalise EFI entropy generation to non-x86 CPUsMichael Brown2016-05-041-1/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcpip] Do not fall back to using unoptimised TCP/IP checksummingMichael Brown2016-05-041-4/+2Star
| | | | | | | | Require architecture-specific code to make a deliberate choice to use the unoptimised generic_tcpip_continue_chksum() function, if there is no optimised version available. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [gdb] Add support for x86_64Michael Brown2016-03-221-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Use generic test_and_clear_bit() functionMichael Brown2016-03-161-19/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bitops] Add generic atomic bit test, set, and clear functionsMichael Brown2016-03-161-0/+94
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Support ioremap() for addresses above 4GB in a 64-bit buildMichael Brown2016-02-261-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ioapi] Split ioremap() out to a separate IOMAP APIMichael Brown2016-02-261-0/+12
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Add bin-x86_64-pcbios build platformMichael Brown2016-02-169-0/+128
| | | | | | | | | | | | | | Move most arch/i386 files to arch/x86, and adjust the contents of the Makefiles and the include/bits/*.h headers to reflect the new locations. This patch makes no substantive code changes, as can be seen using a rename-aware diff (e.g. "git show -M5"). This patch does not make the pcbios platform functional for x86_64; it merely allows it to compile without errors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Wait for and clear XenStore event before receiving dataMichael Brown2015-06-301-0/+19
| | | | | | | | | | | | | | | Older, out-of-tree Xen kernel modules (such as those provided with SuSE Linux Enterprise Server 11) do not clear the leftover "event pending" bit when opening an event channel. Consequently, no event is ever delivered to indicate that there is information in the XenStore ring buffer, and the system hangs shortly after loading the xen-platform-pci kernel module. Work around this problem by always waiting for the XenStore event channel to be signalled, and clearing the event before processing the received data. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [serial] Add general abstraction of a 16550-compatible UARTMichael Brown2015-06-292-0/+42
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13con] Add basic ability to log to a local disk via INT 13Michael Brown2015-05-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Several popular public cloud providers do not provide any sensible mechanism for obtaining debug output from an OS which is failing to boot. For example, Amazon EC2 provides the "Get System Log" facility, which occasionally deigns to report a random subset of the characters emitted via the VM's serial port, but usually returns only a blank screen. (Amazingly, this is still superior to the debugging facilities provided by Azure.) Work around these shortcomings by adding a console type which sends output to a magically detected raw disk partition, and including such a partition within any iPXE .usb-format image. To use this facility: - build an iPXE .usb image with CONSOLE_INT13 enabled - boot the cloud VM from this image - after the boot fails, attach the VM's boot disk to a second VM - from this second VM, use "less -f -R /dev/sdb3" (or similar) to view the iPXE output. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add EFI entropy sourceMichael Brown2015-04-141-0/+1
| | | | | Originally-implemented-by: Jarrod Johnson <jbjohnso@us.ibm.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite byte-swapping codeMichael Brown2015-03-021-0/+8
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-022-2/+6
| | | | | | | | | | These files cannot be automatically relicensed by util/relicense.pl since they either contain unusual but trivial contributions (such as the addition of __nonnull function attributes), or contain lines dating back to the initial git revision (and so require manual knowledge of the code's origin). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-025-5/+5
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Reduce size of memset()Michael Brown2015-02-171-1/+127
| | | | | | | | | As with memcpy(), we can reduce the code size (by an average of 0.2%) by giving the compiler more visibility into what memset() is doing, and by avoiding the "rep" prefix on short fixed-length sequences of string operations. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite string functionsMichael Brown2015-02-171-18/+0Star
| | | | | | | | | | | | Some of the C library string functions have an unknown provenance. Reimplement all such functions to avoid potential licensing uncertainty. Remove the inline-assembler versions of strlen(), memswap(), and strncmp(); these save a minimal amount of space (around 40 bytes in total) and are not performance-critical. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Add support for Hyper-V hypervisorMichael Brown2014-12-181-0/+1
| | | | | | | Add support for detecting and communicating with the Hyper-V hypervisor. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Add basic support for PV-HVM domainsMichael Brown2014-07-292-0/+165
| | | | | | | | | Add basic support for Xen PV-HVM domains (detected via the Xen platform PCI device with IDs 5853:0001), including support for accessing configuration via XenStore and enumerating devices via XenBus. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add flsll()Michael Brown2014-04-271-31/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add inline assembly implementation of flsl() using BSR instructionMichael Brown2014-04-241-0/+31
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [vesafb] Add VESA frame buffer consoleMichael Brown2013-11-281-0/+1
| | | | | | | | | | | The VESA frame buffer console uses the VESA BIOS extensions (VBE) to enumerate video modes, selects an appropriate mode, and then hands off to the generic frame buffer code. The font is extracted from the VGA BIOS, avoiding the need to provide an external font file. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Expose CPUID instruction via settings mechanismMichael Brown2013-08-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Allow CPUID values to be read using the syntax ${cpuid/<register>.<function>} For example, ${cpuid/2.0x80000001} will give the value of %ecx after calling CPUID with %eax=0x80000001. Values for <register> are encoded as %eax=0, %ebx=1, %ecx=2, %edx=3. The numeric encoding is more sophisticated than described above, allowing for settings such as the CPU model (obtained by calling CPUID with %eax=0x80000002-0x80000004 inclusive and concatenating the values returned in %eax:%ebx:%ecx:%edx). See the source code for details. The "cpuvendor" and "cpumodel" settings provide easy access to these more complex CPUID settings. This functionality is intended to complement the "cpuid" command, which allows for testing individual CPUID feature bits. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add "poweroff" commandMarin Hannache2013-07-151-0/+1
| | | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Convert external PXE API errors into iPXE platform-generated errorsMichael Brown2013-04-291-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [initrd] Add ability to reshuffle initrds into image list orderMichael Brown2012-11-121-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Relicense x86 string.hMichael Brown2012-11-121-19/+24
| | | | | | | No code from the original source remains within this file; relicense under GPL2+ with a new copyright notice. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Fix and externalise memswap()Michael Brown2012-11-121-15/+2Star
| | | | | | Make memswap() behave correctly if called with a length of zero. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Reduce overall code size by externalising strlen()Michael Brown2012-11-121-12/+2Star
| | | | | | Typical saving is 5-20 bytes in each file using strlen(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Reduce overall code size by externalising strncmp()Michael Brown2012-11-121-21/+2Star
| | | | | | Typical saving is 20-30 bytes in each file using strncmp(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Remove unnecessary "cld" instruction from memset()Michael Brown2012-11-121-11/+18
| | | | | | Saving is one byte per call to memset(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Convert memcpy() from a macro to an inline functionMichael Brown2012-11-121-4/+24
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Reduce overall code size by externalising memmove()Michael Brown2012-11-121-23/+25
| | | | | | Typical saving is 15-20 bytes in each file using memmove(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Remove obsolete implementation of memcpy()Michael Brown2012-11-121-12/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [sdi] Add support for SDI imagesMichael Brown2012-09-051-0/+1
| | | | | | | Add support (disabled by default) for booting .sdi images as used by Windows XP Embedded. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ioapi] Generalise i386 raw I/O API to x86Michael Brown2012-07-171-0/+14
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcpip] Add faster algorithm for calculating the TCP/IP checksumMichael Brown2012-06-281-0/+5
| | | | | | | | | The generic TCP/IP checksum implementation requires approximately 10 CPU clocks per byte (as measured using the TSC). Improve this to approximately 0.5 CPU clocks per byte by using "lodsl ; adcl" in an unrolled loop. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcpip] Allow for architecture-specific TCP/IP checksum routinesMichael Brown2012-06-271-0/+12
| | | | | | | Calculating the TCP/IP checksum on received packets accounts for a substantial fraction of the response latency. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add "cpuid" commandMichael Brown2012-06-071-2/+4
| | | | | | | Allow x86 CPU feature flags (such as support for 64-bit mode) to be checked using the "cpuid" command. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Merge i386 and x86_64 versions of errfile.hMichael Brown2012-06-061-0/+46
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Use correct constraint for byte-addressable registerMichael Brown2012-03-191-1/+1
| | | | | Reported-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Add big-integer library for RSA calculationsMichael Brown2012-03-141-0/+318
| | | | | | | | | | | | | | RSA requires modular exponentiation using arbitrarily large integers. Given the sizes of the modulus and exponent, all required calculations can be done without any further dynamic storage allocation. The x86 architecture allows for efficient large integer support via inline assembly using the instructions that take advantage of the carry flag (e.g. "adcl", "rcrl"). This implemention is approximately 80% smaller than the (more generic) AXTLS implementation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Add linux api headersPiotr Jaroszyński2010-08-191-0/+6
| | | | | Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [string] Use 64-bit registers in assembly memswap() on x86_64Joshua Oreman2010-08-011-4/+4
| | | | | | | | | An assembly version of memswap() is in an x86 word-length-agnostic header file, but it used 32-bit registers to store pointers, leading to memory errors responding to ARP queries on 64-bit systems. Signed-off-by: Joshua Oreman <oremanj@rwcr.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>