TianoCore EDK2 master
Loading...
Searching...
No Matches
PrmSsdtInstallDxe.c
Go to the documentation of this file.
1
13#include <Library/BaseLib.h>
15#include <Library/DebugLib.h>
18#include <Protocol/AcpiTable.h>
19
20#define _DBGMSGID_ "[PRMSSDTINSTALL]"
21
36 IN CONST UINT8 *OemId
37 )
38{
39 EFI_STATUS Status;
40 UINTN SsdtSize;
41 UINTN TableKey;
42 EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
44
45 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __func__));
46
47 if (OemId == NULL) {
48 return EFI_INVALID_PARAMETER;
49 }
50
51 Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
52 if (!EFI_ERROR (Status)) {
53 //
54 // Discover the SSDT
55 //
56 Status = GetSectionFromFv (
57 &gEfiCallerIdGuid,
58 EFI_SECTION_RAW,
59 0,
60 (VOID **)&Ssdt,
61 &SsdtSize
62 );
63 ASSERT_EFI_ERROR (Status);
64 DEBUG ((DEBUG_INFO, "%a %a: SSDT loaded...\n", _DBGMSGID_, __func__));
65
66 //
67 // Update OEM ID in the SSDT
68 //
69 CopyMem (&Ssdt->OemId, OemId, sizeof (Ssdt->OemId));
70
71 //
72 // Publish the SSDT. Table is re-checksummed.
73 //
74 TableKey = 0;
75 Status = AcpiTableProtocol->InstallAcpiTable (
76 AcpiTableProtocol,
77 Ssdt,
78 SsdtSize,
79 &TableKey
80 );
81 ASSERT_EFI_ERROR (Status);
82 }
83
84 return Status;
85}
86
98EFIAPI
100 IN EFI_HANDLE ImageHandle,
101 IN EFI_SYSTEM_TABLE *SystemTable
102 )
103{
104 EFI_STATUS Status;
105
106 Status = InstallPrmSsdt ((UINT8 *)PcdGetPtr (PcdAcpiDefaultOemId));
107 ASSERT_EFI_ERROR (Status);
108
109 return Status;
110}
UINT64 UINTN
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS EFIAPI GetSectionFromFv(IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
#define PcdGetPtr(TokenName)
Definition: PcdLib.h:388
EFI_STATUS EFIAPI PrmSsdtInstallEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS InstallPrmSsdt(IN CONST UINT8 *OemId)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_BOOT_SERVICES * gBS