ipxe.git
2 years ago[efi] Raise TPL when calling UNDI entry point
Michael Brown [Tue, 5 Sep 2017 09:48:41 +0000 (10:48 +0100)] 
[efi] Raise TPL when calling UNDI entry point

The SnpDxe driver raises the task priority level to TPL_CALLBACK when
calling the UNDI entry point.  This does not appear to be a documented
requirement, but we should probably match the behaviour of SnpDxe to
minimise surprises to third party code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[linux] Impose receive quota on tap driver
Michael Brown [Mon, 4 Sep 2017 17:00:34 +0000 (18:00 +0100)] 
[linux] Impose receive quota on tap driver

The tap driver can retrieve a potentially unlimited number of packets
in a single poll.  This can lead to heap exhaustion under heavy load.

Fix by imposing an artificial receive quota (as already used in other
drivers without natural receive limits).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[malloc] Avoid false positive warnings from valgrind
Michael Brown [Mon, 4 Sep 2017 13:00:32 +0000 (14:00 +0100)] 
[malloc] Avoid false positive warnings from valgrind

Calling discard_cache() is likely to result in a call to
free_memblock(), which will call valgrind_make_blocks_noaccess()
before returning.  This causes valgrind to report an invalid read on
the next iteration through the loop in alloc_memblock().

Fix by explicitly calling valgrind_make_blocks_defined() after
discard_cache() returns.  Also call valgrind_make_blocks_noaccess()
before calling discard_cache(), to guard against free list corruption
while executing cache discarders.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[romprefix] Avoid unaligned accesses within ROM headers
Michael Brown [Wed, 30 Aug 2017 09:15:25 +0000 (10:15 +0100)] 
[romprefix] Avoid unaligned accesses within ROM headers

Ensure that all headers (PCI, UNDI, PnP, iPXE) are aligned to at least
four bytes, so that all accesses to header fields will be correctly
aligned even when reading directly from the expansion ROM BAR.

Reported-by: Peter von Konigsmark <peter@exablaze.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[intel] Add various PCI device IDs
Richard Moore [Tue, 22 Aug 2017 09:38:42 +0000 (10:38 +0100)] 
[intel] Add various PCI device IDs

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[shell] Enable "shell" command even when BANNER_TIMEOUT is zero
Michael Brown [Tue, 1 Aug 2017 19:25:28 +0000 (20:25 +0100)] 
[shell] Enable "shell" command even when BANNER_TIMEOUT is zero

Setting BANNER_TIMEOUT to zero removes the only symbol reference to
shell.o, causing the "shell" command to become unavailable.

Add SHELL_CMD in config/general.h (enabled by default) which will
explicitly drag in shell.o regardless of the value of BANNER_TIMEOUT.

Reported-by: Julian Brost <julian@0x4a42.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[hyperv] Do not steal ownership from the Gen 2 UEFI firmware
Michael Brown [Fri, 28 Jul 2017 20:19:45 +0000 (21:19 +0100)] 
[hyperv] Do not steal ownership from the Gen 2 UEFI firmware

We must not steal ownership from the Gen 2 UEFI firmware, since doing
so will cause an immediate system crash (most likely in the form of a
reboot).

