3 Stateful and implicitly initialized fw_cfg library implementation.
5 Copyright (C) 2013, Red Hat, Inc.
6 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available
9 under the terms and conditions of the BSD License which accompanies this
10 distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
14 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Library/DebugLib.h>
18 #include <Library/QemuFwCfgLib.h>
20 #include "QemuFwCfgLibInternal.h"
22 STATIC BOOLEAN mQemuFwCfgSupported
= FALSE
;
26 Returns a boolean indicating if the firmware configuration interface
29 This function may change fw_cfg state.
31 @retval TRUE The interface is available
32 @retval FALSE The interface is not available
37 QemuFwCfgIsAvailable (
41 return InternalQemuFwCfgIsAvailable ();
55 // Enable the access routines while probing to see if it is supported.
57 mQemuFwCfgSupported
= TRUE
;
59 QemuFwCfgSelectItem (QemuFwCfgItemSignature
);
60 Signature
= QemuFwCfgRead32 ();
61 DEBUG ((EFI_D_INFO
, "FW CFG Signature: 0x%x\n", Signature
));
62 QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion
);
63 Revision
= QemuFwCfgRead32 ();
64 DEBUG ((EFI_D_INFO
, "FW CFG Revision: 0x%x\n", Revision
));
65 if ((Signature
!= SIGNATURE_32 ('Q', 'E', 'M', 'U')) ||
68 DEBUG ((EFI_D_INFO
, "QemuFwCfg interface not supported.\n"));
69 mQemuFwCfgSupported
= FALSE
;
70 return RETURN_SUCCESS
;
73 DEBUG ((EFI_D_INFO
, "QemuFwCfg interface is supported.\n"));
74 return RETURN_SUCCESS
;
79 Returns a boolean indicating if the firmware configuration interface is
80 available for library-internal purposes.
82 This function never changes fw_cfg state.
84 @retval TRUE The interface is available internally.
85 @retval FALSE The interface is not available internally.
88 InternalQemuFwCfgIsAvailable (
92 return mQemuFwCfgSupported
;