summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/AmdSev/SecretDxe/SecretDxe.c
blob: c3258570e9416453743f8d7345a741a78df0f4ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/** @file
  Confidential Computing Secret configuration table constructor

  Copyright (C) 2020 James Bottomley, IBM Corporation.
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <PiDxe.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Guid/ConfidentialComputingSecret.h>

EFI_STATUS
EFIAPI
InitializeSecretDxe (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
  EFI_STATUS                              Status;
  CONFIDENTIAL_COMPUTING_SECRET_LOCATION  *SecretDxeTable;

  Status = gBS->AllocatePool (
                  EfiACPIReclaimMemory,
                  sizeof (CONFIDENTIAL_COMPUTING_SECRET_LOCATION),
                  (VOID **)&SecretDxeTable
                  );
  if (EFI_ERROR (Status)) {
    return Status;
  }

  SecretDxeTable->Base = FixedPcdGet32 (PcdSevLaunchSecretBase);
  SecretDxeTable->Size = FixedPcdGet32 (PcdSevLaunchSecretSize);

  return gBS->InstallConfigurationTable (
                &gConfidentialComputingSecretGuid,
                SecretDxeTable
                );
}