david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

4982 Commits

Author SHA1 Message Date
Michael Brown 89c8c7d4eb [efi] Improve debugging of the debugging facilities
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31 23:44:43 +01:00
Michael Brown 7023923db2 [efi] Dump handle information around connect/disconnect attempts
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31 12:50:14 +01:00
Michael Brown 16d99cc8ef [efi] Dump existing openers when we are unable to open a protocol
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>
2014-07-31 12:50:14 +01:00
Michael Brown 4a480f1d15 [efi] Avoid unnecessarily passing pointers to EFI_HANDLEs
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>
2014-07-31 12:50:09 +01:00
Michael Brown 88bd71a27a [efi] Allow compiler to perform type checks on EFI_HANDLE
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>
2014-07-31 12:17:59 +01:00
Michael Brown 60891f699a [efi] Use efi_handle_name() instead of efi_devpath_text() where applicable
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>
2014-07-31 11:57:31 +01:00
Michael Brown 2e0821b9ed [efi] Use efi_handle_name() instead of efi_handle_devpath_text()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31 11:56:44 +01:00
Michael Brown 736fcf60d1 [efi] Add ability to dump all openers of a given protocol on a handle
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31 01:50:05 +01:00
Michael Brown 550f212d15 [efi] Provide efi_handle_name() for debugging
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>
2014-07-31 01:49:58 +01:00
Michael Brown 0b40e76d95 [efi] Expand the range of well-known EFI GUIDs in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31 01:49:50 +01:00
Michael Brown 7cfb502fff [efi] Ignore failures when attempting to install SNP HII protocol
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>
2014-07-30 18:44:09 +01:00
Michael Brown 98d09a1e03 [netdevice] Avoid registering duplicate network devices
Reject network devices which appear to be duplicates of those already
available via a different underlying hardware device.  On a Xen PV-HVM
system, this allows us to filter out the emulated PCI NICs (which
would otherwise appear alongside the netfront NICs).

Note that we cannot use the Xen facility to "unplug" the emulated PCI
NICs, since there is no guarantee that the OS we subsequently load
will have a native netfront driver.

We permit devices with the same MAC address if they are attached to
the same underlying hardware device (e.g. VLAN devices).

Inspired-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-30 18:22:09 +01:00
Michael Brown 057eb9e496 [efi] Report exact failure when unable to open the device path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-30 17:53:51 +01:00
Michael Brown 608fb792eb [efi] Fix incorrect debug message level when device has no device path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-30 17:15:39 +01:00
Michael Brown 79419a1c69 [efi] Fill in loaded image's DeviceHandle if firmware fails to do so
Some EFI 1.10 implementations (observed with a mid-2011 iMac) seem to
fail to fill in the DeviceHandle for our loaded images.  It is
plausible that these implementations fill in the DeviceHandle only if
loading the image from a device path (rather than directly from a
memory buffer).

Work around this problem by filling in DeviceHandle if the firmware
leaves it empty.

We cannot sensibly fill in FilePath, because we have no way of knowing
whether or not the firmware will treat this as a pointer to be freed
when the image returns.

Reported-by: Curtis Larsen <larsen@dixie.edu>
Tested-by: Curtis Larsen <larsen@dixie.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-30 16:16:10 +01:00
Michael Brown b53d4ae398 [efi] Unload started images only on failure
If the StartImage() call returns with no error, then the image must
have been started and returned successfully.  It either unloaded
itself, or it intended to remain loaded (e.g. it was a driver).  We
therefore do not unload successful images.

If there was an error, we attempt to unload the image.  This may not
work.  In particular, there is no way to tell whether an error
returned from StartImage() was due to being unable to start the image
(in which case we probably should call UnloadImage()), or due to the
image itself returning an error (in which case we probably should not
call UnloadImage()).  We therefore ignore any failures from the
UnloadImage() call itself.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-30 16:07:25 +01:00
Michael Brown dc18fd7648 [efi] Default to releasing network devices for use via SNP
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>
2014-07-30 14:27:07 +01:00
Michael Brown 793a806611 [xen] Add support for Xen netfront virtual NICs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-29 15:57:56 +01:00
Michael Brown 036af27a45 [xen] Add basic support for PV-HVM domains
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>
2014-07-29 15:57:44 +01:00
Michael Brown ec94a8798f [xen] Import selected public headers
Import selected headers from the xen/include/public directory of the
Xen repository at git://xenbits.xen.org/xen.git

The script ./include/xen/import.pl can be used to automatically import
any required headers and their dependencies (in a similar fashion to
./include/ipxe/efi/import.pl).  Trailing whitespace is stripped and an
appropriate FILE_LICENCE declaration is added to each header file.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-29 15:20:49 +01:00
Michael Brown 721a492020 [lotest] Discard packets arriving on the incorrect network device
Commit 24bbaf6 ("[lotest] Allow loopback testing on shared networks")
introduced a regression in which loopback testing packets would be
accepted from any network device.  This produces unexpected results,
such as VLAN loopback testing succeeding even when incorrectly using
the underlying trunk device as either transmitter or receiver.

Fix by discarding any loopback testing packets which arrive on a
network device other than the current loopback testing receiver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-29 15:20:49 +01:00
Michael Brown ec30c856a8 [ioapi] Centralise notion of PAGE_SIZE
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-28 16:58:35 +01:00
Florian Schmaus 6153c09c41 [build] Set GITVERSION only if there is a git repository
The $(BIN)/version.%.o target will fail if iPXE is built within a
non-git repository, e.g. when the user downloaded and extracted an
archive containing iPXE sources, *and* if any parent directory of the
iPXE sources is a git repository (or even contains a directory named
".git").  This is because git will by default ascend the directory
tree and look for ".git".

