summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* [build] Prevent use of MMX and SSE registersMichael Brown2018-03-202-2/+5
| | | | | | | | | | | | | | | | | | | | | | | The existence of MMX and SSE is required by the System V x86_64 ABI and so is assumed by gcc, but these registers are not preserved by our own interrupt handlers and are unlikely to be preserved by other context switch handlers in a boot firmware environment. Explicitly prevent gcc from using MMX or SSE registers to avoid potential problems due to silent register corruption. We must remove the %xmm0-%xmm5 clobbers from the x86_64 version of hv_call() since otherwise gcc will complain about unknown register names. Theoretically, we should probably add code to explicitly preserve the %xmm0-%xmm5 registers across a hypercall, in order to guarantee to external code that these registers remain unchanged. In practice this is difficult since SSE registers are disabled by default: for background information see commits 71560d1 ("[librm] Preserve FPU, MMX and SSE state across calls to virt_call()") and dd9a14d ("[librm] Conditionalize the workaround for the Tivoli VMM's SSE garbling"). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rng] Use fixed-point calculations for min-entropy quantitiesMichael Brown2018-03-206-13/+34
| | | | | | | | | | | | | | We currently perform various min-entropy calculations using build-time floating-point arithmetic. No floating-point code ends up in the final binary, since the results are eventually converted to integers and asserted to be compile-time constants. Though this mechanism is undoubtedly cute, it inhibits us from using "-mno-sse" to prevent the use of SSE registers by the compiler. Fix by using fixed-point arithmetic instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Set log_max_qp to 1Ameer Mahagneh2018-03-202-4/+3Star
| | | | | | | This is required to work around a bug in some firmware versions. Signed-off-by: Ameer Mahagneh <ameerm@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Add support for the ACPI power management timerMichael Brown2018-03-204-0/+147
| | | | | | | | 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>
* [efi] Provide Map_Mem() and associated UNDI callbacksMichael Brown2018-03-201-0/+163
| | | | | | | | | | | | | | | | | | | Some drivers are known to call the optional Map_Mem() callback without first checking that the callback exists. Provide a usable basic implementation of Map_Mem() along with the other callbacks that become mandatory if Map_Mem() is provided. Note that in theory the PCI I/O protocol is allowed to require multiple calls to Map(), with each call handling only a subset of the overall mapped range. However, the reference implementation in EDK2 assumes that a single Map() will always suffice, so we can probably make the same simplifying assumption here. Tested with the Intel E3522X2.EFI driver (which, incidentally, fails to cleanly remove one of its mappings). Originally-implemented-by: Maor Dickman <maord@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [lacp] Check the partner's own state when checking for blocked linksMichael Brown2018-03-191-4/+4
| | | | | | | | The blocked link test in eth_slow_lacp_rx() is performed before the actor TLV is copied to the partner TLV, and so must test the actor state field rather than the partner state field. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ocsp] Allow OCSP checks to be disabledMichael Brown2018-03-182-0/+20
| | | | | | | | | Some CAs provide non-functional OCSP servers, and some clients are forced to operate on networks without access to the OCSP servers. Allow the user to explicitly disable the use of OCSP checks by undefining OCSP_CHECK in config/crypto.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ocsp] Centralise test for whether or not an OCSP check is requiredMichael Brown2018-03-183-4/+18
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [profile] Prevent potential division by zeroMichael Brown2018-03-181-2/+4
| | | | | | | | Limit the profile sample count to INT_MAX to avoid both signed overflow and a potential division by zero when updating the stored mean value. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tftp] Prevent potential division by zeroMichael Brown2018-03-181-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [lacp] Fix debug message to match documentationMichael Brown2018-03-181-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [lacp] Mark link as blocked if partner is not yet up and runningMichael Brown2018-03-182-0/+28
| | | | | | | | | | | | Mark the link as blocked if the LACP partner is not reporting itself as being in sync, collecting, and distributing. This matches the behaviour for STP: we mark the link as blocked if we detect that the switch is actively blocking traffic, in order to extend the DHCP discovery period and so prevent boot failures on switches that take an excessively long time to enable ports. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Do not assume all devices are identicalMichael Brown2018-03-181-5/+2Star
| | | | | | | | Remove the global variable shomron_nodnic_supported, since it may have different values for different PCI devices. Originally-fixed-by: Mohammed Taha <mohammedt@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [librm] Add facility to provide register and stack dump for CPU exceptionsMichael Brown2018-03-183-7/+162
| | | | | | | | | | | | | When DEBUG=librm_mgmt is enabled, intercept CPU exceptions and provide a register and stack dump, then drop to an emergency shell. Exiting from the shell will almost certainly not work, but this provides an opportunity to view the register and stack dump and carry out some basic debugging. Note that we can intercept only the first 8 CPU exceptions, since a PXE ROM is not permitted to rebase the PIC. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add PCI_ROM entry for Intel i354 NICRob Taglang2018-03-151-0/+1
| | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Raise TPL within EFI_DRIVER_BINDING_PROTOCOL entry pointsMichael Brown2018-03-151-0/+19
| | | | | Debugged-by: Rob Taglang <rob@privatemachines.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Drop to TPL_APPLICATION when gathering entropyMichael Brown2018-03-121-0/+6
| | | | | | | | | | | | | | | Commit c89a446 ("[efi] Run at TPL_CALLBACK to protect against UEFI timers") introduced a regression in the EFI entropy gathering code. When the EFI_RNG_PROTOCOL is not present, we fall back to using timer interrupts (as for the BIOS build). Since timer interrupts are disabled at TPL_CALLBACK, WaitForEvent() fails and no entropy can be gathered. Fix by dropping to TPL_APPLICATION while entropy gathering is enabled. Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Parse IPv6 address in root pathHannes Reinecke2018-03-011-1/+6
| | | | | | | | | The iSCSI root path may contain a literal IPv6 address. Update the parser to handle this address format correctly. Signed-off-by: Hannes Reinecke <hare@suse.de> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [process] Include process name in debug messagesMichael Brown2018-02-201-2/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Raise TPL within EFI_USB_IO_PROTOCOL entry pointsMichael Brown2018-02-201-6/+41
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Raise TPL within EFI_SIMPLE_NETWORK_PROTOCOL entry pointsMichael Brown2018-02-201-12/+81
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Run at TPL_CALLBACK to protect against UEFI timersMichael Brown2018-02-203-52/+49Star
| | | | | | | | | | | | | | | | | | | As noted in the comments, UEFI manages to combines the all of the worst aspects of both a polling design (inefficiency and inability to sleep until something interesting happens) and of an interrupt-driven design (the complexity of code that could be preempted at any time, thanks to UEFI timers). This causes problems in particular for UEFI USB keyboards: the keyboard driver calls UsbAsyncInterruptTransfer() to set up a periodic timer which is used to poll the USB bus. This poll may interrupt a critical section within iPXE, typically resulting in list corruption and either a hang or reboot. Work around this problem by mirroring the BIOS design, in which we run with interrupts disabled almost all of the time. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xhci] Consume event TRB before reporting completion to USB coreMichael Brown2018-02-191-4/+4
| | | | | | | | | | | | | | | | Reporting a completion via usb_complete() will pass control outside the scope of xhci.c, and could potentially result in a further call to xhci_event_poll() before returning from usb_complete(). Since we currently update the event consumer counter only after calling usb_complete(), this can result in duplicate completions and consequent corruption of the submission TRB ring structures. Fix by updating the event ring consumer counter before passing control to usb_complete(). Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Allow for domain names within NTLM user namesMichael Brown2018-02-193-3/+112
| | | | | | | | | Allow a NetBIOS domain name to be specified within a URL using a syntax such as: http://domain%5Cusername:password@server/path Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Work around broken reset mechanism in i219 devicesMichael Brown2018-02-032-9/+31
| | | | | | | | | | | | | | | | | | | | The i219 appears to have a seriously broken reset mechanism. After any transmit or receive activity, resetting the card will break both the transmit and receive datapaths until the next PCI bus reset. The Linux and BSD drivers include a convoluted workaround authored by Intel which involves setting a bit in the undocumented FEXTNVM11 register, then transmitting a dummy 512-byte packet containing garbage data, then reconfiguring the receive descriptor prefetch thresholds and temporarily reenabling the receive datapath. The comments in the Intel fix do not even remotely match what the code actually does, and the code accidentally leaves the transmitter enabled after use. Experimentation suggests that an equivalent fix is to simply set the undocumented bit in FEXTNVM11 before enabling the transmit or receive descriptor rings. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xhci] Assume an invalid PSI table if any invalid PSI value is observedMichael Brown2018-01-291-23/+30
| | | | | | | | | | | Invalid protocol speed ID tables appear to be increasingly common in the wild, to the point that it is infeasible to apply an explicit XHCI_BAD_PSIV flag for each offending PCI device ID. Fix by assuming an invalid PSI table as soon as any invalid value is reported by the hardware. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ena] Fix spurious uninitialised variable warning on older versions of gccMichael Brown2018-01-171-31/+7Star
| | | | | | | | | | Some older versions of gcc (observed with gcc 4.7.2) report a spurious uninitialised variable warning in ena_get_device_attributes(). Work around this warning by manually inlining the relevant code (which has only a single call site). Reported-by: xbgmsharp <xbgmsharp@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Make netdev_irq_enabled() independent of netdev_irq_supported()Martin Habets2018-01-141-6/+3Star
| | | | | | | | | | | | | | | | | | The UNDI layer uses the NETDEV_IRQ_ENABLED flag to choose whether to return PXENV_UNDI_ISR_OUT_OURS or PXENV_UNDI_ISR_OUT_NOT_OURS for a given interrupt. For a network device that does not support interrupts, the flag will never be set and so pxenv_undi_isr() will always return PXENV_UNDI_ISR_OUT_NOT_OURS. This causes some NBPs (such as lpxelinux.0) to hang. Redefine NETDEV_IRQ_ENABLED as a simple administrative flag which can be set even on network devices that do not support interrupts. This allows pxenv_undi_isr() (which is the sole user of NETDEV_IRQ_ENABLED) to function as expected by lpxelinux.0. Signed-off-by: Martin Habets <mhabets@solarflare.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tg3] Add support for SerDes PHY initializationJoseph Wong2018-01-142-4/+1021
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [skel] Remove MII interfaceMichael Brown2018-01-142-60/+0Star
| | | | | | | Most drivers do not utilise an MII interface, since the link state is typically available directly from a memory-mapped register. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ena] Add driver for Amazon ENA virtual function NICMichael Brown2018-01-133-0/+1628
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Avoid use of "ld --oformat binary"Michael Brown2018-01-022-4/+5
| | | | | | | | | | | | | | | | Using "ld --oformat binary" for mbr.bin and usbdisk.bin seems to cause segmentation faults on some versions of binutils (observed on Fedora 27). Work around this problem by using ld to create an intermediate ELF object, followed by objcopy (via the existing %.tmp -> %.bin rule) to create the final binary. Note that we cannot simply use a single-stage "objcopy -O binary" since this will not process the relocation records for x86_64: see commit 1afcccd ("[build] Do not use "objcopy -O binary" for objects with relocation records"). Reported-by: Brent S <bts@square-r00t.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add missing FILE_LICENCE declarationsMichael Brown2017-12-293-0/+6
| | | | | | | | Add missing FILE_LICENCE declarations to x86_64 headers based on the corresponding i386 headers (from which the x86_64 headers were originally derived). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add missing FILE_LICENCE declarationsMichael Brown2017-12-292-0/+4
| | | | | | | Add missing FILE_LICENCE declarations to EFI headers based on the corresponding source file. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Omit URI query string and fragment from download progress messagesMichael Brown2017-12-281-6/+7
| | | | | | | | | | | | | | The URIs printed as part of download progress messages are intended to provide a quick visual progress indication to the user. Very long query strings can render this visual indication useless in practice, since the most important information (generally the URI host and path) is drowned out by multiple lines of human-illegible URI-encoded data. Omit the query string entirely from the download progress message. For consistency and brevity, also omit the URI fragment along with the username and password (which was previously redacted anyway). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Report unsuccessful response status lines at DBGVL_LOGMichael Brown2017-12-281-0/+2
| | | | | | | | The precise HTTP response status code is currently visible only at DBGLVL_EXTRA. Allow for easier debugging by reporting the whole status line at DBGLVL_LOG for any unsuccessful responses. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Include error messages for 4xx and 5xx response codesMichael Brown2017-12-281-0/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Skip probing of any unsupported device typesMichael Brown2017-12-281-18/+21
| | | | | | | | | | | | Xen 4.4 includes the device "device/suspend/event-channel" which does not have a "backend" key. This currently causes the entire XenBus device tree probe to fail. Fix by skipping probe attempts for device types for which there is no iPXE driver. Debugged-by: Eytan Heidingsfeld <eytanh@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add PCI device ID for X550-T2Janos Mattyasovszky2017-12-201-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Add support for NTLM authenticationMichael Brown2017-11-125-0/+231
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Handle parsing of WWW-Authenticate header within authentication schemeMichael Brown2017-11-124-75/+157
| | | | | | | Allow individual authentication schemes to parse WWW-Authenticate headers that do not comply with RFC2617. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [http] Gracefully handle offers of multiple authentication schemesMichael Brown2017-11-121-3/+10
| | | | | | | | | | | | | | | | Servers may provide multiple WWW-Authenticate headers, each offering a different authentication scheme. We currently fail the request as soon as we encounter an unrecognised scheme, which prevents subsequent offers from succeeding. Fix by silently ignoring headers for schemes that we do not recognise. If no schemes are recognised then the request will eventually fail anyway due to the 401 response code. If multiple schemes are supported, arbitrarily choose the scheme appearing first within the response headers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ntlm] Add support for NTLM authentication mechanismMichael Brown2017-11-125-0/+847
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Add MD4 message digest algorithmMichael Brown2017-11-125-0/+436
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Eliminate repetitions in MD5 round constant tableMichael Brown2017-11-121-7/+10
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Fix endianness typo in commentMichael Brown2017-11-121-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow for building with older versions of elf.h system headerMichael Brown2017-09-241-0/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Accept (and ignore) R_ARM_V4BX relocationsHeinrich Schuchardt2017-09-241-0/+1
| | | | | | | | | Relocation type R_ARM_V4BX requires no computation. It marks the location of an ARMv4 branch exchange instruction. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Fail fast if cross-certificate source is emptyLadi Prosek2017-09-241-0/+5
| | | | | | | | | | | | In fully self-contained deployments it may be desirable to build iPXE with an empty CROSSCERT source to avoid talking to external services. Add an explicit check for this case and make validator_start_download fail immediately if the base URI is empty. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Inhibit our driver Start() method during disconnection attemptsMichael Brown2017-09-221-0/+16
| | | | | | | | | | | | | | | | | | Some HP BIOSes (observed with a Z840) seem to attempt to connect our drivers in the middle of our call to DisconnectController(). The precise chain of events is unclear, but the symptom is that we see several calls to our Supported() and Start() methods, followed by a system lock-up. Work around this dubious BIOS behaviour by explicitly failing calls to our Start() method while we are in the middle of attempting to disconnect drivers. Reported-by: Jordan Wright <jordan.m.wright@disney.com> Debugged-by: Adrian Lucrèce Céleste <adrianlucrececeleste@airmail.cc> Debugged-by: Christian Nilsson <nikize@gmail.com> Tested-by: Jordan Wright <jordan.m.wright@disney.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>