1 // Copyright 2024, The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 use crate::defs::{EfiGuid, EfiLoadedImageProtocol}; 16 use crate::protocol::{Protocol, ProtocolInfo}; 17 use crate::{DeviceHandle, EfiResult}; 18 19 /// EFI_LOADED_IMAGE_PROTOCOL 20 pub struct LoadedImageProtocol; 21 22 impl ProtocolInfo for LoadedImageProtocol { 23 type InterfaceType = EfiLoadedImageProtocol; 24 25 const GUID: EfiGuid = 26 EfiGuid::new(0x5b1b31a1, 0x9562, 0x11d2, [0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b]); 27 } 28 29 impl<'a> Protocol<'a, LoadedImageProtocol> { device_handle(&self) -> EfiResult<DeviceHandle>30 pub fn device_handle(&self) -> EfiResult<DeviceHandle> { 31 Ok(DeviceHandle(self.interface()?.device_handle)) 32 } 33 } 34