summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* [acpi] Add support for ACPI power offMichael Brown2016-07-119-4/+519
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rng] Check for functioning RTC interruptMichael Brown2016-07-102-0/+57
| | | | | | | | | | | | | | | | | | | | | 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] Install the HII config access protocol on a child of the SNP handleLaszlo Ersek2016-07-082-4/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In edk2, there are several drivers that associate HII forms (and corresponding config access protocol instances) with each individual network device. (In this context, "network device" means the EFI handle on which the SNP protocol is installed, and on which the device path ending with the MAC() node is installed also.) Such edk2 drivers are, for example: Ip4Dxe, HttpBootDxe, VlanConfigDxe. In UEFI, any given handle can carry at most one instance of a specific protocol (see e.g. the specification of the InstallProtocolInterface() boot service). This implies that the class of drivers mentioned above can't install their EFI_HII_CONFIG_ACCESS_PROTOCOL instances on the SNP handle directly -- they would conflict with each other. Accordingly, each of those edk2 drivers creates a "private" child handle under the SNP handle, and installs its config access protocol (and corresponding HII package list) on its child handle. The device path for the child handle is traditionally derived by appending a Hardware Vendor Device Path node after the MAC() node. The VenHw() nodes in question consist of a GUID (by definition), and no trailing data (by choice). The purpose of these VenHw() nodes is only that all the child nodes can be uniquely identified by device path. At the moment iPXE does not follow this pattern. It doesn't run into a conflict when it installs its EFI_HII_CONFIG_ACCESS_PROTOCOL directly on the SNP handle, but that's only because iPXE is the sole driver not following the pattern. This behavior seems risky (one might call it a "latent bug"); better align iPXE with the edk2 custom. Cc: Michael Brown <mcb30@ipxe.org> Cc: Gary Lin <glin@suse.com> Cc: Ladi Prosek <lprosek@redhat.com> Ref: http://thread.gmane.org/gmane.comp.bios.edk2.devel/13494/focus=13532 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ladi Prosek <lprosek@redhat.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [profile] Allow profiling to be globally enabled or disabledMichael Brown2016-07-052-0/+29
| | | | | | | | | | As with assertions, profiling is enabled for objects built with any debug level (including an explicit debug level of zero). Allow profiling to be globally enabled or disabled by adding PROFILE=1 or PROFILE=0 respectively to the build command line. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Allow assertions to be globally enabled or disabledMichael Brown2016-07-052-0/+29
| | | | | | | | | | | | | | | | | | | | | | | Assertions are enabled for objects built with any debug level (including an explicit debug level of zero). It is sometimes useful to be able to enable assertions across all objects; this currently requires manually hacking include/assert.h. Allow assertions to be globally enabled by adding ASSERT=1 to the build command line. For example: make bin/8086100e.mrom ASSERT=1 Similarly, allow assertions to be globally disabled by adding ASSERT=0 to the build command line. If no ASSERT=... is specified on the build command line, then only objects mentioned in DEBUG=... will have assertions enabled (as is currently the case). Note than globally enabling assertions imposes a relatively heavy runtime penalty, primarily due to the various sanity checks performed by list_add(), list_for_each_entry(), etc. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [debug] Allow debug messages to be initially disabled at runtimeMichael Brown2016-07-052-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend the DEBUG=... syntax to allow debug messages to be compiled in but disabled by default. For example: make bin/undionly.kpxe DEBUG=netdevice:3:1 would compile in the messages as for DEBUG=netdevice:3, but would set the debug level mask so that only the DEBUG=netdevice:1 messages would be displayed. This allows for external code to selectively enable the additional debug messages at runtime, without being overwhelmed by unwanted initial noise. For example, a developer of a new protocol may want to temporarily enable tracing of all packets received: this can be done by building with DEBUG=netdevice:3:1 and using // temporarily enable per-packet messages DBG_ENABLE_OBJECT ( netdevice, DBGLVL_EXTRA ); ... // disable per-packet messages DBG_DISABLE_OBJECT ( netdevice, DBGLVL_EXTRA ); Note that unlike the usual DBG_ENABLE() and DBG_DISABLE() macros, DBG_ENABLE_OBJECT() and DBG_DISABLE_OBJECT() will not be removed via dead code elimination if debugging is disabled in the specified object. In particular, this means that using either of these macros will always result in a symbol reference to the specified object. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [debug] Allow per-object runtime enabling/disabling of debug messagesMichael Brown2016-07-051-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | The DBG_ENABLE() and DBG_DISABLE() macros currently affect the debug level of all objects that were built with debugging enabled. This is undesirable, since it is common to use different debug levels in each object. Make the debug level mask a per-object variable. DBG_ENABLE() and DBG_DISABLE() now control only the debug level for the containing object (which is consistent with the intended usage across the existing codebase). DBG_ENABLE_OBJECT() and DBG_DISABLE_OBJECT() may be used to control the debug level for a specified object. For example: // Enable DBG() messages from tcpip.c DBG_ENABLE_OBJECT ( tcpip, DBGLVL_LOG ); Note that the existence of debug messages continues to be gated by the DEBUG=... list specified on the build command line. If an object was built without the relevant debug level, then DBG_ENABLE_OBJECT() will have no effect on that object at runtime (other than to explicitly drag in the object via a symbol reference). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Treat redirection failures as fatalMichael Brown2016-07-041-1/+10
| | | | | Debugged-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [downloader] Treat redirection failures as fatalMichael Brown2016-07-041-2/+6
| | | | | Debugged-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Send intf_close() if redirection failsMichael Brown2016-07-041-0/+5
| | | | | | | | | | A redirection failure is fatal, but provides no opportunity for the caller of xfer_[v]redirect() to report the failure since the interface will already have been disconnected. Fix by sending intf_close() from within the default xfer_vredirect() handler. Debugged-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcp] Automatically generate vendor class identifier stringMichael Brown2016-07-049-32/+29Star
| | | | | | | | | | | | The vendor class identifier strings in DHCP_ARCH_VENDOR_CLASS_ID are out of sync with the (correct) client architecture values in DHCP_ARCH_CLIENT_ARCHITECTURE. Fix by removing all definitions of DHCP_ARCH_VENDOR_CLASS_ID, and instead generating the vendor class identifier string automatically based on DHCP_ARCH_CLIENT_ARCHITECTURE and DHCP_ARCH_CLIENT_NDI. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcpv6] Include vendor class identifier option in DHCPv6 requestsMichael Brown2016-07-042-11/+35
| | | | | | | | | | | | | | | | | | | | | | | | RFC3315 defines DHCPv6 option 16 (vendor class identifier) but does not define any direct relationship with the roughly equivalent DHCPv4 option 60. The PXE specification predates IPv6, and the UEFI specification is expectedly vague on the subject. Examination of the reference EDK2 codebase suggests that the DHCPv6 vendor class identifier will be formatted in accordance with RFC3315, using a single vendor-class-data item in which the opaque-data field is the string as would appear in DHCPv4 option 60. RFC3315 requires the vendor class identifier to specify an IANA enterprise number, as a way of disambiguating the vendor-class-data namespace. The EDK2 code uses the value 343, described as: // TODO: IANA TBD: temporarily using Intel's Since this "TODO" has been present since at least 2010, it is probably safe to assume that it has now become a de facto standard. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcpv6] Include RFC5970 client architecture options in DHCPv6 requestsMichael Brown2016-07-042-17/+52
| | | | | | | | RFC5970 defines DHCPv6 options 61 (client system architecture type) and 62 (client network interface identifier), with contents equivalent to DHCPv4 options 93 and 94 respectively. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcp] Allow for variable encapsulation of architecture-specific optionsMichael Brown2016-07-047-45/+39Star
| | | | | | | | | | | | | DHCPv4 and DHCPv6 share some values in common for the architecture- specific options (such as the client system architecture type), but use different encapsulations: DHCPv4 has a single byte for the option length while DHCPv6 has a 16-bit field for the option length. Move the containing DHCP_OPTION() and related wrappers from the individual dhcp_arch.h files to dhcp.c, thus allowing for the architecture-specific values to be reused in dhcpv6.c. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Disable interrupts on the PIC before starting NBPMichael Brown2016-07-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | Some BIOSes (observed with an HP Gen9) seem to spuriously enable interrupts at the PIC. This causes problems with NBPs such as GRUB which use the UNDI API (thereby enabling interrupts on the NIC) without first hooking an interrupt service routine. In this situation, the interrupt will end up being handled by the default BIOS ISR, which will typically just send an EOI and return. Since nothing in this handler causes the NIC to deassert the interrupt, this will result in an interrupt storm. Entertainingly, some BIOSes are immune to this problem because the default ISR sends the EOI only to the slave PIC; this effectively disables the interrupt. Work around this problem by disabling the interrupt on the PIC before invoking the PXE NBP. An NBP that expects to make use of interrupts will need to be configuring the PIC anyway, so it is probably safe to assume that it will explicitly reenable the interrupt. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [bios] Do not enable interrupts when printing to the consoleMichael Brown2016-07-031-14/+4Star
| | | | | | | | There seems to be no reason for the sti/cli pair used around each call to INT 10. Remove these instructions, so that printing debug messages from within an ISR does not temporarily reenable interrupts. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Fix uninitialised data in HII IFR structuresMichael Brown2016-06-291-0/+1
| | | | | | | | | | | | | | The HII IFR structures are allocated via realloc() rather than zalloc(), and so are not automatically zeroed. This results in the presence of uninitialised and invalid data, causing crashes elsewhere in the UEFI firmware. Fix by explicitly zeroing the newly allocated portion of any IFR structure in efi_ifr_op(). Debugged-by: Laszlo Ersek <lersek@redhat.com> Debugged-by: Gary Lin <glin@suse.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [thunderx] Fix compilation with older versions of gccMichael Brown2016-06-221-2/+2
| | | | | | | Remove redundant duplicate typedef which causes a build failure on older gcc versions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Do not copy garbage bytes into SNP device path MAC addressMichael Brown2016-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | The SNP device path includes the network device's MAC address within the MAC_ADDR_DEVICE_PATH.MacAddress field. We check that the link-layer address will fit within this field, and then perform the copy using the length of the destination buffer. At 32 bytes, the MacAddress field is actually larger than the current maximum iPXE link-layer address. The copy therefore overflows the source buffer, resulting in trailing garbage bytes being appended to the device path's MacAddress. This is invisible in debug messages, since the DevicePathToText protocol will render only the length implied by the interface type. Fix by copying only the actual length of the link-layer address (which we have already verified will not overflow the destination buffer). Debugged-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Report failures to stop the EFI timer tick eventMichael Brown2016-06-201-2/+16
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [smsc75xx] Allow up to 100ms for reset to completeMichael Brown2016-06-202-11/+16
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [virtio] Fix virtio-pci loggingLadi Prosek2016-06-201-7/+7
| | | | | | | | | iPXE debug logging doesn't support %u. This commit replaces it with %d in virtio-pci debug format strings. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [virtio] Renumber virtio_pci_region flagsLadi Prosek2016-06-201-3/+3
| | | | | | | | | | | | | Some of the regions may end up being unmapped, either because they are optional or because the attempt to map them has failed. Region types starting at 0 didn't make it easy to test for this condition. This commit bumps all valid region types up by 1 with 0 having the implicit 'unmapped' meaning. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [thunderx] Retrieve base MAC address via EFI_THUNDER_CONFIG_PROTOCOLMichael Brown2016-06-182-1/+250
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Include VLAN in SNP device path if applicableMichael Brown2016-06-181-2/+15
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add PCI device ID for another I219-LMChristian Nilsson2016-06-161-0/+1
| | | | | Tested-by: Kuniyasu Suzaki <k.suzaki@aist.go.jp> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [thunderx] Fix channel configuration for VNICs 1-7Michael Brown2016-06-151-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [thunderx] Add driver for Cavium ThunderX SoC NICsMichael Brown2016-06-133-0/+2618
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add "ntp" commandMichael Brown2016-06-135-0/+156
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ntp] Add simple NTP clientMichael Brown2016-06-133-0/+385
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Allow system clock to be adjusted at runtimeMichael Brown2016-06-133-3/+19
| | | | | | | | | | Provide a mechanism to allow an arbitrary adjustment to be applied to all subsequent calls to time(). Note that the underlying clock source (e.g. the RTC clock) will not be changed; only the time as reported within iPXE will be affected. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tg3] Add missing memory barrierLeendert van Doorn2016-06-131-0/+2
| | | | | | | | | ARM64 has a weaker memory order model than x86. The missing memory barrier caused phy initialization notification to be delayed beyond the link-wait timeout (15 secs). Signed-off-by: Leendert van Doorn <leendert@paramecium.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcp] Send TCP keepalives on idle established connectionsMichael Brown2016-06-132-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | In some circumstances, intermediate devices may lose state in a way that temporarily prevents the successful delivery of packets from a TCP peer. For example, a firewall may drop a NAT forwarding table entry. Since iPXE spends most of its time downloading files (and hence purely receiving data, sending only TCP ACKs), this can easily happen in a situation in which there is no reason for iPXE's TCP stack to generate any retransmissions. The temporary loss of connectivity can therefore effectively become permanent. Work around this problem by sending TCP keepalives after a period of inactivity on an established connection. TCP keepalives usually send a single garbage byte in sequence number space that has already been ACKed by the peer. Since we do not need to elicit a response from the peer, we instead send pure ACKs (with no garbage data) in order to keep the transmit code path simple. Originally-implemented-by: Ladi Prosek <lprosek@redhat.com> Debugged-by: Ladi Prosek <lprosek@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tg3] Fix address truncation bug on 64-bit machinesLeendert van Doorn2016-06-102-2/+2
| | | | | Signed-off-by: Leendert van Doorn <leendert@paramecium.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Accept headers with no whitespace following the colonMichael Brown2016-06-091-2/+6
| | | | | Reported-by: Raphael Cohn <raphael.cohn@stormmq.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Support systems with multiple PCI root bridgesMichael Brown2016-06-099-42/+160
| | | | | | | | | Extend the 16-bit PCI bus:dev.fn address to a 32-bit seg:bus:dev.fn address, assuming a segment value of zero in contexts where multiple segments are unsupported by the underlying data structures (e.g. in the iBFT or BOFM tables). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Always use a non-zero seed for the (non-crypto) RNGMichael Brown2016-06-091-0/+2
| | | | | | | | | | | | | | The non-cryptographic RNG implemented by random() has the property that a seed value of zero will result in a generated sequence of all-zero values. This situation can arise if currticks() returns zero at start of day. Work around this problem by falling back to a fixed non-zero seed if necessary. This has no effect on the separate DRBG used by cryptographic code. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Remove nested "my" declarationVinson Lee2016-06-031-1/+1
| | | | | | | | | | Fix build error with perl >= 5.23.2: Can't redeclare "my" in "my" at ./util/parserom.pl line 160 Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Expose DHCP packets via the Apple NetBoot protocolMichael Brown2016-05-295-3/+145
| | | | | | | | Mac OS X uses non-standard EFI protocols to obtain the DHCP packets from the UEFI firmware. Originally-implemented-by: Michael Kuron <m.kuron@gmx.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcp] Fix definitions for x86_64 and EFI BC client architecturesMichael Brown2016-05-261-4/+4
| | | | | | | | | | | | | | | There has been a longstanding disagreement between RFC4578 and the IANA "Processor Architecture Types" registry. RFC4578 section 2.1 defines type 7 as "EFI BC" and type 9 as "EFI x86-64"; the IANA registry quotes RFC4578 as its source but has these values erroneously swapped. The EDK2 codebase uses the IANA values. As of March 2016, RFC4578 has been modified by an errata to match the values as recorded in the IANA registry. Fix our definitions to match the consensus values. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [arm] Use correct DHCP client architecture valuesMichael Brown2016-05-263-2/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [axge] Add driver for ASIX 10/100/1000 USB Ethernet NICsMichael Brown2016-05-263-0/+973
| | | | | | | Add driver for the AX88178A (USB2) and AX88179 (USB3) 10/100/1000 Ethernet NICs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Work around broken UEFI keyboard driversMichael Brown2016-05-261-2/+7
| | | | | | | | | | | | Some UEFI keyboard drivers are blissfully unaware of the existence of either Ctrl key, and will report "Ctrl-<key>" as just "<key>". This breaks substantial portions of the iPXE user interface. Work around these broken UEFI drivers by allowing "ESC <key>" to be used as a substitute for "Ctrl-<key>". Tested-by: Dreamcat4 <dreamcat4@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Ignore unrecognised "Connection" header tokensMichael Brown2016-05-251-13/+11Star
| | | | | | | | | | Some HTTP/2 servers send the header "Connection: upgrade, close". This currently causes iPXE to fail due to the unrecognised "upgrade" token. Fix by ignoring any unrecognised tokens in the "Connection" header. Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [lotest] Add option to use broadcast packets for loopback testingMichael Brown2016-05-233-6/+18
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Fix failure path in register_netdev()Michael Brown2016-05-231-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Extend numerical setting tags to "unsigned long"Michael Brown2016-05-203-4/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Add support for PCI Enhanced AllocationMichael Brown2016-05-204-0/+221
| | | | | | | Some embedded devices have immovable BARs, which are described via a PCI Enhanced Allocation capability. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Work around broken HP EliteBook 745 G3 PXE ROMMichael Brown2016-05-131-0/+2
| | | | | | Reported-by: Arturino Mazzei <mazzeia@hotmail.com> Tested-by: Arturino Mazzei <mazzeia@hotmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ath9k] Fix buffer overrun for ar9287Christian Hesse2016-05-121-4/+3Star
| | | | | | | | This backport is from linux kernel upstream commit 83d6f1f ("ath9k: fix buffer overrun for ar9287"). Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>