]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/PrintDxe/Print.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Universal / PrintDxe / Print.c
CommitLineData
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 4Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-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
33UINTN\r
34EFIAPI\r
35PrintDxeUnicodeValueToString (\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
da1204cd
HW
46}\r
47\r
48/**\r
49 Implementaion of the AsciiValueToString service in EFI_PRINT2_PROTOCOL.\r
50\r
da1204cd
HW
51 @param Buffer A pointer to the output buffer for the produced\r
52 Null-terminated ASCII string.\r
53 @param Flags The bitmask of flags that specify left justification, zero\r
54 pad, and commas.\r
55 @param Value The 64-bit signed value to convert to a string.\r
56 @param Width The maximum number of ASCII characters to place in Buffer,\r
57 not including the Null-terminator.\r
58\r
5d1af380 59 @return 0.\r
da1204cd
HW
60\r
61**/\r
62UINTN\r
63EFIAPI\r
64PrintDxeAsciiValueToString (\r
1436aea4
MK
65 OUT CHAR8 *Buffer,\r
66 IN UINTN Flags,\r
67 IN INT64 Value,\r
68 IN UINTN Width\r
da1204cd
HW
69 )\r
70{\r
da1204cd
HW
71 DEBUG ((DEBUG_ERROR, "PrintDxe: The AsciiValueToString service in EFI_PRINT2_PROTOCOL is no longer supported for security reason.\n"));\r
72 DEBUG ((DEBUG_ERROR, "PrintDxe: Please consider using the AsciiValueToStringS service in EFI_PRINT2S_PROTOCOL.\n"));\r
73 ASSERT (FALSE);\r
74 return 0;\r
da1204cd
HW
75}\r
76\r
610b2cbf 77EFI_HANDLE mPrintThunkHandle = NULL;\r
78\r
1436aea4 79CONST EFI_PRINT2_PROTOCOL mPrint2Protocol = {\r
504dcb0a 80 UnicodeBSPrint,\r
610b2cbf 81 UnicodeSPrint,\r
504dcb0a 82 UnicodeBSPrintAsciiFormat,\r
610b2cbf 83 UnicodeSPrintAsciiFormat,\r
da1204cd 84 PrintDxeUnicodeValueToString,\r
504dcb0a 85 AsciiBSPrint,\r
610b2cbf 86 AsciiSPrint,\r
504dcb0a 87 AsciiBSPrintUnicodeFormat,\r
610b2cbf 88 AsciiSPrintUnicodeFormat,\r
da1204cd 89 PrintDxeAsciiValueToString\r
610b2cbf 90};\r
91\r
1436aea4 92CONST EFI_PRINT2S_PROTOCOL mPrint2SProtocol = {\r
e43adbaf
HW
93 UnicodeBSPrint,\r
94 UnicodeSPrint,\r
95 UnicodeBSPrintAsciiFormat,\r
96 UnicodeSPrintAsciiFormat,\r
97 UnicodeValueToStringS,\r
98 AsciiBSPrint,\r
99 AsciiSPrint,\r
100 AsciiBSPrintUnicodeFormat,\r
101 AsciiSPrintUnicodeFormat,\r
102 AsciiValueToStringS\r
103};\r
104\r
610b2cbf 105/**\r
106 The user Entry Point for Print module.\r
107\r
108 This is the entry point for Print DXE Driver. It installs the Print2 Protocol.\r
109\r
110 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
111 @param[in] SystemTable A pointer to the EFI System Table.\r
112\r
113 @retval EFI_SUCCESS The entry point is executed successfully.\r
114 @retval Others Some error occurs when executing this entry point.\r
115\r
116**/\r
117EFI_STATUS\r
118EFIAPI\r
119PrintEntryPoint (\r
1436aea4
MK
120 IN EFI_HANDLE ImageHandle,\r
121 IN EFI_SYSTEM_TABLE *SystemTable\r
610b2cbf 122 )\r
123{\r
124 EFI_STATUS Status;\r
125\r
126 Status = gBS->InstallMultipleProtocolInterfaces (\r
127 &mPrintThunkHandle,\r
1436aea4
MK
128 &gEfiPrint2ProtocolGuid,\r
129 &mPrint2Protocol,\r
130 &gEfiPrint2SProtocolGuid,\r
131 &mPrint2SProtocol,\r
610b2cbf 132 NULL\r
133 );\r
134 ASSERT_EFI_ERROR (Status);\r
135\r
136 return Status;\r
137}\r