1 | /** @file
|
---|
2 | Migrates SEC structures after permanent memory is installed.
|
---|
3 |
|
---|
4 | Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef __SEC_MIGRATION_H__
|
---|
10 | #define __SEC_MIGRATION_H__
|
---|
11 |
|
---|
12 | #include <Base.h>
|
---|
13 |
|
---|
14 | #include <Pi/PiPeiCis.h>
|
---|
15 | #include <Ppi/RepublishSecPpi.h>
|
---|
16 | #include <Ppi/SecPerformance.h>
|
---|
17 | #include <Ppi/SecPlatformInformation.h>
|
---|
18 | #include <Ppi/SecPlatformInformation2.h>
|
---|
19 | #include <Ppi/TemporaryRamDone.h>
|
---|
20 | #include <Ppi/TemporaryRamSupport.h>
|
---|
21 |
|
---|
22 | /**
|
---|
23 | This interface conveys state information out of the Security (SEC) phase into PEI.
|
---|
24 |
|
---|
25 | @param[in] PeiServices Pointer to the PEI Services Table.
|
---|
26 | @param[in,out] StructureSize Pointer to the variable describing size of the input buffer.
|
---|
27 | @param[out] PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
|
---|
28 |
|
---|
29 | @retval EFI_SUCCESS The data was successfully returned.
|
---|
30 | @retval EFI_NOT_FOUND Can't found the HOB created by SecMigrationPei component.
|
---|
31 | @retval EFI_BUFFER_TOO_SMALL The size of buffer pointed by StructureSize is too small and will return
|
---|
32 | the minimal required size in the buffer pointed by StructureSize.
|
---|
33 | @retval EFI_INVALID_PARAMETER The StructureSize is NULL or PlatformInformationRecord is NULL.
|
---|
34 |
|
---|
35 | **/
|
---|
36 | EFI_STATUS
|
---|
37 | EFIAPI
|
---|
38 | SecPlatformInformationPostMemory (
|
---|
39 | IN CONST EFI_PEI_SERVICES **PeiServices,
|
---|
40 | IN OUT UINT64 *StructureSize,
|
---|
41 | OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
|
---|
42 | );
|
---|
43 |
|
---|
44 | /**
|
---|
45 | Re-installs the SEC Platform Information PPIs to implementation in this module to support post-memory.
|
---|
46 |
|
---|
47 | @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
|
---|
48 | @param[in] NotifyDescriptor Address of the notification descriptor data structure.
|
---|
49 | @param[in] Ppi Address of the PPI that was installed.
|
---|
50 |
|
---|
51 | @retval EFI_SUCCESS The SEC Platform Information PPI could not be re-installed.
|
---|
52 | @return Others An error occurred during PPI re-install.
|
---|
53 |
|
---|
54 | **/
|
---|
55 | EFI_STATUS
|
---|
56 | EFIAPI
|
---|
57 | SecPlatformInformationPpiNotifyCallback (
|
---|
58 | IN EFI_PEI_SERVICES **PeiServices,
|
---|
59 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
|
---|
60 | IN VOID *Ppi
|
---|
61 | );
|
---|
62 |
|
---|
63 | /**
|
---|
64 | This interface re-installs PPIs installed in SecCore from a post-memory PEIM.
|
---|
65 |
|
---|
66 | This is to allow a platform that may not support relocation of SecCore to update the PPI instance to a post-memory
|
---|
67 | copy from a PEIM that has been shadowed to permanent memory.
|
---|
68 |
|
---|
69 | @retval EFI_SUCCESS The SecCore PPIs were re-installed successfully.
|
---|
70 | @retval Others An error occurred re-installing the SecCore PPIs.
|
---|
71 |
|
---|
72 | **/
|
---|
73 | EFI_STATUS
|
---|
74 | EFIAPI
|
---|
75 | RepublishSecPpis (
|
---|
76 | VOID
|
---|
77 | );
|
---|
78 |
|
---|
79 | /**
|
---|
80 | Disables the use of Temporary RAM.
|
---|
81 |
|
---|
82 | If present, this service is invoked by the PEI Foundation after
|
---|
83 | the EFI_PEI_PERMANANT_MEMORY_INSTALLED_PPI is installed.
|
---|
84 |
|
---|
85 | @retval EFI_SUCCESS Dummy function, alway return this value.
|
---|
86 |
|
---|
87 | **/
|
---|
88 | EFI_STATUS
|
---|
89 | EFIAPI
|
---|
90 | SecTemporaryRamDonePostMemory (
|
---|
91 | VOID
|
---|
92 | );
|
---|
93 |
|
---|
94 | /**
|
---|
95 | This service of the EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
|
---|
96 | permanent memory.
|
---|
97 |
|
---|
98 | @param PeiServices Pointer to the PEI Services Table.
|
---|
99 | @param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
|
---|
100 | Temporary RAM contents.
|
---|
101 | @param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
|
---|
102 | Temporary RAM contents.
|
---|
103 | @param CopySize Amount of memory to migrate from temporary to permanent memory.
|
---|
104 |
|
---|
105 | @retval EFI_SUCCESS The data was successfully returned.
|
---|
106 | @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
|
---|
107 | TemporaryMemoryBase > PermanentMemoryBase.
|
---|
108 |
|
---|
109 | **/
|
---|
110 | EFI_STATUS
|
---|
111 | EFIAPI
|
---|
112 | SecTemporaryRamSupportPostMemory (
|
---|
113 | IN CONST EFI_PEI_SERVICES **PeiServices,
|
---|
114 | IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
|
---|
115 | IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
|
---|
116 | IN UINTN CopySize
|
---|
117 | );
|
---|
118 |
|
---|
119 | /**
|
---|
120 | This interface conveys performance information out of the Security (SEC) phase into PEI.
|
---|
121 |
|
---|
122 | This service is published by the SEC phase. The SEC phase handoff has an optional
|
---|
123 | EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is passed from SEC into the
|
---|
124 | PEI Foundation. As such, if the platform supports collecting performance data in SEC,
|
---|
125 | this information is encapsulated into the data structure abstracted by this service.
|
---|
126 | This information is collected for the boot-strap processor (BSP) on IA-32.
|
---|
127 |
|
---|
128 | @param[in] PeiServices The pointer to the PEI Services Table.
|
---|
129 | @param[in] This The pointer to this instance of the PEI_SEC_PERFORMANCE_PPI.
|
---|
130 | @param[out] Performance The pointer to performance data collected in SEC phase.
|
---|
131 |
|
---|
132 | @retval EFI_SUCCESS The performance data was successfully returned.
|
---|
133 | @retval EFI_INVALID_PARAMETER The This or Performance is NULL.
|
---|
134 | @retval EFI_NOT_FOUND Can't found the HOB created by the SecMigrationPei component.
|
---|
135 |
|
---|
136 | **/
|
---|
137 | EFI_STATUS
|
---|
138 | EFIAPI
|
---|
139 | GetPerformancePostMemory (
|
---|
140 | IN CONST EFI_PEI_SERVICES **PeiServices,
|
---|
141 | IN PEI_SEC_PERFORMANCE_PPI *This,
|
---|
142 | OUT FIRMWARE_SEC_PERFORMANCE *Performance
|
---|
143 | );
|
---|
144 |
|
---|
145 | typedef struct {
|
---|
146 | UINT64 StructureSize;
|
---|
147 | EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord;
|
---|
148 | } SEC_PLATFORM_INFORMATION_CONTEXT;
|
---|
149 |
|
---|
150 | typedef struct {
|
---|
151 | EFI_HOB_GUID_TYPE Header;
|
---|
152 | UINT8 Revision;
|
---|
153 | UINT8 Reserved[3];
|
---|
154 | FIRMWARE_SEC_PERFORMANCE FirmwareSecPerformance;
|
---|
155 | SEC_PLATFORM_INFORMATION_CONTEXT Context;
|
---|
156 | } SEC_PLATFORM_INFORMATION_CONTEXT_HOB;
|
---|
157 |
|
---|
158 | #endif
|
---|