summaryrefslogtreecommitdiffstats
path: root/src/interface
Commit message (Collapse)AuthorAgeFilesLines
* [hyperv] Require support for VMBus version 3.0 or newerMichael Brown2014-12-211-15/+71
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* [hyperv] Tidy up debug outputMichael Brown2014-12-201-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Assume that VMBus xfer page ranges correspond to RNDIS messagesMichael Brown2014-12-201-31/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [hyperv] Add support for VMBus devicesMichael Brown2014-12-181-0/+1261
| | | | | | Add support for an abstraction of a VMBus device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Generalise snpnet_dev_info() to efi_device_info()Michael Brown2014-10-161-0/+64
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add definitions of GUIDs observed when chainloading from Intel driverMichael Brown2014-09-252-2/+123
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Centralise definitions of more protocol GUIDsMichael Brown2014-09-254-18/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Make EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL optionalMichael Brown2014-09-041-1/+7
| | | | | | | | | | Some UEFI systems (observed with a Hyper-V virtual machine) do not provide EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. Make this an optional protocol (and fail any attempts to access PCI configuration space via the root bridge if the protocol is missing). Reported-by: Colin Blacker <Colin.Blacker@computerplanet.co.uk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Wrap any images loaded by our wrapped imageMichael Brown2014-08-291-21/+67
| | | | | | | | | | | | 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] Make our virtual file system case insensitiveMichael Brown2014-08-271-4/+24
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Show details of intercepted LoadImage() callsMichael Brown2014-08-271-0/+30
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Dump details of any calls to our dummy block and disk I/O protocolsMichael Brown2014-08-221-15/+33
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add definitions of GUIDs observed during Windows bootMichael Brown2014-08-212-1/+22
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Cope with unexpected initial backend statesMichael Brown2014-08-141-1/+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-131-17/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Support displaying and hiding cursorMichael Brown2014-08-061-0/+32
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Generalise snpnet_pci_info() to efi_locate_device()Michael Brown2014-08-061-0/+52
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Move abstract device path and handle functions to efi_utils.cMichael Brown2014-08-064-80/+110
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Open device path protocol only at point of useMichael Brown2014-08-062-39/+43
| | | | | | | | | | | | 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-068-124/+103Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Report errors from attempting to disconnect existing driversCurtis Larsen2014-08-051-1/+8
| | | | | Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Print raw device path when we have no DevicePathToTextProtocolMichael Brown2014-08-011-4/+18
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Also try original ComponentName protocol for retrieving driver namesMichael Brown2014-08-011-1/+34
| | | | | | | The ComponentName and ComponentName2 protocols differ only in the standard which is used for language name codes. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add excessive sanity checks into efi_debug functionsMichael Brown2014-08-011-3/+53
| | | | | | | | Try very hard to avoid ever doing something invalid while attempting to generate a debug message. Debugged-by: Curtis Larsen <larsen@dixie.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Improve debugging of the debugging facilitiesMichael Brown2014-08-011-17/+41
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Dump handle information around connect/disconnect attemptsMichael Brown2014-07-311-0/+9
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Dump existing openers when we are unable to open a protocolMichael Brown2014-07-313-0/+6
| | | | | | | | Dump the existing openers of a protocol whenever we are unable to open a protocol using attributes of BY_DEVICE, EXCLUSIVE, or BY_CHILD_CONTROLLER. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Avoid unnecessarily passing pointers to EFI_HANDLEsMichael Brown2014-07-312-9/+9
| | | | | | | | | | | | 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] Use efi_handle_name() instead of efi_devpath_text() where applicableMichael Brown2014-07-313-23/+20Star
| | | | | | | | | | Using efi_devpath_text() is marginally more efficient if we already have the device path protocol available, but the mild increase in efficiency is not worth compromising the clarity of the pattern: DBGC ( device, "THING %p %s ...", device, efi_handle_name ( device ) ); Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Use efi_handle_name() instead of efi_handle_devpath_text()Michael Brown2014-07-315-83/+45Star
| | | | 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-3/+80
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Provide efi_handle_name() for debuggingMichael Brown2014-07-311-0/+235
| | | | | | | | 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>
* [efi] Expand the range of well-known EFI GUIDs in debug messagesMichael Brown2014-07-311-10/+98
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Ignore failures when attempting to install SNP HII protocolMichael Brown2014-07-302-6/+13
| | | | | | | | HII seems to fail on several systems. Since it is non-essential, treat HII problems as non-fatal. Debugged-by: Curtis Larsen <larsen@dixie.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Report exact failure when unable to open the device pathMichael Brown2014-07-301-2/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Fix incorrect debug message level when device has no device pathMichael Brown2014-07-301-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Default to releasing network devices for use via SNPMichael Brown2014-07-302-30/+31
| | | | | | | | | | | | | | | | | | | | | | | | We currently treat network devices as available for use via the SNP API only if RX queue processing has been frozen. (This is similar in spirit to the way that RX queue processing is frozen for the network device currently exposed via the PXE API.) The default state of a freshly created network device is for the RX queue to not be frozen, and thus to be unavailable for use via SNP. This causes problems when devices are added through code paths other than _efidrv_start() (which explicitly releases devices for use via SNP). We don't actually need to freeze RX queue processing, since calls via the SNP API will always use netdev_poll() rather than net_poll(), and so will never trigger the RX queue processing code path anyway. We can therefore simplify the code to use a single global flag to indicate whether network devices are claimed for use by iPXE or available for use via SNP. Using a global flag allows the default state for dynamically created network devices to behave sensibly. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Add basic support for PV-HVM domainsMichael Brown2014-07-293-0/+1065
| | | | | | | | | Add basic support for Xen PV-HVM domains (detected via the Xen platform PCI device with IDs 5853:0001), including support for accessing configuration via XenStore and enumerating devices via XenBus. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Show more diagnostic information when building with DEBUG=efi_wrapMichael Brown2014-07-262-3/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Use EFI_CONSOLE_CONTROL_PROTOCOL to set text mode if availableCurtis Larsen2014-07-161-0/+34
| | | | | | | | | On some older EFI 1.10 implementations (observed with an old iMac), we must use the (now obsolete) EFI_CONSOLE_CONTROL_PROTOCOL to switch the console into text mode. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Print well-known GUIDs by name in debug messagesMichael Brown2014-07-161-0/+32
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow for interception of boot services calls by loaded imageMichael Brown2014-07-161-0/+237
| | | | | | | When building with DEBUG=efi_wrap, print details of calls made by the loaded image to selected boot services functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Install our own disk I/O protocol and claim exclusive use of itMichael Brown2014-07-141-13/+104
| | | | | | | | | | | | | | | | | | | The EFI FAT filesystem driver has a bug: if a block device contains no FAT filesystem but does have an EFI_SIMPLE_FILE_SYSTEM_PROTOCOL instance, the FAT driver will assume that it must have previously installed the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. This causes the FAT driver to claim control of our device, and to refuse to stop driving it, which prevents us from later uninstalling correctly. Work around this bug by opening the disk I/O protocol ourselves, thereby preventing the FAT driver from opening it. Note that the alternative approach of opening the block I/O protocol (and thereby in theory preventing DiskIo from attaching to the block I/O protocol) causes an endless loop of calls to our DRIVER_STOP method when starting the EFI shell. I have no idea why this is. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Attempt to start only drivers claiming support for a deviceMichael Brown2014-07-081-0/+7
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Identify autoboot device by MAC address when chainloadingMichael Brown2014-07-081-0/+71
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow network devices to be created on top of arbitrary SNP devicesMichael Brown2014-07-034-355/+361
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Restructure EFI driver modelMichael Brown2014-06-254-453/+509
| | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a single instance of EFI_DRIVER_BINDING_PROTOCOL (attached to our image handle); this matches the expectations scattered throughout the EFI specification. Open the underlying hardware device using EFI_OPEN_PROTOCOL_BY_DRIVER and EFI_OPEN_PROTOCOL_EXCLUSIVE, to prevent other drivers from attaching to the same device. Do not automatically connect to devices when being loaded as a driver; leave this task to the platform firmware (or to the user, if loading directly from the EFI shell). When running as an application, forcibly disconnect any existing drivers from devices that we want to control, and reconnect them on exit. Provide a meaningful driver version number (based on the build timestamp), to allow platform firmware to automatically load newer versions of iPXE drivers if multiple drivers are present. Include device paths within debug messages where possible, to aid in debugging. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Provide a meaningful EFI SNP device nameMichael Brown2014-06-251-1/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow device paths to be easily included in debug messagesMichael Brown2014-06-251-20/+50
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Expose build timestamp, build name, and product namesMichael Brown2014-06-243-13/+12Star
| | | | | | | | Expose the build timestamp (measured in seconds since the Epoch) and the build name (e.g. "rtl8139.rom" or "ipxe.efi"), and provide the product name and product short name in a single centralised location. Signed-off-by: Michael Brown <mcb30@ipxe.org>