diff --git a/Cargo.lock b/Cargo.lock index 9d754e3..1f7d47f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,14 +5,12 @@ version = 3 [[package]] name = "redox_uefi" version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1ef8d2afbe5adfc257e0847f360d0f175e7012c4fa984a284966b54ad5834d" +source = "git+https://gitlab.redox-os.org/tcrawford/uefi?branch=stable#f8a54e634d52296e2e99322c648fc44cb0748685" [[package]] name = "redox_uefi_alloc" version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fe0357fd0ecc7c7de510c9add51a52a9268c3fa5890f9c8dbef890e4b2d1f6" +source = "git+https://gitlab.redox-os.org/tcrawford/uefi?branch=stable#f8a54e634d52296e2e99322c648fc44cb0748685" dependencies = [ "redox_uefi", ] @@ -20,8 +18,7 @@ dependencies = [ [[package]] name = "redox_uefi_std" version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a19dfc2a64c4a152fff1819c6ce74460c322a46da9c812ffaa1282260c19ec2" +source = "git+https://gitlab.redox-os.org/tcrawford/uefi?branch=stable#f8a54e634d52296e2e99322c648fc44cb0748685" dependencies = [ "redox_uefi", "redox_uefi_alloc", diff --git a/Cargo.toml b/Cargo.toml index c97110d..2d6cc7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,4 @@ license = "GPL-3.0-only" lto = true [dependencies] -redox_uefi_std = "0.1.12" +redox_uefi_std = { git = "https://gitlab.redox-os.org/tcrawford/uefi", branch = "stable" } diff --git a/src/gop_policy.rs b/src/gop_policy.rs index 1e1338a..424f602 100644 --- a/src/gop_policy.rs +++ b/src/gop_policy.rs @@ -1,12 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-only -use core::ops::FromResidual; use std::prelude::*; use std::uefi::Handle; use std::uefi::boot::InterfaceType; use std::uefi::guid::{Guid, NULL_GUID}; use std::uefi::memory::PhysicalAddress; -use std::uefi::status::{Error, Result, Status}; +use std::uefi::status::{Result, Status}; static VBT: &[u8] = include_bytes!(env!("FIRMWARE_OPEN_VBT")); @@ -31,18 +30,18 @@ pub enum DockStatus { extern "win64" fn GetPlatformLidStatus(CurrentLidStatus: *mut LidStatus) -> Status { if CurrentLidStatus.is_null() { - return Status::from_residual(Error::InvalidParameter); + return Status::INVALID_PARAMETER; } // TODO: Get real lid status unsafe { *CurrentLidStatus = LidStatus::LidOpen }; - Status(0) + Status::SUCCESS } extern "win64" fn GetVbtData(VbtAddress: *mut PhysicalAddress, VbtSize: *mut u32) -> Status { if VbtAddress.is_null() || VbtSize.is_null() { - return Status::from_residual(Error::InvalidParameter); + return Status::INVALID_PARAMETER; } unsafe { *VbtAddress = PhysicalAddress(VBT.as_ptr() as u64) }; @@ -52,7 +51,7 @@ extern "win64" fn GetVbtData(VbtAddress: *mut PhysicalAddress, VbtSize: *mut u32 } extern "win64" fn GetPlatformDockStatus(_CurrentDockStatus: DockStatus) -> Status { - Status::from_residual(Error::Unsupported) + Status::UNSUPPORTED } #[repr(C)] @@ -80,7 +79,12 @@ impl GopPolicy { let self_ptr = Box::into_raw(self); let mut handle = Handle(0); - (uefi.BootServices.InstallProtocolInterface)(&mut handle, &GOP_POLICY_GUID, InterfaceType::Native, self_ptr as usize)?; + Result::from((uefi.BootServices.InstallProtocolInterface)( + &mut handle, + &GOP_POLICY_GUID, + InterfaceType::Native, + self_ptr as usize + ))?; //let _ = (uefi.BootServices.UninstallProtocolInterface)(handle, &GOP_POLICY_GUID, self_ptr as usize); diff --git a/src/main.rs b/src/main.rs index eb604d8..6052ab6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ #![no_std] #![no_main] -#![feature(try_trait_v2)] #![allow(non_snake_case)] #[macro_use] @@ -10,7 +9,6 @@ extern crate uefi_std as std; use std::prelude::*; -use core::ops::FromResidual; use std::uefi::status::Status; mod gop_policy; @@ -20,8 +18,8 @@ pub extern "C" fn main() -> Status { let gop_policy = gop_policy::GopPolicy::new(); if let Err(err) = gop_policy.install() { println!("GopPolicy error: {:?}", err); - Status::from_residual(err) + err } else { - Status(0) + Status::SUCCESS } }