david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

4970 Commits

Author SHA1 Message Date
Michael Brown bb1abb2b21 [ipv4] Rewrite inet_aton()
The implementation of inet_aton() has an unknown provenance.  Rewrite
this code to avoid potential licensing uncertainty.

Also move the code from core/misc.c to its logical home in net/ipv4.c,
and add a few extra test cases.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-19 14:02:07 +00:00
Michael Brown 095c007aa3 [legal] Add missing copyright header to net/ipv4.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-18 14:16:59 +00:00
Michael Brown b05e7e50fa [test] Add IPv4 self-tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-18 14:11:32 +00:00
Michael Brown 645458e5a0 [xhci] Abort commands on timeout
When a command times out, abort it (via the Command Abort bit in the
Command Ring Control Register) so that subsequent commands may execute
as expected.

This improves robustness when a device fails to respond to the Set
Address command, since the subsequent Disable Slot command will now
succeed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-18 11:10:55 +00:00
Michael Brown 88448de720 [xhci] Leak memory if controller fails to disable slot
If the Disable Slot command fails then the hardware may continue to
write to the slot context.  Leak the memory used by the slot context
to avoid future memory corruption.

This situation has been observed in practice when a Set Address
command fails, causing the command ring to become temporarily
unresponsive.

Note that there is no need to similarly leak memory on the failure
path in xhci_device_open(), since in the event of a failure the
hardware is never informed of the slot context address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-18 09:32:50 +00:00
Michael Brown 08189df4e0 [timer] Rewrite the 8254 Programmable Interval Timer support
The 8254 timer code (used to implement udelay()) has an unknown
provenance.  Rewrite this code to avoid potential licensing
uncertainty.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 16:24:02 +00:00
Michael Brown 320e786d3d [ncm] Use generic USB network device framework
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 01:21:54 +00:00
Michael Brown 5b9b5ced4e [ecm] Use generic USB network device framework
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 01:21:54 +00:00
Michael Brown a92fb8d9a5 [usb] Add generic USB network device framework
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 01:21:53 +00:00
Michael Brown 21d3d5c47c [libc] Reduce size of memset()
As with memcpy(), we can reduce the code size (by an average of 0.2%)
by giving the compiler more visibility into what memset() is doing,
and by avoiding the "rep" prefix on short fixed-length sequences of
string operations.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 00:42:28 +00:00
Michael Brown 7867e48cee [test] Add constant-length memset() self-tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 00:41:40 +00:00
Michael Brown cd8273b308 [test] Add self-tests for more string functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-16 23:16:20 +00:00
Michael Brown 8ee39f7432 [libc] Rewrite string functions
Some of the C library string functions have an unknown provenance.
Reimplement all such functions to avoid potential licensing
uncertainty.

Remove the inline-assembler versions of strlen(), memswap(), and
strncmp(); these save a minimal amount of space (around 40 bytes in
total) and are not performance-critical.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-16 23:16:20 +00:00
Michael Brown b54167b8b6 [libc] Remove unused string functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-16 16:25:20 +00:00
Michael Brown 14fc311271 [ncm] Use generic refill framework for bulk IN and interrupt endpoints
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-15 23:13:41 +00:00
Michael Brown 1706ab7ff3 [ecm] Use generic refill framework for bulk IN and interrupt endpoints
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-13 01:12:24 +00:00
Michael Brown ebe433e795 [usb] Use generic refill framework for USB hub interrupt endpoints
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-13 01:10:57 +00:00
Michael Brown 17fc79425e [usb] Provide generic framework for refilling receive endpoints
Provide a generic framework for allocating, refilling, and optionally
recycling I/O buffers used by bulk IN and interrupt endpoints.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-13 01:10:51 +00:00
Michael Brown 5de134662d [build] Apply the "-fno-PIE -nopie" workaround only to i386 builds
Hardened versions of gcc default to building position-independent
code, which breaks our i386 build.  Our build process therefore
detects such platforms and automatically adds "-fno-PIE -nopie" to the
gcc command line.

On x86_64, we choose to build position-independent code (in order to
reduce the final binary size and, in particular, the number of
relocations required for UEFI binaries).  The workaround therefore
breaks the build process for x86_64 binaries on such platforms.