The problem typically manifests on source based distributions, see for
example https://bugs.gentoo.org/show_bug.cgi?id=482804

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-28 16:57:39 +01:00
Michael Brown 410f50c2ee [efi] Show more diagnostic information when building with DEBUG=efi_wrap
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-26 11:24:24 +01:00
Sven Ulland de65a240b9 [lacp] Set "aggregatable" flag in response LACPDU
Some switches do not allow an individual link (as defined in IEEE Std
802.3ad-2000 section 43.3.5) to work alone in a link aggregation group
as described in section 43.3.6.  This is verified on Dell's
PowerConnect M6220, based on the Broadcom Strata XGS-IV chipset.

Set the LACP_STATE_AGGREGATABLE flag in the actor.state field to
announce link aggregation in the response LACPDU, which will have the
switch enable the link aggregation group and allow frames to pass.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-23 11:56:04 +01:00
Michael Brown 5888c887a4 [x86_64] Add functions to read and write model-specific registers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-23 10:20:15 +01:00
Michael Brown 945b8de1fd [i386] Add functions to read and write model-specific registers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-23 10:20:15 +01:00
Michael Brown 3a02409fc8 [natsemi] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:54:49 +01:00
Michael Brown 720ae17aa4 [myson] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:53:43 +01:00
Michael Brown 022ef91984 [skel] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:52:48 +01:00
Michael Brown 7ab3035749 [vmxnet3] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:51:38 +01:00
Michael Brown 857e4f56a7 [realtek] Check for ioremap() failures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:50:18 +01:00
Michael Brown 9ce2b56af6 [intel] Check for ioremap() failures
Debugged-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:49:08 +01:00
Michael Brown ae778091ca [ioapi] Fail ioremap() when attempting to map a zero bus address
When a 32-bit iPXE binary is running on a system which allocates PCI
memory BARs above 4GB, our PCI subsystem will return the base address
for any such BARs as zero (with a warning message if DEBUG=pci is
enabled).  Currently, ioremap() will happily map an address pointing
to the start of physical memory, providing no sensible indication of
failure.

Fix by always returning NULL if we are asked to ioremap() a zero bus
address.

With a totally flat memory model (e.g. under EFI), this provides an
accurate failure indication since no PCI peripheral will be mapped to
the zero bus address.

With the librm memory model, there is the possibility of a spurious
NULL return from ioremap() if the bus address happens to be equal to
virt_offset.  Under the current virtual memory map, the NULL virtual
address will always be the start of .textdata, and so this problem
cannot occur; a NULL return from ioremap() will always be an accurate
failure indication.

Debugged-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 15:39:59 +01:00
Curtis Larsen 8a42a36942 [efi] Use EFI_CONSOLE_CONTROL_PROTOCOL to set text mode if available
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>
2014-07-16 15:10:07 +01:00
Michael Brown eb55c6871a [efi] Include EFI_CONSOLE_CONTROL_PROTOCOL header
The EFI_CONSOLE_CONTROL_PROTOCOL does not exist in the current UEFI
specification, but is required to enable text output on some older EFI
1.10 implementations (observed on an old iMac).

The header is not present in any of the standard include directories,
but can still be found in the EDK2 codebase as part of
EdkCompatibilityPkg.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 14:53:03 +01:00
Michael Brown d4a7cbfb64 [efi] Print well-known GUIDs by name in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16 02:29:40 +01:00
Michael Brown c3b6ccf65b [efi] Allow for interception of boot services calls by loaded image
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>
2014-07-16 01:58:19 +01:00
Michael Brown 8a380987c1 [efi] Install our own disk I/O protocol and claim exclusive use of it
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>
2014-07-14 16:30:19 +01:00
Michael Brown cff0103bd2 [efi] Update EDK2 headers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-14 16:13:55 +01:00
Michael Brown c4af977271 [netdevice] Reset network device index when last device is unregistered
When functioning as an EFI driver, drivers can be disconnected and
reconnected multiple times (e.g. via the EFI shell "connect" command,
or by running an executable such as ipxe.efi which will temporarily
disconnect existing drivers).

Minimise surprise by resetting the network device index to zero
whenever the last device is unregistered.  This is not foolproof, but
it does handle the common case of having all devices unregistered and
then reregistered in the original order.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-14 12:17:19 +01:00
Michael Brown 50e48d5b19 [crypto] Fix debug message
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-12 14:24:40 +01:00
Michael Brown 8484e97f7c [crypto] Add support for iPAddress subject alternative names
Originally-implemented-by: Jarrod Johnson <jarrod.b.johnson@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-11 16:55:14 +01:00
Michael Brown 5365340e77 [efi] Include SNP NIC driver within the all-drivers target
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-08 16:28:22 +01:00
Michael Brown d0cfbd01f5 [efi] Rewrite SNP NIC driver
Rewrite the SNP NIC driver to use non-blocking and deferrable
transmissions, to provide link status detection, to provide
information about the underlying (PCI) hardware device, and to avoid
unnecessary I/O buffer allocations during receive polling.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-08 14:01:55 +01:00
Michael Brown 56b2f66dd2 [efi] Attempt to start only drivers claiming support for a device
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-08 14:01:50 +01:00
Michael Brown bcfd3dea1d [efi] Identify autoboot device by MAC address when chainloading
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-08 00:37:31 +01:00
Michael Brown 00c745e5ff [autoboot] Allow autoboot device to be identified by link-layer address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-08 00:37:31 +01:00
Michael Brown c7051d826b [efi] Allow network devices to be created on top of arbitrary SNP devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-03 15:28:17 +01:00
Michael Brown cb2f6ca46f [build] Add yet another potential location for isolinux.bin
Reported-by: Martin Sofaru <ipxe@fhloston.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-06-26 17:05:36 +01:00