]>
Commit | Line | Data |
---|---|---|
610b2cbf | 1 | /** @file\r |
e43adbaf | 2 | This driver produces Print2 protocols layered on top of the PrintLib from the MdePkg.\r |
610b2cbf | 3 | \r |
e43adbaf | 4 | Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
610b2cbf | 6 | \r |
7 | **/\r | |
8 | \r | |
9 | #include <PiDxe.h>\r | |
10 | \r | |
11 | #include <Protocol/Print2.h>\r | |
12 | #include <Library/PrintLib.h>\r | |
13 | #include <Library/UefiBootServicesTableLib.h>\r | |
14 | #include <Library/DebugLib.h>\r | |
4f22e23b | 15 | #include <Library/UefiDriverEntryPoint.h>\r |
610b2cbf | 16 | \r |
da1204cd HW |
17 | /**\r |
18 | Implementaion of the UnicodeValueToString service in EFI_PRINT2_PROTOCOL.\r | |
19 | \r | |
da1204cd HW |
20 | \r |
21 | @param Buffer The pointer to the output buffer for the produced\r | |
22 | Null-terminated Unicode string.\r | |
23 | @param Flags The bitmask of flags that specify left justification, zero\r | |
24 | pad, and commas.\r | |
25 | @param Value The 64-bit signed value to convert to a string.\r | |
26 | @param Width The maximum number of Unicode characters to place in Buffer,\r | |
27 | not including the Null-terminator.\r | |
28 | \r | |
5d1af380 SZ |
29 | @return 0.\r |
30 | \r | |
da1204cd HW |
31 | \r |
32 | **/\r | |
33 | UINTN\r | |
34 | EFIAPI\r | |
35 | PrintDxeUnicodeValueToString (\r | |
36 | IN OUT CHAR16 *Buffer,\r | |
37 | IN UINTN Flags,\r | |
38 | IN INT64 Value,\r | |
39 | IN UINTN Width\r | |
40 | )\r | |
41 | {\r | |
da1204cd HW |
42 | DEBUG ((DEBUG_ERROR, "PrintDxe: The UnicodeValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));\r |
43 | DEBUG ((DEBUG_ERROR, "PrintDxe: Please consider using the UnicodeValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));\r | |
44 | ASSERT (FALSE);\r | |
45 | return 0;\r | |
5d1af380 | 46 | \r |
da1204cd HW |
47 | }\r |
48 | \r | |
49 | /**\r | |
50 | Implementaion of the AsciiValueToString service in EFI_PRINT2_PROTOCOL.\r | |
51 | \r | |
da1204cd HW |
52 | @param Buffer A pointer to the output buffer for the produced\r |
53 | Null-terminated ASCII string.\r | |
54 | @param Flags The bitmask of flags that specify left justification, zero\r | |
55 | pad, and commas.\r | |
56 | @param Value The 64-bit signed value to convert to a string.\r | |
57 | @param Width The maximum number of ASCII characters to place in Buffer,\r | |
58 | not including the Null-terminator.\r | |
59 | \r | |
5d1af380 | 60 | @return 0.\r |
da1204cd HW |
61 | \r |
62 | **/\r | |
63 | UINTN\r | |
64 | EFIAPI\r | |
65 | PrintDxeAsciiValueToString (\r | |
66 | OUT CHAR8 *Buffer,\r | |
67 | IN UINTN Flags,\r | |
68 | IN INT64 Value,\r | |
69 | IN UINTN Width\r | |
70 | )\r | |
71 | {\r | |
5d1af380 | 72 | \r |
da1204cd HW |
73 | DEBUG ((DEBUG_ERROR, "PrintDxe: The AsciiValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));\r |
74 | DEBUG ((DEBUG_ERROR, "PrintDxe: Please consider using the AsciiValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));\r | |
75 | ASSERT (FALSE);\r | |
76 | return 0;\r | |
5d1af380 | 77 | \r |
da1204cd HW |
78 | }\r |
79 | \r | |
610b2cbf | 80 | EFI_HANDLE mPrintThunkHandle = NULL;\r |
81 | \r | |
82 | CONST EFI_PRINT2_PROTOCOL mPrint2Protocol = {\r | |
504dcb0a | 83 | UnicodeBSPrint,\r |
610b2cbf | 84 | UnicodeSPrint,\r |
504dcb0a | 85 | UnicodeBSPrintAsciiFormat,\r |
610b2cbf | 86 | UnicodeSPrintAsciiFormat,\r |
da1204cd | 87 | PrintDxeUnicodeValueToString,\r |
504dcb0a | 88 | AsciiBSPrint,\r |
610b2cbf | 89 | AsciiSPrint,\r |
504dcb0a | 90 | AsciiBSPrintUnicodeFormat,\r |
610b2cbf | 91 | AsciiSPrintUnicodeFormat,\r |
da1204cd | 92 | PrintDxeAsciiValueToString\r |
610b2cbf | 93 | };\r |
94 | \r | |
e43adbaf HW |
95 | CONST EFI_PRINT2S_PROTOCOL mPrint2SProtocol = {\r |
96 | UnicodeBSPrint,\r | |
97 | UnicodeSPrint,\r | |
98 | UnicodeBSPrintAsciiFormat,\r | |
99 | UnicodeSPrintAsciiFormat,\r | |
100 | UnicodeValueToStringS,\r | |
101 | AsciiBSPrint,\r | |
102 | AsciiSPrint,\r | |
103 | AsciiBSPrintUnicodeFormat,\r | |
104 | AsciiSPrintUnicodeFormat,\r | |
105 | AsciiValueToStringS\r | |
106 | };\r | |
107 | \r | |
610b2cbf | 108 | /**\r |
109 | The user Entry Point for Print module.\r | |
110 | \r | |
111 | This is the entry point for Print DXE Driver. It installs the Print2 Protocol.\r | |
112 | \r | |
113 | @param[in] ImageHandle The firmware allocated handle for the EFI image.\r | |
114 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
115 | \r | |
116 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
117 | @retval Others Some error occurs when executing this entry point.\r | |
118 | \r | |
119 | **/\r | |
120 | EFI_STATUS\r | |
121 | EFIAPI\r | |
122 | PrintEntryPoint (\r | |
123 | IN EFI_HANDLE ImageHandle,\r | |
124 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
125 | )\r | |
126 | {\r | |
127 | EFI_STATUS Status;\r | |
128 | \r | |
129 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
130 | &mPrintThunkHandle,\r | |
131 | &gEfiPrint2ProtocolGuid, &mPrint2Protocol,\r | |
e43adbaf | 132 | &gEfiPrint2SProtocolGuid, &mPrint2SProtocol,\r |
610b2cbf | 133 | NULL\r |
134 | );\r | |
135 | ASSERT_EFI_ERROR (Status);\r | |
136 | \r | |
137 | return Status;\r | |
138 | }\r |