TianoCore EDK2 master
Loading...
Searching...
No Matches
PlatformHasAcpiDtDxe.c
Go to the documentation of this file.
1
12#include <Library/BaseLib.h>
13#include <Library/DebugLib.h>
14#include <Library/PcdLib.h>
17
19EFIAPI
21 IN EFI_HANDLE ImageHandle,
22 IN EFI_SYSTEM_TABLE *SystemTable
23 )
24{
25 EFI_STATUS Status;
26 FIRMWARE_CONFIG_ITEM FwCfgItem;
27 UINTN FwCfgSize;
28
29 //
30 // If we fail to install any of the necessary protocols below, the OS will be
31 // unbootable anyway (due to lacking hardware description), so tolerate no
32 // errors here.
33 //
34 if ((MAX_UINTN == MAX_UINT64) &&
35 !PcdGetBool (PcdForceNoAcpi) &&
36 !EFI_ERROR (
38 "etc/table-loader",
39 &FwCfgItem,
40 &FwCfgSize
41 )
42 ))
43 {
44 //
45 // Only make ACPI available on 64-bit systems, and only if QEMU generates
46 // (a subset of) the ACPI tables.
47 //
48 Status = gBS->InstallProtocolInterface (
49 &ImageHandle,
50 &gEdkiiPlatformHasAcpiGuid,
52 NULL
53 );
54 if (EFI_ERROR (Status)) {
55 goto Failed;
56 }
57
58 return Status;
59 }
60
61 //
62 // Expose the Device Tree otherwise.
63 //
64 Status = gBS->InstallProtocolInterface (
65 &ImageHandle,
66 &gEdkiiPlatformHasDeviceTreeGuid,
68 NULL
69 );
70 if (EFI_ERROR (Status)) {
71 goto Failed;
72 }
73
74 return Status;
75
76Failed:
77 ASSERT_EFI_ERROR (Status);
78 CpuDeadLoop ();
79 //
80 // Keep compilers happy.
81 //
82 return Status;
83}
UINT64 UINTN
VOID EFIAPI CpuDeadLoop(VOID)
Definition: CpuDeadLoop.c:25
EFI_STATUS EFIAPI PlatformHasAcpiDt(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
RETURN_STATUS EFIAPI QemuFwCfgFindFile(IN CONST CHAR8 *Name, OUT FIRMWARE_CONFIG_ITEM *Item, OUT UINTN *Size)
Definition: QemuFwCfgLib.c:250
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_BOOT_SERVICES * gBS
@ EFI_NATIVE_INTERFACE
Definition: UefiSpec.h:1193