blob: 868e32bf7f6040af23a9c65657f5da8993930ec4 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/** @file
CcProbeLib is used to probe the Confidential computing guest type.
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Uefi/UefiBaseType.h>
#include <Library/CcProbeLib.h>
#include <WorkArea.h>
STATIC UINT8 mCcProbeGuestType = 0;
STATIC BOOLEAN mCcProbed = FALSE;
/**
* Read the the ConfidentialComputing Guest type from Ovmf work-area.
*
* @return The ConfidentialComputing Guest type
*/
STATIC
UINT8
ReadCcGuestType (
VOID
)
{
OVMF_WORK_AREA *WorkArea;
if (!mCcProbed) {
WorkArea = (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase);
mCcProbeGuestType = WorkArea != NULL ? WorkArea->Header.GuestType : CcGuestTypeNonEncrypted;
mCcProbed = TRUE;
}
return mCcProbeGuestType;
}
/**
Probe the ConfidentialComputing Guest type. See defition of
CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>.
@return The guest type
**/
UINT8
EFIAPI
CcProbe (
VOID
)
{
return ReadCcGuestType ();
}
/**
* Constructor of DxeCcProbeLib
*
* @return EFI_SUCCESS Successfully called of constructor
*/
EFI_STATUS
EFIAPI
DxeCcProbeLibConstructor (
VOID
)
{
ReadCcGuestType ();
return EFI_SUCCESS;
}
|