summaryrefslogtreecommitdiff
path: root/Board/EM/FixedBootOrder/FixedBootOrder.h
blob: 9aeb6c0fb878b1b59c0828f2543791e99b9cf7f0 (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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2012, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************
//*****************************************************************//
// $Archive: /Alaska/BIN/Modules/Template/FixedBootOrder Demo/Board/em/FixedBootOrder/FixedBootOrder.h $
//
// $Author: Dukeyeh $
//
// $Revision: 11 $
//
// $Date: 9/09/14 3:36a $
//
//*****************************************************************//
//*****************************************************************//
// Revision History
// ----------------
// $Log: /Alaska/BIN/Modules/Template/FixedBootOrder Demo/Board/em/FixedBootOrder/FixedBootOrder.h $
// 
// 11    9/09/14 3:36a Dukeyeh
// [TAG]  		EIP171752 
// [Category]  	Improvement
// [Description]  	Add FIXED_BOOT_ORDER_SUBMENU_MAX_NUM and
// FIXED_BOOT_ORDER_GROUP_MAX_NUM tokens to decide maximum number of
// submenus and groups at boot time.
// [Files]  		Board\em\FixedBootOrder\FixedBootOrder.sdl
// Board\em\FixedBootOrder\FixedBootOrderTSE.c
// Board\em\FixedBootOrder\FixedBootOrder.h
// Board\em\FixedBootOrder\FixedBootOrder.c
// 
// Board\em\FixedBootOrder\FixedBootOrderHII.h
// FixedBootOrder.cif
// 
// 10    8/13/14 11:19p Walonli
// [TAG]  		EIP180632
// [Category]  	New Feature
// [Description]  	Add FixedBootOrder Protocol to change device/group
// name.
// [Files]  		Board\em\FixedBootOrder\FixedBootOrderTSE.c
// Board\em\FixedBootOrder\FixedBootOrder.h
// Board\em\FixedBootOrder\FixedBootOrder.c
// FixedBootOrder.cif
// 
// 9     5/20/14 3:48a Klzhan
// [TAG]  		EIP167196
// [Category]  	Improvement
// [Description]  	Runtime attribute set for the some of the variable used
// by FixedBootOrder needs to be reviewed.
// [Files]  		Board\em\FixedBootOrder\FixedBootOrder.sdl
// Board\em\FixedBootOrder\FixedBootOrder.mak
// Board\em\FixedBootOrder\FBOSetOrder.c
// Board\em\FixedBootOrder\FixedBootOrderTSE.c
// Board\em\FixedBootOrder\FixedBootOrder.h
// Board\em\FixedBootOrder\FixedBootOrder.c
// Board\em\FixedBootOrder\FixedBootOrder.chm
// Board\em\FixedBootOrder\FixedBootOrderHII.c
// Board\em\FixedBootOrder\FixedBootOrderHII.h
// FixedBootOrder.cif
// 
// 8     4/15/14 2:26a Klzhan
// [TAG]  		EIP143078
// [Category]  	Improvement
// [Description]  	Set LOAD_OPTION_ACTIVE must be 0 when
// LOAD_OPTION_HIDDEN=1
// [Files]  		Board\em\FixedBootOrder\FixedBootOrder.sdl
// Board\em\FixedBootOrder\FixedBootOrder.mak
// Board\em\FixedBootOrder\FBOSetOrder.c
// Board\em\FixedBootOrder\FixedBootOrderTSE.c
// Board\em\FixedBootOrder\FixedBootOrder.h
// Board\em\FixedBootOrder\FixedBootOrder.c
// Board\em\FixedBootOrder\FixedBootOrder.chm
// Board\em\FixedBootOrder\FixedBootOrderHII.c
// Board\em\FixedBootOrder\FixedBootOrderHII.h
// FixedBootOrder.cif
// 
// 7     5/31/13 1:46a Easonchen
// EIP123284
// Set Boot Priority unicode string 
// 
// 6     10/04/12 2:15a Easonchen
// [TAG]  		EIP96232
// [Category]  	Improvement
// [Description]  	Support USB Floppy in UEFI mode
// 
// 5     6/28/12 11:22a Easonchen
// Make a new FixedBootOrder module by utilizing 4.6.4.1 BDS
// functionality. 
// 
// 2     12/06/28 11:04p Readwrite
// 
// 2     12/06/28 10:41p Readwrite
// 
// 4     4/14/11 4:00a Easonchen
// [TAG]  	EIP35562
// [Category]  	Improvement
// [Description]  	In Core 4.6.4.1 or Last, Fixed boot variable name - hex
// digits should be in upper case
// 
// 
// 3     11/12/10 3:46a Easonchen
// n           TAG: EIP22689
// TAG: EIP22689
// Improvement: Support submenu function.
// 
// 2     9/14/10 2:41a Easonchen
// 
// 1     4/15/09 3:35a Jameswang
// 
//*****************************************************************//

//<AMI_FHDR_START>
//**********************************************************************
//
// Name:        FixedBootOrder.h
//
// Description: Header file of FixedBootOrder module
//
//**********************************************************************
//<AMI_FHDR_END>


#ifndef _FIXED_BOOT_ORDER_H
#define _FIXED_BOOT_ORDER_H
#ifdef __cplusplus
extern "C" {
#endif

#ifndef VFRCOMPILE

#define FIXED_BOOT_ORDER_GUID \
    {0xc923ca9, 0xdf73, 0x4ac8, 0xb6, 0xd2, 0x98, 0xdd, 0xc3, 0xd, 0x99, 0xfc}

#define FIXED_BOOT_ORDER_SETUP_GUID \
    {0x7e07911a, 0x4807, 0x4b0f, 0xa4, 0x74, 0xf5, 0x43, 0x1c, 0xa9, 0x07, 0xb4}	

#define DEFAULTS_GUID  \
  {0x4599d26f, 0x1a11, 0x49b8, 0xb9, 0x1f, 0x85, 0x87, 0x45, 0xcf, 0xf8, 0x24}

#define DEFAULT_LEGACY_DEV_ORDER_VARIABLE_GUID  \
  { 0x3c4ead08, 0x45ae, 0x4315, 0x8d, 0x15, 0xa6, 0x0e, 0xaa, 0x8c, 0xaf, 0x69 }

#define VARIABLE_ATTRIBUTES \
	(EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)

#define BS_NV_VARIABLE_ATTRIBUTES \
	(EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)

#pragma pack(1)

typedef struct _FBODevMap {
	UINT16 DevType;
	UINT16 BBSType;
	UINT16 Port;
	UINT8 Attr;
}FBODevMap;

typedef struct _FBOHiiMap {
	UINT16 DevType;
	UINT16 StrToken;
	UINT16 FormID;
	UINT16 Label;
	UINT16 DeviceCountOffset;
}FBOHiiMap;

typedef struct{
	UINT32 Type;
	UINT16 Length;
	UINT16 StrToken[1]; 
}HII_DEVICE_INFO;

typedef struct{
	UINT32 Type;
	UINT16 Length;
	UINT16 Device[1]; 
}UEFI_DEVICE_ORDER;

typedef struct _FBO_DEVICE_INFORM {
    CHAR16 *DevName;
    UINT16 DevType ;
    UINT16 DevPortNum ;
    UINT32 DevBDF ;
    EFI_DEVICE_PATH_PROTOCOL *DevPath;
    struct _FBO_DEVICE_INFORM *Next ;
} FBO_DEVICE_INFORM ;

typedef struct _FBO_GROUP_OPTION {
    UINT16 StrToken;
    CHAR16 *OrgGroupName ;
    CHAR16 *NewGroupName ;
    struct _FBO_GROUP_OPTION *Next ;
} FBO_GROUP_OPTION ;

#pragma pack()
//FBO Attr
//#define TYPES_ALWAYS_PRESENT 0x01
#define F_USB 		0x02
#define F_USBKEY 	0x04

#define FixedBootOrderStratKey	0x1000
#define LegacyBootItemKey	FixedBootOrderStratKey
#define UefiBootItemKey		(FixedBootOrderStratKey+0x80)
#define DualBootItemKey		(FixedBootOrderStratKey+0x100)
#define LegacyForms_StartKey	(FixedBootOrderStratKey+0x200)
#define UefiForms_StartKey	(FixedBootOrderStratKey+0x800)

#if CORE_COMBINED_VERSION > 0x40280	//4.6.4.1 or Last
#define gBootName L"Boot%04X"
#else
#define gBootName L"Boot%04x"
#endif

// Calculate the number of orders in this group (DevOrder->Type)
#define DEVORDER_COUNT(DevOrder) (DevOrder->Length - sizeof(DevOrder->Length)) / sizeof(DevOrder->Device)

#define FBO_LEGACY_DISABLED_MASK    0xff00      // LegacyDevOrder disabled flag mask
#define FBO_LEGACY_ORDER_MASK       0x00ff      // LegacyDevOrder valid BBS index mask
#define FBO_UEFI_DISABLED_MASK      0xff000000  // UefiDevOrder disabled flag mask
#define FBO_UEFI_ORDER_MASK         0x0000ffff  // UefiDevOrde valid Boot number mask

typedef EFI_STATUS (EFIAPI *LOAD_DEFAULT_STRING)();

typedef struct _EFI_FIXED_BOOT_ORDER_SETUP_PROTOCOL {
	LOAD_DEFAULT_STRING load_default_string;
} EFI_FIXED_BOOT_ORDER_SETUP_PROTOCOL;


typedef EFI_STATUS (EFIAPI *FBOSetDevMap)(IN FBODevMap *p);
typedef EFI_STATUS (EFIAPI *FBOSetHiiMap)(IN FBOHiiMap *p);
typedef FBODevMap *(EFIAPI *FBOGetDevMap)(IN VOID);
typedef FBOHiiMap *(EFIAPI *FBOGetHiiMap)(IN VOID);
typedef EFI_STATUS (EFIAPI *FBOSetBootOptionTokenMap)(IN UINT16 *p);    //(EIP123284+)
typedef UINT16 *(EFIAPI *FBOGetBootOptionTokenMap)(IN VOID);            //(EIP123284+)
typedef EFI_STATUS (EFIAPI *FBOSetNewDescription)(IN FBO_DEVICE_INFORM *p);
typedef FBO_DEVICE_INFORM* (EFIAPI *FBOGetNewDescription)(IN VOID);


typedef struct _EFI_FIXED_BOOT_ORDER_PROTOCOL {
	FBOSetDevMap SetLegacyDevMap;
	FBOSetDevMap SetUefiDevMap;
	FBOSetDevMap SetDualDevMap;	
	FBOSetHiiMap SetHiiMap;
    FBOSetBootOptionTokenMap SetBootOptionTokenMap;                     //(EIP123284+)
    FBOSetNewDescription SetNewDescription;
	FBOGetDevMap GetLegacyDevMap;
	FBOGetDevMap GetUefiDevMap;
	FBOGetDevMap GetDualDevMap;
	FBOGetHiiMap GetHiiMap;
    FBOGetBootOptionTokenMap GetBootOptionTokenMap;                     //(EIP123284+)
    FBOGetNewDescription GetNewDescription ;
} EFI_FIXED_BOOT_ORDER_PROTOCOL;


#endif	//#ifndef VFRCOMPILE

//This structure is used for setup.
typedef struct {
	UINT8	LegacyDevice[FIXED_BOOT_ORDER_TOTAL_DEVICES_MAX_NUM];	//groups * submenu device.
	UINT8	UefiDevice[FIXED_BOOT_ORDER_TOTAL_DEVICES_MAX_NUM];	//groups * submenu device.
} FIXED_BOOT_SETUP;

//This structure is used for FixedBootOrder Group control.
typedef struct {
	UINT8	LegacyHDD;
	UINT8	LegacyODD;
	UINT8	LegacyNET;
	UINT8	LegacyUSBHDD;
	UINT8	LegacyUSBODD;
	UINT8	LegacyUSBFDD;
	UINT8	LegacyUSBKEY;
	UINT8	UefiHDD;
	UINT8	UefiODD;
	UINT8	UefiNET;
	UINT8	UefiUSBHDD;
	UINT8	UefiUSBODD;
	UINT8	UefiUSBKEY;
	UINT8   UefiUSBFDD;		//(EIP96232+)
} FIXED_BOOT_GROUP;

#ifdef __cplusplus
}
#endif


#endif  //#ifndef _FIXED_BOOT_ORDER_H

//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2012, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************