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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
|
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//
//** **//
//** (C)Copyright 2011, American Megatrends, Inc. **//
//** **//
//** All Rights Reserved. **//
//** **//
//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **//
//** **//
//** Phone (770)-246-8600 **//
//** **//
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//
// $Archive: /Alaska/BIN/Modules/AMITSE2_0/AMITSE/Inc/boot.h $
//
// $Author: Arunsb $
//
// $Revision: 12 $
//
// $Date: 10/18/12 5:31a $
//
//*****************************************************************//
//*****************************************************************//
// Revision History
// ----------------
// $Log: /Alaska/BIN/Modules/AMITSE2_0/AMITSE/Inc/boot.h $
//
// 12 10/18/12 5:31a Arunsb
// Updated for 2.16.1235 QA submission
//
// 8 10/10/12 12:23p Arunsb
// Synched the source for v2.16.1232 backup with Aptio
//
// 10 9/21/12 9:41a Premkumara
// [TAG] EIP 97704
// [Category] Improvement
// [Description] Support BootFFFF variable
// [Files] Boot.h, Boot.c, Special.c
//
// 9 5/29/12 2:55a Arunsb
// [TAG] EIP91109
// [Category] Improvement
// [Description] Sync the Aptio IV source for AptioV
// [Files] boot.h
//
// 8 11/13/11 12:21p Arunsb
// [TAG] EIP70421
// [Category] New Feature
// [Description] Support for driver order in TSE
// [Files] AMITSE.SDL, CommonHelper.c, setup.ini, uefisetup.ini,
// boot.c,
// minisetup.h, bbs.c, special.c, special.h, tseadvanced.c,
// addbootoption.c,
// callback.c, minisetupext.c, minisetupext.h, popupsel.c, popupsel.h,
// TseLitehelper.c, variable.c, Uefi21Wapper.c, AMIVfr.h, boot.h,
// TseElink.h, variable.h,
// setup.h, Boot.vfr and Setup.uni
//
// 7 6/20/11 11:38a Rajashakerg
// [TAG] EIP59417
// [Category] New Feature
// [Description] Spport LOAD_OPTION_HIDDEN option in TSE
// [Files] boot.h, AMITSE.sdl, CommonHelper.c, bbs.c, boot.c,
// minisetup.h, special.c, callback.c
//
// 6 3/15/11 5:11a Rajashakerg
// [TAG] EIP51671
// [Category] New Feature
// [Description] Boot overide menu devices are not disable
// [Files] boot.c, minisetup.h, special.c, minisetupext.c, AMITSE.sdl,
// boot.h, CommonHelper.c
//
// 5 9/20/10 6:46p Madhans
// [TAG] EIP44542
// [Category] BUILD ISSUE FIX
// [Symptom] Build issues with TSE label (INT)4.6.2_TSE_2_10_1207_TEST
// when IdeSecurity and FastBoot modules added to the project
// [RootCause] -
// [Solution] Build issues resolved
// [Files] CommonHelper.c, Tsecommon.h, Hiilib.h, Boot.h, minisetup.h,
// bbs.c, special.c, Bds.c TseLitehelp
//
// 4 3/26/10 5:26p Madhans
// EIP 35562: Support To create Boot option in Capital letters.
//
// 3 2/19/10 12:59p Madhans
// Updated for TSE 2.01. Refer Changelog.log for File change history.
//
// 4 2/19/10 7:59a Mallikarjunanv
// updated the year in copyright message
//
// 3 1/09/10 2:29a Mallikarjunanv
// Updated TSE2.01 Release sources with coding standards
//
// 2 6/24/09 6:33p Madhans
// Coding Standards.
//
// 1 6/09/09 9:53a Madhans
// TSE 2.00.1201
//
// 1 6/04/09 7:49p Madhans
// AMI TSE Advanced.
//
// 1 4/28/09 10:50p Madhans
// Tse 2.0 Code complete Checkin.
//
// 1 4/28/09 10:24p Madhans
// Tse 2.0 Code complete Checkin.
//
//
//*****************************************************************//
//*****************************************************************//
//<AMI_FHDR_START>
//----------------------------------------------------------------------------
//
// Name: boot.h
//
// Description: UEFI Boot related header
//
//----------------------------------------------------------------------------
//<AMI_FHDR_END>
#ifndef _BOOT_H_
#define _BOOT_H_
#if !TSE_USE_EDK_LIBRARY
//EIP:39334 - START
#if TSE_CSM_SUPPORT
#include <Protocol/LegacyBios.h>
#else //If CSM support is not available, then TSE need the following info to build.
#define EFI_LEGACY_BIOS_PROTOCOL_GUID \
{ 0xdb9a1e3d, 0x45cb, 0x4abb, 0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d}
GUID_VARIABLE_DECLARATION(gEfiLegacyBiosProtocolGuid,EFI_LEGACY_BIOS_PROTOCOL_GUID);
#ifndef GUID_VARIABLE_DEFINITION
#include <Protocol/DevicePath.h>
typedef struct _EFI_LEGACY_BIOS_PROTOCOL EFI_LEGACY_BIOS_PROTOCOL;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name: HDD_INFO
//
// Fields:
// Status UINT16 Status of IDE device. See Notes for details.
// Bus UINT32 PCI bus of IDE controller.
// Device UINT32 PCI device of IDE controller.
// Function UINT32 PCI function of IDE controller.
// CommandBaseAddress UINT16 Command ports base address.
// ControlBaseAddress UINT16 Control ports base address.
// BusMasterAddress UINT16 Bus master address.
// IdentifyDrive ATAPI_IDENTIFY Data that identifies the drive data.
//
// Notes:
// The values for the Status field are the following:
// HDD_PRIMARY 0x01
// HDD_SECONDARY 0x02
// HDD_MASTER_ATAPI 0x04
// HDD_SLAVE_ATAPI 0x08
// HDD_MASTER_IDE 0x20
// HDD_SLAVE_IDE 0x40
// HDD_SATA_PATA 0x80
// There is one HDD_INFO structure per IDE controller. The IdentifyDrive is
// one per drive. Index 0 is master and index 1 is slave.
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _ATAPI_IDENTIFY {
UINT16 Raw[256];
} ATAPI_IDENTIFY;
//*************************************************
// IDE device status values
//*************************************************
#define HDD_PRIMARY 0x01
#define HDD_SECONDARY 0x02
#define HDD_MASTER_ATAPI 0x04
#define HDD_SLAVE_ATAPI 0x08
#define HDD_MASTER_IDE 0x20
#define HDD_SLAVE_IDE 0x40
#define HDD_SATA_PATA 0x80
typedef struct _HDD_INFO {
UINT16 Status;
UINT32 Bus;
UINT32 Device;
UINT32 Function;
UINT16 CommandBaseAddress;
UINT16 ControlBaseAddress;
UINT16 BusMasterAddress;
UINT8 HddIrq;
ATAPI_IDENTIFY IdentifyDrive[2];
} HDD_INFO;
//****************************************************
// BBS related definitions
//****************************************************
//
// BootPriority values
//
#define BBS_DO_NOT_BOOT_FROM 0xFFFC
#define BBS_LOWEST_PRIORITY 0xFFFD
#define BBS_UNPRIORITIZED_ENTRY 0xFFFE
#define BBS_IGNORE_ENTRY 0xFFFF
//
// Following is a description of the above fields.
//
// BBS_DO_NOT_BOOT_FROM - Removes a device from the boot list but still
// allows it to be enumerated as a valid device
// under MS-DOS*.
// BBS_LOWEST_PRIORITY - Forces the device to be the last boot device.
// BBS_UNPRIORITIZED_ENTRY - Value that is placed in the BBS_TABLE.BootPriority
// field before priority has been assigned but that
// indicates it is valid entry. Other values indicate
// the priority, with 0x0000 being the highest priority.
// BBS_IGNORE_ENTRY - When placed in the BBS_TABLE.BootPriority field,
// indicates that the entry is to be skipped.
//
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name: BBS_STATUS_FLAGS
//
// Fields:
// OldPosition UINT16:4 Prior priority.
// Reserved1 UINT16:4 Reserved for future use.
// Enabled UINT16:1 If 0, ignore this entry.
// Failed UINT16:1 0-Not known if boot failure occurred; 1-Boot attempt failed.
// MediaPresent UINT16:2 State of media present, see notes.
// Reserved2 UINT16:4 Reserved for future use.
//
// Notes:
// MediaPresent field details:
// 00 = No bootable media is present in the device.
// 01 = Unknown if a bootable media present.
// 10 = Media is present and appears bootable.
// 11 = Reserved.
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct {
UINT16 OldPosition : 4;
UINT16 Reserved1 : 4;
UINT16 Enabled : 1;
UINT16 Failed : 1;
UINT16 MediaPresent: 2;
UINT16 Reserved2 : 4;
} BBS_STATUS_FLAGS;
//****************************************************
// DeviceType values
//****************************************************
#define BBS_FLOPPY 0x01
#define BBS_HARDDISK 0x02
#define BBS_CDROM 0x03
#define BBS_PCMCIA 0x04
#define BBS_USB 0x05
#define BBS_EMBED_NETWORK 0x06
#define BBS_BEV_DEVICE 0x80
#define BBS_UNKNOWN 0xff
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name: BBS_TABLE
//
// Fields:
// BootPriority UINT16 The boot priority for this boot device.
// Bus UINT32 The PCI bus for this boot device.
// Device UINT32 The PCI device for this boot device.
// Function UINT32 The PCI function for the boot device.
// Class UINT8 The PCI class for this boot device..
// SubClass UINT8 The PCI Subclass for this boot device.
// MfgString UINT32 Segment:offset address of an ASCIIZ description.
// DeviceType UINT16 BBS device type.
// StatusFlags BBS_STATUS_FLAGS Status of this boot device.
// BootHandler UINT32 Segment:Offset address of boot loader for IPL devices.
// DescString UINT32 Segment:offset address of an ASCIIZ description string.
// InitPerReserved UINT32 Reserved.
// AdditionalIrq??Handler UINT32 See notes for details.
// AssignedDriveNumber UINT8 The drive number(0x80 -0x8?) assigned by the 16-bit code.
// IBV1 UINT32 IBV specific field.
// IBV2 UINT32 IBV specific field.
//
// Notes:
// The use of AdditionalIrq??Handler fields is IBV dependent. They can be
// used to flag that an OpROM has hooked the specified IRQ. The OpROM
// may be BBS compliant as some SCSI BBS-compliant OpROMs also hook IRQ
// vectors in order to run their BIOS Setup.
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _BBS_TABLE {
UINT16 BootPriority;
UINT32 Bus;
UINT32 Device;
UINT32 Function;
UINT8 Class;
UINT8 SubClass;
UINT16 MfgStringOffset;
UINT16 MfgStringSegment;
UINT16 DeviceType;
BBS_STATUS_FLAGS StatusFlags;
UINT16 BootHandlerOffset;
UINT16 BootHandlerSegment;
UINT16 DescStringOffset;
UINT16 DescStringSegment;
UINT32 InitPerReserved;
UINT32 AdditionalIrq13Handler;
UINT32 AdditionalIrq18Handler;
UINT32 AdditionalIrq19Handler;
UINT32 AdditionalIrq40Handler;
UINT8 AssignedDriveNumber;
UINT32 AdditionalIrq41Handler;
UINT32 AdditionalIrq46Handler;
UINT32 IBV1;
UINT32 IBV2;
} BBS_TABLE;
//<AMI_PHDR_START>
//----------------------------------------------------------------------------
// Name: EFI_LEGACY_BIOS_BOOT
//
// Description: Boots a traditional OS
//
// Input:
// This Indicates the EFI_LEGACY_BIOS_PROTOCOL instance.
// BootOption The EFI device path from BootXXXX variable.
// LoadOptionSize Size of LoadOption.
// LoadOption The load option from BootXXXX variable.
//
// Output:
// EFI_DEVICE_ERROR Failed to boot from any boot device and
// memory is uncorrupted.
//
// Notes: This function normally never returns. It will either boot the OS
// or reset the system if memory has been "corrupted" by loading a
// boot sector and passing control to it.
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_BOOT) (
IN EFI_LEGACY_BIOS_PROTOCOL *This,
IN BBS_BBS_DEVICE_PATH *BootOption,
IN UINT32 LoadOptionsSize,
IN VOID *LoadOptions
);
//<AMI_PHDR_START>
//----------------------------------------------------------------------------
// Name: EFI_LEGACY_BIOS_GET_BBS_INFO
//
// Description: Presents BBS information to external agents.
//
// Input:
// This Indicates the EFI_LEGACY_BIOS_PROTOCOL instance.
// HddCount Number of HDD_INFO structures.
// HddInfo Onboard IDE controller information.
// BbsCount Number of BBS_TABLE structures.
// BbsTable BBS entry.
//
// Output: EFI_SUCCESS
//----------------------------------------------------------------------------
//<AMI_PHDR_END>
typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_GET_BBS_INFO) (
IN EFI_LEGACY_BIOS_PROTOCOL *This,
OUT UINT16 *HddCount,
OUT struct _HDD_INFO **HddInfo,
OUT UINT16 *BbsCount,
IN OUT struct _BBS_TABLE **BbsTable
);
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name: EFI_LEGACY_BIOS_PROTOCOL
//
// Description: Abstracts the traditional BIOS from the rest of EFI. The
// LegacyBoot() member function allows the BDS to support booting
// a traditional OS. EFI thunks drivers that make EFI bindings for
// BIOS INT services use all the other member functions.
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
typedef struct _EFI_LEGACY_BIOS_PROTOCOL {
EFI_LEGACY_BIOS_BOOT LegacyBoot;
EFI_LEGACY_BIOS_GET_BBS_INFO GetBbsInfo;
} EFI_LEGACY_BIOS_PROTOCOL;
#endif //#ifndef GUID_VARIABLE_DEFINITION
#endif //#if !TSE_CSM_SUPPORT
#endif
//EIP:39334 - END
#define MAX_BOOT_OPTIONS 0xFFFF
#ifndef LOAD_OPTION_ACTIVE
#define LOAD_OPTION_ACTIVE 0x00000001
#endif
//EIP:59417 - Checking for LOAD_OPTION_HIDDEN attribute declearaton
#define LOAD_OPTION_HIDDEN 0x00000008
#ifndef LOAD_OPTION_FORCE_RECONNECT
#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
#endif
//EIP-97704 changed macro to global variable
//#define DISABLED_BOOT_OPTION 0xFFFF
//#define DISABLED_DRIVER_OPTION 0xFFFF
extern UINT16 DISABLED_BOOT_OPTION;
extern UINT16 DISABLED_DRIVER_OPTION;
#define BOOT_ORDER_OPTION 0
#define DRIVER_ORDER_OPTION 1
typedef struct _BOOT_OPTION
{
UINT32 Active;
UINT16 PathLength;
CHAR16 Name[1];
}
BOOT_OPTION;
typedef struct _BBS_ORDER_LIST BBS_ORDER_LIST;
typedef struct _BOOT_DATA
{
UINT16 Option;
UINT32 Active;
CHAR16 *Name;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
VOID *LoadOptions;
UINTN LoadOptionSize;
BOOLEAN bNewOption;
UINTN LegacyEntryOffset;
UINT16 LegacyDevCount;
BBS_ORDER_LIST *OrderList;
}
BOOT_DATA;
typedef struct _LANGUAGE_DATA
{
//#if SETUP_SUPPORT_PLATFORM_LANG_VAR
CHAR8 *LangCode;
CHAR16 *Unicode;
//#else
// CHAR8 LangCode[4];
// CHAR16 Unicode[4];
//#endif
CHAR16 *LangString;
UINT16 Token;
}
LANGUAGE_DATA;
//#if SETUP_SUPPORT_ADD_BOOT_OPTION
typedef struct _FS_DATA
{
CHAR16 *FsId;
EFI_DEVICE_PATH_PROTOCOL *FsPath;
}
FS_DATA;
//#endif
//exported variables
extern UINTN gBootOptionCount;
extern CHAR16 gBootFileName[];
extern BOOLEAN gShowAllBbsDev,gPopupMenuShowAllBbsDev;
extern BOOLEAN gSetupHideDisableBootOptions,gPopupMenuHideDisableBootOptions;// EIP:51671 extern decleration of the global varibales to use in soruces.
extern BOOLEAN gLoadOptionHidden; //EIP:59417 - extern decleration of the global varibales to use in soruces.
extern CHAR16 gBootFormarSpecifier[];
extern UINT16 *gBBSDisabled;
//#if SETUP_SUPPORT_ADD_BOOT_OPTION
extern UINTN gFsCount;
extern FS_DATA *gFsList;
//#endif
//exported functions
EFI_STATUS BootGetBootOptions( VOID );
EFI_STATUS BootLaunchBootOption(UINT16 u16Option, UINT16 *pOrder, UINTN u16OrderCount);
BOOT_DATA *BootGetBootData( UINT16 Option );
CHAR16 *BootGetOptionName( BOOT_DATA *bootData);
CHAR16 *BootGetBootNowName( UINT16 value, BOOLEAN ShowAllBBSDev, BOOLEAN TseBootNowInBootOrde);
VOID BootGetLanguages( VOID );
//EFI_STATUS BootLaunchBootNow( UINT16 Index );
EFI_STATUS BootLaunchBootNow( UINT16 index, BOOLEAN ShowAllBbsDev );
EFI_STATUS BootLaunchGuid( EFI_GUID *guid );
EFI_STATUS BootLaunchFilename( CHAR16 *fileName );
//#if SETUP_SUPPORT_ADD_BOOT_OPTION
VOID BootAddBootOption( VOID );
VOID BootDelBootOption( UINT16 index );
VOID DiscardAddDelBootOptions(VOID);
VOID SaveAddDelBootOptions(VOID);
//EIP70421 & 70422 Support for driver order starts
extern UINTN gDriverOptionCount;
extern CHAR16 gDriverFormarSpecifier [];
BOOT_DATA *DriverGetDriverData (UINT16);
CHAR16 *DriverGetOptionName (BOOT_DATA *);
VOID DriverDelDriverOption (UINT16);
VOID DriverAddDriverOption ();
VOID DiscardAddDelDriverOptions (VOID);
VOID SaveAddDelDriverOptions (VOID);
//EIP70421 & 70422 Support for driver order ends
//#endif
#endif /* _BOOT_H_ */
//**********************************************************************
//**********************************************************************
//** **
//** (C)Copyright 2011, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
|