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) 2021, Arm Limited. All rights reserved.<BR>
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/UefiBootServicesTableLib.h>
17 /** Entry point for the Cloud Hypervisor PlatformHasAcpiDtDxe.
19 @param [in] ImageHandle Handle for this image.
20 @param [in] SystemTable Pointer to the EFI system table.
22 @return EFI_SUCCESS If ACPI or Device Tree based hardware
23 description protocol was installed.
24 @return EFI_INVALID_PARAMETER A parameter was invalid.
25 @return EFI_OUT_OF_RESOURCES Insufficient resources exist to complete
31 IN EFI_HANDLE ImageHandle
,
32 IN EFI_SYSTEM_TABLE
*SystemTable
38 // If we fail to install any of the necessary protocols below, the OS will be
39 // unbootable anyway (due to lacking hardware description), so tolerate no
42 if ((MAX_UINTN
== MAX_UINT64
) &&
43 !PcdGetBool (PcdForceNoAcpi
))
45 Status
= gBS
->InstallProtocolInterface (
47 &gEdkiiPlatformHasAcpiGuid
,
51 if (EFI_ERROR (Status
)) {
59 // Expose the Device Tree otherwise.
61 Status
= gBS
->InstallProtocolInterface (
63 &gEdkiiPlatformHasDeviceTreeGuid
,
67 if (EFI_ERROR (Status
)) {
74 ASSERT_EFI_ERROR (Status
);
77 // Keep compilers happy.