summaryrefslogtreecommitdiffstats
path: root/src/drivers
Commit message (Collapse)AuthorAgeFilesLines
...
* [intel] Show original CTRL and STATUS values in debugging outputMichael Brown2017-04-141-4/+12
| | | | | | | | In situations where iPXE fails to reach link-up as expected, it is useful to know the original values of the CTRL and STATUS registers prior to our reset attempt. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [sfc] Add driver for Solarflare SFC8XXX adaptersMartin Habets2017-04-109-0/+5602
| | | | | | Signed-off-by: Martin Habets <mhabets@solarflare.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [thunderx] Use ThunderxConfigProtocol to obtain board configurationAdamczyk, Konrad2017-03-312-110/+60Star
| | | | | | | | | | | | | | | | | | Following changes were introduced: - added GetBgxProp and GetLmacProp methods to ThunderxConfigProtocol - replaced direct BOARD_CFG access with usage of introduced methods - removed redundant BOARD_CFG - changed GUID of ThunderxConfigProtocol, as this is not compatible with previous version - changed UINTN* to UINT64* buffer type to fix issue on 32-bit platforms with MAC address This change allows us to avoid alignment of BOARD_CFG definitions every time it changes in UEFI. Signed-off-by: Konrad Adamczyk <konrad.adamczyk@cavium.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [scsi] Retry TEST UNIT READY commandMichael Brown2017-03-291-10/+35
| | | | | | | | | | | | | | | | | | The TEST UNIT READY command is issued automatically when the device is opened, and is not the result of a command being issued by the caller. This is required in order that a permanent TEST UNIT READY failure can be used to identify unusable paths in a multipath SAN device. Since the TEST UNIT READY command is not part of the caller's command issuing process, it is not covered by any external retry loops (such as the main retry loop in sandev_command()). We must therefore be prepared to retry the TEST UNIT READY command within the SCSI layer itself. We retry only the TEST UNIT READY command so as not to multiply the number of potential retries for normal commands (which are already retried by sandev_command()). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Fix building with kernel 4.11 headersMichael Brown2017-03-292-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Avoid implicit-fallthrough warnings on GCC 7Michael Brown2017-03-296-0/+18
| | | | | | Reported-by: Vinson Lee <vlee@freedesktop.org> Reported-by: Liang Yan <lyan@suse.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iscsi] Do not install iBFT when no iSCSI targets existMichael Brown2017-03-281-0/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Describe all SAN devices via ACPI tablesMichael Brown2017-03-282-173/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Describe all SAN devices via ACPI tables such as the iBFT. For tables that can describe only a single device (i.e. the aBFT and sBFT), one table is installed per device. For multi-device tables (i.e. the iBFT), all devices are described in a single table. An underlying SAN device connection may be closed at the time that we need to construct an ACPI table. We therefore introduce the concept of an "ACPI descriptor" which enables the SAN boot code to maintain an opaque pointer to the underlying object, and an "ACPI model" which can build tables from a list of such descriptors. This separates the lifecycles of ACPI descriptions from the lifecycles of the block device interfaces, and allows for construction of the ACPI tables even if the block device interface has been closed. For a multipath SAN device, iPXE will wait until sufficient information is available to describe all devices but will not wait for all paths to connect successfully. For example: with a multipath iSCSI boot iPXE will wait until at least one path has become available and name resolution has completed on all other paths. We do this since the iBFT has to include IP addresses rather than DNS names. We will commence booting without waiting for the inactive paths to either become available or close; this avoids unnecessary boot delays. Note that the Linux kernel will refuse to accept an iBFT with more than two NIC or target structures. We therefore describe only the NICs that are actually required in order to reach the described targets. Any iBFT with at most two targets is therefore guaranteed to describe at most two NICs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [scsi] Avoid duplicate call to scsicmd_close() on TEST UNIT READY failureMichael Brown2017-03-261-2/+4
| | | | | | | | | | | | | When the TEST UNIT READY command receives an error response, the shutdown of the command's block data interface will result in scsidev_ready() closing the SCSI device. This will subsequently result in a duplicate call to scsicmd_close(), leading to an assertion failure when list_del() is called for the second time. Fix by removing the command from the list of outstanding commands before shutting down the command's interfaces. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [vxge] Fix use of stale I/O buffer on error pathMichael Brown2017-03-231-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [sky2] Use 32-bit read to read Y2_VAUX_AVAILMike McCormack2017-03-232-2/+2
| | | | | | | | | | | B0_CTST is a 24bit register according to the vendor driver (sk98lin). A 16bit read on B0_CTST will always return 0 for Y2_VAUX_AVAIL (1<<16), so use a 32bit read when testing Y2_VAUX_AVAIL. [This patch is copied directly from the Linux kernel tree.] Signed-off-by: Mike McCormack <mikem@ring3k.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pcnet32] Eliminate redundant register readMichael Brown2017-03-231-2/+1Star
| | | | | | | | | | | | | | | | | | | | | The value of ( ( x & 0x0c00 ) | 0x0c00 ) is always 0x0c00 regardless of the value of x, and so the read_csr() is redundant. (There are no read side effects for this register, according to the datasheet.) This line of code originated in Linux kernel 2.3.19pre1 as a->write_csr(ioaddr, 80, a->read_csr(ioaddr, 80) | 0x0c00); and was modified in kernel 2.3.41pre4 to read a->write_csr(ioaddr, 80, (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00); In the absence of commit messages, the intention of the code is unclear. However, the logic resulting in a fixed value of 0x0c00 has remained unaltered for over 17 years, and can probably be assumed to have the correct overall result. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Bug fixes and improved paging allocation methodRaed Salem2017-03-2317-555/+199Star
| | | | | | | | Updates: - revert Support for clear interrupt via BAR Signed-off-by: Raed Salem <raeds@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rtl818x] Fix resource leak on error pathMichael Brown2017-03-231-2/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [sis190] Avoid NULL pointer dereferenceMichael Brown2017-03-221-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [w89c840] Avoid potential array overrunMichael Brown2017-03-221-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tlan] Guard against failure to identify chipMichael Brown2017-03-221-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Assert that mapping length is non-zeroMichael Brown2017-03-221-0/+1
| | | | | | | An (impossible) mapping length of zero produces a negative bit shift, which is technically undefined. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [arbel] Assert that mapping length is non-zeroMichael Brown2017-03-221-0/+1
| | | | | | | An (impossible) mapping length of zero produces a negative bit shift, which is technically undefined. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Use correct length for memcpy()Michael Brown2017-03-221-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ath] Add missing break statementsMichael Brown2017-03-221-0/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [infiniband] Return status code from ib_create_cq() and ib_create_qp()Michael Brown2017-03-224-42/+33Star
| | | | | | | | | | | | Any underlying errors arising during ib_create_cq() or ib_create_qp() are lost since the functions simply return NULL on error. This makes debugging harder, since a debug-enabled build is required to discover the root cause of the error. Fix by returning a status code from these functions, thereby allowing any underlying errors to be propagated. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xhci] Avoid accessing beyond end of endpoint context arrayMichael Brown2017-03-211-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [eoib] Avoid passing a NULL I/O buffer to netdev_tx_complete_err()Michael Brown2017-03-211-1/+2
| | | | | | | | | Report errors in eoib_duplicate() via netdev_tx_err() rather than netdev_tx_complete_err(), since netdev_tx_complete_err() accepts only valid I/O buffers that are currently in the network device's transmit queue. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Use correct length for memcpy()Michael Brown2017-03-211-1/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [sis900] Remove extraneous memset() with incorrect lengthMichael Brown2017-03-211-2/+1Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [qib7322] Use correct length for memset()Michael Brown2017-03-211-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linda] Use correct length for memset()Michael Brown2017-03-211-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [arbel] Avoid potential integer overflow when calculating memory mappingsMichael Brown2017-03-211-1/+1
| | | | | | | | When the area to be mapped straddles the 2GB boundary, the expression (high+size) will overflow on the first loop iteration. Fix by using (end-size), which cannot underflow. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hermon] Avoid potential integer overflow when calculating memory mappingsMichael Brown2017-03-211-1/+1
| | | | | | | | When the area to be mapped straddles the 2GB boundary, the expression (high+size) will overflow on the first loop iteration. Fix by using (end-size), which cannot underflow. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Skip cable detection at initialisation where possibleMichael Brown2017-03-191-23/+19Star
| | | | | | | | | | | | | | | | | | We currently request cable detection in PXE_OPCODE_INITIALIZE to work around buggy Emulex drivers (see commit c0b61ba ("[efi] Work around bugs in Emulex NII driver")). This causes problems with some other NII drivers (e.g. Mellanox), which may time out if the underlying link is intrinsically slow to come up. Attempt to work around both problems simultaneously by requesting cable detection only if the underlying NII driver does not support link status reporting via PXE_OPCODE_GET_STATUS. (This is based on a potentially incorrect assumption that the buggy Emulex drivers do not claim to report link status via PXE_OPCODE_GET_STATUS.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Provide common ARRAY_SIZE() definitionMichael Brown2017-03-108-19/+2Star
| | | | | | | Several files define the ARRAY_SIZE() macro as used in Linux. Provide a common definition for this in include/compiler.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Reset all virtual function settingsVishvananda Ishaya2017-03-094-13/+91
| | | | | | | | | | | Some VF data is not cleared with reset, so make sure to return all the settings to default before configuring the VF. This fixes an issue where network packets would fail to be received if the VF was previously used by the linux ixgbevf driver. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [scsi] Avoid duplicate calls to scsicmd_close()Michael Brown2017-03-091-8/+7Star
| | | | | | | | | | | | | | | | When a SCSI device is closed in error, the shutdown of the device's block data interface will probably lead to any outstanding commands being closed (by whichever object is currently connected to the block data interface). However, commands remain in the list of outstanding commands until the final reference is dropped. The result is that scsidev_close() will make a second call to scsicmd_close() for each command. This is harmless, but produces confusing debug messages. Fix by treating the outstanding command list as holding an explicit reference to each command, and removing the command from the list of outstanding commands in scsicmd_close(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [scsi] Use intfs_shutdown() when shutting down multiple interfacesMichael Brown2017-03-091-5/+3Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Retry any SAN device operationMichael Brown2017-03-071-24/+1Star
| | | | | | | | | | The SCSI layer currently implements a retry loop in order to retry commands that fail due to spurious "error" conditions such as "power on occurred". Move this retry loop to the generic SAN device layer: this allow for retries due to other transient error conditions such as an iSCSI target having dropped the connection due to inactivity. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [thunderx] Don't disable NIC when exiting from iPXEKonrad Adamczyk2017-02-071-3/+0Star
| | | | | | | | | According to ThunderX Errata G-17560, NIC_PF_CFG[ENA] bit should not be cleared at exit. This allows other drivers to access the NIC regs correctly. Signed-off-by: Konrad Adamczyk <konrad.adamczyk@cavium.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [thunderx] Fix hardware deinitializationBartosz Szczepanek2017-02-071-0/+7
| | | | | | | | | | | | It is required to reset BGX context state for the LMAC using BGX_CMR_CONFIG register. This solves problem with network connectivity in Linux booted from iPXE. Signed-off-by: Bartosz Szczepanek <bartosz.szczepanek@cavium.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add INTEL_NO_PHY_RST for I219-LM (2)Christian Nilsson2017-01-261-1/+1
| | | | | | | | Originally-implemented-by: Malte zu Klampen <malte@pclab.ifg.uni-kiel.de> Originally-implemented-by: Richard Moore <rich@richud.com> Tested-by: Esben Storgaard Nielsen <esn@solar.dk> Signed-off-by: Christian Nilsson <nikize@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Allow timer to be selected at runtimeMichael Brown2017-01-262-2/+2
| | | | | | | | | | | | | | | | | | | | | | Allow the active timer (providing udelay() and currticks()) to be selected at runtime based on probing during the INIT_EARLY stage of initialisation. TICKS_PER_SEC is now a fixed compile-time constant for all builds, and is independent of the underlying clock tick rate. We choose the value 1024 to allow multiplications and divisions on seconds to be converted to bit shifts. TICKS_PER_MS is defined as 1, allowing multiplications and divisions on milliseconds to be omitted entirely. The 2% inaccuracy in this definition is negligible when using the standard BIOS timer (running at around 18.2Hz). TIMER_RDTSC now checks for a constant TSC before claiming to be a usable timer. (This timer can be tested in KVM via the command-line option "-cpu host,+invtsc".) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [virtio] Use host-specified MTU when availableMichael Brown2017-01-232-13/+37
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [virtio] Use separate RX and TX empty header buffersMichael Brown2017-01-231-7/+12
| | | | | | | | | | | | | | | Some host implementations (notably Google Compute Platform) are known to unconditionally write back VIRTIO_NET_HDR_F_DATA_VALID to header->flags for received packets, regardless of the features negotiated by the driver. This breaks the transmit datapath by effectively setting an illegal flag for all subsequent transmitted packets. Work around this problem by using separate empty header buffers for the receive and transmit queues. Debugged-by: Ladi Prosek <lprosek@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [af_packet] Add new AF_PACKET driver for LinuxDavid Decotigny2017-01-221-0/+325
| | | | | | | | | | | | This code largely inspired by tap.c. Allows for testing iPXE on real NICs from within Linux. For example: make bin-x86_64-linux/af_packet.linux valgrind ./bin-x86_64-linux/af_packet.linux --net af_packet,if=eth3 Tested as x86_64 and i386 binary. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [virtio] Remove queue size limit in legacy virtioLadi Prosek2017-01-222-9/+40
| | | | | | | | | | | | | | | | Virtio 0.9 implementation was limited to the maximum virtqueue size of MAX_QUEUE_NUM and the virtio-net driver would fail to initialize on hosts exceeding this limit. This commit lifts the restriction by allocating the queue memory based on the actual queue size instead of using a fixed maximum. Note that virtio 1.0 still uses the MAX_QUEUE_NUM constant to cap the size (unfortunately this functionality is not available in virtio 0.9). Signed-off-by: Ladi Prosek <lprosek@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [virtio] Simplify virtqueue shutdownLadi Prosek2017-01-222-19/+20
| | | | | | | | | | | | This commit introduces virtnet_free_virtqueues called on all virtqueue error and shutdown paths. vpm_find_vqs no longer cleans up after itself and instead expects virtnet_free_virtqueues to be always called to undo its effect. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [virtio] Cap queue size to MAX_QUEUE_NUMLadi Prosek2017-01-221-1/+7
| | | | | | | | | | | | | | | vpm_find_vqs incorrectly accepted the host provided queue size with no regard to iPXE's internal limitations. Virtio 1.0 makes it possible for the driver to override the queue size to reduce memory requirements and iPXE is a great use case for this feature. Also removing the extra vq->vring.num assignment which is already handled in vring_init. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [golan] Update Connect-IB, ConnectX-4 and ConnectX-4 Lx (Infiniband) supportRaed Salem2016-12-0823-152/+901
| | | | | | | | | | | | | | Updates: - Nodnic: Support for arm cq doorbell via the UAR BAR - Ensure hardware is quiescent when no interface is open - WinPE WA - Support for clear interrupt via BAR - Nodnic: Support for send TX doorbells via the UAR BAR - Added ConnectX-5EX device - Added ConnectX-5 device Signed-off-by: Raed Salem <raeds@mellanox.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Remove duplicate intelvf_mbox_queues() functionMichael Brown2016-07-141-41/+0Star
| | | | | | | | Commit db34436 ("[intel] Strip spurious VLAN tags received by virtual function NICs") accidentally introduced two copies of the intel[x]vf_mbox_queues() function. Remove the unintended copy. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Strip spurious VLAN tags received by virtual function NICsMichael Brown2016-07-124-0/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The physical function may be configured to transparently insert a VLAN tag into all transmitted packets. Unfortunately, it does not equivalently strip this same VLAN tag from all received packets. This behaviour may be observed in some Amazon EC2 instances with Enhanced Networking enabled: transmissions work as expected but all packets received by iPXE appear to have a spurious VLAN tag. We can configure the receive queue to strip VLAN tags via the RXDCTL.VME bit. We need to find out from the PF driver whether or not we should do so. There exists a "get queue configuration" mailbox message which contains a field labelled IXGBE_VF_TRANS_VLAN in the Linux driver. A comment in the Linux PF driver describes this field as "notify VF of need for VLAN tag stripping, and correct queue". It will be filled with a non-zero value if the PF is enforcing the use of a single VLAN tag. It will also be filled with a non-zero value if the PF is using multiple traffic classes. The Linux VF driver seems to treat this field as being simply the number of traffic classes, and gives it no VLAN-related interpretation. The Linux VF driver instead handles the VLAN tag stripping by simply assuming that any unrecognised VLAN tag ought to be silently dropped. We choose to strip and ignore the VLAN tag if the IXGBE_VF_TRANS_VLAN field has a non-zero value. Reported-by: Leonid Vasetsky <leonidv@velostrata.com> Tested-by: Leonid Vasetsky <leonidv@velostrata.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add PCI device ID for I219-V/LMLukas Grossar2016-07-121-0/+2
| | | | | Signed-off-by: Lukas Grossar <lukas.grossar@adfinis-sygroup.ch> Signed-off-by: Michael Brown <mcb30@ipxe.org>