acpi_tables/
facs.rs

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
5use zerocopy::FromBytes;
6use zerocopy::Immutable;
7use zerocopy::IntoBytes;
8use zerocopy::KnownLayout;
9
10#[repr(C, packed)]
11#[derive(Clone, Copy, Default, FromBytes, Immutable, IntoBytes, KnownLayout)]
12pub 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
26impl 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}