From ab6c9c67bf1d5365812c1a7818bd92899a54d164 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 10 Feb 2026 21:16:09 +0800 Subject: [PATCH] uefi: Upgrade uefi and framework_lib Update framework_lib to latest main (v0.6.7). Needs uefi 0.41. - Drop uefi-services and our uefi-rs fork, upstream uefi now has the ShellParameters protocol - Use the uefi::boot and uefi::runtime free functions instead of passing BootServices/SystemTable around - Replace the hand-written UsbIo protocol with upstream uefi::proto::usb::io::UsbIo - ResetType::Cold/Shutdown -> ResetType::COLD/SHUTDOWN - stall and TimerTrigger take a Duration - wait_for_key_event returns an owned Event, no unsafe_clone needed - framework_lib's get_smbios returns a dmidecode based SmbiosStore, replace smbios-lib with dmidecode to read the BIOS version - InputDeckStatus has a new touchpad_id field - Bump built to 0.8 and rust-version to 1.89, required by framework_lib Signed-off-by: Daniel Schaefer --- Cargo.lock | 1034 +++++++++++++++++++++--------------------- Cargo.toml | 19 +- flake.nix | 4 - src/drawing.rs | 2 +- src/ec_comm.rs | 9 + src/main.rs | 70 ++- src/shell_params.rs | 45 -- src/sleep.rs | 18 +- src/state_machine.rs | 128 +++--- src/uefi_usb.rs | 150 +----- 10 files changed, 646 insertions(+), 833 deletions(-) delete mode 100644 src/shell_params.rs diff --git a/Cargo.lock b/Cargo.lock index dd975f1..0ddd400 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -27,7 +27,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" dependencies = [ "anstyle", - "anstyle-parse", + "anstyle-parse 0.2.7", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse 1.0.0", "anstyle-query", "anstyle-wincon", "colorchoice", @@ -37,9 +52,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" @@ -50,6 +65,15 @@ dependencies = [ "utf8parse", ] +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + [[package]] name = "anstyle-query" version = "1.1.3" @@ -88,12 +112,6 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.9.1" @@ -111,11 +129,10 @@ dependencies = [ [[package]] name = "built" -version = "0.5.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9c056b9ed43aee5e064b683aa1ec783e19c6acec7559e3ae931b7490472fbe" +checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64" dependencies = [ - "cargo-lock", "chrono", "git2", ] @@ -132,18 +149,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "cargo-lock" -version = "8.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031718ddb8f78aa5def78a09e90defe30151d1f6c672f937af4dd916429ed996" -dependencies = [ - "semver", - "serde", - "toml", - "url", -] - [[package]] name = "cc" version = "1.0.79" @@ -165,24 +170,33 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core", +] + [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" dependencies = [ "iana-time-zone", - "num-integer", "num-traits", - "serde", - "winapi", + "windows-link 0.2.1", ] [[package]] name = "clap" -version = "4.5.39" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" dependencies = [ "clap_builder", "clap_derive", @@ -199,9 +213,9 @@ dependencies = [ [[package]] name = "clap-verbosity-flag" -version = "2.2.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34c77f67047557f62582784fd7482884697731b2932c7d37ced54bce2312e1e2" +checksum = "9d92b1fab272fe943881b77cc6e920d6543e5b1bfadbd5ed81c7c5a755742394" dependencies = [ "clap", "log", @@ -209,33 +223,52 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.39" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "clap_lex", "strsim", ] +[[package]] +name = "clap_complete" +version = "4.5.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "430b4dc2b5e3861848de79627b2bedc9f3342c7da5173a14eaa5d0f8dc18ae5d" +dependencies = [ + "clap", +] + [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.101", + "syn 3.0.9", ] [[package]] name = "clap_lex" -version = "0.7.4" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" + +[[package]] +name = "clap_mangen" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "211d617eaa4b735c96c9e0228fcbdb5120ef623f2b8cb67ffb84c3e02dbc28a4" +dependencies = [ + "clap", + "roff", +] [[package]] name = "codespan-reporting" @@ -254,38 +287,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] -name = "convert_case" -version = "0.4.0" +name = "core-foundation-sys" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] -name = "core-foundation" -version = "0.6.4" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "core-foundation-sys 0.6.2", "libc", ] -[[package]] -name = "core-foundation-sys" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - [[package]] name = "cpufeatures" -version = "0.2.17" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" dependencies = [ "libc", ] @@ -345,26 +365,34 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.99.17" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", - "syn 1.0.109", + "syn 2.0.101", ] [[package]] -name = "digest" -version = "0.10.7" +name = "dmidecode" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "a898086945b8e1c1e12f0996773ae65442d84f8dcafd5ab88a4c80b1da3d3008" dependencies = [ - "block-buffer", - "crypto-common", + "bitflags", + "uuid", ] [[package]] @@ -406,7 +434,7 @@ version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" dependencies = [ - "anstream", + "anstream 0.6.19", "anstyle", "env_filter", "jiff", @@ -424,131 +452,48 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] [[package]] name = "framework_lib" -version = "0.4.3" -source = "git+https://github.com/FrameworkComputer/framework-system?rev=v0.4.3#00023c55736ce689547be8603cd4b3b2adc16a8d" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d6233cb19fc42103c38e179ac2f379921b823912f5f07a9a3ea30a01260734" dependencies = [ "built", "clap", "clap-num", "clap-verbosity-flag", + "clap_complete", + "clap_mangen", + "dmidecode", "env_logger", "guid-create", "lazy_static", "libc", "log", - "nix 0.29.0", + "nix", "no-std-compat", "num", "num-derive", "num-traits", "plain", - "redox_hwio", + "rand", "regex", + "sha1", "sha2", - "smbios-lib", - "spin 0.9.8", + "spin 0.12.3", "uefi", - "uefi-services", - "windows 0.59.0", - "wmi", -] - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-executor" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.101", -] - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", + "uefi-raw", + "windows 0.62.2", + "windows-version", + "winreg", + "zerocopy", ] [[package]] @@ -568,21 +513,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "084c6b182b01dec54ff12986b9cc8859a9b0d92b074f878c382a4481a070e66e" [[package]] -name = "getopts" -version = "0.2.21" +name = "getrandom" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ - "unicode-width", + "cfg-if", + "libc", + "r-efi", + "rand_core", ] [[package]] name = "git2" -version = "0.15.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1" +checksum = "7b88256088d75a56f8ecfa070513a775dd9107f6530ef14919dac831af9cfe2b" dependencies = [ - "bitflags 1.3.2", + "bitflags", "libc", "libgit2-sys", "log", @@ -591,8 +539,9 @@ dependencies = [ [[package]] name = "guid-create" -version = "0.4.1" -source = "git+https://github.com/FrameworkComputer/guid-create?branch=no-rand#84c3ad2e8b64a12beebb460804a65da55434cfd9" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c525e972d6c182cab88bf69fe99a1a07e153f142453fe44d7e122409c77c5177" dependencies = [ "winapi", ] @@ -610,7 +559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", - "core-foundation-sys 0.8.4", + "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", @@ -627,14 +576,106 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + [[package]] name = "idna" -version = "0.3.0" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", ] [[package]] @@ -643,40 +684,23 @@ version = "0.3.17" dependencies = [ "built", "cfg-if", + "dmidecode", "embedded-graphics", "framework_lib", "getargs", "log", "redox_hwio", - "smbios-lib", "uefi", - "uefi-services", "zune-core", "zune-png", ] -[[package]] -name = "io-kit-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f21dcc74995dd4cd090b147e79789f8d65959cbfb5f0b118002db869ea3bd0a0" -dependencies = [ - "core-foundation-sys 0.6.2", - "mach 0.2.3", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - [[package]] name = "jiff" version = "0.2.14" @@ -730,15 +754,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.172" +version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" [[package]] name = "libgit2-sys" -version = "0.14.2+1.5.1" +version = "0.18.3+1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4" +checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" dependencies = [ "cc", "libc", @@ -767,6 +791,12 @@ dependencies = [ "cc", ] +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + [[package]] name = "lock_api" version = "0.4.9" @@ -783,39 +813,12 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" -[[package]] -name = "mach" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" -dependencies = [ - "libc", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "micromath" version = "2.1.0" @@ -824,25 +827,11 @@ checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815" [[package]] name = "nix" -version = "0.25.1" +version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset", - "pin-utils", -] - -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.9.1", + "bitflags", "cfg-if", "cfg_aliases", "libc", @@ -878,13 +867,13 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.4.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +checksum = "e4e98dc3b890f6c23a0f9d3d491a2823d0dea0fa656302a13dd225fa924112a8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 3.0.9", ] [[package]] @@ -942,21 +931,9 @@ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "percent-encoding" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pkg-config" @@ -985,52 +962,80 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] [[package]] name = "ptr_meta" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcada80daa06c42ed5f48c9a043865edea5dc44cbf9ac009fda3b89526e28607" +checksum = "0b9a0cf95a1196af61d4f1cbdab967179516d9a4a4312af1f31948f8f6224a79" dependencies = [ "ptr_meta_derive", ] [[package]] name = "ptr_meta_derive" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca9224df2e20e7c5548aeb5f110a0f3b77ef05f8585139b7148b59056168ed2" +checksum = "7347867d0a7e1208d93b46767be83e2b8f978c3dad35f775ac8d8847551d6fe1" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.101", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "redox_hwio" version = "0.1.6" source = "git+https://github.com/FrameworkComputer/rust-hwio?branch=freebsd#9bcff4277d8f3d7dce2b12c6ad81d092ae35c4ba" -dependencies = [ - "lazy_static", - "nix 0.25.1", -] [[package]] name = "regex" @@ -1062,19 +1067,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] -name = "rustc_version" -version = "0.4.0" +name = "roff" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "323c417e1d9665a65b263ec744ba09030cfb277e9daa0b018a4ab62e57bc8189" [[package]] name = "scopeguard" @@ -1088,15 +1084,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" -[[package]] -name = "semver" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" -dependencies = [ - "serde", -] - [[package]] name = "serde" version = "1.0.219" @@ -1118,14 +1105,14 @@ dependencies = [ ] [[package]] -name = "serde_json" -version = "1.0.95" +name = "sha1" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" dependencies = [ - "itoa", - "ryu", - "serde", + "cfg-if", + "cpufeatures 0.2.17", + "digest", ] [[package]] @@ -1135,7 +1122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -1146,29 +1133,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "238abfbb77c1915110ad968465608b68e869e0772622c9656714e73e5a1a522f" [[package]] -name = "slab" -version = "0.4.9" +name = "smallvec" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smbios-lib" -version = "0.9.1" -source = "git+https://github.com/FrameworkComputer/smbios-lib.git?branch=no-std#b3e2fff8a6f4b8c2d729467cbbf0c8c41974cd1c" -dependencies = [ - "core-foundation", - "core-foundation-sys 0.6.2", - "getopts", - "io-kit-sys", - "libc", - "mach 0.3.2", - "no-std-compat", - "serde", - "serde_json", -] +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "spin" @@ -1178,13 +1146,19 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" -version = "0.9.8" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +checksum = "0134f9043ed38b087ac4f7d4af44c79e2c9e5094421fe3164f435ce585953b10" dependencies = [ "lock_api", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + [[package]] name = "strsim" version = "0.11.1" @@ -1214,28 +1188,21 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "2.0.12" +name = "syn" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" dependencies = [ - "thiserror-impl", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "thiserror-impl" -version = "2.0.12" +name = "synstructure" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", @@ -1243,27 +1210,22 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.6.0" +name = "termcolor" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ - "tinyvec_macros", + "winapi-util", ] [[package]] -name = "tinyvec_macros" -version = "0.1.1" +name = "tinystr" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ - "serde", + "displaydoc", + "zerovec", ] [[package]] @@ -1274,52 +1236,55 @@ checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "ucs2" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad643914094137d475641b6bab89462505316ec2ce70907ad20102d28a79ab8" +checksum = "df79298e11f316400c57ec268f3c2c29ac3c4d4777687955cd3d4f3a35ce7eba" dependencies = [ "bit_field", ] [[package]] name = "uefi" -version = "0.20.0" -source = "git+https://github.com/FrameworkComputer/uefi-rs?branch=merged#95165e1adde99da7a460320538d908af8b55f87f" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368cef7d94514897e6dad4350945c7910a9f5bf9021191d1c58ee3ec09962697" dependencies = [ - "bitflags 1.3.2", - "derive_more", + "bitflags", + "cfg-if", "log", "ptr_meta", "ucs2", "uefi-macros", + "uefi-raw", + "uguid", ] [[package]] name = "uefi-macros" -version = "0.11.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0caeb0e7b31b9f1f347e541106be10aa8c66c76fa722a3298a4cd21433fabd4" +checksum = "643efa8b64be89780bc498b290fab04337c7c4d171cc82cce2e133a74616dcc4" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 3.0.9", ] [[package]] -name = "uefi-services" +name = "uefi-raw" version = "0.17.0" -source = "git+https://github.com/FrameworkComputer/uefi-rs?branch=merged#95165e1adde99da7a460320538d908af8b55f87f" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3636327a6d88a38c0f2567fb695ec7ba27b3483d1877730486605aa0866da201" dependencies = [ - "cfg-if", - "log", - "uefi", + "bitflags", + "uguid", ] [[package]] -name = "unicode-bidi" -version = "0.3.13" +name = "uguid" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "0c8352f8c05e47892e7eaf13b34abd76a7f4aeaf817b716e88789381927f199c" [[package]] name = "unicode-ident" @@ -1327,15 +1292,6 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-width" version = "0.1.10" @@ -1344,21 +1300,34 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "url" -version = "2.3.1" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "1.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" + [[package]] name = "vcpkg" version = "0.2.15" @@ -1467,77 +1436,54 @@ dependencies = [ [[package]] name = "windows" -version = "0.59.0" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f919aee0a93304be7f62e8e5027811bbba96bcb1de84d6618be56e43f8a32a1" -dependencies = [ - "windows-core 0.59.0", - "windows-targets 0.53.0", -] - -[[package]] -name = "windows" -version = "0.60.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf874e74c7a99773e62b1c671427abf01a425e77c3d3fb9fb1e4883ea934529" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ "windows-collections", - "windows-core 0.60.1", + "windows-core", "windows-future", - "windows-link", "windows-numerics", ] [[package]] name = "windows-collections" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5467f79cc1ba3f52ebb2ed41dbb459b8e7db636cc3429458d9a852e15bc24dec" -dependencies = [ - "windows-core 0.60.1", -] - -[[package]] -name = "windows-core" -version = "0.59.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "810ce18ed2112484b0d4e15d022e5f598113e220c53e373fb31e67e21670c1ce" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "windows-implement", - "windows-interface", - "windows-result", - "windows-strings", - "windows-targets 0.53.0", + "windows-core", ] [[package]] name = "windows-core" -version = "0.60.1" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca21a92a9cae9bf4ccae5cf8368dce0837100ddf6e6d57936749e85f152f6247" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.2.1", "windows-result", "windows-strings", ] [[package]] name = "windows-future" -version = "0.1.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a787db4595e7eb80239b74ce8babfb1363d8e343ab072f2ffe901400c03349f0" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "windows-core 0.60.1", - "windows-link", + "windows-core", + "windows-link 0.2.1", + "windows-threading", ] [[package]] name = "windows-implement" -version = "0.59.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83577b051e2f49a058c308f17f273b570a6a758386fc291b5f6a934dd84e48c1" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", @@ -1546,9 +1492,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.1" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", @@ -1557,36 +1503,42 @@ dependencies = [ [[package]] name = "windows-link" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-link" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b39de7c7fe78858b0144c50c3fc000bab3be17d5e9b85b1053871693c7f7415" [[package]] name = "windows-numerics" -version = "0.1.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "005dea54e2f6499f2cee279b8f703b3cf3b5734a2d8d21867c8f44003182eeed" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-core 0.60.1", - "windows-link", + "windows-core", + "windows-link 0.2.1", ] [[package]] name = "windows-result" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] [[package]] name = "windows-strings" -version = "0.3.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -1622,7 +1574,7 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", + "windows_i686_gnullvm", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", @@ -1630,19 +1582,21 @@ dependencies = [ ] [[package]] -name = "windows-targets" -version = "0.53.0" +name = "windows-threading" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-version" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5d2a42ae19ff386c4680514519a225a2a99bcfada6aff0ab3766f928ff84365" +dependencies = [ + "windows-link 0.100.0", ] [[package]] @@ -1657,12 +1611,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" @@ -1675,12 +1623,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - [[package]] name = "windows_i686_gnu" version = "0.48.0" @@ -1693,24 +1635,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - [[package]] name = "windows_i686_msvc" version = "0.48.0" @@ -1723,12 +1653,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" @@ -1741,12 +1665,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" @@ -1759,12 +1677,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - [[package]] name = "windows_x86_64_msvc" version = "0.48.0" @@ -1778,24 +1690,116 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" +name = "winreg" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" +dependencies = [ + "cfg-if", + "windows-sys", +] + +[[package]] +name = "writeable" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] -name = "wmi" -version = "0.15.2" +name = "yoke" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f902b4592b911109e7352bcfec7b754b07ec71e514d7dfa280eaef924c1cb08" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ - "chrono", - "futures", - "log", - "serde", - "thiserror", - "windows 0.60.0", - "windows-core 0.60.1", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 27d37b3..a8b4ffe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "inputmodules" version = "0.3.17" edition = "2021" -rust-version = "1.61" +rust-version = "1.89" build = "build.rs" readme = "../README.md" license = "BSD-3-Clause" @@ -13,24 +13,17 @@ qemu = [] azalea = [] [build-dependencies] -built = { version = "0.5.0", default-features = false, features = ["chrono", "git2"] } +built = { version = "0.8", default-features = false, features = ["chrono", "git2"] } [dependencies] cfg-if = "1.0.0" embedded-graphics = "0.8.1" getargs = { version = "0.5.0", default-features = false } log = "0.4.27" -uefi = { version = "0.20", features = ["alloc"] } -uefi-services = "0.17" +uefi = { version = "0.41", features = ["alloc", "global_allocator", "logger", "panic_handler"] } zune-core = "0.4.12" redox_hwio = { git = "https://github.com/FrameworkComputer/rust-hwio", branch = "freebsd", default-features = false } -smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std", default-features = false } - -# Temporarily override because we need pending PRs for -# for the Shell and ShellParameters protocols -[patch.crates-io] -uefi = { git = "https://github.com/FrameworkComputer/uefi-rs", branch = "merged" } -uefi-services = { git = "https://github.com/FrameworkComputer/uefi-rs", branch = "merged" } +dmidecode = { version = "1", default-features = false } [dependencies.zune-png] version = "0.4.10" @@ -38,9 +31,7 @@ default-features = false [dependencies.framework_lib] #path = "/home/zoid/clone/framework-system/framework_lib" -git = "https://github.com/FrameworkComputer/framework-system" -rev = "v0.4.3" -#branch = "main" +version = "0.6.7" features = ["uefi"] default-features = false diff --git a/flake.nix b/flake.nix index 6f664e0..5736ccf 100644 --- a/flake.nix +++ b/flake.nix @@ -85,11 +85,7 @@ cargoLock = { lockFile = ./Cargo.lock; outputHashes = { - "framework_lib-0.4.3" = "sha256-gO7ieyVQzK3BkNsy451WNtrx51jlzd6vhwJX8RDoj/o="; - "guid-create-0.4.1" = "sha256-tf38uNtC8YhDN4TZ3yfj4oOG3mYccHPa962YCLkVx4g="; "redox_hwio-0.1.6" = "sha256-knLIZ7yp42SQYk32NGq3SUGvJFVumFhD64Njr5TRdFs="; - "smbios-lib-0.9.1" = "sha256-3L8JaA75j9Aaqg1z9lVs61m6CvXDeQprEFRq+UDCHQo="; - "uefi-0.20.0" = "sha256-2lUd2a+7NvS94LyAHE2BwGV4j6607mbPXE5htrwdz04="; }; }; diff --git a/src/drawing.rs b/src/drawing.rs index e498942..3b92c5a 100644 --- a/src/drawing.rs +++ b/src/drawing.rs @@ -15,8 +15,8 @@ use framework_lib::chromium_ec::input_deck::{InputModuleType, TopRowPositions}; use framework_lib::power::ReducedPowerInfo; #[allow(unused_imports)] use log::{debug, error, info, trace}; +use uefi::boot::ScopedProtocol; use uefi::proto::console::gop::GraphicsOutput; -use uefi::table::boot::ScopedProtocol; use zune_core::result::DecodingResult; use zune_png::PngDecoder; diff --git a/src/ec_comm.rs b/src/ec_comm.rs index 080c4a7..c1d5954 100644 --- a/src/ec_comm.rs +++ b/src/ec_comm.rs @@ -83,6 +83,7 @@ pub fn get_input_deck(ec: &Option) -> InputDeckStatus { state: InputDeckState::On, hubboard_present: true, touchpad_present: true, + touchpad_id: InputModuleType::Touchpad as u8, top_row: TopRowPositions { pos0: InputModuleType::KeyboardA, pos1: InputModuleType::Disconnected, @@ -95,6 +96,7 @@ pub fn get_input_deck(ec: &Option) -> InputDeckStatus { state: InputDeckState::On, hubboard_present: false, touchpad_present: true, + touchpad_id: InputModuleType::Touchpad as u8, top_row: TopRowPositions { pos0: InputModuleType::GenericB, pos1: InputModuleType::Disconnected, @@ -350,6 +352,7 @@ pub fn keypress_mock_data( state: input_deck::InputDeckState::Disconnected, hubboard_present: true, touchpad_present: true, + touchpad_id: InputModuleType::Touchpad as u8, top_row: input_deck::TopRowPositions { pos0: input_deck::InputModuleType::Disconnected, pos1: input_deck::InputModuleType::Disconnected, @@ -365,6 +368,7 @@ pub fn keypress_mock_data( state: input_deck::InputDeckState::Disconnected, hubboard_present: true, touchpad_present: false, + touchpad_id: InputModuleType::Disconnected as u8, top_row: input_deck::TopRowPositions { pos0: input_deck::InputModuleType::Disconnected, pos1: input_deck::InputModuleType::Disconnected, @@ -380,6 +384,7 @@ pub fn keypress_mock_data( state: input_deck::InputDeckState::Disconnected, hubboard_present: true, touchpad_present: false, + touchpad_id: InputModuleType::Disconnected as u8, top_row: input_deck::TopRowPositions { pos0: input_deck::InputModuleType::GenericC, pos1: input_deck::InputModuleType::Disconnected, @@ -395,6 +400,7 @@ pub fn keypress_mock_data( state: input_deck::InputDeckState::Disconnected, hubboard_present: true, touchpad_present: false, + touchpad_id: InputModuleType::Disconnected as u8, top_row: input_deck::TopRowPositions { pos0: input_deck::InputModuleType::GenericC, pos1: input_deck::InputModuleType::GenericC, @@ -410,6 +416,7 @@ pub fn keypress_mock_data( state: input_deck::InputDeckState::Disconnected, hubboard_present: true, touchpad_present: false, + touchpad_id: InputModuleType::Disconnected as u8, top_row: input_deck::TopRowPositions { pos0: input_deck::InputModuleType::GenericC, pos1: input_deck::InputModuleType::GenericC, @@ -425,6 +432,7 @@ pub fn keypress_mock_data( state: input_deck::InputDeckState::On, hubboard_present: true, touchpad_present: true, + touchpad_id: InputModuleType::Touchpad as u8, top_row: input_deck::TopRowPositions { pos0: input_deck::InputModuleType::GenericC, pos1: input_deck::InputModuleType::GenericC, @@ -440,6 +448,7 @@ pub fn keypress_mock_data( state: input_deck::InputDeckState::On, hubboard_present: true, touchpad_present: true, + touchpad_id: InputModuleType::Touchpad as u8, top_row: input_deck::TopRowPositions { pos0: input_deck::InputModuleType::FullWidth, pos1: input_deck::InputModuleType::Disconnected, diff --git a/src/main.rs b/src/main.rs index 92a0547..00c4c0f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,17 +4,18 @@ extern crate alloc; -use alloc::string::ToString; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; use framework_lib::chromium_ec::input_deck::InputDeckState; use framework_lib::chromium_ec::{print_err, CrosEc}; #[allow(unused_imports)] use log::{debug, error, info, trace}; +use uefi::boot::{self, OpenProtocolAttributes, OpenProtocolParams, SearchType}; use uefi::prelude::*; -use uefi::proto::shell_params::*; -use uefi::table::boot::{OpenProtocolAttributes, OpenProtocolParams, SearchType}; +use uefi::proto::shell_params::ShellParameters; use uefi::Identify; #[allow(unused_imports)] -use uefi_services::{print, println}; +use uefi::{print, println}; mod buffer; mod drawing; @@ -33,14 +34,10 @@ struct BiosSettings { inputmodule_setting: Option, } -fn get_bios_settings(boot_services: &BootServices) -> Option { +fn get_bios_settings() -> Option { // If the protocol isn't present, assume nothing is disabled and show the UI - let oem_handle = boot_services - .get_handle_for_protocol::() - .ok()?; - let oem = boot_services - .open_protocol_exclusive::(oem_handle) - .ok()?; + let oem_handle = boot::get_handle_for_protocol::().ok()?; + let oem = boot::open_protocol_exclusive::(oem_handle).ok()?; Some(BiosSettings { standalone_mode: oem.standalone_mode_enabled(), @@ -57,8 +54,8 @@ fn get_bios_settings(boot_services: &BootServices) -> Option { /// - dGPU PD is outdated /// - Fan has issues /// - Interposer or door has issues -fn show_ui(boot_services: &BootServices) -> Option { - let settings = get_bios_settings(boot_services)?; +fn show_ui() -> Option { + let settings = get_bios_settings()?; let require_inputmodules = settings.inputmodule_setting == Some(oem_variable::InputmoduleSetting::RequireModules); @@ -85,24 +82,23 @@ pub unsafe extern "C" fn wcslen(s: *const u16) -> usize { } #[entry] -fn main(image_handle: Handle, mut system_table: SystemTable) -> Status { - let event = uefi_services::init(&mut system_table).unwrap(); - let boot_services = system_table.boot_services(); +fn main() -> Status { + uefi::helpers::init().unwrap(); // Only error prints in release build #[cfg(not(debug_assertions))] log::set_max_level(log::LevelFilter::Error); - let arg = get_shell_action(boot_services); + let arg = get_shell_action(); if let Ok(ShellAction::Info) = arg { println!("Provide Parameter: 'gui' to launch UI and show issues"); println!("Provide Parameter: 'force' to launch UI even if everything is ok"); println!("Provide Parameter: 'gop' to print GOP debugging info"); println!(); - print_module_status(&boot_services); + print_module_status(); } else if let Ok(ShellAction::GopInfo) = arg { println!("GOP Info"); - state_machine::print_gop_info(boot_services); + state_machine::print_gop_info(); } else { info!("No shell arg, launching GUI"); @@ -114,11 +110,11 @@ fn main(image_handle: Handle, mut system_table: SystemTable) -> Status { let force_ui = matches!(arg, Ok(ShellAction::Force)); // Show the UI if we can't tell the BIOS settings or they indicate we need to show the UI - let show_ui = show_ui(boot_services) != Some(false); + let show_ui = show_ui() != Some(false); let reset = if force_ui || show_ui { ec_comm::set_uefi_app_mode(&ec, true); - let gui_res = state_machine::start(boot_services, &system_table, &ec, force_ui); + let gui_res = state_machine::start(&ec, force_ui); ec_comm::set_uefi_app_mode(&ec, false); gui_res.unwrap() } else { @@ -129,20 +125,14 @@ fn main(image_handle: Handle, mut system_table: SystemTable) -> Status { if let Some(reset_type) = reset { #[cfg(debug_assertions)] info!("Shutting down"); - boot_services.stall(1_000_000); + boot::stall(core::time::Duration::from_micros(1_000_000)); // Shut down the system // TODO: I should do this outside of this function - let rt = system_table.runtime_services(); - rt.reset(reset_type, Status::SUCCESS, None); + uefi::runtime::reset(reset_type, Status::SUCCESS, None); } } - if let Some(event) = event { - // Will crash when Linux boots if we don't call this - boot_services.close_event(event).unwrap(); - } - Status::SUCCESS } @@ -154,17 +144,17 @@ enum ShellAction { GopInfo, } -fn get_shell_action(boot_services: &BootServices) -> uefi::Result { +fn get_shell_action() -> uefi::Result { // TODO: I think I should open this from the ImageHandle? let shell_params_h = - boot_services.locate_handle_buffer(SearchType::ByProtocol(&ShellParameters::GUID))?; - trace!("Found {} ShellParameters handles", (*shell_params_h).len()); - for handle in &*shell_params_h { + boot::locate_handle_buffer(SearchType::ByProtocol(&ShellParameters::GUID))?; + trace!("Found {} ShellParameters handles", shell_params_h.len()); + for handle in shell_params_h.iter() { let params_handle = unsafe { - boot_services.open_protocol::( + boot::open_protocol::( OpenProtocolParams { handle: *handle, - agent: boot_services.image_handle(), + agent: boot::image_handle(), controller: None, }, OpenProtocolAttributes::GetProtocol, @@ -173,11 +163,11 @@ fn get_shell_action(boot_services: &BootServices) -> uefi::Result { // Ehm why are there two and one has no args? // Maybe one is the shell itself? - if params_handle.argc == 0 { + if params_handle.args_len() == 0 { continue; } - let args = params_handle.get_args(); + let args: Vec = params_handle.args().map(|arg| arg.to_string()).collect(); // First arg is the executable path return Ok(if args.len() == 2 && args[1] == "gui" { ShellAction::Gui @@ -194,7 +184,7 @@ fn get_shell_action(boot_services: &BootServices) -> uefi::Result { Ok(ShellAction::Gui) } -fn print_module_status(boot_services: &BootServices) { +fn print_module_status() { print_tool_version(); println!(""); @@ -225,7 +215,7 @@ fn print_module_status(boot_services: &BootServices) { } println!(" Firmware Versions"); - if let Ok(devices) = uefi_usb::get_usb_devices(boot_services) { + if let Ok(devices) = uefi_usb::get_usb_devices() { for device in devices { let name = if let Some(name) = device.get_name() { name @@ -240,7 +230,7 @@ fn print_module_status(boot_services: &BootServices) { } println!("BIOS Settings"); - if let Some(settings) = get_bios_settings(boot_services) { + if let Some(settings) = get_bios_settings() { println!(" Standalone Mode Enabled: {}", settings.standalone_mode); println!( " Inputmodule Setting: {:?}", diff --git a/src/shell_params.rs b/src/shell_params.rs deleted file mode 100644 index ce3fc98..0000000 --- a/src/shell_params.rs +++ /dev/null @@ -1,45 +0,0 @@ -//! Protocol to get the shell commandline parameters -//! TODO: Upstream to rust-osdev/uefi-rs -use alloc::borrow::ToOwned; -use core::ffi::c_void; -use uefi::proto::unsafe_protocol; -use uefi::{CStr16, CString16, Char16}; - -use alloc::string::String; -use alloc::string::ToString; -use alloc::vec; -use alloc::vec::Vec; - -type ShellFileHandle = *const c_void; - -#[repr(C)] -#[unsafe_protocol("752f3136-4e16-4fdc-a22a-e5f46812f4ca")] -pub struct ShellParameters { - pub argv: *const *const Char16, - pub argc: usize, - pub std_in: ShellFileHandle, - pub std_out: ShellFileHandle, - pub std_err: ShellFileHandle, -} -impl ShellParameters { - pub fn get_args(&self) -> Vec { - let mut args = vec![]; - // Skip first one, which is the executable's name - for i in 1..self.argc { - let str = unsafe { CStr16::from_ptr(*self.argv.add(i)) }; - let string = str.to_owned(); - args.push(string); - } - args - } - pub fn get_str_args(&self) -> Vec { - let mut args = vec![]; - // Skip first one, which is the executable's name - for i in 1..self.argc { - let str = unsafe { CStr16::from_ptr(*self.argv.add(i)) }; - let string = str.to_string(); - args.push(string); - } - args - } -} diff --git a/src/sleep.rs b/src/sleep.rs index a5bdab9..9161c1b 100644 --- a/src/sleep.rs +++ b/src/sleep.rs @@ -1,31 +1,29 @@ use core::ffi::c_void; use core::ptr::NonNull; +use core::time::Duration; -#[allow(unused_imports)] -use uefi::prelude::*; -use uefi::table::boot::{BootServices, EventType, Tpl}; +use uefi::boot::{self, EventType, TimerTrigger, Tpl}; use uefi::Event; unsafe extern "efiapi" fn idle_callback(_event: Event, _context: Option>) {} // Continue execution after a timeout or when the event fires // This is much better than gBS->Stall because it'll actually pause the CPU instead of busywaiting. -pub fn sleep_or(bs: &BootServices, ms: u64, or_event: Option) { +pub fn sleep_or(ms: u64, or_event: Option) { let oneshot_timer = unsafe { - bs.create_event(EventType::TIMER, Tpl::CALLBACK, Some(idle_callback), None) - .unwrap() + boot::create_event(EventType::TIMER, Tpl::CALLBACK, Some(idle_callback), None).unwrap() }; - bs.set_timer( + boot::set_timer( &oneshot_timer, - uefi::table::boot::TimerTrigger::Relative(ms * 10_000), + TimerTrigger::Relative(Duration::from_millis(ms)), ) .unwrap(); - let mut events = if let Some(event) = or_event { + let events = if let Some(event) = or_event { [oneshot_timer, event] } else { [unsafe { oneshot_timer.unsafe_clone() }, oneshot_timer] }; - let _which_event_fired = bs.wait_for_event(&mut events).discard_errdata().unwrap(); + let _which_event_fired = boot::wait_for_event(&events).unwrap(); } diff --git a/src/state_machine.rs b/src/state_machine.rs index 688bd9d..b2c3758 100644 --- a/src/state_machine.rs +++ b/src/state_machine.rs @@ -9,6 +9,7 @@ use core::fmt; use embedded_graphics::geometry::Size; use embedded_graphics::prelude::Point; +use dmidecode::Structure; use framework_lib::ccgx::{AppVersion, Application, MainPdVersions}; use framework_lib::chromium_ec::commands::{ EcResponseExpansionBayStatus, EcResponseGetHwDiag, ExpansionBayBoard, ExpansionBayIssue, @@ -17,24 +18,20 @@ use framework_lib::chromium_ec::input_deck::{InputDeckStatus, InputModuleType}; use framework_lib::chromium_ec::CrosEc; use framework_lib::power::{self, ReducedPowerInfo}; #[cfg(not(feature = "qemu"))] -use framework_lib::smbios::{get_platform, get_smbios, Platform}; +use framework_lib::smbios::get_smbios; #[cfg(feature = "qemu")] +use framework_lib::smbios::SmbiosStore; use framework_lib::smbios::{get_platform, Platform}; #[allow(unused_imports)] use log::{debug, error, info, trace}; use log::{log_enabled, Level}; -#[cfg(feature = "qemu")] -use smbioslib::SMBiosData; -use smbioslib::SMBiosInformation; -use uefi::prelude::{BootServices, RuntimeServices}; +use uefi::boot::{self, OpenProtocolAttributes, OpenProtocolParams, ScopedProtocol, SearchType}; use uefi::proto::console::gop::GraphicsOutput; use uefi::proto::console::text::{Input, Key, ScanCode}; -use uefi::table::boot::{OpenProtocolAttributes, OpenProtocolParams, ScopedProtocol, SearchType}; -use uefi::table::runtime::{VariableAttributes, VariableVendor}; -use uefi::table::{Boot, SystemTable}; +use uefi::runtime::{VariableAttributes, VariableVendor}; use uefi::{cstr16, guid, Char16, Identify}; #[allow(unused_imports)] -use uefi_services::{print, println, system_table}; +use uefi::{print, println}; use hwio::{Io, Pio}; @@ -855,9 +852,9 @@ impl State { } } -pub fn print_gop_info(bs: &BootServices) -> Option<()> { +pub fn print_gop_info() -> Option<()> { let gop_handles = if let Ok(gop_handles) = - bs.locate_handle_buffer(SearchType::ByProtocol(&GraphicsOutput::GUID)) + boot::locate_handle_buffer(SearchType::ByProtocol(&GraphicsOutput::GUID)) { gop_handles } else { @@ -867,10 +864,10 @@ pub fn print_gop_info(bs: &BootServices) -> Option<()> { let gop = if let Some(handle) = gop_handles.iter().next() { unsafe { - bs.open_protocol::( + boot::open_protocol::( OpenProtocolParams { handle: *handle, - agent: bs.image_handle(), + agent: boot::image_handle(), controller: None, }, OpenProtocolAttributes::GetProtocol, @@ -895,9 +892,9 @@ pub fn print_gop_info(bs: &BootServices) -> Option<()> { Some(()) } -fn get_gop_buffer(bs: &BootServices) -> Option<(ScopedProtocol<'_, GraphicsOutput>, Buffer)> { +fn get_gop_buffer() -> Option<(ScopedProtocol, Buffer)> { let gop_handles = if let Ok(gop_handles) = - bs.locate_handle_buffer(SearchType::ByProtocol(&GraphicsOutput::GUID)) + boot::locate_handle_buffer(SearchType::ByProtocol(&GraphicsOutput::GUID)) { gop_handles } else { @@ -907,10 +904,10 @@ fn get_gop_buffer(bs: &BootServices) -> Option<(ScopedProtocol<'_, GraphicsOutpu let gop = if let Some(handle) = gop_handles.iter().next() { unsafe { - bs.open_protocol::( + boot::open_protocol::( OpenProtocolParams { handle: *handle, - agent: bs.image_handle(), + agent: boot::image_handle(), controller: None, }, OpenProtocolAttributes::GetProtocol, @@ -932,21 +929,22 @@ fn get_gop_buffer(bs: &BootServices) -> Option<(ScopedProtocol<'_, GraphicsOutpu Some((gop, Buffer::new(width, height))) } -fn get_input_protocol(bs: &BootServices) -> Option> { - let input_handles = - if let Ok(input_handles) = bs.locate_handle_buffer(SearchType::ByProtocol(&Input::GUID)) { - input_handles - } else { - error!("Input protocol is missing"); - return None; - }; +fn get_input_protocol() -> Option> { + let input_handles = if let Ok(input_handles) = + boot::locate_handle_buffer(SearchType::ByProtocol(&Input::GUID)) + { + input_handles + } else { + error!("Input protocol is missing"); + return None; + }; if let Some(handle) = input_handles.iter().next() { unsafe { - bs.open_protocol::( + boot::open_protocol::( OpenProtocolParams { handle: *handle, - agent: bs.image_handle(), + agent: boot::image_handle(), controller: None, }, OpenProtocolAttributes::GetProtocol, @@ -960,9 +958,9 @@ fn get_input_protocol(bs: &BootServices) -> Option> { } // Avoid using because it might cause trouble with later boot process -fn _get_exclusive_input_protocol(bs: &BootServices) -> Option> { - let input_handle = bs.get_handle_for_protocol::().ok()?; - bs.open_protocol_exclusive::(input_handle).ok() +fn _get_exclusive_input_protocol() -> Option> { + let input_handle = boot::get_handle_for_protocol::().ok()?; + boot::open_protocol_exclusive::(input_handle).ok() } fn has_bay_issue( @@ -1001,28 +999,26 @@ fn has_bay_issue( } /// Set OS indications so that a reboot will boot into setup menu -fn set_os_indications_setupmenu(rt: &RuntimeServices) { +fn set_os_indications_setupmenu() { let vendor = VariableVendor(EFI_GLOBAL_VARIABLE_GUID); let mut buf = [0; 8]; - rt.get_variable(cstr16!("OsIndicationsSupported"), &vendor, &mut buf) + uefi::runtime::get_variable(cstr16!("OsIndicationsSupported"), &vendor, &mut buf) .expect("failed to get variable"); let os_indications: u64 = u64::from_ne_bytes(buf); debug!("OS Indications: {:?}", os_indications); - let os_indications = if rt - .get_variable(cstr16!("OsIndications"), &vendor, &mut buf) - .is_ok() - { - u64::from_ne_bytes(buf) | EFI_OS_INDICATIONS_BOOT_TO_FW_UI - } else { - EFI_OS_INDICATIONS_BOOT_TO_FW_UI - }; + let os_indications = + if uefi::runtime::get_variable(cstr16!("OsIndications"), &vendor, &mut buf).is_ok() { + u64::from_ne_bytes(buf) | EFI_OS_INDICATIONS_BOOT_TO_FW_UI + } else { + EFI_OS_INDICATIONS_BOOT_TO_FW_UI + }; debug!("OS Indications: {:?}", os_indications); let attrs = VariableAttributes::NON_VOLATILE | VariableAttributes::BOOTSERVICE_ACCESS | VariableAttributes::RUNTIME_ACCESS; - rt.set_variable( + uefi::runtime::set_variable( cstr16!("OsIndications"), &vendor, attrs, @@ -1032,11 +1028,9 @@ fn set_os_indications_setupmenu(rt: &RuntimeServices) { } pub fn start( - bs: &BootServices, - st: &SystemTable, ec: &Option, force_ui: bool, -) -> uefi::Result> { +) -> uefi::Result> { let mut input_deck = ec_comm::get_input_deck(ec); let mut expansion_bay = ec_comm::get_expansion_bay(ec); let mut hw_diag = ec_comm::get_hw_diag(ec); @@ -1045,19 +1039,21 @@ pub fn start( .as_ref() .and_then(power::power_info) .map(Into::::into); - let mut usb_devices = uefi_usb::get_usb_devices_noerr(bs); + let mut usb_devices = uefi_usb::get_usb_devices_noerr(); #[cfg(feature = "qemu")] - let smbios: Option = None; + let smbios: Option = None; #[cfg(not(feature = "qemu"))] let smbios = get_smbios(); - let bios_version = if let Some(smbios) = smbios { - let bios_entries = smbios.collect::(); - let bios = bios_entries.first().unwrap(); - format!("{}", bios.version()) - } else { - "?.??".to_string() - }; + let bios_version = smbios + .as_ref() + .and_then(|smbios| { + smbios.structures().find_map(|r| match r { + Ok(Structure::Bios(bios)) => Some(bios.bios_version.to_string()), + _ => None, + }) + }) + .unwrap_or_else(|| "?.??".to_string()); let ec_version = ec_comm::version_info(ec); let state = State::new(ec); @@ -1072,7 +1068,7 @@ pub fn start( } // Get GOP protocol to draw on the screen - let (mut gop, mut buffer) = if let Some((gop, buf)) = get_gop_buffer(bs) { + let (mut gop, mut buffer) = if let Some((gop, buf)) = get_gop_buffer() { (gop, buf) } else { error!("inputmodules.efi - Couldn't draw to display"); @@ -1082,9 +1078,8 @@ pub fn start( }; // Get Input protocol to detect keypresses - let mut input = get_input_protocol(bs).expect("Should always have input protocol"); + let mut input = get_input_protocol().expect("Should always have input protocol"); - let rt = st.runtime_services(); let mut state = State::new(ec); // Record the time when the warning shows up and the timer starts // So that the countdown does not start when the user is still installing inputmodules @@ -1097,7 +1092,7 @@ pub fn start( // If the any firmware (keyboard or PD) is outdated, start a countdown timer and continue boot // Outdated keyboard or PD firmware does not impact boot functionality, so we can safely continue if let StateFrame::OutdatedFirmware(_) = &state.frame { - if let Ok(now) = rt.get_time() { + if let Ok(now) = uefi::runtime::get_time() { let current_seconds = now.second() as u32 + (now.minute() as u32 * 60); if now.second() as u32 != last_second { @@ -1156,7 +1151,7 @@ pub fn start( &mut power_info, ); } - usb_devices = uefi_usb::get_usb_devices_noerr(bs); + usb_devices = uefi_usb::get_usb_devices_noerr(); // TODO: Maybe mock power button press? let button_pressed = ec_comm::button_pressed(ec); @@ -1181,10 +1176,9 @@ pub fn start( } if state.keypress == Some(Key::Special(ScanCode::FUNCTION_12)) { - let rt = st.runtime_services(); - set_os_indications_setupmenu(rt); + set_os_indications_setupmenu(); info!("Rebooting into BIOS Setup Menu"); - return Ok(Some(uefi::table::runtime::ResetType::Cold)); + return Ok(Some(uefi::runtime::ResetType::COLD)); } // If verbose always need to update, to update things like fan info in the debug section @@ -1199,7 +1193,7 @@ pub fn start( ); if need_redraw && log_enabled!(Level::Debug) { // Sleep after state.need_redraw prints debug information - bs.stall(1_000_000); + boot::stall(core::time::Duration::from_micros(1_000_000)); } let q_key = Char16::try_from('?').unwrap(); @@ -1221,12 +1215,10 @@ pub fn start( if long_press > 4 { // Exit and signal that we need to poweroff info!("Powering off"); - return Ok(Some(uefi::table::runtime::ResetType::Shutdown)); + return Ok(Some(uefi::runtime::ResetType::SHUTDOWN)); } // Wait a second - sleep_or(bs, 1_000, unsafe { - Some(input.wait_for_key_event().unsafe_clone()) - }); + sleep_or(1_000, input.wait_for_key_event().ok()); long_press += 1; true } else { @@ -1294,9 +1286,7 @@ pub fn start( // TODO: It needs to be very low to detect short power button presses, // but it doesn't have to be that low for the input modules. Maybe we can find a compromise // Put CPU to sleep until key press or 10ms timeout - sleep_or(bs, 10, unsafe { - Some(input.wait_for_key_event().unsafe_clone()) - }); + sleep_or(10, input.wait_for_key_event().ok()); state.keypress = input.read_key().expect(FAILED_INPUT); // Save current values to access and compare them in next iteration diff --git a/src/uefi_usb.rs b/src/uefi_usb.rs index 62fbe41..b11c898 100644 --- a/src/uefi_usb.rs +++ b/src/uefi_usb.rs @@ -2,130 +2,11 @@ use alloc::format; use alloc::string::String; use alloc::vec; use alloc::vec::Vec; -use core::mem::MaybeUninit; #[allow(unused_imports)] use log::{debug, error, info, trace}; -use uefi::prelude::*; -use uefi::proto::unsafe_protocol; -use uefi::table::boot::{OpenProtocolAttributes, OpenProtocolParams, SearchType}; -use uefi::{Char16, Identify, Result}; -#[allow(unused_imports)] -use uefi_services::{print, println}; - -// This file is a simple UsbIo protocol -// It's not supposed to be complete - for now we only need to read the device descriptor to get -// VID, PID and bcdUSB. - -#[allow(dead_code)] -#[repr(C)] -pub enum UsbDataDirection { - DataIn = 0x00, - DataOut = 0x01, - NoData = 0x02, -} - -#[repr(C, packed)] -pub struct UsbDeviceRequest { - pub request_type: u8, - pub request: u8, - pub value: u16, - pub index: u16, - pub length: u16, -} - -#[repr(C, packed)] -pub struct UsbDeviceDescriptor { - pub length: u8, - pub descriptor_type: u8, - pub bcd_usb: u16, - pub device_class: u8, - pub device_sub_class: u8, - pub device_protocol: u8, - pub max_packet_size0: u8, - pub id_vendor: u16, - pub id_product: u16, - pub bcd_device: u16, - pub str_manufacturer: u8, - pub str_product: u8, - pub str_serial_number: u8, - pub num_configurations: u8, -} - -#[repr(C, packed)] -pub struct UsbConfigDescriptor { - pub length: u8, - pub descriptor_type: u8, - pub total_length: u16, - pub num_interfaces: u8, - pub configuration_value: u8, - pub configuration: u8, - pub attributes: u8, - pub max_power: u8, -} - -#[repr(C, packed)] -pub struct UsbInterfaceDescriptor { - pub length: u8, - pub descriptor_type: u8, - pub interface_number: u8, - pub alternate_setting: u8, - pub num_endpoints: u8, - pub interface_class: u8, - pub interface_sub_class: u8, - pub interface_protocol: u8, - pub interface: u8, -} - -#[repr(C, packed)] -pub struct UsbEndpointDescriptor { - pub length: u8, - pub descriptor_type: u8, - pub endpoint_address: u8, - pub attributes: u8, - pub max_packet_size: u16, - pub interval: u8, -} - -#[repr(C)] -#[unsafe_protocol("2b2f68d6-0cd2-44cf-8e8b-bba20b1b5b75")] -pub struct UsbIo { - usb_control_transfer: extern "efiapi" fn( - &mut UsbIo, - &mut UsbDeviceRequest, - UsbDataDirection, - u32, - *mut u8, - usize, - *mut u32, - ) -> Status, - - usb_bulk_transfer: - extern "efiapi" fn(&mut UsbIo, u8, *mut u8, *mut usize, usize, u32) -> Status, - // TODO: usb_async_interrupt_transfer - usb_async_interrupt_transfer: extern "efiapi" fn(&mut UsbIo) -> Status, - usb_sync_interrupt_transfer: - extern "efiapi" fn(&mut UsbIo, u8, *mut u8, *mut usize, usize, *mut u32) -> Status, - usb_isochronous_transfer: - extern "efiapi" fn(&mut UsbIo, u8, *mut u8, usize, *mut u32) -> Status, - // TODO: async_isochronous_transfer - usb_async_isochronous_transfer: extern "efiapi" fn(&mut UsbIo) -> Status, - usb_get_device_descriptor: extern "efiapi" fn(&mut UsbIo, *mut UsbDeviceDescriptor) -> Status, - usb_get_config_descriptor: extern "efiapi" fn(&mut UsbIo, *mut UsbConfigDescriptor) -> Status, - usb_get_interface_descriptor: - extern "efiapi" fn(&mut UsbIo, *mut UsbInterfaceDescriptor) -> Status, - usb_get_endpoint_descriptor: - extern "efiapi" fn(&mut UsbIo, u8, *mut UsbEndpointDescriptor) -> Status, - usb_get_string_descriptor: extern "efiapi" fn(&mut UsbIo, u16, u8, *mut *mut Char16) -> Status, - usb_get_supported_languages: extern "efiapi" fn(&mut UsbIo, *mut *mut u16, *mut u16) -> Status, - usb_port_reset: extern "efiapi" fn(&mut UsbIo) -> Status, -} -impl UsbIo { - pub fn get_device_descriptor(&mut self) -> Result { - let mut desc = MaybeUninit::::uninit(); - (self.usb_get_device_descriptor)(self, desc.as_mut_ptr()) - .into_with_val(|| unsafe { desc.assume_init() }) - } -} +use uefi::boot::{self, OpenProtocolAttributes, OpenProtocolParams, SearchType}; +use uefi::proto::usb::io::UsbIo; +use uefi::{Identify, Result}; #[derive(PartialEq, Eq, Debug, Clone)] pub struct UsbDevice { @@ -164,12 +45,12 @@ impl UsbDevice { } } -pub fn get_usb_devices(bs: &BootServices) -> Result> { +pub fn get_usb_devices() -> Result> { let mut devices = vec![]; #[cfg(not(feature = "qemu"))] debug!("Locate USB IO Handles"); - let usb_io_handles = bs.locate_handle_buffer(SearchType::ByProtocol(&UsbIo::GUID)); + let usb_io_handles = boot::locate_handle_buffer(SearchType::ByProtocol(&UsbIo::GUID)); let usb_io_handles = if let Ok(usb_io_handles) = usb_io_handles { debug!("UsbIo protocol found"); @@ -182,13 +63,13 @@ pub fn get_usb_devices(bs: &BootServices) -> Result> { return Ok(devices); }; - info!("Found {} UsbIo handles", (*usb_io_handles).len()); - for handle in &*usb_io_handles { + info!("Found {} UsbIo handles", usb_io_handles.len()); + for handle in usb_io_handles.iter() { let mut usb_handle = unsafe { - bs.open_protocol::( + boot::open_protocol::( OpenProtocolParams { handle: *handle, - agent: bs.image_handle(), + agent: boot::image_handle(), controller: None, }, OpenProtocolAttributes::GetProtocol, @@ -197,7 +78,7 @@ pub fn get_usb_devices(bs: &BootServices) -> Result> { }; let desc = usb_handle - .get_device_descriptor() + .device_descriptor() .expect("Failed to get Device Descriptor"); let dev = UsbDevice { @@ -230,18 +111,17 @@ pub fn get_usb_devices(bs: &BootServices) -> Result> { patch ); // What's this? - debug!(" Protocol: 0x{:02X}", { desc.device_protocol }); + debug!(" Protocol: 0x{:02X}", desc.device_protocol); // 0 and 0 means look at the interface descriptor info!( " Device Class: {}, Subclass: {}", - { desc.device_class }, - { desc.device_sub_class } + desc.device_class, desc.device_subclass ); // TODO: Get string //info!(" Str Manufactr: {}", { desc.str_manufacturer }); //info!(" Str Product: {}", { desc.str_product }); // Is expected to be 1 - info!(" Configurations: {}", { desc.num_configurations }); + info!(" Configurations: {}", desc.num_configurations); // Is expected to be always be 64 //info!(" Max Packet Size: {}", { desc.max_packet_size0 }); } @@ -250,8 +130,8 @@ pub fn get_usb_devices(bs: &BootServices) -> Result> { /// Same as get_usb_devices but return empty Vec instead of Result::Err /// It prints the error message with error! -pub fn get_usb_devices_noerr(bs: &BootServices) -> Vec { - match get_usb_devices(bs) { +pub fn get_usb_devices_noerr() -> Vec { + match get_usb_devices() { Ok(devices) => devices, Err(err) => { error!("{:?}", err);