Commit Graph

5912 Commits (c742c576d0d0fc7f7d49825f5d3c53fd7b597327)
 

Author SHA1 Message Date
Michael Brown c742c576d0 [build] Move predefined all-drivers build shortcut to Makefile
The (very approximate) split between Makefile.housekeeping and
Makefile is that the former provides mechanism and the latter provides
policy.

Provide a section within Makefile as a home for predefined build
shortcuts such as the existing all-drivers build.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-08-02 11:00:43 +01:00
Michael Brown a4f8c6e31f [build] Do not apply WORKAROUND_CFLAGS for host compiler
The WORKAROUND_CFLAGS list is constructed based on running tests on
the target compiler, and the results may not be valid for the host
compiler.

The only relevant workaround required for the host compiler is
-Wno-stringop-truncation, which is needed to avoid a spurious compiler
warning for a totally correct usage of strncpy() in util/elf2efi.c.

Duplicating the workaround tests for the host compiler is messy, as is
conditionally applying __attribute__((nonstring)).  Fix instead by
disapplying WORKAROUND_CFLAGS for the host compiler, and using
memcpy() with an explicitly calculated length instead of strncpy() in
util/elf2efi.c.

Reported-by: Ignat Korchagin <ignat@cloudflare.com>
Reported-by: Christopher Clark <christopher.w.clark@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-22 14:51:28 +01:00
Valentine Barshak 1dd56dbd11 [build] Workaround compilation error with gcc 9.1
Compiling with gcc 9.1 generates lots of "taking address of packed
member of ... may result in an unaligned pointer value" warnings.

Some of these warnings are genuine, and indicate correctly that parts
of iPXE currently require the CPU (or runtime environment) to support
unaligned accesses.  For example: the TCP/IP receive data path will
attempt to access 32-bit fields that may not be aligned to a 32-bit
boundary.

Other warnings are either spurious (such as when the pointer is to a
variable-length byte array, which can have no alignment requirement
anyway) or unhelpful (such as when the pointer is used solely to
provide a debug colour value for the DBGC() macro).

There appears to be no easy way to silence the spurious warnings.
Since the ability to perform unaligned accesses is already a
requirement for iPXE, work around the problem by silencing this class
of warnings.

Signed-off-by: Valentine Barshak <gvaxon@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-22 11:07:13 +01:00
Valentine Barshak 412acd7854 [build] Fix "'%s' directive argument is null" error
Use '%p' directive, and print handle's address if the address is null
and the handle doesn't have a name.  This fixes the following
compilation error:

  interface/efi/efi_debug.c:334:3: error: '%s' directive
  argument is null [-Werror=format-overflow=]

Signed-off-by: Valentine Barshak <gvaxon@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-22 11:07:13 +01:00
Michael Brown f4cc5834ef [smscusb] Fetch MAC from device tree for Raspberry Pi Model B+
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-19 19:15:33 +01:00
Michael Brown a046329012 [build] Add named configuration for Raspberry Pi
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-19 17:45:22 +01:00
Michael Brown 83e0f9f377 [smsc95xx] Fetch MAC from device tree for Raspberry Pi
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-19 17:44:27 +01:00
Michael Brown 6dde0f60bf [efi] Register a device tree if provided by the platform firmware
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-19 17:43:02 +01:00
Michael Brown e520a51df1 [fdt] Add ability to parse a MAC address from a flattened device tree
The Raspberry Pi NIC has no EEPROM to hold the MAC address.  The
platform firmware (e.g. UEFI or U-Boot) will typically obtain the MAC
address from the VideoCore firmware and add it to the device tree,
which is then made available to subsequent programs such as iPXE or
the Linux kernel.

Add the ability to parse a flattened device tree and to extract the
MAC address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-19 17:35:39 +01:00
Michael Brown a385e23768 [efi] Return only registered EFI devices from efidev_parent()
efidev_parent() currently assumes that any device with BUS_TYPE_EFI is
part of a struct efi_device.  This assumption is not valid, since the
code in efi_device_info() may also create a device with BUS_TYPE_EFI.

Fix by searching through the list of registered EFI devices when
looking for a match, instead of relying on the bus type value.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-15 12:49:47 +01:00
Michael Brown c2226b3d1a [arm] Provide dummy implementations for {in,out}[s]{b,w,l}
It is currently not possible to build the all-drivers iPXE binaries
for ARM, since there is no implementation for inb(), outb(), etc.

There is no common standard for accessing I/O space on ARM platforms,
and there are almost no ARM-compatible peripherals that actually
require I/O space accesses.

