3 Stateless fw_cfg library implementation.
5 Clients must call QemuFwCfgIsAvailable() first.
7 Copyright (C) 2013, Red Hat, Inc.
8 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
10 This program and the accompanying materials are licensed and made available
11 under the terms and conditions of the BSD License which accompanies this
12 distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
16 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Library/DebugLib.h>
20 #include <Library/QemuFwCfgLib.h>
24 Returns a boolean indicating if the firmware configuration interface
27 This function may change fw_cfg state.
29 @retval TRUE The interface is available
30 @retval FALSE The interface is not available
35 QemuFwCfgIsAvailable (
42 QemuFwCfgSelectItem (QemuFwCfgItemSignature
);
43 Signature
= QemuFwCfgRead32 ();
44 DEBUG ((EFI_D_INFO
, "FW CFG Signature: 0x%x\n", Signature
));
45 QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion
);
46 Revision
= QemuFwCfgRead32 ();
47 DEBUG ((EFI_D_INFO
, "FW CFG Revision: 0x%x\n", Revision
));
48 if ((Signature
!= SIGNATURE_32 ('Q', 'E', 'M', 'U')) ||
51 DEBUG ((EFI_D_INFO
, "QemuFwCfg interface not supported.\n"));
55 DEBUG ((EFI_D_INFO
, "QemuFwCfg interface is supported.\n"));
61 Returns a boolean indicating if the firmware configuration interface is
62 available for library-internal purposes.
64 This function never changes fw_cfg state.
66 @retval TRUE The interface is available internally.
67 @retval FALSE The interface is not available internally.
71 InternalQemuFwCfgIsAvailable (
76 // We always return TRUE, because the consumer of this library ought to have
77 // called QemuFwCfgIsAvailable before making other calls which would hit this