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
101
102
103
|
//! Graphics Output Protocol
//!
//! Provides means to configure graphics hardware and get access to
//! framebuffers. Replaces the old UGA interface from EFI with a
//! VGA-independent API.
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
0x9042a9de,
0x23dc,
0x4a38,
0x96,
0xfb,
&[0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a],
);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct PixelBitmask {
pub red_mask: u32,
pub green_mask: u32,
pub blue_mask: u32,
pub reserved_mask: u32,
}
pub type GraphicsPixelFormat = u32;
pub const PIXEL_RED_GREEN_BLUE_RESERVED_8_BIT_PER_COLOR: GraphicsPixelFormat = 0x00000000;
pub const PIXEL_BLUE_GREEN_RED_RESERVED_8_BIT_PER_COLOR: GraphicsPixelFormat = 0x00000001;
pub const PIXEL_BIT_MASK: GraphicsPixelFormat = 0x00000002;
pub const PIXEL_BLT_ONLY: GraphicsPixelFormat = 0x00000003;
pub const PIXEL_FORMAT_MAX: GraphicsPixelFormat = 0x00000004;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ModeInformation {
pub version: u32,
pub horizontal_resolution: u32,
pub vertical_resolution: u32,
pub pixel_format: GraphicsPixelFormat,
pub pixel_information: PixelBitmask,
pub pixels_per_scan_line: u32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Mode {
pub max_mode: u32,
pub mode: u32,
pub info: *mut ModeInformation,
pub size_of_info: usize,
pub frame_buffer_base: crate::base::PhysicalAddress,
pub frame_buffer_size: usize,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct BltPixel {
pub blue: u8,
pub green: u8,
pub red: u8,
pub reserved: u8,
}
pub type BltOperation = u32;
pub const BLT_VIDEO_FILL: BltOperation = 0x00000000;
pub const BLT_VIDEO_TO_BLT_BUFFER: BltOperation = 0x00000001;
pub const BLT_BUFFER_TO_VIDEO: BltOperation = 0x00000002;
pub const BLT_VIDEO_TO_VIDEO: BltOperation = 0x00000003;
pub const BLT_OPERATION_MAX: BltOperation = 0x00000004;
pub type ProtocolQueryMode = eficall! {fn(
*mut Protocol,
u32,
*mut usize,
*mut *mut ModeInformation,
) -> crate::base::Status};
pub type ProtocolSetMode = eficall! {fn(
*mut Protocol,
u32,
) -> crate::base::Status};
pub type ProtocolBlt = eficall! {fn(
*mut Protocol,
*mut BltPixel,
BltOperation,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
) -> crate::base::Status};
#[repr(C)]
pub struct Protocol {
pub query_mode: ProtocolQueryMode,
pub set_mode: ProtocolSetMode,
pub blt: ProtocolBlt,
pub mode: *mut Mode,
}
|