Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/acpi_tables/src/facs.rs
5394 views
1
// Copyright 2021 The ChromiumOS Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
use zerocopy::FromBytes;
6
use zerocopy::Immutable;
7
use zerocopy::IntoBytes;
8
use zerocopy::KnownLayout;
9
10
#[repr(C, packed)]
11
#[derive(Clone, Copy, Default, FromBytes, Immutable, IntoBytes, KnownLayout)]
12
pub struct FACS {
13
pub signature: [u8; 4],
14
pub length: u32,
15
pub hardware_signature: u32,
16
pub waking: u32,
17
pub lock: u32,
18
pub flags: u32,
19
pub x_waking: u64,
20
pub version: u8,
21
pub _reserved1: [u8; 3],
22
pub ospm_flags: u32,
23
pub _reserved2: [u8; 24],
24
}
25
26
impl FACS {
27
pub fn new() -> Self {
28
FACS {
29
signature: *b"FACS",
30
length: std::mem::size_of::<FACS>() as u32,
31
hardware_signature: 0,
32
waking: 0,
33
lock: 0,
34
flags: 0,
35
x_waking: 0,
36
version: 1,
37
_reserved1: [0; 3],
38
ospm_flags: 0,
39
_reserved2: [0; 24],
40
}
41
}
42
43
pub fn len() -> usize {
44
std::mem::size_of::<FACS>()
45
}
46
}
47
48