]>
Commit | Line | Data |
---|---|---|
a6141834 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 | |
9792fb0e | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
a6141834 LE |
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/UefiBootServicesTableLib.h>\r | |
15 | \r | |
16 | EFI_STATUS\r | |
17 | EFIAPI\r | |
18 | XenPlatformHasAcpiDt (\r | |
19 | IN EFI_HANDLE ImageHandle,\r | |
20 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
21 | )\r | |
22 | {\r | |
23 | EFI_STATUS Status;\r | |
24 | \r | |
25 | //\r | |
26 | // If we fail to install any of the necessary protocols below, the OS will be\r | |
27 | // unbootable anyway (due to lacking hardware description), so tolerate no\r | |
28 | // errors here.\r | |
29 | //\r | |
30 | // Always make ACPI available on 64-bit systems.\r | |
31 | //\r | |
32 | if (MAX_UINTN == MAX_UINT64) {\r | |
33 | Status = gBS->InstallProtocolInterface (\r | |
34 | &ImageHandle,\r | |
35 | &gEdkiiPlatformHasAcpiGuid,\r | |
36 | EFI_NATIVE_INTERFACE,\r | |
37 | NULL\r | |
38 | );\r | |
39 | if (EFI_ERROR (Status)) {\r | |
40 | goto Failed;\r | |
41 | }\r | |
42 | }\r | |
43 | \r | |
44 | //\r | |
45 | // Expose the Device Tree unconditionally.\r | |
46 | //\r | |
47 | Status = gBS->InstallProtocolInterface (\r | |
48 | &ImageHandle,\r | |
49 | &gEdkiiPlatformHasDeviceTreeGuid,\r | |
50 | EFI_NATIVE_INTERFACE,\r | |
51 | NULL\r | |
52 | );\r | |
53 | if (EFI_ERROR (Status)) {\r | |
54 | goto Failed;\r | |
55 | }\r | |
56 | \r | |
57 | return Status;\r | |
58 | \r | |
59 | Failed:\r | |
60 | ASSERT_EFI_ERROR (Status);\r | |
61 | CpuDeadLoop ();\r | |
62 | //\r | |
63 | // Keep compilers happy.\r | |
64 | //\r | |
65 | return Status;\r | |
66 | }\r |