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

5288 Commits

Author SHA1 Message Date
Michael Brown 9aa8090d06 [base16] Add buffer size parameter to base16_encode() and base16_decode()
The current API for Base16 (and Base64) encoding requires the caller
to always provide sufficient buffer space.  This prevents the use of
the generic encoding/decoding functionality in some situations, such
as in formatting the hex setting types.

Implement a generic hex_encode() (based on the existing
format_hex_setting()), implement base16_encode() and base16_decode()
in terms of the more generic hex_encode() and hex_decode(), and update
all callers to provide the additional buffer length parameter.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-24 14:41:32 +01:00
Michael Brown b56b482fa3 [test] Include IPv6 support when performing settings self-tests
The settings self-tests include tests for the "ipv6" setting type.
When IPv6 support is not included, this setting type exists (since it
is referred to by some dual-stack code, such as dns.c) but is
non-functional.

Force IPv6 support to be included within a settings self-test build
using an explicit REQUIRE_OBJECT() macro.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-24 14:41:32 +01:00
Christian Hesse 1b56452121 [ath9k] Remove confusing logic inversion in an ANI variable
This changed in Linux kernel the same way in commit 7067e701
("ath9k_hw: remove confusing logic inversion in an ANI variable") by
Felix Fietkau.

Additionally this fixes "error: logical not is only applied to the
left hand side of comparison" with GCC 5.1.0.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-24 13:08:29 +01:00
Christian Hesse bf40b79734 [build] Add missing "const" qualifiers
This fixes "initialization discards 'const' qualifier from pointer
target type" warnings with GCC 5.1.0.

Signed-off-by: Christian Hesse <mail@eworm.de>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-24 13:03:28 +01:00
Christian Hesse 5744c3e8cd [intel] Add PCI device IDs for Intel I218-LM and I218-V
I218-LM (rev 3) is found in Lenovo Thinkpad X250.  The remaining
device IDs are from linux/drivers/net/ethernet/intel/e1000e/hw.h

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-22 13:57:52 +01:00
Michael Brown dc19e630cb [build] Construct all-drivers list based on driver class
The USB bus drivers (ehci.c and xhci.c) have PCI device ID tables and
hence PCI_ROM() lines, but should probably not be included in the
all-drivers build on this basis, since they do nothing useful unless a
USB network driver is also present.

Fix by constructing the all-drivers list based on the driver class
(i.e. the portion of the source path immediately after "drivers/").

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-22 12:21:14 +01:00
Michael Brown 2154af0077 [rtl818x] Obviate RTL_ROM() hack
Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-22 11:05:19 +01:00
Michael Brown eda1c58358 [realtek] Do not attempt to access EEPROM on RTL8169 chips
On some RTL8169 onboard NICs (observed with a Lenovo ThinkPad 11e),
the EEPROM is not merely not present: any attempt to read from the
non-existent EEPROM will crash and reboot the system.

The equivalent code to read from the EEPROM was removed from the Linux
r8169 driver in 2009 with a comment suggesting that it was similarly
found to be unreliable on some systems.

Fix by accessing the EEPROM only on RTL8139 NICs, and assuming that
the MAC address will always be correctly preset on RTL8169 NICs.

Reported-by: Evan Prohaska <eprohaska@edkey.org>
Tested-by: Evan Prohaska <eprohaska@edkey.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-21 17:42:36 +01:00
Michael Brown 8958f62a1c [intel] Force RX polling on VMware emulated 82545em
The emulated Intel 82545em in some versions of VMware (observed with
ESXi v5.1) seems to sometimes fail to set the RXT0 bit in the
interrupt cause register (ICR), causing iPXE to stop receiving
packets.  Work around this problem (for the 82545em only) by always
polling the receive queue regardless of the state of the ICR.

Reported-by: Slava Bendersky <volga629@networklab.ca>
Tested-by: Slava Bendersky <volga629@networklab.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-21 16:52:33 +01:00
Michael Brown 63dcab002e [intel] Report any unexpected interrupt causes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-21 15:47:16 +01:00
Ed Swierk da990b8870 [intel] Update PCI device IDs for Intel 82599 and X540 10G NICs
Identifiers are based on defines in Linux ixgbe_type.h.

Descriptive names are based on
https://www-ssl.intel.com/content/www/us/en/ethernet-controllers/82599-10-gbe-controller-spec-update.html
and
https://www-ssl.intel.com/content/www/us/en/network-adapters/10-gigabit-network-adapters/ethernet-x540-spec-update.html

