1 /** @file
2   This file declares EDKII Shadow Microcode PPI.
3 
4   Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
5   SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #ifndef __PPI_SHADOW_MICROCODE_H__
10 #define __PPI_SHADOW_MICROCODE_H__
11 
12 #define EDKII_PEI_SHADOW_MICROCODE_PPI_GUID \
13   { \
14     0x430f6965, 0x9a69, 0x41c5, { 0x93, 0xed, 0x8b, 0xf0, 0x64, 0x35, 0xc1, 0xc6 } \
15   }
16 
17 typedef struct _EDKII_PEI_SHADOW_MICROCODE_PPI  EDKII_PEI_SHADOW_MICROCODE_PPI;
18 
19 typedef struct {
20   UINT32         ProcessorSignature;
21   UINT8          PlatformId;
22 } EDKII_PEI_MICROCODE_CPU_ID;
23 
24 /**
25   Shadow microcode update patches to memory.
26 
27   The function is used for shadowing microcode update patches to a continuous memory.
28   It shall allocate memory buffer and only shadow the microcode patches for those
29   processors specified by MicrocodeCpuId array. The checksum verification may be
30   skiped in this function so the caller must perform checksum verification before
31   using the microcode patches in returned memory buffer.
32 
33   @param[in]  This                 The PPI instance pointer.
34   @param[in]  CpuIdCount           Number of elements in MicrocodeCpuId array.
35   @param[in]  MicrocodeCpuId       A pointer to an array of EDKII_PEI_MICROCODE_CPU_ID
36                                    structures.
37   @param[out] BufferSize           Pointer to receive the total size of Buffer.
38   @param[out] Buffer               Pointer to receive address of allocated memory
39                                    with microcode patches data in it.
40 
41   @retval EFI_SUCCESS              The microcode has been shadowed to memory.
42   @retval EFI_OUT_OF_RESOURCES     The operation fails due to lack of resources.
43 
44 **/
45 typedef
46 EFI_STATUS
47 (EFIAPI *EDKII_PEI_SHADOW_MICROCODE) (
48   IN  EDKII_PEI_SHADOW_MICROCODE_PPI        *This,
49   IN  UINTN                                 CpuIdCount,
50   IN  EDKII_PEI_MICROCODE_CPU_ID            *MicrocodeCpuId,
51   OUT UINTN                                 *BufferSize,
52   OUT VOID                                  **Buffer
53   );
54 
55 ///
56 /// This PPI is installed by some platform or chipset-specific PEIM that
57 /// abstracts handling microcode shadow support.
58 ///
59 struct _EDKII_PEI_SHADOW_MICROCODE_PPI {
60   EDKII_PEI_SHADOW_MICROCODE          ShadowMicrocode;
61 };
62 
63 extern EFI_GUID gEdkiiPeiShadowMicrocodePpiGuid;
64 
65 #endif
66 
67