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

1264 Commits

Author SHA1 Message Date
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
Michael Brown 01d16d821f [libc] Rewrite byte-swapping code
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 16:35:37 +00:00
Michael Brown 2f020a8df3 [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
These files cannot be automatically relicensed by util/relicense.pl
since they either contain unusual but trivial contributions (such as
the addition of __nonnull function attributes), or contain lines
dating back to the initial git revision (and so require manual
knowledge of the code's origin).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 16:35:29 +00:00
Michael Brown 626ccf76ea [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
Relicence files with kind permission from the following contributors:

  Alex Williamson <alex.williamson@redhat.com>
  Eduardo Habkost <ehabkost@redhat.com>
  Greg Jednaszewski <jednaszewski@gmail.com>
  H. Peter Anvin <hpa@zytor.com>
  Marin Hannache <git@mareo.fr>
  Robin Smidsrød <robin@smidsrod.no>
  Shao Miller <sha0.miller@gmail.com>
  Thomas Horsten <thomas@horsten.com>

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 14:50:42 +00:00
Michael Brown b6ee89ffb5 [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
Relicense files for which I am the sole author (as identified by
util/relicense.pl).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 14:17:31 +00:00
Michael Brown 5e95a79241 [legal] Include full licence text for all GPL2_OR_LATER files
Add the standard warranty disclaimer and Free Software Foundation
address paragraphs to the licence text where these are not currently
present.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 17:59:53 +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 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 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 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 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 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 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 639632b059 [hyperv] Assume that VMBus xfer page ranges correspond to RNDIS messages
The (undocumented) VMBus protocol seems to allow for transfer
page-based packets where the data payload is split into an arbitrary
set of ranges within the transfer page set.

The RNDIS protocol includes a length field within the header of each
message, and it is known from observation that multiple RNDIS messages
can be concatenated into a single VMBus message.

iPXE currently assumes that the transfer page range boundaries are
entirely arbitrary, and uses the RNDIS header length to determine the
RNDIS message boundaries.

Windows Server 2012 R2 generates an RNDIS_INDICATE_STATUS_MSG for an
undocumented and unknown status code (0x40020006) with a malformed
RNDIS header length: the length does not cover the StatusBuffer
portion of the message.  This causes iPXE to report a malformed RNDIS
message and to discard any further RNDIS messages within the same
VMBus message.

The Linux Hyper-V driver assumes that the transfer page range
boundaries correspond to RNDIS message boundaries, and so does not
notice the malformed length field in the RNDIS header.

Match the behaviour of the Linux Hyper-V driver: assume that the
transfer page range boundaries correspond to the RNDIS message
boundaries and ignore the RNDIS header length.  This avoids triggering
the "malformed packet" error and also avoids unnecessary data copying:
since we now have one I/O buffer per RNDIS message, there is no longer
any need to use iob_split().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-20 21:33:53 +00:00
Michael Brown a69c9953ac [hyperv] Increase TX ring size
Empirical observation suggests that 32 is a sensible size to minimise
the number of deferred packet transmissions without overflowing the
VMBus transmit ring buffer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-20 12:41:42 +00:00
Michael Brown 4e6821662c [hyperv] Receive all VMBus messages in a poll
Allow for elision of transmitted TCP ACKs by handling all received
VMBus messages in each network device poll operation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-20 12:40:17 +00:00
Michael Brown cd68d93b6e [hyperv] Tear down NetVSC RX buffer GPADL after closing VMBus device
On Windows Server 2012 R2, the receive buffer teardown completion
message seems to occasionally be deferred until after the VMBus
channel has been closed.  This happens even if there are no packets
currently in the receive buffer.

Work around this problem by separating the revocation and teardown of
the receive buffer, and deferring the teardown until after the VMBus
channel has been closed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-20 01:53:35 +00:00
Michael Brown ef16d0d2b3 [hyperv] Add support for NetVSC paravirtual network devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-18 16:27:37 +00:00
Michael Brown d08547309b [vmxnet3] Add profiling code to exclude time spent in the hypervisor
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12 10:18:03 +00:00
Michael Brown a937615151 [intel] Use autoloaded MAC address instead of EEPROM MAC address
The i350 (and possibly other Intel NICs) have a non-trivial
correspondence between the PCI function number and the external
physical port number.  For example, the i350 has a "LAN Function Sel"
bit within the EEPROM which can invert the mapping so that function 0
becomes port 3, function 1 becomes port 2, etc.

Unfortunately the MAC addresses within the EEPROM are indexed by
physical port number rather than PCI function number.  The end result
is that when anything other than the default mapping is used, iPXE
will use the wrong address as the base MAC address.

Fix by using the autoloaded MAC address if it is valid, and falling
back to reading the MAC address directly from the EEPROM only if no
autoloaded address is available.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-31 15:24:40 +00:00
Michael Brown af17abf67f [efi] Include NII driver within "snp" and "snponly" build targets
End users almost certainly don't care whether the underlying interface
is SNP or NII/UNDI.  Try to minimise surprise and unnecessary
documentation by including the NII driver whenever the SNP driver is
requested.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-17 16:52:31 +01:00
Michael Brown feb3a0f7d5 [efi] Check for presence of UNDI in NII protocol
iPXE itself exposes a dummy NII protocol with no UNDI.  Avoid
potentially dereferencing a NULL pointer by checking for a non-zero
UNDI address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-17 16:52:31 +01:00
Michael Brown 047baaba38 [efi] Add NII / UNDI driver
Some UEFI network drivers provide a software UNDI interface which is
exposed via the Network Interface Identifier Protocol (NII), rather
than providing a Simple Network Protocol (SNP).

The UEFI platform firmware will usually include the SnpDxe driver,
which attaches to NII and provides an SNP interface.  The SNP
interface is usually provided on the same handle as the underlying NII
device.  This causes problems for our EFI driver model: when
efi_driver_connect() detaches existing drivers from the handle it will
cause the SNP interface to be uninstalled, and so our SNP driver will
not be able to attach to the handle.  The platform firmware will
eventually reattach the SnpDxe driver and may attach us to the SNP
handle, but we have no way to prevent other drivers from attaching
first.

Fix by providing a driver which can attach directly to the NII
protocol, using the software UNDI interface to drive the network
device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16 14:13:20 +01:00
Michael Brown b9a5ff2b03 [efi] Generalise snpnet_dev_info() to efi_device_info()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16 14:12:42 +01:00
Michael Brown b71e93bb71 [efi] Free transmit ring entry before calling netdev_tx_complete()
The snpnet driver uses netdev_tx_defer() and so must ensure that space
in the (single-entry) transmit descriptor ring is freed up before
calling netdev_tx_complete().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16 14:12:42 +01:00
Anton D. Kachalov 86285d1d54 [intel] Add 8086:1557 card (Intel 82599 10G ethernet mezz)
Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-03 13:22:09 +01:00
Jan Kiszka 0df7ce9641 [intel] Add I217-LM PCI ID
Add the ID for the LM variant and differentiate it from the I217-V.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-16 16:00:50 +01:00
Michael Brown 0ce3c97095 [efi] Allow for non-PCI snpnet devices
We currently require information about the underlying PCI device to
populate the snpnet device's name and description.  If the underlying
device is not a PCI device, this will fail and prevent the device from
being registered.

Fix by falling back to populating the device description with
information based on the EFI handle, if no PCI device information is
available.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-04 16:18:08 +01:00
Michael Brown 4c5b7945c3 [efi] Use the SNP protocol instance to match the SNP chainloading device
Some systems will install a child of the SNP device and use this as
our loaded image's device handle, duplicating the installation of the
underlying SNP protocol onto the child device handle.  On such
systems, we want to end up driving the parent device (and
disconnecting any other drivers, such as MNP, which may be attached to
the parent device).

Fix by recording the SNP protocol instance at initialisation time, and
using this to match against device handles (rather than simply
comparing the handles themselves).

Reported-by: Jarrod Johnson <jarrod.b.johnson@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-04 15:39:02 +01:00
Michael Brown ead70bf920 [intel] Apply PBS/PBA errata workaround only to ICH8 PCI device IDs
ICH8 devices have an errata which requires us to reconfigure the
packet buffer size (PBS) register, and correspondingly adjust the
packet buffer allocation (PBA) register.  The "Intel I/O Controller
Hub ICH8/9/10 and 82566/82567/82562V Software Developer's Manual"
notes for the PBS register that:

  10.4.20   Packet Buffer Size - PBS (01008h; R/W)

  Note: The default setting of this register is 20 KB and is
        incorrect. This register must be programmed to 16 KB.

  Initial value: 0014h
                 0018h (ICH9/ICH10)

It is unclear from this comment precisely which devices require the
workaround to be applied.  We currently attempt to err on the side of
caution: if we detect an initial value of either 0x14 or 0x18 then the
workaround will be applied.  If the workaround is applied
unnecessarily, then the effect should be just that we use less than
the full amount of the available packet buffer memory.

Unfortunately this approach does not play nicely with other device
drivers.  For example, the Linux e1000e driver will rewrite PBA while
assuming that PBS still contains the default value, which can result
in inconsistent values between the two registers, and a corresponding
inability to transmit or receive packets.  Even more unfortunately,
the contents of PBS and PBA are not reset by anything less than a
power cycle, meaning that this error condition will survive a hardware
reset.

The Linux driver (written and maintained by Intel) applies the PBS/PBA
errata workaround only for devices in the ICH8 family, identified via
the PCI device ID.  Adopt a similar approach, using the PCI_ROM()
driver data field to indicate when the workaround is required.

Reported-by: Donald Bindner <dbindner@truman.edu>
Debugged-by: Donald Bindner <dbindner@truman.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-21 00:40:22 +01:00
Michael Brown d461b8ddf2 [intel] Display before and after values for both PBS and PBA
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-20 23:16:01 +01:00
Michael Brown c845740b88 [intel] Display PBS value when applying ICH errata workaround
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-20 22:59:54 +01:00
Michael Brown 3953ddd2ac [smc9000] Avoid using CONFIG as a preprocessor macro
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-19 14:38:27 +01:00
Michael Brown 8b2942a7db [xen] Cope with unexpected initial backend states
Under some circumstances (e.g. if iPXE itself is booted via iSCSI, or
after an unclean reboot), the backend may not be in the expected
InitWait state when iPXE starts up.

There is no generic reset mechanism for Xenbus devices.  Recent
versions of xen-netback will gracefully perform all of the required
steps if the frontend sets its state to Initialising.  Older versions
(such as that found in XenServer 6.2.0) require the frontend to
transition through Closed before reaching Initialising.

Add a reset mechanism for netfront devices which does the following:

 - read current backend state

 - if backend state is anything other than InitWait, then set the
   frontend state to Closed and wait for the backend to also reach
   Closed

 - set the frontend state to Initialising and wait for the backend to
   reach InitWait.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-14 00:14:51 +01:00
Michael Brown be79ca535a [xen] Use version 1 grant tables by default
Using version 1 grant tables limits guests to using 16TB of grantable
RAM, and prevents the use of subpage grants.  Some versions of the Xen
hypervisor refuse to allow the grant table version to be set after the
first grant references have been created, so the loaded operating
system may be stuck with whatever choice we make here.  We therefore
currently use version 2 grant tables, since they give the most
flexibility to the loaded OS.

Current versions (7.2.0) of the Windows PV drivers have no support for
version 2 grant tables, and will merrily create version 1 entries in
what the hypervisor believes to be a version 2 table.  This causes
some confusion.

Avoid this problem by attempting to use version 1 tables, since
otherwise we may render Windows unable to boot.

Play nicely with other potential bootloaders by accepting either
version 1 or version 2 grant tables (if we are unable to set our
requested version).

Note that the use of version 1 tables on a 64-bit system introduces a
possible failure path in which a frame number cannot fit into the
32-bit field within the v1 structure.  This in turn introduces
additional failure paths into netfront_transmit() and
netfront_refill_rx().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-13 19:21:42 +01:00
Michael Brown 5c4f1da2ce [efi] Generalise snpnet_pci_info() to efi_locate_device()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-06 14:27:45 +01:00
Curtis Larsen 2ce1c70166 [efi] Try various possible SNP receive filters
The behavior observed in the Apple EFI (1.10) RecieveFilters() call
is:

  - failure if any of the PROMISCUOUS or MULTICAST filters are
    included

  - success if only UNICAST is included, however the result is
    UNICAST|BROADCAST

  - success if only UNICAST and BROADCAST are included

  - if UNICAST, or UNICAST|BROADCAST are used, but the previous call
    tried (and failed) to set UNICAST|BROADCAST|MULTICAST, then the
    result is UNICAST|BROADCAST|MULTICAST

Work around this apparently broken SNP implementation by trying
RecieveFilterMask, then falling back to UNICAST|BROADCAST|MULTICAST,
then UNICAST|BROADCAST, and finally UNICAST.

Modified-by: Michael Brown <mcb30@ipxe.org>
Tested-by: Curtis Larsen <larsen@dixie.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-05 23:10:34 +01:00
Michael Brown 7b3cc18462 [efi] Open device path protocol only at point of use
Some EFI 1.10 systems (observed on an Apple iMac) do not allow us to
open the device path protocol with an attribute of
EFI_OPEN_PROTOCOL_BY_DRIVER and so we cannot maintain a safe,
long-lived pointer to the device path.  Work around this by instead
opening the device path protocol with an attribute of
EFI_OPEN_PROTOCOL_GET_PROTOCOL whenever we need to use it.

Debugged-by: Curtis Larsen <larsen@dixie.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-05 23:10:33 +01:00
Michael Brown 3b42ed477f [efi] Provide centralised definitions of commonly-used GUIDs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-05 23:08:32 +01:00
Michael Brown 471fdfab79 [efi] Reset multicast filter list when setting SNP receive filters
According to the UEFI specification, the MCastFilter parameter (which
we currently pass as NULL, along with a zero MCastFilterCnt) is
optional only if ResetMCastFilter is true.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-05 18:00:17 +01:00
Michael Brown 1f7b269954 [efi] Add ability to dump SNP device mode information
Originally-implemented-by: Curtis Larsen <larsen@dixie.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-05 17:32:16 +01:00
Michael Brown 16d99cc8ef [efi] Dump existing openers when we are unable to open a protocol
Dump the existing openers of a protocol whenever we are unable to open
a protocol using attributes of BY_DEVICE, EXCLUSIVE, or
BY_CHILD_CONTROLLER.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31 12:50:14 +01:00
Michael Brown 60891f699a [efi] Use efi_handle_name() instead of efi_devpath_text() where applicable
Using efi_devpath_text() is marginally more efficient if we already
have the device path protocol available, but the mild increase in
efficiency is not worth compromising the clarity of the pattern:

  DBGC ( device, "THING %p %s ...", device, efi_handle_name ( device ) );

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31 11:57:31 +01:00
Michael Brown 2e0821b9ed [efi] Use efi_handle_name() instead of efi_handle_devpath_text()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31 11:56:44 +01:00
Michael Brown 793a806611 [xen] Add support for Xen netfront virtual NICs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-29 15:57:56 +01:00
Michael Brown 3a02409fc8 [natsemi] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:54:49 +01:00
Michael Brown 720ae17aa4 [myson] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:53:43 +01:00
Michael Brown 022ef91984 [skel] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:52:48 +01:00
Michael Brown 7ab3035749 [vmxnet3] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:51:38 +01:00
Michael Brown 857e4f56a7 [realtek] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:50:18 +01:00
Michael Brown 9ce2b56af6 [intel] Check for ioremap() failures
Debugged-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:49:08 +01:00
Michael Brown d0cfbd01f5 [efi] Rewrite SNP NIC driver
Rewrite the SNP NIC driver to use non-blocking and deferrable
transmissions, to provide link status detection, to provide
information about the underlying (PCI) hardware device, and to avoid
unnecessary I/O buffer allocations during receive polling.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-08 14:01:55 +01:00
Michael Brown c7051d826b [efi] Allow network devices to be created on top of arbitrary SNP devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-03 15:28:17 +01:00
Hannes Reinecke bb5a4a111b [igbvf] Allow changing of MAC address
The VF might not have assigned a MAC address upon startup, and will
end up with a random MAC address during probe().  With this patch the
MAC address can be changed later on.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-06-12 17:46:12 +01:00
Hannes Reinecke f63ec19dca [igbvf] Assign random MAC address if none is set
If the VF doesn't have a MAC address assigned we should create a
random MAC address.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-06-12 17:38:08 +01:00
Michael Brown d5cf058994 [iscsi] Include IP address origin in iBFT
The iBFT includes an "origin" field to indicate the source of the IP
address.  We use the heuristic of assuming that the source should be
"manual" if the IP address originates directly from the network device
settings block, and "DHCP" otherwise.  This is an imperfect guess, but
is likely to be correct in most common situations.

Originally-implemented-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-06-12 17:09:16 +01:00
Michael Brown 059adae434 [iscsi] Read IPv4 settings only from the relevant network device
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-06-12 17:03:14 +01:00
Michael Brown e047811c85 [scsi] Improve sense code parsing
Parse the sense data to extract the reponse code, the sense key, the
additional sense code, and the additional sense code qualifier.

Originally-implemented-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-06-03 02:04:46 +01:00
Michael Brown 4e4fc678c2 [intel] Increase receive ring fill level
As of commit d28bb51 ("[tcp] Defer sending ACKs until all received
packets have been processed"), increasing the RX ring size will
increase the number of received packets per transmitted ACK (since
each poll will process up to one complete receive ring).  Under KVM,
this can make a substantial (up to ~200%) difference to the overall
download speed, since transmissions are very expensive.

Increase the ring fill level from four to eight packets: this
increases the download speed by around 50% at a cost of around 8kB of
heap space.  Further speedups are possible by increasing the ring size
further, but it would be preferable to find alternative methods which
do not use noticeable amounts of heap space.

Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-05-16 13:15:40 +01:00
Michael Brown abf875a2e5 [intel] Exclude time spent in hypervisor from profiling
When profiling, exclude any time spent inside the hypervisor
responding to our MMIO accesses.  This substantially reduces the
variance accumulated on many other profilers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-05-06 22:53:33 +01:00
Michael Brown b2c7b6a85e [intel] Push new RX descriptors in batches
Inside a virtual machine, writing the RX ring tail pointer may incur a
substantial overhead of processing inside the hypervisor.  Minimise
this overhead by writing the tail pointer once per batch of
descriptors, rather than once per descriptor.

Profiling under qemu-kvm (version 1.6.2) shows that this reduces the
amount of time taken to refill the RX descriptor ring by around 90%.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27 23:14:48 +01:00
Michael Brown 8a3dcefc0c [intel] Profile common virtual machine operations
Operations which are negligible on physical hardware (such as issuing
a posted write to the transmit ring tail register) may involve
substantial amounts of processing within the hypervisor if running in
a virtual machine.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27 23:14:48 +01:00
Michael Brown 27884298a3 [intel] Avoid completely filling the TX descriptor ring
It is unclear from the datasheets whether or not the TX ring can be
completely filled (i.e. whether writing the tail value as equal to the
current head value will cause the ring to be treated as completely
full or completely empty).  It is very plausible that this edge case
could differ in behaviour between real hardware and the many
implementations of an emulated Intel NIC found in various virtual
machines.  Err on the side of caution and always leave at least one
ring entry empty.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-22 13:12:54 +01:00
Michael Brown ccb6e5c627 [realtek] Clear bit 24 of RCR
On an Asus Z87-K motherboard with an onboard 8168 NIC, booting into
Windows 7 and then warm rebooting into iPXE results in a broken RX
datapath: packets can be transmitted successfully but garbage is
received.  A cold reboot clears the problem.

A dump of the PHY registers reveals only one difference: in the
failure case the bits ADVERTISE_PAUSE_CAP and ADVERTISE_PAUSE_ASYM are
cleared.  Explicitly setting these bits does not fix the problem.

A dump of the MAC registers reveals a few differences, of which the
most obvious culprit is the undocumented bit 24 of the Receive
Configuration Register (RCR), which is set in the failure case.
Explicitly clearing this bit does fix the problem.

Reported-by: Sebastian Nielsen <ipxe@sebbe.eu>
Reported-by: Oliver Rath <rath@mglug.de>
Debugged-by: Sebastian Nielsen <ipxe@sebbe.eu>
Tested-by: Sebastian Nielsen <ipxe@sebbe.eu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-20 15:54:25 +00:00
Michael Brown 87b59677ba [realtek] Add ability to dump all internal registers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-20 12:36:14 +00:00
Michael Brown 145fc26ed5 [realtek] Dump all MII register contents when link status changes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-10 12:22:23 +00:00
Michael Brown ac5c2e851b [realtek] Include link status register details in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-04 16:30:06 +00:00
Michael Brown 3fa7a3b136 [intel] Add some missing PCI IDs
Tested-by: Philipp Hagen <Philipp.Hagen@she.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-29 16:43:39 +00:00
Michael Brown 22001cb206 [settings] Explicitly separate the concept of a completed fetched setting
The fetch_setting() family of functions may currently modify the
definition of the specified setting (e.g. to add missing type
information).  Clean up this interface by requiring callers to provide
an explicit buffer to contain the completed definition of the fetched
setting, if required.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-12-05 00:37:02 +00:00
lolipop 0780bccb68 [intel] Add Intel I217 Gigabit Ethernet PCI ID
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-23 12:03:58 +01:00
Michael Brown 8a2dc7a588 [linux] Apply MAC address prior to registering network device
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 02:02:58 +01:00
Michael Brown 0b65c8cad6 [netdevice] Add method for generating EUI-64 address from link-layer address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03 01:24:15 +01:00
Michael Brown ae0124cd40 [linux] Give tap devices a name and bus type
Give tap devices a meaningful name, and avoid segmentation faults when
attempting to retrieve ${net0/bustype} by assigning a new bus type for
tap devices.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-27 16:39:43 +01:00
Thomas Miletich 6d72b498c2 [3c90x] Fix High-MTU packet reception
Prevent the card from flagging packets of 1518 bytes length as
overlength.

This fixes the High-MTU loopback test.

Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-20 14:38:33 +01:00
Thomas Miletich e5f6471525 [3c90x] Don't round up transmit packet length
The 3c90x B and C revisions support rounding up the packet length to a
specific boundary.  Disable this feature to avoid overlength packets.

This fixes the loopback test.

Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-20 14:37:05 +01:00
Thomas Miletich b324a9c243 [3c90x] Stall upload engine before setting RX ring address
According to the 3c90x datasheet we have to stall the upload (receive)
engine before setting the receive ring address.

Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-20 14:34:53 +01:00
Michael Brown 6d910559b3 [pci] Add pci_find_next() to iterate over existent PCI devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-05 13:51:16 +01:00
Marin Hannache 9b93b669d1 [legal] Add missing FILE_LICENCE declarations
Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 13:41:46 +02:00
Michael Brown 918fb43743 [realtek] Allow extra space in RX buffers
Some hardware (observed with an onboard RTL8168) will erroneously
report a buffer overflow error if the received packet exactly fills
the receive buffer.

Fix by adding an extra four bytes of padding to each receive buffer.

Debugged-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 12:19:37 +02:00
Adrian Jamróz 4fabc0012a [velocity] Rewrite VIA Velocity driver
Signed-off-by: Adrian Jamróz <adrian.jamroz@gmail.com>
Modified-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 11:25:51 +02:00
Michael Brown 3aafe5fc54 [realtek] Report RX error detail in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 00:38:43 +02:00
Marin Hannache 6ad05aa319 [legal] Add FILE_LICENCE for ath9k driver headers
Signed-off-by: Marin Hannache <git@mareo.fr>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-14 23:47:42 +02:00
Michael Brown 18521a170c [intel] Incorporate ring producer and consumer counters in diagnostics
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-14 23:27:37 +02:00
Adrian Jamróz ad4f58d410 [rhine] Rewrite VIA Rhine driver
Replace the old via-rhine driver with a new version using the iPXE
API.

Includes fixes by Thomas Miletich for:

  - MMIO access
  - Link detection
  - RX completion in RX overflow case
  - Reset and EEPROM reloading
  - CRC stripping
  - Missing cpu_to_le32() calls
  - Missing memory barriers

Signed-off-by: Adrian Jamróz <adrian.jamroz@gmail.com>
Modified-by: Thomas Miletich <thomas.miletich@gmail.com>
Tested-by: Thomas Miletich <thomas.miletich@gmail.com>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Modified-by: Michael Brown <mcb30@ipxe.org>
Tested-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-14 18:09:01 +02:00