]>
Commit | Line | Data |
---|---|---|
5e4d5b10 LE |
1 | /** @file\r |
2 | Shared code for the PEI fw_cfg and DXE fw_cfg instances of the QemuFwCfgS3Lib\r | |
3 | class.\r | |
4 | \r | |
5 | Copyright (C) 2017, Red Hat, Inc.\r | |
6 | \r | |
b26f0cf9 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
5e4d5b10 LE |
8 | **/\r |
9 | \r | |
10 | #include <Library/QemuFwCfgLib.h>\r | |
11 | #include <Library/QemuFwCfgS3Lib.h>\r | |
12 | \r | |
13 | /**\r | |
14 | Determine if S3 support is explicitly enabled.\r | |
15 | \r | |
16 | @retval TRUE If S3 support is explicitly enabled. Other functions in this\r | |
17 | library may be called (subject to their individual\r | |
18 | restrictions).\r | |
19 | \r | |
20 | FALSE Otherwise. This includes unavailability of the firmware\r | |
21 | configuration interface. No other function in this library\r | |
22 | must be called.\r | |
23 | **/\r | |
24 | BOOLEAN\r | |
25 | EFIAPI\r | |
26 | QemuFwCfgS3Enabled (\r | |
27 | VOID\r | |
28 | )\r | |
29 | {\r | |
ac0a286f MK |
30 | RETURN_STATUS Status;\r |
31 | FIRMWARE_CONFIG_ITEM FwCfgItem;\r | |
32 | UINTN FwCfgSize;\r | |
33 | UINT8 SystemStates[6];\r | |
5e4d5b10 LE |
34 | \r |
35 | Status = QemuFwCfgFindFile ("etc/system-states", &FwCfgItem, &FwCfgSize);\r | |
ac0a286f | 36 | if ((Status != RETURN_SUCCESS) || (FwCfgSize != sizeof SystemStates)) {\r |
5e4d5b10 LE |
37 | return FALSE;\r |
38 | }\r | |
ac0a286f | 39 | \r |
5e4d5b10 LE |
40 | QemuFwCfgSelectItem (FwCfgItem);\r |
41 | QemuFwCfgReadBytes (sizeof SystemStates, SystemStates);\r | |
ac0a286f | 42 | return (BOOLEAN)(SystemStates[3] & BIT7);\r |
5e4d5b10 | 43 | }\r |