]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
Update to support to produce Component Name and & Component Name 2 protocol based...
[mirror_edk2.git] / MdeModulePkg / Universal / Console / GraphicsConsoleDxe / GraphicsConsole.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 GraphicsConsole.h
15
16 Abstract:
17
18
19 Revision History
20
21 --*/
22
23 #ifndef _GRAPHICS_CONSOLE_H
24 #define _GRAPHICS_CONSOLE_H
25
26 #include <PiDxe.h>
27 #include <Protocol/HiiFramework.h>
28 #include <Protocol/SimpleTextOut.h>
29 #include <Protocol/GraphicsOutput.h>
30 #include <Protocol/UgaDraw.h>
31 #include <Protocol/DevicePath.h>
32 #include <Library/DebugLib.h>
33 #include <Library/UefiDriverEntryPoint.h>
34 #include <Library/UefiLib.h>
35 #include <Library/HiiLibFramework.h>
36 #include <Library/BaseMemoryLib.h>
37 #include <Library/MemoryAllocationLib.h>
38 #include <Library/UefiBootServicesTableLib.h>
39
40
41 extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;
42 extern EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2;
43
44 //
45 // EFI Component Name Functions
46 //
47 /**
48 Retrieves a Unicode string that is the user readable name of the driver.
49
50 This function retrieves the user readable name of a driver in the form of a
51 Unicode string. If the driver specified by This has a user readable name in
52 the language specified by Language, then a pointer to the driver name is
53 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
54 by This does not support the language specified by Language,
55 then EFI_UNSUPPORTED is returned.
56
57 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
58 EFI_COMPONENT_NAME_PROTOCOL instance.
59
60 @param Language[in] A pointer to a Null-terminated ASCII string
61 array indicating the language. This is the
62 language of the driver name that the caller is
63 requesting, and it must match one of the
64 languages specified in SupportedLanguages. The
65 number of languages supported by a driver is up
66 to the driver writer. Language is specified
67 in RFC 3066 or ISO 639-2 language code format.
68
69 @param DriverName[out] A pointer to the Unicode string to return.
70 This Unicode string is the name of the
71 driver specified by This in the language
72 specified by Language.
73
74 @retval EFI_SUCCESS The Unicode string for the Driver specified by
75 This and the language specified by Language was
76 returned in DriverName.
77
78 @retval EFI_INVALID_PARAMETER Language is NULL.
79
80 @retval EFI_INVALID_PARAMETER DriverName is NULL.
81
82 @retval EFI_UNSUPPORTED The driver specified by This does not support
83 the language specified by Language.
84
85 **/
86 EFI_STATUS
87 EFIAPI
88 GraphicsConsoleComponentNameGetDriverName (
89 IN EFI_COMPONENT_NAME_PROTOCOL *This,
90 IN CHAR8 *Language,
91 OUT CHAR16 **DriverName
92 );
93
94
95 /**
96 Retrieves a Unicode string that is the user readable name of the controller
97 that is being managed by a driver.
98
99 This function retrieves the user readable name of the controller specified by
100 ControllerHandle and ChildHandle in the form of a Unicode string. If the
101 driver specified by This has a user readable name in the language specified by
102 Language, then a pointer to the controller name is returned in ControllerName,
103 and EFI_SUCCESS is returned. If the driver specified by This is not currently
104 managing the controller specified by ControllerHandle and ChildHandle,
105 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
106 support the language specified by Language, then EFI_UNSUPPORTED is returned.
107
108 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
109 EFI_COMPONENT_NAME_PROTOCOL instance.
110
111 @param ControllerHandle[in] The handle of a controller that the driver
112 specified by This is managing. This handle
113 specifies the controller whose name is to be
114 returned.
115
116 @param ChildHandle[in] The handle of the child controller to retrieve
117 the name of. This is an optional parameter that
118 may be NULL. It will be NULL for device
119 drivers. It will also be NULL for a bus drivers
120 that wish to retrieve the name of the bus
121 controller. It will not be NULL for a bus
122 driver that wishes to retrieve the name of a
123 child controller.
124
125 @param Language[in] A pointer to a Null-terminated ASCII string
126 array indicating the language. This is the
127 language of the driver name that the caller is
128 requesting, and it must match one of the
129 languages specified in SupportedLanguages. The
130 number of languages supported by a driver is up
131 to the driver writer. Language is specified in
132 RFC 3066 or ISO 639-2 language code format.
133
134 @param ControllerName[out] A pointer to the Unicode string to return.
135 This Unicode string is the name of the
136 controller specified by ControllerHandle and
137 ChildHandle in the language specified by
138 Language from the point of view of the driver
139 specified by This.
140
141 @retval EFI_SUCCESS The Unicode string for the user readable name in
142 the language specified by Language for the
143 driver specified by This was returned in
144 DriverName.
145
146 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
147
148 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
149 EFI_HANDLE.
150
151 @retval EFI_INVALID_PARAMETER Language is NULL.
152
153 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
154
155 @retval EFI_UNSUPPORTED The driver specified by This is not currently
156 managing the controller specified by
157 ControllerHandle and ChildHandle.
158
159 @retval EFI_UNSUPPORTED The driver specified by This does not support
160 the language specified by Language.
161
162 **/
163 EFI_STATUS
164 EFIAPI
165 GraphicsConsoleComponentNameGetControllerName (
166 IN EFI_COMPONENT_NAME_PROTOCOL *This,
167 IN EFI_HANDLE ControllerHandle,
168 IN EFI_HANDLE ChildHandle OPTIONAL,
169 IN CHAR8 *Language,
170 OUT CHAR16 **ControllerName
171 );
172
173
174 //
175 // Glyph database
176 //
177 #define GLYPH_WIDTH 8
178 #define GLYPH_HEIGHT 19
179
180 typedef union {
181 EFI_NARROW_GLYPH NarrowGlyph;
182 EFI_WIDE_GLYPH WideGlyph;
183 } GLYPH_UNION;
184
185 extern EFI_NARROW_GLYPH UsStdNarrowGlyphData[];
186 extern EFI_WIDE_GLYPH UsStdWideGlyphData[];
187
188 //
189 // Device Structure
190 //
191 #define GRAPHICS_CONSOLE_DEV_SIGNATURE EFI_SIGNATURE_32 ('g', 's', 't', 'o')
192
193 typedef struct {
194 UINTN Columns;
195 UINTN Rows;
196 INTN DeltaX;
197 INTN DeltaY;
198 UINT32 GopWidth;
199 UINT32 GopHeight;
200 UINT32 GopModeNumber;
201 } GRAPHICS_CONSOLE_MODE_DATA;
202
203 #define GRAPHICS_MAX_MODE 3
204
205 typedef struct {
206 UINTN Signature;
207 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
208 EFI_UGA_DRAW_PROTOCOL *UgaDraw;
209 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
210 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
211 GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];
212 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
213 EFI_HII_HANDLE HiiHandle;
214 } GRAPHICS_CONSOLE_DEV;
215
216 #define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
217 CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
218
219 //
220 // Global Variables
221 //
222 extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;
223
224 //
225 // Prototypes
226 //
227 UINTN
228 ReturnNarrowFontSize (
229 VOID
230 );
231
232 UINTN
233 ReturnWideFontSize (
234 VOID
235 );
236
237 EFI_STATUS
238 EFIAPI
239 GraphicsConsoleConOutReset (
240 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
241 IN BOOLEAN ExtendedVerification
242 );
243
244 EFI_STATUS
245 EFIAPI
246 GraphicsConsoleConOutOutputString (
247 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
248 IN CHAR16 *WString
249 );
250
251 EFI_STATUS
252 EFIAPI
253 GraphicsConsoleConOutTestString (
254 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
255 IN CHAR16 *WString
256 );
257
258 EFI_STATUS
259 EFIAPI
260 GraphicsConsoleConOutQueryMode (
261 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
262 IN UINTN ModeNumber,
263 OUT UINTN *Columns,
264 OUT UINTN *Rows
265 );
266
267 EFI_STATUS
268 EFIAPI
269 GraphicsConsoleConOutSetMode (
270 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
271 IN UINTN ModeNumber
272 );
273
274 EFI_STATUS
275 EFIAPI
276 GraphicsConsoleConOutSetAttribute (
277 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
278 IN UINTN Attribute
279 );
280
281 EFI_STATUS
282 EFIAPI
283 GraphicsConsoleConOutClearScreen (
284 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
285 );
286
287 EFI_STATUS
288 EFIAPI
289 GraphicsConsoleConOutSetCursorPosition (
290 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
291 IN UINTN Column,
292 IN UINTN Row
293 );
294
295 EFI_STATUS
296 EFIAPI
297 GraphicsConsoleConOutEnableCursor (
298 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
299 IN BOOLEAN Visible
300 );
301
302 EFI_STATUS
303 EfiLocateHiiProtocol (
304 VOID
305 );
306
307 EFI_STATUS
308 EFIAPI
309 GraphicsConsoleControllerDriverSupported (
310 IN EFI_DRIVER_BINDING_PROTOCOL *This,
311 IN EFI_HANDLE Controller,
312 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
313 );
314
315 EFI_STATUS
316 EFIAPI
317 GraphicsConsoleControllerDriverStart (
318 IN EFI_DRIVER_BINDING_PROTOCOL *This,
319 IN EFI_HANDLE Controller,
320 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
321 );
322
323 EFI_STATUS
324 EFIAPI
325 GraphicsConsoleControllerDriverStop (
326 IN EFI_DRIVER_BINDING_PROTOCOL *This,
327 IN EFI_HANDLE Controller,
328 IN UINTN NumberOfChildren,
329 IN EFI_HANDLE *ChildHandleBuffer
330 );
331
332 #endif