Fix by moving the workaround to the i386-specific portion of the
Makefile.

Reported-by: Jan Kundrát <jkt@kde.org>
Debugged-by: Jan Kundrát <jkt@kde.org>
Debugged-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-12 16:04:07 +00:00
Michael Brown 907cffb7c5 [efi] Disallow R_X86_64_32 relocations
UEFI binaries may be relocated to any location within the 64-bit
address space.  We compile as position-independent code with hidden
visibility, which should force all relocation records to be either
PC-relative (in which case no PE relocations are required) or full
64-bit relocations.  There should be no R_X86_64_32 relocation
records, since that would imply an invalid assumption that code could
not be relocated above 4GB.

Remove support for R_X86_64_32 relocation records from util/elf2efi.c,
so that any such records result in a build failure rather than a
potential runtime failure.

Reported-by: Jan Kundrát <jkt@kde.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-12 13:39:25 +00:00
Olaf Hering 335a7ddcd4 [build] Sort objects in blib.a
When building hvmloader for Xen tools the iPXE objects are also linked
into the binary.  Unfortunately the linker will place them in the
order found in the archive.  Since this order is random the resulting
hvmloader binary differs when it was built from identical sources but
on different build hosts.  To help with creating a reproducible binary
the elements in blib.a must simply be sorted before passing them to
$(AR).

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-12 09:43:02 +00:00
Michael Brown 6fe8f80418 [usb] Handle port status changes received after failing to find a driver
Commit a60f2dd ("[usb] Try multiple USB device configurations")
changed the behaviour of register_usb() such that if no drivers are
found then the device will be closed and the memory used will be
freed.

If a port status change subsequently occurs while the device is still
physically attached, then usb_hotplug() will see this as a new device
having been attached, since there is no device recorded as being
currently attached to the port.  This can lead to spurious hotplug
events (or even endless loops of hotplug events, if the process of
opening and closing the device happens to generate a port status
change).

Fix by using a separate flag to indicate that a device is physically
attached (even if we have no corresponding struct usb_device).

Reported-by: Dan Ellis <Dan.Ellis@displaylink.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-12 00:57:15 +00:00
Michael Brown f3725a86e0 [rndis] Add rndis_rx_err()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 17:26:51 +00:00
Michael Brown 4b2800c7d5 [build] Allow product tag line to be customised via config/branding.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 14:22:43 +00:00
Michael Brown b06fdcf936 [build] Allow setting help text URI to be customised via config/branding.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 14:11:28 +00:00
Michael Brown 92f3bd901e [build] Allow command help text URI to be customised via config/branding.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 14:11:28 +00:00
Michael Brown eac445b650 [build] Allow error message URI to be customised via config/branding.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 14:11:28 +00:00
Michael Brown e1ce15ec3c [build] Allow product URI to be customised via config/branding.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 14:11:28 +00:00
Michael Brown 544a6a9769 [build] Use PRODUCT_SHORT_NAME for end-user visible strings
Use PRODUCT_SHORT_NAME instead of a hardcoded "iPXE" for strings which
are typically shown in the user interface.

Note that this only allows for customisation of the user interface.
Where the "iPXE" string serves a technical purpose (such as in the
HTTP User-Agent), the string cannot be customised.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 14:11:22 +00:00
Michael Brown 1c3fb3c61a [build] Move branding information to config/branding.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 12:51:58 +00:00
Michael Brown 32d20fdd7e [xhci] Delay after (possibly) forcing port link state to RxDetect
Some xHCI controllers (observed with a Renesas Electronics PCIe USB3
card) seem to require a delay after forcing the link state of USB3
ports to RxDetect.  Omitting this delay causes strange behaviour
including system lockups.

