]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/EdkDxePrintLib/PrintLib.c
PcdIoBlockBaseAddressForIpf is required by IPF platform so need add it back
[mirror_edk2.git] / MdeModulePkg / Library / EdkDxePrintLib / PrintLib.c
CommitLineData
a0afd019 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 PrintLib.c\r
15\r
16Abstract:\r
17\r
18 Print Library\r
19\r
20--*/\r
21\r
22\r
23\r
24//\r
25// The package level header files this module uses\r
26//\r
27#include <PiDxe.h>\r
28//\r
29// The protocols, PPI and GUID defintions for this module\r
30//\r
31#include <Protocol/Print.h>\r
32//\r
33// The Library classes this module consumes\r
34//\r
35#include <Library/PrintLib.h>\r
36#include <Library/UefiBootServicesTableLib.h>\r
37\r
38static EFI_PRINT_PROTOCOL *gPrintProtocol = NULL;\r
39\r
40UINTN\r
41UnicodeVSPrint (\r
42 OUT CHAR16 *StartOfBuffer,\r
43 IN UINTN BufferSize,\r
44 IN const CHAR16 *FormatString,\r
45 IN VA_LIST Marker\r
46 )\r
47/*++\r
48\r
49Routine Description:\r
50\r
51 VSPrint function to process format and place the results in Buffer. Since a\r
52 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus\r
53 this is the main print working routine\r
54\r
55Arguments:\r
56\r
57 StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.\r
58\r
59 BufferSize - Maximum number of characters to put into buffer. Zero means\r
60 no limit.\r
61\r
62 FormatString - Unicode format string see file header for more details.\r
63\r
64 Marker - Vararg list consumed by processing Format.\r
65\r
66Returns:\r
67\r
68 Number of characters printed.\r
69\r
70--*/\r
71{\r
72 EFI_STATUS Status;\r
73\r
74 if (gPrintProtocol == NULL) {\r
75 Status = gBS->LocateProtocol (\r
76 &gEfiPrintProtocolGuid,\r
77 NULL,\r
78 (VOID **)&gPrintProtocol\r
79 );\r
80 if (EFI_ERROR (Status)) {\r
81 gPrintProtocol = NULL;\r
82 }\r
83 if (gPrintProtocol == NULL) {\r
84 return 0;\r
85 }\r
86 }\r
87 return gPrintProtocol->VSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
88}\r
89\r
90UINTN\r
91UnicodeSPrint (\r
92 OUT CHAR16 *StartOfBuffer,\r
93 IN UINTN BufferSize,\r
94 IN const CHAR16 *FormatString,\r
95 ...\r
96 )\r
97\r
98{\r
99 UINTN Return;\r
100 VA_LIST Marker;\r
101\r
102 VA_START (Marker, FormatString);\r
103 Return = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
104 VA_END (Marker);\r
105 return Return;\r
106}\r
107\r
108UINTN\r
109AsciiVSPrint (\r
110 OUT CHAR8 *StartOfBuffer,\r
111 IN UINTN BufferSize,\r
112 IN const CHAR8 *FormatString,\r
113 IN VA_LIST Marker\r
114 )\r
115/*++\r
116\r
117Routine Description:\r
118\r
119 VSPrint function to process format and place the results in Buffer. Since a\r
120 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus\r
121 this is the main print working routine\r
122\r
123Arguments:\r
124\r
125 StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.\r
126\r
127 BufferSize - Maximum number of characters to put into buffer. Zero means\r
128 no limit.\r
129\r
130 FormatString - Unicode format string see file header for more details.\r
131\r
132 Marker - Vararg list consumed by processing Format.\r
133\r
134Returns:\r
135\r
136 Number of characters printed.\r
137\r
138--*/\r
139{\r
140 return 0;\r
141}\r
142\r
143UINTN\r
144AsciiSPrint (\r
145 OUT CHAR8 *StartOfBuffer,\r
146 IN UINTN BufferSize,\r
147 IN const CHAR8 *FormatString,\r
148 ...\r
149 )\r
150\r
151{\r
152 UINTN Return;\r
153 VA_LIST Marker;\r
154\r
155 VA_START (Marker, FormatString);\r
156 Return = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
157 VA_END (Marker);\r
158 return Return;\r
159}\r