Commit Graph

16 Commits

Author SHA1 Message Date
Heinrich Schuchardt
cb90ee9757 efi_loader: efi_net: check return value of calloc
Calloc may return NULL. So we must check the return value.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:22:56 +01:00
Heinrich Schuchardt
336d9dfc0a efi_loader: fill return values in SimpleNetworkProtocol
In the receive function all return values should be filled.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09 07:00:35 +02:00
Heinrich Schuchardt
8db174d651 efi_loader: size fields in SimpleNetworkProtocol
The size fields in the Simple Network Protocol are all
UINTN in the UEFI spec. So use size_t.

Provide a function description of the receive function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09 07:00:34 +02:00
Heinrich Schuchardt
891b3d9051 efi_loader: fix efi_net_get_status
The returned interrupt status was wrong.

As out transmit buffer is empty we need to always set
EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT.

When we have received a packet we need to set
EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT.

Furthermore we should call efi_timer_check() to handle events.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09 07:00:34 +02:00
Heinrich Schuchardt
e5c21603fc efi_loader: implement WaitForPacket event
The WaitForPacket event informs that a network package has been
received by the SimpleNetworkProtocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: Move is_signaled = true line into efi_net_push()]
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09 07:00:33 +02:00
Heinrich Schuchardt
a0549ef607 efi_loader: use events for efi_net_receive
A timer event is defined. The timer handler cares for receiving new
packets.

efi_timer_check is called both in efi_net_transmit and efi_net_receive
to enable events during network communication.

Calling efi_timer_check in efi_net_get_status is implemented in a
separate patch.

[agraf] This patch is needed to make efi_net_get_status() actually
        report incoming packets.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: fix spelling in comment]
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09 07:00:33 +02:00
Heinrich Schuchardt
61da678c39 efi_net: return EFI_UNSUPPORTED where appropriate
U-Boot does not implement all functions of the simple network
protocol. The unimplemented functions return either of
EFI_SUCCESS and EFI_INVALID_PARAMETER.

The UEFI spec foresees to return EFI_UNSUPPORTED in these cases.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09 07:00:32 +02:00
Heinrich Schuchardt
5d4a5ea964 efi_loader: efi_net: hwaddr_size = 6
The length of a MAC address is 6.
We have to set this length in the EFI_SIMPLE_NETWORK_MODE
structure of the EFI_SIMPLE_NETWORK_PROTOCOL.

Without this patch iPXE fails to initialize the network with
error message
SNP MAC(001e0633bcbf,0x0) has invalid hardware address length 0

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09 07:00:32 +02:00
Heinrich Schuchardt
bdecf974f1 efi_loader: fill simple network protocol revision
Provide the simple network protocol revision.
This revision number could be used to identify backwards compatible
enhancements of the protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09 07:00:32 +02:00
Rob Clark
95c5553ea2 efi_loader: refactor boot device and loaded_image handling
Get rid of the hacky fake boot-device and duplicate device-path
constructing (which needs to match what efi_disk and efi_net do).
Instead convert over to use efi_device_path helpers to construct
device-paths, and use that to look up the actual boot device.

Also, extract out a helper to plug things in properly to the
loaded_image.  In a following patch we'll want to re-use this in
efi_load_image() to handle the case of loading an image from a
file_path.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-20 10:36:56 +02:00
Rob Clark
e15fc33548 efi_loader: use proper device-paths for net
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-20 10:35:29 +02:00
xypron.glpk@gmx.de
b5349f742a efi_loader: refactor efi_open_protocol
efi_open_protocol was implemented to call a protocol specific open
function to retrieve the protocol interface.

The UEFI specification does not know of such a function.

It is not possible to implement InstallProtocolInterface with the
current design.

With the patch the protocol interface itself is stored in the list
of installed protocols of an efi_object instead of an open function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: fix efi gop support]
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-07-19 14:14:23 +02:00
Oleksandr Tymoshenko
d7608aba38 efi: Use device device path type Messaging for network interface node
When adding network interface node use Messaging device path with
subtype MAC Address and device's MAC address as a value instead
of Media Device path type with subtype File Path and path "Net"

Signed-off-by: Oleksandr Tymoshenko <gonzo@bluezbox.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2016-11-14 23:24:02 +01:00
Simon Glass
e275458c2f efi: Fix missing EFIAPI specifiers
These are missing in some functions. Add them to keep things consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2016-10-19 09:01:53 +02:00
Alexander Graf
712cd29874 efi_loader: Allow bouncing for network
So far bounce buffers were only used for disk I/O, but network I/O
may suffer from the same problem.

On platforms that have problems doing DMA on high addresses, let's
also bounce outgoing network packets. Incoming ones always already
get bounced.

This patch fixes EFI PXE boot on ZynqMP for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
2016-10-19 09:01:50 +02:00
Alexander Graf
0efe1bcf5c efi_loader: Add network access support
We can now successfully boot EFI applications from disk, but users
may want to also run them from a PXE setup.

This patch implements rudimentary network support, allowing a payload
to send and receive network packets.

With this patch, I was able to successfully run grub2 with network
access inside of QEMU's -M xlnx-ep108.

Signed-off-by: Alexander Graf <agraf@suse.de>
2016-05-27 10:01:10 -04:00