Signed-off-by: Ed Swierk <eswierk@skyportsystems.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-21 15:40:55 +01:00
Michael Brown 02bf08bc1e [build] Use a single call to parserom.pl to speed up building
Inspired-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-18 16:11:21 +01:00
Michael Brown dac866b066 [build] Work around binutils quirk on OpenBSD 5.7
The assembler on OpenBSD 5.7 seems not to correctly handle the
combinations of .struct and .previous used in unlzma.S, and ends up
complaining about an "attempt to allocate data in absolute section".

Work around this problem by explicitly resetting the section after the
data structure definitions.

Reported-by: Jiri B <jirib@devio.us>
Tested-by: Jiri B <jirib@devio.us>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-18 00:53:27 +01:00
Michael Brown b594bfd490 [build] Fix compiler warning on OpenBSD 5.7
Reported-by: Jiri B <jirib@devio.us>
Tested-by: Jiri B <jirib@devio.us>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-17 23:56:03 +01:00
Michael Brown 40de412762 [build] Allow building PCI ROMs with device ID lists
PCI v3.0 supports a "device list" which allows the ROM to claim
support for multiple PCI device IDs (but only a single vendor ID).
Add support for building such ROMs by scanning the build target
element list and incorporating any device IDs into the ROM's device
list header.  For example:

  make bin/8086153a--8086153b.mrom

would build a ROM claiming support for both 8086:153a and 8086:153b.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-15 12:20:06 +01:00
Michael Brown fb31365db4 [prism2] Remove duplicate PCI_ROM() lines
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-15 11:38:10 +01:00
Michael Brown 532649aacf [eepro100] Remove duplicate PCI_ROM() line
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-15 11:38:10 +01:00
Michael Brown 7ca801d637 [efi] Use the EFI_RNG_PROTOCOL as an entropy source if available
Entropy gathering via timer ticks is slow under UEFI (of the order of
20-30 seconds on some machines).  Use the EFI_RNG_PROTOCOL if
available, to speed up the process of entropy gathering.

Note that some implementations (including EDK2) will fail if we
request fewer than 32 random bytes at a time, and that the RNG
protocol provides no guarantees about the amount of entropy provided
by a call to GetRNG().  We take the (hopefully pessimistic) view that
a 32-byte block returned by GetRNG() will contain at least the 1.3
bits of entropy claimed by min_entropy_per_sample().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-14 17:53:13 +01:00
Michael Brown c6c7e78c42 [efi] Poll for TX completions only when there is an outstanding TX buffer
At least one NII implementation (in a Microsoft Surface tablet) seems
to fail to report the absence (sic) of TX completions properly.  Work
around this by checking for TX completions only when we expect to see
one.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-14 17:02:00 +01:00
Michael Brown 729c16ad5b [efi] Poll media status only if advertised as supported
Some NII implementations will fail the GET_STATUS operation if we
request the media status.  Fix by doing so only if GET_INIT_INFO
reported that media status is supported.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-14 16:44:37 +01:00
Michael Brown 914dd539b0 [efi] Provide a dummy data block in nii_initialise()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-14 16:21:37 +01:00
Michael Brown 6567511c3d [efi] Add EFI time source
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-14 11:55:08 +01:00
Michael Brown eb2252fd7a [efi] Add EFI entropy source
Originally-implemented-by: Jarrod Johnson <jbjohnso@us.ibm.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-14 11:37:38 +01:00
Michael Brown 452aa157be [util] Add ability to dump PCI device ID list
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-13 16:22:35 +01:00
Michael Brown ae01462b79 [romprefix] Allow autoboot device filter to be disabled
Our current behaviour when booting as a ROM is to autoboot only from
devices which are attached via the PCI bus:dev.fn address passed to
the ROM's initialisation vector.

