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
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.
23 #ifndef _GRAPHICS_CONSOLE_H
24 #define _GRAPHICS_CONSOLE_H
27 #include <Protocol/SimpleTextOut.h>
28 #include <Protocol/GraphicsOutput.h>
29 #include <Protocol/UgaDraw.h>
30 #include <Protocol/DevicePath.h>
31 #include <Library/DebugLib.h>
32 #include <Library/UefiDriverEntryPoint.h>
33 #include <Library/UefiLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/HiiLib.h>
38 #include <Library/BaseLib.h>
39 #include <Library/PcdLib.h>
41 #include <MdeModuleHii.h>
43 #include <Protocol/HiiFont.h>
44 #include <Protocol/HiiDatabase.h>
47 extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName
;
48 extern EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2
;
51 // EFI Component Name Functions
54 Retrieves a Unicode string that is the user readable name of the driver.
56 This function retrieves the user readable name of a driver in the form of a
57 Unicode string. If the driver specified by This has a user readable name in
58 the language specified by Language, then a pointer to the driver name is
59 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
60 by This does not support the language specified by Language,
61 then EFI_UNSUPPORTED is returned.
63 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
64 EFI_COMPONENT_NAME_PROTOCOL instance.
66 @param Language[in] A pointer to a Null-terminated ASCII string
67 array indicating the language. This is the
68 language of the driver name that the caller is
69 requesting, and it must match one of the
70 languages specified in SupportedLanguages. The
71 number of languages supported by a driver is up
72 to the driver writer. Language is specified
73 in RFC 3066 or ISO 639-2 language code format.
75 @param DriverName[out] A pointer to the Unicode string to return.
76 This Unicode string is the name of the
77 driver specified by This in the language
78 specified by Language.
80 @retval EFI_SUCCESS The Unicode string for the Driver specified by
81 This and the language specified by Language was
82 returned in DriverName.
84 @retval EFI_INVALID_PARAMETER Language is NULL.
86 @retval EFI_INVALID_PARAMETER DriverName is NULL.
88 @retval EFI_UNSUPPORTED The driver specified by This does not support
89 the language specified by Language.
94 GraphicsConsoleComponentNameGetDriverName (
95 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
97 OUT CHAR16
**DriverName
102 Retrieves a Unicode string that is the user readable name of the controller
103 that is being managed by a driver.
105 This function retrieves the user readable name of the controller specified by
106 ControllerHandle and ChildHandle in the form of a Unicode string. If the
107 driver specified by This has a user readable name in the language specified by
108 Language, then a pointer to the controller name is returned in ControllerName,
109 and EFI_SUCCESS is returned. If the driver specified by This is not currently
110 managing the controller specified by ControllerHandle and ChildHandle,
111 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
112 support the language specified by Language, then EFI_UNSUPPORTED is returned.
114 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
115 EFI_COMPONENT_NAME_PROTOCOL instance.
117 @param ControllerHandle[in] The handle of a controller that the driver
118 specified by This is managing. This handle
119 specifies the controller whose name is to be
122 @param ChildHandle[in] The handle of the child controller to retrieve
123 the name of. This is an optional parameter that
124 may be NULL. It will be NULL for device
125 drivers. It will also be NULL for a bus drivers
126 that wish to retrieve the name of the bus
127 controller. It will not be NULL for a bus
128 driver that wishes to retrieve the name of a
131 @param Language[in] A pointer to a Null-terminated ASCII string
132 array indicating the language. This is the
133 language of the driver name that the caller is
134 requesting, and it must match one of the
135 languages specified in SupportedLanguages. The
136 number of languages supported by a driver is up
137 to the driver writer. Language is specified in
138 RFC 3066 or ISO 639-2 language code format.
140 @param ControllerName[out] A pointer to the Unicode string to return.
141 This Unicode string is the name of the
142 controller specified by ControllerHandle and
143 ChildHandle in the language specified by
144 Language from the point of view of the driver
147 @retval EFI_SUCCESS The Unicode string for the user readable name in
148 the language specified by Language for the
149 driver specified by This was returned in
152 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
154 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
157 @retval EFI_INVALID_PARAMETER Language is NULL.
159 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
161 @retval EFI_UNSUPPORTED The driver specified by This is not currently
162 managing the controller specified by
163 ControllerHandle and ChildHandle.
165 @retval EFI_UNSUPPORTED The driver specified by This does not support
166 the language specified by Language.
171 GraphicsConsoleComponentNameGetControllerName (
172 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
173 IN EFI_HANDLE ControllerHandle
,
174 IN EFI_HANDLE ChildHandle OPTIONAL
,
176 OUT CHAR16
**ControllerName
183 //#define GLYPH_WIDTH 8
184 //#define GLYPH_HEIGHT 19
187 // User can define valid graphic resolution here
188 // e.g. 640x480, 800x600, 1024x768...
190 #define CURRENT_HORIZONTAL_RESOLUTION 800
191 #define CURRENT_VERTICAL_RESOLUTION 600
194 EFI_NARROW_GLYPH NarrowGlyph
;
195 EFI_WIDE_GLYPH WideGlyph
;
198 extern EFI_NARROW_GLYPH UsStdNarrowGlyphData
[];
199 extern EFI_WIDE_GLYPH UsStdWideGlyphData
[];
204 #define GRAPHICS_CONSOLE_DEV_SIGNATURE EFI_SIGNATURE_32 ('g', 's', 't', 'o')
213 UINT32 GopModeNumber
;
214 } GRAPHICS_CONSOLE_MODE_DATA
;
216 #define GRAPHICS_MAX_MODE 4
220 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
221 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
222 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput
;
223 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode
;
224 GRAPHICS_CONSOLE_MODE_DATA ModeData
[GRAPHICS_MAX_MODE
];
225 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*LineBuffer
;
226 EFI_HII_HANDLE HiiHandle
;
227 } GRAPHICS_CONSOLE_DEV
;
229 #define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
230 CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
235 extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding
;
241 ReturnNarrowFontSize (
252 GraphicsConsoleConOutReset (
253 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
254 IN BOOLEAN ExtendedVerification
259 GraphicsConsoleConOutOutputString (
260 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
266 GraphicsConsoleConOutTestString (
267 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
273 GraphicsConsoleConOutQueryMode (
274 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
282 GraphicsConsoleConOutSetMode (
283 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
289 GraphicsConsoleConOutSetAttribute (
290 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
296 GraphicsConsoleConOutClearScreen (
297 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
302 GraphicsConsoleConOutSetCursorPosition (
303 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
310 GraphicsConsoleConOutEnableCursor (
311 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
317 GraphicsConsoleControllerDriverSupported (
318 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
319 IN EFI_HANDLE Controller
,
320 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
325 GraphicsConsoleControllerDriverStart (
326 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
327 IN EFI_HANDLE Controller
,
328 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
333 GraphicsConsoleControllerDriverStop (
334 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
335 IN EFI_HANDLE Controller
,
336 IN UINTN NumberOfChildren
,
337 IN EFI_HANDLE
*ChildHandleBuffer
341 EfiLocateHiiProtocol (