Provide dummy implementations that behave as though no device is
present (i.e. ignore writes, return all bits high for reads).  This is
sufficient to allow the all-drivers binaries to link, and should cause
drivers to behave as though no I/O space peripherals are present in
the system.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-14 15:31:25 +01:00
Michael Brown 3fb3ffccea [build] Fix use of inline assembly on GCC 8 ARM64 builds
Commit 1a7746603 ("[build] Fix use of inline assembly on GCC 4.8 ARM64
builds") switched from using "%c0" to "%a0" in order to avoid an
"invalid operand prefix" error on the ARM64 version of GCC 4.8.

It appears that the ARM64 version of GCC 8 now produces an "invalid
address mode" error for the "%a0" form, but is happy with the original
"%c0" form.

Switch back to using the "%c0" form, on the assumption that the
requirement for "%a0" was a temporary aberration.

Originally-fixed-by: John L. Jolly <jjolly@suse.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-07-14 14:05:48 +01:00
Mohammed 1cdf56f751 [golan] Add various new PCI device IDs
Signed-off-by: Mohammed <mohammedt@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-05-02 11:00:18 +01:00
Michael Brown a95966955c [intelxl] Add driver for Intel 40 Gigabit Ethernet NIC virtual functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:26:18 +01:00
Michael Brown 92b46b7858 [intelxl] Choose to operate in non-PXE mode
The physical function defaults to operating in "PXE mode" after a
power-on reset.  In this mode, receive descriptors are fetched and
written back as single descriptors.  In normal (non-PXE mode)
operation, receive descriptors are fetched and written back only as
complete cachelines unless an interrupt is raised.

There is no way to return to PXE mode from non-PXE mode, and there is
no way for the virtual function driver to operate in PXE mode.

Choose to operate in non-PXE mode.  This requires us to trick the
hardware into believing that it is raising an interrupt, so that it
will not defer writing back receive descriptors until a complete
cacheline (i.e. four packets) have been consumed.  We do so by
configuring the hardware to use MSI-X with a dummy target location in
place of the usual APIC register.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:26:18 +01:00
Michael Brown 3078a952a8 [intelxl] Expose functions required by virtual function driver
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:26:18 +01:00
Michael Brown 1e0342ebd8 [intelxl] Allow for arbitrary placement of interrupt control register
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:26:18 +01:00
Michael Brown 2dbd9c0a3c [intelxl] Split out ring creation from context programming
The virtual function driver will use the same transmit and receive
descriptor ring structures, but will not itself construct and program
the ring context.  Split out ring creation and destruction from the
programming of the ring context, to allow code to be shared between
physical and virtual function drivers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:26:18 +01:00
Michael Brown 9907fd54d3 [intelxl] Allow for arbitrary placement of ring tail registers
The virtual function transmit and receive ring tail register offsets
do not match those of the physical function.  Allow the tail register
offsets to be specified separately.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:26:18 +01:00
Michael Brown f460a436ca [intelxl] Use 32-byte receive descriptors
The physical function driver does not allow the virtual function to
request the use of 16-byte receive descriptors.  Switch to using
32-byte receive descriptors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:26:17 +01:00
Michael Brown 7676924571 [intelxl] Provide a mechanism for handling "send to VF" events
Provide a weak stub function for handling the "send to VF" event used
for communications between the physical and virtual function drivers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:25:59 +01:00
Michael Brown 17298d0121 [intelxl] Allow admin cookie to hold extended opcode and return code
The "send to PF" and "send to VF" admin queue descriptors (ab)use the
cookie field to hold the extended opcode and return code values.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:25:59 +01:00
Michael Brown 7b68c310f9 [intelxl] Allow admin queues to be reinitialised
A virtual function reset is triggered via an admin queue command and
will reset the admin queue configuration registers.  Allow the admin
queues to be reinitialised after such a reset, without requiring the
overhead (and potential failure paths) of freeing and reallocating the
queues.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:25:59 +01:00
Michael Brown 8f3e648b6c [intelxl] Use one admin queue buffer per admin queue descriptor
We currently use a single data buffer shared between all admin queue
descriptors.  This works for the physical function driver since we
have at most one command in progress and only a single event (which
does not use a data buffer).

The communication path between the physical and virtual function
drivers uses the event data buffer, and there is no way to prevent a
solicited event (i.e. a response to a request) from being overwritten
by an unsolicited event (e.g. a link status change).

Provide individual data buffers for each admin event queue descriptor
(and for each admin command queue descriptor, for the sake of
consistency).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:25:59 +01:00
Michael Brown c5ccfe79cf [intelxl] Allow for virtual function admin queue register maps
The register map for the virtual functions appears to have been
constructed using a random number generator.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:25:59 +01:00
Michael Brown c901b5ca45 [intelxl] Use VLAN tag in receive descriptor if present
The physical function driver does not allow the virtual function to
request that VLAN tags are left unstripped.  Extract and use the VLAN
tag from the receive descriptor if present.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:25:57 +01:00
Michael Brown fe680c8228 [vlan] Provide vlan_netdev_rx() and vlan_netdev_rx_err()
The Hermon driver uses vlan_find() to identify the appropriate VLAN
device for packets that are received with the VLAN tag already
stripped out by the hardware.  Generalise this capability and expose
it for use by other network card drivers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27 20:25:00 +01:00
Michael Brown afee77d816 [pci] Add support for PCI MSI-X interrupts
The Intel 40 Gigabit Ethernet virtual functions support only MSI-X
interrupts, and will write back completed interrupt descriptors only
when the device attempts to raise an interrupt (or when a complete
cacheline of receive descriptors has been completed).

We cannot actually use MSI-X interrupts within iPXE, since we never
have ownership of the APIC.  However, an MSI-X interrupt is
fundamentally just a DMA write of a single dword to an arbitrary
address.  We can therefore configure the device to "raise" an
interrupt by writing a meaningless value to an otherwise unused memory
location: this is sufficient to trigger the receive descriptor
writeback logic.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-24 11:41:38 +01:00
Christian Nilsson ebf2eaf515 [intel] Add PCI ID for I219-V and -LM 6 to 9
Signed-off-by: Christian Nilsson <nikize@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-03-18 10:24:08 +00:00
Michael Brown b6ffe28a21 [ocsp] Accept response certID with missing hashAlgorithm parameters
One of the design goals of ASN.1 DER is to provide a canonical
serialization of a data structure, thereby allowing for equality of
values to be tested by simply comparing the serialized bytes.

Some OCSP servers will modify the request certID to omit the optional
(and null) "parameters" portion of the hashAlgorithm.  This is
arguably legal but breaks the ability to perform a straightforward
bitwise comparison on the entire certID field between request and
response.

Fix by comparing the OID-identified hashAlgorithm separately from the
remaining certID fields.

Originally-fixed-by: Thilo Fromm <Thilo@kinvolk.io>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-03-10 18:13:52 +00:00
Michael Brown f6b2bf9507 [tcp] Display "connecting" status until connection is established
Provide increased visibility into the progress of TCP connections by
displaying an explicit "connecting" status message while waiting for
the TCP handshake to complete.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-03-10 17:29:06 +00:00
Michael Brown 7b63c1275f [tls] Display validator messages only while validation is in progress
Allow the cipherstream to report progress status messages during
connection establishment.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-03-10 17:27:33 +00:00
Michael Brown b28ccfc725 [tls] Display cross-certificate and OCSP status messages
TLS connections will almost always create background connections to
perform cross-signed certificate downloads and OCSP checks.  There is
currently no direct visibility into which checks are taking place,
which makes troubleshooting difficult in the absence of either a
packet capture or a debug build.

Use the job progress message buffer to report the current cross-signed
certificate download or OCSP status check, where applicable.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-03-07 15:23:19 +00:00
Michael Brown 447e5cd447 [crypto] Use x509_name() in validator debug messages
Display a human-readable certificate name in validator debug messages
wherever possible.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-03-07 13:47:30 +00:00
Michael Brown eaba1a22b8 [tls] Support stateless session resumption
Add support for RFC5077 session ticket extensions to allow for
stateless TLS session resumption.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-03-06 15:11:18 +00:00
Michael Brown 799781f168 [tls] Fix incorrectly duplicated error number
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-03-06 15:11:18 +00:00
Michael Brown 272fe32529 [tls] Support stateful session resumption
Record the session ID (if any) provided by the server and attempt to
reuse it for any concurrent connections to the same server.

If multiple connections are initiated concurrently (e.g. when using
PeerDist) then defer sending the ClientHello for all but the first
connection, to allow time for the first connection to potentially
obtain a session ID (and thereby speed up the negotiation for all
remaining connections).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-02-21 11:32:25 +00:00
Michael Brown 64b4452bca [efi] Blacklist the Dell Ip4ConfigDxe driver
On a Dell OptiPlex 7010, calling DisconnectController() on the LOM
device handle will lock up the system.  Debugging shows that execution
is trapped in an infinite loop that is somehow trying to reconnect
drivers (without going via ConnectController()).

The problem can be reproduced in the UEFI shell with no iPXE code
present, by using the "disconnect" command.  Experimentation shows
that the only fix is to unload (rather than just disconnect) the
"Ip4ConfigDxe" driver.

Add the concept of a blacklist of UEFI drivers that will be
automatically unloaded when iPXE runs as an application, and add the
Dell Ip4ConfigDxe driver to this blacklist.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-02-19 19:02:11 +00:00
Michael Brown 36a4c85f91 [init] Show startup and shutdown function names in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-01-25 14:53:43 +00:00
Petr Borsodi de4565cbe7 [util] Add support for EFI ROM images
The Option::ROM module recognizes and checks EFI header of image.  The
disrom.pl utility dumps this header if is present.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-01-21 11:58:02 +00:00
Petr Borsodi 3f4c179a14 [util] Improve processing of ROM images in Option::ROM
The Option::ROM module now compares the Code Type in the PCIR header
to 0x00 (PC-AT) in order to check the presence of other header types
(PnP, UNDI, iPXE, etc).  The validity of these headers are checked not
only by offset, but by range and signature checks also.  The image
checksum and initial size also depends on Code Type.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-01-21 11:56:35 +00:00
Michael Brown 956f6a7227 [zbin] Fix compiler warning with GCC 9
GCC 9 warns that abs() may truncate its signed long argument.  Fix by
using labs() instead.

Reported-by: Martin Liška <mliska@suse.cz>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-01-21 11:17:04 +00:00
Aaron Young 3946aa9bac [libc] Fix strcmp()/strncmp() to return proper values
Fix strcmp() and strncmp() to return proper standard positive/negative
values for unequal strings.  Current implementation is backwards
(i.e. the functions are returning negative when should be positive and
vice-versa).

Currently all consumers of these functions only check the return value
for ==0 or !=0 and so we can safely change the implementation without
breaking things.

Signed-off-by: Aaron Young <Aaron.Young@oracle.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-01-15 14:12:27 +00:00
Ignat Korchagin e226fecd1b [efi] Fix error handling path in efi_snp_probe
Current (simplified):

1. InstallMultipleProtocolInterfaces
       if err goto err_install_protocol_interface;
2. OpenProtocol(efi_nii_protocol_guid)
       if err goto err_open_nii;
3. OpenProtocol(efi_nii31_protocol_guid)
       if err goto err_open_nii31;
4. efi_child_add
       if err goto err_efi_child_add;
...
err_efi_child_add:
   CloseProtocol(efi_nii_protocol_guid) <= should be efi_nii31_protocol_guid
err_open_nii: <= should be err_open_nii31
   CloseProtocol(efi_nii31_protocol_guid) <= should be efi_nii_protocol_guid
err_open_nii31: <= should be err_open_nii
   UninstallMultipleProtocolInterfaces

Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-01-15 14:01:17 +00:00
Petr Borsodi ba0d5aa993 [pci] Correct invalid base-class/sub-class/prog-if order in PCIR
PCI Configuration Space contains fields prog-if at the offset 0x09,
sub-class at the offset 0x0a and base-class at the offset 0x0b (it
respects little endian).  PCIR structure uses these fields in the same
order.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-01-15 13:08:44 +00:00
Christian Hesse 133f4c47ba [build] Handle R_X86_64_PLT32 from binutils 2.31
Starting from binutils 2.31.0 (commit bd7ab16b) x86-64 assembler
generates R_X86_64_PLT32 instead of R_X86_64_PC32.

Acked-by: John Jolly <jjolly@suse.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-09-17 12:24:18 +01:00
Martin Habets af1860711a [sfc] Add support for X25xx adapters
The first adapters in this family are X2522-10, X2522-25, X2541 and
X2542.

These no longer use PCI BAR 0 for I/O, but use that for memory.  In
other words, BAR 2 on SFN8xxx adapters now becomes BAR 0.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-08-26 22:02:23 +01:00
Michael Brown d2063b7693 [intelxl] Add driver for Intel 40 Gigabit Ethernet NICs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-07-17 12:14:43 +01:00
Michael Brown b9d68b9de0 [ethernet] Use standard 1500 byte MTU unless explicitly overridden
Devices that support jumbo frames will currently default to the
largest possible MTU.  This assumption is valid for virtual adapters
such as virtio-net, where the MTU must have been configured by a
system administrator, but is unsafe in the general case of a physical
adapter.

Default to the standard Ethernet MTU, unless explicitly overridden
either by the driver or via the ${netX/mtu} setting.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-07-17 12:14:43 +01:00
Michael Brown 05b979146d [rndis] Clean up error handling path in register_rndis()
Avoid calling rndis_halt() and rndis->op->close() twice if the call to
register_netdev() fails.

Reported-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-07-09 10:35:57 +01:00