Add a build configuration option AUTOBOOT_ROM_FILTER (enabled by
default) to control this behaviour.  This allows for ROMs to be built
which will attempt to boot from any detected device, even if not
attached via the original PCI bus:dev.fn address.  (This is
particularly useful when building combined EHCI/xHCI ROMs for USB
network boot, since the BIOS may request a boot via the EHCI
controller but the xHCI driver will reroute the root hub ports to the
xHCI controller.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-13 14:49:02 +01:00
Michael Brown 867e3ee475 [xhci] Always reset root hub ports
In theory USB3 ports do not require a reset to enable the port.
Experimentation shows that this is sometimes required, particularly
when rerouting ports from EHCI to xHCI and switching speeds.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-13 14:37:15 +01:00
Robin Smidsrød 68d8a44469 [build] Rewrite parserom.pl to support multiple source files
Running util/parserom.pl on all source files (637) one by one takes
approximately 35 seconds because of the startup cost of each invocation.
With the utility rewritten to support multiple source files it now takes
approximately 1 second to scan all source files for ROM declarations.

The --exclude-driver and --exclude-driver-class options have been added,
making it possible to skip certain source files from being scanned at all.

In addition --debug option has been added to more easily trace progress.

Finally --help option was added to show usage information.

Signed-off-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-13 12:37:30 +01:00
Michael Brown d9166bbcae [peerdist] Add support for decoding PeerDist Content Information
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-13 12:26:05 +01:00
Michael Brown 755d2b8f6b [efi] Ensure drivers are disconnected when ExitBootServices() is called
We hook the UEFI ExitBootServices() event and use it to trigger a call
to shutdown_boot().  This does not automatically cause drivers to be
disconnected from their devices, since device enumeration is now
handled by the UEFI core rather than by iPXE.  (Under the old and
dubiously compatible device model, iPXE used to perform its own device
enumeration and so the call to shutdown_boot() would indeed have
caused drivers to be disconnected.)

Fix by replicating parts of the dummy "EFI root device" from
efiprefix.c to efidrvprefix.c, so that the call to shutdown_boot()
will call efi_driver_disconnect_all().

Originally-fixed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-13 12:06:59 +01:00
Michael Brown ea3d5875cd [crypto] Add SHA-512/224 algorithm
SHA-512/224 is almost identical to SHA-512, with differing initial
hash values and a truncated output length.

This implementation has been verified using the NIST SHA-512/224 test
vectors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-12 17:02:11 +01:00
Michael Brown e5e91ab471 [crypto] Add SHA-512/256 algorithm
SHA-512/256 is almost identical to SHA-512, with differing initial
hash values and a truncated output length.

This implementation has been verified using the NIST SHA-512/256 test
vectors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-12 17:01:10 +01:00
Michael Brown 02879299c9 [crypto] Add SHA-384 algorithm
SHA-384 is almost identical to SHA-512, with differing initial hash
values and a truncated output length.

This implementation has been verified using the NIST SHA-384 test
vectors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-12 17:01:10 +01:00
Michael Brown 6f713c2d95 [crypto] Add SHA-512 algorithm
This implementation has been verified using the NIST SHA-512 test
vectors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-12 17:01:10 +01:00
Michael Brown 4dbc44348c [crypto] Add SHA-224 algorithm
SHA-224 is almost identical to SHA-256, with differing initial hash
values and a truncated output length.

This implementation has been verified using the NIST SHA-224 test
vectors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-12 17:01:10 +01:00
Michael Brown a9da129122 [test] Simplify digest algorithm self-tests
Update the digest self-tests to use okx(), and centralise concepts and
data shared between tests for multiple algorithms to reduce duplicated
code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-12 17:01:10 +01:00
Laszlo Ersek b12b1b620f [virtio] Downgrade per-iobuf debug messages to DBGC2
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-10 21:18:42 +01:00
Michael Brown dc795b9fef [test] Add setjmp()/longjmp() self-tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-07 06:40:46 +01:00
Michael Brown fb2bedcff3 [libc] Add x86_64 versions of setjmp() and longjmp()
None of the x86_64 builds currently have any way of invoking these
functions.  They are included only to avoid introducing unnecessary
architecture-specific dependencies into the self-test suite.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-07 06:40:42 +01:00
Michael Brown 00ff3d8bb3 [libc] Fix typo in longjmp()
Commit 8ab4b00 ("[libc] Rewrite setjmp() and longjmp()") introduced a
regression in which the saved values of %ebx, %esi, and %edi were all
accidentally restored into %esp.  The result is that the second and
subsequent returns from setjmp() would effectively corrupt %ebx, %esi,
%edi, and the stack pointer %esp.

Use of setjmp() and longjmp() is generally discouraged: our only use
occurs as part of the implementation of PXENV_RESTART_TFTP, since the
PXE API effectively mandates its use here.  The call to setjmp()
occurs at the start of pxe_start_nbp(), where there are almost
certainly no values held in %ebx, %esi, or %edi.  The corruption of
these registers therefore had no visible effect on program execution.
The corruption of %esp would have been visible on return from
pxe_start_nbp(), but there are no known PXE NBPs which first call
PXENV_RESTART_TFTP and subsequently attempt to return to the PXE base
code.  The effect on program execution was therefore similar to that
of moving the stack to a pseudo-random location in the 32-bit address
space; this will often allow execution to complete successfully since
there is a high chance that the pseudo-random location will be unused.
The regression therefore went undetected for around one month.

Fix by restoring the correct registers from the saved jmp_buf
structure.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-04-07 06:40:34 +01:00
Michael Brown f557794ab3 [xhci] Support USB1 devices attached via transaction translators
xHCI provides a somewhat convoluted mechanism for specifying details
of a transaction translator.  Hubs must be marked as such in the
device slot context.  The only opportunity to do so is as part of a
Configure Endpoint command, which can be executed only when opening
the hub's interrupt endpoint.

We add a mechanism for host controllers to intercept the opening of
hub devices, providing xHCI with an opportunity to update the internal
device slot structure for the corresponding USB device to indicate
that the device is a hub.  We then include the hub-specific details in
the input context whenever any Configure Endpoint command is issued.

When a device is opened, we record the device slot and port for its
transaction translator (if any), and supply these as part of the
Address Device command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-23 20:24:20 +00:00
Michael Brown 026b3446b9 [usb] Improve debug messages for failed control transactions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-23 20:18:02 +00:00
Michael Brown b418af26d9 [ehci] Support USB1 devices attached via transaction translators
Support low-speed and full-speed devices attached to a USB2 hub.  Such
devices use a transaction translator (TT) within the USB2 hub, which
asynchronously initiates transactions on the lower-speed bus and
returns the result via a split completion on the high-speed bus.

We make the simplifying assumption that there will never be more than
sixteen active interrupt endpoints behind a single transaction
translator; this assumption allows us to schedule all periodic start
splits in microframe 0 and all periodic split completions in
microframes 2 and 3.  (We do not handle isochronous endpoints.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-23 16:23:08 +00:00
Michael Brown 5486c947e2 [usb] Clear transaction translator buffers when applicable
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-23 16:22:55 +00:00
Michael Brown 9e88194655 [usb] Add clear_tt() hub method to clear transaction translator buffer
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-23 16:21:13 +00:00
Michael Brown de6f4e3ede [usb] Reset endpoints without waiting for a new transfer to be enqueued
The current endpoint reset logic defers the reset until the caller
attempts to enqueue a new transfer to that endpoint.  This is
insufficient when dealing with endpoints behind a transaction
translator, since the transaction translator is a resource shared
between multiple endpoints.

We cannot reset the endpoint as part of the completion handling, since
that would introduce recursive calls to usb_poll().  Instead, we
add the endpoint to a list of halted endpoints, and perform the reset
on the next call to usb_step().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-23 15:21:35 +00:00
Michael Brown 661189eede [xhci] Ring doorbell as part of endpoint reset
The endpoint may already have enqueued TRBs at the time that
xhci_endpoint_reset() is called.  Ring the doorbell to resume
processing these TRBs immediately, rather than waiting until the next
call to xhci_endpoint_message() or xhci_endpoint_stream().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-23 15:21:35 +00:00
Michael Brown a3c00d8d3b [libprefix] Fix building on 64-bit FreeBSD 8.4
Reported-by: Pavel Antonov <holly@istu.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-23 13:28:59 +00:00
Michael Brown acc27b9005 [usb] Fix USB timeouts to match specification
Several of the USB timeouts were chosen on the principle of "pick an
arbitrary but ridiculously large value, just to be safe".  It turns
out that some of the timeouts permitted by the USB specification are
even larger: for example, control transactions are allowed to take up
to five seconds to complete.

Fix up these USB timeout values to match those found in the USB2
specification.

Debugged-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-18 16:43:18 +00:00
Michael Brown c492a9fd92 [netdevice] Add missing bus types to netdev_fetch_bustype()
Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-18 16:42:39 +00:00
Michael Brown 8370f87745 [ehci] Add support for EHCI host controllers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-18 12:35:17 +00:00