strat9_kernel/acpi/
bgrt.rs1use super::sdt::Sdt;
7use zerocopy::FromBytes;
8
9pub const BGRT_SIGNATURE: &[u8; 4] = b"BGRT";
10
11pub const BGRT_STATUS_DISPLAYED: u8 = 1;
13
14pub const BGRT_FORMAT_BMP: u16 = 0;
16
17#[derive(Clone, Copy, Debug, FromBytes)]
19#[repr(C, packed)]
20pub struct Bgrt {
21 pub header: Sdt,
22 pub version: u16,
23 pub status: u8,
24 pub image_type: u8,
25 pub image_base: u64,
26 pub image_offset_x: u32,
27 pub image_offset_y: u32,
28}
29
30impl Bgrt {
31 pub fn get() -> Option<&'static Bgrt> {
33 unsafe { super::find_table(BGRT_SIGNATURE).map(|ptr| &*(ptr as *const Bgrt)) }
34 }
35
36 pub fn was_displayed(&self) -> bool {
38 (self.status & BGRT_STATUS_DISPLAYED) != 0
39 }
40
41 pub fn image_format(&self) -> u16 {
43 self.image_type.into()
44 }
45
46 pub fn image_base(&self) -> u64 {
48 self.image_base
49 }
50
51 pub fn image_offset_x(&self) -> u32 {
53 self.image_offset_x
54 }
55
56 pub fn image_offset_y(&self) -> u32 {
58 self.image_offset_y
59 }
60}