]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
1. Fixed bugs in DxeNetLib to meet consistence with network module DriverBinding...
[mirror_edk2.git] / MdeModulePkg / Universal / Console / GraphicsConsoleDxe / GraphicsConsole.h
1 /*++
2
3 Copyright (c) 2006 - 2008, 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/FrameworkHii.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/FrameworkHiiLib.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 //
181 // User can define valid graphic resolution here
182 // e.g. 640x480, 800x600, 1024x768...
183 //
184 #define CURRENT_HORIZONTAL_RESOLUTION 800
185 #define CURRENT_VERTICAL_RESOLUTION 600
186
187 typedef union {
188 EFI_NARROW_GLYPH NarrowGlyph;
189 EFI_WIDE_GLYPH WideGlyph;
190 } GLYPH_UNION;
191
192 extern EFI_NARROW_GLYPH UsStdNarrowGlyphData[];
193 extern EFI_WIDE_GLYPH UsStdWideGlyphData[];
194
195 //
196 // Device Structure
197 //
198 #define GRAPHICS_CONSOLE_DEV_SIGNATURE EFI_SIGNATURE_32 ('g', 's', 't', 'o')
199
200 typedef struct {
201 UINTN Columns;
202 UINTN Rows;
203 INTN DeltaX;
204 INTN DeltaY;
205 UINT32 GopWidth;
206 UINT32 GopHeight;
207 UINT32 GopModeNumber;
208 } GRAPHICS_CONSOLE_MODE_DATA;
209
210 #define GRAPHICS_MAX_MODE 4
211
212 typedef struct {
213 UINTN Signature;
214 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
215 EFI_UGA_DRAW_PROTOCOL *UgaDraw;
216 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
217 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
218 GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];
219 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
220 EFI_HII_HANDLE HiiHandle;
221 } GRAPHICS_CONSOLE_DEV;
222
223 #define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
224 CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
225
226 //
227 // Global Variables
228 //
229 extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;
230
231 //
232 // Prototypes
233 //
234 UINTN
235 ReturnNarrowFontSize (
236 VOID
237 );
238
239 UINTN
240 ReturnWideFontSize (
241 VOID
242 );
243
244 EFI_STATUS
245 EFIAPI
246 GraphicsConsoleConOutReset (
247 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
248 IN BOOLEAN ExtendedVerification
249 );
250
251 EFI_STATUS
252 EFIAPI
253 GraphicsConsoleConOutOutputString (
254 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
255 IN CHAR16 *WString
256 );
257
258 EFI_STATUS
259 EFIAPI
260 GraphicsConsoleConOutTestString (
261 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
262 IN CHAR16 *WString
263 );
264
265 EFI_STATUS
266 EFIAPI
267 GraphicsConsoleConOutQueryMode (
268 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
269 IN UINTN ModeNumber,
270 OUT UINTN *Columns,
271 OUT UINTN *Rows
272 );
273
274 EFI_STATUS
275 EFIAPI
276 GraphicsConsoleConOutSetMode (
277 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
278 IN UINTN ModeNumber
279 );
280
281 EFI_STATUS
282 EFIAPI
283 GraphicsConsoleConOutSetAttribute (
284 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
285 IN UINTN Attribute
286 );
287
288 EFI_STATUS
289 EFIAPI
290 GraphicsConsoleConOutClearScreen (
291 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
292 );
293
294 EFI_STATUS
295 EFIAPI
296 GraphicsConsoleConOutSetCursorPosition (
297 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
298 IN UINTN Column,
299 IN UINTN Row
300 );
301
302 EFI_STATUS
303 EFIAPI
304 GraphicsConsoleConOutEnableCursor (
305 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
306 IN BOOLEAN Visible
307 );
308
309 EFI_STATUS
310 EfiLocateHiiProtocol (
311 VOID
312 );
313
314 EFI_STATUS
315 EFIAPI
316 GraphicsConsoleControllerDriverSupported (
317 IN EFI_DRIVER_BINDING_PROTOCOL *This,
318 IN EFI_HANDLE Controller,
319 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
320 );
321
322 EFI_STATUS
323 EFIAPI
324 GraphicsConsoleControllerDriverStart (
325 IN EFI_DRIVER_BINDING_PROTOCOL *This,
326 IN EFI_HANDLE Controller,
327 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
328 );
329
330 EFI_STATUS
331 EFIAPI
332 GraphicsConsoleControllerDriverStop (
333 IN EFI_DRIVER_BINDING_PROTOCOL *This,
334 IN EFI_HANDLE Controller,
335 IN UINTN NumberOfChildren,
336 IN EFI_HANDLE *ChildHandleBuffer
337 );
338
339 #endif