Commit graph

178 commits

Author SHA1 Message Date
Philipp Schuster
4cea282995 treewide: nuke uefi-services 2024-04-20 15:25:16 +02:00
Nicholas Bishop
789aa2143f Put package changelog links in top-level changelog 2023-11-12 18:38:41 +01:00
Nicholas Bishop
1bd2eeb1cb uefi: Add separate changelog file 2023-11-12 18:38:41 +01:00
Nicholas Bishop
9b64f7bf47 uefi-macros: Add separate changelog file 2023-11-12 18:38:41 +01:00
Nicholas Bishop
3b0479a86c uefi-services: Add separate changelog file 2023-11-12 18:38:41 +01:00
Nicholas Bishop
46625a611d uefi-raw: Add separate changelog file 2023-11-12 18:38:41 +01:00
Nicholas Bishop
330ac9f071 uefi-raw: Add SimpleFileSystemProtocol and related types 2023-11-04 11:27:10 -04:00
Nicholas Bishop
47eab2e3e1 uefi-raw: Add AbsolutePointerProtocol 2023-11-03 21:43:36 -04:00
Nicholas Bishop
69d3da2940 Use const interface pointers in protocol management functions
A protocol's interface may mutate itself, but the void pointer passed to the
`{install,reinstall,uninstall}_protocol_interface` functions is opaque to the
firmware, so there's no need for it to be a mut pointer.

Note that from a Rust safety perspective there's no difference here -- mut and
const pointers are interchangeable.

https://github.com/rust-osdev/uefi-rs/issues/970
2023-10-29 11:13:10 -04:00
Nicholas Bishop
ab8109e924 uefi: Use atomics instead of static mut in allocator
Change the allocator's `BOOT_SERVICES` static to a `SYSTEM_TABLE` containing an
`AtomicPtr`.

This completes the transition away from any uses of `static mut`.
2023-10-27 11:52:24 -04:00
Philipp Schuster
6e3b06c9b7
Merge pull request #978 from nicholasbishop/bishop-atomic-logger
Change Logger to use an atomic pointer internally
2023-10-27 05:13:58 +00:00
Nicholas Bishop
544130ea3a Change Logger to use an atomic pointer internally
Using a `Logger` no longer requires making it mutable, and it now provides a
`const` `new` function. This allows creating a `static` `Logger`, rather than a
`static mut` `Option<Logger>`, which allows for less `unsafe`.
2023-10-26 22:13:24 -04:00
Nicholas Bishop
f0fe055cd7 uefi: Add SystemTable::as_ptr 2023-10-26 20:34:09 -04:00
Philipp Schuster
1f0d83b93c
Merge pull request #973 from nicholasbishop/bishop-unsafe-free
Mark free_pages and free_pool as unsafe
2023-10-26 05:22:44 +00:00
Nicholas Bishop
2e583141e6 uefi-services: Remove NonNull wrapper from system_table
The `SystemTable` type is already essentially a wrapper around a pointer, so
there's no need to wrap this return value in another pointer via `NonNull`.
2023-10-25 20:39:13 -04:00
Nicholas Bishop
2f3bc34ef8 Mark free_pages and free_pool as unsafe
These functions can easily be used to trigger UB from safe code by passing in an
address to memory that is still in use. Fix by marking them `unsafe`.
2023-10-25 20:26:44 -04:00
Jarl Evanson
de463d9c3c Implemented get, get_mut, Index, and IndexMut for
`MemoryMap`. Added corresponding tests as well.
2023-10-23 21:26:40 -04:00
Philipp Schuster
6c29405c16 uefi/gop: fix memory leak 2023-10-21 20:34:38 +02:00
Nicholas Bishop
7ae1a47482 Update changelog 2023-10-11 13:17:32 -04:00
Philipp Schuster
736c8e7173 tree: post-release fixes 2023-10-10 18:25:05 +02:00
Philipp Schuster
6c1a5b20aa changelog: prepare uefi release 0.25 2023-10-10 18:08:19 +02:00
Daniel Schaefer
ab19c9904b ShellParams: Add protocol
Useful to get the shell arguments for a commandline application.

Signed-off-by: Daniel Schaefer <dhs@frame.work>
2023-09-05 10:58:52 +08:00
julic20s
0d1a9da8d1 uefi: Update exit_boot_services() prototype 2023-08-25 09:47:02 +08:00
Nicholas Bishop
8717f337b5 Bump MSRV to 1.70 2023-08-24 13:50:21 -04:00
Chris Moylan
4dc61a4f12 Implement core::error::Error for all error types 2023-08-14 21:33:29 -05:00
Philipp Schuster
b7f256b149
Merge pull request #906 from nicholasbishop/bishop-drop-memmove
Drop `memmove` and `set_mem` from boot services
2023-08-01 12:32:25 +00:00
Gus Caplan
c3f2c1f02e
add event to smp 2023-07-29 17:02:07 -07:00
Nicholas Bishop
d0372e9d5e Drop memmove and set_mem from boot services
There's no good reason to the UEFI version of these functions over core Rust
functions like `core::ptr::copy` and `core::ptr::write_bytes`. The safety
requirements of the `core` functions are also better documented.
2023-07-29 14:27:35 -04:00
Nicholas Bishop
a6ab883680 Rework FileSystem::copy to operate on 1MiB chunks
Also add a new test for the copy function.
2023-07-24 13:33:59 +02:00
Nicholas Bishop
0f186cf512 uefi: Change try_exists to return FileSystemResult<bool>
Returning a bool allows both "exists" and "does not exist" to be success cases,
while properly propagating unexpected errors.

