2 Instance of Print Library based on gEfiPrint2ProtocolGuid.
4 Implement the print library instance by wrap the interface
5 provided in the Print2 protocol. This protocol is defined as the internal
6 protocol related to this implementation, not in the public spec. So, this
7 library instance is only for this code base.
9 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
10 This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 #include <Protocol/Print2.h>
24 #include <Library/PrintLib.h>
26 #include <Library/BaseLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/DebugLib.h>
30 EFI_PRINT2_PROTOCOL
*mPrint2Protocol
= NULL
;
33 The constructor function caches the pointer to Print2 protocol.
35 The constructor function locates Print2 protocol from protocol database.
36 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
38 @param ImageHandle The firmware allocated handle for the EFI image.
39 @param SystemTable A pointer to the EFI System Table.
41 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
47 IN EFI_HANDLE ImageHandle
,
48 IN EFI_SYSTEM_TABLE
*SystemTable
53 Status
= gBS
->LocateProtocol (
54 &gEfiPrint2ProtocolGuid
,
56 (VOID
**) &mPrint2Protocol
58 ASSERT_EFI_ERROR (Status
);
59 ASSERT (mPrint2Protocol
!= NULL
);
66 Worker function that converts a VA_LIST to a BASE_LIST based on a Null-terminated
69 @param AsciiFormat TRUE if Format is an ASCII string. FALSE if Format is a Unicode string.
70 @param Format Null-terminated format string.
71 @param VaListMarker VA_LIST style variable argument list consumed by processing Format.
72 @param BaseListMarker BASE_LIST style variable argument list consumed by processing Format.
73 @param Size The size, in bytes, of the BaseListMarker buffer.
75 @return The number of bytes in BaseListMarker. 0 if BaseListMarker is too small.
79 DxePrintLibPrint2ProtocolVaListToBaseList (
80 IN BOOLEAN AsciiFormat
,
81 IN CONST CHAR8
*Format
,
82 IN VA_LIST VaListMarker
,
83 OUT BASE_LIST BaseListMarker
,
87 BASE_LIST BaseListStart
;
88 UINTN BytesPerFormatCharacter
;
90 UINTN FormatCharacter
;
94 ASSERT (Format
!= NULL
);
95 ASSERT (BaseListMarker
!= NULL
);
97 BaseListStart
= BaseListMarker
;
100 ASSERT (AsciiStrSize (Format
) != 0);
101 BytesPerFormatCharacter
= 1;
104 ASSERT (StrSize ((CHAR16
*) Format
) != 0);
105 BytesPerFormatCharacter
= 2;
110 // Get the first character from the format string
112 FormatCharacter
= ((*Format
& 0xff) | (*(Format
+ 1) << 8)) & FormatMask
;
114 while (FormatCharacter
!= 0) {
115 if (FormatCharacter
== '%') {
119 // Parse Flags and Width
121 for (Done
= FALSE
; !Done
; ) {
123 // Get the next character from the format string
125 Format
+= BytesPerFormatCharacter
;
128 // Get the next character from the format string
130 FormatCharacter
= ((*Format
& 0xff) | (*(Format
+ 1) << 8)) & FormatMask
;
132 switch (FormatCharacter
) {
154 BASE_ARG (BaseListMarker
, UINTN
) = VA_ARG (VaListMarker
, UINTN
);
158 // Make no output if Format string terminates unexpectedly when
159 // looking up for flag, width, precision and type.
161 Format
-= BytesPerFormatCharacter
;
163 // break skipped on purpose.
172 // Handle each argument type
174 switch (FormatCharacter
) {
176 if (sizeof (VOID
*) > 4) {
183 BASE_ARG (BaseListMarker
, INT64
) = VA_ARG (VaListMarker
, INT64
);
185 BASE_ARG (BaseListMarker
, int) = VA_ARG (VaListMarker
, int);
193 BASE_ARG (BaseListMarker
, VOID
*) = VA_ARG (VaListMarker
, VOID
*);
196 BASE_ARG (BaseListMarker
, UINTN
) = VA_ARG (VaListMarker
, UINTN
);
199 BASE_ARG (BaseListMarker
, RETURN_STATUS
) = VA_ARG (VaListMarker
, RETURN_STATUS
);
205 // If BASE_LIST is larger than Size, then return FALSE
207 if ((UINTN
)((UINT8
*)BaseListMarker
- (UINT8
*)BaseListStart
) > Size
) {
212 // Get the next character from the format string
214 Format
+= BytesPerFormatCharacter
;
217 // Get the next character from the format string
219 FormatCharacter
= ((*Format
& 0xff) | (*(Format
+ 1) << 8)) & FormatMask
;
225 Produces a Null-terminated Unicode string in an output buffer based on
226 a Null-terminated Unicode format string and a VA_LIST argument list
228 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
230 The Unicode string is produced by parsing the format string specified by FormatString.
231 Arguments are pulled from the variable argument list specified by Marker based on the
232 contents of the format string.
233 The number of Unicode characters in the produced output buffer is returned not including
235 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
237 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
238 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
239 If BufferSize > 1 and FormatString is NULL, then ASSERT().
240 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
241 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
242 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
244 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
245 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
246 Null-terminator, then ASSERT().
248 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
250 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
251 @param FormatString Null-terminated Unicode format string.
252 @param Marker VA_LIST marker for the variable argument list.
254 @return The number of Unicode characters in the produced output buffer not including the
261 OUT CHAR16
*StartOfBuffer
,
263 IN CONST CHAR16
*FormatString
,
267 UINT64 BaseListMarker
[256 / sizeof (UINT64
)];
269 DxePrintLibPrint2ProtocolVaListToBaseList (
271 (CHAR8
*)FormatString
,
273 (BASE_LIST
)BaseListMarker
,
274 sizeof (BaseListMarker
) - 8
277 return UnicodeBSPrint (StartOfBuffer
, BufferSize
, FormatString
, (BASE_LIST
)BaseListMarker
);
281 Produces a Null-terminated Unicode string in an output buffer based on
282 a Null-terminated Unicode format string and a BASE_LIST argument list
284 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
286 The Unicode string is produced by parsing the format string specified by FormatString.
287 Arguments are pulled from the variable argument list specified by Marker based on the
288 contents of the format string.
289 The number of Unicode characters in the produced output buffer is returned not including
291 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
293 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
294 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
295 If BufferSize > 1 and FormatString is NULL, then ASSERT().
296 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
297 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
298 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
300 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
301 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
302 Null-terminator, then ASSERT().
304 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
306 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
307 @param FormatString Null-terminated Unicode format string.
308 @param Marker BASE_LIST marker for the variable argument list.
310 @return The number of Unicode characters in the produced output buffer not including the
317 OUT CHAR16
*StartOfBuffer
,
319 IN CONST CHAR16
*FormatString
,
323 return mPrint2Protocol
->UnicodeBSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
327 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
328 Unicode format string and variable argument list.
330 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
332 The Unicode string is produced by parsing the format string specified by FormatString.
333 Arguments are pulled from the variable argument list based on the contents of the format string.
334 The number of Unicode characters in the produced output buffer is returned not including
336 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
338 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
339 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
340 If BufferSize > 1 and FormatString is NULL, then ASSERT().
341 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
342 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
343 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
345 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
346 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
347 Null-terminator, then ASSERT().
349 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
351 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
352 @param FormatString Null-terminated Unicode format string.
353 @param ... Variable argument list whose contents are accessed based on the
354 format string specified by FormatString.
356 @return The number of Unicode characters in the produced output buffer not including the
363 OUT CHAR16
*StartOfBuffer
,
365 IN CONST CHAR16
*FormatString
,
371 VA_START (Marker
, FormatString
);
372 return UnicodeVSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
376 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
377 ASCII format string and a VA_LIST argument list
379 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
381 The Unicode string is produced by parsing the format string specified by FormatString.
382 Arguments are pulled from the variable argument list specified by Marker based on the
383 contents of the format string.
384 The number of Unicode characters in the produced output buffer is returned not including
386 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
388 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
389 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
390 If BufferSize > 1 and FormatString is NULL, then ASSERT().
391 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
392 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
394 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
395 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
396 Null-terminator, then ASSERT().
398 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
400 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
401 @param FormatString Null-terminated Unicode format string.
402 @param Marker VA_LIST marker for the variable argument list.
404 @return The number of Unicode characters in the produced output buffer not including the
410 UnicodeVSPrintAsciiFormat (
411 OUT CHAR16
*StartOfBuffer
,
413 IN CONST CHAR8
*FormatString
,
417 UINT64 BaseListMarker
[256 / sizeof (UINT64
)];
419 DxePrintLibPrint2ProtocolVaListToBaseList (
423 (BASE_LIST
)BaseListMarker
,
424 sizeof (BaseListMarker
) - 8
427 return UnicodeBSPrintAsciiFormat (StartOfBuffer
, BufferSize
, FormatString
, (BASE_LIST
)BaseListMarker
);
431 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
432 ASCII format string and a BASE_LIST argument list
434 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
436 The Unicode string is produced by parsing the format string specified by FormatString.
437 Arguments are pulled from the variable argument list specified by Marker based on the
438 contents of the format string.
439 The number of Unicode characters in the produced output buffer is returned not including
441 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
443 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
444 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
445 If BufferSize > 1 and FormatString is NULL, then ASSERT().
446 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
447 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
449 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
450 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
451 Null-terminator, then ASSERT().
453 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
455 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
456 @param FormatString Null-terminated Unicode format string.
457 @param Marker BASE_LIST marker for the variable argument list.
459 @return The number of Unicode characters in the produced output buffer not including the
465 UnicodeBSPrintAsciiFormat (
466 OUT CHAR16
*StartOfBuffer
,
468 IN CONST CHAR8
*FormatString
,
472 return mPrint2Protocol
->UnicodeBSPrintAsciiFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
476 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
477 ASCII format string and variable argument list.
479 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
481 The Unicode string is produced by parsing the format string specified by FormatString.
482 Arguments are pulled from the variable argument list based on the contents of the
484 The number of Unicode characters in the produced output buffer is returned not including
486 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
488 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
489 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
490 If BufferSize > 1 and FormatString is NULL, then ASSERT().
491 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
492 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
494 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
495 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
496 Null-terminator, then ASSERT().
498 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
500 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
501 @param FormatString Null-terminated Unicode format string.
502 @param ... Variable argument list whose contents are accessed based on the
503 format string specified by FormatString.
505 @return The number of Unicode characters in the produced output buffer not including the
511 UnicodeSPrintAsciiFormat (
512 OUT CHAR16
*StartOfBuffer
,
514 IN CONST CHAR8
*FormatString
,
520 VA_START (Marker
, FormatString
);
521 return UnicodeVSPrintAsciiFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
525 Converts a decimal value to a Null-terminated Unicode string.
527 Converts the decimal number specified by Value to a Null-terminated Unicode
528 string specified by Buffer containing at most Width characters. No padding of spaces
529 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
530 The number of Unicode characters in Buffer is returned not including the Null-terminator.
531 If the conversion contains more than Width characters, then only the first
532 Width characters are returned, and the total number of characters
533 required to perform the conversion is returned.
534 Additional conversion parameters are specified in Flags.
536 The Flags bit LEFT_JUSTIFY is always ignored.
537 All conversions are left justified in Buffer.
538 If Width is 0, PREFIX_ZERO is ignored in Flags.
539 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
540 are inserted every 3rd digit starting from the right.
541 If RADIX_HEX is set in Flags, then the output buffer will be
542 formatted in hexadecimal format.
543 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
544 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
545 then Buffer is padded with '0' characters so the combination of the optional '-'
546 sign character, '0' characters, digit characters for Value, and the Null-terminator
547 add up to Width characters.
548 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
549 If Buffer is NULL, then ASSERT().
550 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
551 If unsupported bits are set in Flags, then ASSERT().
552 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
553 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
555 @param Buffer Pointer to the output buffer for the produced Null-terminated
557 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
558 @param Value The 64-bit signed value to convert to a string.
559 @param Width The maximum number of Unicode characters to place in Buffer, not including
562 @return The number of Unicode characters in Buffer not including the Null-terminator.
567 UnicodeValueToString (
568 IN OUT CHAR16
*Buffer
,
574 return mPrint2Protocol
->UnicodeValueToString (Buffer
, Flags
, Value
, Width
);
578 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
579 ASCII format string and a VA_LIST argument list.
581 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
583 The ASCII string is produced by parsing the format string specified by FormatString.
584 Arguments are pulled from the variable argument list specified by Marker based on
585 the contents of the format string.
586 The number of ASCII characters in the produced output buffer is returned not including
588 If BufferSize is 0, then no output buffer is produced and 0 is returned.
590 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
591 If BufferSize > 0 and FormatString is NULL, then ASSERT().
592 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
593 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
595 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
596 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
597 Null-terminator, then ASSERT().
599 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
601 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
602 @param FormatString Null-terminated Unicode format string.
603 @param Marker VA_LIST marker for the variable argument list.
605 @return The number of ASCII characters in the produced output buffer not including the
612 OUT CHAR8
*StartOfBuffer
,
614 IN CONST CHAR8
*FormatString
,
618 UINT64 BaseListMarker
[256 / sizeof (UINT64
)];
620 DxePrintLibPrint2ProtocolVaListToBaseList (
624 (BASE_LIST
)BaseListMarker
,
625 sizeof (BaseListMarker
) - 8
628 return AsciiBSPrint (StartOfBuffer
, BufferSize
, FormatString
, (BASE_LIST
)BaseListMarker
);
632 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
633 ASCII format string and a BASE_LIST argument list.
635 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
637 The ASCII string is produced by parsing the format string specified by FormatString.
638 Arguments are pulled from the variable argument list specified by Marker based on
639 the contents of the format string.
640 The number of ASCII characters in the produced output buffer is returned not including
642 If BufferSize is 0, then no output buffer is produced and 0 is returned.
644 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
645 If BufferSize > 0 and FormatString is NULL, then ASSERT().
646 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
647 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
649 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
650 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
651 Null-terminator, then ASSERT().
653 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
655 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
656 @param FormatString Null-terminated Unicode format string.
657 @param Marker BASE_LIST marker for the variable argument list.
659 @return The number of ASCII characters in the produced output buffer not including the
666 OUT CHAR8
*StartOfBuffer
,
668 IN CONST CHAR8
*FormatString
,
672 return mPrint2Protocol
->AsciiBSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
676 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
677 ASCII format string and variable argument list.
679 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
681 The ASCII string is produced by parsing the format string specified by FormatString.
682 Arguments are pulled from the variable argument list based on the contents of the
684 The number of ASCII characters in the produced output buffer is returned not including
686 If BufferSize is 0, then no output buffer is produced and 0 is returned.
688 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
689 If BufferSize > 0 and FormatString is NULL, then ASSERT().
690 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
691 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
693 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
694 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
695 Null-terminator, then ASSERT().
697 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
699 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
700 @param FormatString Null-terminated Unicode format string.
701 @param ... Variable argument list whose contents are accessed based on the
702 format string specified by FormatString.
704 @return The number of ASCII characters in the produced output buffer not including the
711 OUT CHAR8
*StartOfBuffer
,
713 IN CONST CHAR8
*FormatString
,
719 VA_START (Marker
, FormatString
);
720 return AsciiVSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
724 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
725 ASCII format string and a VA_LIST argument list.
727 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
729 The ASCII string is produced by parsing the format string specified by FormatString.
730 Arguments are pulled from the variable argument list specified by Marker based on
731 the contents of the format string.
732 The number of ASCII characters in the produced output buffer is returned not including
734 If BufferSize is 0, then no output buffer is produced and 0 is returned.
736 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
737 If BufferSize > 0 and FormatString is NULL, then ASSERT().
738 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
739 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
740 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
742 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
743 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
744 Null-terminator, then ASSERT().
746 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
748 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
749 @param FormatString Null-terminated Unicode format string.
750 @param Marker VA_LIST marker for the variable argument list.
752 @return The number of ASCII characters in the produced output buffer not including the
758 AsciiVSPrintUnicodeFormat (
759 OUT CHAR8
*StartOfBuffer
,
761 IN CONST CHAR16
*FormatString
,
765 UINT64 BaseListMarker
[256 / sizeof (UINT64
)];
767 DxePrintLibPrint2ProtocolVaListToBaseList (
769 (CHAR8
*)FormatString
,
771 (BASE_LIST
)BaseListMarker
,
772 sizeof (BaseListMarker
) - 8
775 return AsciiBSPrintUnicodeFormat (StartOfBuffer
, BufferSize
, FormatString
, (BASE_LIST
)BaseListMarker
);
779 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
780 ASCII format string and a BASE_LIST argument list.
782 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
784 The ASCII string is produced by parsing the format string specified by FormatString.
785 Arguments are pulled from the variable argument list specified by Marker based on
786 the contents of the format string.
787 The number of ASCII characters in the produced output buffer is returned not including
789 If BufferSize is 0, then no output buffer is produced and 0 is returned.
791 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
792 If BufferSize > 0 and FormatString is NULL, then ASSERT().
793 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
794 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
795 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
797 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
798 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
799 Null-terminator, then ASSERT().
801 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
803 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
804 @param FormatString Null-terminated Unicode format string.
805 @param Marker BASE_LIST marker for the variable argument list.
807 @return The number of ASCII characters in the produced output buffer not including the
813 AsciiBSPrintUnicodeFormat (
814 OUT CHAR8
*StartOfBuffer
,
816 IN CONST CHAR16
*FormatString
,
820 return mPrint2Protocol
->AsciiBSPrintUnicodeFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
824 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
825 ASCII format string and variable argument list.
827 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
829 The ASCII string is produced by parsing the format string specified by FormatString.
830 Arguments are pulled from the variable argument list based on the contents of the
832 The number of ASCII characters in the produced output buffer is returned not including
834 If BufferSize is 0, then no output buffer is produced and 0 is returned.
836 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
837 If BufferSize > 0 and FormatString is NULL, then ASSERT().
838 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
839 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
840 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
842 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
843 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
844 Null-terminator, then ASSERT().
846 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
848 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
849 @param FormatString Null-terminated Unicode format string.
850 @param ... Variable argument list whose contents are accessed based on the
851 format string specified by FormatString.
853 @return The number of ASCII characters in the produced output buffer not including the
859 AsciiSPrintUnicodeFormat (
860 OUT CHAR8
*StartOfBuffer
,
862 IN CONST CHAR16
*FormatString
,
868 VA_START (Marker
, FormatString
);
869 return AsciiVSPrintUnicodeFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
874 Converts a decimal value to a Null-terminated ASCII string.
876 Converts the decimal number specified by Value to a Null-terminated ASCII string
877 specified by Buffer containing at most Width characters. No padding of spaces
879 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
880 The number of ASCII characters in Buffer is returned not including the Null-terminator.
881 If the conversion contains more than Width characters, then only the first Width
882 characters are returned, and the total number of characters required to perform
883 the conversion is returned.
884 Additional conversion parameters are specified in Flags.
885 The Flags bit LEFT_JUSTIFY is always ignored.
886 All conversions are left justified in Buffer.
887 If Width is 0, PREFIX_ZERO is ignored in Flags.
888 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
889 are inserted every 3rd digit starting from the right.
890 If RADIX_HEX is set in Flags, then the output buffer will be
891 formatted in hexadecimal format.
892 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
893 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
894 then Buffer is padded with '0' characters so the combination of the optional '-'
895 sign character, '0' characters, digit characters for Value, and the Null-terminator
896 add up to Width characters.
898 If Buffer is NULL, then ASSERT().
899 If unsupported bits are set in Flags, then ASSERT().
900 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
901 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
903 @param Buffer Pointer to the output buffer for the produced Null-terminated
905 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
906 @param Value The 64-bit signed value to convert to a string.
907 @param Width The maximum number of ASCII characters to place in Buffer, not including
910 @return The number of ASCII characters in Buffer not including the Null-terminator.
922 return mPrint2Protocol
->AsciiValueToString (Buffer
, Flags
, Value
, Width
);