summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/firmware/pcbios
Commit message (Collapse)AuthorAgeFilesLines
* [bios] Add bin-x86_64-pcbios build platformMichael Brown2016-02-167-1995/+0Star
| | | | | | | | | | | | | | 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>
* [bios] Allow memmap.c to be compiled for x86_64Michael Brown2016-02-161-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Allow bios_console.c to be compiled for x86_64Michael Brown2016-02-161-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Use size_t when casting _text16_memsz and _data16_memszMichael Brown2016-02-161-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Use intptr_t when casting .text16 function pointersMichael Brown2016-02-163-7/+6Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Add support for injecting keypressesMichael Brown2015-12-231-38/+209
| | | | | | | | | | | | | | | | | | | When USB network card drivers are used, the BIOS' legacy USB capability is necessarily disabled since there is no way to share the host controller between the BIOS and iPXE. Commit 3726722 ("[usb] Add basic support for USB keyboards") added support allowing a USB keyboard to be used within iPXE. However, external code such as a PXE NBP has no way to utilise this support, and so a USB keyboard cannot be used to control a PXE NBP loaded from a USB network card. Add support for injecting keypresses from any iPXE console into the BIOS keyboard buffer. This allows external code such as a PXE NBP to function with a USB keyboard even after the BIOS' legacy USB capability has been disabled. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Add ANSI blink attributeChristian Nilsson2015-07-221-0/+6
| | | | | | | | | | | | Expose the high bit of the VGA text attribute byte via the ANSI SGR parameters 5 ("blink on") and 25 ("blink off"). Note that some video cards (and virtual machines) may display a high intensity background colour instead of blinking text. Signed-off-by: Christian Nilsson <nikize@gmail.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-023-3/+15
| | | | | | | | | | 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-021-1/+5
| | | | | | | | | | | | | | | Relicence files with kind permission from the following contributors: Alex Williamson <alex.williamson@redhat.com> Eduardo Habkost <ehabkost@redhat.com> Greg Jednaszewski <jednaszewski@gmail.com> H. Peter Anvin <hpa@zytor.com> Marin Hannache <git@mareo.fr> Robin Smidsrød <robin@smidsrod.no> Shao Miller <sha0.miller@gmail.com> Thomas Horsten <thomas@horsten.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-023-3/+15
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Support displaying and hiding cursorMichael Brown2014-08-061-0/+43
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Fix screen clearing on even more buggy BIOSesMichael Brown2014-03-211-1/+3
| | | | | | | | | | | | | | | | Some BIOSes (observed with a ProLiant DL360p Gen8 SE) perform no range checking whatsoever on the parameters passed to INT10,06 and will therefore happily write to an area beyond the end of video RAM. The area immediately following the video RAM tends to be the VGA BIOS ROM image. Overwriting the VGA BIOS leads to an interesting variety of crashes and reboots. Fix by specifying an exact width and height to be cleared, rather than passing in large values and relying upon the BIOS to truncate them to the appropriate range. Reported-by: Alex Davies <adavies@jumptrading.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Pass escape sequence context to ANSI escape sequence handlersMichael Brown2013-11-271-3/+9
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Work around bug in gcc >= 4.8Michael Brown2013-09-251-4/+5
| | | | | | | | | | | | | Commit 238050d ("[build] Work around bug in gcc >= 4.8") works around one instance of a bug in recent versions of gcc, in which "ebp" cannot be specified within an asm clobber list. Some versions of gcc seem to exhibit the same bug on other points in the codebase. Fix by changing all instances of "ebp" in a clobber list to use the push/pop %ebp workaround instead. Originally-implemented-by: Víctor Román Archidona <contacto@victor-roman.es> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Fix screen clearing on buggy BIOSesMichael Brown2013-04-171-1/+1
| | | | | | | | | | | | The implementation of INT 10,06 on some BIOSes (observed with both Hyper-V and a Dell OptiPlex 7010) seems to treat %dx=0xffff as a special value meaning "do absolutely nothing". Fix by using %dx=0xfefe, which should still be sufficient to cover any realistic screen size. Reported-by: John Clark <skyman@iastate.edu> Tested-by: John Clark <skyman@iastate.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pcbios] Inhibit all calls to INT 15,e820 and INT 15,e801 during POSTMichael Brown2013-03-111-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many BIOSes do not construct the full system memory map until after calling the option ROM initialisation entry points. For several years, we have added sanity checks and workarounds to accommodate charming quirks such as BIOSes which report the entire 32-bit address space (including all memory-mapped PCI BARs) as being usable RAM. The IBM x3650 takes quirky behaviour to a new extreme. Calling either INT 15,e820 or INT 15,e801 during POST doesn't just get you invalid data. We could cope with invalid data. Instead, these nominally read-only API calls manage to trash some internal BIOS state, with the result that the system memory map is _never_ constructed. This tends to confuse subsequent bootloaders and operating systems. [ GRUB 0.97 fails in a particularly amusing way. Someone thought it would be a good idea for memcpy() to check that the destination memory region is a valid part of the system memory map; if not, then memcpy() will sulk, fail, and return NULL. This breaks pretty much every use of memcpy() including, for example, those inserted implicitly by gcc to copy non-const initialisers. Debugging is _fun_ when a simple call to printf() manages to create an infinite recursion, exhaust the available stack space, and shut down the CPU. ] Fix by completely inhibiting calls to INT 15,e820 and INT 15,e801 during POST. We do now allow relocation during POST up to the maximum address returned by INT 15,88 (which seems so far to always be safe). This allows us to continue to have a reasonable size of external heap, even if the PMM allocation is close to the 1MB mark. The downside of allowing relocation during POST is that we may overwrite PMM-allocated memory in use by other option ROMs. However, the downside of inhibiting relocation, when combined with also inhibiting calls to INT 15,e820 and INT 15,e801, would be that we might have no external heap available: this would make booting an OS impossible and could prevent some devices from even completing initialisation. On balance, the lesser evil is probably to allow relocation during POST (up to the limit provided by INT 15,88). Entering iPXE during POST is a rare operation; on the even rarer systems where doing so happens to overwrite a PMM-allocated region, then there exists a fairly simple workaround: if the user enters iPXE during POST and wishes to exit iPXE, then the user must reboot. This is an acceptable cost, given the rarity of the situation and the simplicity of the workaround. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pcbios] Add extra debugging messages when unhiding iPXE from memoryMichael Brown2013-03-081-5/+15
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Update FSF mailing address in GPL licence textsMichael Brown2012-07-207-7/+14
| | | | | Suggested-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Recognise Page Up and Page Down keysMichael Brown2012-03-291-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Remove "log message" usage from interactive console defaultsMichael Brown2012-03-271-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Allow usage to be defined independently for each consoleMichael Brown2012-03-261-0/+8
| | | | | | | | | | | | | | | | | | | | | Add the concept of a "console usage", such as "standard output" or "debug messages". Allow usages to be associated with each console independently. For example, to send debugging output via the serial port, while preventing it from appearing on the local console: #define CONSOLE_SERIAL CONSOLE_USAGE_ALL #define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG ) If no usages are explicitly specified, then a default set of usages will be applied. For example: #define CONSOLE_SERIAL will have the same affect as #define CONSOLE_SERIAL CONSOLE_USAGE_ALL Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Set character attributes only when necessaryMichael Brown2012-03-221-0/+8
| | | | | | | | | | | | | | | | | | | There is no INT 10 call for "display character with attribute, advancing the cursor and scrolling the screen as necessary". We therefore make two INT 10 calls: INT 10,09 to write the character with its attribute at the current cursor position, and then INT 10,0e to (re)write the character (leaving the attribute unchanged), advance the cursor position and scroll as necessary. This confuses the serial-over-LAN console redirection feature provided by some BIOSes. Fix by performing the INT10,09 only when necessary to change the existing attribute. Reported-by: Itay Gazit <itaygazit@gmail.com> Tested-by: Itay Gazit <itaygazit@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Add facility for rudimentary keyboard mappingMichael Brown2011-03-161-2/+19
| | | | | | | Allow for remapping of ASCII characters returned by the BIOS, using a map consisting of (from,to) pairs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Use INT 16,11 instead of INT 16,01 to check for keystrokesMichael Brown2011-03-101-1/+1
| | | | | | | | INT 16,01 will discard some extended keystrokes on some BIOSes, making it impossible for iPXE to detect keypresses such as F12. Fix by using INT 16,11 instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Move include/console.h to include/ipxe/console.hMichael Brown2011-03-091-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Recognise scancodes for F5-F12 inclusiveMichael Brown2011-03-071-25/+24Star
| | | | | | | | | The function keys F5-F12 all conform to the same ANSI pattern as the other "special" keys that we currently recognise. Add these key definitions, and shrink the representation of the ANSI sequences in bios_console.c to compensate. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pcbios] Merge adjacent memory regions of same typeEduardo Habkost2011-02-171-2/+10
| | | | | | | | | | Some BIOSes can report multiple memory regions which may be adjacent and the same type. Since only the first region is used in the mboot.c32 layer it's possible to run out of memory when loading all of the boot modules. One may get around this problem by having iPXE merge these memory regions internally. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ioapi] Move get_memmap() to the I/O API groupPiotr Jaroszyński2010-08-162-3/+5
| | | | | | | | | pcbios specific get_memmap() is used by the b44 driver making all-drivers builds fail on other platforms. Move it to the I/O API group and provide a dummy implementation on EFI. Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [comboot] Propagate carry flag from COMBOOT APIStefan Hajnoczi2010-05-251-12/+0Star
| | | | | | | | | | | | COMBOOT API calls set the carry flag on failure. This was not being propagated because the COMBOOT interrupt handler used iret to return with EFLAGS restored from the stack. This patch propagates CF before returning from the interrupt. Reported-by: Geoff Lywood <glywood@vmware.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Marty Connor <mdc@etherboot.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pcbios] Always show INT 15,88 result under DEBUG=memmapMichael Brown2010-04-251-5/+5
| | | | | | | | Always call INT 15,88 even if we don't use the result. This allows DEBUG=memmap to show the complete result set returned by all of the INT 15 memory-map calls. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Use libflat to enable A20 line on each real-to-protected transitionMichael Brown2010-04-201-176/+0Star
| | | | | | | | | | | | | Use the shared code in libflat to perform the A20 transitions automatically on each transition from real to protected mode. This allows us to remove all explicit calls to gateA20_set(). The old warnings about avoiding automatically enabling A20 are essentially redundant; they date back to the time when we would always start hammering the keyboard controller without first checking to see if gate A20 was already enabled (which it almost always is). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Rename gPXE to iPXEMichael Brown2010-04-205-11/+11
| | | | | | | | | | | Access to the gpxe.org and etherboot.org domains and associated resources has been revoked by the registrant of the domain. Work around this problem by renaming project from gPXE to iPXE, and updating URLs to match. Also update README, LOG and COPYRIGHTS to remove obsolete information. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [e820mangler] Add missing CLC ins. for success pathShao Miller2009-11-211-0/+1
| | | | | | | The get_underlying_e820 function should return with CF unset on success. Reported-by: Timothy Stack <tstack@vmware.com> Signed-off-by: Marty Connor <mdc@etherboot.org>
* [legal] Add a selection of FILE_LICENCE declarationsMichael Brown2009-05-188-1/+17
| | | | | Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
* [pcbios] Don't use "lret $2" to return from an interruptH. Peter Anvin2009-04-152-11/+21
| | | | | | | | | | | | | Using "lret $2" to return from an interrupt causes interrupts to be disabled in the calling program, since the INT instruction will have disabled interrupts. Instead, patch CF on the stack and use iret to return. Interestingly, the original PC BIOS had this bug in at least one place. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Michael Brown <mcb30@etherboot.org>
* [i386] Add explicit flags and type on all .section declarationsMichael Brown2009-02-151-21/+18Star
| | | | | | | | | | | | | | | | | | | | | | | Try to avoid future problems caused by implicit section flags and/or type information by instituting a policy that all .section declarations must explicitly state the flags and type. Most of this change was achieved using perl -pi \ -e 's/".text"$/".text", "ax", \@progbits/ ; ' \ -e 's/".text16"$/".text16", "ax", \@progbits/ ; ' \ -e 's/".text16.null"$/".text16.null", "ax", \@progbits/ ; ' \ -e 's/".text16.data"$/".text16.data", "aw", \@progbits/ ; ' \ -e 's/".data"$/".data", "aw", \@progbits/ ; ' \ -e 's/".data16"$/".data16", "aw", \@progbits/ ; ' \ -e 's/".bss"$/".bss", "aw", \@nobits/ ; ' \ -e 's/".bss16"$/".bss16", "aw", \@nobits/ ; ' \ -e 's/".prefix"$/".prefix", "ax", \@progbits/ ; ' \ -e 's/".prefix.lib"$/".prefix.lib", "awx", \@progbits/ ; ' \ -e 's/".prefix.data"$/".prefix.data", "aw", \@progbits/ ; ' \ -e 's/".weak"$/".weak", "a", \@nobits/ ; ' \ `git grep -l '\.section'`
* [bios] Add F8 function key as a recognised BIOS keycodeMichael Brown2009-01-251-1/+3
|
* [pcbios] Add additional sanity check for bogus e820 mapMarty Connor2008-12-181-0/+7
| | | | | | | | | | At POST time some BIOSes return invalid e820 maps even though they indicate that the data is valid. We add a check that the first region returned by e820 is RAM type and declare the map to be invalid if it is not. This extends the sanity checks from 8b20e5d ("[pcbios] Sanity-check the INT15,e820 and INT15,e801 memory maps").
* [efi] Use EFI-native mechanism for accessing SMBIOS tableMichael Brown2008-12-052-491/+0Star
| | | | | | EFI provides a copy of the SMBIOS table accessible via the EFI system table, which we should use instead of manually scanning through the F000:0000 segment.
* [i386] Change [u]int32_t to [unsigned] int, rather than [unsigned] longMichael Brown2008-11-191-1/+1
| | | | | | This brings us in to line with Linux definitions, and also simplifies adding x86_64 support since both platforms have 2-byte shorts, 4-byte ints and 8-byte long longs.
* [build] Keep gcc 4.4 happyMichael Brown2008-11-181-6/+8
| | | | | gcc 4.4 adds another few warnings, and also seems to complain if we place %ebp in the clobber list for any inline asm.
* [settings] Add the notion of a "tag magic" to numbered settingsMichael Brown2008-10-301-4/+19
| | | | | | | | | | | | | | | | | | | Settings can be constructed using a dotted-decimal notation, to allow for access to unnamed settings. The default interpretation is as a DHCP option number (with encapsulated options represented as "<encapsulating option>.<encapsulated option>". In several contexts (e.g. SMBIOS, Phantom CLP), it is useful to interpret the dotted-decimal notation as referring to non-DHCP options. In this case, it becomes necessary for these contexts to ignore standard DHCP options, otherwise we end up trying to, for example, retrieve the boot filename from SMBIOS. Allow settings blocks to specify a "tag magic". When dotted-decimal notation is used to construct a setting, the tag magic value of the originating settings block will be ORed in to the tag number. Store/fetch methods can then check for the magic number before interpreting arbitrarily-numbered settings.
* [pcbios] Guard against register corruption in INT 15,e820 implementationsMichael Brown2008-10-232-3/+11
| | | | | | | | | | Someone at Dell must have a full-time job designing ways to screw up implementations of INT 15,e820. This latest gem is courtesy of a Dell Xanadu system, which arbitrarily decides to obliterate the contents of %esi. Preserve %esi, %edi and %ebp across calls to INT 15,e820, in case someone tries a variation on this trick in future.
* [uaccess] Formalise the uaccess APIMichael Brown2008-10-131-0/+1
| | | | | | The userptr_t is now the fundamental type that gets used for conversions. For example, virt_to_phys() is implemented in terms of virt_to_user() and user_to_phys().
* [ioapi] Remove old io.h file and switch all users over to <gpxe/io.h>Michael Brown2008-10-121-6/+6
|
* [i386] Simplify linker script and standardise linker-defined symbol namesMichael Brown2008-10-102-18/+18
| | | | | | | | | | | | | Reduce the number of sections within the linker script to match the number of practical sections within the output file. Define _section, _msection, _esection, _section_filesz, _section_memsz, and _section_lma for each section, replacing the mixture of symbols that previously existed. In particular, replace _text and _end with _textdata and _etextdata, to make it explicit within code that uses these symbols that the .text and .data sections are always treated as a single contiguous block.
* [pcbios] Allow for larger-than-20-byte buffers in e820mangler.SMichael Brown2008-09-291-14/+45
| | | | | | | | | | Although the E820 API allows for a caller to provide only a 20-byte buffer, there exists at least one combination (HP BIOS, 32-bit WinPE) that relies on information found only in the "extended attributes" field, which requires a 24-byte buffer. Allow for up to a 64-byte E820 buffer, in the hope of coping with future idiocies like this one.
* [pcbios] Print INT 15,E820 extended attributes, if presentMichael Brown2008-09-291-3/+43
| | | | | | | | | | | | | The ACPI specification defines an additional 4-byte field at offset 20 for an E820 memory map entry. This field is presumably optional, since generally E820 gets given only a 20-byte buffer to fill. However, the bits of this optional field are defined as: bit 0 : region is enabled bit 1 : region is non-volatile memory rather than RAM so it seems as though callers that pass in only a 20-byte buffer may be missing out on some rather important information.
* [pcbios] Save/restore %es in INT 15,e820Michael Brown2008-09-291-0/+2
| | | | | | | Our INT 15,e820 code was setting %es=%ss (as part of the "look ahead in the memory map" logic), but failing to restore %es afterwards. This is a serious bug, but wasn't affecting many platforms because almost all callers seem to set %es=%ss anyway.
* [pcbios] Fetch INT 15,e820 entry directly into our e820 cacheMichael Brown2008-09-251-19/+9Star
| | | | | | | | | | | | | | | | | | | | Some BIOSes require us to pass in not only the continuation value (in %ebx) as returned by the previous call to INT 15,e820 but also the unmodified buffer (at %es:%di) as returned by the previous call to INT 15,e820. Apparently, someone thought it would be a worthwhile optimisation to fill in only the low dword of the "length" field and the low byte of the "type field", assuming that the buffer would remain unaltered from the previous call. This problem was being triggered by the "peek ahead" logic in get_mangled_e820(), which would read the next entry into a temporary buffer in order to be able to guarantee terminating the map with %ebx=0 rather than CF=1. (Terminating with CF=1 upsets some Windows flavours, despite being documented legal behaviour.) Work around this problem by always fetching directly into our e820 cache; that way we can guarantee that the underlying call always sees the previous buffer contents (and the same buffer address).