summaryrefslogtreecommitdiff
path: root/ReferenceCode/Haswell/Include/CpuDataStruct.h
blob: bb2aee4b9480a5c34b1136205e9f56d4646383ed (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/** @file
  CPU data structure

@copyright
  Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
  This software and associated documentation (if any) is furnished
  under a license and may only be used or copied in accordance
  with the terms of the license. Except as permitted by such
  license, no part of this software or documentation may be
  reproduced, stored in a retrieval system, or transmitted in any
  form or by any means without the express written consent of
  Intel Corporation.

  This file contains an 'Intel Peripheral Driver' and is
  licensed for Intel CPUs and chipsets under the terms of your
  license agreement with Intel or your vendor.  This file may
  be modified by the user, subject to additional terms of the
  license agreement
**/
#ifndef _CPU_DATA_STRUCT_H
#define _CPU_DATA_STRUCT_H

#include EFI_GUID_DEFINITION (SmramCpuDataVariable)
#include EFI_GUID_DEFINITION (SmramCpuDataHeader)

#pragma pack(1)
typedef struct {
  UINT16 Limit;
  UINTN  Base;
} PSEUDO_DESCRIPTOR;
#pragma pack()

typedef struct {
  BOOLEAN              APState;
  BOOLEAN              S3BootPath;
  EFI_PHYSICAL_ADDRESS WakeUpBuffer;
  EFI_PHYSICAL_ADDRESS GdtrProfile;
  EFI_PHYSICAL_ADDRESS IdtrProfile;
  EFI_PHYSICAL_ADDRESS CpuPrivateData;
  EFI_PHYSICAL_ADDRESS StackAddress;
  EFI_PHYSICAL_ADDRESS MicrocodePointerBuffer;
  EFI_PHYSICAL_ADDRESS SmramBase;
  EFI_PHYSICAL_ADDRESS SmmStartImageBase;
  UINT32               SmmStartImageSize;
  UINT32               NumberOfCpus;
} ACPI_CPU_DATA;

typedef struct {
  //
  // Guid as Signature.
  //
  EFI_GUID             HeaderGuid;
  EFI_PHYSICAL_ADDRESS AcpiCpuPointer;
  ACPI_CPU_DATA        AcpiCpuData;

  //
  // It points the data defined below.
  //
  EFI_PHYSICAL_ADDRESS GdtrProfileOffset;
  EFI_PHYSICAL_ADDRESS GdtOffset;
  EFI_PHYSICAL_ADDRESS IdtrProfileOffset;
  EFI_PHYSICAL_ADDRESS IdtOffset;
  EFI_PHYSICAL_ADDRESS CpuPrivateDataOffset;
  EFI_PHYSICAL_ADDRESS S3BootScriptTableOffset;
  EFI_PHYSICAL_ADDRESS S3BspMtrrTableOffset;
  EFI_PHYSICAL_ADDRESS MicrocodePointerBufferOffset; ///< It is pointer to pointer array.
  EFI_PHYSICAL_ADDRESS MicrocodeDataBufferOffset;    ///< It is pointer to the data.
  ///
  /// We need put all the data buffer here as well.
  /// These data will be copied to original location in S3.
  ///
  //
  // DataBuffer size
  //
  UINT32 GdtrProfileSize;
  UINT32 GdtSize;
  UINT32 IdtrProfileSize;
  UINT32 IdtSize;
  UINT32 CpuPrivateDataSize;
  UINT32 S3BootScriptTableSize;
  UINT32 S3BspMtrrTableSize;
  UINT32 MicrocodePointerBufferSize;
  UINT32 MicrocodeDataBufferSize;

  //
  //  UINT8                 WakeUpBufferData[WakeUpBufferSize];
  //  UINT8                 GdtrProfileData[GdtrProfileSize];
  //  UINT8                 GdtData[GdtSize];
  //  UINT8                 IdtrProfileData[IdtrProfileSize];
  //  UINT8                 IdtData[IdtSize];
  //  UINT8                 CpuPrivateData[CpuPrivateDataSize];
  //  UINT8                 S3BootScriptTable[S3BootScriptTableSize];
  //  UINT8                 S3BspMtrrTable[S3BspMtrrTableSize];
  //  UINT32                MicrocodePointerBufferData[NumberOfCpus + 1];
  //  UINT8                 MicrocodeDataBufferData[MicrocodeDataBufferSize * NumberOfCpus];
  //
} SMRAM_CPU_DATA;

typedef struct {
  UINT32 RegEax;
  UINT32 RegEbx;
  UINT32 RegEcx;
  UINT32 RegEdx;
} EFI_CPUID_REGISTER;

typedef struct {
  UINT32 HeaderVersion;
  UINT32 UpdateRevision;
  UINT32 Date;
  UINT32 ProcessorId;
  UINT32 Checksum;
  UINT32 LoaderRevision;
  UINT32 ProcessorFlags;
  UINT32 DataSize;
  UINT32 TotalSize;
  UINT8  Reserved[12];
} EFI_CPU_MICROCODE_HEADER;

typedef struct {
  UINT32 ExtendedSignatureCount;
  UINT32 ExtendedTableChecksum;
  UINT8  Reserved[12];
} EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER;

typedef struct {
  UINT32 ProcessorSignature;
  UINT32 ProcessorFlag;
  UINT32 ProcessorChecksum;
} EFI_CPU_MICROCODE_EXTENDED_TABLE;

typedef struct {
  UINT32 Stepping       : 4;
  UINT32 Model          : 4;
  UINT32 Family         : 4;
  UINT32 Type           : 2;
  UINT32 Reserved1      : 2;
  UINT32 ExtendedModel  : 4;
  UINT32 ExtendedFamily : 8;
  UINT32 Reserved2      : 4;
} EFI_CPU_VERSION;

#endif