uefi_specs/hyperv/
bios_event_log.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Types and constants defined in `BiosEventLogInterface.h`
5
6use guid::Guid;
7use static_assertions::const_assert_eq;
8use zerocopy::FromBytes;
9use zerocopy::Immutable;
10use zerocopy::IntoBytes;
11use zerocopy::KnownLayout;
12
13/// Represents an event channel plus data.
14///
15/// This is used when flushing a UEFI event channel to the BIOS device.
16/// Data is series of EFI_EVENT_DESCRIPTORs with variable sized data.
17///
18/// reSearch query: `BIOS_EVENT_CHANNEL`
19#[repr(C)]
20#[derive(Debug, IntoBytes, FromBytes, Immutable, KnownLayout)]
21pub struct BiosEventChannel {
22    pub channel: Guid,
23    pub events_written: u32,
24    pub events_lost: u32,
25    pub data_size: u32,
26    // Payload of size `data_size`
27}
28
29/// reSearch query: `EFI_EVENT_DESCRIPTOR`
30#[repr(C)]
31#[derive(Debug, IntoBytes, FromBytes, Immutable, KnownLayout)]
32pub struct EfiEventDescriptor {
33    pub producer: Guid,       // Optional GUID identifying the producer of the event
34    pub correlation_id: Guid, // Optional Guid used to correlate an event entry with another event entry
35    pub create_time: u64,     // Timestamp when the event was created
36    pub commit_time: u64, // Timestamp when the event was committed (may be the same as CreateTime)
37    pub event_id: u32,    // Producer specified identifier
38    pub flags: u32,       // See EVENT_FLAG_nnnnn
39    pub header_size: u32, // Size of this header structure
40    pub data_size: u32,   // Associated Data Size
41                          // New fields should be added here.
42}
43
44const_assert_eq!(size_of::<EfiEventDescriptor>(), 64);