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