summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* [build] Provide common ARRAY_SIZE() definitionMichael Brown2017-03-109-19/+9Star
| | | | | | | 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>
* [iscsi] Don't close when receiving NOP-InVishvananda Ishaya Abrams2017-03-091-9/+8Star
| | | | | | | | | | | Some iSCSI targets send NOP-In. Rather than closing the connection when we receive one, it is more user friendly to log a debug message and keep the connection open. Eventually, it would be nice if iPXE supported replying to NOP-Ins, but we might as well keep the connection open until the target disconnects us. Modified-by: Michael Brown <mcb30@ipxe.org> 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>
* [block] Use intfs_shutdown() when shutting down multiple interfacesMichael Brown2017-03-091-2/+1Star
| | | | 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>
* [iscsi] Use intfs_shutdown() when shutting down multiple interfacesMichael Brown2017-03-091-4/+2Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Retry any SAN device operationMichael Brown2017-03-072-43/+36Star
| | | | | | | | | | 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>
* [efi] Refactor to use centralised SAN device abstractionMichael Brown2017-03-071-650/+161Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Refactor to use centralised SAN device abstractionMichael Brown2017-03-071-685/+264Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Centralise "san-drive" settingMichael Brown2017-03-077-51/+40Star
| | | | | | | | | | | | The concept of the SAN drive number is meaningful only in a BIOS environment, where it represents the INT13 drive number (0x80 for the first hard disk). We retain this concept in a UEFI environment to allow for a simple way for iPXE commands to refer to SAN drives. Centralise the concept of the default drive number, since it is shared between all supported environments. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Centralise SAN device abstractionMichael Brown2017-03-073-1/+687
| | | | | | | Create a central SAN device abstraction to be shared between BIOS and UEFI. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Remove spurious commentsMichael Brown2017-03-071-7/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add missing SANBOOT_PROTO_HTTP to EFI default configurationMichael Brown2017-03-071-0/+1
| | | | 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>
* [http] Cleanly shut down potentially looped interfacesMichael Brown2017-02-021-15/+6Star
| | | | | | | | | | | | | Use intfs_shutdown() and intfs_restart() to cleanly shut down multiple interfaces that may loop back to the same object. This fixes a regression introduced by commit daa8ed9 ("[interface] Provide intf_reinit() to reinitialise nullified interfaces") which broke the use of HTTP Basic and Digest authentication. Reported-by: murmansk <murmansk@hotmail.com> Reported-by: Brett Waldo <brettwaldo@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [interface] Provide the ability to shut down multiple interfacesMichael Brown2017-02-022-0/+74
| | | | | | | | | | | | | | | Shutting down (and optionally restarting) multiple interfaces is fraught with problems if there are loops in the interface connectivity (e.g. the HTTP content-decoded and transfer-decoded interfaces, which will generally loop back to each other). Various workarounds currently exist across the codebase, generally involving preceding calls to intf_nullify() to avoid problems due to known loops. Provide intfs_shutdown() and intfs_restart() to allow all of an object's interfaces to be shut down (or restarted) in a single call, without having to worry about potential external loops. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Report attempts to use timers before initialisationMichael Brown2017-02-011-3/+25
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add "unixtime" builtin setting to expose the current timeMichael Brown2017-01-261-0/+33
| | | | | | | | | | | Expose the current wall-clock time (in seconds since the Epoch), since this is often useful in captured boot logs and can also be useful when checking unexpected X.509 certificate validation failures. Use a :uint32 setting to avoid Y2K38 rollover, thereby ensuring that this will eventually be somebody else's problem. 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>
* [int13] Test correct return status from INT 13 callsMichael Brown2017-01-261-5/+5
| | | | | | | | | | | | | INT 13 calls return a status value via %ah, with CF set if %ah is non-zero (indicating an error). Our wrappers zero the whole of %ax if CF is clear, to allow C code (which has no easy access to CF) to simply test for a non-zero status to detect an error. The current code assigns the returned status to a uint8_t, effectively testing %al rather than %ah. Fix by treating the returned status as a uint16_t instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Avoid potential division by zeroMichael Brown2017-01-261-3/+7
| | | | | | | | Avoid using a zero sector count to guess the disk geometry, since that would result in a division by zero when calculating the number of cylinders. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Provide timer based on the 10MHz time reference count MSRMichael Brown2017-01-262-11/+108
| | | | | | | | | | | | | When running on AMD platforms, the legacy hardware emulation is extremely unreliable. In particular, the IRQ0 timer interrupt is likely to simply stop working, resulting in a total failure of any code that relies on timers (such as DHCP retransmission attempts). Work around this by using the 10MHz time counter provided by Hyper-V via an MSR. (This timer can be tested in KVM via the command-line option "-cpu host,hv_time".) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [time] Allow timer to be selected at runtimeMichael Brown2017-01-2624-304/+355
| | | | | | | | | | | | | | | | | | | | | | 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>
* [cpuid] Provide cpuid_supported() to test for supported functionsMichael Brown2017-01-254-62/+72
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Limit MTU by hardware maximum frame lengthMichael Brown2017-01-255-10/+31
| | | | | | | | | | | | | | | | Separate out the concept of "hardware maximum supported frame length" and "configured link MTU", and limit the latter according to the former. In networks where the DHCP-supplied link MTU is inconsistent with the hardware or driver capabilities (e.g. a network using jumbo frames), this will result in iPXE advertising a TCP MSS consistent with a size that can actually be received. Note that the term "MTU" is typically used to refer to the maximum length excluding the link-layer headers; we adopt this usage. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [interface] Unplug interface before calling intf_close() in intf_shutdown()Michael Brown2017-01-251-4/+9
| | | | | | | | | | | | | | | | | | | The call to intf_close() may result in the original interface being reopened. For example: when reading the capacity of a 2TB+ disk via iSCSI, the SCSI layer will respond to the intf_close() from the READ CAPACITY (10) command by immediately issuing a READ CAPACITY (16) command. The iSCSI layer happens to reuse the same interface for the new command (since it allows only a single concurrent command). Currently, intf_shutdown() unplugs the interface after the call to intf_close() returns. In the above scenario, this results in unplugging the just-reopened interface. Fix by transferring the interface destination (and its reference) to a temporary interface, and so effectively performing the unplug before making the call to intf_close(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [interface] Remove misleading commentMichael Brown2017-01-251-3/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [interface] Avoid unnecessary reference counting in intf_unplug()Michael Brown2017-01-251-1/+4
| | | | | | | The null interface does not have a reference counter, so the call to intf_get() is always redundant. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Fix building elf2efi.c when -fpic is enabled by defaultMichael Brown2017-01-251-1/+1
| | | | | | | | | | | | | | | The x86_64 EDK2 headers include a #pragma to mark all subsequent symbol declarations and references as hidden if position-independent code is being generated. Since libgen.h is currently included only after the EDK2 headers, this results in __xpg_basename() being erroneously marked as having hidden visibility (if the compiler defaults to building position-independent code); this eventually results in a failure to link the elf2efi binary. Fix by including libgen.h prior to including the EDK2 headers. Originally-fixed-by: Doug Goldstein <cardoe@cardoe.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pic8259] Fix definitions for "read IRR" and "read ISR" commandsMichael Brown2017-01-251-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Ignore unsolicited VMBus messagesMichael Brown2017-01-241-39/+43
| | | | | | | | | | | In some high-end Azure instances (e.g. NC6) we may receive an unsolicited VMBUS_OFFER_CHANNEL message for a PCIe pass-through device some time after completing the bus enumeration. This currently causes apparently random failures due to unexpected VMBus message types. Fix by ignoring any unsolicited VMBus messages. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cloud] Show CPU vendor and model in example cloud boot scriptsMichael Brown2017-01-243-0/+6
| | | | | | | | | Some problems arise only when running on a specific CPU type (e.g. non-functional timer interrupts as observed in Azure AMD instances). Include the CPU vendor and model within the sample cloud boot scripts, to assist in debugging such problems. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Allow MTU to be changed at runtimeMichael Brown2017-01-233-3/+67
| | | | | | | | | | | | Provide a settings applicator to modify netdev->max_pkt_len in response to changes to the "mtu" setting (DHCP option 26). Note that as with MAC address changes, drivers are permitted to completely ignore any changes in the MTU value. The net result will be that iPXE effectively uses the smaller of either the hardware default MTU or the software configured MTU. 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>
* [cloud] Add ability to retrieve Google Compute Engine metadataMichael Brown2017-01-235-0/+87
| | | | | | | | | | | | | | | | | | | | | | | For some unspecified "security" reason, the Google Compute Engine metadata server will refuse any requests that do not include the non-standard HTTP header "Metadata-Flavor: Google". Attempt to autodetect such requests (by comparing the hostname against "metadata.google.internal"), and add the "Metadata-Flavor: Google" header if applicable. Enable this feature in the CONFIG=cloud build, and include a sample embedded script allowing iPXE to boot from a script configured as metadata via e.g. # Create shared boot image make bin/ipxe.usb CONFIG=cloud EMBED=config/cloud/gce.ipxe # Configure per-instance boot script gcloud compute instances add-metadata <instance> \ --metadata-from-file ipxeboot=boot.ipxe 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-224-0/+372
| | | | | | | | | | | | 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>
* [build] Return const char * from uuid_ntoa()David Decotigny2017-01-223-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [virtio] Remove queue size limit in legacy virtioLadi Prosek2017-01-224-13/+44
| | | | | | | | | | | | | | | | 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-222-4/+10
| | | | | | | | | | | | | | | 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>
* [build] Add %.vhd target for building VM bootable disk imagesMichael Brown2017-01-222-0/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv4] Accept unicast packets for the local network broadcast addressMichael Brown2017-01-221-0/+1
| | | | | | | | | | | | | The ISC Kea DHCP server transmits its DHCPOFFER as a unicast packet with a broadcast IPv4 destination address (255.255.255.255). This combination is currently rejected by iPXE. Fix by explicitly accepting the local network broadcast address (255.255.255.255) as a valid unicast destination address. Reported-by: Roy Ledochowski <roy.ledochowski@hpe.com> Tested-by: Roy Ledochowski <roy.ledochowski@hpe.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>
* [efi] Work around temporal anomaly encountered during ExitBootServices()Michael Brown2016-12-073-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | EFI provides no clean way for device drivers to shut down in preparation for handover to a booted operating system. The platform firmware simply doesn't bother to call the drivers' Stop() methods. Instead, drivers must register an EVT_SIGNAL_EXIT_BOOT_SERVICES event to be signalled when ExitBootServices() is called, and clean up without any reference to the EFI driver model. Unfortunately, all timers silently stop working when ExitBootServices() is called. Even more unfortunately, and for no discernible reason, this happens before any EVT_SIGNAL_EXIT_BOOT_SERVICES events are signalled. The net effect of this entertaining design choice is that any timeout loops on the shutdown path (e.g. for gracefully closing outstanding TCP connections) may wait indefinitely. There is no way to report failure from currticks(), since the API lazily assumes that the host system continues to travel through time in the usual direction. Work around EFI's violation of this assumption by falling back to a simple free-running monotonic counter. Debugged-by: Maor Dickman <maord@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [undi] Try matching UNDI ROMs in BIOS enumeration orderMichael Brown2016-12-071-1/+1
| | | | | | | | | | | | | | | When searching for an UNDI ROM to match against a PCI device, search in order of increasing ROM address (within the 128kB BIOS option ROM area). This is likely (though not guaranteed) to match the order of the original enumeration performed by the BIOS, which is in turn likely to match the order of enumeration on the PCI bus. Since we load at most one UNDI ROM, the net result is that we increase our chances of loading the ROM corresponding to the selected PCI device (rather than loading a ROM corresponding to a higher-numbered PCI device with the same vendor and device IDs.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Include diagnostic information within progress messagesMichael Brown2016-12-061-14/+38
| | | | | | | Include some relevant diagnostic infomation within the progress messages generated via DEBUG=libprefix. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prefix] Remove impossible progress messageMichael Brown2016-12-061-1/+0Star
| | | | | | | | | | | | | | | | | | | | The "progress" macro can be used only from within the .prefix section. At the point of calling relocate(), we are running in .text16 and so the near call to print_message() will end up calling a random function somewhere in .text16. Interestingly, this problem has remained unnoticed for some time. It is rare to build with DEBUG=libprefix. In the few cases that it has been used during development, the randomly selected function in .text16 seems to have been a harmless no-op with no visible side-effects (beyond the unnoticed failure to print the "relocate" progress message). Fix by removing the futile attempt to print a progress message before calling relocate(). Reported-by: Raed Salem <raeds@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>