summaryrefslogtreecommitdiff
path: root/Library/Tokens.c
blob: 982d7e7f69ee3936e0e8fb65e856f4942cbaf30f (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
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
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093        **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************

//**********************************************************************
// $Header: /Alaska/Projects/Intel/Haswell/LynxPoint_SharkBay-DT_Crb_1AQQW/Library/Tokens.c 2     9/17/13 10:18p Thomaschen $
//
// $Revision: 2 $
//
// $Date: 9/17/13 10:18p $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/Projects/Intel/Haswell/LynxPoint_SharkBay-DT_Crb_1AQQW/Library/Tokens.c $
// 
// 2     9/17/13 10:18p Thomaschen
// Update for PS2CTL module which labeled 4.6.5_PS2CTL_003.
// 
// 1     6/04/13 1:50a Thomaschen
// Fixed for EIP118202.
// 
// 23    11/01/12 6:40a Deepthins
// [TAG]  		EIP101100 
// [Category]  	Improvement
// [Description]  	Multi Language is supported in Ps2ctl driver
// [Files]  		CORE_DXE.sdl, kbc.h, ps2kbd.c and Tokens.c
// 
// 22    5/24/12 3:22p Artems
// [TAG]  		EIP N/A
// [Category]  	Improvement
// [Description]  	Graphics console tokens moved from BdsBoard.c to
// tokens.c
// [Files]  		BdsBoard.c Tokens.c
// 
// 21    4/20/12 2:28p Artems
// [TAG]  		EIP87678
// [Category]  	New Feature
// [Description]  	Selection of image to boot from on flash update boot
// path - either old image (currently in flash) or new one in recovery
// capsule
// [Files]  		Recovery.c
// DxeIpl.c
// Core.sdl
// Tokens.c
// 
// 20    2/01/12 1:57a Deepthins
// [TAG]  		EIP63116
// [Category]  	New Feature
// [Description]  	PS/2 Keyboard/Mouse IRQ mode generic support
// [Files]  		Token.c, Ps2main.c, Ps2kbd.c, Mouse.c, kbc.h, kbc.c,
// CORE_DXE.sdl
// 
// 19    4/27/11 4:47a Lavanyap
// [TAG] - EIP49407
// [Category] - IMPROVEMENT
// [Description] - Move the Ps2 driver SDL tokens from Core Source to Core
// Bin,So that we don't need to add Core source for changing the Ps2
// driver SDL tokens.
// [Files] - Ps2Ctl.sdl, ps2kbd.c, ps2main.c, ps2ctl.h, kbc.c, mouse.c,
// hotkey.c, CORE_DXE.sdl, Tokens.c
// 
// 18    1/25/11 12:50p Oleksiyy
// [TAG]  		EIP42253 
// [Category]  	New Feature
// [Description]  	Added support for platforms, where flash part is not
// memory mapped while write enabled, controlled by
// NO_MMIO_FLASH_ACCESS_DURING_UPDATE sdl token. Flash protocol used to
// access flash in that case.
// [Files]  		NVRAMDXE.c, Flash.c, Tokens.c and Runtime.sdl
// 
// 17    9/02/10 3:36p Felixp
// Enhancement(EIP 39460): Runtime Garbage Collection Support.
// NvramRtGarbageCollectionSupport variable is added.
// 
// 16    8/23/10 3:29p Felixp
// Enhancement(EIP 29307): HideComPort variable is added. Part of Runtime
// Trace support.
// 
// 15    8/20/10 12:48p Felixp
// LZMA compression support: GetDecompressInterface function is added.
// 
// 14    11/25/09 1:30p Felixp
// 
// 13    11/25/09 1:24p Felixp
// 
// 12    11/25/09 1:22p Felixp
// TraceLevelMask constant is added
// 
// 11    11/24/09 11:31a Felixp
// DefaultLanguageCode constant is added.
// 
// 10    8/25/09 4:12p Felixp
// NvramChecksumSupport constant is added.
// 
// 9     7/10/09 9:21a Felixp
// Headers updated
// 
// 8     7/10/09 8:54a Felixp
// New NVRAM_MONOTONIC_COUNTER_SUPPORT SDL token is created. 
// The token can be used to disable Core NVRAM-based implementation of the
// monotonic counter
// architectural protocol and to use stand alone monotonic counter driver
// instead.
// 
// 7     10/09/08 11:47a Felixp
// NvramBackupAddress variable added
// 
// 6     8/31/07 9:36a Felixp
// NVRAM code update related changes
// 
// 5     3/31/07 1:45p Felixp
// Bug fix: NvramEnd was improperly defined. It caused NVRAM overflaw
// (NVRAM garbage collection never happened).
// 
// 4     12/20/06 1:48p Felixp
// FlashBlockSize type changed from UINTN to UINT32
// 
// 2     7/22/05 2:20a Felixp
//  NVRAM enclosed into Firmware volume
// 
// 1     6/16/05 10:40a Felixp
// 
//**********************************************************************
//<AMI_FHDR_START>
//
// Name:	Tokens.c
//
// Description:	
//    This file contains constants and variables corresponding to some of the SDL tokens.
//    The constants and variables are used by modules that are distributed in binary 
//    and cannot directly consume token.h
//
//<AMI_FHDR_END>
//**********************************************************************
#include <FFS.h>
#include <AmiLib.h>
#include <token.h>

// Constants
const char *sAmiRomFile = CONVERT_TO_STRING(AMI_ROM);

const UINTN FlashSize = FLASH_SIZE;
const UINT32 FlashBlockSize = FLASH_BLOCK_SIZE;
const UINT32 FlashRetries = FLASH_RETRIES;
const UINTN FlashEmpty = (UINTN)(-FLASH_ERASE_POLARITY);
const UINT32 FlashEmptyNext = (FLASH_ERASE_POLARITY ? 0xffffff : 0);
const UINTN NvramAddress = NVRAM_ADDRESS;
#if FAULT_TOLERANT_NVRAM_UPDATE
const UINTN NvramBackupAddress = NVRAM_BACKUP_ADDRESS;
#else
const UINTN NvramBackupAddress = 0;
#endif
#if RUNTIME_TRACE_SUPPORT
const BOOLEAN HideComPort = TRUE;
#else
const BOOLEAN HideComPort = FALSE;
#endif
const UINTN NvramSize = NVRAM_SIZE;
const BOOLEAN NvSimulation = NV_SIMULATION;
const UINT32 NvramHeaderLength = NVRAM_HEADER_SIZE;
const BOOLEAN NvramMonotonicCounterSupport = NVRAM_MONOTONIC_COUNTER_SUPPORT;
const BOOLEAN NvramChecksumSupport = NVRAM_RECORD_CHECKSUM_SUPPORT;

#ifdef DEFAULT_LANGUAGE_CODE
const char *DefaultLanguageCode = CONVERT_TO_STRING(DEFAULT_LANGUAGE_CODE);
#endif
const UINT32 TraceLevelMask = TRACE_LEVEL_MASK;

// Variables
#define FLASH_DEVICE_BASE_ADDRESS (0xFFFFFFFF-FLASH_SIZE+1)
UINTN FlashDeviceBase = FLASH_DEVICE_BASE_ADDRESS;
UINTN FwhFeatureSpaceBase = FLASH_DEVICE_BASE_ADDRESS & ~(UINTN)0x400000;

#if NVRAM_RT_GARBAGE_COLLECTION_SUPPORT
const BOOLEAN NvramRtGarbageCollectionSupport = NVRAM_RT_GARBAGE_COLLECTION_SUPPORT;
#else
const BOOLEAN NvramRtGarbageCollectionSupport = 0;
#endif
#if NO_MMIO_FLASH_ACCESS_DURING_UPDATE
const BOOLEAN FlashNotMemoryMapped = NO_MMIO_FLASH_ACCESS_DURING_UPDATE;
#else
const BOOLEAN FlashNotMemoryMapped = 0;
#endif

#ifdef USE_RECOVERY_IMAGE_ON_FLASH_UPDATE
const BOOLEAN UseNewImage = USE_RECOVERY_IMAGE_ON_FLASH_UPDATE;
#else
const BOOLEAN UseNewImage = TRUE;
#endif

typedef struct _TEXT_MODE  {
	INT32	ModeNum;
	INT32	Col;
	INT32	Row;
	UINT32	VideoCol; // horizontal pixels
	UINT32	VideoRow; // vertical pixels
} TEXT_MODE;

const TEXT_MODE TextModeArray[] = {GC_MODE_LIST};
const INT32 MaxTextMode=(sizeof(TextModeArray)/sizeof(TEXT_MODE));


//Ps2Ctl driver global variables

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    KbdIrqSupport
//
// Description:	Variable to replace KB_IRQ_SUPPORT token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN KbdIrqSupport = 
#ifdef KB_IRQ_SUPPORT
    KB_IRQ_SUPPORT
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    MsIrqSupport
//
// Description:	Variable to replace MS_IRQ_SUPPORT token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN MsIrqSupport = 
#ifdef MS_IRQ_SUPPORT
    MS_IRQ_SUPPORT
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    Ps2MouseSupport
//
// Description:	Variable to replace PS2MOUSE_SUPPORT token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN Ps2MouseSupport = 
#ifdef PS2MOUSE_SUPPORT
    PS2MOUSE_SUPPORT
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    Ps2KbdSupport
//
// Description:	Variable to replace PS2KBD_SUPPORT token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN Ps2KbdSupport = 
#ifdef PS2KBD_SUPPORT
PS2KBD_SUPPORT
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    KbRdBeforeInstall
//
// Description:	Variable to replace KBD_READ_BEFORE_INSTALL token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN KbRdBeforeInstall = 
#ifdef KBD_READ_BEFORE_INSTALL
    KBD_READ_BEFORE_INSTALL
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    KbcAutoDetectPorts
//
// Description:	Variable to replace KBC_AUTODETECT_PORTS token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN KbcAutoDetectPorts = 
#ifdef KBC_AUTODETECT_PORTS
KBC_AUTODETECT_PORTS
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    BlockKbcPin2223Bit
//
// Description:	Variable to replace BLOCK_KBC_PIN_22_23_BIT token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN BlockKbcPin2223Bit = 
#ifdef BLOCK_KBC_PIN_22_23_BIT
BLOCK_KBC_PIN_22_23_BIT
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    LedsAtStartup
//
// Description:	Variable to replace LEDS_AT_STARTUP token.
//
// Notes: UINT8
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
UINT8 LedsAtStartup = 
#ifdef LEDS_AT_STARTUP
LEDS_AT_STARTUP
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    MaxHotKeys
//
// Description:	Variable to replace MAX_HOTKEYS token.
//
// Notes: UINT8
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
UINT8 MaxHotKeys = 
#ifdef MAX_HOTKEYS
MAX_HOTKEYS
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    InitDefaultHotKeys
//
// Description:	Variable to replace INIT_DEFAULT_HOTKEYS token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN InitDefaultHotKeys = 
#ifdef INIT_DEFAULT_HOTKEYS
INIT_DEFAULT_HOTKEYS
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    KbcBasicAssuranceTest
//
// Description:	Variable to replace KBC_BASIC_ASSURANCE_TEST token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN KbcBasicAssuranceTest = 
#ifdef KBC_BASIC_ASSURANCE_TEST
KBC_BASIC_ASSURANCE_TEST
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    DetectPs2KeyboardValue
//
// Description:	Variable to replace DETECT_PS2_KEYBOARD token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN DetectPs2KeyboardValue = 
#ifdef DETECT_PS2_KEYBOARD
DETECT_PS2_KEYBOARD
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    DetectPs2MouseValue
//
// Description:	Variable to replace DETECT_PS2_MOUSE token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN DetectPs2MouseValue = 
#ifdef DETECT_PS2_MOUSE
DETECT_PS2_MOUSE
#else
    0
#endif
    ;
//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    InstallKeyboardMouseAlways
//
// Description:	Variable to replace INSTALL_KEYBOARD_MOUSE_ALWAYS token.
//
// Notes: BOOLEAN
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
BOOLEAN InstallKeyboardMouseAlways = 
#ifdef INSTALL_KEYBOARD_MOUSE_ALWAYS
INSTALL_KEYBOARD_MOUSE_ALWAYS
#else
    0
#endif
    ;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    IbFreeTimeoutValue
//
// Description:	Variable to replace IBFREE_TIMEOUT token.
//
// Notes: UINT32
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
UINT32 IbFreeTimeoutValue = 
#ifdef IBFREE_TIMEOUT
IBFREE_TIMEOUT
#else
    0
#endif
    ;

//<AMI_SHDR_START>
//----------------------------------------------------------------------------
// Name:    IbMaxFreeTimeoutValue
//
// Description:	Variable to replace MAXIMUM_TIMEOUT_FOR_IBFREE token.
//
// Notes: UINT32
//
//----------------------------------------------------------------------------
//<AMI_SHDR_END>
UINT32 IbFreeMaxTimeoutValue = 
#ifdef MAXIMUM_TIMEOUT_FOR_IBFREE
MAXIMUM_TIMEOUT_FOR_IBFREE
#else
    0
#endif
    ;

//Decompression
BOOLEAN GetDecompressInterface(
    UINT8 CompressionType, GET_INFO *GetInfoPtr, DECOMPRESS *DecompressPtr
)
{
    if (CompressionType==EFI_STANDARD_COMPRESSION){
        *GetInfoPtr=GetInfo;
        *DecompressPtr=Decompress;
        return TRUE;
    }
#if LZMA_SUPPORT==1
    else if (CompressionType==EFI_CUSTOMIZED_COMPRESSION){
        *GetInfoPtr=LzmaGetInfo;
        *DecompressPtr=LzmaDecompress;
        return TRUE;
    }
#endif
    return FALSE;
}

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