summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* [test] Add self-tests for base16Michael Brown2013-07-122-0/+122
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcp] Fix comment to match code behaviourMichael Brown2013-07-121-1/+1
| | | | | Reported-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcp] Do not send RST for unrecognised connectionsMichael Brown2013-07-121-1/+0Star
| | | | | | | | | | | | On large networks with substantial numbers of monitoring agents, unwanted TCP connection attempts may end up flooding iPXE's ARP cache. Fix by silently dropping packets received for unrecognised TCP connections. This should not cause problems, since many firewalls will also silently drop any such packets. Reported-by: Jarrod Johnson <jarrod.b.johnson@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Use next-server from filename's settings blockMichael Brown2013-06-241-14/+25
| | | | | | | | | | | Locate the settings block containing the filename, and search only that settings block for the next-server address. This avoids problems caused by misconfigured DHCP servers which provide a next-server address (often defaulting to the DHCP server's own IP address) even when not providing a filename. Originally-implemented-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Work around bug in gcc >= 4.8Michael Brown2013-06-071-3/+5
| | | | | | | | | | | | | | | | | | | gcc 4.8 and 4.9 fail to compile pxe_call.c with the error "bp cannot be used in asm here". Other points in the codebase which use "ebp" in the asm clobber list do not seem to be affected. Unfortunately gcc provides no way to specify %ebp as an output register, so we cannot use this as a workaround. The only viable solution is to explicitly push/pop %ebp within the asm itself. This is ugly for two reasons: firstly, it may be unnecessary; secondly, it may cause gcc to generate invalid %esp-relative addresses if the asm happens to use memory operands. This specific block of asm uses no memory operands and so will not generate invalid code. Reported-by: Daniel P. Berrange <berrange@redhat.com> Reported-by: Christian Hesse <list@eworm.de> Originally-fixed-by: Christian Hesse <list@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bzimage] Fix spurious uninitialised-variable warning on some gcc versionsMichael Brown2013-06-051-0/+1
| | | | | Reported-by: Matthew Helton <mwhelton@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bzimage] Align initrd images to page boundaryMichael Brown2013-06-052-19/+16Star
| | | | | | | | | | | | | | | | | | | | Some versions of Linux apparently complain if initrds are not aligned to a page boundary. Fix by changing INITRD_ALIGN from 4 bytes to 4096 bytes. The amount of padding at the end of each initrd will now often be sufficient to allow the cpio header to be prepended without crossing an alignment boundary. The final location of the initrd may therefore end up being slightly higher than the post-shuffle location. bzimage_load_initrd() must therefore now copy the initrd body prior to copying the cpio header, otherwise the start of the initrd body may be overwritten by the cpio header. (Note that the guarantee that an initrd will never need to overwrite an initrd at a higher location still holds, since the overall length of each initrd cannot decrease as a result of adding a cpio header.) Reported-by: Dave Hansen <dave@sr71.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Accept OCSP responses containing multiple certificatesMichael Brown2013-05-292-13/+151
| | | | | | | | | | | | | | RFC2560 mandates that a valid OCSP response will contain exactly one relevant certificate. However, some OCSP responders include extraneous certificates. iPXE currently assumes that the first certificate in the OCSP response is the relevant certificate; OCSP checks will therefore fail if the responder includes the extraneous certificates before the relevant certificate. Fix by using the responder ID to identify the relevant certificate. Reported-by: Christian Stroehmeier <stroemi@mail.uni-paderborn.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Fix reopening of legacy-mode 8139 NICMichael Brown2013-05-261-3/+5
| | | | | | | | | | | | | | | realtek_destroy_ring() currently does nothing if the card is operating in legacy (pre-RTL8139C+) mode. In particular, the producer and consumer counters are incorrectly left holding their current values. Virtual hardware (e.g. the emulated RTL8139 in qemu and similar VMs) is tolerant of this behaviour, but real hardware will fail to transmit if the descriptors are not used in the correct order. Fix by resetting the producer and consumer counters in realtek_destroy_ring() even if the card is operating in legacy mode. Reported-by: Gelip <mrgelip@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Reset MAC address when asked to clear the "mac" settingMichael Brown2013-05-161-3/+11
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Add "chip" settingMichael Brown2013-05-161-26/+131
| | | | | Suggested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Add efidrv.cab target for UEFI Secure Boot signingMichael Brown2013-05-144-6/+17
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Provide "allXXXs" targets for all media on all platformsMichael Brown2013-05-142-8/+19
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Fix incorrect pointer offset in undiloader.SFrediano Ziglio2013-05-141-2/+2
| | | | | | | | | | | | | Commit 2422647 ("[prefix] Allow prefix to specify an arbitrary maximum address for relocation") introduced a regression into the UNDI ROM loader by preserving an extra register on the stack without modifying the %sp-relative addresses used in the routine. Fix by correcting the %sp-relative addresses to allow for the extra preserved variable. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Use $(eval) if availableMichael Brown2013-05-142-48/+113
| | | | | | | | | When the $(eval) function is available (in GNU make >= 3.80), we can evaluate many of the dynamically-generated Makefile rules directly. This avoids generating a few hundred Makefile fragments in the filesystem, and so speeds up the build process. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Report meaningful error when certificate chain validation failsMichael Brown2013-05-101-7/+5Star
| | | | | | | | | | | | | | | | | | If a certificate chain contains no certificate which can be validated as a standalone certificate (i.e. contains no trusted root certificates or previously-validated certificates) then iPXE will currently return a fixed error EACCES_UNTRUSTED. This masks the actual errors obtained when attempting to validate each certificate as a standalone certificate, and so makes troubleshooting difficult for the end user. Fix by instead returning the error obtained when attempting to validate the final certificate in the chain as a standalone certificate. This error is most likely (though not guaranteed) to represent the "real" problem. Reported-by: Sven Dreyer <sven@dreyer-net.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [smbios] Allow access to multiple instances of SMBIOS structuresMichael Brown2013-05-013-5/+10
| | | | | | | | | | | | | | | | | | | | | | | Extend the syntax for numerical SMBIOS settings from smbios/<type>.<offset>.<length> to smbios/[<instance>.]<type>.<offset>.<length> Where SMBIOS provides multiple structures with the same <type>, this extended syntax allows for access to structures other than the first. If <instance> is omitted then it will default to zero, giving access to the first instance (and so matching existing behaviour). The 16-bit SMBIOS handle (which is an alternative way to disambiguate multiple instances of the same type of structure) can be accessed, if required, using smbios/<instance>.<type>.2.2:uint16 Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [smbios] Allow access to unreferenced SMBIOS stringsMichael Brown2013-05-011-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | iPXE allows access to general SMBIOS settings using the syntax: smbios/<type>.<offset>.<length> This provides access to any fixed-offset field within an SMBIOS structure. This syntax is currently overloaded to interpret a zero <length> as meaning that the byte at <offset> contains a string index; this provides access to SMBIOS strings (which are not located at fixed offsets). The "OEM Strings" SMBIOS structure contains strings which are not referenced by any fixed string index field within the structure. iPXE currently provides no way to access these strings. Fix by overloading the syntax for numerical SMBIOS settings to interpret an <offset> of zero as implying that <length> contains a literal string index. The OEM Strings can then be accessed using: smbios/11.0.1 smbios/11.0.2 smbios/11.0.3 ... The actual byte at offset zero will always contain the structure type, which is already known since it must be specified in order to access the structure. There is thus no plausible existing use case for an offset of zero; overloading the syntax in this way should therefore not break compatibility with any existing scripts. The corner case where both <offset> and <length> are zero is undefined (and, for now, will simply return a "not found" error). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Eliminate settings "tag magic"Michael Brown2013-05-0111-170/+82Star
| | | | | | | Create an explicit concept of "settings scope" and eliminate the magic values used for numerical setting tags. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Defer packets when no transmit descriptors are availableMichael Brown2013-05-011-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Add netdev_tx_defer() to allow drivers to defer transmissionsMichael Brown2013-05-012-3/+91
| | | | | | | | Devices with small transmit descriptor rings may temporarily run out of space. Provide netdev_tx_defer() to allow drivers to defer packets for retransmission as soon as a descriptor becomes available. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcp] Remove obsolete bootp.h headerMichael Brown2013-05-011-230/+0Star
| | | | | Reported-by: Christian Helmuth <christian.helmuth@genode-labs.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Ensure EEPROM writes reach chip before starting udelay()Michael Brown2013-05-011-0/+3
| | | | | | | | | | | | | | | On some systems, it appears to be possible for writes to the EEPROM registers to be delayed for long enough that the EEPROM's setup and hold times are violated, resulting in invalid data being read from the EEPROM. Fix by inserting a PCI read cycle immediately after writes to RTL_9346CR, to ensure that the write has completed before starting the udelay() used to time the SPI bus transitions. Reported-by: Gelip <mrgelip@gmail.com> Tested-by: Gelip <mrgelip@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Report failure cause when unable to open payloadMichael Brown2013-04-301-4/+7
| | | | | | | | | | | | | | | | | Report the cause of the failure when we are unable to open the .mrom payload. There are two possible failure cases: - Unable to find a suitable memory BAR to borrow (e.g. if the NIC doesn't have a memory BAR that is at least as large as the expansion ROM BAR, or if the memory BAR has been assigned a 64-bit address which won't fit into the 32-bit expansion ROM BAR). This will be reported as "BABABABA". - Unable to find correct ROM image within the BAR. This will be reported as the address (within the borrowed BAR) at which we first fail to find a valid 55AA signature. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Allow reaction time between writing RTL_CAPR and reading RTL_CRMichael Brown2013-04-301-0/+3
| | | | | | | | | | | | | | Some older RTL8139 chips seem to not immediately update the RTL_CR.BUFE bit in response to a write to RTL_CAPR. This results in iPXE seeing a spurious zero-length received packet, and thereafter being out of sync with the hardware's RX ring offset. Fix by inserting an extra PCI read cycle after writing to RTL_CAPR, to give the chip time to react before we next read RTL_CR. Reported-by: Gelip <mrgelip@gmail.com> Tested-by: Gelip <mrgelip@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Convert external PXE API errors into iPXE platform-generated errorsMichael Brown2013-04-294-16/+27
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [errdb] Strip platform error code for non-platform-generated errorsMichael Brown2013-04-291-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Use ID word to detect EEPROM presenceMichael Brown2013-04-282-16/+42
| | | | | | | | | | | | | | | | | Some onboard RTL8169 NICs seem to leave the EEPROM pins disconnected. The existing is_valid_ether_addr() test will not necessarily catch this, since it expects a missing EEPROM to show up as a MAC address of 00:00:00:00:00:00 or ff:ff:ff:ff:ff:ff. When the EEPROM pins are floating the MAC address may read as e.g. 00:00:00:00:0f:00, which will not be detected as invalid. Check the ID word in the first two bytes of the EEPROM (which should have the value 0x8129 for all RTL8139 and RTL8169 chips), and use this to determine whether or not an EEPROM is present. Reported-by: Carl Karsten <carl@nextdayvideo.com> Tested-by: Carl Karsten <carl@nextdayvideo.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Default to short wchar_t in stddef.hMichael Brown2013-04-281-2/+2
| | | | | | | | sparse does not understand -fshort-wchar. Default to using uint16_t as a wchar_t if not explicitly specified by the compiler, to avoid large numbers of spurious warnings from sparse. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix dubious uses of bitwise operatorsMichael Brown2013-04-282-2/+2
| | | | | | Detected by sparse. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix uses of literal 0 as a NULL pointerMichael Brown2013-04-2813-24/+20Star
| | | | | | Detected using sparse. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Use -Wno-decl when running sparseMichael Brown2013-04-281-0/+1
| | | | | | | | | | Linker table entries must be non-static in order to avoid being completely optimised away by some versions of gcc. Use -Wno-decl to prevent sparse from warning about these, since the alternative would be to litter the code with otherwise unnecessary "extern" declarations. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Print bad MAC address in debug message when inferring no EEPROMMichael Brown2013-04-271-1/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [process] Mark process descriptor as static in PERMANENT_PROCESSMichael Brown2013-04-251-1/+1
| | | | | | There is no need for the process descriptor to be a global variable. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Avoid sparse undeclared symbol warning for PROVIDE_SYMBOL()Michael Brown2013-04-251-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Allow sparse to be invoked via "make C=1"Michael Brown2013-04-251-0/+9
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Define __WINT_TYPE__ if necessaryMichael Brown2013-04-251-0/+3
| | | | | | | | sparse does not define __WCHAR_TYPE__ or __WINT_TYPE__. We already define __WCHAR_TYPE__ if the compiler does not do so; do the same for __WINT_TYPE__. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Allow sparse to find compiler.hMichael Brown2013-04-251-1/+1
| | | | | | | | sparse seems to have problems finding compiler.h when specified as "-include compiler.h"; one possible explanation is that it ignores the include path. Fix by using "-include include/compiler.h". Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Use link-layer address as part of RNG seedMichael Brown2013-04-191-2/+11
| | | | | | | | | | | | | | | | | | | | iPXE currently seeds the random number generator using the system timer tick count. When large numbers of machines are booted simultaneously, multiple machines may end up choosing the same DHCP transaction ID (XID) value; this can cause problems. Fix by using the least significant (and hence most variable) bits of each network device's link-layer address to perturb the random number generator. This introduces some per-machine unique data into the random number generator's seed, and so reduces the chances of DHCP XID collisions. This does not affect the ANS X9.82-compatible random bit generator used by TLS and other cryptography code, which uses an entirely separate source of entropy. Originally-implemented-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add sample platform-generated error disambiguationsMichael Brown2013-04-191-3/+19
| | | | | | | | Add disambiguated errors for LoadImage() and StartImage(), primarily to demonstrate how to use __einfo_uniqify() and __einfo_platformify() in the context of EFI platform errors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Perform meaningful error code conversionsMichael Brown2013-04-1920-200/+212
| | | | | | | | Exploit the redefinition of iPXE error codes to include a "platform error code" to allow for meaningful conversion of EFI_STATUS values to iPXE errors and vice versa. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Redefine low 8 bits of error code as "platform error code"Michael Brown2013-04-197-234/+648
| | | | | | | | | | The low 8 bits of an iPXE error code are currently defined as the closest equivalent PXE error code. Generalise this scheme to platforms other than PC-BIOS by extending this definition to "closest equivalent platform error code". This allows for the possibility of returning meaningful errors via EFI APIs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Use __einfo() tuple as first argument to EUNIQ()Michael Brown2013-04-196-83/+86
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Remove obsolete EFI I/O implementation using EFI_CPU_IO_PROTOCOLMichael Brown2013-04-195-591/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add intelx driver for Intel 10 Gigabit Ethernet NICsMichael Brown2013-04-193-0/+580
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Expose functionality to be shared with intelx driverMichael Brown2013-04-192-15/+33
| | | | | | | | The Intel 10 Gigabit NICs have a datapath that is almost register-compatible with the Intel 1 Gigabit NICs. Expose common functionality to avoid duplication of code in the new "intelx" driver. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Remove hardcoded offsets for descriptor ring registersMichael Brown2013-04-192-18/+6Star
| | | | | | | | | | | | | | The Intel 10 Gigabit NICs use the same simplified (aka "legacy") descriptor format and the same layout for descriptor register blocks as the Intel 1 Gigabit NICs. The offsets of the descriptor register blocks are not the same. Simplify reuse of the existing code by removing all hardcoded offsets for registers within descriptor register blocks, and ensuring that all offsets are calculated using the descriptor register block base address provided via intel_init_ring(). 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>
* [settings] Expose build architecture and platform via settingsMichael Brown2013-04-061-15/+85
| | | | | | | | | | | | | | | Expose the build architecture (e.g. "i386" or "x86_64") via ${buildarch} and the firmware platform (e.g. "pcbios" or "efi") via ${platform}. These settings directly expose the ARCH and PLATFORM variables from the Makefile. Note that the build architecture reflects the architecture for which iPXE was compiled, not the architecture on which iPXE is currently running. The "cpuid" command can be used to detect a 64-bit system at runtime. Requested-by: James A. Peltier <jpeltier@sfu.ca> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Fetch device path for loaded image during initialisationMichael Brown2013-03-272-13/+38
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>