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
) &&
44 // Only make ACPI available on 64-bit systems, and only if QEMU generates
45 // (a subset of) the ACPI tables.
47 Status
= gBS
->InstallProtocolInterface (
49 &gEdkiiPlatformHasAcpiGuid
,
53 if (EFI_ERROR (Status
)) {
61 // Expose the Device Tree otherwise.
63 Status
= gBS
->InstallProtocolInterface (
65 &gEdkiiPlatformHasDeviceTreeGuid
,
69 if (EFI_ERROR (Status
)) {
76 ASSERT_EFI_ERROR (Status
);
79 // Keep compilers happy.