Add an unconditional 20ms delay after writing the port link states.
This seems to be sufficient to avoid the problem.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-11 11:18:35 +00:00
Michael Brown 1bb9e88ba0 [ecm] Add support for CDC-ECM USB Ethernet devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-10 13:49:27 +00:00
Michael Brown 58c3e7f747 [usb] Allow usb_stream() to enforce a terminating short packet
Some USB endpoints require that a short packet be used to terminate
transfers, since they have no other way to determine message
boundaries.  If the message length happens to be an exact multiple of
the USB packet size, then this requires the use of an additional
zero-length packet.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-10 13:49:27 +00:00
Michael Brown 17aceb34da [usb] Parse endpoint descriptor bInterval field
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-10 01:14:22 +00:00
Michael Brown cf153f60a5 [usb] Handle CDC union functional descriptors
USB Communications Device Class devices may use a union functional
descriptor to group several interfaces into a function.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-09 16:34:55 +00:00
Michael Brown a60f2ddfeb [usb] Try multiple USB device configurations
Iterate over a USB device's available configurations until we find one
for which we have working drivers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-09 14:46:22 +00:00
Michael Brown 2e72d100af [ncm] Reserve headroom in received packets
Some protocols (such as ARP) may modify the received packet and re-use
the same I/O buffer for transmission of a reply.  To allow this,
reserve sufficient headroom at the start of each received packet
buffer for our transmit datapath headers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-06 15:46:43 +00:00
Michael Brown 95bc563f0c [pxe] Maintain a queue for received PXE UDP packets
Some devices return multiple packets in a single poll.  Handle such
devices gracefully by enqueueing received PXE UDP packets (along with
a pseudo-header to hold the IPv4 addresses and port numbers) and
dequeueing them on subsequent calls to PXENV_UDP_READ.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-06 14:16:31 +00:00
Michael Brown c9dbe1d39c [pxe] Use tftp_uri() to construct PXE TFTP URIs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-06 12:27:20 +00:00
Michael Brown e2a26f76de [uri] Allow tftp_uri() to construct a URI with a custom port
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-06 12:18:18 +00:00
Michael Brown 2dfdcae938 [tftp] Explicitly abort connection whenever parent interface is closed
Fetching the TFTP file size is currently implemented via a custom
"tftpsize://" protocol hack.  Generalise this approach to instead
close the TFTP connection whenever the parent data-transfer interface
is closed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-06 12:08:54 +00:00
Michael Brown 2d3f2b2446 [ncm] Use large multi-packet buffers by default
Some devices have a very small number of internal buffers, and rely on
being able to pack multiple packets into each buffer.  Using 2048-byte
buffers on such devices produces throughput of around 100Mbps.  Using
a small number of much larger buffers (e.g. 32kB) increases the
throughput to around 780Mbps.  (The full 1Gbps is not reached because
the high RTT induced by the use of multi-packet buffers causes us to
saturate our 256kB TCP window.)

Since allocation of large buffers is very likely to fail, allocate the
buffer set only once when the device is opened and recycle buffers
immediately after use.  Received data is now always copied to
per-packet buffers.

If allocation of large buffers fails, fall back to allocating a larger
number of smaller buffers.  This will give reduced performance, but
the device will at least still be functional.

Share code between the interrupt and bulk IN endpoint handlers, since
the buffer handling is now very similar.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-06 09:54:04 +00:00
Michael Brown 66048e3214 [usb] Report xHCI host controller events
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-05 12:40:05 +00:00
Michael Brown cc5a27f9cb [ncm] Add support for CDC-NCM USB Ethernet devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-03 12:33:35 +00:00
Michael Brown fd53ada87c [usb] Add support for xHCI host controllers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-03 12:33:28 +00:00
Michael Brown e17e771a13 [usb] Add basic support for USB hubs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-03 12:19:52 +00:00
Michael Brown 018b13dcec [usb] Add basic support for USB devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-03 12:19:47 +00:00
Michael Brown 8c43891db4 [romprefix] Ensure UNDI loader can be included by all ROM types
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-02 15:11:41 +00:00
Michael Brown 072d656a2f [pci] Allow drivers to specify a PCI class
Allow drivers to specify a supported PCI class code.  To save space in
the final binary, make this an attribute of the driver rather than an
attribute of a PCI device ID list entry.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-02 14:31:18 +00:00
Michael Brown d38bac05e7 [build] Include Hyper-V driver in the all-drivers build
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-21 11:21:34 +00:00