Commit graph

472 commits

Author SHA1 Message Date
Philipp Schuster
507ed36219 ci: fix 2025-05-31 20:37:48 +02:00
Philipp Schuster
8cfeedc07d uefi-test-runner: SNP: remove magic ethernet frame value
We still have the unfortunate situation that the SNP test
depends on DHCP of the PXE test, but now it is much clearer
how the UDP packet is sent via Ethernet and how the echo
service is used.
2025-05-31 19:59:10 +02:00
Philipp Schuster
ba68eae9cd uefi-integration-test: PXE: log IP addresses 2025-05-31 19:59:10 +02:00
Philipp Schuster
0d5af99a03 uefi-test-runner: SNP: use smoltcp to UDP packet
Properly deconstruct the response. This improves the maintainability of
this test and to better understand what is going on.
2025-05-31 19:59:10 +02:00
Philipp Schuster
e99f02bd64 uefi-test-runner: SNP: add verbose receive function
The new function makes debugging of unexpected packages (e.g. ARP)
much easier detectable.
2025-05-31 19:59:10 +02:00
Philipp Schuster
01ec4fe966 uefi-test-runner: SNP: add more constants 2025-05-31 19:59:10 +02:00
Philipp Schuster
f9e383adf5 uefi-test-runner: SNP: improve idempotence of test
snp::test() can now be called multiple times in a row
2025-05-31 19:59:10 +02:00
Philipp Schuster
fe84413295 uefi-test-runner: SNP: improve doc (what's going on) 2025-05-31 19:59:10 +02:00
Philipp Schuster
0512dc3c00 uefi-test-runner: SNP: decouple finding handle from test
Although the changes look big, most things were just reordered
(moved out of the loop body) and decoupled. The function finding
the proper handle verifies the interface has the right MAC, to
prevent failure and ease debugging.
2025-05-31 19:58:01 +02:00
Philipp Schuster
005802d9b2 uefi-test-runner: SNP: PXE feature gate 2025-05-31 19:58:01 +02:00
Markus Ebner
080e87b278
uefi: Add integration test for PCI_ROOT_BRIDGE_IO_PROTOCOL 2025-05-29 21:17:36 +02:00
Jarl Evanson
cc6bca7386 uefi: Add integration test for the USB I/O protocol 2025-05-23 07:11:06 -05:00
Philipp Schuster
da78ac4f98 doc: help with feature selection 2025-05-20 08:50:58 +02:00
Philipp Schuster
83412b60a0 rustfmt: update to edition 2024
We can delete rustfmt.toml as the style version defaults to
the crate's rust edition.
2025-05-17 12:27:06 +02:00
Philipp Schuster
bfe3c6d420 rust: update to edition 2024 2025-05-17 12:21:52 +02:00
Philipp Schuster
2fdcc705f4 uefi-test-runner: streamline memory related tests 2025-05-11 16:39:38 +02:00
fox0
3a0f5acb06 uefi: use Duration for boot::stall 2025-05-08 19:11:22 +07:00
Bjorn Andersson
22c10b29ba uefi: Implement CalculateCrc32() boot services function
UEFI Boot services includes a helper function (CalculateCrc32) for calculating a
32-bit CRC over a buffer. This is useful in Rust applications as well, so expose
it in the boot services API.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2025-04-30 10:35:29 +02:00
Gerd Hoffmann
e782459658 add test case for ip4config2 and http protocols.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-04-18 12:12:23 -04:00
Gerd Hoffmann
3fc70b0df7 Add CA trust database to the repo.
This is needed for https support (tls server certificate verification).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-04-18 12:12:23 -04:00
Philipp Schuster
2a629c832d uefi: allocator: use shortcut for PAGE_SIZE + add test
Allocating page-aligned memory via the global allocator is not
uncommon for UEFI OS loaders. Therefore, it is feasible to use a
shortcut in the allocator, and directly use boot::allocate_pages()
rather than boot::allocate_pool().

We can look at the TRACE messages of `cargo xtask run` to
verify that the shortcut is taken.
2025-04-15 14:49:09 +02:00
Philipp Schuster
bd3e22a043 uefi-test-runner: restructure alloc test into modules
This is a prerequisite for the next commit.
2025-04-15 13:35:40 +02:00
Jarl Evanson
f978a8e822 uefi-raw: Move EFI_SIMPLE_NETWORK_PROTOCOL 2025-04-15 04:08:59 -05:00
Markus Ebner
0ce684c375
uefi: Add integration test for ATA_PASS_THRU_PROTOCOL 2025-04-14 22:04:38 +02:00
Markus Ebner
ff49771650 uefi: Add integration test for NVM_EXPRESS_PASS_THRU_PROTOCOL 2025-04-12 19:42:54 +02:00
Gerd Hoffmann
3e8c28573d test/snp: drop multicast from packet filter.
The test case does not use multicast.  The edk2 virtio-net driver
does not support multicast.  Drop it from packet filter.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-04-10 22:16:03 +02:00
Gerd Hoffmann
6e8418e078 test/snp: UNSUPPORTED for statistics is not a test failure
The edk2 virtio-net driver does not support statistics and returns
UNSUPPORTED.   This is correct behavior.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-04-10 22:16:03 +02:00
Gerd Hoffmann
ba0d0c7136 test/snp: NOT_STARTED error is not a test failure
In case the network has not been started before (say by pxe test) the
shutdown and stop functions may return NOT_STARTED.  This is normal
behavior and not a test failure.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-04-10 22:16:03 +02:00
Markus Ebner
5b7173f8d3
uefi: Add safe protocol bindings for EFI_EXT_SCSI_PASS_THRU_PROTOCOL 2025-04-08 14:12:00 +02:00
Philipp Schuster
ac14387c4a
Merge branch 'main' into mr-devpathutil 2025-04-08 09:38:17 +02:00
Markus Ebner
61bf5753e3
uefi: Add initial incomplete safe wrapper for DevicePathUtilities protocol 2025-04-07 14:11:43 +02:00
Philipp Schuster
4752b4eecc uefi: change signature of exit_boot_services
People probably want to use 99% of the time LOADER_DATA here.
Therefore, we indicate in our function signature, that people should
use the default (`None`) if they are unsure what to do here.

LOADER_DATA is also what Linux uses [0].

[0] https://elixir.bootlin.com/linux/v6.13.7/source/drivers/firmware/efi/libstub/mem.c#L24
2025-04-06 21:55:37 +02:00
Markus Ebner
19c4805835
uefi: Implement safe wrapper for EFI_DISK_INFO_PROTOCOL 2025-03-25 18:25:13 +01:00
Nicholas Bishop
3072149af1 uefi: Make pxe::Mode an opaque struct
Methods are now provided to access mode data instead of direct field access.

In a later PR, this will help with switching the public API to use
`core::net::IpAddr`.
2025-03-23 15:13:51 +01:00
Bjorn Andersson
782392c99f uefi: Implement SignalEvent() boot services function
Missing from the boot services is the SignalEvent() function, which is used to
place signals into a signaled state. Implement this to allow applications to
signal e.g. event groups.

Also implement a test case, checking that the event callback is signaled when
the newly introduced function is invoked.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
2025-03-01 13:47:13 -05:00
Philipp Schuster
f42e461310 uefi-raw: use new Boolean type
Use the new type introduced in ec6e0e6b
2025-02-12 08:18:41 +01:00
Nicholas Bishop
c576801017 Add SPDX headers to uefi-test-runner 2025-02-07 13:18:26 -05:00
Nicholas Bishop
5d1ed37dfc test-runner: Clean up device path tests
Split the conversion tests out into separate functions. This is a bit more
verbose, but makes it clearer exactly what is being tested.

The conversion tests now use a hardcoded test `DevicePath`, so we no longer need
to `cfg` the tests for different arches based on what devices QEMU creates. This
also makes it clearer what effects `DisplayOnly` and `AllowShortcuts` can have
on the text conversion.
2025-01-25 15:16:40 -05:00
Nicholas Bishop
65155fa76a Fix memory leaks in DevicePathFromText
The methods of both DevicePathToText and DevicePathFromText return memory that
is allocated internally by UEFI, so it needs to be freed on
drop. DevicePathToText already does that correctly by returning a `PoolString`,
but this was missed in DevicePathFromText, which just returns a reference.

Fix by adding PoolDevicePath and PoolDevicePathNode structs, and return them
from the corresponding methods of DevicePathFromText.
2025-01-24 13:34:13 -05:00
Nicholas Bishop
83e99f2abb relicensing: Rewrite PR "uefi: Fix wrong install_configuration_table() signature"
The signature fix itself is trivial, just adding a `&`. The test changes had
already been partially rewritten during the freestanding table function
refactor. Now alter constants and variable names, remove a use of `as`, and free
the memory at the end.

The PR originally included a cleanup commit ("uefi-test-runner: Fix buffer
alignment on ia32") that ended up being cherry-picked and merged in a separate
PR: https://github.com/rust-osdev/uefi-rs/pull/844. Rewrite that fix here as
well.

This covers these commits:
d7697c3ab5
9609873a1c
2025-01-21 01:40:57 -05:00
Nicholas Bishop
a5e9ba13a6 Use size_of/size_of_val/align_of/align_of_val from the prelude
As of Rust 1.80, these functions are in the prelude so we don't need to import
`mem` or fully specify the path.
2024-12-14 20:33:08 -05:00
Nicholas Bishop
c995e08a96 Fix formatting
Result of `cargo xtask fmt`.
2024-11-05 15:34:35 -05:00
Nicholas Bishop
81af1a3bb3 uefi: Improve the VariableKey type and iterator
Prior to this commit, the `name` field of `VariableKey` was not public, so it
was not possible to construct `VariableKey` outside of this crate. This is a
problem for unit tests that want to mock `runtime::variable_keys`; there's no
way for the unit test to construct the iterator elements.

Fix by making `name` public. Also change the `name` type from a `Vec<u16>` to a
`CString16`; this makes the type easier to work with, since in all cases
variable names should be UCS-2. The `VariableKeys` iterator now yields an error
for variables with non-UCS-2 names (but such errors do not stop iteration; you
can simply continue on to the next variable key).

Also deprecate the `VariableKey::name()` method, since it just returns the same
thing as the `name` field now.
2024-10-06 16:08:05 -04:00
Nicholas Bishop
bb806a76d1 test-runner: Remove remaining tests for deprecated table types 2024-09-28 11:48:38 -04:00
Nicholas Bishop
534df65e91 test-runner: Remove accidental debug log 2024-09-27 09:13:23 -04:00
Nicholas Bishop
d2b7eac633 test-runner: Remove BootServices from test_load_image 2024-09-26 23:30:28 -04:00
Nicholas Bishop
91fa4b5336 test-runner: Remove BootServices from proto tests 2024-09-20 18:12:08 -04:00
Philipp Schuster
d6eb99ef3a
Merge pull request #1404 from rust-osdev/bishop-remove-rt
Delete deprecated RuntimeServices struct
2024-09-20 07:46:10 +00:00
Nicholas Bishop
14d27af5fc test-runner: Remove BootServices from many protocol tests 2024-09-20 01:43:36 -04:00
Nicholas Bishop
44ca889219 test-runner: Clean up a few old imports of uefi::table::runtime 2024-09-20 01:07:37 -04:00