This problem was masked before commit a0f6e75 ("[hyperv] Do not fail
if guest OS ID MSR is already set"), since prior to that commit we
would always fail if we found any non-zero guest OS identity.  We now
accept a non-zero previous guest OS identity in order to allow for
situations such as chainloading from iPXE to another iPXE, and as a
prerequisite for commit b91cc98 ("[hyperv] Cope with Windows Server
2016 enlightenments").

A proper fix would be to reverse engineer the UEFI protocols exposed
within the Hyper-V Gen 2 firmware and use these to bind to the VMBus
device representing the network connection, (with the native Hyper-V
driver moved to become a BIOS-only feature).

As an interim solution, fail to initialise the native Hyper-V driver
if we detect the guest OS identity known to be used by the Gen 2 UEFI
firmware.  This will cause the standard all-drivers build (ipxe.efi)
to fall back to using the SNP driver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[acpi] Fix spurious uninitialised-variable warning on some gcc versions
Michael Brown [Fri, 28 Jul 2017 19:19:31 +0000 (20:19 +0100)] 
[acpi] Fix spurious uninitialised-variable warning on some gcc versions

Reported-by: Christian Nilsson <nikize@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[acpi] Compute and check checksum for ACPI tables
Laurent Gourvénec [Thu, 27 Jul 2017 14:04:35 +0000 (16:04 +0200)] 
[acpi] Compute and check checksum for ACPI tables

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[build] Fix ARM32 EFI builds with current EDK2 headers
Michael Brown [Fri, 28 Jul 2017 14:40:44 +0000 (15:40 +0100)] 
[build] Fix ARM32 EFI builds with current EDK2 headers

EDK2 commit 6440385 ("MdePkg/Include: Add enumeration size checks to
Base.h") enforced the UEFI specification mandate that enums should
always be 32 bits.  This revealed a latent bug in iPXE, which does not
build with -fno-short-enums.

Fix by adding -fno-short-enums to CFLAGS for ARM32 EFI builds.

Reported-by: Benjamin S. Allen <bsallen@alcf.anl.gov>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[build] Fix use of inline assembly on GCC 4.8 ARM64 builds
Michael Brown [Fri, 28 Jul 2017 12:50:35 +0000 (13:50 +0100)] 
[build] Fix use of inline assembly on GCC 4.8 ARM64 builds

The inline assembly used in include/errno.h to generate the einfo
blocks requires the ability to generate an immediate constant with no
immediate-value prefix (such as the dollar sign for x86 assembly).

We currently achieve this via the undocumented "%c0" form of operand.
This causes an "invalid operand prefix" error on GCC 4.8 for ARM64
builds.

Fix by switching to the equally undocumented "%a0" form of operand,
which appears to work correctly on all tested versions of GCC.

Reported-by: Benjamin S. Allen <bsallen@alcf.anl.gov>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[build] Conditionalise use of -mabi=lp64 for ARM64 builds
Michael Brown [Fri, 28 Jul 2017 11:47:06 +0000 (12:47 +0100)] 
[build] Conditionalise use of -mabi=lp64 for ARM64 builds

The -mabi option was added in GCC 4.9.  Test for the existence of this
option to allow for building with earlier versions of GCC.

Reported-by: Benjamin S. Allen <bsallen@alcf.anl.gov>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[efi] Enumerate PCI BARs in same order as SnpDxe
Michael Brown [Fri, 21 Jul 2017 13:48:27 +0000 (14:48 +0100)] 
[efi] Enumerate PCI BARs in same order as SnpDxe

The UEFI specification has an implicit and demonstrably incorrect
requirement (in the Mem_IO() calling convention) that any UNDI network
device has at most one memory BAR and one I/O BAR.

Some UEFI platforms have been observed to report the existence of
non-existent additional I/O BARs, causing iPXE to select the wrong
BAR.  This problem does not affect the SnpDxe driver, since that
driver will always choose the lowest numbered existent BAR of each
type.

Adjust iPXE's behaviour to match that of SnpDxe, i.e. to always select
the lowest numbered BAR(s).

Debugged-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Debugged-by: Adklei <adklei@realtek.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[lan78xx] Add driver for Microchip LAN78xx USB Ethernet NICs ipxe-qemu-20170717-0600d3ae94-0 ipxe-qemu-release-v2.10.0
Michael Brown [Thu, 16 Jun 2016 14:06:25 +0000 (15:06 +0100)] 
[lan78xx] Add driver for Microchip LAN78xx USB Ethernet NICs

Originally-implemented-by: Ravi Hegde <ravi.hegde@microchip.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[smsc75xx] Expose functionality shared with LAN78xx devices
Michael Brown [Fri, 7 Jul 2017 16:25:37 +0000 (17:25 +0100)] 
[smsc75xx] Expose functionality shared with LAN78xx devices

The LAN78xx datapath is essentially identical to that of the SMSC75xx.
Expose the transmit, poll, and bulk IN endpoint operations to allow
for reuse by the LAN78xx driver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[smscusb] Allow for alternative PHY register layouts
Michael Brown [Mon, 10 Jul 2017 11:38:39 +0000 (12:38 +0100)] 
[smscusb] Allow for alternative PHY register layouts

The LAN78xx PHY interrupt source and mask registers do not match those
used by the SMSC75xx and SMSC95xx.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[smscusb] Move non-inline register access functions to smscusb.c
Michael Brown [Mon, 10 Jul 2017 10:54:24 +0000 (11:54 +0100)] 
[smscusb] Move non-inline register access functions to smscusb.c

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[virtio] Support VIRTIO_NET_F_IOMMU_PLATFORM
Jason Wang [Mon, 10 Jul 2017 09:10:41 +0000 (17:10 +0800)] 
[virtio] Support VIRTIO_NET_F_IOMMU_PLATFORM

Since we don't enable IOMMU at all, we can then simply enable the
IOMMU support by claiming the support of VIRITO_F_IOMMU_PLATFORM.
This fixes booting failure when iommu_platform is set from qemu cli.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[smscusb] Add ability to read MAC address from OTP
Michael Brown [Fri, 7 Jul 2017 18:01:25 +0000 (19:01 +0100)] 
[smscusb] Add ability to read MAC address from OTP

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[smsc75xx] Use common SMSC USB device functionality
Michael Brown [Thu, 6 Jul 2017 16:10:31 +0000 (17:10 +0100)] 
[smsc75xx] Use common SMSC USB device functionality

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[smsc95xx] Use common SMSC USB device functionality
Michael Brown [Thu, 6 Jul 2017 16:25:14 +0000 (17:25 +0100)] 
[smsc95xx] Use common SMSC USB device functionality

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[smscusb] Abstract out common SMSC USB device functionality
Michael Brown [Thu, 6 Jul 2017 15:58:22 +0000 (16:58 +0100)] 
[smscusb] Abstract out common SMSC USB device functionality

The smsc75xx and smsc95xx drivers include a substantial amount of
identical functionality, varying only in the base address of register
sets.  Abstract out this common functionality to allow code to be
shared between the drivers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[intel] Add support for I219-V in 7th Gen Intel NUC
Jerone Young [Sun, 2 Jul 2017 22:23:17 +0000 (17:23 -0500)] 
[intel] Add support for I219-V in 7th Gen Intel NUC

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[tls] Support RFC5746 secure renegotiation
Michael Brown [Tue, 4 Jul 2017 11:51:29 +0000 (12:51 +0100)] 
[tls] Support RFC5746 secure renegotiation

Support renegotiation with servers supporting RFC5746.  This allows
for the use of per-directory client certificates.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[mucurses] Avoid potential division by zero
Michael Brown [Tue, 4 Jul 2017 11:51:53 +0000 (12:51 +0100)] 
[mucurses] Avoid potential division by zero

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[usb] Use non-zero language ID to retrieve strings
Michael Brown [Mon, 3 Jul 2017 12:38:55 +0000 (13:38 +0100)] 
[usb] Use non-zero language ID to retrieve strings

We currently use a zero language ID to retrieve strings such as the
ECM/NCM MAC address.  This works on most hardware devices, but is
known to fail on some software emulated CDC-NCM devices.

Fix by using the first supported language ID, falling back to English
(0x0409) if any error occurs when fetching the list of supported
languages.  This matches the behaviour of the Linux kernel.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[exanic] Add driver for Exablaze ExaNIC cards
Michael Brown [Tue, 20 Jun 2017 11:10:14 +0000 (12:10 +0100)] 
[exanic] Add driver for Exablaze ExaNIC cards

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[crypto] Expose pem_asn1() for use with non-image data
Michael Brown [Mon, 29 May 2017 16:29:20 +0000 (17:29 +0100)] 
[crypto] Expose pem_asn1() for use with non-image data

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[crypto] Provide asn1_built() to construct a cursor from a builder
Michael Brown [Tue, 13 Jun 2017 11:12:11 +0000 (12:12 +0100)] 
[crypto] Provide asn1_built() to construct a cursor from a builder

Our ASN.1 parsing code uses a struct asn1_cursor, while the object
construction code uses a struct asn1_builder.  These structures are
identical apart from the const modifier applied to the data pointer in
struct asn1_cursor.

Provide asn1_built() to safely typecast a struct asn1_builder to a
struct asn1_cursor, allowing constructed objects to be passed to
functions expecting a struct asn1_cursor.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[crypto] Expose asn1_grow()
Michael Brown [Tue, 13 Jun 2017 11:11:40 +0000 (12:11 +0100)] 
[crypto] Expose asn1_grow()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[crypto] Expose RSA_CTX_SIZE constant
Michael Brown [Tue, 13 Jun 2017 11:09:52 +0000 (12:09 +0100)] 
[crypto] Expose RSA_CTX_SIZE constant

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[cpuid] Allow input %ecx value to be specified
Michael Brown [Thu, 15 Jun 2017 13:50:20 +0000 (14:50 +0100)] 
[cpuid] Allow input %ecx value to be specified

For some CPUID leaves (e.g. %eax=0x00000004), the result depends on
the input value of %ecx.  Allow this subfunction number to be
specified as a parameter to the cpuid() wrapper.

The subfunction number is exposed via the ${cpuid/...} settings
mechanism using the syntax

  ${cpuid/<subfunction>.0x40.<register>.<function>}

e.g.

  ${cpuid/0.0x40.0.0x0000000b}
  ${cpuid/1.0x40.0.0x0000000b}

to retrieve the CPU topology information.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[ecm] Display invalid MAC address strings in debug messages
Michael Brown [Wed, 14 Jun 2017 16:40:05 +0000 (17:40 +0100)] 
[ecm] Display invalid MAC address strings in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[build] Use -no-pie on newer versions of gcc
Michael Brown [Wed, 14 Jun 2017 11:33:16 +0000 (12:33 +0100)] 
[build] Use -no-pie on newer versions of gcc

Some distributions patch gcc to generate position independent
executables by default.  We currently include a workaround to check
for this and to add -fno-PIE -nopie to CFLAGS if required.

Newer patched versions of gcc require -fno-PIE -no-pie instead.  Check
for both variants.

Reported-by: Nathan Rennie-Waldock <nathan.renniewaldock@gmail.com>
Originally-fixed-by: Markos Chandras <mchandras@suse.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[intel] Add INTEL_NO_PHY_RST for I219-V
Mika Tiainen [Tue, 30 May 2017 17:23:17 +0000 (20:23 +0300)] 
[intel] Add INTEL_NO_PHY_RST for I219-V

Fix booting on HP EliteBook 820 G3.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[usb] Allow for USB network devices with no interrupt endpoint
Michael Brown [Thu, 18 May 2017 14:18:25 +0000 (15:18 +0100)] 
[usb] Allow for USB network devices with no interrupt endpoint

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[hdprefix] Avoid attempts to read beyond the end of the disk
Michael Brown [Tue, 13 Jun 2017 12:16:26 +0000 (13:16 +0100)] 
[hdprefix] Avoid attempts to read beyond the end of the disk

When booting from a hard disk image (e.g. bin/ipxe.usb) within an
emulator such as QEMU, the disk may not exist beyond the end of the
image.  Limit all reads to the length of the image to avoid spurious
errors when loading the iPXE image.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[syslog] Handle backspace characters
Michael Brown [Tue, 13 Jun 2017 10:54:41 +0000 (11:54 +0100)] 
[syslog] Handle backspace characters

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[acpi] Expose ACPI tables via settings mechanism
Michael Brown [Tue, 23 May 2017 14:44:22 +0000 (15:44 +0100)] 
[acpi] Expose ACPI tables via settings mechanism

Allow values to be read from ACPI tables using the syntax

  ${acpi/<signature>.<index>.0.<offset>.<length>}

where <signature> is the ACPI table signature as a 32-bit hexadecimal
number (e.g. 0x41504093 for the 'APIC' signature on the MADT), <index>
is the index into the array of tables matching this signature,
<offset> is the byte offset within the table, and <length> is the
field length in bytes.

Numeric values are returned in reverse byte order, since ACPI numeric
values are usually little-endian.

For example:

  ${acpi/0x41504943.0.0.0.0}           - entire MADT table in raw hex
  ${acpi/0x41504943.0.0.0x0a.6:string} - MADT table OEM ID
  ${acpi/0x41504943.0.0.0x24.4:uint32} - local APIC address

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[efi] Provide access to ACPI tables
Michael Brown [Tue, 23 May 2017 17:32:31 +0000 (18:32 +0100)] 
[efi] Provide access to ACPI tables

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[acpi] Make acpi_find_rsdt() a per-platform method
Michael Brown [Mon, 22 May 2017 18:27:30 +0000 (19:27 +0100)] 
[acpi] Make acpi_find_rsdt() a per-platform method

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[settings] Extend numerical setting tags to 64 bits
Michael Brown [Tue, 16 May 2017 15:58:01 +0000 (16:58 +0100)] 
[settings] Extend numerical setting tags to 64 bits

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[tls] Keep cipherstream window open until TLS negotiation is complete
Michael Brown [Mon, 22 May 2017 12:17:23 +0000 (13:17 +0100)] 
[tls] Keep cipherstream window open until TLS negotiation is complete

When performing a SAN boot, the plainstream window size will be zero
(since this is the mechanism used internally to indicate that no data
should be fetched via the initial request).  This zero value currently
propagates to the advertised TCP window size, which prevents the TLS
negotiation from completing.

Fix by ensuring that the cipherstream window is held open until TLS
negotiation is complete, and only then falling back to passing through
the plainstream window size.

Reported-by: John Wigley <johnwigley#ipxe@acorna.co.uk>
Tested-by: John Wigley <johnwigley#ipxe@acorna.co.uk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[efi] Prevent EFI code from being linked in to non-EFI builds
Michael Brown [Fri, 19 May 2017 11:21:18 +0000 (12:21 +0100)] 
[efi] Prevent EFI code from being linked in to non-EFI builds

Ensure that efi_systab is an undefined symbol in non-EFI builds.  In
particular, this prevents users from incorrectly enabling IMAGE_EFI in
a BIOS build of iPXE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[xen] Provide 18 4kB receive buffers to work around xen-netback bug
Michael Brown [Fri, 19 May 2017 01:50:21 +0000 (02:50 +0100)] 
[xen] Provide 18 4kB receive buffers to work around xen-netback bug

The Xen network backend (xen-netback) suffered from a regression
between upstream Linux kernels 3.18 and 4.2 inclusive, which would
cause packet reception to fail unless at least 18 receive buffers were
available.  This bug was fixed in kernel commit 1d5d485 ("xen-netback:
require fewer guest Rx slots when not using GSO").

Work around this bug in affected versions of xen-netback by providing
the requisite 18 receive buffers.

Reported-by: Taylor Schneider <tschneider@live.com>
Tested-by: Taylor Schneider <tschneider@live.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[iscsi] Fix iBFT when no explicit initiator name setting exists
Michael Brown [Wed, 10 May 2017 14:30:51 +0000 (15:30 +0100)] 
[iscsi] Fix iBFT when no explicit initiator name setting exists

Commit 7cfdd76 ("[block] Describe all SAN devices via ACPI tables")
changed the definition of the iSCSI initiator IQN in the iBFT to
represent a common initiator IQN used for all iSCSI sessions, and
attempted to calculate this common initiator IQN by fetching the
common ${initiator-iqn} setting.

This fails when no explicit ${initiator-iqn} has been specified
(i.e. when an initiator IQN has instead been constructed from either
the hostname or system UUID), and results in an empty initiator IQN in
the iBFT.

Fix by using the initiator IQN of an arbitrary iSCSI session
present in the iBFT.

Debugged-by: Tal Aloni <tal.aloni.il@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[iscsi] Always send FirstBurstLength parameter
Michael Brown [Wed, 3 May 2017 12:01:11 +0000 (13:01 +0100)] 
[iscsi] Always send FirstBurstLength parameter

As of kernel 4.11, the LIO target will propose a value for
FirstBurstLength if the initiator did not do so.  This is entirely
redundant in our case, since FirstBurstLength is defined by RFC 3720
to be

  "Irrelevant when: ( InitialR2T=Yes and ImmediateData=No )"

and we already enforce both InitialR2T=Yes and ImmediateData=No in our
initial proposal.  However, LIO (arguably correctly) complains when we
do not respond to its redundant proposal of an already-irrelevant
value.

Fix by always proposing the default value for FirstBurstLength.

Debugged-by: Patrick Seeburger <info@8bit.de>
Tested-by: Patrick Seeburger <info@8bit.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[efi] Standardise PCI debug messages
Michael Brown [Mon, 1 May 2017 13:01:54 +0000 (14:01 +0100)] 
[efi] Standardise PCI debug messages

Use the PCI bus:dev.fn address in debug messages, falling back to the
EFI handle name only if we do not yet have enough information to
determine the bus:dev.fn address.

Include the vendor and device IDs in debug messages when no suitable
driver is found, to match the diagnostics available in a BIOS
environment.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[hyperv] Cope with Windows Server 2016 enlightenments
Michael Brown [Tue, 25 Apr 2017 13:13:22 +0000 (14:13 +0100)] 
[hyperv] Cope with Windows Server 2016 enlightenments

An "enlightened" external bootloader (such as Windows Server 2016's
winload.exe) may take ownership of the Hyper-V connection before all
INT 13 operations have been completed.  When this happens, all VMBus
devices are implicitly closed and we are left with a non-functional
network connection.

Detect when our Hyper-V connection has been lost (by checking the
SynIC message page MSR).  Reclaim ownership of the Hyper-V connection
and reestablish any VMBus devices, without disrupting any existing
iPXE state (such as IPv4 settings attached to the network device).

Windows Server 2016 will not cleanly take ownership of an active
Hyper-V connection.  Experimentation shows that we can quiesce by
resetting only the SynIC message page MSR; this results in a
successful SAN boot (on a Windows 2012 R2 physical host).  Choose to
quiesce by resetting (almost) all MSRs, in the hope that this will be
more robust against corner cases such as a stray synthetic interrupt
occurring during the handover.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[hyperv] Remove redundant return status code from mapping functions
Michael Brown [Fri, 28 Apr 2017 15:18:58 +0000 (16:18 +0100)] 
[hyperv] Remove redundant return status code from mapping functions

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[hyperv] Do not fail if guest OS ID MSR is already set
Michael Brown [Tue, 25 Apr 2017 12:33:52 +0000 (13:33 +0100)] 
[hyperv] Do not fail if guest OS ID MSR is already set

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Provide abstraction to allow system to be quiesced
Michael Brown [Wed, 26 Apr 2017 19:02:23 +0000 (20:02 +0100)] 
[block] Provide abstraction to allow system to be quiesced

When performing a SAN boot via INT 13, there is no way for the
operating system to indicate that it has finished using the INT 13 SAN
device.  We therefore have no opportunity to clean up state before the
loaded operating system's native drivers take over.  This can cause
problems when booting Windows, which tends not to be forgiving of
unexpected system state.

Windows will typically write a flag to the SAN device as the last
action before transferring control to the native drivers.  We can use
this as a heuristic to bring the system to a quiescent state (without
performing a full shutdown); this provides us an opportunity to
temporarily clean up state that could otherwise prevent a successful
Windows boot.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Provide sandev_read() and sandev_write() as global symbols
Michael Brown [Wed, 26 Apr 2017 19:00:10 +0000 (20:00 +0100)] 
[block] Provide sandev_read() and sandev_write() as global symbols

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[intel] Do not enable ASDE on i350 backplane NIC
Michael Brown [Sun, 16 Apr 2017 20:26:13 +0000 (21:26 +0100)] 
[intel] Do not enable ASDE on i350 backplane NIC

On most Intel NICs, Auto-Speed Detection Enable (ASDE) can be used to
automatically detect the correct link speed by sampling the link using
the internal PHY.  This feature is automatically inhibited when not
appropriate for the physical link (e.g. when using internal SerDes
mode on the 8254x).

On the i350 datasheet ASDE is a reserved bit, but the relevant
auto-speed detection hardware appears still to be present.  However,
enabling ASDE on the i350 1000BASE-KX backplane NIC seems to cause an
immediate link failure.  It is possible that the auto-speed detection
hardware is still present, is not connected to a physical link, and is
not inhibited from being applied in this mode.

Work around this problem by adding an INTEL_NO_ASDE flag bit
(analogous to INTEL_NO_PHY_RST), and applying this for the i350
backplane NIC.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[intel] Show original CTRL and STATUS values in debugging output
Michael Brown [Fri, 14 Apr 2017 09:09:57 +0000 (10:09 +0100)] 
[intel] Show original CTRL and STATUS values in debugging output

In situations where iPXE fails to reach link-up as expected, it is
useful to know the original values of the CTRL and STATUS registers
prior to our reset attempt.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Allow use of a non-default EFI SAN boot filename
Michael Brown [Wed, 12 Apr 2017 14:03:25 +0000 (15:03 +0100)] 
[block] Allow use of a non-default EFI SAN boot filename

Some older operating systems (e.g. RHEL6) use a non-default filename
on the root disk and rely on setting an EFI variable to point to the
bootloader.  This does not work when performing a SAN boot on a
machine where the EFI variable is not present.

Fix by allowing a non-default filename to be specified via the
"sanboot --filename" option or the "san-filename" setting.  For
example:

  sanboot --filename \efi\redhat\grub.efi \
          iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6

or

  option ipxe.san-filename code 188 = string;
  option ipxe.san-filename "\\efi\\redhat\\grub.efi";
  option root-path "iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6";

Originally-implemented-by: Vishvananda Ishaya Abrams <vish.ishaya@oracle.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[efi] Add efi_sprintf() and efi_vsprintf()
Michael Brown [Wed, 12 Apr 2017 14:01:56 +0000 (15:01 +0100)] 
[efi] Add efi_sprintf() and efi_vsprintf()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[efi] Fix typo in efi_acpi_table_protocol_guid
Michael Brown [Mon, 10 Apr 2017 15:46:11 +0000 (16:46 +0100)] 
[efi] Fix typo in efi_acpi_table_protocol_guid

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[sfc] Add driver for Solarflare SFC8XXX adapters
Martin Habets [Fri, 7 Apr 2017 09:46:15 +0000 (10:46 +0100)] 
[sfc] Add driver for Solarflare SFC8XXX adapters

Signed-off-by: Martin Habets <mhabets@solarflare.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[libc] Add stdbool.h standard header
Michael Brown [Mon, 10 Apr 2017 15:11:50 +0000 (16:11 +0100)] 
[libc] Add stdbool.h standard header

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[thunderx] Use ThunderxConfigProtocol to obtain board configuration
Adamczyk, Konrad [Thu, 30 Mar 2017 13:54:59 +0000 (13:54 +0000)] 
[thunderx] Use ThunderxConfigProtocol to obtain board configuration

Following changes were introduced:
 - added GetBgxProp and GetLmacProp methods to ThunderxConfigProtocol
 - replaced direct BOARD_CFG access with usage of introduced methods
 - removed redundant BOARD_CFG
 - changed GUID of ThunderxConfigProtocol, as this is not compatible
   with previous version
 - changed UINTN* to UINT64* buffer type to fix issue on 32-bit
   platforms with MAC address

This change allows us to avoid alignment of BOARD_CFG definitions
every time it changes in UEFI.

Signed-off-by: Konrad Adamczyk <konrad.adamczyk@cavium.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[scsi] Retry TEST UNIT READY command
Michael Brown [Wed, 29 Mar 2017 09:29:44 +0000 (12:29 +0300)] 
[scsi] Retry TEST UNIT READY command

The TEST UNIT READY command is issued automatically when the device is
opened, and is not the result of a command being issued by the caller.
This is required in order that a permanent TEST UNIT READY failure can
be used to identify unusable paths in a multipath SAN device.

Since the TEST UNIT READY command is not part of the caller's command
issuing process, it is not covered by any external retry loops (such
as the main retry loop in sandev_command()).

We must therefore be prepared to retry the TEST UNIT READY command
within the SCSI layer itself.  We retry only the TEST UNIT READY
command so as not to multiply the number of potential retries for
normal commands (which are already retried by sandev_command()).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[linux] Fix building with kernel 4.11 headers
Michael Brown [Wed, 29 Mar 2017 07:58:17 +0000 (10:58 +0300)] 
[linux] Fix building with kernel 4.11 headers

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[build] Avoid implicit-fallthrough warnings on GCC 7
Michael Brown [Wed, 29 Mar 2017 07:36:03 +0000 (10:36 +0300)] 
[build] Avoid implicit-fallthrough warnings on GCC 7

Reported-by: Vinson Lee <vlee@freedesktop.org>
Reported-by: Liang Yan <lyan@suse.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[mucurses] Fix erroneous __nonnull attribute
Michael Brown [Wed, 29 Mar 2017 07:35:05 +0000 (10:35 +0300)] 
[mucurses] Fix erroneous __nonnull attribute

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[http] Notify data transfer interface when underlying connection is ready
Michael Brown [Tue, 28 Mar 2017 20:37:03 +0000 (23:37 +0300)] 
[http] Notify data transfer interface when underlying connection is ready

HTTP implements xfer_window_changed() on the underlying server
connection using http_step(), which does not propagate the window
change notification to the data transfer interface.  This breaks the
multipath-capable SAN boot code, which relies on the window change
notification to discover that the HTTP block device is ready for
commands to be issued.

Fix by sending xfer_window_changed() in http_step() once the
underlying connection has been determined to be ready.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[iscsi] Do not install iBFT when no iSCSI targets exist
Michael Brown [Tue, 28 Mar 2017 17:45:23 +0000 (20:45 +0300)] 
[iscsi] Do not install iBFT when no iSCSI targets exist

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Describe all SAN devices via ACPI tables
Michael Brown [Mon, 27 Mar 2017 15:20:34 +0000 (18:20 +0300)] 
[block] Describe all SAN devices via ACPI tables

Describe all SAN devices via ACPI tables such as the iBFT.  For tables
that can describe only a single device (i.e. the aBFT and sBFT), one
table is installed per device.  For multi-device tables (i.e. the
iBFT), all devices are described in a single table.

An underlying SAN device connection may be closed at the time that we
need to construct an ACPI table.  We therefore introduce the concept
of an "ACPI descriptor" which enables the SAN boot code to maintain an
opaque pointer to the underlying object, and an "ACPI model" which can
build tables from a list of such descriptors.  This separates the
lifecycles of ACPI descriptions from the lifecycles of the block
device interfaces, and allows for construction of the ACPI tables even
if the block device interface has been closed.

For a multipath SAN device, iPXE will wait until sufficient
information is available to describe all devices but will not wait for
all paths to connect successfully.  For example: with a multipath
iSCSI boot iPXE will wait until at least one path has become available
and name resolution has completed on all other paths.  We do this
since the iBFT has to include IP addresses rather than DNS names.  We
will commence booting without waiting for the inactive paths to either
become available or close; this avoids unnecessary boot delays.

Note that the Linux kernel will refuse to accept an iBFT with more
than two NIC or target structures.  We therefore describe only the
NICs that are actually required in order to reach the described
targets.  Any iBFT with at most two targets is therefore guaranteed to
describe at most two NICs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Ignore redundant xfer_window_changed() messages
Michael Brown [Tue, 28 Mar 2017 15:58:47 +0000 (18:58 +0300)] 
[block] Ignore redundant xfer_window_changed() messages

For some block device protocols, the active path may continue to
receive xfer_window_changed() notifications during normal use.  These
currently result in the active path being erroneously closed.

Fix by ignoring any xfer_window_changed() messages if this path is
already the active path.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[linux] Use dummy SAN device
Michael Brown [Tue, 28 Mar 2017 12:22:42 +0000 (15:22 +0300)] 
[linux] Use dummy SAN device

Allow for easier testing of SAN code by using the dummy SAN device by
default.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Gracefully close SAN device if registration fails
Michael Brown [Mon, 27 Mar 2017 13:56:36 +0000 (16:56 +0300)] 
[block] Gracefully close SAN device if registration fails

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Retry reopening indefinitely for multipath devices
Michael Brown [Mon, 27 Mar 2017 10:18:14 +0000 (13:18 +0300)] 
[block] Retry reopening indefinitely for multipath devices

For multipath SAN devices, verify that the device is capable of being
opened (i.e. that all URIs are parseable and that at least one path is
alive) and thereafter retry indefinitely to reopen the device as
needed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Add a small delay between attempts to reopen SAN targets
Michael Brown [Mon, 27 Mar 2017 12:32:29 +0000 (15:32 +0300)] 
[block] Add a small delay between attempts to reopen SAN targets

When all SAN targets are completely unreachable, there will be a
natural delay between reopening attempts due to the network connection
timeout on the unreachable targets.

However, some SAN targets may accept connections instantly and report
a temporary unavailability by e.g. failing the TEST UNIT READY
command.  If all targets are behaving this way then there will be no
natural delay, and we will attempt to saturate the network with
connection attempts.

Fix by introducing a small delay between attempts.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Allow SAN retry count to be reconfigured
Michael Brown [Mon, 27 Mar 2017 10:06:16 +0000 (13:06 +0300)] 
[block] Allow SAN retry count to be reconfigured

Allow the SAN retry count to be configured via the ${san-retry}
setting, defaulting to the current value of 10 retries if not
specified.

Note that setting a retry count of zero is inadvisable, since iSCSI
targets in particular will often report spurious errors such as "power
on occurred" for the first few commands.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[time] Add sleep_fixed() function to sleep without checking for Ctrl-C
Michael Brown [Mon, 27 Mar 2017 12:31:42 +0000 (15:31 +0300)] 
[time] Add sleep_fixed() function to sleep without checking for Ctrl-C

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[int13con] Avoid overwriting random portions of SAN boot disks
Michael Brown [Mon, 27 Mar 2017 07:50:59 +0000 (10:50 +0300)] 
[int13con] Avoid overwriting random portions of SAN boot disks

The INT13 console type (CONSOLE_INT13) autodetects at initialisation
time a magic partition to be used for logging iPXE console output.  If
the INT13 drive number mapping is subsequently changed (e.g. because
iPXE was used to perform a SAN boot), then the console logging output
will be written to the incorrect disk.

Fix by recording the INT13 vector at initialisation time, and using
this original vector to emulate INT13 calls for all subsequent
accesses.  This should be robust against drive remapping performed
either by ourselves or by another bootloader (e.g. a chainloaded
undionly.kpxe which then performs a SAN boot).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[int13] Improve geometry guessing for unaligned partitions
Michael Brown [Sun, 26 Mar 2017 18:03:50 +0000 (21:03 +0300)] 
[int13] Improve geometry guessing for unaligned partitions

Some partition tables have partitions that are not aligned to a
cylinder boundary, which confuses the current geometry guessing logic.

Enhance the existing logic to ensure that we never reduce our guesses
for the number of heads or sectors per track, and add extra logic to
calculate the exact number of sectors per track if we find a partition
that starts within cylinder zero.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Add basic multipath support
Michael Brown [Sun, 26 Mar 2017 12:12:11 +0000 (15:12 +0300)] 
[block] Add basic multipath support

Add basic support for multipath block devices.  The "sanboot" and
"sanhook" commands now accept a list of SAN URIs.  We open all URIs
concurrently.  The first connection to become available for issuing
block device commands is marked as the active path and used for all
subsequent commands; all other connections are then closed.  Whenever
the active path fails, we reopen all URIs and repeat the process.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[block] Add dummy SAN device
Michael Brown [Sun, 26 Mar 2017 12:42:52 +0000 (15:42 +0300)] 
[block] Add dummy SAN device

Add a dummy SAN device which allows the "sanhook" command to be tested
even when no SAN booting capability is present on the platform.  This
allows substantial portions of the SAN boot code to be run in Linux
under Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[scsi] Avoid duplicate call to scsicmd_close() on TEST UNIT READY failure
Michael Brown [Sun, 26 Mar 2017 08:21:14 +0000 (11:21 +0300)] 
[scsi] Avoid duplicate call to scsicmd_close() on TEST UNIT READY failure

When the TEST UNIT READY command receives an error response, the
shutdown of the command's block data interface will result in
scsidev_ready() closing the SCSI device.  This will subsequently
result in a duplicate call to scsicmd_close(), leading to an assertion
failure when list_del() is called for the second time.

Fix by removing the command from the list of outstanding commands
before shutting down the command's interfaces.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[vxge] Fix use of stale I/O buffer on error path
Michael Brown [Thu, 23 Mar 2017 19:10:25 +0000 (21:10 +0200)] 
[vxge] Fix use of stale I/O buffer on error path

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[iobuf] Increase minimum I/O buffer size to 128 bytes
Michael Brown [Thu, 23 Mar 2017 16:15:24 +0000 (18:15 +0200)] 
[iobuf] Increase minimum I/O buffer size to 128 bytes

The eIPoIB translation layer needs to translate outbound ARP packets
from Ethernet to IPoIB.  A 64-byte buffer (starting with the Ethernet
header) does not provide enough tailroom to expand to hold the two
20-byte IPoIB MAC addresses.  The result is that an UNDI API user will
be unable to send ARP packets.

We could potentially shuffle the packet contents to reuse the space
occupied by the stripped Ethernet link-layer header, but this would
add complexity.  Instead, fix by increasing the minimum allocation
size to 128 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[sky2] Use 32-bit read to read Y2_VAUX_AVAIL
Mike McCormack [Thu, 23 Mar 2017 15:54:03 +0000 (17:54 +0200)] 
[sky2] Use 32-bit read to read Y2_VAUX_AVAIL

B0_CTST is a 24bit register according to the vendor driver (sk98lin).
A 16bit read on B0_CTST will always return 0 for Y2_VAUX_AVAIL
(1<<16), so use a 32bit read when testing Y2_VAUX_AVAIL.

[This patch is copied directly from the Linux kernel tree.]

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[pcnet32] Eliminate redundant register read
Michael Brown [Thu, 23 Mar 2017 15:35:10 +0000 (17:35 +0200)] 
[pcnet32] Eliminate redundant register read

The value of ( ( x & 0x0c00 ) | 0x0c00 ) is always 0x0c00 regardless
of the value of x, and so the read_csr() is redundant.  (There are no
read side effects for this register, according to the datasheet.)

This line of code originated in Linux kernel 2.3.19pre1 as

  a->write_csr(ioaddr, 80, a->read_csr(ioaddr, 80) | 0x0c00);

and was modified in kernel 2.3.41pre4 to read

  a->write_csr(ioaddr, 80, (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00);

In the absence of commit messages, the intention of the code is
unclear.  However, the logic resulting in a fixed value of 0x0c00 has
remained unaltered for over 17 years, and can probably be assumed to
have the correct overall result.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[golan] Bug fixes and improved paging allocation method
Raed Salem [Thu, 23 Mar 2017 13:56:27 +0000 (15:56 +0200)] 
[golan] Bug fixes and improved paging allocation method

Updates:
- revert Support for clear interrupt via BAR

Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[rtl818x] Fix resource leak on error path
Michael Brown [Thu, 23 Mar 2017 09:40:23 +0000 (11:40 +0200)] 
[rtl818x] Fix resource leak on error path

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[travis] Integrate with Coverity Scan
Michael Brown [Thu, 23 Mar 2017 08:22:36 +0000 (10:22 +0200)] 
[travis] Integrate with Coverity Scan

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[travis] Build and run the unit test suite
Michael Brown [Wed, 22 Mar 2017 20:22:25 +0000 (22:22 +0200)] 
[travis] Build and run the unit test suite

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[travis] Add minimal .travis.yml file
Michael Brown [Wed, 22 Mar 2017 18:20:53 +0000 (20:20 +0200)] 
[travis] Add minimal .travis.yml file

Allow for automated builds via Travis CI (https://travis-ci.org).

Note that the bin-i386-linux build platform is deliberately omitted
since the required linux-libc-dev:i386 package is not on the allowed
packages list for the Travis 14.04 ("trusty") container environment.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[malloc] Track maximum heap usage
Michael Brown [Wed, 22 Mar 2017 18:01:25 +0000 (20:01 +0200)] 
[malloc] Track maximum heap usage

Track the current and maximum heap usage, and display the maximum
during shutdown when DEBUG=malloc is enabled.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[coverity] Add Coverity user model
Michael Brown [Wed, 22 Mar 2017 14:46:03 +0000 (16:46 +0200)] 
[coverity] Add Coverity user model

Add a trivial model file to prevent Coverity from making various
incorrect assumptions about functions where the iPXE behaviour
diverges from POSIX or Linux norms.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[mucurses] Ensure SLK labels are always terminated
Michael Brown [Wed, 22 Mar 2017 14:35:29 +0000 (16:35 +0200)] 
[mucurses] Ensure SLK labels are always terminated

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[sis190] Avoid NULL pointer dereference
Michael Brown [Wed, 22 Mar 2017 14:12:56 +0000 (16:12 +0200)] 
[sis190] Avoid NULL pointer dereference

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[w89c840] Avoid potential array overrun
Michael Brown [Wed, 22 Mar 2017 13:59:27 +0000 (15:59 +0200)] 
[w89c840] Avoid potential array overrun

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[tlan] Guard against failure to identify chip
Michael Brown [Wed, 22 Mar 2017 13:28:58 +0000 (15:28 +0200)] 
[tlan] Guard against failure to identify chip

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[hermon] Assert that mapping length is non-zero
Michael Brown [Wed, 22 Mar 2017 13:18:54 +0000 (15:18 +0200)] 
[hermon] Assert that mapping length is non-zero

An (impossible) mapping length of zero produces a negative bit shift,
which is technically undefined.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[arbel] Assert that mapping length is non-zero
Michael Brown [Wed, 22 Mar 2017 13:18:54 +0000 (15:18 +0200)] 
[arbel] Assert that mapping length is non-zero

An (impossible) mapping length of zero produces a negative bit shift,
which is technically undefined.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[video_subr] Use memmove() for overlapping memory copy
Michael Brown [Wed, 22 Mar 2017 13:13:06 +0000 (15:13 +0200)] 
[video_subr] Use memmove() for overlapping memory copy

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[tcp] Use correct length for memset()
Michael Brown [Wed, 22 Mar 2017 13:11:05 +0000 (15:11 +0200)] 
[tcp] Use correct length for memset()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2 years ago[xen] Use standard calling pattern for asprintf()
Michael Brown [Wed, 22 Mar 2017 12:41:01 +0000 (14:41 +0200)] 
[xen] Use standard calling pattern for asprintf()

Our asprintf() implementation guarantees that strp will be NULL on
allocation failure, but this is not standard behaviour.  Detect errors
by checking for a negative return value instead of a NULL pointer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>