forked from naydef/IntelFSPLeak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fsp.h
160 lines (144 loc) · 3.32 KB
/
fsp.h
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
typedef uint32_t EFI_STATUS;
#define EFI_SUCCESS 0
#define EFI_INVALID_PARAMETER 0x80000002
#define EFI_UNSUPPORTED 0x80000003 /* The FSP calling conditions were not met. */
#define EFI_OUT_OF_RESOURCES 0x80000009
// This might be reserved by FSP-M. It seems to be there's a iomap resource HOB at 0xFED00000 of size 0x1000
#define FSP_DATA_ADDR (void **) 0xFED00148
enum {
FSP_ACTION_TEMP_RAM_INIT = 1,
FSP_ACTION_NOTIFY = 2,
FSP_ACTION_MEMORY_INIT = 3,
FSP_ACTION_TEMP_RAM_EXIT = 4,
FSP_ACTION_SILICON_INIT = 5,
}
typedef union {
struct {
uint16_t offset_1; // offset bits 0..15
uint16_t selector; // a code segment selector in GDT or LDT
uint8_t zero; // unused, set to 0
uint8_t type_attr; // type and attributes, see below
uint16_t offset_2; // offset bits 16..31
};
struct {
uint32_t idt_1;
uint32_t idt_2;
}
} IDTDescr;
typedef struct {
uint16_t limit;
uint32_t base;
} IDT_s;
typedef struct {
uint32_t Signature; // 0x00
uint32_t Zero1;
uint32_t StackPointer; // 0x08
uint32_t PostCode; // 0x0C
uint32_t Unused1[13];
uint32_t InfoHeaderPtr; // 0x44
uint32_t ConfigPtr; // 0z48
uint32_t Unused2;
uint32_t ConfigPtr2; // Gets initialized to config pointer, ends up as something else
uint32_t Zero2;
uint8_t Action; // 0x58
uint8_t Unused3[31];
uint32_t PerfSignature; // 0x78
uint32_t Zero3;
uint32_t TSCIndex; // 0x80
// Last byte of the TSC is replaced by a value given by the FSP code
uint64_t TSC[0x20]; // 0x84-0x88 + index*8
} FSP_DATA;
typedef struct
{
char Signature[4];
int HeaderLength;
__int16 Reserved1;
char SpecVersion;
char HeaderRevision;
int ImageRevision;
char ImageId[8];
int ImageSize;
int ImageBase;
__int16 ImageAttribute;
__int16 ComponentAttribute;
void *CfgRegionOffset;
int CfgRegionSize;
int Reserved2;
void *TempRamInitEntryOffset;
int Reserved3;
void *NotifyPhaseEntryOffset;
void *FspMemoryinitEntryOffset;
void *TempRamExitEntryOffset;
void *FspSiliconInitEntryOffset;
} InfoHeader;
/* 24 */
struct CPU_IO_PPI
{
void *MemRead;
void *MemWrite;
void *IoRead;
void *IoWrite;
void *IoRead8;
void *IoRead16;
void *IoRead32;
void *IoRead64;
void *IoWrite8;
void *IoWrite16;
void *IoWrite32;
void *IoWrite64;
void *MemRead8;
void *MemRead16;
void *MemRead32;
void *MemRead64;
void *MemWrite8;
void *MemWrite16;
void *MemWrite32;
void *MemWrite64;
};
/* 25 */
struct __unaligned __declspec(align(2)) PCI_CFG2_PPI
{
void *Read;
void *Write;
void *Modify;
__int16 Segment;
};
/* 23 */
struct EFI_PEI_SERVICES
{
EFI_TABLE_HEADER Hdr;
void *InstallPpi;
void *ReInstallPpi;
void *LocatePpi;
void *NotifyPpi;
void *GetBootMode;
void *SetBootMode;
void *GetHobList;
void *CreateHob;
void *FfsFindNextVolume;
void *FfsFindNextFile;
void *FfsFindSectionData;
void *InstallPeiMemory;
void *AllocatePages;
void *AllocatePool;
void *CopyMem;
void *SetMem;
void *ReportStatusCode;
void *ResetSystem;
CPU_IO_PPI *CpuIo;
PCI_CFG2_PPI *PciCfg;
void *FfsFindFileByName;
void *FfsGetFileInfo;
void *FfsGetVolumeInfo;
void *RegisterForShadow;
void *FindSectionData3;
void *FfsGetFileInfo2;
void *ResetSystem2;
};
inline PEI_SERVICE ** GetPeiServices () {
IDT_s IDT;
void *ptr;
__sidt(IDT);
ptr = IDT.base;
return *(ptr - 4);
}