2 This driver produces Print2 protocols layered on top of the PrintLib from the MdePkg.
4 Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Protocol/Print2.h>
12 #include <Library/PrintLib.h>
13 #include <Library/UefiBootServicesTableLib.h>
14 #include <Library/DebugLib.h>
15 #include <Library/UefiDriverEntryPoint.h>
18 Implementaion of the UnicodeValueToString service in EFI_PRINT2_PROTOCOL.
20 If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then ASSERT().
22 @param Buffer The pointer to the output buffer for the produced
23 Null-terminated Unicode string.
24 @param Flags The bitmask of flags that specify left justification, zero
26 @param Value The 64-bit signed value to convert to a string.
27 @param Width The maximum number of Unicode characters to place in Buffer,
28 not including the Null-terminator.
30 @return If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, return 0.
31 Otherwise, return the number of Unicode characters in Buffer not
32 including the Null-terminator.
37 PrintDxeUnicodeValueToString (
38 IN OUT CHAR16
*Buffer
,
44 #ifdef DISABLE_NEW_DEPRECATED_INTERFACES
46 // If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then the
47 // PrintLib API UnicodeValueToString is already deprecated.
48 // In this case, ASSERT will be triggered and zero will be returned for the
49 // implementation of the UnicodeValueToString service in EFI_PRINT2_PROTOCOL
50 // to indicate that the service is no longer supported.
52 DEBUG ((DEBUG_ERROR
, "PrintDxe: The UnicodeValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));
53 DEBUG ((DEBUG_ERROR
, "PrintDxe: Please consider using the UnicodeValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));
57 return UnicodeValueToString (Buffer
, Flags
, Value
, Width
);
62 Implementaion of the AsciiValueToString service in EFI_PRINT2_PROTOCOL.
64 If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then ASSERT().
66 @param Buffer A pointer to the output buffer for the produced
67 Null-terminated ASCII string.
68 @param Flags The bitmask of flags that specify left justification, zero
70 @param Value The 64-bit signed value to convert to a string.
71 @param Width The maximum number of ASCII characters to place in Buffer,
72 not including the Null-terminator.
74 @return If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, return 0.
75 Otherwise, return the number of ASCII characters in Buffer not
76 including the Null-terminator.
81 PrintDxeAsciiValueToString (
88 #ifdef DISABLE_NEW_DEPRECATED_INTERFACES
90 // If the macro DISABLE_NEW_DEPRECATED_INTERFACES is defined, then the
91 // PrintLib API AsciiValueToString is already deprecated.
92 // In this case, ASSERT will be triggered and zero will be returned for the
93 // implementation of the AsciiValueToString service in EFI_PRINT2_PROTOCOL
94 // to indicate that the service is no longer supported.
96 DEBUG ((DEBUG_ERROR
, "PrintDxe: The AsciiValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));
97 DEBUG ((DEBUG_ERROR
, "PrintDxe: Please consider using the AsciiValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));
101 return AsciiValueToString (Buffer
, Flags
, Value
, Width
);
105 EFI_HANDLE mPrintThunkHandle
= NULL
;
107 CONST EFI_PRINT2_PROTOCOL mPrint2Protocol
= {
110 UnicodeBSPrintAsciiFormat
,
111 UnicodeSPrintAsciiFormat
,
112 PrintDxeUnicodeValueToString
,
115 AsciiBSPrintUnicodeFormat
,
116 AsciiSPrintUnicodeFormat
,
117 PrintDxeAsciiValueToString
120 CONST EFI_PRINT2S_PROTOCOL mPrint2SProtocol
= {
123 UnicodeBSPrintAsciiFormat
,
124 UnicodeSPrintAsciiFormat
,
125 UnicodeValueToStringS
,
128 AsciiBSPrintUnicodeFormat
,
129 AsciiSPrintUnicodeFormat
,
134 The user Entry Point for Print module.
136 This is the entry point for Print DXE Driver. It installs the Print2 Protocol.
138 @param[in] ImageHandle The firmware allocated handle for the EFI image.
139 @param[in] SystemTable A pointer to the EFI System Table.
141 @retval EFI_SUCCESS The entry point is executed successfully.
142 @retval Others Some error occurs when executing this entry point.
148 IN EFI_HANDLE ImageHandle
,
149 IN EFI_SYSTEM_TABLE
*SystemTable
154 Status
= gBS
->InstallMultipleProtocolInterfaces (
156 &gEfiPrint2ProtocolGuid
, &mPrint2Protocol
,
157 &gEfiPrint2SProtocolGuid
, &mPrint2SProtocol
,
160 ASSERT_EFI_ERROR (Status
);