VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/PrintDxe/Print.c@ 90698

Last change on this file since 90698 was 89983, checked in by vboxsync, 4 years ago

Devices/EFI: Merge edk-stable202105 and openssl 1.1.1j and make it build, bugref:4643

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette