Compare commits

..
Author SHA1 Message Date
dependabot[bot] 045c3a3ca7 chore(deps): bump the actions-updates group across 1 directory with 5 updates
Bumps the actions-updates group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [step-security/harden-runner](https://github.com/step-security/harden-runner) | `2.22.1` | `2.22.2` |
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `10.3.0` | `10.3.2` |
| [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.38.3` | `4.39.1` |
| [github/codeql-action/init](https://github.com/github/codeql-action) | `4.38.3` | `4.39.1` |
| [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.38.3` | `4.39.1` |



Updates `step-security/harden-runner` from 2.22.1 to 2.22.2
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/ccd8616d44fd3846e67624a50d5aad6d37bf2d25...dc2769abcc0fcfbadfc1df54081c1608579ef6b2)

Updates `astral-sh/setup-uv` from 10.3.0 to 10.3.2
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/1c37ad07a6a961277cf70c0d37d6f313000f5884...07a047e608db84b3d8c06cd9a7c7dcc9c355c18e)

Updates `github/codeql-action/upload-sarif` from 4.38.3 to 4.39.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/24c54180a607b1449ed407dd24f251e4e9147c8d...9b3254085494b55a0f7c4c2b3d2d52cc712ce370)

Updates `github/codeql-action/init` from 4.38.3 to 4.39.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/24c54180a607b1449ed407dd24f251e4e9147c8d...9b3254085494b55a0f7c4c2b3d2d52cc712ce370)

Updates `github/codeql-action/analyze` from 4.38.3 to 4.39.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/24c54180a607b1449ed407dd24f251e4e9147c8d...9b3254085494b55a0f7c4c2b3d2d52cc712ce370)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-updates
- dependency-name: astral-sh/setup-uv
  dependency-version: 10.3.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-updates
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.39.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-updates
- dependency-name: github/codeql-action/init
  dependency-version: 4.39.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-updates
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.39.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-updates
...

Signed-off-by: dependabot[bot] <[email protected]>
2026-11-02 09:13:00 +00:00
alex 45e8dcf597 sprout: version 0.0.31 (#134) 2026-10-24 23:23:05 -07:00
dependabot[bot] ac47febd0c chore(deps): bump toml (#132)
Bumps the cargo-updates group with 1 update: [toml](https://github.com/toml-rs/toml).


Updates `toml` from 1.1.6+spec-1.1.0 to 1.1.8+spec-1.1.0
- [Commits](https://github.com/toml-rs/toml/compare/toml-v1.1.6...toml-v1.1.8)

---
updated-dependencies:
- dependency-name: toml
  dependency-version: 1.1.8+spec-1.1.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-updates
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-24 23:13:30 -07:00
dependabot[bot] 5637753022 chore(deps): bump the actions-updates group with 7 updates (#133)
Bumps the actions-updates group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [step-security/harden-runner](https://github.com/step-security/harden-runner) | `2.22.0` | `2.22.1` |
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `10.2.0` | `10.3.0` |
| [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.38.2` | `4.38.3` |
| [github/codeql-action/init](https://github.com/github/codeql-action) | `4.38.2` | `4.38.3` |
| [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.38.2` | `4.38.3` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.1` | `7.0.2` |
| [actions/create-github-app-token](https://github.com/actions/create-github-app-token) | `3.2.0` | `3.3.0` |


Updates `step-security/harden-runner` from 2.22.0 to 2.22.1
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/351661ca32ac09a36dc5ee2d536e3128f2a3c8ed...ccd8616d44fd3846e67624a50d5aad6d37bf2d25)

Updates `astral-sh/setup-uv` from 10.2.0 to 10.3.0
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/c18668ad3cf93ea998bef934396af7bb5c839dc7...1c37ad07a6a961277cf70c0d37d6f313000f5884)

Updates `github/codeql-action/upload-sarif` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

Updates `github/codeql-action/init` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

Updates `github/codeql-action/analyze` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9)

Updates `actions/create-github-app-token` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/create-github-app-token/compare/bcd2ba49218906704ab6c1aa796996da409d3eb1...64ab729a6294000f5aa4a4bc0b73d1f32bc45510)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-updates
- dependency-name: astral-sh/setup-uv
  dependency-version: 10.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-updates
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-updates
- dependency-name: github/codeql-action/init
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-updates
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-updates
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions-updates
- dependency-name: actions/create-github-app-token
  dependency-version: 3.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-updates
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-24 23:13:12 -07:00
8 changed files with 41 additions and 110 deletions

No files matched your search

+3 -3
View File
@@ -26,7 +26,7 @@ jobs:
actions: read # Needed to analyze action metadata. actions: read # Needed to analyze action metadata.
steps: steps:
- name: harden runner - name: harden runner
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0 uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with: with:
egress-policy: audit egress-policy: audit
@@ -36,7 +36,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: setup uv - name: setup uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
- name: zizmor - name: zizmor
run: uvx zizmor --pedantic --format sarif . > results.sarif run: uvx zizmor --pedantic --format sarif . > results.sarif
@@ -44,7 +44,7 @@ jobs:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: upload - name: upload
uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with: with:
sarif_file: results.sarif sarif_file: results.sarif
category: zizmor category: zizmor
+3 -3
View File
@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: harden runner - name: harden runner
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0 uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with: with:
egress-policy: audit egress-policy: audit
@@ -52,7 +52,7 @@ jobs:
name: 'build ${{ matrix.arch }}' name: 'build ${{ matrix.arch }}'
steps: steps:
- name: harden runner - name: harden runner
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0 uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with: with:
egress-policy: audit egress-policy: audit
@@ -81,7 +81,7 @@ jobs:
name: 'clippy ${{ matrix.arch }}' name: 'clippy ${{ matrix.arch }}'
steps: steps:
- name: harden runner - name: harden runner
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0 uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with: with:
egress-policy: audit egress-policy: audit
+3 -3
View File
@@ -38,7 +38,7 @@ jobs:
build-mode: none build-mode: none
steps: steps:
- name: harden runner - name: harden runner
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0 uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with: with:
egress-policy: audit egress-policy: audit
@@ -48,13 +48,13 @@ jobs:
persist-credentials: false persist-credentials: false
- name: initialize codeql - name: initialize codeql
uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }} build-mode: ${{ matrix.build-mode }}
config-file: ./.github/codeql/codeql-config.yaml config-file: ./.github/codeql/codeql-config.yaml
- name: perform codeql analysis - name: perform codeql analysis
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"
+3 -3
View File
@@ -26,7 +26,7 @@ jobs:
artifact-digest: "${{ steps.upload.outputs.artifact-digest }}" artifact-digest: "${{ steps.upload.outputs.artifact-digest }}"
steps: steps:
- name: harden runner - name: harden runner
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0 uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with: with:
egress-policy: audit egress-policy: audit
@@ -44,7 +44,7 @@ jobs:
- name: 'upload artifacts' - name: 'upload artifacts'
id: upload id: upload
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with: with:
name: artifacts name: artifacts
path: target/assemble/* path: target/assemble/*
@@ -61,7 +61,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: harden runner - name: harden runner
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0 uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with: with:
egress-policy: audit egress-policy: audit
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: harden runner - name: harden runner
uses: step-security/harden-runner@351661ca32ac09a36dc5ee2d536e3128f2a3c8ed # v2.22.0 uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
with: with:
egress-policy: audit egress-policy: audit
@@ -50,7 +50,7 @@ jobs:
subject-path: target/assemble/* subject-path: target/assemble/*
- name: 'generate cultivator token' - name: 'generate cultivator token'
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
id: generate-token id: generate-token
with: with:
app-id: "${{ secrets.EDERA_CULTIVATION_APP_ID }}" app-id: "${{ secrets.EDERA_CULTIVATION_APP_ID }}"
Generated
+14 -14
View File
@@ -80,14 +80,14 @@ dependencies = [
[[package]] [[package]]
name = "edera-sprout-bls" name = "edera-sprout-bls"
version = "0.0.30" version = "0.0.31"
dependencies = [ dependencies = [
"anyhow", "anyhow",
] ]
[[package]] [[package]]
name = "edera-sprout-boot" name = "edera-sprout-boot"
version = "0.0.30" version = "0.0.31"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"edera-sprout-bls", "edera-sprout-bls",
@@ -107,21 +107,21 @@ dependencies = [
[[package]] [[package]]
name = "edera-sprout-build" name = "edera-sprout-build"
version = "0.0.30" version = "0.0.31"
dependencies = [ dependencies = [
"png", "png",
] ]
[[package]] [[package]]
name = "edera-sprout-config" name = "edera-sprout-config"
version = "0.0.30" version = "0.0.31"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "edera-sprout-eficore" name = "edera-sprout-eficore"
version = "0.0.30" version = "0.0.31"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bitflags", "bitflags",
@@ -133,7 +133,7 @@ dependencies = [
[[package]] [[package]]
name = "edera-sprout-parsing" name = "edera-sprout-parsing"
version = "0.0.30" version = "0.0.31"
dependencies = [ dependencies = [
"hex", "hex",
"sha2", "sha2",
@@ -320,9 +320,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "1.1.1" version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
dependencies = [ dependencies = [
"serde_core", "serde_core",
] ]
@@ -366,9 +366,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "1.1.6+spec-1.1.0" version = "1.1.8+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a" checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
dependencies = [ dependencies = [
"serde_core", "serde_core",
"serde_spanned", "serde_spanned",
@@ -379,18 +379,18 @@ dependencies = [
[[package]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "1.1.1+spec-1.1.0" version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
dependencies = [ dependencies = [
"serde_core", "serde_core",
] ]
[[package]] [[package]]
name = "toml_parser" name = "toml_parser"
version = "1.1.3+spec-1.1.0" version = "1.1.5+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
dependencies = [ dependencies = [
"winnow", "winnow",
] ]
+1 -1
View File
@@ -11,7 +11,7 @@ resolver = "3"
[workspace.package] [workspace.package]
license = "Apache-2.0" license = "Apache-2.0"
version = "0.0.30" version = "0.0.31"
homepage = "https://sprout.edera.dev" homepage = "https://sprout.edera.dev"
repository = "https://github.com/edera-dev/sprout" repository = "https://github.com/edera-dev/sprout"
edition = "2024" edition = "2024"
+12 -81
View File
@@ -2,20 +2,20 @@ use crate::context::SproutContext;
use alloc::collections::BTreeMap; use alloc::collections::BTreeMap;
use alloc::format; use alloc::format;
use alloc::rc::Rc; use alloc::rc::Rc;
use alloc::string::{String, ToString}; use alloc::string::String;
use alloc::vec::Vec; use alloc::vec::Vec;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use edera_sprout_config::drivers::{DriverDeclaration, DriverProvides}; use edera_sprout_config::drivers::{DriverDeclaration, DriverProvides};
use eficore::loader::source::ImageSource; use eficore::loader::source::ImageSource;
use eficore::loader::{ImageLoadRequest, ImageLoader}; use eficore::loader::{ImageLoadRequest, ImageLoader};
use log::info; use log::info;
use uefi::boot::{OpenProtocolAttributes, OpenProtocolParams, SearchType}; use uefi::boot::SearchType;
use uefi::proto::media::block::BlockIO; use uefi::proto::media::block::BlockIO;
use uefi::proto::media::disk::{DiskIo, DiskIo2}; use uefi::proto::media::disk::{DiskIo, DiskIo2};
use uefi::{Handle, Identify}; use uefi::{Handle, Identify};
/// Loads the driver specified by the `driver` declaration. /// Loads the driver specified by the `driver` declaration.
fn load_driver(context: Rc<SproutContext>, driver: &DriverDeclaration) -> Result<Handle> { fn load_driver(context: Rc<SproutContext>, driver: &DriverDeclaration) -> Result<()> {
// Acquire the handle and device path of the loaded image. // Acquire the handle and device path of the loaded image.
let sprout_image = uefi::boot::image_handle(); let sprout_image = uefi::boot::image_handle();
@@ -36,31 +36,13 @@ fn load_driver(context: Rc<SproutContext>, driver: &DriverDeclaration) -> Result
// Start the driver image, this is expected to return control to sprout. // Start the driver image, this is expected to return control to sprout.
// There is no guarantee that the driver will actually return control as it is // There is no guarantee that the driver will actually return control as it is
// just a standard EFI image. // just a standard EFI image.
info!("starting driver image");
uefi::boot::start_image(*image.handle()).context("unable to start driver image")?; uefi::boot::start_image(*image.handle()).context("unable to start driver image")?;
info!("driver image returned");
Ok(*image.handle()) Ok(())
}
/// Checks whether the handle is a logical partition rather than a whole disk.
fn is_partition(handle: Handle) -> bool {
let params = OpenProtocolParams {
handle,
agent: uefi::boot::image_handle(),
controller: None,
};
// Opening with GetProtocol does not disturb the existing protocol users.
let block = unsafe {
uefi::boot::open_protocol::<BlockIO>(params, OpenProtocolAttributes::GetProtocol)
};
block.is_ok_and(|block| block.media().is_logical_partition())
} }
/// Locates the handles that are disks or partitions. /// Locates the handles that are disks or partitions.
/// Filesystem drivers bind to partitions, so whole disks are only returned when /// These are the only controllers that filesystem drivers can bind to.
/// there are no partitions. Reconnecting a whole disk makes the firmware rebuild
/// its partition handles, which hangs on some NVMe firmware.
fn locate_storage_handles() -> Result<Vec<Handle>> { fn locate_storage_handles() -> Result<Vec<Handle>> {
let mut storage = Vec::new(); let mut storage = Vec::new();
for guid in [&BlockIO::GUID, &DiskIo::GUID, &DiskIo2::GUID] { for guid in [&BlockIO::GUID, &DiskIo::GUID, &DiskIo2::GUID] {
@@ -74,32 +56,7 @@ fn locate_storage_handles() -> Result<Vec<Handle>> {
} }
} }
} }
let partitions: Vec<Handle> = storage Ok(storage)
.iter()
.copied()
.filter(|handle| is_partition(*handle))
.collect();
if partitions.is_empty() {
return Ok(storage);
}
Ok(partitions)
}
/// Describes a handle by its device path, for diagnosing hangs.
fn describe(handle: Handle) -> String {
use uefi::proto::device_path::DevicePath;
let params = OpenProtocolParams {
handle,
agent: uefi::boot::image_handle(),
controller: None,
};
match unsafe {
uefi::boot::open_protocol::<DevicePath>(params, OpenProtocolAttributes::GetProtocol)
} {
Ok(path) => path.to_string(),
Err(_) => String::from("<no device path>"),
}
} }
/// Reconnects handles to their controllers. /// Reconnects handles to their controllers.
@@ -107,7 +64,7 @@ fn describe(handle: Handle) -> String {
/// After we load all the drivers, we need to reconnect their handles /// After we load all the drivers, we need to reconnect their handles
/// so that filesystems are recognized again. /// so that filesystems are recognized again.
/// When `provides` is [`DriverProvides::Filesystems`], only disk and partition handles are reconnected. /// When `provides` is [`DriverProvides::Filesystems`], only disk and partition handles are reconnected.
fn reconnect(provides: DriverProvides, drivers: &[Handle]) -> Result<()> { fn reconnect(provides: DriverProvides) -> Result<()> {
// Locate the handles to reconnect in the UEFI stack. // Locate the handles to reconnect in the UEFI stack.
let handles = match provides { let handles = match provides {
DriverProvides::Any => uefi::boot::locate_handle_buffer(SearchType::AllHandles) DriverProvides::Any => uefi::boot::locate_handle_buffer(SearchType::AllHandles)
@@ -115,35 +72,13 @@ fn reconnect(provides: DriverProvides, drivers: &[Handle]) -> Result<()> {
.iter() .iter()
.copied() .copied()
.collect(), .collect(),
DriverProvides::Filesystems => { DriverProvides::Filesystems => locate_storage_handles()?,
// Probe in reverse so the first partition is the last to be tried.
let mut storage = locate_storage_handles()?;
storage.reverse();
storage
}
}; };
// The driver list passed to the firmware must end with a null entry. for handle in handles {
let driver_list: Vec<Option<Handle>> = drivers
.iter()
.copied()
.map(Some)
.chain(core::iter::once(None))
.collect();
let total = handles.len();
for (index, handle) in handles.into_iter().enumerate() {
info!("reconnecting {}/{}: {}", index + 1, total, describe(handle));
// Ignore the result as there is nothing we can do if reconnecting a controller fails. // Ignore the result as there is nothing we can do if reconnecting a controller fails.
// This is also likely to fail in some cases but should fail safely. // This is also likely to fail in some cases but should fail safely.
// Filesystem drivers are connected directly so the firmware stack is not rebuilt. let _ = uefi::boot::connect_controller(handle, &[], None, true);
let _ = match provides {
DriverProvides::Any => uefi::boot::connect_controller(handle, &[], None, true),
DriverProvides::Filesystems => {
uefi::boot::connect_controller(handle, &driver_list, None, false)
}
};
info!("reconnected {}/{}", index + 1, total);
} }
Ok(()) Ok(())
@@ -165,12 +100,8 @@ pub fn load(
info!("loading drivers"); info!("loading drivers");
// Load all the drivers in no particular order. // Load all the drivers in no particular order.
let mut loaded = Vec::new();
for (name, driver) in drivers { for (name, driver) in drivers {
loaded.push( load_driver(context.clone(), driver).context(format!("unable to load driver: {}", name))?;
load_driver(context.clone(), driver)
.context(format!("unable to load driver: {}", name))?,
);
} }
// Reconnect everything if any driver can provide anything, otherwise only storage. // Reconnect everything if any driver can provide anything, otherwise only storage.
@@ -182,7 +113,7 @@ pub fn load(
} else { } else {
DriverProvides::Any DriverProvides::Any
}; };
reconnect(provides, &loaded).context("unable to reconnect drivers")?; reconnect(provides).context("unable to reconnect drivers")?;
info!("loaded drivers"); info!("loaded drivers");
// We've now loaded all the drivers, so we can return. // We've now loaded all the drivers, so we can return.