This makes it line up with the std `try_exists` method:
https://doc.rust-lang.org/std/path/struct.Path.html#method.try_exists

Also simplified the implementation to just call `open`, no need to get metadata
since `open` already returns an error if the file doesn't exist.
2023-07-16 13:24:30 -04:00
Nicholas Bishop
aeb7dfb85d Move serial Parity and StopBits enums to uefi-raw
In keeping with the uefi-raw style, these are now newtype_enums instead of Rust
enums. This changes the public API of `uefi`.
2023-07-15 15:08:45 -04:00
Nicholas Bishop
f95706aa57 Fix target_arch name: i386 -> x86
`x86` is what will be set on the `i686-unknown-uefi` target, not `i386`.

See also https://doc.rust-lang.org/reference/conditional-compilation.html.
2023-07-08 13:37:08 -04:00
Nicholas Bishop
17227f727f uefi: Use uefi_raw's SimplePointerProtocol to implement Pointer 2023-07-05 13:17:38 -04:00
Nicholas Bishop
b8674679aa uefi: Change Pointer::wait_for_input_event to return an option
Our `Event` type always represents a non-null pointer, but the spec doesn't
guarantee that the `wait_for_input` event will be non-null.
2023-07-05 13:17:38 -04:00
Nicholas Bishop
7cfaf19a38 Return a SimpleFileSystem from BootServices::get_image_file_system
This reverts a small change from: https://github.com/rust-osdev/uefi-rs/pull/472

If using the library without the `alloc` feature enabled, `FileSystem` isn't
available, but you might still want access to the image's file system via the
underlying protocol.

The high-level API is still easily accessible via `FileSystem::new`.
2023-07-03 13:33:44 -04:00
Nicholas Bishop
baa7b48d4c uefi: Use uefi_raw's LoadedImageProtocol to implement LoadedImage 2023-06-25 10:17:30 -04:00
Nicholas Bishop
2fdff0fdff uefi: Return an option from LoadedImage::device
It's not guaranteed that the `device_handle` will be non-null, so return an
option.
2023-06-25 10:17:30 -04:00
Nicholas Bishop
668feb011c Update changelog 2023-06-25 09:56:03 -04:00
Nicholas Bishop
026d8560ab Update changelog 2023-06-20 20:43:09 -04:00
Philipp Schuster
ea968e14cb device_path: add to_string() for more convenience 2023-06-20 13:48:41 -04:00
Nicholas Bishop
911a049fee uefi: Improve support for null protocol interfaces
Modify `ScopedProtocol` to check if the interface pointer is null. If it is,
then `Deref` and `DerefMut` will now panic. They are also now marked
`#[track_caller]` so that the panic location points to the caller.

Also added `get` and `get_mut` methods to get potentially-null interface data
without panicking.
2023-06-19 11:02:20 -04:00
Nicholas Bishop
1432370592 uefi: Add raw pointer Event/Handle methods
Allow round-tripping from raw pointer to `Event` and `Handle` via `from_ptr` and
`as_ptr` methods.
2023-06-11 17:33:21 -04:00
Philipp Schuster
8b21b16e5c load_image: LoadImageSource::FromFilePath => FromDevicePath 2023-06-10 11:25:48 -04:00
Philipp Schuster
80b5e7a41e device_path: enhance device path structs with convenient methods 2023-06-09 10:04:34 -04:00
Nicholas Bishop
63569bd9e2 Update changelog 2023-06-04 18:41:45 -04:00
Nicholas Bishop
04fc147f95 Update changelog 2023-06-01 06:21:50 -04:00
Nicholas Bishop
9464dcec19 uefi: Change file reading to read in 1 MiB chunks
Some UEFI implementations have a bug where large reads will incorrectly return
an error, so read in 1 MiB chunks to avoid that.

The `RegularFile::read` method no longer returns `Option<usize>` in error data,
since that is only useful with directory reads. Directory reads continue to use
the original unchunked read, which is fine since directory entries should be
much smaller than the chunk size.

Fixes https://github.com/rust-osdev/uefi-rs/issues/825
2023-05-30 19:48:29 -04:00
Raito Bezarius
a3e551cd67 uefi(boot_services): add install_configuration_table
See https://uefi.org/specs/UEFI/2.9_A/07_Services_Boot_Services.html#efi-boot-services-installconfigurationtable
Closes #782
2023-05-23 22:25:46 -04:00
Nicholas Bishop
fe9576a0d5 uefi: Fix use of tuples in pointer structs
Tuples are not FFI safe, so replace them with arrays.
2023-05-21 19:07:56 -04:00
Nicholas Bishop
51abdb3791 Move ResetType to uefi-raw and make it a newtype enum
This type is used as an output parameter in `QueryCapsuleCapabilities`, so make
it a newtype enum.
2023-05-17 16:45:20 -04:00