]> git.proxmox.com Git - mirror_edk2.git/blame - ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
ArmVirtPkg: Apply uncrustify changes
[mirror_edk2.git] / ArmVirtPkg / CloudHvPlatformHasAcpiDtDxe / CloudHvHasAcpiDtDxe.c
CommitLineData
31fcee6d
JW
1/** @file\r
2 Decide whether the firmware should expose an ACPI- and/or a Device Tree-based\r
3 hardware description to the operating system.\r
4\r
5 Copyright (c) 2021, Arm Limited. All rights reserved.<BR>\r
6\r
7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
8**/\r
9\r
10#include <Guid/PlatformHasAcpi.h>\r
11#include <Guid/PlatformHasDeviceTree.h>\r
12#include <Library/BaseLib.h>\r
13#include <Library/DebugLib.h>\r
14#include <Library/PcdLib.h>\r
15#include <Library/UefiBootServicesTableLib.h>\r
16\r
17/** Entry point for the Cloud Hypervisor PlatformHasAcpiDtDxe.\r
18\r
19 @param [in] ImageHandle Handle for this image.\r
20 @param [in] SystemTable Pointer to the EFI system table.\r
21\r
22 @return EFI_SUCCESS If ACPI or Device Tree based hardware\r
23 description protocol was installed.\r
24 @return EFI_INVALID_PARAMETER A parameter was invalid.\r
25 @return EFI_OUT_OF_RESOURCES Insufficient resources exist to complete\r
26 the request.\r
27**/\r
28EFI_STATUS\r
29EFIAPI\r
30PlatformHasAcpiDt (\r
2b16a4fb
MK
31 IN EFI_HANDLE ImageHandle,\r
32 IN EFI_SYSTEM_TABLE *SystemTable\r
31fcee6d
JW
33 )\r
34{\r
2b16a4fb 35 EFI_STATUS Status;\r
31fcee6d
JW
36\r
37 //\r
38 // If we fail to install any of the necessary protocols below, the OS will be\r
39 // unbootable anyway (due to lacking hardware description), so tolerate no\r
40 // errors here.\r
41 //\r
2b16a4fb
MK
42 if ((MAX_UINTN == MAX_UINT64) &&\r
43 !PcdGetBool (PcdForceNoAcpi))\r
44 {\r
31fcee6d
JW
45 Status = gBS->InstallProtocolInterface (\r
46 &ImageHandle,\r
47 &gEdkiiPlatformHasAcpiGuid,\r
48 EFI_NATIVE_INTERFACE,\r
49 NULL\r
50 );\r
51 if (EFI_ERROR (Status)) {\r
52 goto Failed;\r
53 }\r
54\r
55 return Status;\r
56 }\r
57\r
58 //\r
59 // Expose the Device Tree otherwise.\r
60 //\r
61 Status = gBS->InstallProtocolInterface (\r
62 &ImageHandle,\r
63 &gEdkiiPlatformHasDeviceTreeGuid,\r
64 EFI_NATIVE_INTERFACE,\r
65 NULL\r
66 );\r
67 if (EFI_ERROR (Status)) {\r
68 goto Failed;\r
69 }\r
70\r
71 return Status;\r
72\r
73Failed:\r
74 ASSERT_EFI_ERROR (Status);\r
75 CpuDeadLoop ();\r
76 //\r
77 // Keep compilers happy.\r
78 //\r
79 return Status;\r
80}\r