summaryrefslogtreecommitdiffstats
path: root/src/include
Commit message (Collapse)AuthorAgeFilesLines
* [usb] Add generic USB network device frameworkMichael Brown2015-02-172-0/+63
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite string functionsMichael Brown2015-02-172-42/+97
| | | | | | | | | | | | Some of the C library string functions have an unknown provenance. Reimplement all such functions to avoid potential licensing uncertainty. Remove the inline-assembler versions of strlen(), memswap(), and strncmp(); these save a minimal amount of space (around 40 bytes in total) and are not performance-critical. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Remove unused string functionsMichael Brown2015-02-161-6/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Provide generic framework for refilling receive endpointsMichael Brown2015-02-131-0/+40
| | | | | | | 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>
* [usb] Handle port status changes received after failing to find a driverMichael Brown2015-02-121-1/+7
| | | | | | | | | | | | | | | | | | | | | 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>
* [rndis] Add rndis_rx_err()Michael Brown2015-02-111-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Allow usb_stream() to enforce a terminating short packetMichael Brown2015-02-101-3/+5
| | | | | | | | | | 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>
* [usb] Parse endpoint descriptor bInterval fieldMichael Brown2015-02-101-1/+8
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Handle CDC union functional descriptorsMichael Brown2015-02-091-0/+17
| | | | | | | 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>
* [usb] Try multiple USB device configurationsMichael Brown2015-02-091-3/+3
| | | | | | | 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>
* [uri] Allow tftp_uri() to construct a URI with a custom portMichael Brown2015-02-061-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ncm] Add support for CDC-NCM USB Ethernet devicesMichael Brown2015-02-032-0/+40
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add support for xHCI host controllersMichael Brown2015-02-031-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add basic support for USB hubsMichael Brown2015-02-031-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add basic support for USB devicesMichael Brown2015-02-033-1/+1154
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Allow drivers to specify a PCI classMichael Brown2015-02-022-93/+55Star
| | | | | | | | 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>
* [hyperv] Require support for VMBus version 3.0 or newerMichael Brown2014-12-211-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | We require the ability to disconnect from and reconnect to VMBus; if we don't have this then there is no (viable) way for a loaded operating system to continue to use any VMBus devices. (There is also a small but non-zero risk that the host will continue to write to our interrupt and monitor pages, since the VMBUS_UNLOAD message in earlier versions is essentially a no-op.) This requires us to ensure that the host supports protocol version 3.0 (VMBUS_VERSION_WIN8_1). However, we can't actually _use_ protocol version 3.0, since doing so causes an iSCSI-booted Windows Server 2012 R2 VM to crash due to a NULL pointer dereference in vmbus.sys. To work around this problem, we first ensure that we can connect using protocol v3.0, then disconnect and reconnect using the oldest known protocol. This deliberately prevents the use of the iPXE native Hyper-V drivers on older versions of Hyper-V, where we could use our drivers but in so doing would break the loaded operating system. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Ignore start-of-day RNDIS_INDICATE_STATUS_MSG with status 0x40020006Michael Brown2014-12-201-0/+2
| | | | | | | | | | | Windows Server 2012 R2 generates an RNDIS_INDICATE_STATUS_MSG with a status code of 0x4002006. This status code does not appear to be documented anywhere within the sphere of human knowledge. Explicitly ignore this status code in order to avoid unnecessarily cluttering the display when RNDIS debugging is enabled. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Assume that VMBus xfer page ranges correspond to RNDIS messagesMichael Brown2014-12-201-7/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [rndis] Send RNDIS_HALT_MSGMichael Brown2014-12-191-1/+1
| | | | | | The RNDIS specification requires that we send RNDIS_HALT_MSG. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Send RNDIS_INITIALISE_MSGMichael Brown2014-12-191-2/+20
| | | | | | | | The Hyper-V RNDIS implementation on Windows Server 2012 R2 requires that we send an explicit RNDIS initialisation message in order to get a working RX datapath. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Add support for NetVSC paravirtual network devicesMichael Brown2014-12-181-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Add support for VMBus devicesMichael Brown2014-12-184-0/+635
| | | | | | Add support for an abstraction of a VMBus device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Add support for Hyper-V hypervisorMichael Brown2014-12-181-0/+230
| | | | | | | Add support for detecting and communicating with the Hyper-V hypervisor. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Add generic RNDIS device abstractionMichael Brown2014-12-183-6/+354
| | | | | | | RNDIS provides an abstraction of a network device on top of a generic packet transmission mechanism. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iobuf] Add iob_split() to split an I/O buffer into portionsMichael Brown2014-12-181-0/+1
| | | | | | | | | | | RNDIS devices may provide multiple packets encapsulated into a single message. Provide an API to allow the RNDIS driver to split an I/O buffer into smaller portions. The current implementation will always copy the underlying data, rather than splitting the buffer in situ. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [device] Provide a driver-private data field for root devicesMichael Brown2014-12-181-0/+23
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [list] Add sanity checks after list-adding functionsMichael Brown2014-12-121-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add ASSERTED macro to test if any assertion has triggeredMichael Brown2014-12-121-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ping] Allow "ping" command output to be inhibitedMichael Brown2014-10-231-1/+1
| | | | | Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ping] Allow termination after a specified number of packetsMichael Brown2014-10-232-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Add the "-c <count>" option to the "ping" command, allowing for automatic termination after a specified number of packets. When a number of packets is specified: - if a serious error (i.e. length mismatch or content mismatch) occurs, then the ping will be immediately terminated with the relevant status code; - if at least one response is received successfully, and all errors are non-serious (i.e. timeouts or out-of-sequence responses), then the ping will be terminated after the final response (or timeout) with a success status; - if no responses are received successfully, then the ping will be terminated after the final timeout with ETIMEDOUT. If no number of packets is specified, then the ping will continue until manually interrupted. Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add NII / UNDI driverMichael Brown2014-10-164-0/+843
| | | | | | | | | | | | | | | | | | | | | | | 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>
* [efi] Update to current EDK2 headersMichael Brown2014-10-165-15/+60
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Generalise snpnet_dev_info() to efi_device_info()Michael Brown2014-10-161-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add definitions of GUIDs observed when chainloading from Intel driverMichael Brown2014-09-2510-0/+4123
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Centralise definitions of more protocol GUIDsMichael Brown2014-09-251-0/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Avoid returning uninitialised data from PCI configuration space readsMichael Brown2014-09-041-0/+3
| | | | | | | | Under UEFI, reads from PCI configuration space may fail. If this happens, we should return all-ones (which will mimic the behaviour of an absent PCI device). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Wrap any images loaded by our wrapped imageMichael Brown2014-08-292-2/+2
| | | | | | | | | | | | Propagate our modified EFI system table to any images loaded by the image that we wrap, thereby allowing us to observe boot services calls made by all subsequent EFI images. Also show details of intercepted ExitBootServices() calls. When wrapping is used, exiting boot services will almost certainly fail, but this at least allows us to see when it happens. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add definitions of GUIDs observed during Windows bootMichael Brown2014-08-216-0/+3773
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Cope with unexpected initial backend statesMichael Brown2014-08-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [xen] Use version 1 grant tables by defaultMichael Brown2014-08-132-12/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [efi] Generalise snpnet_pci_info() to efi_locate_device()Michael Brown2014-08-061-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Move abstract device path and handle functions to efi_utils.cMichael Brown2014-08-063-4/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Open device path protocol only at point of useMichael Brown2014-08-062-8/+2Star
| | | | | | | | | | | | 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>
* [efi] Provide centralised definitions of commonly-used GUIDsMichael Brown2014-08-061-0/+16
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Avoid unnecessarily passing pointers to EFI_HANDLEsMichael Brown2014-07-312-3/+3
| | | | | | | | | | | | efi_file_install() and efi_download_install() are both used to install onto existing handles. There is therefore no need to allow for each of their calls to InstallMultipleProtocolInterfaces() to create a new handle. By passing the handle directly (rather than a pointer to the handle), we avoid potential confusion (and erroneous debug message colours). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow compiler to perform type checks on EFI_HANDLEMichael Brown2014-07-311-0/+10
| | | | | | | | | The EFI headers define EFI_HANDLE as a void pointer, which renders type checking on anything dealing with EFI handles somewhat useless. Work around this bizarre sabotage attempt by redefining EFI_HANDLE as a pointer to an anonymous structure. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Use efi_handle_name() instead of efi_handle_devpath_text()Michael Brown2014-07-311-1/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add ability to dump all openers of a given protocol on a handleMichael Brown2014-07-311-1/+26
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Provide efi_handle_name() for debuggingMichael Brown2014-07-311-0/+1
| | | | | | | | Provide a function efi_handle_name() (as a generalisation of efi_handle_devpath_text()) which tries various methods to produce a human-readable name for an EFI handle. Signed-off-by: Michael Brown <mcb30@ipxe.org>