html-to-markdown 2.27.2 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/ext/html-to-markdown-rb/native/Cargo.toml +1 -1
- data/ext/html-to-markdown-rb/native/src/conversion/mod.rs +6 -0
- data/ext/html-to-markdown-rb/native/src/conversion/tables.rs +71 -0
- data/ext/html-to-markdown-rb/native/src/lib.rs +27 -1
- data/lib/html_to_markdown/version.rb +1 -1
- data/lib/html_to_markdown.rb +29 -0
- data/rust-vendor/getrandom/.cargo-checksum.json +1 -1
- data/rust-vendor/getrandom/.cargo_vcs_info.json +1 -1
- data/rust-vendor/getrandom/CHANGELOG.md +62 -43
- data/rust-vendor/getrandom/Cargo.lock +49 -56
- data/rust-vendor/getrandom/Cargo.toml +2 -2
- data/rust-vendor/getrandom/Cargo.toml.orig +2 -2
- data/rust-vendor/getrandom/src/backends/efi_rng.rs +8 -10
- data/rust-vendor/getrandom/src/backends/getentropy.rs +13 -4
- data/rust-vendor/getrandom/src/backends/linux_android_with_fallback.rs +10 -25
- data/rust-vendor/getrandom/src/backends/netbsd.rs +17 -25
- data/rust-vendor/getrandom/src/backends/rdrand.rs +15 -9
- data/rust-vendor/getrandom/src/backends/rndr.rs +2 -1
- data/rust-vendor/getrandom/src/backends/vxworks.rs +7 -3
- data/rust-vendor/getrandom/src/backends/windows.rs +21 -5
- data/rust-vendor/getrandom/src/utils/lazy_bool.rs +39 -0
- data/rust-vendor/getrandom/src/utils/lazy_ptr.rs +57 -0
- data/rust-vendor/html-to-markdown-rs/Cargo.toml +2 -2
- data/rust-vendor/html-to-markdown-rs/README.md +29 -0
- data/rust-vendor/html-to-markdown-rs/src/convert_api.rs +368 -0
- data/rust-vendor/html-to-markdown-rs/src/converter/main.rs +10 -5
- data/rust-vendor/html-to-markdown-rs/src/converter/text_node.rs +2 -1
- data/rust-vendor/html-to-markdown-rs/src/lib.rs +3 -0
- data/rust-vendor/html-to-markdown-rs/src/prelude.rs +3 -0
- data/rust-vendor/html-to-markdown-rs/tests/issue_216_217_regressions.rs +82 -0
- data/rust-vendor/quote/.cargo-checksum.json +1 -1
- data/rust-vendor/quote/.cargo_vcs_info.json +1 -1
- data/rust-vendor/quote/.github/workflows/ci.yml +2 -2
- data/rust-vendor/quote/Cargo.lock +21 -21
- data/rust-vendor/quote/Cargo.toml +2 -2
- data/rust-vendor/quote/Cargo.toml.orig +2 -2
- data/rust-vendor/quote/README.md +0 -1
- data/rust-vendor/quote/src/lib.rs +1 -1
- data/rust-vendor/quote/src/to_tokens.rs +7 -0
- data/rust-vendor/quote/tests/ui/not-quotable.stderr +1 -1
- data/rust-vendor/quote/tests/ui/not-repeatable.stderr +3 -11
- data/rust-vendor/r-efi/.cargo-checksum.json +1 -1
- data/rust-vendor/r-efi/.cargo_vcs_info.json +1 -1
- data/rust-vendor/r-efi/AUTHORS +1 -0
- data/rust-vendor/r-efi/Cargo.lock +1 -1
- data/rust-vendor/r-efi/Cargo.toml +1 -3
- data/rust-vendor/r-efi/Cargo.toml.orig +1 -5
- data/rust-vendor/r-efi/NEWS.md +16 -0
- data/rust-vendor/r-efi/src/base.rs +1 -1
- data/rust-vendor/r-efi/src/lib.rs +27 -12
- data/rust-vendor/r-efi/src/protocols/absolute_pointer.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/block_io.rs +8 -8
- data/rust-vendor/r-efi/src/protocols/bus_specific_driver_override.rs +2 -2
- data/rust-vendor/r-efi/src/protocols/debug_support.rs +10 -10
- data/rust-vendor/r-efi/src/protocols/debugport.rs +8 -8
- data/rust-vendor/r-efi/src/protocols/decompress.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/device_path_from_text.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/device_path_to_text.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/device_path_utilities.rs +16 -16
- data/rust-vendor/r-efi/src/protocols/disk_io.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/disk_io2.rs +8 -8
- data/rust-vendor/r-efi/src/protocols/driver_binding.rs +6 -6
- data/rust-vendor/r-efi/src/protocols/driver_diagnostics2.rs +2 -2
- data/rust-vendor/r-efi/src/protocols/driver_family_override.rs +2 -2
- data/rust-vendor/r-efi/src/protocols/file.rs +28 -28
- data/rust-vendor/r-efi/src/protocols/graphics_output.rs +6 -6
- data/rust-vendor/r-efi/src/protocols/hii_database.rs +24 -24
- data/rust-vendor/r-efi/src/protocols/hii_font.rs +8 -8
- data/rust-vendor/r-efi/src/protocols/hii_font_ex.rs +10 -10
- data/rust-vendor/r-efi/src/protocols/hii_string.rs +10 -10
- data/rust-vendor/r-efi/src/protocols/ip4.rs +16 -16
- data/rust-vendor/r-efi/src/protocols/ip6.rs +18 -18
- data/rust-vendor/r-efi/src/protocols/load_file.rs +2 -2
- data/rust-vendor/r-efi/src/protocols/loaded_image.rs +2 -2
- data/rust-vendor/r-efi/src/protocols/managed_network.rs +16 -16
- data/rust-vendor/r-efi/src/protocols/memory_attribute.rs +6 -6
- data/rust-vendor/r-efi/src/protocols/mp_services.rs +15 -15
- data/rust-vendor/r-efi/src/protocols/pci_io.rs +26 -26
- data/rust-vendor/r-efi/src/protocols/platform_driver_override.rs +6 -6
- data/rust-vendor/r-efi/src/protocols/rng.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/service_binding.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/shell.rs +81 -81
- data/rust-vendor/r-efi/src/protocols/shell_dynamic_command.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/simple_file_system.rs +2 -2
- data/rust-vendor/r-efi/src/protocols/simple_network.rs +26 -26
- data/rust-vendor/r-efi/src/protocols/simple_text_input.rs +4 -4
- data/rust-vendor/r-efi/src/protocols/simple_text_input_ex.rs +11 -11
- data/rust-vendor/r-efi/src/protocols/simple_text_output.rs +18 -18
- data/rust-vendor/r-efi/src/protocols/tcp4.rs +20 -20
- data/rust-vendor/r-efi/src/protocols/tcp6.rs +18 -18
- data/rust-vendor/r-efi/src/protocols/timestamp.rs +3 -3
- data/rust-vendor/r-efi/src/protocols/udp4.rs +16 -16
- data/rust-vendor/r-efi/src/protocols/udp6.rs +14 -14
- data/rust-vendor/r-efi/src/system.rs +115 -115
- data/rust-vendor/r-efi/src/vendor/intel/console_control.rs +6 -6
- data/rust-vendor/r-efi-5.3.0/.cargo-checksum.json +1 -0
- data/rust-vendor/r-efi-5.3.0/.cargo_vcs_info.json +6 -0
- data/rust-vendor/r-efi-5.3.0/.github/workflows/publish.yml +39 -0
- data/rust-vendor/r-efi-5.3.0/.github/workflows/rust-tests.yml +125 -0
- data/rust-vendor/r-efi-5.3.0/AUTHORS +74 -0
- data/rust-vendor/r-efi-5.3.0/Cargo.lock +16 -0
- data/rust-vendor/r-efi-5.3.0/Cargo.toml +70 -0
- data/rust-vendor/r-efi-5.3.0/Cargo.toml.orig +51 -0
- data/rust-vendor/r-efi-5.3.0/Makefile +85 -0
- data/rust-vendor/r-efi-5.3.0/NEWS.md +301 -0
- data/rust-vendor/r-efi-5.3.0/README.md +99 -0
- data/rust-vendor/r-efi-5.3.0/examples/freestanding.rs +34 -0
- data/rust-vendor/r-efi-5.3.0/examples/gop-query.rs +188 -0
- data/rust-vendor/r-efi-5.3.0/examples/hello-world.rs +55 -0
- data/rust-vendor/r-efi-5.3.0/src/base.rs +993 -0
- data/rust-vendor/r-efi-5.3.0/src/hii.rs +1300 -0
- data/rust-vendor/r-efi-5.3.0/src/lib.rs +182 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/absolute_pointer.rs +69 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/block_io.rs +70 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/bus_specific_driver_override.rs +32 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/debug_support.rs +835 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/debugport.rs +42 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/decompress.rs +37 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/device_path.rs +82 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/device_path_from_text.rs +26 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/device_path_to_text.rs +30 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/device_path_utilities.rs +63 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/disk_io.rs +40 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/disk_io2.rs +58 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/driver_binding.rs +42 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/driver_diagnostics2.rs +38 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/driver_family_override.rs +23 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/file.rs +183 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/graphics_output.rs +103 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/hii_database.rs +299 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/hii_font.rs +87 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/hii_font_ex.rs +107 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/hii_package_list.rs +14 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/hii_string.rs +71 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/ip4.rs +202 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/ip6.rs +264 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/load_file.rs +26 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/load_file2.rs +15 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/loaded_image.rs +39 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/loaded_image_device_path.rs +13 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/managed_network.rs +147 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/memory_attribute.rs +40 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/mp_services.rs +121 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/pci_io.rs +203 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/platform_driver_override.rs +46 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/rng.rs +83 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/service_binding.rs +20 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/shell.rs +295 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/shell_dynamic_command.rs +33 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/shell_parameters.rs +23 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/simple_file_system.rs +26 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/simple_network.rs +196 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/simple_text_input.rs +38 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/simple_text_input_ex.rs +85 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/simple_text_output.rs +86 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/tcp4.rs +224 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/tcp6.rs +202 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/timestamp.rs +32 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/udp4.rs +151 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols/udp6.rs +137 -0
- data/rust-vendor/r-efi-5.3.0/src/protocols.rs +54 -0
- data/rust-vendor/r-efi-5.3.0/src/system.rs +1130 -0
- data/rust-vendor/r-efi-5.3.0/src/vendor/intel/console_control.rs +37 -0
- data/rust-vendor/r-efi-5.3.0/src/vendor.rs +10 -0
- data/rust-vendor/tokio/.cargo-checksum.json +1 -1
- data/rust-vendor/tokio/.cargo_vcs_info.json +1 -1
- data/rust-vendor/tokio/CHANGELOG.md +94 -0
- data/rust-vendor/tokio/Cargo.lock +1549 -0
- data/rust-vendor/tokio/Cargo.toml +96 -83
- data/rust-vendor/tokio/Cargo.toml.orig +7 -7
- data/rust-vendor/tokio/README.md +1 -1
- data/rust-vendor/tokio/src/fs/open_options.rs +4 -1
- data/rust-vendor/tokio/src/fs/read.rs +4 -1
- data/rust-vendor/tokio/src/fs/write.rs +4 -1
- data/rust-vendor/tokio/src/io/async_write.rs +3 -4
- data/rust-vendor/tokio/src/io/poll_evented.rs +23 -1
- data/rust-vendor/tokio/src/io/stderr.rs +15 -1
- data/rust-vendor/tokio/src/io/stdout.rs +14 -0
- data/rust-vendor/tokio/src/io/util/async_write_ext.rs +2 -2
- data/rust-vendor/tokio/src/io/util/write_buf.rs +11 -2
- data/rust-vendor/tokio/src/lib.rs +12 -28
- data/rust-vendor/tokio/src/macros/select.rs +6 -8
- data/rust-vendor/tokio/src/net/tcp/socket.rs +25 -1
- data/rust-vendor/tokio/src/net/tcp/stream.rs +40 -1
- data/rust-vendor/tokio/src/process/unix/pidfd_reaper.rs +1 -41
- data/rust-vendor/tokio/src/runtime/blocking/pool.rs +18 -14
- data/rust-vendor/tokio/src/runtime/builder.rs +10 -4
- data/rust-vendor/tokio/src/runtime/handle.rs +3 -2
- data/rust-vendor/tokio/src/runtime/io/driver/uring.rs +49 -61
- data/rust-vendor/tokio/src/runtime/io/driver.rs +6 -5
- data/rust-vendor/tokio/src/runtime/mod.rs +20 -1
- data/rust-vendor/tokio/src/runtime/runtime.rs +71 -1
- data/rust-vendor/tokio/src/runtime/scheduler/current_thread/mod.rs +24 -8
- data/rust-vendor/tokio/src/runtime/scheduler/multi_thread/worker.rs +5 -0
- data/rust-vendor/tokio/src/runtime/task/core.rs +1 -0
- data/rust-vendor/tokio/src/runtime/task/join.rs +7 -3
- data/rust-vendor/tokio/src/runtime/task/list.rs +5 -3
- data/rust-vendor/tokio/src/runtime/task/mod.rs +0 -5
- data/rust-vendor/tokio/src/runtime/tests/loom_blocking.rs +39 -1
- data/rust-vendor/tokio/src/signal/mod.rs +6 -17
- data/rust-vendor/tokio/src/signal/registry.rs +1 -1
- data/rust-vendor/tokio/src/signal/unix.rs +24 -44
- data/rust-vendor/tokio/src/signal/windows/sys.rs +52 -64
- data/rust-vendor/tokio/src/signal/windows.rs +35 -23
- data/rust-vendor/tokio/src/sync/mpsc/mod.rs +3 -1
- data/rust-vendor/tokio/src/sync/oneshot.rs +13 -0
- data/rust-vendor/tokio/src/sync/rwlock.rs +4 -5
- data/rust-vendor/tokio/src/sync/tests/loom_oneshot.rs +27 -1
- data/rust-vendor/tokio/src/task/blocking.rs +16 -1
- data/rust-vendor/tokio/src/task/builder.rs +2 -2
- data/rust-vendor/tokio/src/task/mod.rs +1 -1
- data/rust-vendor/tokio/src/task/spawn.rs +8 -3
- data/rust-vendor/tokio/src/task/yield_now.rs +13 -23
- data/rust-vendor/tokio/src/time/clock.rs +62 -0
- data/rust-vendor/tokio/src/util/memchr.rs +32 -4
- data/rust-vendor/tokio/src/util/sharded_list.rs +6 -4
- data/rust-vendor/tokio/tests/fs_link.rs +54 -0
- data/rust-vendor/tokio/tests/io_async_fd_memory_leak.rs +209 -0
- data/rust-vendor/tokio/tests/io_write_buf.rs +56 -0
- data/rust-vendor/tokio/tests/process_issue_7144.rs +8 -0
- data/rust-vendor/tokio/tests/rt_basic.rs +41 -0
- data/rust-vendor/tokio/tests/rt_common_before_park.rs +92 -0
- data/rust-vendor/tokio/tests/rt_metrics.rs +1 -1
- data/rust-vendor/tokio/tests/rt_panic.rs +12 -0
- data/rust-vendor/tokio/tests/rt_shutdown_err.rs +82 -0
- data/rust-vendor/tokio/tests/rt_threaded.rs +49 -1
- data/rust-vendor/tokio/tests/rt_unstable_metrics.rs +32 -0
- data/rust-vendor/tokio/tests/tcp_connect.rs +2 -3
- data/rust-vendor/tokio/tests/tcp_shutdown.rs +1 -3
- data/rust-vendor/tokio/tests/tcp_socket.rs +3 -4
- data/rust-vendor/tokio/tests/tcp_stream.rs +3 -0
- data/sig/html_to_markdown.rbs +46 -0
- data/spec/convert_with_tables_spec.rb +194 -0
- metadata +80 -3
- data/rust-vendor/getrandom/src/utils/lazy.rs +0 -64
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//! UEFI Reference Specification Protocol Constants and Definitions
|
|
2
|
+
//!
|
|
3
|
+
//! This project provides protocol constants and definitions as defined in the UEFI Reference
|
|
4
|
+
//! Specification. The aim is to provide all these constants as C-ABI compatible imports to rust.
|
|
5
|
+
//! Safe rust abstractions over the UEFI API are out of scope of this project. That is, the
|
|
6
|
+
//! purpose is really just to extract all the bits and pieces from the specification and provide
|
|
7
|
+
//! them as rust types and constants.
|
|
8
|
+
//!
|
|
9
|
+
//! While we strongly recommend using safe abstractions to interact with UEFI systems, this
|
|
10
|
+
//! project serves both as base to write those abstractions, but also as last resort if you have
|
|
11
|
+
//! to deal with quirks and peculiarities of UEFI systems directly. Therefore, several examples
|
|
12
|
+
//! are included, which show how to interact with UEFI systems from rust. These serve both as
|
|
13
|
+
//! documentation for anyone interested in how the system works, but also as base for anyone
|
|
14
|
+
//! implementing safe abstractions on top.
|
|
15
|
+
//!
|
|
16
|
+
//! # Target Configuration
|
|
17
|
+
//!
|
|
18
|
+
//! Rust code can be compiled natively for UEFI systems. However, you are quite unlikely to have a
|
|
19
|
+
//! rust compiler running in an UEFI environment. Therefore, you will most likely want to cross
|
|
20
|
+
//! compile your rust code for UEFI systems. To do this, you need a target-configuration for UEFI
|
|
21
|
+
//! systems. As of rust-1.61, upstream rust includes the following UEFI targets:
|
|
22
|
+
//!
|
|
23
|
+
//! * `aarch64-unknown-uefi`: A native UEFI target for aarch64 systems (64bit ARM).
|
|
24
|
+
//! * `i686-unknown-uefi`: A native UEFI target for i686 systems (32bit Intel x86).
|
|
25
|
+
//! * `x86_64-unknown-uefi`: A native UEFI target for x86-64 systems (64bit Intel x86).
|
|
26
|
+
//!
|
|
27
|
+
//! If none of these targets match your architecture, you have to create the target specification
|
|
28
|
+
//! yourself. Feel free to contact the `r-efi` project for help.
|
|
29
|
+
//!
|
|
30
|
+
//! # Transpose Guidelines
|
|
31
|
+
//!
|
|
32
|
+
//! The UEFI specification provides C language symbols and definitions of all
|
|
33
|
+
//! its protocols and features. Those are integral parts of the specification
|
|
34
|
+
//! and UEFI programming is often tightly coupled with the C language. For
|
|
35
|
+
//! better compatibility to existing UEFI documentation, all the rust symbols
|
|
36
|
+
//! are transposed from C following strict rules, aiming for close similarity
|
|
37
|
+
//! to specification. This section gives a rationale on some of the less
|
|
38
|
+
//! obvious choices and tries to describe as many of those rules as possible.
|
|
39
|
+
//!
|
|
40
|
+
//! * `no enums`: Rust enums do not allow random discriminant values. However,
|
|
41
|
+
//! many UEFI enumerations use reserved ranges for vendor defined values.
|
|
42
|
+
//! These cannot be represented with rust enums in an efficient manner.
|
|
43
|
+
//! Hence, any enumerations are turned into rust constants with an
|
|
44
|
+
//! accompanying type alias.
|
|
45
|
+
//!
|
|
46
|
+
//! A detailed discussion can be found in:
|
|
47
|
+
//!
|
|
48
|
+
//! ```gitlog
|
|
49
|
+
//! commit 401a91901e860a5c0cd0f92b75dda0a72cf65322
|
|
50
|
+
//! Author: David Rheinsberg <david.rheinsberg@gmail.com>
|
|
51
|
+
//! Date: Wed Apr 21 12:07:07 2021 +0200
|
|
52
|
+
//!
|
|
53
|
+
//! r-efi: convert enums to constants
|
|
54
|
+
//! ```
|
|
55
|
+
//!
|
|
56
|
+
//! * `no incomplete types`: Several structures use incomplete structure types
|
|
57
|
+
//! by using an unbound array as last member. While rust can easily
|
|
58
|
+
//! represent those within its type-system, such structures become DSTs,
|
|
59
|
+
//! hence even raw pointers to them become fat-pointers, and would thus
|
|
60
|
+
//! violate the UEFI ABI.
|
|
61
|
+
//!
|
|
62
|
+
//! Instead, we use const-generics to allow compile-time adjustment of the
|
|
63
|
+
//! variable-sized structures, with a default value of 0. This allows
|
|
64
|
+
//! computing different sizes of the structures without any runtime overhead.
|
|
65
|
+
//!
|
|
66
|
+
//! * `nullable callbacks as Option`: Rust has no raw function pointers, but
|
|
67
|
+
//! just normal Rust function pointers. Those, however, have no valid null
|
|
68
|
+
//! value. The Rust ABI guarantees that `Option<fn ...>` is an C-ABI
|
|
69
|
+
//! compatible replacement for nullable function pointers, with `None` being
|
|
70
|
+
//! mapped to `NULL`. Hence, whenever UEFI APIs require nullable function
|
|
71
|
+
//! pointers, we use `Option<fn ...>`.
|
|
72
|
+
//!
|
|
73
|
+
//! * `prefer *mut over *const`: Whenever we transpose pointers from the
|
|
74
|
+
//! specification into Rust, we prefer `*mut` in almost all cases. `*const`
|
|
75
|
+
//! should only be used if the underlying value is known not to be accessible
|
|
76
|
+
//! via any other mutable pointer type. Since this is rarely the case in
|
|
77
|
+
//! UEFI, we avoid it.
|
|
78
|
+
//!
|
|
79
|
+
//! The reasoning is that Rust allows coercing immutable types into `*const`
|
|
80
|
+
//! pointers, without any explicit casting required. However, immutable Rust
|
|
81
|
+
//! references require that no other mutable reference exists simultaneously.
|
|
82
|
+
//! This is not a guarantee of `const`-pointers in C / UEFI, hence this
|
|
83
|
+
//! coercion is usually ill-advised or even wrong.
|
|
84
|
+
//!
|
|
85
|
+
//! Lastly, note that `*mut` and `*const` and be `as`-casted in both
|
|
86
|
+
//! directions without violating any Rust guarantees. Any UB concerns always
|
|
87
|
+
//! stem from the safety guarantees of the surrounding code, not of the
|
|
88
|
+
//! raw-pointer handling.
|
|
89
|
+
//!
|
|
90
|
+
//! # Specification Details
|
|
91
|
+
//!
|
|
92
|
+
//! This section lists errata of, and general comments on, the UEFI
|
|
93
|
+
//! specification relevant to the development of `r-efi`:
|
|
94
|
+
//!
|
|
95
|
+
//! * The `Unload` function-pointer of the LoadedImageProtocol can be `NULL`,
|
|
96
|
+
//! despite the protocol documentation lacking any mention of this. Other
|
|
97
|
+
//! parts of the specification refer to images lacking an unload function,
|
|
98
|
+
//! but there is no explicit documentation how this manifests in the
|
|
99
|
+
//! protocol structure. EDK2 assumes `NULL` indicates a lack of unload
|
|
100
|
+
//! function, and an errata has been submitted to the UEFI forum.
|
|
101
|
+
//!
|
|
102
|
+
//! * The specification mandates an 8-byte alignment for the `GUID` structure
|
|
103
|
+
//! However, all widespread implementations (including EDK2) use a 4-byte
|
|
104
|
+
//! alignment. An errata has been reported to EDK2 (still pending).
|
|
105
|
+
//!
|
|
106
|
+
//! # Examples
|
|
107
|
+
//!
|
|
108
|
+
//! To write free-standing UEFI applications, you need to disable the entry-point provided by rust
|
|
109
|
+
//! and instead provide your own. Most target-configurations look for a function called `efi_main`
|
|
110
|
+
//! during linking and set it as entry point. If you use the target-configurations provided with
|
|
111
|
+
//! upstream rust, they will pick the function called `efi_main` as entry-point.
|
|
112
|
+
//!
|
|
113
|
+
//! The following example shows a minimal UEFI application, which simply returns success upon
|
|
114
|
+
//! invocation. Note that you must provide your own panic-handler when running without `libstd`.
|
|
115
|
+
//! In our case, we use a trivial implementation that simply loops forever.
|
|
116
|
+
//!
|
|
117
|
+
//! ```ignore
|
|
118
|
+
//! #![no_main]
|
|
119
|
+
//! #![no_std]
|
|
120
|
+
//!
|
|
121
|
+
//! use r_efi::efi;
|
|
122
|
+
//!
|
|
123
|
+
//! #[panic_handler]
|
|
124
|
+
//! fn panic_handler(_info: &core::panic::PanicInfo) -> ! {
|
|
125
|
+
//! loop {}
|
|
126
|
+
//! }
|
|
127
|
+
//!
|
|
128
|
+
//! #[export_name = "efi_main"]
|
|
129
|
+
//! pub extern fn main(_h: efi::Handle, _st: *mut efi::SystemTable) -> efi::Status {
|
|
130
|
+
//! efi::Status::SUCCESS
|
|
131
|
+
//! }
|
|
132
|
+
//! ```
|
|
133
|
+
|
|
134
|
+
// Mark this crate as `no_std`. We have no std::* dependencies (and we better don't have them),
|
|
135
|
+
// so no reason to require it. This does not mean that you cannot use std::* with UEFI. You have
|
|
136
|
+
// to port it to UEFI first, though.
|
|
137
|
+
//
|
|
138
|
+
// In case of unit-test compilation, we pull in `std` and drop the `no_std` marker. This allows
|
|
139
|
+
// basic unit-tests on the compilation host. For integration tests, we have separate compilation
|
|
140
|
+
// units, so they will be unaffected by this.
|
|
141
|
+
#![cfg_attr(not(test), no_std)]
|
|
142
|
+
|
|
143
|
+
// Import the different core modules. We separate them into different modules to make it easier to
|
|
144
|
+
// work on them and describe what each part implements. This is different to the reference
|
|
145
|
+
// implementation, which uses a flat namespace due to its origins in the C language. For
|
|
146
|
+
// compatibility, we provide this flat namespace as well. See the `efi` submodule.
|
|
147
|
+
#[macro_use]
|
|
148
|
+
pub mod base;
|
|
149
|
+
#[macro_use]
|
|
150
|
+
pub mod hii;
|
|
151
|
+
#[macro_use]
|
|
152
|
+
pub mod system;
|
|
153
|
+
|
|
154
|
+
// Import the protocols. Each protocol is separated into its own module, readily imported by the
|
|
155
|
+
// meta `protocols` module. Note that this puts all symbols into their respective protocol
|
|
156
|
+
// namespace, thus clearly separating them (unlike the UEFI Specification, which more often than
|
|
157
|
+
// not violates its own namespacing).
|
|
158
|
+
pub mod protocols;
|
|
159
|
+
|
|
160
|
+
// Import vendor protocols. They are just like protocols in `protocols`, but
|
|
161
|
+
// separated for better namespacing.
|
|
162
|
+
pub mod vendor;
|
|
163
|
+
|
|
164
|
+
/// Flat EFI Namespace
|
|
165
|
+
///
|
|
166
|
+
/// The EFI namespace re-exports all symbols in a single, flat namespace. This allows mirroring
|
|
167
|
+
/// the entire EFI namespace as given in the specification and makes it easier to refer to them
|
|
168
|
+
/// with the same names as the reference C implementation.
|
|
169
|
+
///
|
|
170
|
+
/// Note that the individual protocols are put into submodules. The specification does this in
|
|
171
|
+
/// most parts as well (by prefixing all symbols). This is not true in all cases, as the
|
|
172
|
+
/// specification suffers from lack of namespaces in the reference C language. However, we decided
|
|
173
|
+
/// to namespace the remaining bits as well, for better consistency throughout the API. This
|
|
174
|
+
/// should be self-explanatory in nearly all cases.
|
|
175
|
+
pub mod efi {
|
|
176
|
+
pub use crate::base::*;
|
|
177
|
+
pub use crate::system::*;
|
|
178
|
+
|
|
179
|
+
pub use crate::hii;
|
|
180
|
+
pub use crate::protocols;
|
|
181
|
+
pub use crate::vendor;
|
|
182
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//! Absolute Pointer Protocol
|
|
2
|
+
//!
|
|
3
|
+
//! Provides a simple method for accessing absolute pointer devices. This
|
|
4
|
+
//! includes devices such as touch screens and digitizers. The Absolute Pointer
|
|
5
|
+
//! Protocol allows information about a pointer device to be retrieved. The
|
|
6
|
+
//! protocol is attached to the device handle of an absolute pointer device,
|
|
7
|
+
//! and can be used for input from the user in the preboot environment.
|
|
8
|
+
//!
|
|
9
|
+
//! Supported devices may return 1, 2, or 3 axis of information. The Z axis may
|
|
10
|
+
//! optionally be used to return pressure data measurements derived from user
|
|
11
|
+
//! pen force.
|
|
12
|
+
//!
|
|
13
|
+
//! All supported devices must support a touch-active status. Supported devices
|
|
14
|
+
//! may optionally support a second input button, for example a pen
|
|
15
|
+
//! side-button.
|
|
16
|
+
|
|
17
|
+
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
|
|
18
|
+
0x8d59d32b,
|
|
19
|
+
0xc655,
|
|
20
|
+
0x4ae9,
|
|
21
|
+
0x9b,
|
|
22
|
+
0x15,
|
|
23
|
+
&[0xf2, 0x59, 0x04, 0x99, 0x2a, 0x43],
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
pub const SUPPORTS_ALT_ACTIVE: u32 = 0x00000001;
|
|
27
|
+
pub const SUPPORTS_PRESSURE_AS_Z: u32 = 0x00000002;
|
|
28
|
+
|
|
29
|
+
#[derive(Clone, Copy, Debug, Default)]
|
|
30
|
+
#[repr(C)]
|
|
31
|
+
pub struct Mode {
|
|
32
|
+
pub absolute_min_x: u64,
|
|
33
|
+
pub absolute_min_y: u64,
|
|
34
|
+
pub absolute_min_z: u64,
|
|
35
|
+
pub absolute_max_x: u64,
|
|
36
|
+
pub absolute_max_y: u64,
|
|
37
|
+
pub absolute_max_z: u64,
|
|
38
|
+
pub attributes: u32,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
pub const TOUCH_ACTIVE: u32 = 0x00000001;
|
|
42
|
+
pub const ALT_ACTIVE: u32 = 0x00000002;
|
|
43
|
+
|
|
44
|
+
#[derive(Clone, Copy, Debug, Default)]
|
|
45
|
+
#[repr(C)]
|
|
46
|
+
pub struct State {
|
|
47
|
+
pub current_x: u64,
|
|
48
|
+
pub current_y: u64,
|
|
49
|
+
pub current_z: u64,
|
|
50
|
+
pub active_buttons: u32,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
pub type Reset = eficall! {fn(
|
|
54
|
+
this: *mut Protocol,
|
|
55
|
+
extended_verification: bool,
|
|
56
|
+
) -> crate::base::Status};
|
|
57
|
+
|
|
58
|
+
pub type GetState = eficall! {fn(
|
|
59
|
+
this: *mut Protocol,
|
|
60
|
+
state: *mut State,
|
|
61
|
+
) -> crate::base::Status};
|
|
62
|
+
|
|
63
|
+
#[repr(C)]
|
|
64
|
+
pub struct Protocol {
|
|
65
|
+
pub reset: Reset,
|
|
66
|
+
pub get_state: GetState,
|
|
67
|
+
pub wait_for_input: crate::efi::Event,
|
|
68
|
+
pub mode: *mut Mode,
|
|
69
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//! Block I/O Protocol
|
|
2
|
+
//!
|
|
3
|
+
//! Used to abstract mass storage devices to allow code running in the EFI boot services environment
|
|
4
|
+
//! to access the storage devices without specific knowledge of the type of device or controller that
|
|
5
|
+
//! manages the device.
|
|
6
|
+
|
|
7
|
+
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
|
|
8
|
+
0x964e5b21,
|
|
9
|
+
0x6459,
|
|
10
|
+
0x11d2,
|
|
11
|
+
0x8e,
|
|
12
|
+
0x39,
|
|
13
|
+
&[0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
pub const REVISION: u64 = 0x0000000000010000u64;
|
|
17
|
+
pub const REVISION2: u64 = 0x0000000000020001u64;
|
|
18
|
+
pub const REVISION3: u64 = 0x000000000002001fu64;
|
|
19
|
+
|
|
20
|
+
#[repr(C)]
|
|
21
|
+
#[derive(Clone, Copy, Debug)]
|
|
22
|
+
pub struct Media {
|
|
23
|
+
pub media_id: u32,
|
|
24
|
+
pub removable_media: bool,
|
|
25
|
+
pub media_present: bool,
|
|
26
|
+
pub logical_partition: bool,
|
|
27
|
+
pub read_only: bool,
|
|
28
|
+
pub write_caching: bool,
|
|
29
|
+
pub block_size: u32,
|
|
30
|
+
pub io_align: u32,
|
|
31
|
+
pub last_block: crate::base::Lba,
|
|
32
|
+
pub lowest_aligned_lba: crate::base::Lba,
|
|
33
|
+
pub logical_blocks_per_physical_block: u32,
|
|
34
|
+
pub optimal_transfer_length_granularity: u32,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
pub type ProtocolReset = eficall! {fn(
|
|
38
|
+
*mut Protocol,
|
|
39
|
+
crate::base::Boolean,
|
|
40
|
+
) -> crate::base::Status};
|
|
41
|
+
|
|
42
|
+
pub type ProtocolReadBlocks = eficall! {fn(
|
|
43
|
+
*mut Protocol,
|
|
44
|
+
u32,
|
|
45
|
+
crate::base::Lba,
|
|
46
|
+
usize,
|
|
47
|
+
*mut core::ffi::c_void,
|
|
48
|
+
) -> crate::base::Status};
|
|
49
|
+
|
|
50
|
+
pub type ProtocolWriteBlocks = eficall! {fn(
|
|
51
|
+
*mut Protocol,
|
|
52
|
+
u32,
|
|
53
|
+
crate::base::Lba,
|
|
54
|
+
usize,
|
|
55
|
+
*mut core::ffi::c_void,
|
|
56
|
+
) -> crate::base::Status};
|
|
57
|
+
|
|
58
|
+
pub type ProtocolFlushBlocks = eficall! {fn(
|
|
59
|
+
*mut Protocol,
|
|
60
|
+
) -> crate::base::Status};
|
|
61
|
+
|
|
62
|
+
#[repr(C)]
|
|
63
|
+
pub struct Protocol {
|
|
64
|
+
pub revision: u64,
|
|
65
|
+
pub media: *const Media,
|
|
66
|
+
pub reset: ProtocolReset,
|
|
67
|
+
pub read_blocks: ProtocolReadBlocks,
|
|
68
|
+
pub write_blocks: ProtocolWriteBlocks,
|
|
69
|
+
pub flush_blocks: ProtocolFlushBlocks,
|
|
70
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//! Bus Specific Driver Override Protocol
|
|
2
|
+
//!
|
|
3
|
+
//! This protocol matches one or more drivers to a controller. This protocol is
|
|
4
|
+
//! produced by a bus driver, and it is installed on the child handles of buses
|
|
5
|
+
//! that require a bus specific algorithm for matching drivers to controllers.
|
|
6
|
+
//! This protocol is used by the `EFI_BOOT_SERVICES.ConnectController()` boot
|
|
7
|
+
//! service to select the best driver for a controller. All of the drivers
|
|
8
|
+
//! returned by this protocol have a higher precedence than drivers found in
|
|
9
|
+
//! the general EFI Driver Binding search algorithm, but a lower precedence
|
|
10
|
+
//! than those drivers returned by the EFI Platform Driver Override Protocol.
|
|
11
|
+
//! If more than one driver image handle is returned by this protocol, then the
|
|
12
|
+
//! drivers image handles are returned in order from highest precedence to
|
|
13
|
+
//! lowest precedence.
|
|
14
|
+
|
|
15
|
+
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
|
|
16
|
+
0x3bc1b285,
|
|
17
|
+
0x8a15,
|
|
18
|
+
0x4a82,
|
|
19
|
+
0xaa,
|
|
20
|
+
0xbf,
|
|
21
|
+
&[0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65],
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
pub type ProtocolGetDriver = eficall! {fn(
|
|
25
|
+
*mut Protocol,
|
|
26
|
+
*mut crate::base::Handle,
|
|
27
|
+
) -> crate::base::Status};
|
|
28
|
+
|
|
29
|
+
#[repr(C)]
|
|
30
|
+
pub struct Protocol {
|
|
31
|
+
pub get_driver: ProtocolGetDriver,
|
|
32
|
+
}
|