]> git.proxmox.com Git - mirror_edk2.git/blame - ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
ArmVirtPkg: add PlatformHasAcpiDtDxe
[mirror_edk2.git] / ArmVirtPkg / PlatformHasAcpiDtDxe / PlatformHasAcpiDtDxe.c
CommitLineData
2558bfe3
LE
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) 2017, Red Hat, Inc.\r
6\r
7 This program and the accompanying materials are licensed and made available\r
8 under the terms and conditions of the BSD License which accompanies this\r
9 distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14**/\r
15\r
16#include <Guid/PlatformHasAcpi.h>\r
17#include <Guid/PlatformHasDeviceTree.h>\r
18#include <Library/BaseLib.h>\r
19#include <Library/DebugLib.h>\r
20#include <Library/PcdLib.h>\r
21#include <Library/UefiBootServicesTableLib.h>\r
22\r
23EFI_STATUS\r
24EFIAPI\r
25PlatformHasAcpiDt (\r
26 IN EFI_HANDLE ImageHandle,\r
27 IN EFI_SYSTEM_TABLE *SystemTable\r
28 )\r
29{\r
30 EFI_STATUS Status;\r
31\r
32 Status = EFI_SUCCESS;\r
33\r
34 //\r
35 // If we fail to install any of the necessary protocols below, the OS will be\r
36 // unbootable anyway (due to lacking hardware description), so tolerate no\r
37 // errors here.\r
38 //\r
39 // Always make ACPI available on 64-bit systems.\r
40 //\r
41 if (MAX_UINTN == MAX_UINT64) {\r
42 Status = gBS->InstallProtocolInterface (\r
43 &ImageHandle,\r
44 &gEdkiiPlatformHasAcpiGuid,\r
45 EFI_NATIVE_INTERFACE,\r
46 NULL\r
47 );\r
48 if (EFI_ERROR (Status)) {\r
49 goto Failed;\r
50 }\r
51 }\r
52\r
53 //\r
54 // Expose the Device Tree unless PcdPureAcpiBoot is set.\r
55 //\r
56 if (!FeaturePcdGet (PcdPureAcpiBoot)) {\r
57 Status = gBS->InstallProtocolInterface (\r
58 &ImageHandle,\r
59 &gEdkiiPlatformHasDeviceTreeGuid,\r
60 EFI_NATIVE_INTERFACE,\r
61 NULL\r
62 );\r
63 if (EFI_ERROR (Status)) {\r
64 goto Failed;\r
65 }\r
66 }\r
67\r
68 return Status;\r
69\r
70Failed:\r
71 ASSERT_EFI_ERROR (Status);\r
72 CpuDeadLoop ();\r
73 //\r
74 // Keep compilers happy.\r
75 //\r
76 return Status;\r
77}\r