Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/modules/include/efi.h

  • Property svn:executable set to *
1
2#ifndef __LIBEFI_H__
3#define __LIBEFI_H__
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <stdbool.h>
8#include <stdarg.h>
9#include <assert.h>
10#include <pexpert/i386/efi.h>
11
12#define ASSERT(x) assert(x)
13
14typedef uint8_t BOOLEAN;
15typedef int32_t INTN;
16typedef uint32_t UINTN;
17typedef int8_t INT8;
18typedef uint8_t UINT8;
19typedef int16_t INT16;
20typedef uint16_t UINT16;
21typedef int32_t INT32;
22typedef uint32_t UINT32;
23typedef int64_t INT64;
24typedef uint64_t UINT64;
25typedef char CHAR8;
26typedef int CHAR16;
27typedef UINT64 EFI_LBA;
28
29//
30// Modifiers to absract standard types to aid in debug of problems
31//
32#ifndef CONST
33#define CONST const
34#endif
35
36#ifndef STATIC
37#define STATIC static
38#endif
39
40#ifndef VOID
41#define VOID void
42#endif
43
44#ifndef VOLATILE
45#define VOLATILE volatile
46#endif
47
48#ifndef TRUE
49#define TRUE 1
50#endif
51
52#ifndef FALSE
53#define FALSE 0
54#endif
55
56/**
57 Return the maximum of two operands.
58
59 This macro returns the maximum of two operand specified by a and b.
60 Both a and b must be the same numerical types, signed or unsigned.
61
62 @param a The first operand with any numerical type.
63 @param b The second operand. Can be any numerical type as long as is
64 the same type as a.
65
66 @return Maximum of two operands.
67
68 **/
69#ifndef MAX
70#define MAX(a,b) ((a) > (b) ? (a) : (b))
71#endif
72
73/**
74 Return the minimum of two operands.
75
76 This macro returns the minimal of two operand specified by a and b.
77 Both a and b must be the same numerical types, signed or unsigned.
78
79 @param a The first operand with any numerical type.
80 @param b The second operand. It should be the same any numerical type with a.
81
82 @return Minimum of two operands.
83
84 **/
85#ifndef MIN
86#define MIN(a,b) ((a) < (b) ? (a) : (b))
87#endif
88
89/**
90 Return the absolute value of a signed operand.
91
92 This macro returns the absolute value of the signed operand specified by a.
93
94 @param a The signed operand.
95
96 @return The absolute value of the signed operand.
97
98 **/
99#ifndef ABS
100#define ABS(a) \
101(((a) < 0) ? (-(a)) : (a))
102#endif
103
104//
105// Generate an ASSERT if Status is an error code
106//
107#define ASSERT_EFI_ERROR(status) ASSERT(!EFI_ERROR(status))
108
109typedef enum {
110EfiPciWidthUint8,
111EfiPciWidthUint16,
112EfiPciWidthUint32,
113EfiPciWidthUint64,
114EfiPciWidthFifoUint8,
115EfiPciWidthFifoUint16,
116EfiPciWidthFifoUint32,
117EfiPciWidthFifoUint64,
118EfiPciWidthFillUint8,
119EfiPciWidthFillUint16,
120EfiPciWidthFillUint32,
121EfiPciWidthFillUint64,
122EfiPciWidthMaximum
123} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH;
124
125typedef enum {
126EfiBltVideoFill,
127EfiBltVideoToBltBuffer,
128EfiBltBufferToVideo,
129EfiBltVideoToVideo,
130EfiGraphicsOutputBltOperationMax
131} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
132
133typedef struct {
134UINT8 Blue;
135UINT8 Green;
136UINT8 Red;
137UINT8 Reserved;
138} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
139
140typedef struct {
141UINT8 Blue;
142UINT8 Green;
143UINT8 Red;
144UINT8 Reserved;
145} EFI_UGA_PIXEL;
146
147VOID
148CopyVideoBuffer (
149 IN UINT8 *VbeBuffer,
150 IN VOID *MemAddress,
151 IN UINTN DestinationX,
152 IN UINTN DestinationY,
153 IN UINTN TotalBytes,
154 IN UINT32 VbePixelWidth,
155 IN UINTN BytesPerScanLine
156 );
157
158EFI_STATUS
159BiosVideoGraphicsOutputVbeBlt (
160 IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *VbeFrameBuffer,
161 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
162 IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
163 IN UINTN SourceX,
164 IN UINTN SourceY,
165 IN UINTN DestinationX,
166 IN UINTN DestinationY,
167 IN UINTN Width,
168 IN UINTN Height,
169 IN UINTN Delta
170 );
171
172EFI_STATUS
173RootBridgeIoMemRW (
174 IN BOOLEAN Write,
175 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
176 IN UINT64 Address,
177 IN UINTN Count,
178 IN OUT VOID *Buffer
179 );
180
181UINT64
182MmioWrite64 (
183 IN UINTN Address,
184 IN UINT64 Value
185 );
186UINT64
187MmioRead64 (
188IN UINTN Address
189);
190
191UINT32
192MmioWrite32 (
193 IN UINTN Address,
194 IN UINT32 Value
195 );
196
197UINT32
198MmioRead32 (
199IN UINTN Address
200);
201
202UINT16
203MmioWrite16 (
204 IN UINTN Address,
205 IN UINT16 Value
206 );
207
208UINT16
209MmioRead16 (
210IN UINTN Address
211);
212
213UINT8
214MmioWrite8 (
215IN UINTN Address,
216IN UINT8 Value
217);
218
219UINT8
220MmioRead8 (
221 IN UINTN Address
222 );
223
224UINT64
225IoWrite64 (
226 IN UINTN Port,
227 IN UINT64 Value
228 );
229
230UINT64
231IoRead64 (
232 IN UINTN Port
233 );
234
235//
236// String Services
237//
238
239/**
240 Copies one Null-terminated Unicode string to another Null-terminated Unicode
241 string and returns the new Unicode string.
242
243 This function copies the contents of the Unicode string Source to the Unicode
244 string Destination, and returns Destination. If Source and Destination
245 overlap, then the results are undefined.
246
247 If Destination is NULL, then ASSERT().
248 If Destination is not aligned on a 16-bit boundary, then ASSERT().
249 If Source is NULL, then ASSERT().
250 If Source is not aligned on a 16-bit boundary, then ASSERT().
251 If Source and Destination overlap, then ASSERT().
252 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
253 PcdMaximumUnicodeStringLength Unicode characters not including the
254 Null-terminator, then ASSERT().
255
256 @param Destination The pointer to a Null-terminated Unicode string.
257 @param Source The pointer to a Null-terminated Unicode string.
258
259 @return Destination.
260
261 **/
262CHAR16 *
263StrCpy (
264 OUT CHAR16 *Destination,
265 IN CONST CHAR16 *Source
266 );
267
268
269/**
270 Copies up to a specified length from one Null-terminated Unicode string to
271 another Null-terminated Unicode string and returns the new Unicode string.
272
273 This function copies the contents of the Unicode string Source to the Unicode
274 string Destination, and returns Destination. At most, Length Unicode
275 characters are copied from Source to Destination. If Length is 0, then
276 Destination is returned unmodified. If Length is greater that the number of
277 Unicode characters in Source, then Destination is padded with Null Unicode
278 characters. If Source and Destination overlap, then the results are
279 undefined.
280
281 If Length > 0 and Destination is NULL, then ASSERT().
282 If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
283 If Length > 0 and Source is NULL, then ASSERT().
284 If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
285 If Source and Destination overlap, then ASSERT().
286 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
287 PcdMaximumUnicodeStringLength, then ASSERT().
288 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
289 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
290 then ASSERT().
291
292 @param Destination The pointer to a Null-terminated Unicode string.
293 @param Source The pointer to a Null-terminated Unicode string.
294 @param Length The maximum number of Unicode characters to copy.
295
296 @return Destination.
297
298 **/
299CHAR16 *
300StrnCpy (
301 OUT CHAR16 *Destination,
302 IN CONST CHAR16 *Source,
303 IN UINTN Length
304 );
305
306
307/**
308 Returns the length of a Null-terminated Unicode string.
309
310 This function returns the number of Unicode characters in the Null-terminated
311 Unicode string specified by String.
312
313 If String is NULL, then ASSERT().
314 If String is not aligned on a 16-bit boundary, then ASSERT().
315 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
316 PcdMaximumUnicodeStringLength Unicode characters not including the
317 Null-terminator, then ASSERT().
318
319 @param String Pointer to a Null-terminated Unicode string.
320
321 @return The length of String.
322
323 **/
324UINTN
325StrLen (
326 IN CONST CHAR16 *String
327 );
328
329
330/**
331 Returns the size of a Null-terminated Unicode string in bytes, including the
332 Null terminator.
333
334 This function returns the size, in bytes, of the Null-terminated Unicode string
335 specified by String.
336
337 If String is NULL, then ASSERT().
338 If String is not aligned on a 16-bit boundary, then ASSERT().
339 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
340 PcdMaximumUnicodeStringLength Unicode characters not including the
341 Null-terminator, then ASSERT().
342
343 @param String The pointer to a Null-terminated Unicode string.
344
345 @return The size of String.
346
347 **/
348UINTN
349StrSize (
350 IN CONST CHAR16 *String
351 );
352
353
354/**
355 Compares two Null-terminated Unicode strings, and returns the difference
356 between the first mismatched Unicode characters.
357
358 This function compares the Null-terminated Unicode string FirstString to the
359 Null-terminated Unicode string SecondString. If FirstString is identical to
360 SecondString, then 0 is returned. Otherwise, the value returned is the first
361 mismatched Unicode character in SecondString subtracted from the first
362 mismatched Unicode character in FirstString.
363
364 If FirstString is NULL, then ASSERT().
365 If FirstString is not aligned on a 16-bit boundary, then ASSERT().
366 If SecondString is NULL, then ASSERT().
367 If SecondString is not aligned on a 16-bit boundary, then ASSERT().
368 If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more
369 than PcdMaximumUnicodeStringLength Unicode characters not including the
370 Null-terminator, then ASSERT().
371 If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more
372 than PcdMaximumUnicodeStringLength Unicode characters, not including the
373 Null-terminator, then ASSERT().
374
375 @param FirstString The pointer to a Null-terminated Unicode string.
376 @param SecondString The pointer to a Null-terminated Unicode string.
377
378 @retval 0 FirstString is identical to SecondString.
379 @return others FirstString is not identical to SecondString.
380
381 **/
382INTN
383StrCmp (
384 IN CONST CHAR16 *FirstString,
385 IN CONST CHAR16 *SecondString
386 );
387
388
389/**
390 Compares up to a specified length the contents of two Null-terminated Unicode strings,
391 and returns the difference between the first mismatched Unicode characters.
392
393 This function compares the Null-terminated Unicode string FirstString to the
394 Null-terminated Unicode string SecondString. At most, Length Unicode
395 characters will be compared. If Length is 0, then 0 is returned. If
396 FirstString is identical to SecondString, then 0 is returned. Otherwise, the
397 value returned is the first mismatched Unicode character in SecondString
398 subtracted from the first mismatched Unicode character in FirstString.
399
400 If Length > 0 and FirstString is NULL, then ASSERT().
401 If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT().
402 If Length > 0 and SecondString is NULL, then ASSERT().
403 If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT().
404 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
405 PcdMaximumUnicodeStringLength, then ASSERT().
406 If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than
407 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
408 then ASSERT().
409 If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than
410 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
411 then ASSERT().
412
413 @param FirstString The pointer to a Null-terminated Unicode string.
414 @param SecondString The pointer to a Null-terminated Unicode string.
415 @param Length The maximum number of Unicode characters to compare.
416
417 @retval 0 FirstString is identical to SecondString.
418 @return others FirstString is not identical to SecondString.
419
420 **/
421INTN
422StrnCmp (
423 IN CONST CHAR16 *FirstString,
424 IN CONST CHAR16 *SecondString,
425 IN UINTN Length
426 );
427
428
429/**
430 Concatenates one Null-terminated Unicode string to another Null-terminated
431 Unicode string, and returns the concatenated Unicode string.
432
433 This function concatenates two Null-terminated Unicode strings. The contents
434 of Null-terminated Unicode string Source are concatenated to the end of
435 Null-terminated Unicode string Destination. The Null-terminated concatenated
436 Unicode String is returned. If Source and Destination overlap, then the
437 results are undefined.
438
439 If Destination is NULL, then ASSERT().
440 If Destination is not aligned on a 16-bit boundary, then ASSERT().
441 If Source is NULL, then ASSERT().
442 If Source is not aligned on a 16-bit boundary, then ASSERT().
443 If Source and Destination overlap, then ASSERT().
444 If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
445 than PcdMaximumUnicodeStringLength Unicode characters, not including the
446 Null-terminator, then ASSERT().
447 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
448 PcdMaximumUnicodeStringLength Unicode characters, not including the
449 Null-terminator, then ASSERT().
450 If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
451 and Source results in a Unicode string with more than
452 PcdMaximumUnicodeStringLength Unicode characters, not including the
453 Null-terminator, then ASSERT().
454
455 @param Destination The pointer to a Null-terminated Unicode string.
456 @param Source The pointer to a Null-terminated Unicode string.
457
458 @return Destination.
459
460 **/
461CHAR16 *
462StrCat (
463 IN OUT CHAR16 *Destination,
464 IN CONST CHAR16 *Source
465 );
466
467
468/**
469 Concatenates up to a specified length one Null-terminated Unicode to the end
470 of another Null-terminated Unicode string, and returns the concatenated
471 Unicode string.
472
473 This function concatenates two Null-terminated Unicode strings. The contents
474 of Null-terminated Unicode string Source are concatenated to the end of
475 Null-terminated Unicode string Destination, and Destination is returned. At
476 most, Length Unicode characters are concatenated from Source to the end of
477 Destination, and Destination is always Null-terminated. If Length is 0, then
478 Destination is returned unmodified. If Source and Destination overlap, then
479 the results are undefined.
480
481 If Destination is NULL, then ASSERT().
482 If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
483 If Length > 0 and Source is NULL, then ASSERT().
484 If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
485 If Source and Destination overlap, then ASSERT().
486 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
487 PcdMaximumUnicodeStringLength, then ASSERT().
488 If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
489 than PcdMaximumUnicodeStringLength Unicode characters, not including the
490 Null-terminator, then ASSERT().
491 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
492 PcdMaximumUnicodeStringLength Unicode characters, not including the
493 Null-terminator, then ASSERT().
494 If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
495 and Source results in a Unicode string with more than PcdMaximumUnicodeStringLength
496 Unicode characters, not including the Null-terminator, then ASSERT().
497
498 @param Destination The pointer to a Null-terminated Unicode string.
499 @param Source The pointer to a Null-terminated Unicode string.
500 @param Length The maximum number of Unicode characters to concatenate from
501 Source.
502
503 @return Destination.
504
505 **/
506CHAR16 *
507StrnCat (
508 IN OUT CHAR16 *Destination,
509 IN CONST CHAR16 *Source,
510 IN UINTN Length
511 );
512
513/**
514 Returns the first occurrence of a Null-terminated Unicode sub-string
515 in a Null-terminated Unicode string.
516
517 This function scans the contents of the Null-terminated Unicode string
518 specified by String and returns the first occurrence of SearchString.
519 If SearchString is not found in String, then NULL is returned. If
520 the length of SearchString is zero, then String is returned.
521
522 If String is NULL, then ASSERT().
523 If String is not aligned on a 16-bit boundary, then ASSERT().
524 If SearchString is NULL, then ASSERT().
525 If SearchString is not aligned on a 16-bit boundary, then ASSERT().
526
527 If PcdMaximumUnicodeStringLength is not zero, and SearchString
528 or String contains more than PcdMaximumUnicodeStringLength Unicode
529 characters, not including the Null-terminator, then ASSERT().
530
531 @param String The pointer to a Null-terminated Unicode string.
532 @param SearchString The pointer to a Null-terminated Unicode string to search for.
533
534 @retval NULL If the SearchString does not appear in String.
535 @return others If there is a match.
536
537 **/
538CHAR16 *
539StrStr (
540 IN CONST CHAR16 *String,
541 IN CONST CHAR16 *SearchString
542 );
543
544/**
545 Convert a Null-terminated Unicode decimal string to a value of
546 type UINTN.
547
548 This function returns a value of type UINTN by interpreting the contents
549 of the Unicode string specified by String as a decimal number. The format
550 of the input Unicode string String is:
551
552 [spaces] [decimal digits].
553
554 The valid decimal digit character is in the range [0-9]. The
555 function will ignore the pad space, which includes spaces or
556 tab characters, before [decimal digits]. The running zero in the
557 beginning of [decimal digits] will be ignored. Then, the function
558 stops at the first character that is a not a valid decimal character
559 or a Null-terminator, whichever one comes first.
560
561 If String is NULL, then ASSERT().
562 If String is not aligned in a 16-bit boundary, then ASSERT().
563 If String has only pad spaces, then 0 is returned.
564 If String has no pad spaces or valid decimal digits,
565 then 0 is returned.
566 If the number represented by String overflows according
567 to the range defined by UINTN, then ASSERT().
568
569 If PcdMaximumUnicodeStringLength is not zero, and String contains
570 more than PcdMaximumUnicodeStringLength Unicode characters not including
571 the Null-terminator, then ASSERT().
572
573 @param String The pointer to a Null-terminated Unicode string.
574
575 @retval Value translated from String.
576
577 **/
578UINTN
579StrDecimalToUintn (
580 IN CONST CHAR16 *String
581 );
582
583/**
584 Convert a Null-terminated Unicode decimal string to a value of
585 type UINT64.
586
587 This function returns a value of type UINT64 by interpreting the contents
588 of the Unicode string specified by String as a decimal number. The format
589 of the input Unicode string String is:
590
591 [spaces] [decimal digits].
592
593 The valid decimal digit character is in the range [0-9]. The
594 function will ignore the pad space, which includes spaces or
595 tab characters, before [decimal digits]. The running zero in the
596 beginning of [decimal digits] will be ignored. Then, the function
597 stops at the first character that is a not a valid decimal character
598 or a Null-terminator, whichever one comes first.
599
600 If String is NULL, then ASSERT().
601 If String is not aligned in a 16-bit boundary, then ASSERT().
602 If String has only pad spaces, then 0 is returned.
603 If String has no pad spaces or valid decimal digits,
604 then 0 is returned.
605 If the number represented by String overflows according
606 to the range defined by UINT64, then ASSERT().
607
608 If PcdMaximumUnicodeStringLength is not zero, and String contains
609 more than PcdMaximumUnicodeStringLength Unicode characters not including
610 the Null-terminator, then ASSERT().
611
612 @param String The pointer to a Null-terminated Unicode string.
613
614 @retval Value translated from String.
615
616 **/
617UINT64
618StrDecimalToUint64 (
619 IN CONST CHAR16 *String
620 );
621
622
623/**
624 Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.
625
626 This function returns a value of type UINTN by interpreting the contents
627 of the Unicode string specified by String as a hexadecimal number.
628 The format of the input Unicode string String is:
629
630 [spaces][zeros][x][hexadecimal digits].
631
632 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
633 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
634 If "x" appears in the input string, it must be prefixed with at least one 0.
635 The function will ignore the pad space, which includes spaces or tab characters,
636 before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
637 [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
638 first valid hexadecimal digit. Then, the function stops at the first character
639 that is a not a valid hexadecimal character or NULL, whichever one comes first.
640
641 If String is NULL, then ASSERT().
642 If String is not aligned in a 16-bit boundary, then ASSERT().
643 If String has only pad spaces, then zero is returned.
644 If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
645 then zero is returned.
646 If the number represented by String overflows according to the range defined by
647 UINTN, then ASSERT().
648
649 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
650 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
651 then ASSERT().
652
653 @param String The pointer to a Null-terminated Unicode string.
654
655 @retval Value translated from String.
656
657 **/
658UINTN
659StrHexToUintn (
660 IN CONST CHAR16 *String
661 );
662
663
664/**
665 Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.
666
667 This function returns a value of type UINT64 by interpreting the contents
668 of the Unicode string specified by String as a hexadecimal number.
669 The format of the input Unicode string String is
670
671 [spaces][zeros][x][hexadecimal digits].
672
673 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
674 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
675 If "x" appears in the input string, it must be prefixed with at least one 0.
676 The function will ignore the pad space, which includes spaces or tab characters,
677 before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
678 [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
679 first valid hexadecimal digit. Then, the function stops at the first character that is
680 a not a valid hexadecimal character or NULL, whichever one comes first.
681
682 If String is NULL, then ASSERT().
683 If String is not aligned in a 16-bit boundary, then ASSERT().
684 If String has only pad spaces, then zero is returned.
685 If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
686 then zero is returned.
687 If the number represented by String overflows according to the range defined by
688 UINT64, then ASSERT().
689
690 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
691 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
692 then ASSERT().
693
694 @param String The pointer to a Null-terminated Unicode string.
695
696 @retval Value translated from String.
697
698 **/
699UINT64
700StrHexToUint64 (
701 IN CONST CHAR16 *String
702 );
703
704/**
705 Convert a Null-terminated Unicode string to a Null-terminated
706 ASCII string and returns the ASCII string.
707
708 This function converts the content of the Unicode string Source
709 to the ASCII string Destination by copying the lower 8 bits of
710 each Unicode character. It returns Destination.
711
712 The caller is responsible to make sure Destination points to a buffer with size
713 equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.
714
715 If any Unicode characters in Source contain non-zero value in
716 the upper 8 bits, then ASSERT().
717
718 If Destination is NULL, then ASSERT().
719 If Source is NULL, then ASSERT().
720 If Source is not aligned on a 16-bit boundary, then ASSERT().
721 If Source and Destination overlap, then ASSERT().
722
723 If PcdMaximumUnicodeStringLength is not zero, and Source contains
724 more than PcdMaximumUnicodeStringLength Unicode characters not including
725 the Null-terminator, then ASSERT().
726
727 If PcdMaximumAsciiStringLength is not zero, and Source contains more
728 than PcdMaximumAsciiStringLength Unicode characters not including the
729 Null-terminator, then ASSERT().
730
731 @param Source The pointer to a Null-terminated Unicode string.
732 @param Destination The pointer to a Null-terminated ASCII string.
733
734 @return Destination.
735
736 **/
737CHAR8 *
738UnicodeStrToAsciiStr (
739 IN CONST CHAR16 *Source,
740 OUT CHAR8 *Destination
741 );
742
743
744/**
745 Copies one Null-terminated ASCII string to another Null-terminated ASCII
746 string and returns the new ASCII string.
747
748 This function copies the contents of the ASCII string Source to the ASCII
749 string Destination, and returns Destination. If Source and Destination
750 overlap, then the results are undefined.
751
752 If Destination is NULL, then ASSERT().
753 If Source is NULL, then ASSERT().
754 If Source and Destination overlap, then ASSERT().
755 If PcdMaximumAsciiStringLength is not zero and Source contains more than
756 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
757 then ASSERT().
758
759 @param Destination The pointer to a Null-terminated ASCII string.
760 @param Source The pointer to a Null-terminated ASCII string.
761
762 @return Destination
763
764 **/
765CHAR8 *
766AsciiStrCpy (
767 OUT CHAR8 *Destination,
768 IN CONST CHAR8 *Source
769 );
770
771
772/**
773 Copies up to a specified length one Null-terminated ASCII string to another
774 Null-terminated ASCII string and returns the new ASCII string.
775
776 This function copies the contents of the ASCII string Source to the ASCII
777 string Destination, and returns Destination. At most, Length ASCII characters
778 are copied from Source to Destination. If Length is 0, then Destination is
779 returned unmodified. If Length is greater that the number of ASCII characters
780 in Source, then Destination is padded with Null ASCII characters. If Source
781 and Destination overlap, then the results are undefined.
782
783 If Destination is NULL, then ASSERT().
784 If Source is NULL, then ASSERT().
785 If Source and Destination overlap, then ASSERT().
786 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
787 PcdMaximumAsciiStringLength, then ASSERT().
788 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
789 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
790 then ASSERT().
791
792 @param Destination The pointer to a Null-terminated ASCII string.
793 @param Source The pointer to a Null-terminated ASCII string.
794 @param Length The maximum number of ASCII characters to copy.
795
796 @return Destination
797
798 **/
799CHAR8 *
800AsciiStrnCpy (
801 OUT CHAR8 *Destination,
802 IN CONST CHAR8 *Source,
803 IN UINTN Length
804 );
805
806
807/**
808 Returns the length of a Null-terminated ASCII string.
809
810 This function returns the number of ASCII characters in the Null-terminated
811 ASCII string specified by String.
812
813 If Length > 0 and Destination is NULL, then ASSERT().
814 If Length > 0 and Source is NULL, then ASSERT().
815 If PcdMaximumAsciiStringLength is not zero and String contains more than
816 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
817 then ASSERT().
818
819 @param String The pointer to a Null-terminated ASCII string.
820
821 @return The length of String.
822
823 **/
824UINTN
825AsciiStrLen (
826 IN CONST CHAR8 *String
827 );
828
829
830/**
831 Returns the size of a Null-terminated ASCII string in bytes, including the
832 Null terminator.
833
834 This function returns the size, in bytes, of the Null-terminated ASCII string
835 specified by String.
836
837 If String is NULL, then ASSERT().
838 If PcdMaximumAsciiStringLength is not zero and String contains more than
839 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
840 then ASSERT().
841
842 @param String The pointer to a Null-terminated ASCII string.
843
844 @return The size of String.
845
846 **/
847UINTN
848AsciiStrSize (
849 IN CONST CHAR8 *String
850 );
851
852
853/**
854 Compares two Null-terminated ASCII strings, and returns the difference
855 between the first mismatched ASCII characters.
856
857 This function compares the Null-terminated ASCII string FirstString to the
858 Null-terminated ASCII string SecondString. If FirstString is identical to
859 SecondString, then 0 is returned. Otherwise, the value returned is the first
860 mismatched ASCII character in SecondString subtracted from the first
861 mismatched ASCII character in FirstString.
862
863 If FirstString is NULL, then ASSERT().
864 If SecondString is NULL, then ASSERT().
865 If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
866 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
867 then ASSERT().
868 If PcdMaximumAsciiStringLength is not zero and SecondString contains more
869 than PcdMaximumAsciiStringLength ASCII characters not including the
870 Null-terminator, then ASSERT().
871
872 @param FirstString The pointer to a Null-terminated ASCII string.
873 @param SecondString The pointer to a Null-terminated ASCII string.
874
875 @retval ==0 FirstString is identical to SecondString.
876 @retval !=0 FirstString is not identical to SecondString.
877
878 **/
879INTN
880AsciiStrCmp (
881 IN CONST CHAR8 *FirstString,
882 IN CONST CHAR8 *SecondString
883 );
884
885
886/**
887 Performs a case insensitive comparison of two Null-terminated ASCII strings,
888 and returns the difference between the first mismatched ASCII characters.
889
890 This function performs a case insensitive comparison of the Null-terminated
891 ASCII string FirstString to the Null-terminated ASCII string SecondString. If
892 FirstString is identical to SecondString, then 0 is returned. Otherwise, the
893 value returned is the first mismatched lower case ASCII character in
894 SecondString subtracted from the first mismatched lower case ASCII character
895 in FirstString.
896
897 If FirstString is NULL, then ASSERT().
898 If SecondString is NULL, then ASSERT().
899 If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
900 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
901 then ASSERT().
902 If PcdMaximumAsciiStringLength is not zero and SecondString contains more
903 than PcdMaximumAsciiStringLength ASCII characters not including the
904 Null-terminator, then ASSERT().
905
906 @param FirstString The pointer to a Null-terminated ASCII string.
907 @param SecondString The pointer to a Null-terminated ASCII string.
908
909 @retval ==0 FirstString is identical to SecondString using case insensitive
910 comparisons.
911 @retval !=0 FirstString is not identical to SecondString using case
912 insensitive comparisons.
913
914 **/
915INTN
916AsciiStriCmp (
917 IN CONST CHAR8 *FirstString,
918 IN CONST CHAR8 *SecondString
919 );
920
921
922/**
923 Compares two Null-terminated ASCII strings with maximum lengths, and returns
924 the difference between the first mismatched ASCII characters.
925
926 This function compares the Null-terminated ASCII string FirstString to the
927 Null-terminated ASCII string SecondString. At most, Length ASCII characters
928 will be compared. If Length is 0, then 0 is returned. If FirstString is
929 identical to SecondString, then 0 is returned. Otherwise, the value returned
930 is the first mismatched ASCII character in SecondString subtracted from the
931 first mismatched ASCII character in FirstString.
932
933 If Length > 0 and FirstString is NULL, then ASSERT().
934 If Length > 0 and SecondString is NULL, then ASSERT().
935 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
936 PcdMaximumAsciiStringLength, then ASSERT().
937 If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than
938 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
939 then ASSERT().
940 If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than
941 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
942 then ASSERT().
943
944 @param FirstString The pointer to a Null-terminated ASCII string.
945 @param SecondString The pointer to a Null-terminated ASCII string.
946 @param Length The maximum number of ASCII characters for compare.
947
948 @retval ==0 FirstString is identical to SecondString.
949 @retval !=0 FirstString is not identical to SecondString.
950
951 **/
952INTN
953AsciiStrnCmp (
954 IN CONST CHAR8 *FirstString,
955 IN CONST CHAR8 *SecondString,
956 IN UINTN Length
957 );
958
959
960/**
961 Concatenates one Null-terminated ASCII string to another Null-terminated
962 ASCII string, and returns the concatenated ASCII string.
963
964 This function concatenates two Null-terminated ASCII strings. The contents of
965 Null-terminated ASCII string Source are concatenated to the end of Null-
966 terminated ASCII string Destination. The Null-terminated concatenated ASCII
967 String is returned.
968
969 If Destination is NULL, then ASSERT().
970 If Source is NULL, then ASSERT().
971 If PcdMaximumAsciiStringLength is not zero and Destination contains more than
972 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
973 then ASSERT().
974 If PcdMaximumAsciiStringLength is not zero and Source contains more than
975 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
976 then ASSERT().
977 If PcdMaximumAsciiStringLength is not zero and concatenating Destination and
978 Source results in a ASCII string with more than PcdMaximumAsciiStringLength
979 ASCII characters, then ASSERT().
980
981 @param Destination The pointer to a Null-terminated ASCII string.
982 @param Source The pointer to a Null-terminated ASCII string.
983
984 @return Destination
985
986 **/
987CHAR8 *
988AsciiStrCat (
989 IN OUT CHAR8 *Destination,
990 IN CONST CHAR8 *Source
991 );
992
993
994/**
995 Concatenates up to a specified length one Null-terminated ASCII string to
996 the end of another Null-terminated ASCII string, and returns the
997 concatenated ASCII string.
998
999 This function concatenates two Null-terminated ASCII strings. The contents
1000 of Null-terminated ASCII string Source are concatenated to the end of Null-
1001 terminated ASCII string Destination, and Destination is returned. At most,
1002 Length ASCII characters are concatenated from Source to the end of
1003 Destination, and Destination is always Null-terminated. If Length is 0, then
1004 Destination is returned unmodified. If Source and Destination overlap, then
1005 the results are undefined.
1006
1007 If Length > 0 and Destination is NULL, then ASSERT().
1008 If Length > 0 and Source is NULL, then ASSERT().
1009 If Source and Destination overlap, then ASSERT().
1010 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
1011 PcdMaximumAsciiStringLength, then ASSERT().
1012 If PcdMaximumAsciiStringLength is not zero, and Destination contains more than
1013 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
1014 then ASSERT().
1015 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
1016 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
1017 then ASSERT().
1018 If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and
1019 Source results in a ASCII string with more than PcdMaximumAsciiStringLength
1020 ASCII characters, not including the Null-terminator, then ASSERT().
1021
1022 @param Destination The pointer to a Null-terminated ASCII string.
1023 @param Source The pointer to a Null-terminated ASCII string.
1024 @param Length The maximum number of ASCII characters to concatenate from
1025 Source.
1026
1027 @return Destination
1028
1029 **/
1030CHAR8 *
1031AsciiStrnCat (
1032 IN OUT CHAR8 *Destination,
1033 IN CONST CHAR8 *Source,
1034 IN UINTN Length
1035 );
1036
1037
1038/**
1039 Returns the first occurrence of a Null-terminated ASCII sub-string
1040 in a Null-terminated ASCII string.
1041
1042 This function scans the contents of the ASCII string specified by String
1043 and returns the first occurrence of SearchString. If SearchString is not
1044 found in String, then NULL is returned. If the length of SearchString is zero,
1045 then String is returned.
1046
1047 If String is NULL, then ASSERT().
1048 If SearchString is NULL, then ASSERT().
1049
1050 If PcdMaximumAsciiStringLength is not zero, and SearchString or
1051 String contains more than PcdMaximumAsciiStringLength Unicode characters
1052 not including the Null-terminator, then ASSERT().
1053
1054 @param String The pointer to a Null-terminated ASCII string.
1055 @param SearchString The pointer to a Null-terminated ASCII string to search for.
1056
1057 @retval NULL If the SearchString does not appear in String.
1058 @retval others If there is a match return the first occurrence of SearchingString.
1059 If the length of SearchString is zero,return String.
1060
1061 **/
1062CHAR8 *
1063AsciiStrStr (
1064 IN CONST CHAR8 *String,
1065 IN CONST CHAR8 *SearchString
1066 );
1067
1068
1069/**
1070 Convert a Null-terminated ASCII decimal string to a value of type
1071 UINTN.
1072
1073 This function returns a value of type UINTN by interpreting the contents
1074 of the ASCII string String as a decimal number. The format of the input
1075 ASCII string String is:
1076
1077 [spaces] [decimal digits].
1078
1079 The valid decimal digit character is in the range [0-9]. The function will
1080 ignore the pad space, which includes spaces or tab characters, before the digits.
1081 The running zero in the beginning of [decimal digits] will be ignored. Then, the
1082 function stops at the first character that is a not a valid decimal character or
1083 Null-terminator, whichever on comes first.
1084
1085 If String has only pad spaces, then 0 is returned.
1086 If String has no pad spaces or valid decimal digits, then 0 is returned.
1087 If the number represented by String overflows according to the range defined by
1088 UINTN, then ASSERT().
1089 If String is NULL, then ASSERT().
1090 If PcdMaximumAsciiStringLength is not zero, and String contains more than
1091 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1092 then ASSERT().
1093
1094 @param String The pointer to a Null-terminated ASCII string.
1095
1096 @retval The value translated from String.
1097
1098 **/
1099UINTN
1100AsciiStrDecimalToUintn (
1101 IN CONST CHAR8 *String
1102 );
1103
1104
1105/**
1106 Convert a Null-terminated ASCII decimal string to a value of type
1107 UINT64.
1108
1109 This function returns a value of type UINT64 by interpreting the contents
1110 of the ASCII string String as a decimal number. The format of the input
1111 ASCII string String is:
1112
1113 [spaces] [decimal digits].
1114
1115 The valid decimal digit character is in the range [0-9]. The function will
1116 ignore the pad space, which includes spaces or tab characters, before the digits.
1117 The running zero in the beginning of [decimal digits] will be ignored. Then, the
1118 function stops at the first character that is a not a valid decimal character or
1119 Null-terminator, whichever on comes first.
1120
1121 If String has only pad spaces, then 0 is returned.
1122 If String has no pad spaces or valid decimal digits, then 0 is returned.
1123 If the number represented by String overflows according to the range defined by
1124 UINT64, then ASSERT().
1125 If String is NULL, then ASSERT().
1126 If PcdMaximumAsciiStringLength is not zero, and String contains more than
1127 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1128 then ASSERT().
1129
1130 @param String The pointer to a Null-terminated ASCII string.
1131
1132 @retval Value translated from String.
1133
1134 **/
1135UINT64
1136AsciiStrDecimalToUint64 (
1137 IN CONST CHAR8 *String
1138 );
1139
1140
1141/**
1142 Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.
1143
1144 This function returns a value of type UINTN by interpreting the contents of
1145 the ASCII string String as a hexadecimal number. The format of the input ASCII
1146 string String is:
1147
1148 [spaces][zeros][x][hexadecimal digits].
1149
1150 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
1151 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
1152 appears in the input string, it must be prefixed with at least one 0. The function
1153 will ignore the pad space, which includes spaces or tab characters, before [zeros],
1154 [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
1155 will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
1156 digit. Then, the function stops at the first character that is a not a valid
1157 hexadecimal character or Null-terminator, whichever on comes first.
1158
1159 If String has only pad spaces, then 0 is returned.
1160 If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then
1161 0 is returned.
1162
1163 If the number represented by String overflows according to the range defined by UINTN,
1164 then ASSERT().
1165 If String is NULL, then ASSERT().
1166 If PcdMaximumAsciiStringLength is not zero,
1167 and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
1168 the Null-terminator, then ASSERT().
1169
1170 @param String The pointer to a Null-terminated ASCII string.
1171
1172 @retval Value translated from String.
1173
1174 **/
1175UINTN
1176AsciiStrHexToUintn (
1177 IN CONST CHAR8 *String
1178 );
1179
1180
1181/**
1182 Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.
1183
1184 This function returns a value of type UINT64 by interpreting the contents of
1185 the ASCII string String as a hexadecimal number. The format of the input ASCII
1186 string String is:
1187
1188 [spaces][zeros][x][hexadecimal digits].
1189
1190 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
1191 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
1192 appears in the input string, it must be prefixed with at least one 0. The function
1193 will ignore the pad space, which includes spaces or tab characters, before [zeros],
1194 [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
1195 will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
1196 digit. Then, the function stops at the first character that is a not a valid
1197 hexadecimal character or Null-terminator, whichever on comes first.
1198
1199 If String has only pad spaces, then 0 is returned.
1200 If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then
1201 0 is returned.
1202
1203 If the number represented by String overflows according to the range defined by UINT64,
1204 then ASSERT().
1205 If String is NULL, then ASSERT().
1206 If PcdMaximumAsciiStringLength is not zero,
1207 and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
1208 the Null-terminator, then ASSERT().
1209
1210 @param String The pointer to a Null-terminated ASCII string.
1211
1212 @retval Value translated from String.
1213
1214 **/
1215UINT64
1216AsciiStrHexToUint64 (
1217 IN CONST CHAR8 *String
1218 );
1219
1220
1221/**
1222 Convert one Null-terminated ASCII string to a Null-terminated
1223 Unicode string and returns the Unicode string.
1224
1225 This function converts the contents of the ASCII string Source to the Unicode
1226 string Destination, and returns Destination. The function terminates the
1227 Unicode string Destination by appending a Null-terminator character at the end.
1228 The caller is responsible to make sure Destination points to a buffer with size
1229 equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.
1230
1231 If Destination is NULL, then ASSERT().
1232 If Destination is not aligned on a 16-bit boundary, then ASSERT().
1233 If Source is NULL, then ASSERT().
1234 If Source and Destination overlap, then ASSERT().
1235 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
1236 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
1237 then ASSERT().
1238 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1239 PcdMaximumUnicodeStringLength ASCII characters not including the
1240 Null-terminator, then ASSERT().
1241
1242 @param Source The pointer to a Null-terminated ASCII string.
1243 @param Destination The pointer to a Null-terminated Unicode string.
1244
1245 @return Destination.
1246
1247 **/
1248CHAR16 *
1249AsciiStrToUnicodeStr (
1250 IN CONST CHAR8 *Source,
1251 OUT CHAR16 *Destination
1252 );
1253
1254
1255/**
1256 Converts an 8-bit value to an 8-bit BCD value.
1257
1258 Converts the 8-bit value specified by Value to BCD. The BCD value is
1259 returned.
1260
1261 If Value >= 100, then ASSERT().
1262
1263 @param Value The 8-bit value to convert to BCD. Range 0..99.
1264
1265 @return The BCD value.
1266
1267 **/
1268UINT8
1269DecimalToBcd8 (
1270 IN UINT8 Value
1271 );
1272
1273
1274/**
1275 Converts an 8-bit BCD value to an 8-bit value.
1276
1277 Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit
1278 value is returned.
1279
1280 If Value >= 0xA0, then ASSERT().
1281 If (Value & 0x0F) >= 0x0A, then ASSERT().
1282
1283 @param Value The 8-bit BCD value to convert to an 8-bit value.
1284
1285 @return The 8-bit value is returned.
1286
1287 **/
1288UINT8
1289BcdToDecimal8 (
1290 IN UINT8 Value
1291 );
1292
1293
1294/**
1295 Copies a source buffer to a destination buffer, and returns the destination buffer.
1296
1297 This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns
1298 DestinationBuffer. The implementation must be reentrant, and it must handle the case
1299 where SourceBuffer overlaps DestinationBuffer.
1300
1301 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
1302 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
1303
1304 @param DestinationBuffer The pointer to the destination buffer of the memory copy.
1305 @param SourceBuffer The pointer to the source buffer of the memory copy.
1306 @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer.
1307
1308 @return DestinationBuffer.
1309
1310 **/
1311VOID *
1312CopyMem (
1313 OUT VOID *DestinationBuffer,
1314 IN CONST VOID *SourceBuffer,
1315 IN UINTN Length
1316 );
1317
1318/**
1319 Fills a target buffer with a byte value, and returns the target buffer.
1320
1321 This function fills Length bytes of Buffer with Value, and returns Buffer.
1322
1323 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1324
1325 @param Buffer The memory to set.
1326 @param Length The number of bytes to set.
1327 @param Value The value with which to fill Length bytes of Buffer.
1328
1329 @return Buffer.
1330
1331 **/
1332VOID *
1333SetMem (
1334 OUT VOID *Buffer,
1335 IN UINTN Length,
1336 IN UINT8 Value
1337 );
1338
1339/**
1340 Fills a target buffer with a 16-bit value, and returns the target buffer.
1341
1342 This function fills Length bytes of Buffer with the 16-bit value specified by
1343 Value, and returns Buffer. Value is repeated every 16-bits in for Length
1344 bytes of Buffer.
1345
1346 If Length > 0 and Buffer is NULL, then ASSERT().
1347 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1348 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
1349 If Length is not aligned on a 16-bit boundary, then ASSERT().
1350
1351 @param Buffer The pointer to the target buffer to fill.
1352 @param Length The number of bytes in Buffer to fill.
1353 @param Value The value with which to fill Length bytes of Buffer.
1354
1355 @return Buffer.
1356
1357 **/
1358VOID *
1359SetMem16 (
1360 OUT VOID *Buffer,
1361 IN UINTN Length,
1362 IN UINT16 Value
1363 );
1364
1365/**
1366 Fills a target buffer with a 32-bit value, and returns the target buffer.
1367
1368 This function fills Length bytes of Buffer with the 32-bit value specified by
1369 Value, and returns Buffer. Value is repeated every 32-bits in for Length
1370 bytes of Buffer.
1371
1372 If Length > 0 and Buffer is NULL, then ASSERT().
1373 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1374 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
1375 If Length is not aligned on a 32-bit boundary, then ASSERT().
1376
1377 @param Buffer The pointer to the target buffer to fill.
1378 @param Length The number of bytes in Buffer to fill.
1379 @param Value The value with which to fill Length bytes of Buffer.
1380
1381 @return Buffer.
1382
1383 **/
1384VOID *
1385SetMem32 (
1386 OUT VOID *Buffer,
1387 IN UINTN Length,
1388 IN UINT32 Value
1389 );
1390
1391/**
1392 Fills a target buffer with a 64-bit value, and returns the target buffer.
1393
1394 This function fills Length bytes of Buffer with the 64-bit value specified by
1395 Value, and returns Buffer. Value is repeated every 64-bits in for Length
1396 bytes of Buffer.
1397
1398 If Length > 0 and Buffer is NULL, then ASSERT().
1399 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1400 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
1401 If Length is not aligned on a 64-bit boundary, then ASSERT().
1402
1403 @param Buffer The pointer to the target buffer to fill.
1404 @param Length The number of bytes in Buffer to fill.
1405 @param Value The value with which to fill Length bytes of Buffer.
1406
1407 @return Buffer.
1408
1409 **/
1410VOID *
1411SetMem64 (
1412 OUT VOID *Buffer,
1413 IN UINTN Length,
1414 IN UINT64 Value
1415 );
1416
1417/**
1418 Fills a target buffer with a value that is size UINTN, and returns the target buffer.
1419
1420 This function fills Length bytes of Buffer with the UINTN sized value specified by
1421 Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length
1422 bytes of Buffer.
1423
1424 If Length > 0 and Buffer is NULL, then ASSERT().
1425 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1426 If Buffer is not aligned on a UINTN boundary, then ASSERT().
1427 If Length is not aligned on a UINTN boundary, then ASSERT().
1428
1429 @param Buffer The pointer to the target buffer to fill.
1430 @param Length The number of bytes in Buffer to fill.
1431 @param Value The value with which to fill Length bytes of Buffer.
1432
1433 @return Buffer.
1434
1435 **/
1436VOID *
1437SetMemN (
1438 OUT VOID *Buffer,
1439 IN UINTN Length,
1440 IN UINTN Value
1441 );
1442
1443/**
1444 Fills a target buffer with zeros, and returns the target buffer.
1445
1446 This function fills Length bytes of Buffer with zeros, and returns Buffer.
1447
1448 If Length > 0 and Buffer is NULL, then ASSERT().
1449 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1450
1451 @param Buffer The pointer to the target buffer to fill with zeros.
1452 @param Length The number of bytes in Buffer to fill with zeros.
1453
1454 @return Buffer.
1455
1456 **/
1457VOID *
1458ZeroMem (
1459 OUT VOID *Buffer,
1460 IN UINTN Length
1461 );
1462
1463/**
1464 Compares the contents of two buffers.
1465
1466 This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
1467 If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
1468 value returned is the first mismatched byte in SourceBuffer subtracted from the first
1469 mismatched byte in DestinationBuffer.
1470
1471 If Length > 0 and DestinationBuffer is NULL, then ASSERT().
1472 If Length > 0 and SourceBuffer is NULL, then ASSERT().
1473 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
1474 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
1475
1476 @param DestinationBuffer The pointer to the destination buffer to compare.
1477 @param SourceBuffer The pointer to the source buffer to compare.
1478 @param Length The number of bytes to compare.
1479
1480 @return 0 All Length bytes of the two buffers are identical.
1481 @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first
1482 mismatched byte in DestinationBuffer.
1483
1484 **/
1485INTN
1486CompareMem (
1487 IN CONST VOID *DestinationBuffer,
1488 IN CONST VOID *SourceBuffer,
1489 IN UINTN Length
1490 );
1491
1492/**
1493 Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value
1494 in the target buffer.
1495
1496 This function searches target the buffer specified by Buffer and Length from the lowest
1497 address to the highest address for an 8-bit value that matches Value. If a match is found,
1498 then a pointer to the matching byte in the target buffer is returned. If no match is found,
1499 then NULL is returned. If Length is 0, then NULL is returned.
1500
1501 If Length > 0 and Buffer is NULL, then ASSERT().
1502 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1503
1504 @param Buffer The pointer to the target buffer to scan.
1505 @param Length The number of bytes in Buffer to scan.
1506 @param Value The value to search for in the target buffer.
1507
1508 @return A pointer to the matching byte in the target buffer, otherwise NULL.
1509
1510 **/
1511VOID *
1512ScanMem8 (
1513 IN CONST VOID *Buffer,
1514 IN UINTN Length,
1515 IN UINT8 Value
1516 );
1517
1518/**
1519 Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value
1520 in the target buffer.
1521
1522 This function searches target the buffer specified by Buffer and Length from the lowest
1523 address to the highest address for a 16-bit value that matches Value. If a match is found,
1524 then a pointer to the matching byte in the target buffer is returned. If no match is found,
1525 then NULL is returned. If Length is 0, then NULL is returned.
1526
1527 If Length > 0 and Buffer is NULL, then ASSERT().
1528 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
1529 If Length is not aligned on a 16-bit boundary, then ASSERT().
1530 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1531
1532 @param Buffer The pointer to the target buffer to scan.
1533 @param Length The number of bytes in Buffer to scan.
1534 @param Value The value to search for in the target buffer.
1535
1536 @return A pointer to the matching byte in the target buffer, otherwise NULL.
1537
1538 **/
1539VOID *
1540ScanMem16 (
1541 IN CONST VOID *Buffer,
1542 IN UINTN Length,
1543 IN UINT16 Value
1544 );
1545
1546/**
1547 Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value
1548 in the target buffer.
1549
1550 This function searches target the buffer specified by Buffer and Length from the lowest
1551 address to the highest address for a 32-bit value that matches Value. If a match is found,
1552 then a pointer to the matching byte in the target buffer is returned. If no match is found,
1553 then NULL is returned. If Length is 0, then NULL is returned.
1554
1555 If Length > 0 and Buffer is NULL, then ASSERT().
1556 If Buffer is not aligned on a 32-bit boundary, then ASSERT().
1557 If Length is not aligned on a 32-bit boundary, then ASSERT().
1558 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1559
1560 @param Buffer The pointer to the target buffer to scan.
1561 @param Length The number of bytes in Buffer to scan.
1562 @param Value The value to search for in the target buffer.
1563
1564 @return A pointer to the matching byte in the target buffer, otherwise NULL.
1565
1566 **/
1567VOID *
1568ScanMem32 (
1569 IN CONST VOID *Buffer,
1570 IN UINTN Length,
1571 IN UINT32 Value
1572 );
1573
1574/**
1575 Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value
1576 in the target buffer.
1577
1578 This function searches target the buffer specified by Buffer and Length from the lowest
1579 address to the highest address for a 64-bit value that matches Value. If a match is found,
1580 then a pointer to the matching byte in the target buffer is returned. If no match is found,
1581 then NULL is returned. If Length is 0, then NULL is returned.
1582
1583 If Length > 0 and Buffer is NULL, then ASSERT().
1584 If Buffer is not aligned on a 64-bit boundary, then ASSERT().
1585 If Length is not aligned on a 64-bit boundary, then ASSERT().
1586 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1587
1588 @param Buffer The pointer to the target buffer to scan.
1589 @param Length The number of bytes in Buffer to scan.
1590 @param Value The value to search for in the target buffer.
1591
1592 @return A pointer to the matching byte in the target buffer, otherwise NULL.
1593
1594 **/
1595VOID *
1596ScanMem64 (
1597 IN CONST VOID *Buffer,
1598 IN UINTN Length,
1599 IN UINT64 Value
1600 );
1601
1602/**
1603 Scans a target buffer for a UINTN sized value, and returns a pointer to the matching
1604 UINTN sized value in the target buffer.
1605
1606 This function searches target the buffer specified by Buffer and Length from the lowest
1607 address to the highest address for a UINTN sized value that matches Value. If a match is found,
1608 then a pointer to the matching byte in the target buffer is returned. If no match is found,
1609 then NULL is returned. If Length is 0, then NULL is returned.
1610
1611 If Length > 0 and Buffer is NULL, then ASSERT().
1612 If Buffer is not aligned on a UINTN boundary, then ASSERT().
1613 If Length is not aligned on a UINTN boundary, then ASSERT().
1614 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
1615
1616 @param Buffer The pointer to the target buffer to scan.
1617 @param Length The number of bytes in Buffer to scan.
1618 @param Value The value to search for in the target buffer.
1619
1620 @return A pointer to the matching byte in the target buffer, otherwise NULL.
1621
1622 **/
1623VOID *
1624ScanMemN (
1625 IN CONST VOID *Buffer,
1626 IN UINTN Length,
1627 IN UINTN Value
1628 );
1629
1630
1631
1632//
1633// String Services
1634//
1635
1636/**
1637 Copies one Null-terminated Unicode string to another Null-terminated Unicode
1638 string and returns the new Unicode string.
1639
1640 This function copies the contents of the Unicode string Source to the Unicode
1641 string Destination, and returns Destination. If Source and Destination
1642 overlap, then the results are undefined.
1643
1644 If Destination is NULL, then ASSERT().
1645 If Destination is not aligned on a 16-bit boundary, then ASSERT().
1646 If Source is NULL, then ASSERT().
1647 If Source is not aligned on a 16-bit boundary, then ASSERT().
1648 If Source and Destination overlap, then ASSERT().
1649 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1650 PcdMaximumUnicodeStringLength Unicode characters not including the
1651 Null-terminator, then ASSERT().
1652
1653 @param Destination The pointer to a Null-terminated Unicode string.
1654 @param Source The pointer to a Null-terminated Unicode string.
1655
1656 @return Destination.
1657
1658 **/
1659CHAR16 *
1660StrCpy (
1661 OUT CHAR16 *Destination,
1662 IN CONST CHAR16 *Source
1663 );
1664
1665
1666/**
1667 Copies up to a specified length from one Null-terminated Unicode string to
1668 another Null-terminated Unicode string and returns the new Unicode string.
1669
1670 This function copies the contents of the Unicode string Source to the Unicode
1671 string Destination, and returns Destination. At most, Length Unicode
1672 characters are copied from Source to Destination. If Length is 0, then
1673 Destination is returned unmodified. If Length is greater that the number of
1674 Unicode characters in Source, then Destination is padded with Null Unicode
1675 characters. If Source and Destination overlap, then the results are
1676 undefined.
1677
1678 If Length > 0 and Destination is NULL, then ASSERT().
1679 If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
1680 If Length > 0 and Source is NULL, then ASSERT().
1681 If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
1682 If Source and Destination overlap, then ASSERT().
1683 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
1684 PcdMaximumUnicodeStringLength, then ASSERT().
1685 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1686 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
1687 then ASSERT().
1688
1689 @param Destination The pointer to a Null-terminated Unicode string.
1690 @param Source The pointer to a Null-terminated Unicode string.
1691 @param Length The maximum number of Unicode characters to copy.
1692
1693 @return Destination.
1694
1695 **/
1696CHAR16 *
1697StrnCpy (
1698 OUT CHAR16 *Destination,
1699 IN CONST CHAR16 *Source,
1700 IN UINTN Length
1701 );
1702
1703
1704/**
1705 Returns the length of a Null-terminated Unicode string.
1706
1707 This function returns the number of Unicode characters in the Null-terminated
1708 Unicode string specified by String.
1709
1710 If String is NULL, then ASSERT().
1711 If String is not aligned on a 16-bit boundary, then ASSERT().
1712 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
1713 PcdMaximumUnicodeStringLength Unicode characters not including the
1714 Null-terminator, then ASSERT().
1715
1716 @param String Pointer to a Null-terminated Unicode string.
1717
1718 @return The length of String.
1719
1720 **/
1721UINTN
1722StrLen (
1723 IN CONST CHAR16 *String
1724 );
1725
1726
1727/**
1728 Returns the size of a Null-terminated Unicode string in bytes, including the
1729 Null terminator.
1730
1731 This function returns the size, in bytes, of the Null-terminated Unicode string
1732 specified by String.
1733
1734 If String is NULL, then ASSERT().
1735 If String is not aligned on a 16-bit boundary, then ASSERT().
1736 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
1737 PcdMaximumUnicodeStringLength Unicode characters not including the
1738 Null-terminator, then ASSERT().
1739
1740 @param String The pointer to a Null-terminated Unicode string.
1741
1742 @return The size of String.
1743
1744 **/
1745UINTN
1746StrSize (
1747 IN CONST CHAR16 *String
1748 );
1749
1750
1751/**
1752 Compares two Null-terminated Unicode strings, and returns the difference
1753 between the first mismatched Unicode characters.
1754
1755 This function compares the Null-terminated Unicode string FirstString to the
1756 Null-terminated Unicode string SecondString. If FirstString is identical to
1757 SecondString, then 0 is returned. Otherwise, the value returned is the first
1758 mismatched Unicode character in SecondString subtracted from the first
1759 mismatched Unicode character in FirstString.
1760
1761 If FirstString is NULL, then ASSERT().
1762 If FirstString is not aligned on a 16-bit boundary, then ASSERT().
1763 If SecondString is NULL, then ASSERT().
1764 If SecondString is not aligned on a 16-bit boundary, then ASSERT().
1765 If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more
1766 than PcdMaximumUnicodeStringLength Unicode characters not including the
1767 Null-terminator, then ASSERT().
1768 If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more
1769 than PcdMaximumUnicodeStringLength Unicode characters, not including the
1770 Null-terminator, then ASSERT().
1771
1772 @param FirstString The pointer to a Null-terminated Unicode string.
1773 @param SecondString The pointer to a Null-terminated Unicode string.
1774
1775 @retval 0 FirstString is identical to SecondString.
1776 @return others FirstString is not identical to SecondString.
1777
1778 **/
1779INTN
1780StrCmp (
1781 IN CONST CHAR16 *FirstString,
1782 IN CONST CHAR16 *SecondString
1783 );
1784
1785
1786/**
1787 Compares up to a specified length the contents of two Null-terminated Unicode strings,
1788 and returns the difference between the first mismatched Unicode characters.
1789
1790 This function compares the Null-terminated Unicode string FirstString to the
1791 Null-terminated Unicode string SecondString. At most, Length Unicode
1792 characters will be compared. If Length is 0, then 0 is returned. If
1793 FirstString is identical to SecondString, then 0 is returned. Otherwise, the
1794 value returned is the first mismatched Unicode character in SecondString
1795 subtracted from the first mismatched Unicode character in FirstString.
1796
1797 If Length > 0 and FirstString is NULL, then ASSERT().
1798 If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT().
1799 If Length > 0 and SecondString is NULL, then ASSERT().
1800 If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT().
1801 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
1802 PcdMaximumUnicodeStringLength, then ASSERT().
1803 If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than
1804 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
1805 then ASSERT().
1806 If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than
1807 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,
1808 then ASSERT().
1809
1810 @param FirstString The pointer to a Null-terminated Unicode string.
1811 @param SecondString The pointer to a Null-terminated Unicode string.
1812 @param Length The maximum number of Unicode characters to compare.
1813
1814 @retval 0 FirstString is identical to SecondString.
1815 @return others FirstString is not identical to SecondString.
1816
1817 **/
1818INTN
1819StrnCmp (
1820 IN CONST CHAR16 *FirstString,
1821 IN CONST CHAR16 *SecondString,
1822 IN UINTN Length
1823 );
1824
1825
1826/**
1827 Concatenates one Null-terminated Unicode string to another Null-terminated
1828 Unicode string, and returns the concatenated Unicode string.
1829
1830 This function concatenates two Null-terminated Unicode strings. The contents
1831 of Null-terminated Unicode string Source are concatenated to the end of
1832 Null-terminated Unicode string Destination. The Null-terminated concatenated
1833 Unicode String is returned. If Source and Destination overlap, then the
1834 results are undefined.
1835
1836 If Destination is NULL, then ASSERT().
1837 If Destination is not aligned on a 16-bit boundary, then ASSERT().
1838 If Source is NULL, then ASSERT().
1839 If Source is not aligned on a 16-bit boundary, then ASSERT().
1840 If Source and Destination overlap, then ASSERT().
1841 If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
1842 than PcdMaximumUnicodeStringLength Unicode characters, not including the
1843 Null-terminator, then ASSERT().
1844 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1845 PcdMaximumUnicodeStringLength Unicode characters, not including the
1846 Null-terminator, then ASSERT().
1847 If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
1848 and Source results in a Unicode string with more than
1849 PcdMaximumUnicodeStringLength Unicode characters, not including the
1850 Null-terminator, then ASSERT().
1851
1852 @param Destination The pointer to a Null-terminated Unicode string.
1853 @param Source The pointer to a Null-terminated Unicode string.
1854
1855 @return Destination.
1856
1857 **/
1858CHAR16 *
1859StrCat (
1860 IN OUT CHAR16 *Destination,
1861 IN CONST CHAR16 *Source
1862 );
1863
1864
1865/**
1866 Concatenates up to a specified length one Null-terminated Unicode to the end
1867 of another Null-terminated Unicode string, and returns the concatenated
1868 Unicode string.
1869
1870 This function concatenates two Null-terminated Unicode strings. The contents
1871 of Null-terminated Unicode string Source are concatenated to the end of
1872 Null-terminated Unicode string Destination, and Destination is returned. At
1873 most, Length Unicode characters are concatenated from Source to the end of
1874 Destination, and Destination is always Null-terminated. If Length is 0, then
1875 Destination is returned unmodified. If Source and Destination overlap, then
1876 the results are undefined.
1877
1878 If Destination is NULL, then ASSERT().
1879 If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
1880 If Length > 0 and Source is NULL, then ASSERT().
1881 If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
1882 If Source and Destination overlap, then ASSERT().
1883 If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
1884 PcdMaximumUnicodeStringLength, then ASSERT().
1885 If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
1886 than PcdMaximumUnicodeStringLength Unicode characters, not including the
1887 Null-terminator, then ASSERT().
1888 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
1889 PcdMaximumUnicodeStringLength Unicode characters, not including the
1890 Null-terminator, then ASSERT().
1891 If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
1892 and Source results in a Unicode string with more than PcdMaximumUnicodeStringLength
1893 Unicode characters, not including the Null-terminator, then ASSERT().
1894
1895 @param Destination The pointer to a Null-terminated Unicode string.
1896 @param Source The pointer to a Null-terminated Unicode string.
1897 @param Length The maximum number of Unicode characters to concatenate from
1898 Source.
1899
1900 @return Destination.
1901
1902 **/
1903CHAR16 *
1904StrnCat (
1905 IN OUT CHAR16 *Destination,
1906 IN CONST CHAR16 *Source,
1907 IN UINTN Length
1908 );
1909
1910/**
1911 Returns the first occurrence of a Null-terminated Unicode sub-string
1912 in a Null-terminated Unicode string.
1913
1914 This function scans the contents of the Null-terminated Unicode string
1915 specified by String and returns the first occurrence of SearchString.
1916 If SearchString is not found in String, then NULL is returned. If
1917 the length of SearchString is zero, then String is returned.
1918
1919 If String is NULL, then ASSERT().
1920 If String is not aligned on a 16-bit boundary, then ASSERT().
1921 If SearchString is NULL, then ASSERT().
1922 If SearchString is not aligned on a 16-bit boundary, then ASSERT().
1923
1924 If PcdMaximumUnicodeStringLength is not zero, and SearchString
1925 or String contains more than PcdMaximumUnicodeStringLength Unicode
1926 characters, not including the Null-terminator, then ASSERT().
1927
1928 @param String The pointer to a Null-terminated Unicode string.
1929 @param SearchString The pointer to a Null-terminated Unicode string to search for.
1930
1931 @retval NULL If the SearchString does not appear in String.
1932 @return others If there is a match.
1933
1934 **/
1935CHAR16 *
1936StrStr (
1937 IN CONST CHAR16 *String,
1938 IN CONST CHAR16 *SearchString
1939 );
1940
1941/**
1942 Convert a Null-terminated Unicode decimal string to a value of
1943 type UINTN.
1944
1945 This function returns a value of type UINTN by interpreting the contents
1946 of the Unicode string specified by String as a decimal number. The format
1947 of the input Unicode string String is:
1948
1949 [spaces] [decimal digits].
1950
1951 The valid decimal digit character is in the range [0-9]. The
1952 function will ignore the pad space, which includes spaces or
1953 tab characters, before [decimal digits]. The running zero in the
1954 beginning of [decimal digits] will be ignored. Then, the function
1955 stops at the first character that is a not a valid decimal character
1956 or a Null-terminator, whichever one comes first.
1957
1958 If String is NULL, then ASSERT().
1959 If String is not aligned in a 16-bit boundary, then ASSERT().
1960 If String has only pad spaces, then 0 is returned.
1961 If String has no pad spaces or valid decimal digits,
1962 then 0 is returned.
1963 If the number represented by String overflows according
1964 to the range defined by UINTN, then ASSERT().
1965
1966 If PcdMaximumUnicodeStringLength is not zero, and String contains
1967 more than PcdMaximumUnicodeStringLength Unicode characters not including
1968 the Null-terminator, then ASSERT().
1969
1970 @param String The pointer to a Null-terminated Unicode string.
1971
1972 @retval Value translated from String.
1973
1974 **/
1975UINTN
1976StrDecimalToUintn (
1977 IN CONST CHAR16 *String
1978 );
1979
1980/**
1981 Convert a Null-terminated Unicode decimal string to a value of
1982 type UINT64.
1983
1984 This function returns a value of type UINT64 by interpreting the contents
1985 of the Unicode string specified by String as a decimal number. The format
1986 of the input Unicode string String is:
1987
1988 [spaces] [decimal digits].
1989
1990 The valid decimal digit character is in the range [0-9]. The
1991 function will ignore the pad space, which includes spaces or
1992 tab characters, before [decimal digits]. The running zero in the
1993 beginning of [decimal digits] will be ignored. Then, the function
1994 stops at the first character that is a not a valid decimal character
1995 or a Null-terminator, whichever one comes first.
1996
1997 If String is NULL, then ASSERT().
1998 If String is not aligned in a 16-bit boundary, then ASSERT().
1999 If String has only pad spaces, then 0 is returned.
2000 If String has no pad spaces or valid decimal digits,
2001 then 0 is returned.
2002 If the number represented by String overflows according
2003 to the range defined by UINT64, then ASSERT().
2004
2005 If PcdMaximumUnicodeStringLength is not zero, and String contains
2006 more than PcdMaximumUnicodeStringLength Unicode characters not including
2007 the Null-terminator, then ASSERT().
2008
2009 @param String The pointer to a Null-terminated Unicode string.
2010
2011 @retval Value translated from String.
2012
2013 **/
2014UINT64
2015StrDecimalToUint64 (
2016 IN CONST CHAR16 *String
2017 );
2018
2019
2020/**
2021 Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.
2022
2023 This function returns a value of type UINTN by interpreting the contents
2024 of the Unicode string specified by String as a hexadecimal number.
2025 The format of the input Unicode string String is:
2026
2027 [spaces][zeros][x][hexadecimal digits].
2028
2029 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
2030 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
2031 If "x" appears in the input string, it must be prefixed with at least one 0.
2032 The function will ignore the pad space, which includes spaces or tab characters,
2033 before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
2034 [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
2035 first valid hexadecimal digit. Then, the function stops at the first character
2036 that is a not a valid hexadecimal character or NULL, whichever one comes first.
2037
2038 If String is NULL, then ASSERT().
2039 If String is not aligned in a 16-bit boundary, then ASSERT().
2040 If String has only pad spaces, then zero is returned.
2041 If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
2042 then zero is returned.
2043 If the number represented by String overflows according to the range defined by
2044 UINTN, then ASSERT().
2045
2046 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
2047 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
2048 then ASSERT().
2049
2050 @param String The pointer to a Null-terminated Unicode string.
2051
2052 @retval Value translated from String.
2053
2054 **/
2055UINTN
2056StrHexToUintn (
2057 IN CONST CHAR16 *String
2058 );
2059
2060
2061/**
2062 Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.
2063
2064 This function returns a value of type UINT64 by interpreting the contents
2065 of the Unicode string specified by String as a hexadecimal number.
2066 The format of the input Unicode string String is
2067
2068 [spaces][zeros][x][hexadecimal digits].
2069
2070 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
2071 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
2072 If "x" appears in the input string, it must be prefixed with at least one 0.
2073 The function will ignore the pad space, which includes spaces or tab characters,
2074 before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
2075 [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
2076 first valid hexadecimal digit. Then, the function stops at the first character that is
2077 a not a valid hexadecimal character or NULL, whichever one comes first.
2078
2079 If String is NULL, then ASSERT().
2080 If String is not aligned in a 16-bit boundary, then ASSERT().
2081 If String has only pad spaces, then zero is returned.
2082 If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
2083 then zero is returned.
2084 If the number represented by String overflows according to the range defined by
2085 UINT64, then ASSERT().
2086
2087 If PcdMaximumUnicodeStringLength is not zero, and String contains more than
2088 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
2089 then ASSERT().
2090
2091 @param String The pointer to a Null-terminated Unicode string.
2092
2093 @retval Value translated from String.
2094
2095 **/
2096UINT64
2097StrHexToUint64 (
2098 IN CONST CHAR16 *String
2099 );
2100
2101/**
2102 Convert a Null-terminated Unicode string to a Null-terminated
2103 ASCII string and returns the ASCII string.
2104
2105 This function converts the content of the Unicode string Source
2106 to the ASCII string Destination by copying the lower 8 bits of
2107 each Unicode character. It returns Destination.
2108
2109 The caller is responsible to make sure Destination points to a buffer with size
2110 equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.
2111
2112 If any Unicode characters in Source contain non-zero value in
2113 the upper 8 bits, then ASSERT().
2114
2115 If Destination is NULL, then ASSERT().
2116 If Source is NULL, then ASSERT().
2117 If Source is not aligned on a 16-bit boundary, then ASSERT().
2118 If Source and Destination overlap, then ASSERT().
2119
2120 If PcdMaximumUnicodeStringLength is not zero, and Source contains
2121 more than PcdMaximumUnicodeStringLength Unicode characters not including
2122 the Null-terminator, then ASSERT().
2123
2124 If PcdMaximumAsciiStringLength is not zero, and Source contains more
2125 than PcdMaximumAsciiStringLength Unicode characters not including the
2126 Null-terminator, then ASSERT().
2127
2128 @param Source The pointer to a Null-terminated Unicode string.
2129 @param Destination The pointer to a Null-terminated ASCII string.
2130
2131 @return Destination.
2132
2133 **/
2134CHAR8 *
2135UnicodeStrToAsciiStr (
2136 IN CONST CHAR16 *Source,
2137 OUT CHAR8 *Destination
2138 );
2139
2140
2141/**
2142 Copies one Null-terminated ASCII string to another Null-terminated ASCII
2143 string and returns the new ASCII string.
2144
2145 This function copies the contents of the ASCII string Source to the ASCII
2146 string Destination, and returns Destination. If Source and Destination
2147 overlap, then the results are undefined.
2148
2149 If Destination is NULL, then ASSERT().
2150 If Source is NULL, then ASSERT().
2151 If Source and Destination overlap, then ASSERT().
2152 If PcdMaximumAsciiStringLength is not zero and Source contains more than
2153 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2154 then ASSERT().
2155
2156 @param Destination The pointer to a Null-terminated ASCII string.
2157 @param Source The pointer to a Null-terminated ASCII string.
2158
2159 @return Destination
2160
2161 **/
2162CHAR8 *
2163AsciiStrCpy (
2164 OUT CHAR8 *Destination,
2165 IN CONST CHAR8 *Source
2166 );
2167
2168
2169/**
2170 Copies up to a specified length one Null-terminated ASCII string to another
2171 Null-terminated ASCII string and returns the new ASCII string.
2172
2173 This function copies the contents of the ASCII string Source to the ASCII
2174 string Destination, and returns Destination. At most, Length ASCII characters
2175 are copied from Source to Destination. If Length is 0, then Destination is
2176 returned unmodified. If Length is greater that the number of ASCII characters
2177 in Source, then Destination is padded with Null ASCII characters. If Source
2178 and Destination overlap, then the results are undefined.
2179
2180 If Destination is NULL, then ASSERT().
2181 If Source is NULL, then ASSERT().
2182 If Source and Destination overlap, then ASSERT().
2183 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
2184 PcdMaximumAsciiStringLength, then ASSERT().
2185 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
2186 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
2187 then ASSERT().
2188
2189 @param Destination The pointer to a Null-terminated ASCII string.
2190 @param Source The pointer to a Null-terminated ASCII string.
2191 @param Length The maximum number of ASCII characters to copy.
2192
2193 @return Destination
2194
2195 **/
2196CHAR8 *
2197AsciiStrnCpy (
2198 OUT CHAR8 *Destination,
2199 IN CONST CHAR8 *Source,
2200 IN UINTN Length
2201 );
2202
2203
2204/**
2205 Returns the length of a Null-terminated ASCII string.
2206
2207 This function returns the number of ASCII characters in the Null-terminated
2208 ASCII string specified by String.
2209
2210 If Length > 0 and Destination is NULL, then ASSERT().
2211 If Length > 0 and Source is NULL, then ASSERT().
2212 If PcdMaximumAsciiStringLength is not zero and String contains more than
2213 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2214 then ASSERT().
2215
2216 @param String The pointer to a Null-terminated ASCII string.
2217
2218 @return The length of String.
2219
2220 **/
2221UINTN
2222AsciiStrLen (
2223 IN CONST CHAR8 *String
2224 );
2225
2226
2227/**
2228 Returns the size of a Null-terminated ASCII string in bytes, including the
2229 Null terminator.
2230
2231 This function returns the size, in bytes, of the Null-terminated ASCII string
2232 specified by String.
2233
2234 If String is NULL, then ASSERT().
2235 If PcdMaximumAsciiStringLength is not zero and String contains more than
2236 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2237 then ASSERT().
2238
2239 @param String The pointer to a Null-terminated ASCII string.
2240
2241 @return The size of String.
2242
2243 **/
2244UINTN
2245AsciiStrSize (
2246 IN CONST CHAR8 *String
2247 );
2248
2249
2250/**
2251 Compares two Null-terminated ASCII strings, and returns the difference
2252 between the first mismatched ASCII characters.
2253
2254 This function compares the Null-terminated ASCII string FirstString to the
2255 Null-terminated ASCII string SecondString. If FirstString is identical to
2256 SecondString, then 0 is returned. Otherwise, the value returned is the first
2257 mismatched ASCII character in SecondString subtracted from the first
2258 mismatched ASCII character in FirstString.
2259
2260 If FirstString is NULL, then ASSERT().
2261 If SecondString is NULL, then ASSERT().
2262 If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
2263 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2264 then ASSERT().
2265 If PcdMaximumAsciiStringLength is not zero and SecondString contains more
2266 than PcdMaximumAsciiStringLength ASCII characters not including the
2267 Null-terminator, then ASSERT().
2268
2269 @param FirstString The pointer to a Null-terminated ASCII string.
2270 @param SecondString The pointer to a Null-terminated ASCII string.
2271
2272 @retval ==0 FirstString is identical to SecondString.
2273 @retval !=0 FirstString is not identical to SecondString.
2274
2275 **/
2276INTN
2277AsciiStrCmp (
2278 IN CONST CHAR8 *FirstString,
2279 IN CONST CHAR8 *SecondString
2280 );
2281
2282
2283/**
2284 Performs a case insensitive comparison of two Null-terminated ASCII strings,
2285 and returns the difference between the first mismatched ASCII characters.
2286
2287 This function performs a case insensitive comparison of the Null-terminated
2288 ASCII string FirstString to the Null-terminated ASCII string SecondString. If
2289 FirstString is identical to SecondString, then 0 is returned. Otherwise, the
2290 value returned is the first mismatched lower case ASCII character in
2291 SecondString subtracted from the first mismatched lower case ASCII character
2292 in FirstString.
2293
2294 If FirstString is NULL, then ASSERT().
2295 If SecondString is NULL, then ASSERT().
2296 If PcdMaximumAsciiStringLength is not zero and FirstString contains more than
2297 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2298 then ASSERT().
2299 If PcdMaximumAsciiStringLength is not zero and SecondString contains more
2300 than PcdMaximumAsciiStringLength ASCII characters not including the
2301 Null-terminator, then ASSERT().
2302
2303 @param FirstString The pointer to a Null-terminated ASCII string.
2304 @param SecondString The pointer to a Null-terminated ASCII string.
2305
2306 @retval ==0 FirstString is identical to SecondString using case insensitive
2307 comparisons.
2308 @retval !=0 FirstString is not identical to SecondString using case
2309 insensitive comparisons.
2310
2311 **/
2312INTN
2313AsciiStriCmp (
2314 IN CONST CHAR8 *FirstString,
2315 IN CONST CHAR8 *SecondString
2316 );
2317
2318
2319/**
2320 Compares two Null-terminated ASCII strings with maximum lengths, and returns
2321 the difference between the first mismatched ASCII characters.
2322
2323 This function compares the Null-terminated ASCII string FirstString to the
2324 Null-terminated ASCII string SecondString. At most, Length ASCII characters
2325 will be compared. If Length is 0, then 0 is returned. If FirstString is
2326 identical to SecondString, then 0 is returned. Otherwise, the value returned
2327 is the first mismatched ASCII character in SecondString subtracted from the
2328 first mismatched ASCII character in FirstString.
2329
2330 If Length > 0 and FirstString is NULL, then ASSERT().
2331 If Length > 0 and SecondString is NULL, then ASSERT().
2332 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
2333 PcdMaximumAsciiStringLength, then ASSERT().
2334 If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than
2335 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
2336 then ASSERT().
2337 If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than
2338 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
2339 then ASSERT().
2340
2341 @param FirstString The pointer to a Null-terminated ASCII string.
2342 @param SecondString The pointer to a Null-terminated ASCII string.
2343 @param Length The maximum number of ASCII characters for compare.
2344
2345 @retval ==0 FirstString is identical to SecondString.
2346 @retval !=0 FirstString is not identical to SecondString.
2347
2348 **/
2349INTN
2350AsciiStrnCmp (
2351 IN CONST CHAR8 *FirstString,
2352 IN CONST CHAR8 *SecondString,
2353 IN UINTN Length
2354 );
2355
2356
2357/**
2358 Concatenates one Null-terminated ASCII string to another Null-terminated
2359 ASCII string, and returns the concatenated ASCII string.
2360
2361 This function concatenates two Null-terminated ASCII strings. The contents of
2362 Null-terminated ASCII string Source are concatenated to the end of Null-
2363 terminated ASCII string Destination. The Null-terminated concatenated ASCII
2364 String is returned.
2365
2366 If Destination is NULL, then ASSERT().
2367 If Source is NULL, then ASSERT().
2368 If PcdMaximumAsciiStringLength is not zero and Destination contains more than
2369 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2370 then ASSERT().
2371 If PcdMaximumAsciiStringLength is not zero and Source contains more than
2372 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2373 then ASSERT().
2374 If PcdMaximumAsciiStringLength is not zero and concatenating Destination and
2375 Source results in a ASCII string with more than PcdMaximumAsciiStringLength
2376 ASCII characters, then ASSERT().
2377
2378 @param Destination The pointer to a Null-terminated ASCII string.
2379 @param Source The pointer to a Null-terminated ASCII string.
2380
2381 @return Destination
2382
2383 **/
2384CHAR8 *
2385AsciiStrCat (
2386 IN OUT CHAR8 *Destination,
2387 IN CONST CHAR8 *Source
2388 );
2389
2390
2391/**
2392 Concatenates up to a specified length one Null-terminated ASCII string to
2393 the end of another Null-terminated ASCII string, and returns the
2394 concatenated ASCII string.
2395
2396 This function concatenates two Null-terminated ASCII strings. The contents
2397 of Null-terminated ASCII string Source are concatenated to the end of Null-
2398 terminated ASCII string Destination, and Destination is returned. At most,
2399 Length ASCII characters are concatenated from Source to the end of
2400 Destination, and Destination is always Null-terminated. If Length is 0, then
2401 Destination is returned unmodified. If Source and Destination overlap, then
2402 the results are undefined.
2403
2404 If Length > 0 and Destination is NULL, then ASSERT().
2405 If Length > 0 and Source is NULL, then ASSERT().
2406 If Source and Destination overlap, then ASSERT().
2407 If PcdMaximumAsciiStringLength is not zero, and Length is greater than
2408 PcdMaximumAsciiStringLength, then ASSERT().
2409 If PcdMaximumAsciiStringLength is not zero, and Destination contains more than
2410 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
2411 then ASSERT().
2412 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
2413 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,
2414 then ASSERT().
2415 If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and
2416 Source results in a ASCII string with more than PcdMaximumAsciiStringLength
2417 ASCII characters, not including the Null-terminator, then ASSERT().
2418
2419 @param Destination The pointer to a Null-terminated ASCII string.
2420 @param Source The pointer to a Null-terminated ASCII string.
2421 @param Length The maximum number of ASCII characters to concatenate from
2422 Source.
2423
2424 @return Destination
2425
2426 **/
2427CHAR8 *
2428AsciiStrnCat (
2429 IN OUT CHAR8 *Destination,
2430 IN CONST CHAR8 *Source,
2431 IN UINTN Length
2432 );
2433
2434
2435/**
2436 Returns the first occurrence of a Null-terminated ASCII sub-string
2437 in a Null-terminated ASCII string.
2438
2439 This function scans the contents of the ASCII string specified by String
2440 and returns the first occurrence of SearchString. If SearchString is not
2441 found in String, then NULL is returned. If the length of SearchString is zero,
2442 then String is returned.
2443
2444 If String is NULL, then ASSERT().
2445 If SearchString is NULL, then ASSERT().
2446
2447 If PcdMaximumAsciiStringLength is not zero, and SearchString or
2448 String contains more than PcdMaximumAsciiStringLength Unicode characters
2449 not including the Null-terminator, then ASSERT().
2450
2451 @param String The pointer to a Null-terminated ASCII string.
2452 @param SearchString The pointer to a Null-terminated ASCII string to search for.
2453
2454 @retval NULL If the SearchString does not appear in String.
2455 @retval others If there is a match return the first occurrence of SearchingString.
2456 If the length of SearchString is zero,return String.
2457
2458 **/
2459CHAR8 *
2460AsciiStrStr (
2461 IN CONST CHAR8 *String,
2462 IN CONST CHAR8 *SearchString
2463 );
2464
2465
2466/**
2467 Convert a Null-terminated ASCII decimal string to a value of type
2468 UINTN.
2469
2470 This function returns a value of type UINTN by interpreting the contents
2471 of the ASCII string String as a decimal number. The format of the input
2472 ASCII string String is:
2473
2474 [spaces] [decimal digits].
2475
2476 The valid decimal digit character is in the range [0-9]. The function will
2477 ignore the pad space, which includes spaces or tab characters, before the digits.
2478 The running zero in the beginning of [decimal digits] will be ignored. Then, the
2479 function stops at the first character that is a not a valid decimal character or
2480 Null-terminator, whichever on comes first.
2481
2482 If String has only pad spaces, then 0 is returned.
2483 If String has no pad spaces or valid decimal digits, then 0 is returned.
2484 If the number represented by String overflows according to the range defined by
2485 UINTN, then ASSERT().
2486 If String is NULL, then ASSERT().
2487 If PcdMaximumAsciiStringLength is not zero, and String contains more than
2488 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2489 then ASSERT().
2490
2491 @param String The pointer to a Null-terminated ASCII string.
2492
2493 @retval The value translated from String.
2494
2495 **/
2496UINTN
2497AsciiStrDecimalToUintn (
2498 IN CONST CHAR8 *String
2499 );
2500
2501
2502/**
2503 Convert a Null-terminated ASCII decimal string to a value of type
2504 UINT64.
2505
2506 This function returns a value of type UINT64 by interpreting the contents
2507 of the ASCII string String as a decimal number. The format of the input
2508 ASCII string String is:
2509
2510 [spaces] [decimal digits].
2511
2512 The valid decimal digit character is in the range [0-9]. The function will
2513 ignore the pad space, which includes spaces or tab characters, before the digits.
2514 The running zero in the beginning of [decimal digits] will be ignored. Then, the
2515 function stops at the first character that is a not a valid decimal character or
2516 Null-terminator, whichever on comes first.
2517
2518 If String has only pad spaces, then 0 is returned.
2519 If String has no pad spaces or valid decimal digits, then 0 is returned.
2520 If the number represented by String overflows according to the range defined by
2521 UINT64, then ASSERT().
2522 If String is NULL, then ASSERT().
2523 If PcdMaximumAsciiStringLength is not zero, and String contains more than
2524 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2525 then ASSERT().
2526
2527 @param String The pointer to a Null-terminated ASCII string.
2528
2529 @retval Value translated from String.
2530
2531 **/
2532UINT64
2533AsciiStrDecimalToUint64 (
2534 IN CONST CHAR8 *String
2535 );
2536
2537
2538/**
2539 Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.
2540
2541 This function returns a value of type UINTN by interpreting the contents of
2542 the ASCII string String as a hexadecimal number. The format of the input ASCII
2543 string String is:
2544
2545 [spaces][zeros][x][hexadecimal digits].
2546
2547 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
2548 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
2549 appears in the input string, it must be prefixed with at least one 0. The function
2550 will ignore the pad space, which includes spaces or tab characters, before [zeros],
2551 [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
2552 will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
2553 digit. Then, the function stops at the first character that is a not a valid
2554 hexadecimal character or Null-terminator, whichever on comes first.
2555
2556 If String has only pad spaces, then 0 is returned.
2557 If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then
2558 0 is returned.
2559
2560 If the number represented by String overflows according to the range defined by UINTN,
2561 then ASSERT().
2562 If String is NULL, then ASSERT().
2563 If PcdMaximumAsciiStringLength is not zero,
2564 and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
2565 the Null-terminator, then ASSERT().
2566
2567 @param String The pointer to a Null-terminated ASCII string.
2568
2569 @retval Value translated from String.
2570
2571 **/
2572UINTN
2573AsciiStrHexToUintn (
2574 IN CONST CHAR8 *String
2575 );
2576
2577
2578/**
2579 Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.
2580
2581 This function returns a value of type UINT64 by interpreting the contents of
2582 the ASCII string String as a hexadecimal number. The format of the input ASCII
2583 string String is:
2584
2585 [spaces][zeros][x][hexadecimal digits].
2586
2587 The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
2588 The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
2589 appears in the input string, it must be prefixed with at least one 0. The function
2590 will ignore the pad space, which includes spaces or tab characters, before [zeros],
2591 [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
2592 will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
2593 digit. Then, the function stops at the first character that is a not a valid
2594 hexadecimal character or Null-terminator, whichever on comes first.
2595
2596 If String has only pad spaces, then 0 is returned.
2597 If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then
2598 0 is returned.
2599
2600 If the number represented by String overflows according to the range defined by UINT64,
2601 then ASSERT().
2602 If String is NULL, then ASSERT().
2603 If PcdMaximumAsciiStringLength is not zero,
2604 and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
2605 the Null-terminator, then ASSERT().
2606
2607 @param String The pointer to a Null-terminated ASCII string.
2608
2609 @retval Value translated from String.
2610
2611 **/
2612UINT64
2613AsciiStrHexToUint64 (
2614 IN CONST CHAR8 *String
2615 );
2616
2617
2618/**
2619 Convert one Null-terminated ASCII string to a Null-terminated
2620 Unicode string and returns the Unicode string.
2621
2622 This function converts the contents of the ASCII string Source to the Unicode
2623 string Destination, and returns Destination. The function terminates the
2624 Unicode string Destination by appending a Null-terminator character at the end.
2625 The caller is responsible to make sure Destination points to a buffer with size
2626 equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.
2627
2628 If Destination is NULL, then ASSERT().
2629 If Destination is not aligned on a 16-bit boundary, then ASSERT().
2630 If Source is NULL, then ASSERT().
2631 If Source and Destination overlap, then ASSERT().
2632 If PcdMaximumAsciiStringLength is not zero, and Source contains more than
2633 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
2634 then ASSERT().
2635 If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
2636 PcdMaximumUnicodeStringLength ASCII characters not including the
2637 Null-terminator, then ASSERT().
2638
2639 @param Source The pointer to a Null-terminated ASCII string.
2640 @param Destination The pointer to a Null-terminated Unicode string.
2641
2642 @return Destination.
2643
2644 **/
2645CHAR16 *
2646AsciiStrToUnicodeStr (
2647 IN CONST CHAR8 *Source,
2648 OUT CHAR16 *Destination
2649 );
2650
2651
2652/**
2653 Converts an 8-bit value to an 8-bit BCD value.
2654
2655 Converts the 8-bit value specified by Value to BCD. The BCD value is
2656 returned.
2657
2658 If Value >= 100, then ASSERT().
2659
2660 @param Value The 8-bit value to convert to BCD. Range 0..99.
2661
2662 @return The BCD value.
2663
2664 **/
2665UINT8
2666DecimalToBcd8 (
2667 IN UINT8 Value
2668 );
2669
2670
2671/**
2672 Converts an 8-bit BCD value to an 8-bit value.
2673
2674 Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit
2675 value is returned.
2676
2677 If Value >= 0xA0, then ASSERT().
2678 If (Value & 0x0F) >= 0x0A, then ASSERT().
2679
2680 @param Value The 8-bit BCD value to convert to an 8-bit value.
2681
2682 @return The 8-bit value is returned.
2683
2684 **/
2685UINT8
2686BcdToDecimal8 (
2687 IN UINT8 Value
2688 );
2689
2690
2691/**
2692Allocates one or more 4KB pages of type EfiBootServicesData.
2693
2694Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
2695allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
2696is returned. If there is not enough memory remaining to satisfy the request, then NULL is
2697returned.
2698
2699@param Pages The number of 4 KB pages to allocate.
2700
2701@return A pointer to the allocated buffer or NULL if allocation fails.
2702
2703**/
2704VOID *
2705AllocatePages (
2706 IN UINTN Pages
2707 );
2708
2709/**
2710 Allocates one or more 4KB pages of type EfiRuntimeServicesData.
2711
2712 Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
2713 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
2714 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
2715 returned.
2716
2717 @param Pages The number of 4 KB pages to allocate.
2718
2719 @return A pointer to the allocated buffer or NULL if allocation fails.
2720
2721 **/
2722VOID *
2723AllocateRuntimePages (
2724 IN UINTN Pages
2725 );
2726
2727/**
2728 Allocates one or more 4KB pages of type EfiReservedMemoryType.
2729
2730 Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
2731 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
2732 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
2733 returned.
2734
2735 @param Pages The number of 4 KB pages to allocate.
2736
2737 @return A pointer to the allocated buffer or NULL if allocation fails.
2738
2739 **/
2740VOID *
2741AllocateReservedPages (
2742 IN UINTN Pages
2743 );
2744
2745/**
2746 Frees one or more 4KB pages that were previously allocated with one of the page allocation
2747 functions in the Memory Allocation Library.
2748
2749 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
2750 must have been allocated on a previous call to the page allocation services of the Memory
2751 Allocation Library. If it is not possible to free allocated pages, then this function will
2752 perform no actions.
2753
2754 If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
2755 then ASSERT().
2756 If Pages is zero, then ASSERT().
2757
2758 @param Buffer Pointer to the buffer of pages to free.
2759 @param Pages The number of 4 KB pages to free.
2760
2761 **/
2762VOID
2763FreePages (
2764 IN VOID *Buffer,
2765 IN UINTN Pages
2766 );
2767
2768/**
2769 Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
2770
2771 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
2772 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
2773 returned. If there is not enough memory at the specified alignment remaining to satisfy the
2774 request, then NULL is returned.
2775
2776 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
2777
2778 @param Pages The number of 4 KB pages to allocate.
2779 @param Alignment The requested alignment of the allocation. Must be a power of two.
2780 If Alignment is zero, then byte alignment is used.
2781
2782 @return A pointer to the allocated buffer or NULL if allocation fails.
2783
2784 **/
2785VOID *
2786AllocateAlignedPages (
2787 IN UINTN Pages,
2788 IN UINTN Alignment
2789 );
2790
2791/**
2792 Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
2793
2794 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
2795 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
2796 returned. If there is not enough memory at the specified alignment remaining to satisfy the
2797 request, then NULL is returned.
2798
2799 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
2800
2801 @param Pages The number of 4 KB pages to allocate.
2802 @param Alignment The requested alignment of the allocation. Must be a power of two.
2803 If Alignment is zero, then byte alignment is used.
2804
2805 @return A pointer to the allocated buffer or NULL if allocation fails.
2806
2807 **/
2808VOID *
2809AllocateAlignedRuntimePages (
2810 IN UINTN Pages,
2811 IN UINTN Alignment
2812 );
2813
2814/**
2815 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
2816
2817 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
2818 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
2819 returned. If there is not enough memory at the specified alignment remaining to satisfy the
2820 request, then NULL is returned.
2821
2822 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
2823
2824 @param Pages The number of 4 KB pages to allocate.
2825 @param Alignment The requested alignment of the allocation. Must be a power of two.
2826 If Alignment is zero, then byte alignment is used.
2827
2828 @return A pointer to the allocated buffer or NULL if allocation fails.
2829
2830 **/
2831VOID *
2832AllocateAlignedReservedPages (
2833 IN UINTN Pages,
2834 IN UINTN Alignment
2835 );
2836
2837/**
2838 Frees one or more 4KB pages that were previously allocated with one of the aligned page
2839 allocation functions in the Memory Allocation Library.
2840
2841 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
2842 must have been allocated on a previous call to the aligned page allocation services of the Memory
2843 Allocation Library. If it is not possible to free allocated pages, then this function will
2844 perform no actions.
2845
2846 If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
2847 Library, then ASSERT().
2848 If Pages is zero, then ASSERT().
2849
2850 @param Buffer Pointer to the buffer of pages to free.
2851 @param Pages The number of 4 KB pages to free.
2852
2853 **/
2854VOID
2855FreeAlignedPages (
2856 IN VOID *Buffer,
2857 IN UINTN Pages
2858 );
2859
2860/**
2861 Allocates a buffer of type EfiBootServicesData.
2862
2863 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
2864 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
2865 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
2866
2867 @param AllocationSize The number of bytes to allocate.
2868
2869 @return A pointer to the allocated buffer or NULL if allocation fails.
2870
2871 **/
2872VOID *
2873AllocatePool (
2874 IN UINTN AllocationSize
2875 );
2876
2877/**
2878 Allocates a buffer of type EfiRuntimeServicesData.
2879
2880 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
2881 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
2882 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
2883
2884 @param AllocationSize The number of bytes to allocate.
2885
2886 @return A pointer to the allocated buffer or NULL if allocation fails.
2887
2888 **/
2889VOID *
2890AllocateRuntimePool (
2891 IN UINTN AllocationSize
2892 );
2893
2894/**
2895 Allocates a buffer of type EfiReservedMemoryType.
2896
2897 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns
2898 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
2899 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
2900
2901 @param AllocationSize The number of bytes to allocate.
2902
2903 @return A pointer to the allocated buffer or NULL if allocation fails.
2904
2905 **/
2906VOID *
2907AllocateReservedPool (
2908 IN UINTN AllocationSize
2909 );
2910
2911/**
2912 Allocates and zeros a buffer of type EfiBootServicesData.
2913
2914 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
2915 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
2916 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
2917 request, then NULL is returned.
2918
2919 @param AllocationSize The number of bytes to allocate and zero.
2920
2921 @return A pointer to the allocated buffer or NULL if allocation fails.
2922
2923 **/
2924VOID *
2925AllocateZeroPool (
2926 IN UINTN AllocationSize
2927 );
2928
2929/**
2930 Allocates and zeros a buffer of type EfiRuntimeServicesData.
2931
2932 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
2933 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
2934 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
2935 request, then NULL is returned.
2936
2937 @param AllocationSize The number of bytes to allocate and zero.
2938
2939 @return A pointer to the allocated buffer or NULL if allocation fails.
2940
2941 **/
2942VOID *
2943AllocateRuntimeZeroPool (
2944 IN UINTN AllocationSize
2945 );
2946
2947/**
2948 Allocates and zeros a buffer of type EfiReservedMemoryType.
2949
2950 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
2951 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
2952 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
2953 request, then NULL is returned.
2954
2955 @param AllocationSize The number of bytes to allocate and zero.
2956
2957 @return A pointer to the allocated buffer or NULL if allocation fails.
2958
2959 **/
2960VOID *
2961AllocateReservedZeroPool (
2962 IN UINTN AllocationSize
2963 );
2964
2965/**
2966 Copies a buffer to an allocated buffer of type EfiBootServicesData.
2967
2968 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
2969 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
2970 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
2971 is not enough memory remaining to satisfy the request, then NULL is returned.
2972
2973 If Buffer is NULL, then ASSERT().
2974 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2975
2976 @param AllocationSize The number of bytes to allocate and zero.
2977 @param Buffer The buffer to copy to the allocated buffer.
2978
2979 @return A pointer to the allocated buffer or NULL if allocation fails.
2980
2981 **/
2982VOID *
2983AllocateCopyPool (
2984 IN UINTN AllocationSize,
2985 IN CONST VOID *Buffer
2986 );
2987
2988/**
2989 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
2990
2991 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
2992 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
2993 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
2994 is not enough memory remaining to satisfy the request, then NULL is returned.
2995
2996 If Buffer is NULL, then ASSERT().
2997 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
2998
2999 @param AllocationSize The number of bytes to allocate and zero.
3000 @param Buffer The buffer to copy to the allocated buffer.
3001
3002 @return A pointer to the allocated buffer or NULL if allocation fails.
3003
3004 **/
3005VOID *
3006AllocateRuntimeCopyPool (
3007 IN UINTN AllocationSize,
3008 IN CONST VOID *Buffer
3009 );
3010
3011/**
3012 Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
3013
3014 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
3015 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
3016 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
3017 is not enough memory remaining to satisfy the request, then NULL is returned.
3018
3019 If Buffer is NULL, then ASSERT().
3020 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
3021
3022 @param AllocationSize The number of bytes to allocate and zero.
3023 @param Buffer The buffer to copy to the allocated buffer.
3024
3025 @return A pointer to the allocated buffer or NULL if allocation fails.
3026
3027 **/
3028VOID *
3029AllocateReservedCopyPool (
3030 IN UINTN AllocationSize,
3031 IN CONST VOID *Buffer
3032 );
3033
3034/**
3035 Reallocates a buffer of type EfiBootServicesData.
3036
3037 Allocates and zeros the number bytes specified by NewSize from memory of type
3038 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
3039 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
3040 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
3041 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
3042 enough memory remaining to satisfy the request, then NULL is returned.
3043
3044 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
3045 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
3046
3047 @param OldSize The size, in bytes, of OldBuffer.
3048 @param NewSize The size, in bytes, of the buffer to reallocate.
3049 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
3050 parameter that may be NULL.
3051
3052 @return A pointer to the allocated buffer or NULL if allocation fails.
3053
3054 **/
3055VOID *
3056ReallocatePool (
3057 IN UINTN OldSize,
3058 IN UINTN NewSize,
3059 IN VOID *OldBuffer OPTIONAL
3060 );
3061
3062/**
3063 Reallocates a buffer of type EfiRuntimeServicesData.
3064
3065 Allocates and zeros the number bytes specified by NewSize from memory of type
3066 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
3067 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
3068 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
3069 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
3070 enough memory remaining to satisfy the request, then NULL is returned.
3071
3072 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
3073 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
3074
3075 @param OldSize The size, in bytes, of OldBuffer.
3076 @param NewSize The size, in bytes, of the buffer to reallocate.
3077 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
3078 parameter that may be NULL.
3079
3080 @return A pointer to the allocated buffer or NULL if allocation fails.
3081
3082 **/
3083VOID *
3084ReallocateRuntimePool (
3085 IN UINTN OldSize,
3086 IN UINTN NewSize,
3087 IN VOID *OldBuffer OPTIONAL
3088 );
3089
3090/**
3091 Reallocates a buffer of type EfiReservedMemoryType.
3092
3093 Allocates and zeros the number bytes specified by NewSize from memory of type
3094 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and
3095 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
3096 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
3097 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
3098 enough memory remaining to satisfy the request, then NULL is returned.
3099
3100 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
3101 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
3102
3103 @param OldSize The size, in bytes, of OldBuffer.
3104 @param NewSize The size, in bytes, of the buffer to reallocate.
3105 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
3106 parameter that may be NULL.
3107
3108 @return A pointer to the allocated buffer or NULL if allocation fails.
3109
3110 **/
3111VOID *
3112ReallocateReservedPool (
3113 IN UINTN OldSize,
3114 IN UINTN NewSize,
3115 IN VOID *OldBuffer OPTIONAL
3116 );
3117
3118/**
3119 Frees a buffer that was previously allocated with one of the pool allocation functions in the
3120 Memory Allocation Library.
3121
3122 Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
3123 pool allocation services of the Memory Allocation Library. If it is not possible to free pool
3124 resources, then this function will perform no actions.
3125
3126 If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
3127 then ASSERT().
3128
3129 @param Buffer Pointer to the buffer to free.
3130
3131 **/
3132VOID
3133FreePool (
3134 IN VOID *Buffer
3135 );
3136
3137
3138UINTN
3139SPrint (
3140 OUT CHAR16 *Str,
3141 IN UINTN StrSize,
3142 IN CHAR16 *fmt,
3143 ...
3144 );
3145
3146CHAR16 *
3147PoolPrint (
3148 IN CHAR16 *fmt,
3149 ...
3150 );
3151
3152typedef struct {
3153 CHAR16 *str;
3154 UINTN len;
3155 UINTN maxlen;
3156} POOL_PRINT;
3157
3158CHAR16 *
3159CatPrint (
3160 IN OUT POOL_PRINT *Str,
3161 IN CHAR16 *fmt,
3162 ...
3163 );
3164
3165VOID
3166ValueToHex (
3167 IN CHAR16 *Buffer,
3168 IN UINT64 v
3169 );
3170
3171VOID
3172ValueToString (
3173 IN CHAR16 *Buffer,
3174 IN BOOLEAN Comma,
3175 IN INT64 v
3176 );
3177
3178VOID
3179TimeToString (
3180 OUT CHAR16 *Buffer,
3181 IN EFI_TIME *Time
3182 );
3183
3184VOID
3185GuidToString (
3186 OUT CHAR16 *Buffer,
3187 IN EFI_GUID *Guid
3188 );
3189
3190VOID
3191StatusToString (
3192 OUT CHAR16 *Buffer,
3193 EFI_STATUS Status
3194 );
3195
3196UINT64
3197GetPowerOfTwo (
3198 IN UINT64 Operand
3199 );
3200
3201UINT8
3202Log2 (
3203 IN UINT64 Operand
3204 );
3205
3206UINT64
3207DivU64x32 (
3208 IN UINT64 Dividend,
3209 IN UINTN Divisor,
3210 OUT UINTN *Remainder OPTIONAL
3211 );
3212
3213UINT64
3214RShiftU64 (
3215 IN UINT64 Operand,
3216 IN UINTN Count
3217 );
3218
3219UINT64
3220MultU64x32 (
3221 IN UINT64 Multiplicand,
3222 IN UINTN Multiplier
3223 );
3224
3225UINT64
3226LShiftU64 (
3227 IN UINT64 Operand,
3228 IN UINTN Count
3229 );
3230
3231UINT64
3232Power10U64 (
3233 IN UINT64 Operand,
3234 IN UINTN Power
3235 );
3236
3237/**
3238 Retrieves a 32-bit PCD token value based on a token name.
3239
3240 Returns the 32-bit value for the token specified by TokenName.
3241 If TokenName is not a valid token in the token space, then the module will not build.
3242
3243 @param TokenName The name of the PCD token to retrieve a current value for.
3244
3245 @return 32-bit value for the token specified by TokenName.
3246
3247 **/
3248#define _PCD_TOKEN_PcdMaximumAsciiStringLength 6U
3249#define _PCD_VALUE_PcdMaximumAsciiStringLength 1000000U
3250#define _PCD_GET_MODE_32_PcdMaximumAsciiStringLength _PCD_VALUE_PcdMaximumAsciiStringLength
3251
3252#define _PCD_TOKEN_PcdMaximumUnicodeStringLength 7U
3253#define _PCD_VALUE_PcdMaximumUnicodeStringLength 1000000U
3254#define _PCD_GET_MODE_32_PcdMaximumUnicodeStringLength _PCD_VALUE_PcdMaximumUnicodeStringLength
3255
3256#define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName
3257
3258#define BIT0 0x00000001
3259#define BIT1 0x00000002
3260#define BIT2 0x00000004
3261#define BIT3 0x00000008
3262#define BIT4 0x00000010
3263#define BIT5 0x00000020
3264#define BIT6 0x00000040
3265#define BIT7 0x00000080
3266#define BIT8 0x00000100
3267#define BIT9 0x00000200
3268#define BIT10 0x00000400
3269#define BIT11 0x00000800
3270#define BIT12 0x00001000
3271#define BIT13 0x00002000
3272#define BIT14 0x00004000
3273#define BIT15 0x00008000
3274#define BIT16 0x00010000
3275#define BIT17 0x00020000
3276#define BIT18 0x00040000
3277#define BIT19 0x00080000
3278#define BIT20 0x00100000
3279#define BIT21 0x00200000
3280#define BIT22 0x00400000
3281#define BIT23 0x00800000
3282#define BIT24 0x01000000
3283#define BIT25 0x02000000
3284#define BIT26 0x04000000
3285#define BIT27 0x08000000
3286#define BIT28 0x10000000
3287#define BIT29 0x20000000
3288#define BIT30 0x40000000
3289#define BIT31 0x80000000
3290#define BIT32 0x0000000100000000ULL
3291#define BIT33 0x0000000200000000ULL
3292#define BIT34 0x0000000400000000ULL
3293#define BIT35 0x0000000800000000ULL
3294#define BIT36 0x0000001000000000ULL
3295#define BIT37 0x0000002000000000ULL
3296#define BIT38 0x0000004000000000ULL
3297#define BIT39 0x0000008000000000ULL
3298#define BIT40 0x0000010000000000ULL
3299#define BIT41 0x0000020000000000ULL
3300#define BIT42 0x0000040000000000ULL
3301#define BIT43 0x0000080000000000ULL
3302#define BIT44 0x0000100000000000ULL
3303#define BIT45 0x0000200000000000ULL
3304#define BIT46 0x0000400000000000ULL
3305#define BIT47 0x0000800000000000ULL
3306#define BIT48 0x0001000000000000ULL
3307#define BIT49 0x0002000000000000ULL
3308#define BIT50 0x0004000000000000ULL
3309#define BIT51 0x0008000000000000ULL
3310#define BIT52 0x0010000000000000ULL
3311#define BIT53 0x0020000000000000ULL
3312#define BIT54 0x0040000000000000ULL
3313#define BIT55 0x0080000000000000ULL
3314#define BIT56 0x0100000000000000ULL
3315#define BIT57 0x0200000000000000ULL
3316#define BIT58 0x0400000000000000ULL
3317#define BIT59 0x0800000000000000ULL
3318#define BIT60 0x1000000000000000ULL
3319#define BIT61 0x2000000000000000ULL
3320#define BIT62 0x4000000000000000ULL
3321#define BIT63 0x8000000000000000ULL
3322
3323
3324///
3325/// Maximum legal IA-32 address.
3326///
3327#define MAX_ADDRESS 0xFFFFFFFF
3328
3329typedef CHAR16 CHAR_W;
3330#define STRING_W(_s) L##_s
3331
3332#endif /* __LIBEFI_H__ */
3333
3334/* EOF */
3335

Archive Download this file

Revision: 2182