2 Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
3 hardware description to the operating system.
5 Copyright (c) 2017, Red Hat, Inc.
7 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Guid/PlatformHasAcpi.h>
11 #include <Guid/PlatformHasDeviceTree.h>
12 #include <Library/BaseLib.h>
13 #include <Library/DebugLib.h>
14 #include <Library/PcdLib.h>
15 #include <Library/QemuFwCfgLib.h>
16 #include <Library/UefiBootServicesTableLib.h>
21 IN EFI_HANDLE ImageHandle
,
22 IN EFI_SYSTEM_TABLE
*SystemTable
26 FIRMWARE_CONFIG_ITEM FwCfgItem
;
30 // If we fail to install any of the necessary protocols below, the OS will be
31 // unbootable anyway (due to lacking hardware description), so tolerate no
34 if ((MAX_UINTN
== MAX_UINT64
) &&
35 !PcdGetBool (PcdForceNoAcpi
) &&
45 // Only make ACPI available on 64-bit systems, and only if QEMU generates
46 // (a subset of) the ACPI tables.
48 Status
= gBS
->InstallProtocolInterface (
50 &gEdkiiPlatformHasAcpiGuid
,
54 if (EFI_ERROR (Status
)) {
62 // Expose the Device Tree otherwise.
64 Status
= gBS
->InstallProtocolInterface (
66 &gEdkiiPlatformHasDeviceTreeGuid
,
70 if (EFI_ERROR (Status
)) {
77 ASSERT_EFI_ERROR (Status
);
80 // Keep compilers happy.