uefi_raw/protocol/hii/
database.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3//! Bindings for HII Database Protocol
4
5use super::{HiiHandle, HiiPackageHeader, HiiPackageListHeader, KeyDescriptor};
6use crate::{guid, Guid, Handle, Status};
7
8/// EFI_HII_KEYBOARD_LAYOUT
9#[derive(Debug)]
10#[repr(C)]
11pub struct HiiKeyboardLayout {
12    pub layout_length: u16,
13    pub guid: Guid,
14    pub layout_descriptor_string_offset: u32,
15    pub descriptor_count: u8,
16    pub descriptors: [KeyDescriptor; 0],
17}
18
19newtype_enum! {
20    /// EFI_HII_DATABASE_NOTIFY_TYPE
21    pub enum HiiDatabaseNotifyType: usize => {
22        NEW_PACK = 1 << 0,
23        REMOVE_PACK = 1 << 1,
24        EXPORT_PACK = 1 << 2,
25        ADD_PACK = 1 << 3,
26    }
27}
28
29/// EFI_HII_DATABASE_NOTIFY
30pub type HiiDatabaseNotifyFn = unsafe extern "efiapi" fn(
31    package_type: u8,
32    package_guid: *const Guid,
33    package: *const HiiPackageHeader,
34    handle: HiiHandle,
35    notify_type: HiiDatabaseNotifyType,
36) -> Status;
37
38/// EFI_HII_DATABASE_PROTOCOL
39#[derive(Debug)]
40#[repr(C)]
41pub struct HiiDatabaseProtocol {
42    pub new_package_list: unsafe extern "efiapi" fn(
43        this: *const Self,
44        package_list: *const HiiPackageListHeader,
45        driver_handle: Handle,
46        handle: *mut HiiHandle,
47    ) -> Status,
48    pub remove_package_list:
49        unsafe extern "efiapi" fn(this: *const Self, handle: HiiHandle) -> Status,
50    pub update_package_list: unsafe extern "efiapi" fn(
51        this: *const Self,
52        handle: HiiHandle,
53        package_list: *const HiiPackageListHeader,
54    ) -> Status,
55    pub list_package_lists: unsafe extern "efiapi" fn(
56        this: *const Self,
57        package_type: u8,
58        package_guid: *const Guid,
59        handle_buffer_length: *mut usize,
60        handle: *mut HiiHandle,
61    ) -> Status,
62    pub export_package_lists: unsafe extern "efiapi" fn(
63        this: *const Self,
64        handle: HiiHandle,
65        buffer_size: *mut usize,
66        buffer: *mut HiiPackageListHeader,
67    ) -> Status,
68    pub register_package_notify: unsafe extern "efiapi" fn(
69        this: *const Self,
70        package_type: u8,
71        package_guid: *const Guid,
72        package_notify_fn: HiiDatabaseNotifyFn,
73        notify_type: HiiDatabaseNotifyType,
74        notify_handle: *mut Handle,
75    ) -> Status,
76    pub unregister_package_notify:
77        unsafe extern "efiapi" fn(this: *const Self, notification_handle: Handle) -> Status,
78    pub find_keyboard_layouts: unsafe extern "efiapi" fn(
79        this: *const Self,
80        key_guid_buffer_length: *mut u16,
81        key_guid_buffer: *mut Guid,
82    ) -> Status,
83    pub get_keyboard_layout: unsafe extern "efiapi" fn(
84        this: *const Self,
85        key_guid: *const Guid,
86        leyboard_layout_length: *mut u16,
87        keyboard_layout: *mut HiiKeyboardLayout,
88    ) -> Status,
89    pub set_keyboard_layout:
90        unsafe extern "efiapi" fn(this: *const Self, key_guid: *const Guid) -> Status,
91    pub get_package_list_handle: unsafe extern "efiapi" fn(
92        this: *const Self,
93        package_list_handle: HiiHandle,
94        driver_handle: *mut Handle,
95    ) -> Status,
96}
97
98impl HiiDatabaseProtocol {
99    pub const GUID: Guid = guid!("ef9fc172-a1b2-4693-b327-6d32fc416042");
100}