UefiCpuPkg/CpuMpPei: Load microcode if found newer revision
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / Microcode.h
1 /** @file
2 Definitions for loading microcode on processors.
3
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _CPU_MICROCODE_H_
16 #define _CPU_MICROCODE_H_
17
18 #define EFI_MSR_IA32_PLATFORM_ID 0x17
19 #define EFI_MSR_IA32_BIOS_UPDT_TRIG 0x79
20 #define EFI_MSR_IA32_BIOS_SIGN_ID 0x8b
21
22 #define MAX_MICROCODE_DESCRIPTOR_LENGTH 100
23
24 typedef struct {
25 VOID *MicrocodeData;
26 UINTN MicrocodeSize;
27 UINT32 ProcessorId;
28 BOOLEAN Load;
29 } MICROCODE_INFO;
30
31 //
32 // Definition for IA32 microcode format
33 //
34 typedef struct {
35 UINT32 HeaderVersion;
36 UINT32 UpdateRevision;
37 UINT32 Date;
38 UINT32 ProcessorId;
39 UINT32 Checksum;
40 UINT32 LoaderRevision;
41 UINT32 ProcessorFlags;
42 UINT32 DataSize;
43 UINT32 TotalSize;
44 UINT8 Reserved[12];
45 } EFI_CPU_MICROCODE_HEADER;
46
47 typedef struct {
48 UINT32 ExtendedSignatureCount;
49 UINT32 ExtendedTableChecksum;
50 UINT8 Reserved[12];
51 } EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER;
52
53 typedef struct {
54 UINT32 ProcessorSignature;
55 UINT32 ProcessorFlag;
56 UINT32 ProcessorChecksum;
57 } EFI_CPU_MICROCODE_EXTENDED_TABLE;
58
59 /**
60 Detect whether specified processor can find matching microcode patch and load it.
61
62 **/
63 VOID
64 MicrocodeDetect (
65 VOID
66 );
67
68 #endif