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