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

1264 Commits

Author SHA1 Message Date
Michael Brown 597521ef53 [qib7322] Validate payload length
There is no way for the hardware to give us an invalid length in the
LRH, since it must have parsed this length field in order to perform
header splitting.  However, this is difficult to prove conclusively.

Add an unnecessary length check to explicitly reject any packets
larger than the posted receive I/O buffer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-30 07:31:51 +01:00
Michael Brown c9af896314 [linda] Validate payload length
There is no way for the hardware to give us an invalid length in the
LRH, since it must have parsed this length field in order to perform
header splitting.  However, this is difficult to prove conclusively.

Add an unnecessary length check to explicitly reject any packets
larger than the posted receive I/O buffer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-30 07:27:09 +01:00
Christian Nilsson ef1c4b1c90 [intel] Add PCI device ID for another I219-V
Signed-off-by: Christian Nilsson <nikize@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-29 19:53:20 +01:00
Michael Brown 97c3f6e55a [iscsi] Include DHCP server address in iBFT
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-29 19:38:18 +01:00
Christian Hesse 05027a7a12 [golan] Fix build error on some versions of gcc
Some versions of gcc complain that "'__bswap_variable_32' is static
but used in inline function 'golan_check_rc_and_cmd_status' which is
not static".

Fix by making golan_check_rc_and_cmd_status() a static inline.

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-23 05:59:44 +00:00
Wissam Shoukair 0a20373a2f [golan] Add Connect-IB, ConnectX-4 and ConnectX-4 Lx (Infiniband) support
Signed-off-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-22 17:55:55 +00:00
Michael Brown 860d5904fb [arbel] Fix received packet length
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-22 16:11:58 +00:00
Michael Brown 3ad028cf1c [hermon] Fix received packet length
Debugged-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-22 16:09:18 +00:00
Michael Brown 59bae324c0 [etherfabric] Avoid use of sleep() in driver code
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-22 15:19:25 +00:00
Michael Brown c640b954cd [3c5x9] Avoid use of sleep() in driver code
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-22 15:14:07 +00:00
Michael Brown 173c0c2536 [infiniband] Allow drivers to override the eIPoIB LEMAC
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-21 09:30:42 +00:00
Michael Brown 57c63047e3 [arbel] Allocate space for GRH on UD queue pairs
As with the previous commit (for Hermon), allocate a separate ring
buffer to hold received GRHs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-21 08:55:02 +00:00
Michael Brown e84c917f39 [hermon] Allocate space for GRH on UD queue pairs
The Infiniband specification (volume 1, section 11.4.1.2 "Post Receive
Request") notes that for UD QPs, the GRH will be placed in the first
40 bytes of the receive buffer if present.  (If no GRH is present,
which is normal, then the first 40 bytes of the receive buffer will be
unused.)

Mellanox hardware performs this placement automatically: other headers
will be stripped (and their values returned via the CQE), but the
first 40 bytes of the data buffer will be consumed by the (probably
non-existent) GRH.

This does not fit neatly into iPXE's internal abstraction, which
expects the data buffer to represent just the data payload with the
addresses from the GRH (if present) passed as additional parameters to
ib_complete_recv().

The end result of this discrepancy is that attempts to receive
full-sized 2048-byte IPoIB packets on Mellanox hardware will fail.

Fix by allocating a separate ring buffer to hold the received GRHs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-21 08:18:15 +00:00
Michael Brown 4a861cc61c [qib7322] Add missing iounmap()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-20 14:55:18 +00:00
Michael Brown bea9ee2397 [linda] Add missing iounmap()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-20 14:54:08 +00:00
Michael Brown 692324905e [arbel] Add missing iounmap()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-20 14:52:01 +00:00
Michael Brown e2cdbd51a8 [hermon] Add missing iounmap()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-20 14:46:40 +00:00
Michael Brown 750a2efeb2 [ipoib] Allow external code to identify IPoIB network devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-20 09:22:55 +00:00
Michael Brown 2246a6b274 [pseudobit] Rename bitops.h to pseudobit.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-16 17:03:33 +00:00
Michael Brown 86f96a40f4 [tg3] Remove x86-specific inline assembly
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-12 21:15:43 +00:00
Michael Brown 7e78cdddc8 [3c595] Fix compilation when "char" is unsigned by default
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-12 18:06:47 +00:00
Michael Brown 4350d26a04 [qib7322] Use standard readq() and writeq() implementations
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-12 17:51:59 +00:00
Michael Brown 5229662b7f [linda] Use standard readq() and writeq() implementations
This driver is the original source of the current readq() and writeq()
implementations for 32-bit iPXE.  Switch to using the now-centralised
definitions, to avoid including architecture-specific code in an
otherwise architecture-independent driver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-12 17:42:30 +00:00
Michael Brown 3144e4fb64 [eoib] Support non-FullMember gateway devices
Some EoIB implementations utilise an EoIB-to-Ethernet gateway device
that does not perform a FullMember join to the multicast group for the
EoIB broadcast domain.  This has various exciting side-effects, such
as requiring every EoIB node to send every broadcast packet twice.

As an added bonus, the gateway may also break the EoIB MAC address to
GID mapping protocol by sending Ethernet-sourced packets from the
wrong QPN.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-09 08:43:40 +00:00
Michael Brown 1a9ed68cbb [eoib] Allow the multicast group to be forcefully created
Some EoIB implementations require each individual EoIB node to create
the multicast group for the EoIB broadcast domain.

It is left as an exercise for the interested reader to determine how
such an implementation might ever allow the parameters of such a
multicast group to be changed without requiring a simultaneous upgrade
of every driver on every operating system on every machine currently
attached to the fabric.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-09 08:43:40 +00:00
Michael Brown ecd93cfc11 [eoib] Silently ignore EoIB heartbeat packets
Some EoIB implementations transmit a vendor-proprietary heartbeat
packet on the same multicast group used to provide the EoIB broadcast
domain.

Silently ignore these heartbeat packets, to avoid cluttering up the
network interface error statistics.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-09 08:43:40 +00:00
Michael Brown 9154d7a65c [eoib] Add Ethernet over Infiniband (EoIB) driver
EoIB is a fairly simple protocol in which raw Ethernet frames
(excluding the CRC) are encapsulated within Infiniband Unreliable
Datagrams, with a four-byte fixed EoIB header (which conveys no actual
information).  The Ethernet broadcast domain is provided by a
multicast group, similar to the IPoIB IPv4 multicast group.

The mapping from Ethernet MAC addresses to Infiniband address vectors
is achieved by snooping incoming traffic and building a peer cache
which can then be used to map a MAC address into a port GID.  The
address vector is completed using a path record lookup, as for IPoIB.
Note that this requires every packet to include a GRH.

Add basic support for EoIB devices.  This driver is substantially
derived from the IPoIB driver.  There is currently no mechanism for
automatically creating EoIB devices.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-09 08:43:40 +00:00
Michael Brown 9939b704f1 [ipoib] Increase number of transmit work queue entries
Avoid running out of transmit work queue entries under heavy load.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08 17:44:28 +00:00
Michael Brown b5aa51ac62 [ipoib] Resimplify test for received broadcast packets
Commit e62e52b ("[ipoib] Simplify test for received broadcast
packets") relies upon the multicast LID being present in the
destination address vector as passed to ipoib_complete_recv().
Unfortunately, this information is not present in many Infiniband
devices' completion queue entries.

Fix by testing instead for the presence of a multicast GID.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08 17:43:26 +00:00
Michael Brown 6a3ffa0114 [infiniband] Assign names to queue pairs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08 15:51:53 +00:00
Michael Brown 5a7fd2cc90 [infiniband] Allow for the creation of multicast groups
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08 12:23:30 +00:00
Michael Brown e62e52b2b9 [ipoib] Simplify test for received broadcast packets
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08 12:23:30 +00:00
Michael Brown ffdf8ea757 [ipoib] Avoid unnecessary path record lookup for broadcast address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08 12:23:30 +00:00
Michael Brown 14ad9cbd67 [infiniband] Parse MLID, rate, and SL from multicast membership record
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08 12:23:30 +00:00
Michael Brown c335f8eae4 [infiniband] Record multicast GID attachment as part of group membership
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-08 12:23:30 +00:00
Michael Brown 60e205a551 [infiniband] Remove concept of whole-device owner data
Remove the implicit assumption that the IPoIB protocol owns the whole
Infiniband device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-07 21:04:40 +00:00
Mika Tiainen 0588c03772 [intel] Add INTEL_NO_PHY_RST for another I218-LM variant
Fixed booting on HP EliteBook 820 G2 laptop.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-12 13:23:44 +00:00
Michael Brown 17a200257a [ehci] Add extra debugging information
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-05 21:03:17 +00:00
Michael Brown d0bfd830e4 [ath9k] Remove broken ath_rxbuf_alloc()
ath_rx_init() demonstrates some serious confusion over how to use
pointers, resulting in (uint32_t*)NULL being used as a temporary
variable.  This does not end well.

The broken code in question is performing manual alignment of I/O
buffers, which can now be achieved more simply using alloc_iob_raw().
Fix by removing ath_rxbuf_alloc() entirely.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-28 14:24:24 +00:00
Hummel Frank 6366fa7af6 [intel] Add INTEL_NO_PHY_RST for I218-LM
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-27 13:07:42 +00:00
Michael Brown 207edc4615 [smsc95xx] 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.  The SMSC95XX
transmit header is larger than the receive header: the re-used I/O
buffer therefore does not have sufficient headroom for the transmit
header, and the ARP reply will therefore fail to be transmitted.  This
is essentially the same problem as in commit 2e72d10 ("[ncm] Reserve
headroom in received packets").

Fix by reserving sufficient space at the start of each received packet
to allow for the difference between the lengths of the transmit and
receive headers.

This problem is not caught by the current driver development test
suite (documented at http://ipxe.org/dev/driver), since even the large
file transfer tests tend to completely sufficiently quickly that there
is no need for the server to ever send an ARP request.  The failure
shows up only when using a very slow protocol such as RFC7440-enhanced
TFTP (as used by Windows Deployment Services).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-19 00:23:06 +00:00
Michael Brown 71b83a6d00 [usb] Allow USB endpoints to specify a reserved header length for refills
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-19 00:01:11 +00:00
Michael Brown 8dc23d9b83 [smsc95xx] Enable LEDs
The LED pins are configured by default as GPIO inputs.  While it is
conceivable that a board might actually use these pins as GPIOs, no
such board is known to exist.

The Linux smsc95xx driver configures these pins unconditionally as LED
outputs.  Assume that it is safe to do likewise.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-18 21:46:09 +00:00
Michael Brown 2f861d736f [usb] Add support for numeric keypad on USB keyboards
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-06 18:55:08 +00:00
Michael Brown ae8dfd74c0 [smsc95xx] Fetch MAC from SMBIOS OEM string for Honeywell VM3
The Honeywell VM3 has no attached EEPROM, and records the MAC address
within an SMBIOS OEM string.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-04 15:31:26 +00:00
Michael Brown 82e03764d8 [smsc95xx] Allow for multiple methods for obtaining the MAC address
The SMSC95xx devices tend to be used in embedded systems with a
variety of ad-hoc mechanisms for storing the MAC address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-23 15:29:55 +00:00
Michael Brown ee8388ec69 [xhci] Ensure that zero-length packets are not part of a TRB chain
Some xHCI controllers (such as qemu's emulated xHCI controller) do not
correctly handle zero-length packets that are part of a TRB chain.
The zero-length TRB ends up being squashed and does not result in a
zero-length packet as seen by the device.

Work around this problem by marking the zero-length packet as
belonging to a separate transfer descriptor.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-07 22:40:47 +00:00
Torgeir Wulfsberg d6945925d8 [intel] Add INTEL_NO_PHY_RST for I217-LM
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-07 19:52:16 +00:00
Michael Brown 296dee6d38 [acm] Add support for CDC-ACM (aka USB RNDIS) devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-07 13:16:53 +00:00
Michael Brown 53ba5936b5 [usb] Allow additional settling time for out-of-spec hubs
Some hubs (e.g. the Avocent Corp. Virtual Hub on a Lenovo x3550
Integrated Management Module) have been observed to require more than
the standard 200ms for ports to stabilise, with the result that
devices appear to disconnect and immediately reconnect during the
initial bus enumeration.

Work around this problem by allowing specific hubs an extra 500ms of
settling time.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-07 13:16:47 +00:00
Michael Brown fb8c52de9b [usb] Allow USB device IDs to include arbitrary driver-specific data
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-07 13:08:23 +00:00
Michael Brown eb1fc1e957 [usb] Record USB device speed separately from current port speed
Record the speed of a USB device based on the port's speed at the time
that the device was enabled.  This allows us to remember the device's
speed even after the device has been disconnected (and so the port's
current speed has changed).

In particular, this allows us to correctly identify the transaction
translator for a low-speed or full-speed device after the device has
been disconnected.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-07 13:08:23 +00:00
Michael Brown 15ce7ce355 [usb] Use port->disconnected to check for disconnected devices
The usb_message() and usb_stream() functions currently check for
port->speed==USB_SPEED_NONE to determine whether or not a device has
been unplugged.  This test will give a false negative result if a new
device has been plugged in before the hotplug mechanism has finished
handling the removal of the old device.

Fix by checking instead the port->disconnected flag, which is now
cleared only after completing the removal of the old device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-07 13:08:22 +00:00
Michael Brown 89c767bfd6 [smsc95xx] Add driver for SMSC/Microchip LAN95xx USB Ethernet NICs
Tested using QEMU and usbredir to expose the LAN9512 chip present on a
Raspberry Pi.

There is a known issue with the LAN9512: an extra two bytes are
appended to every transmitted packet.  These two bytes comprise:

  {   0x00,   0x08 } if packet length == 0 (mod 8)
  { CRC[0],   0x00 } if packet length == 7 (mod 8)
  { CRC[0], CRC[1] } otherwise

The extra bytes are appended whether the Ethernet CRC is generated
manually or added automatically by the hardware.  The issue occurs
with the Linux kernel driver as well as the iPXE driver.  It appears
to be an undocumented hardware errata.

TCP/IP traffic is not affected, since the IP header length field
causes the extraneous bytes to be discarded by the receiver.  However,
protocols that rely on the length of the Ethernet frame (such as FCoE
or iPXE's "lotest" protocol) will be unusable on this hardware.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-01 15:37:37 +00:00
Michael Brown ed18cd5678 [pci] Add definitions for PCI Express function level reset (FLR)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-11-30 22:13:27 +00:00
Michael Brown f3c2da7d4a [intel] Correct definition of receive overrun bit
Reported-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-11-22 19:17:24 +00:00
Michael Brown fff9281b84 [intel] Forcibly skip PHY reset on some models
On some models (notably ICH), the PHY reset mechanism appears to be
broken.  In particular, the PHY_CTRL register will be correctly loaded
from NVM but the values will not be propagated to the "OEM bits" PHY
register.  This typically has the effect of dropping the link speed to
10Mbps.

Since the original version of this driver in commit 945e428 ("[intel]
Replace driver for Intel Gigabit NICs"), we have always worked around
this problem by skipping the PHY reset if the link is already up.
Enhance this workaround by explicitly checking for known-broken PCI
IDs.

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-11-22 19:08:09 +00:00
Kyösti Mälkki d5f7ee60e7 [intel] Add PCI IDs for i210/i211 flashless operation
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-11-04 20:47:39 +00:00
Carl Henrik Lunde 3f8da985aa [vmxnet3] Avoid completely filling the TX descriptor ring
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-16 11:10:30 +01:00
Michael Brown 79443785cd [ncm] Support setting MAC address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-14 22:45:56 +01:00
Michael Brown 668dc73d52 [usb] Allow for wildcard USB class IDs
Make the class ID a property of the USB driver (rather than a property
of the USB device ID), and allow USB drivers to specify a wildcard ID
for any of the three component IDs (class, subclass, or protocol).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-14 21:56:40 +01:00
Michael Brown 549a0caabb [usb] Select preferred USB device configuration based on driver score
Generate a score for each possible USB device configuration based on
the available driver support, and select the configuration with the
highest score.  This will allow us to prefer ECM over RNDIS (for
devices which support both) and will allow us to meaningfully select a
configuration even when we have drivers available for all functions
(e.g. when exposing unused functions via EFI_USB_IO_PROTOCOL).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-14 21:45:34 +01:00
Michael Brown 7107334391 [efi] Provide efi_devpath_len()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-13 12:54:31 +01:00
Michael Brown 4a7d691697 [xhci] Support arbitrarily large transfers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-13 12:54:31 +01:00
Michael Brown 8f418ee477 [ehci] Support arbitrarily large transfers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-13 12:54:30 +01:00
Michael Brown 6424a38323 [ehci] Do not treat zero-length NULL pointers as unreachable
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-13 12:54:30 +01:00
Michael Brown f9e192605c [usb] Generalise zero-length packet generation logic
The decision on whether or not a zero-length packet needs to be
transmitted is independent of the host controller and belongs in the
USB core.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-13 12:54:30 +01:00
Michael Brown 15a8800a98 [efi] Add a USB host controller driver based on EFI_USB_IO_PROTOCOL
Allow iPXE to coexist with other USB device drivers, by attaching to
the EFI_USB_IO_PROTOCOL instances provided by the UEFI platform
firmware.

The EFI_USB_IO_PROTOCOL is an unsurprisingly badly designed
abstraction of a USB device.  The poor design choices intrinsic in the
UEFI specification prevent efficient operation as a network device,
with the result that devices operated using the EFI_USB_IO_PROTOCOL
operate approximately two orders of magnitude slower than devices
operated using our native EHCI or xHCI host controller drivers.

Since the performance is so abysmally slow, and since the underlying
problems are due to fundamental architectural mistakes in the UEFI
specification, support for the EFI_USB_IO_PROTOCOL host controller
driver is left as disabled by default.  Users are advised to use the
native iPXE host controller drivers instead.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-07 01:38:40 +01:00
Michael Brown 82bc90dd88 [usb] Add function to device's function list before attempting probe
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-06 21:51:38 +01:00
Michael Brown 866e525814 [usb] Expose usb_find_driver()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-06 21:51:38 +01:00
Michael Brown 9501eaf68d [efi] Remove raw EFI_HANDLE values from debug messages
The raw EFI_HANDLE value is almost never useful to know, and simply
adds noise to the already verbose debug messages.  Improve the
legibility of debug messages by using only the name generated by
efi_handle_name().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-27 15:40:44 +01:00
Fabrice Bacchella c0b61bad99 [efi] Work around bugs in Emulex NII driver
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 15:57:05 +01:00
Fabrice Bacchella b71037989d [efi] Improve NII driver logging
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 15:55:48 +01:00
Wissam Shoukair eb8df9a046 [ipoib] Fix a race when chain-loading undionly.kpxe in IPoIB
The Infiniband link status change callback ipoib_link_state_changed()
may be called while the IPoIB device is closed, in which case there
will not be an IPoIB queue pair to be joined to the IPv4 broadcast
group.  This leads to NULL pointer dereferences in ib_mcast_attach()
and ib_mcast_detach().

Fix by not attempting to join (or leave) the broadcast group unless we
actually have an IPoIB queue pair.

Signed-off-by: Wissam Shoukair <wissams@mellanox.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-17 14:42:36 +01:00
Bernd Wiebelt 24112d91a0 [tg3] Add support for BCM57766
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-06 14:27:48 +01:00
Michael Brown 652e5a96db [ipoib] Transmit multicast packets as broadcasts
Multicast MAC addresses will never have REMAC cache entries, and the
corresponding multicast IPoIB MAC address cannot be obtained simply by
issuing an ARP request.

For the trivial volume of multicast packets that we expect to send in
any realistic scenario, the simplest solution is to send them as
broadcasts instead.

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-06 13:10:40 +01:00
Michael Brown 8829634bd7 [ipoib] Attempt to generate ARPs as needed to repopulate REMAC cache
The only way to map an eIPoIB MAC address (REMAC) to an IPoIB MAC
address is to intercept an incoming ARP request or reply.

If we do not have an REMAC cache entry for a particular destination
MAC address, then we cannot transmit the packet.  This can arise in at
least two situations:

 - An external program (e.g. a PXE NBP using the UNDI API) may attempt
   to transmit to a destination MAC address that has been obtained by
   some method other than ARP.

 - Memory pressure may have caused REMAC cache entries to be
   discarded.  This is fairly likely on a busy network, since REMAC
   cache entries are created for all received (broadcast) ARP
   requests.  (We can't sensibly avoid creating these cache entries,
   since they are required in order to send an ARP reply, and when we
   are being used via the UNDI API we may have no knowledge of which
   IP addresses are "ours".)

Attempt to ameliorate the situation by generating a semi-spurious ARP
request whenever we find a missing REMAC cache entry.  This will
hopefully trigger an ARP reply, which would then provide us with the
information required to populate the REMAC cache.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-29 14:50:16 +01:00
Michael Brown e213a008ca [ipoib] Mark REMAC cache as expensive
As with the neighbour cache, discarding an REMAC cache entry is
potentially very disruptive.

Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-29 14:12:43 +01:00
Michael Brown be3517c4ab [xhci] Ignore invalid protocol speed ID values on Intel Skylake platforms
Some Intel Skylake platforms (observed on a prototype Lenovo ThinkPad)
report the list of available USB3 protocol speed ID values as {1,2,3}
but then report a port's speed using ID value 4.

The value 4 happens to be the default value for SuperSpeed (when no
protocol speed ID value list is explicitly defined), and the hardware
seems to function correctly if we simply ignore its protocol speed ID
table and assume that it uses the default values.

Fix by adding a "broken PSI values" quirk for this controller.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-18 15:09:57 +01:00
Michael Brown 323bf186fb [xhci] Record device-specific quirks in xHCI device structure
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-18 15:05:54 +01:00
Michael Brown 6b7157c233 [ipoib] Fix REMAC cache discarder
Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-01 18:02:55 +01:00
Michael Brown 6d195c5669 [xhci] Fix comparison of signed and unsigned integers
gcc 4.8.2 fails to report this erroneous comparison unless assertions
are enabled.

Reported-by: Mary-Ann Johnson <MaryAnn.Johnson@displaylink.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-01 17:19:48 +01:00
Michael Brown 982b051cbc [xhci] Fix length of allocated slot array
The xHCI slot ID is one-based, not zero-based.  Fix the length of the
xhci->slot[] array to account for this, and add assertions to check
that the hardware returns a valid slot ID in response to the Enable
Slot command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-01 14:00:25 +01:00
Michael Brown 99f87b2338 [intel] Fix operation when physical function has jumbo frames enabled
When jumbo frames are enabled, the Linux ixgbe physical function
driver will disable the virtual function's receive datapath by
default, and will enable it only if the virtual function negotiates
API version 1.1 (or higher) and explicitly selects an MTU.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-19 13:03:02 +01:00
Michael Brown 51b6a1c835 [intel] Add intelxvf_stats() to dump packet statistics registers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-19 13:03:02 +01:00
Michael Brown a91b1f7339 [intel] Add intelxvf driver for Intel 10 GigE virtual function NICs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-16 14:54:38 +01:00
Michael Brown bb1e1048f6 [intel] Add support for mailbox used by virtual functions
Virtual functions use a mailbox to communicate with the physical
function driver: this covers functionality such as obtaining the MAC
address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-16 14:54:37 +01:00
Michael Brown 9e2121be0d [intel] Allow for the use of advanced TX descriptors
Intel virtual function NICs almost work with the use of "legacy"
transmit and receive descriptors (which are backwards compatible right
back to the original Intel Gigabit NICs).

Unfortunately the "TX switching" feature (which allows for VM<->VM
traffic to be looped back within the NIC itself) does not work when a
legacy TX descriptor is used: the packet is instead sent onto the
wire.

Fix by allowing for the use of an "advanced" TX descriptor (containing
exactly the same information as is found in the "legacy" descriptor).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-16 14:54:31 +01:00
Michael Brown 28ce9b6cc0 [intel] Expose intel_diag() for use by other Intel NIC drivers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-15 15:19:10 +01:00
Michael Brown 5ecd16af04 [usb] Always clear recorded disconnections after performing hotplug actions
The recorded disconnections (in port->disconnected) will currently be
left uncleared if usb_attached() returns an error (e.g. because there
are no drivers for a particular USB device).  This is incorrect
behaviour: the disconnection has been handled and the record should be
cleared until the next physical disconnection is detected (via the CSC
bit).

The problem is masked for EHCI, UHCI, and USB hubs, since these will
report a changed port (via usb_port_changed()) only when the
underlying hardware reports a change.  xHCI will call
usb_port_changed() in response to any port status event, at which
point the stale value of port->disconnected will be erroneously acted
upon.  This can lead to an endless loop of repeatedly enumerating the
same device when a driverless device is attached to an xHCI root hub
port.

Fix by unconditionally clearing port->disconnected in usb_hotplugged().

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-13 15:01:07 +01:00
Michael Brown a2173fca45 [usb] Do not call usb_hotplug() when registering a new hub
The action of registering a new hub can itself happen in only two
ways: either a new USB hub has been created (in which case we are
already inside a call to usb_hotplug()), or a new root hub has been
created.

In the former case, we do not need to issue a further call to
usb_hotplug(), since the hub's ports will all be marked as changed and
so will be handled after the return from register_usb_hub() anyway.
Calling usb_hotplug() within register_usb_hub() leads to a confusing
order of events, such as:

- root hub port 1 detects a change
- root hub port 2 detects a change
- usb_hotplug() is called
  - root hub port 1 finds a USB hub
    - usb_hotplug() is called
      - this inner call to usb_hotplug() handles root hub port 2

Fix by calling usb_hotplug() only from usb_step() and from
register_usb_bus().  This avoids recursive calls to usb_hotplug() and
ensures that devices are enumerated in the order of detection.

Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-13 14:13:09 +01:00
Michael Brown 372672275e [usb] Add basic support for USB keyboards
When USB network card drivers are used, the BIOS' legacy USB
capability is necessarily disabled since there is no way to share the
host controller between the BIOS and iPXE.  This currently results in
USB keyboards becoming non-functional in USB-enabled builds of iPXE.

Fix by adding basic support for USB keyboards, enabled by default in
iPXE builds which include USB support.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-12 15:53:22 +01:00
Michael Brown a8e4187c45 [usb] Add generic USB human interface device (HID) framework
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-12 15:40:20 +01:00
Michael Brown 0eaa3a34bf [usb] Add USB_INTERRUPT_OUT internal type
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-11 14:56:46 +01:00
Michael Brown bb6d7bebe9 [uhci] Use meaningful device names in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-10 00:19:16 +01:00
Michael Brown 5832e9ea93 [ehci] Use meaningful device names in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-10 00:19:11 +01:00
Michael Brown 91a4ad2466 [xhci] Use meaningful device names in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-10 00:19:11 +01:00
Michael Brown 9d43c4080d [usb] Provide usb_endpoint_name() for use by host controller drivers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-09 23:45:13 +01:00
Michael Brown 6dba29b18f [uhci] Add support for UHCI host controllers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-09 23:14:34 +01:00
Michael Brown 9ea8a2daa7 [ehci] Allow UHCI/OHCI controllers to locate the EHCI companion controller
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-09 20:09:08 +01:00
Michael Brown a66fd8920d [usb] Add find_usb_bus_by_location() helper function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-09 20:09:08 +01:00
Michael Brown b3de9664c7 [ehci] Poll child companion controllers after disowning port
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-09 20:09:08 +01:00
Michael Brown e4783add79 [usb] Maintain single lists of halted endpoints and changed ports
When an EHCI hotplug action results in the controller disowning the
port, it will result in a hotplug action on the corresponding UHCI or
OHCI controller.  Allow such hotplug actions to be carried out as part
of the same call to usb_step() or usb_register_bus(), by maintaining a
single central list of changed ports.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-09 20:08:50 +01:00
Michael Brown 5e1e2069fd [usb] Maintain a list of all USB buses
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-09 19:37:29 +01:00
Michael Brown f6604627ff [usb] Detect missed disconnections
The USB core will currently fail to detect disconnections if a new
device has attached by the time the port is examined in
usb_hotplug().

Fix by recording the fact that a disconnection has taken place
whenever the "connection status changed" (CSC) bit is observed to be
set.  (Whether the change represents a disconnection or a
reconnection, it indicates that the port has experienced some time of
being disconnected.)

Note that the time at which a disconnection can be detected varies by
hub type.  In particular: root hubs can observe the CSC bit when
polling, and so will record the disconnection before calling
usb_port_changed(), but USB hubs read the port status (and hence the
CSC bit) only during the call to hub_speed(), long after the call to
usb_port_changed().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-08 14:57:14 +01:00
Michael Brown b88ab14ba3 [pci] Provide PCI_CLASS() to calculate a scalar PCI class value
Rename PCI_CLASS() (which constructs a struct pci_class_id) to
PCI_CLASS_ID(), and provide PCI_CLASS() as a macro which constructs
the 24-bit scalar value of a PCI class code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-08 14:57:12 +01:00
Michael Brown 50e703a534 [usb] Include setup packet within I/O buffer for message transfers
The USB API currently assumes that host controllers will have
immediate data buffer space available in which to store the setup
packet.  This is true for xHCI, partially true for EHCI (which happens
to have 12 bytes of padding in each transfer descriptor due to
alignment requirements), and not true at all for UHCI.

Include the setup packet within the I/O buffer passed to the host
controller's message() method, thereby eliminating the requirement for
host controllers to provide immediate data buffers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-01 16:29:11 +01:00
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
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 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 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 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 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 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
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 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 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 8370f87745 [ehci] Add support for EHCI host controllers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-18 12:35:17 +00:00
Michael Brown ec0e2a7bd7 [xhci] Do not release ownership back to BIOS when booting an OS
xHCI (and EHCI) nominally provide a mechanism for releasing ownership
of the host controller back to the BIOS, which can then potentially
restore legacy USB keyboard functionality.

This is a rarely used code path, since most operating systems claim
ownership and never attempt to later return to the BIOS.  On some
systems (observed with a Lenovo X1 Carbon), this code path leads to
obscure and interesting bugs: if the xHCI and EHCI controllers are
both claimed and later released back to the BIOS, then a subsequent
call to INT 16,0305 to set the keyboard repeat rate to a non-default
value will lock the system.

Obscure though this sequence of operations may sound, it is exactly
what happens when using iPXE to boot a Linux kernel via a USB network
card.  There is old and probably unwanted code in Linux's
arch/x86/boot/main.c which sets the keyboard repeat rate (with the
accompanying comment "Set keyboard repeat rate (why?)").  When booting
Linux via a USB network card on a Lenovo X1 Carbon, the system
therefore locks up immediately after jumping to the kernel's entry
point.

Work around this problem by preventing the release of ownership back
to the BIOS if it is known that we are shutting down to boot an OS.
This should allow legacy USB keyboard functionality to be restored if
the user chooses to exit iPXE, while avoiding the rarely used code
paths (and corresponding BIOS bugs) if the user chooses instead to
boot an OS.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-18 12:35:16 +00:00
Michael Brown 3de0ffc887 [xhci] Forcibly disable SMIs if BIOS fails to release ownership
If the BIOS fails to gracefully release ownership of the xHCI
controller, we can forcibly claim it by disabling all SMIs via the
USB legacy support control/status register.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-16 20:38:48 +00:00
Michael Brown 838ab97ce3 [usb] Add functions for manual device address assignment
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-16 15:42:29 +00:00
Michael Brown 74f57016dc [ncm] Respect maximum transfer size of the bus
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-16 15:40:54 +00:00
Michael Brown 7b6765ff1b [usb] Add the concept of a USB bus maximum transfer size
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-16 15:40:53 +00:00
Michael Brown 7f80eb511e [smsc75xx] Move RX FIFO overflow message to DBGLVL_EXTRA
RX FIFO overflow is almost inevitable since the (usable) USB2 bus
bandwidth is approximately one quarter of the Ethernet bandwidth.
Avoid flooding the console with RX FIFO overflow messages in a
standard debug build.

With TCP SACK implemented, the RX FIFO overflow no longer causes a
catastrophic drop in throughput.  Experimentation shows that HTTP
downloads now progress at a fairly smooth 250Mbps, which is around the
maximum speed attainable for a USB2 NIC.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-11 23:14:43 +00:00
Michael Brown 69062bbc21 [smsc75xx] Add driver for SMSC/Microchip LAN75xx USB Ethernet NICs
This driver is functional but any downloads via a TCP-based protocol
tend to perform poorly.  The 1Gbps Ethernet line rate is substantially
higher than the 480Mbps (in practice around 280Mbps) provided by USB2,
and the device has only 32kB of internal buffer memory.  Our 256kB TCP
receive window therefore rapidly overflows the RX FIFO, leading to
multiple dropped packets (usually within the same TCP window) and
hence a low overall throughput.

Reducing the TCP window size so that the RX FIFO does not overflow
greatly increases throughput, but is not a general-purpose solution.

Further investigation is required to determine how other OSes
(e.g. Linux) cope with this scenario.  It is possible that
implementing TCP SACK would provide some benefit.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-11 13:38:38 +00:00
Michael Brown 6ad02e78bb [mii] Add generic mii_check_link() function
Most devices expose at least the link up/down status via a bit in a
MAC register, since the MAC generally already needs to know whether or
not the link is up.  Some devices (e.g. the SMSC75xx USB NIC) expose
this information to software only via the MII registers.

Provide a generic mii_check_link() implementation to check the BMSR
and report the link status via netdev_link_{up,down}().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-10 21:31:07 +00:00
Michael Brown 03e71d5d1a [legal] Relicense Davicom DM96xx drivers
Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-10 00:12:39 +00:00
Michael Brown 1ae94c903d [dm96xx] Add driver for Davicom DM96xx USB Ethernet NICs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-09 19:58:57 +00:00
Thomas Miletich 02bf4f16f3 [intel] Add PCI ID for I218-LM
Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-09 14:20:41 +00:00
Michael Brown 3eb91209d9 [xen] Set the "feature-rx-notify" flag for netfront devices
iPXE already sends RX notifications to the backend when needed, but
does not set the "feature-rx-notify" flag.  As of XenServer 6.5, this
flag is mandatory and omitting it will cause the backend to fail.

Fix by setting the "feature-rx-notify" flag, to inform the backend
that we will send notifications.

Reported-by: Shalom Bhooshi <shalom.bhooshi@citrix.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-09 08:52:03 +00:00
Michael Brown e905cdcce3 [xhci] Undo PCH-specific quirk fixes when removing device
Restore the original values of XUSB2PR and USB3PSSEN, in case we are
booting an OS with no support for xHCI.

Suggested-by: Dan Ellis <Dan.Ellis@displaylink.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-06 17:15:29 +00:00
Michael Brown ff320404d5 [xhci] Enable USB3 ports on Intel PCH8/PCH9 controllers
Intel PCH controllers default to routing USB2 ports to EHCI rather
than xHCI, and default to disabling SuperSpeed connections.
Manipulate the PCI configuration space registers as necessary to
reroute ports and enable SuperSpeed.

Originally-fixed-by: Dan Ellis <Dan.Ellis@displaylink.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-06 11:58:14 +00:00
Michael Brown 1a4e94a828 [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
Relicense files with kind permission from

    Stefan Hajnoczi <stefanha@redhat.com>

alongside the contributors who have already granted such relicensing
permission.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-05 11:40:13 +00:00
Michael Brown fbc4ba4b4e [build] Fix the REQUIRE_SYMBOL mechanism
At some point in the past few years, binutils became more aggressive
at removing unused symbols.  To function as a symbol requirement, a
relocation record must now be in a section marked with @progbits and
must not be in a section which gets discarded during the link (either
via --gc-sections or via /DISCARD/).

Update REQUIRE_SYMBOL() to generate relocation records meeting these
criteria.  To minimise the impact upon the final binary size, we use
existing symbols (specified via the REQUIRING_SYMBOL() macro) as the
relocation targets where possible.  We use R_386_NONE or R_X86_64_NONE
relocation types to prevent any actual unwanted relocation taking
place.  Where no suitable symbol exists for REQUIRING_SYMBOL() (such
as in config.c), the macro PROVIDE_REQUIRING_SYMBOL() can be used to
generate a one-byte-long symbol to act as the relocation target.

If there are versions of binutils for which this approach fails, then
the fallback will probably involve killing off REQUEST_SYMBOL(),
redefining REQUIRE_SYMBOL() to use the current definition of
REQUEST_SYMBOL(), and postprocessing the linked ELF file with
something along the lines of "nm -u | wc -l" to check that there are
no undefined symbols remaining.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-05 00:59:38 +00:00
Michael Brown 86ae6e6c18 [build] Use REQUIRE_OBJECT() to drag in per-object configuration
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-05 00:57:44 +00:00
Michael Brown e399fc0d21 [pci] Rewrite unrelicensable portions of pci.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 00:08:41 +00:00
Michael Brown 06c8a27b74 [pci] Remove outdated and mostly-unused pci_ids.h file
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 21:37:45 +00:00