summaryrefslogtreecommitdiffstats
path: root/src/drivers
Commit message (Collapse)AuthorAgeFilesLines
* [ehci] Use meaningful device names in debug messagesMichael Brown2015-05-102-43/+52
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xhci] Use meaningful device names in debug messagesMichael Brown2015-05-102-119/+124
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Provide usb_endpoint_name() for use by host controller driversMichael Brown2015-05-101-33/+29Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uhci] Add support for UHCI host controllersMichael Brown2015-05-102-0/+1921
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ehci] Allow UHCI/OHCI controllers to locate the EHCI companion controllerMichael Brown2015-05-092-0/+28
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add find_usb_bus_by_location() helper functionMichael Brown2015-05-091-0/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ehci] Poll child companion controllers after disowning portMichael Brown2015-05-092-0/+59
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Maintain single lists of halted endpoints and changed portsMichael Brown2015-05-091-44/+55
| | | | | | | | | | 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>
* [usb] Maintain a list of all USB busesMichael Brown2015-05-091-0/+10
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Detect missed disconnectionsMichael Brown2015-05-084-51/+72
| | | | | | | | | | | | | | | | | | | | | 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>
* [pci] Provide PCI_CLASS() to calculate a scalar PCI class valueMichael Brown2015-05-082-4/+4
| | | | | | | | 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>
* [usb] Include setup packet within I/O buffer for message transfersMichael Brown2015-05-014-46/+40Star
| | | | | | | | | | | | | | 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>
* [base16] Add buffer size parameter to base16_encode() and base16_decode()Michael Brown2015-04-242-2/+2
| | | | | | | | | | | | | | 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>
* [ath9k] Remove confusing logic inversion in an ANI variableChristian Hesse2015-04-244-24/+24
| | | | | | | | | | | | 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>
* [intel] Add PCI device IDs for Intel I218-LM and I218-VChristian Hesse2015-04-221-1/+6
| | | | | | | | 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>
* [rtl818x] Obviate RTL_ROM() hackMichael Brown2015-04-224-35/+31Star
| | | | | Reported-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Do not attempt to access EEPROM on RTL8169 chipsMichael Brown2015-04-211-2/+3
| | | | | | | | | | | | | | | | | 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>
* [intel] Force RX polling on VMware emulated 82545emMichael Brown2015-04-212-1/+13
| | | | | | | | | | | | 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>
* [intel] Report any unexpected interrupt causesMichael Brown2015-04-212-0/+10
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Update PCI device IDs for Intel 82599 and X540 10G NICsEd Swierk2015-04-211-4/+9
| | | | | | | | | | | | 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>
* [prism2] Remove duplicate PCI_ROM() linesMichael Brown2015-04-151-2/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [eepro100] Remove duplicate PCI_ROM() lineMichael Brown2015-04-151-1/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Poll for TX completions only when there is an outstanding TX bufferMichael Brown2015-04-141-8/+4Star
| | | | | | | | | 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>
* [efi] Poll media status only if advertised as supportedMichael Brown2015-04-141-2/+14
| | | | | | | | 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>
* [efi] Provide a dummy data block in nii_initialise()Michael Brown2015-04-141-1/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xhci] Always reset root hub portsMichael Brown2015-04-131-7/+5Star
| | | | | | | | 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>
* [virtio] Downgrade per-iobuf debug messages to DBGC2Laszlo Ersek2015-04-101-6/+6
| | | | | Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xhci] Support USB1 devices attached via transaction translatorsMichael Brown2015-03-234-31/+143
| | | | | | | | | | | | | | | | | | | | 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>
* [usb] Improve debug messages for failed control transactionsMichael Brown2015-03-231-6/+5Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ehci] Support USB1 devices attached via transaction translatorsMichael Brown2015-03-232-11/+53
| | | | | | | | | | | | | | | 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>
* [usb] Clear transaction translator buffers when applicableMichael Brown2015-03-231-4/+68
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add clear_tt() hub method to clear transaction translator bufferMichael Brown2015-03-234-2/+105
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Reset endpoints without waiting for a new transfer to be enqueuedMichael Brown2015-03-231-28/+64
| | | | | | | | | | | | | | | 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>
* [xhci] Ring doorbell as part of endpoint resetMichael Brown2015-03-231-0/+3
| | | | | | | | | 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>
* [usb] Fix USB timeouts to match specificationMichael Brown2015-03-182-2/+10
| | | | | | | | | | | | | | | 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>
* [ehci] Add support for EHCI host controllersMichael Brown2015-03-182-0/+2361
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xhci] Do not release ownership back to BIOS when booting an OSMichael Brown2015-03-181-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [xhci] Forcibly disable SMIs if BIOS fails to release ownershipMichael Brown2015-03-161-10/+10
| | | | | | | | 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>
* [usb] Add functions for manual device address assignmentMichael Brown2015-03-161-0/+44
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ncm] Respect maximum transfer size of the busMichael Brown2015-03-161-0/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add the concept of a USB bus maximum transfer sizeMichael Brown2015-03-163-2/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [smsc75xx] Move RX FIFO overflow message to DBGLVL_EXTRAMichael Brown2015-03-121-1/+2
| | | | | | | | | | | | | | 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>
* [smsc75xx] Add driver for SMSC/Microchip LAN75xx USB Ethernet NICsMichael Brown2015-03-112-0/+1365
| | | | | | | | | | | | | | | | | | | 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>
* [mii] Add generic mii_check_link() functionMichael Brown2015-03-101-0/+32
| | | | | | | | | | | | 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>
* [legal] Relicense Davicom DM96xx driversMichael Brown2015-03-102-2/+6
| | | | | Reported-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dm96xx] Add driver for Davicom DM96xx USB Ethernet NICsMichael Brown2015-03-092-0/+861
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add PCI ID for I218-LMThomas Miletich2015-03-091-0/+1
| | | | | Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Set the "feature-rx-notify" flag for netfront devicesMichael Brown2015-03-091-0/+8
| | | | | | | | | | | | 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>
* [xhci] Undo PCH-specific quirk fixes when removing deviceMichael Brown2015-03-062-17/+51
| | | | | | | | 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>
* [xhci] Enable USB3 ports on Intel PCH8/PCH9 controllersMichael Brown2015-03-062-0/+55
| | | | | | | | | | 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>