aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* [bios] Allow pcibios_discover() to return an empty rangeMichael Brown2022-09-181-3/+5
| | | | | | | Allow pcibios_discover() to return an empty range if the INT 1A,B101 PCI BIOS installation check call fails. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Add support for the Enhanced Configuration Access Mechanism (ECAM)Michael Brown2022-09-165-0/+461
| | | | | | | | | | | | | The ACPI MCFG table describes a direct mapping of PCI configuration space into MMIO space. This mapping allows access to extended configuration space (up to 4096 bytes) and also provides for the existence of multiple host bridges. Add support for the ECAM mechanism described by the ACPI MCFG table, as a selectable PCI I/O API alongside the existing PCI BIOS and Type 1 mechanisms. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Generalise pci_num_bus() to pci_discover()Michael Brown2022-09-1510-43/+78
| | | | | | | | | | Allow pci_find_next() to discover devices beyond the first PCI segment, by generalising pci_num_bus() (which implicitly assumes that there is only a single PCI segment) with pci_discover() (which has the ability to return an arbitrary contiguous chunk of PCI bus:dev.fn address space). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Check for wraparound in callers of pci_find_next()Michael Brown2022-09-153-3/+10
| | | | | | | | | | | | | | | | The semantics of the bus:dev.fn parameter passed to pci_find_next() are "find the first existent PCI device at this address or higher", with the caller expected to increment the address between finding devices. This does not allow the parameter to distinguish between the two cases "start from address zero" and "wrapped after incrementing maximal possible address", which could therefore lead to an infinite loop in the degenerate case that a device with address ffff:ff:1f.7 really exists. Fix by checking for wraparound in the caller (which is already responsible for performing the increment). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Allow pci_find_next() to return non-zero PCI segmentsMichael Brown2022-09-153-16/+14
| | | | | | | | Separate the return status code from the returned PCI bus:dev.fn address, in order to allow pci_find_next() to be used to find devices with a non-zero PCI segment number. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Add missing PROVIDE_PCIAPI_INLINE() macrosMichael Brown2022-09-151-0/+9
| | | | | | | Ensure type consistency of the PCI I/O API methods by adding the missing PROVIDE_PCIAPI_INLINE() macros. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv6] Ignore SLAAC on prefixes with an incompatible prefix lengthMichael Brown2022-09-131-11/+25
| | | | | | | | | | | | | Experience suggests that routers are often misconfigured to advertise SLAAC even on prefixes that do not have a SLAAC-compatible prefix length. iPXE will currently treat this as an error, resulting in the prefix being ignored completely. Handle this misconfiguration by ignoring the autonomous address flag when the prefix length is unsuitable for SLAAC. Reported-by: Malte Janduda <mail@janduda.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv6] Fix mask calculation when prefix length is not a multiple of 8Michael Brown2022-09-062-1/+38
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Validate constructed IPv6 routing table entriesMichael Brown2022-09-061-12/+52
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ena] Increase receive ring size to 128 entriesMichael Brown2022-08-262-5/+12
| | | | | | | | | | | | | | Some versions of the ENA hardware (observed on a c6i.large instance in eu-west-2) seem to require a receive ring containing at least 128 entries: any smaller ring will never see receive completions or will stall after the first few completions. Increase the receive ring size to 128 entries (determined empirically) for compatibility with these hardware versions. Limit the receive ring fill level to 16 (as at present) to avoid consuming more memory than will typically be available in the internal heap. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ena] Provide a host information pageMichael Brown2022-08-262-0/+159
| | | | | | | | | | | | | | | | | | | | | | Some versions of the ENA firmware (observed on a c6i.large instance in eu-west-2) seem to require a host information page, without which the CREATE_CQ command will fail with ENA_ADMIN_UNKNOWN_ERROR. These firmware versions also seem to require us to claim that we are a Linux kernel with a specific driver major version number. This appears to be a firmware bug, as revealed by Linux kernel commit 1a63443af ("net/amazon: Ensure that driver version is aligned to the linux kernel"): this commit changed the value of the driver version number field to be the Linux kernel version, and was hastily reverted in commit 92040c6da ("net: ena: fix broken interface between ENA driver and FW") which clarified that the version number field does actually have some undocumented significance to some versions of the firmware. Fix by providing a host information page via the SET_FEATURE command, incorporating the apparently necessary lies about our identity. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ena] Specify the unused completion queue MSI-X vector as 0xffffffffMichael Brown2022-08-262-0/+9
| | | | | | | | | | | | Some versions of the ENA firmware (observed on a c6i.large instance in eu-west-2) will complain if the completion queue's MSI-X vector field is left empty, even though the queue configuration specifies that interrupts are not used. Work around these firmware versions by passing in what appears to be the magic "no MSI-X vector" value in this field. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ena] Allow for out-of-order completionsMichael Brown2022-08-262-20/+62
| | | | | | | | | | | | | | | | | | | | | | The ENA data path design has separate submission and completion queues. Submission queues must be refilled in strict order (since there is only a single linear tail pointer used to communicate the existence of new entries to the hardware), and completion queue entries include a request identifier copied verbatim from the submission queue entry. Once the submission queue doorbell has been rung, software never again reads from the submission queue entry and nothing ever needs to write back to the submission queue entry since completions are reported via the separate completion queue. This design allows the hardware to complete submission queue entries out of order, provided that it internally caches at least as many entries as it leaves gaps. Record and identify I/O buffers by request identifier (using a circular ring buffer of unique request identifiers), and remove the assumption that submission queue entries will be completed in order. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ena] Limit submission queue fill level to completion queue sizeMichael Brown2022-08-262-4/+11
| | | | | | | | | | | The CREATE_CQ command is permitted to return a size smaller than requested, which could leave us in a situation where the completion queue could overflow. Avoid overflow by limiting the submission queue fill level to the actual size of the completion queue. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Explicitly request a single queue pair for virtual functionsMichael Brown2022-08-162-1/+58
| | | | | | | | | | | | | | | | Current versions of the E810 PF driver fail to set the number of in-use queue pairs in response to the CONFIG_VSI_QUEUES message. When the number of in-use queue pairs is less than the number of available queue pairs, this results in some packets being directed to nonexistent receive queues and hence silently dropped. Work around this PF driver bug by explicitly configuring the number of available queue pairs via the REQUEST_QUEUES message. This message triggers a VF reset that, in turn, requires us to reopen the admin queue and issue an additional GET_RESOURCES message to restore the VF to a functional state. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Allow for admin commands that trigger a VF resetMichael Brown2022-08-161-13/+28
| | | | | | | | | | | | The RESET_VF admin queue command does not complete via the usual mechanism, but instead requires us to poll registers to wait for the reset to take effect and then reopen the admin queue. Allow for the existence of other admin queue commands that also trigger a VF reset, by separating out the logic that waits for the reset to complete. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Negotiate virtual function API version 1.1Michael Brown2022-08-163-3/+31
| | | | | | | Negotiate API version 1.1 in order to allow access to virtual function opcodes that are disallowed by default on the E810. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Show virtual function packet statistics for debuggingMichael Brown2022-08-162-0/+88
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Add driver for Intel 100 Gigabit Ethernet NICsMichael Brown2022-08-125-7/+1569
| | | | | | | | | | | | | | | Add a driver for the E810 family of 100 Gigabit Ethernet NICs. The core datapath is identical to that of the 40 Gigabit XL710, and this part of the code is shared between both drivers. The admin queue mechanism is sufficiently similar to make it worth reusing substantial portions of the code, with separate implementations for several commands to handle the (unnecessarily) breaking changes in data structure layouts. The major differences are in the mechanisms for programming queue contexts (where the E810 abandons TX/RX symmetry) and for configuring the transmit scheduler and receive filters: these portions are sufficiently different to justify a separate driver. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Use admin queue to set port MAC address and maximum frame sizeMichael Brown2022-08-122-27/+105
| | | | | | | Remove knowledge of the PRTGL_SA[HL] registers, and instead use the admin queue to set the MAC address and maximum frame size. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Use admin queue to get port MAC addressMichael Brown2022-08-122-51/+82
| | | | | | | Remove knowledge of the PRTPM_SA[HL] registers, and instead use the admin queue to retrieve the MAC address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Defer fetching MAC address until after opening admin queueMichael Brown2022-08-121-5/+5
| | | | | | | Allow for the MAC address to be fetched using an admin queue command, instead of reading the PRTPM_SA[HL] registers directly. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Set maximum frame size to 9728 bytes as per datasheetMichael Brown2022-08-122-10/+6
| | | | | | | | | | | | The PRTGL_SAH register contains the current maximum frame size, and is not guaranteed on reset to contain the actual maximum frame size supported by the hardware, which the datasheet specifies as 9728 bytes (including the 4-byte CRC). Set the maximum packet size to a hardcoded 9728 bytes instead of reading from the PRTGL_SAH register. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Always issue "clear PXE mode" admin queue commandMichael Brown2022-08-112-13/+11
| | | | | | | | Remove knowledge of the GLLAN_RCTL_0 register (which changes location between the XL810 and E810 register maps), and instead unconditionally issue the "clear PXE mode" command with the EEXIST error silenced. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Allow expected admin queue command errors to be silencedMichael Brown2022-08-111-3/+7
| | | | | | | | | | | | | The "clear PXE mode" admin queue command will return an EEXIST error if the device is already in non-PXE mode, but there is no other admin queue command that can be used to determine whether the device has already been switched into non-PXE mode. Provide a mechanism to allow expected errors from a command to be silenced, to allow the "clear PXE mode" command to be cleanly used without needing to first check the GLLAN_RCTL_0 register value. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Increase data buffer size to 4kBMichael Brown2022-08-111-2/+5
| | | | | | | | | | | At least one E810 admin queue command (Query Default Scheduling Tree Topology) insists upon being provided with a 4kB data buffer, even when the data to be returned is much smaller. Work around this requirement by increasing the admin queue data buffer size to 4kB. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Separate virtual function driver definitionsMichael Brown2022-08-114-259/+320
| | | | | | | Move knowledge of the virtual function data structures and admin command definitions from intelxl.h to intelxlvf.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Reuse admin command descriptor and buffer for VF responsesMichael Brown2022-08-112-17/+15
| | | | | | | | | Remove the large static admin data buffer structure embedded within struct intelxl_nic, and instead copy the response received via the "send to VF" admin queue event to the (already consumed and completed) admin command descriptor and data buffer. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Handle admin events via a callbackMichael Brown2022-08-113-30/+43
| | | | | | | | The physical and virtual function drivers each care about precisely one admin queue event type. Simplify event handling by using a per-driver callback instead of the existing weak function symbol. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Rename 8086:1889 PCI ID to "iavf"Michael Brown2022-08-101-1/+1
| | | | | | | | | | | The PCI device ID 8086:1889 is for the Intel Ethernet Adaptive Virtual Function, which is a generic virtual function that can be exposed by different generations of Intel hardware. Rename the PCI ID from "xl710-vf-ad" to "iavf" to reflect that the driver is not XL710-specific. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Increase receive descriptor ring size to 64 entriesMichael Brown2022-08-101-2/+2
| | | | | | | The E810 requires that receive descriptor rings have at least 64 entries (and are a multiple of 32 entries). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Negotiate API version for virtual function via admin queueMichael Brown2022-08-103-10/+75
| | | | | | | | | | Do not attempt to use the admin commands to get the firmware version and report the driver version for the virtual function driver, since these will be rejected by the E810 firmware as invalid commands when issued by a virtual function. Instead, use the mailbox interface to negotiate the API version with the physical function driver. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Use non-zero MSI-X vector for virtual function interruptsMichael Brown2022-08-104-18/+39
| | | | | | | | The 100 Gigabit physical function driver requires a virtual function driver to request that transmit and receive queues are mapped to MSI-X vector 1 or higher. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Fix invocation of intelxlvf_admin_queues()Michael Brown2022-08-101-1/+1
| | | | | | | The second parameter to intelxlvf_admin_queues() is a boolean used to select the VF opcode, rather than the raw VF opcode itself. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Use function-level reset instead of PFGEN_CTRL.PFSWRMichael Brown2022-08-084-39/+18
| | | | | | | | Remove knowledge of the PFGEN_CTRL register (which changes location between XL710 and E810 register maps), and instead use PCIe FLR to reset the physical function. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Generalise function-level reset mechanismMichael Brown2022-08-083-20/+26
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Update list of PCI IDsMichael Brown2022-08-081-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Include admin command response data buffer in debug outputMichael Brown2022-08-081-1/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Identify rings consistently in debug messagesMichael Brown2022-08-081-4/+3
| | | | | | | Use the tail register offset (which exists for all ring types) as the ring identifier in all relevant debug messages. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Add missing padding bytes to receive queue contextMichael Brown2022-08-081-0/+2
| | | | | | | For the sake of completeness, ensure that all 32 bytes of the receive queue context are programmed (including the unused final 8 bytes). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Fix bit width of function number in PFFUNC_RID registerMichael Brown2022-08-081-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intelxl] Fix retrieval of switch configuration via admin queueMichael Brown2022-08-081-9/+11
| | | | | | | | | | | | | | | | | Commit 8f3e648 ("[intelxl] Use one admin queue buffer per admin queue descriptor") changed the API for intelxl_admin_command() such that the caller now constructs the command directly within the next available descriptor ring entry, rather than relying on intelxl_admin_command() to copy the descriptor to and from the descriptor ring. This introduced a regression in intelxl_admin_switch(), since the second and subsequent iterations of the loop will not have constructed a valid command in the new descriptor ring entry before calling intelxl_admin_command(). Fix by constructing the command within the loop. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [acpi] Expose system MAC address via ${sysmac} settingsysmacMichael Brown2022-06-101-0/+37
| | | | | | | | | | | | | | Expose the system MAC address (if any) via the ${sysmac} setting. This allows scripts to access the system MAC address even when iPXE has decided not to apply it to a network device (e.g. because the cached DHCPACK MAC address was selected in order to match the behaviour of a previous boot stage). The setting is named ${sysmac} rather than ${acpimac} in order to allow for forward compatibility with non-ACPI mechanisms that may exist in future for specifying a system MAC address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cachedhcp] Allow cached DHCPACK to override a temporary MAC addresshwmacMichael Brown2022-05-231-9/+42
| | | | | | | | | | | | | | | | | | When running on a system with an ACPI-provided system-specific MAC address, iPXE will apply this address to an ECM or NCM USB NIC. If iPXE has been chainloaded from a previous stage that does not understand the ACPI MAC mechanism then this can result in iPXE using a different MAC address than the previous stage, which is surprising to users. Attempt to minimise surprise by allowing the MAC address found in a cached DHCPACK packet to override a temporary MAC address, if the DHCPACK MAC address matches the network device's permanent MAC address. When a previous stage has chosen to use the network device's permanent MAC address (e.g. because it does not understand the ACPI MAC mechanism), this will cause iPXE to make the same choice. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ecm] Treat ACPI MAC address as being a non-permanent MAC addressMichael Brown2022-05-233-14/+18
| | | | | | | | | | | When applying an ACPI-provided system-specific MAC address, apply it to netdev->ll_addr rather than netdev->hw_addr. This allows iPXE scripts to access the permanent MAC address via the ${netX/hwaddr} setting (and thereby provides scripts with a mechanism to ascertain that the NIC is using a MAC address other than its own permanent hardware address). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cloud] Allow aws-import script to run on Python 3.6Michael Brown2022-04-061-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [acpi] Support the "_RTXMAC_" format for ACPI-based MAC addressesMichael Brown2022-03-252-28/+144
| | | | | | | | | | | | | Some newer HP products expose the host-based MAC (HBMAC) address using an ACPI method named "RTMA" returning a part-binary string of the form "_RTXMAC_#<mac>#", where "<mac>" comprises the raw MAC address bytes. Extend the existing support to handle this format alongside the older "_AUXMAC_" format (which uses a base16-encoded MAC address). Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [acpi] Add MAC address extraction self-testsMichael Brown2022-03-242-0/+239
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Add stub phys_to_user() implementationMichael Brown2022-03-241-1/+14
| | | | | | | | | For symmetry with the stub user_to_phys() implementation, provide phys_to_user() with the same underlying assumption that virtual addresses are physical (since there is no way to know the real physical address when running as a Linux userspace executable). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [acpi] Allow for the possibility of overriding ACPI tables at link timeMichael Brown2022-03-245-5/+26
| | | | | | | Allow for linked-in code to override the mechanism used to locate an ACPI table, thereby opening up the possibility of ACPI self-tests. Signed-off-by: Michael Brown <mcb30@ipxe.org>