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>
22 #include "QemuFwCfgLibInternal.h"
25 Returns a boolean indicating if the firmware configuration interface
28 This function may change fw_cfg state.
30 @retval TRUE The interface is available
31 @retval FALSE The interface is not available
36 QemuFwCfgIsAvailable (
43 QemuFwCfgSelectItem (QemuFwCfgItemSignature
);
44 Signature
= QemuFwCfgRead32 ();
45 DEBUG ((EFI_D_INFO
, "FW CFG Signature: 0x%x\n", Signature
));
46 QemuFwCfgSelectItem (QemuFwCfgItemInterfaceVersion
);
47 Revision
= QemuFwCfgRead32 ();
48 DEBUG ((EFI_D_INFO
, "FW CFG Revision: 0x%x\n", Revision
));
49 if ((Signature
!= SIGNATURE_32 ('Q', 'E', 'M', 'U')) ||
52 DEBUG ((EFI_D_INFO
, "QemuFwCfg interface not supported.\n"));
56 DEBUG ((EFI_D_INFO
, "QemuFwCfg interface is supported.\n"));
62 Returns a boolean indicating if the firmware configuration interface is
63 available for library-internal purposes.
65 This function never changes fw_cfg state.
67 @retval TRUE The interface is available internally.
68 @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
84 Returns a boolean indicating whether QEMU provides the DMA-like access method
87 @retval TRUE The DMA-like access method is available.
88 @retval FALSE The DMA-like access method is unavailable.
91 InternalQemuFwCfgDmaIsAvailable (