]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c
UefiCpuPkg/PiSmmCpuDxeSmm: TransferApToSafeState() use UINTN params
[mirror_edk2.git] / OvmfPkg / Library / QemuFwCfgLib / QemuFwCfgSec.c
CommitLineData
c90decb9
LE
1/** @file\r
2\r
3 Stateless fw_cfg library implementation.\r
4\r
5 Clients must call QemuFwCfgIsAvailable() first.\r
6\r
7 Copyright (C) 2013, Red Hat, Inc.\r
8 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
9\r
10 This program and the accompanying materials are licensed and made available\r
11 under the terms and conditions of the BSD License which accompanies this\r
12 distribution. The full text of the license may be found at\r
13 http://opensource.org/licenses/bsd-license.php\r
14\r
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
16 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17**/\r
18\r
19#include <Library/DebugLib.h>\r
20#include <Library/QemuFwCfgLib.h>\r
21\r
22\r
23/**\r
24 Returns a boolean indicating if the firmware configuration interface\r
25 is available or not.\r
26\r
27 This function may change fw_cfg state.\r
28\r
29 @retval TRUE The interface is available\r
30 @retval FALSE The interface is not available\r
31\r
32**/\r
33BOOLEAN\r
34EFIAPI\r
35QemuFwCfgIsAvailable (\r
36 VOID\r
37 )\r
38{\r
39 UINT32 Signature;\r
40 UINT32 Revision;\r
41\r
42 QemuFwCfgSelectItem (QemuFwCfgItemSignature);\r
43 Signature = QemuFwCfgRead32 ();\r
44 DEBUG ((EFI_D_INFO, "FW CFG Signature: 0x%x\n", Signature));\r
45 QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion);\r
46 Revision = QemuFwCfgRead32 ();\r
47 DEBUG ((EFI_D_INFO, "FW CFG Revision: 0x%x\n", Revision));\r
48 if ((Signature != SIGNATURE_32 ('Q', 'E', 'M', 'U')) ||\r
49 (Revision < 1)\r
50 ) {\r
51 DEBUG ((EFI_D_INFO, "QemuFwCfg interface not supported.\n"));\r
52 return FALSE;\r
53 }\r
54\r
55 DEBUG ((EFI_D_INFO, "QemuFwCfg interface is supported.\n"));\r
56 return TRUE;\r
57}\r
58\r
59\r
60/**\r
61 Returns a boolean indicating if the firmware configuration interface is\r
62 available for library-internal purposes.\r
63\r
64 This function never changes fw_cfg state.\r
65\r
66 @retval TRUE The interface is available internally.\r
67 @retval FALSE The interface is not available internally.\r
68**/\r
69BOOLEAN\r
70EFIAPI\r
71InternalQemuFwCfgIsAvailable (\r
72 VOID\r
73 )\r
74{\r
75 //\r
76 // We always return TRUE, because the consumer of this library ought to have\r
77 // called QemuFwCfgIsAvailable before making other calls which would hit this\r
78 // path.\r
79 //\r
80 return TRUE;\r
81}\r