VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/PrmPkg/PrmSsdtInstallDxe/PrmSsdtInstallDxe.c@ 99454

Last change on this file since 99454 was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/** @file
2
3 This file contains a sample implementation of the Platform Runtime Mechanism (PRM)
4 SSDT Install library.
5
6 Copyright (c) Microsoft Corporation
7 Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11
12#include <IndustryStandard/Acpi.h>
13#include <Library/BaseLib.h>
14#include <Library/BaseMemoryLib.h>
15#include <Library/DebugLib.h>
16#include <Library/DxeServicesLib.h>
17#include <Library/UefiBootServicesTableLib.h>
18#include <Protocol/AcpiTable.h>
19
20#define _DBGMSGID_ "[PRMSSDTINSTALL]"
21
22/**
23 Installs the PRM SSDT.
24
25 @param[in] OemId OEM ID to be used in the SSDT installation.
26
27 @retval EFI_SUCCESS The PRM SSDT was installed successfully.
28 @retval EFI_INVALID_PARAMETER The OemId pointer argument is NULL.
29 @retval EFI_NOT_FOUND An instance of gEfiAcpiTableProtocolGuid was not found installed or
30 the SSDT (AML RAW section) could not be found in the current FV.
31 @retval EFI_OUT_OF_RESOURCES Insufficient memory resources to install the PRM SSDT.
32
33**/
34EFI_STATUS
35InstallPrmSsdt (
36 IN CONST UINT8 *OemId
37 )
38{
39 EFI_STATUS Status;
40 UINTN SsdtSize;
41 UINTN TableKey;
42 EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
43 EFI_ACPI_DESCRIPTION_HEADER *Ssdt;
44
45 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
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_, __FUNCTION__));
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
87/**
88 The entry point for this module.
89
90 @param[in] ImageHandle The firmware allocated handle for the EFI image.
91 @param[in] SystemTable A pointer to the EFI System Table.
92
93 @retval EFI_SUCCESS The entry point is executed successfully.
94 @retval Others An error occurred when executing this entry point.
95
96**/
97EFI_STATUS
98EFIAPI
99PrmSsdtInstallEntryPoint (
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}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette