]>
Commit | Line | Data |
---|---|---|
39d76b25 SM |
1 | /** @file\r |
2 | \r | |
3 | The KvmtoolPlatformDxe performs the platform specific initialization like:\r | |
4 | - It decides if the firmware should expose ACPI or Device Tree-based\r | |
5 | hardware description to the operating system.\r | |
6 | \r | |
7 | Copyright (c) 2018 - 2020, ARM Limited. All rights reserved.\r | |
8 | \r | |
9 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
10 | \r | |
11 | **/\r | |
12 | \r | |
13 | #include <Guid/VariableFormat.h>\r | |
14 | #include <Library/BaseLib.h>\r | |
15 | #include <Library/DebugLib.h>\r | |
16 | #include <Library/UefiBootServicesTableLib.h>\r | |
17 | #include <Protocol/FdtClient.h>\r | |
18 | \r | |
19 | /** Decide if the firmware should expose ACPI tables or Device Tree and\r | |
20 | install the appropriate protocol interface.\r | |
21 | \r | |
22 | Note: This function is derived from "ArmVirtPkg/PlatformHasAcpiDtDxe",\r | |
23 | by dropping the word size check, and the fw_cfg check.\r | |
24 | \r | |
25 | @param [in] ImageHandle Handle for this image.\r | |
26 | \r | |
27 | @retval EFI_SUCCESS Success.\r | |
28 | @retval EFI_OUT_OF_RESOURCES There was not enough memory to install the\r | |
29 | protocols.\r | |
30 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
31 | \r | |
32 | **/\r | |
33 | STATIC\r | |
34 | EFI_STATUS\r | |
35 | PlatformHasAcpiDt (\r | |
2b16a4fb | 36 | IN EFI_HANDLE ImageHandle\r |
39d76b25 SM |
37 | )\r |
38 | {\r | |
39 | if (!PcdGetBool (PcdForceNoAcpi)) {\r | |
40 | // Expose ACPI tables\r | |
41 | return gBS->InstallProtocolInterface (\r | |
42 | &ImageHandle,\r | |
43 | &gEdkiiPlatformHasAcpiGuid,\r | |
44 | EFI_NATIVE_INTERFACE,\r | |
45 | NULL\r | |
46 | );\r | |
47 | }\r | |
48 | \r | |
49 | // Expose the Device Tree.\r | |
50 | return gBS->InstallProtocolInterface (\r | |
51 | &ImageHandle,\r | |
52 | &gEdkiiPlatformHasDeviceTreeGuid,\r | |
53 | EFI_NATIVE_INTERFACE,\r | |
54 | NULL\r | |
55 | );\r | |
56 | }\r | |
57 | \r | |
58 | /** Entry point for Kvmtool Platform Dxe\r | |
59 | \r | |
60 | @param [in] ImageHandle Handle for this image.\r | |
61 | @param [in] SystemTable Pointer to the EFI system table.\r | |
62 | \r | |
63 | @retval EFI_SUCCESS Success.\r | |
64 | @retval EFI_OUT_OF_RESOURCES There was not enough memory to install the\r | |
65 | protocols.\r | |
66 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
67 | \r | |
68 | **/\r | |
69 | EFI_STATUS\r | |
70 | EFIAPI\r | |
71 | KvmtoolPlatformDxeEntryPoint (\r | |
2b16a4fb MK |
72 | IN EFI_HANDLE ImageHandle,\r |
73 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
39d76b25 SM |
74 | )\r |
75 | {\r | |
2b16a4fb | 76 | EFI_STATUS Status;\r |
39d76b25 SM |
77 | \r |
78 | Status = PlatformHasAcpiDt (ImageHandle);\r | |
79 | ASSERT_EFI_ERROR (Status);\r | |
80 | \r | |
81 | return Status;\r | |
82 | }\r |