2 Public include file for Microcode library.
4 Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef MICROCODE_LIB_H_
10 #define MICROCODE_LIB_H_
12 #include <Register/Intel/Microcode.h>
13 #include <Ppi/ShadowMicrocode.h>
16 Get microcode update signature of currently loaded microcode update.
18 @return Microcode signature.
22 GetProcessorMicrocodeSignature (
27 Get the processor signature and platform ID for current processor.
29 @param MicrocodeCpuId Return the processor signature and platform ID.
33 GetProcessorMicrocodeCpuId (
34 EDKII_PEI_MICROCODE_CPU_ID
*MicrocodeCpuId
38 Return the total size of the microcode entry.
40 Logic follows pseudo code in SDM as below:
43 If (Update.DataSize != 00000000H)
44 N = Update.TotalSize / 4
46 If Microcode is NULL, then ASSERT.
48 @param Microcode Pointer to the microcode entry.
50 @return The microcode total size.
55 IN CPU_MICROCODE_HEADER
*Microcode
59 Load the microcode to the processor.
61 If Microcode is NULL, then ASSERT.
63 @param Microcode Pointer to the microcode entry.
68 IN CPU_MICROCODE_HEADER
*Microcode
72 Detect whether specified processor can find matching microcode patch and load it.
74 Microcode format is as below:
75 +----------------------------------------+-------------------------------------------------+
76 | CPU_MICROCODE_HEADER | |
77 +----------------------------------------+ V
78 | Update Data | CPU_MICROCODE_HEADER.Checksum
79 +----------------------------------------+-------+ ^
80 | CPU_MICROCODE_EXTENDED_TABLE_HEADER | | |
81 +----------------------------------------+ V |
82 | CPU_MICROCODE_EXTENDED_TABLE[0] | CPU_MICROCODE_EXTENDED_TABLE_HEADER.Checksum |
83 | CPU_MICROCODE_EXTENDED_TABLE[1] | ^ |
85 +----------------------------------------+-------+-----------------------------------------+
87 There may by multiple CPU_MICROCODE_EXTENDED_TABLE in this format.
88 The count of CPU_MICROCODE_EXTENDED_TABLE is indicated by ExtendedSignatureCount
89 of CPU_MICROCODE_EXTENDED_TABLE_HEADER structure.
91 If Microcode is NULL, then ASSERT.
93 @param Microcode Pointer to a microcode entry.
94 @param MicrocodeLength The total length of the microcode entry.
95 @param MinimumRevision The microcode whose revision <= MinimumRevision is treated as invalid.
96 Caller can supply value get from GetProcessorMicrocodeSignature() to check
97 whether the microcode is newer than loaded one.
98 Caller can supply 0 to treat any revision (except 0) microcode as valid.
99 @param MicrocodeCpuIds Pointer to an array of processor signature and platform ID that represents
101 Caller can supply zero-element array to skip the processor signature and
103 @param MicrocodeCpuIdCount The number of elements in MicrocodeCpuIds.
104 @param VerifyChecksum FALSE to skip all the checksum verifications.
106 @retval TRUE The microcode is valid.
107 @retval FALSE The microcode is invalid.
112 IN CPU_MICROCODE_HEADER
*Microcode
,
113 IN UINTN MicrocodeLength
,
114 IN UINT32 MinimumRevision
,
115 IN EDKII_PEI_MICROCODE_CPU_ID
*MicrocodeCpuIds
,
116 IN UINTN MicrocodeCpuIdCount
,
117 IN BOOLEAN VerifyChecksum