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/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 #include <Library/HiiLib.h>
40 #include <Library/BaseLib.h>
42 #include <MdeModuleHii.h>
44 #include <Protocol/HiiFont.h>
45 #include <Protocol/HiiDatabase.h>
48 extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName
;
49 extern EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2
;
52 // EFI Component Name Functions
55 Retrieves a Unicode string that is the user readable name of the driver.
57 This function retrieves the user readable name of a driver in the form of a
58 Unicode string. If the driver specified by This has a user readable name in
59 the language specified by Language, then a pointer to the driver name is
60 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
61 by This does not support the language specified by Language,
62 then EFI_UNSUPPORTED is returned.
64 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
65 EFI_COMPONENT_NAME_PROTOCOL instance.
67 @param Language[in] A pointer to a Null-terminated ASCII string
68 array indicating the language. This is the
69 language of the driver name that the caller is
70 requesting, and it must match one of the
71 languages specified in SupportedLanguages. The
72 number of languages supported by a driver is up
73 to the driver writer. Language is specified
74 in RFC 3066 or ISO 639-2 language code format.
76 @param DriverName[out] A pointer to the Unicode string to return.
77 This Unicode string is the name of the
78 driver specified by This in the language
79 specified by Language.
81 @retval EFI_SUCCESS The Unicode string for the Driver specified by
82 This and the language specified by Language was
83 returned in DriverName.
85 @retval EFI_INVALID_PARAMETER Language is NULL.
87 @retval EFI_INVALID_PARAMETER DriverName is NULL.
89 @retval EFI_UNSUPPORTED The driver specified by This does not support
90 the language specified by Language.
95 GraphicsConsoleComponentNameGetDriverName (
96 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
98 OUT CHAR16
**DriverName
103 Retrieves a Unicode string that is the user readable name of the controller
104 that is being managed by a driver.
106 This function retrieves the user readable name of the controller specified by
107 ControllerHandle and ChildHandle in the form of a Unicode string. If the
108 driver specified by This has a user readable name in the language specified by
109 Language, then a pointer to the controller name is returned in ControllerName,
110 and EFI_SUCCESS is returned. If the driver specified by This is not currently
111 managing the controller specified by ControllerHandle and ChildHandle,
112 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
113 support the language specified by Language, then EFI_UNSUPPORTED is returned.
115 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
116 EFI_COMPONENT_NAME_PROTOCOL instance.
118 @param ControllerHandle[in] The handle of a controller that the driver
119 specified by This is managing. This handle
120 specifies the controller whose name is to be
123 @param ChildHandle[in] The handle of the child controller to retrieve
124 the name of. This is an optional parameter that
125 may be NULL. It will be NULL for device
126 drivers. It will also be NULL for a bus drivers
127 that wish to retrieve the name of the bus
128 controller. It will not be NULL for a bus
129 driver that wishes to retrieve the name of a
132 @param Language[in] A pointer to a Null-terminated ASCII string
133 array indicating the language. This is the
134 language of the driver name that the caller is
135 requesting, and it must match one of the
136 languages specified in SupportedLanguages. The
137 number of languages supported by a driver is up
138 to the driver writer. Language is specified in
139 RFC 3066 or ISO 639-2 language code format.
141 @param ControllerName[out] A pointer to the Unicode string to return.
142 This Unicode string is the name of the
143 controller specified by ControllerHandle and
144 ChildHandle in the language specified by
145 Language from the point of view of the driver
148 @retval EFI_SUCCESS The Unicode string for the user readable name in
149 the language specified by Language for the
150 driver specified by This was returned in
153 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
155 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
158 @retval EFI_INVALID_PARAMETER Language is NULL.
160 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
162 @retval EFI_UNSUPPORTED The driver specified by This is not currently
163 managing the controller specified by
164 ControllerHandle and ChildHandle.
166 @retval EFI_UNSUPPORTED The driver specified by This does not support
167 the language specified by Language.
172 GraphicsConsoleComponentNameGetControllerName (
173 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
174 IN EFI_HANDLE ControllerHandle
,
175 IN EFI_HANDLE ChildHandle OPTIONAL
,
177 OUT CHAR16
**ControllerName
184 //#define GLYPH_WIDTH 8
185 //#define GLYPH_HEIGHT 19
188 // User can define valid graphic resolution here
189 // e.g. 640x480, 800x600, 1024x768...
191 #define CURRENT_HORIZONTAL_RESOLUTION 800
192 #define CURRENT_VERTICAL_RESOLUTION 600
195 EFI_NARROW_GLYPH NarrowGlyph
;
196 EFI_WIDE_GLYPH WideGlyph
;
199 extern EFI_NARROW_GLYPH UsStdNarrowGlyphData
[];
200 extern EFI_WIDE_GLYPH UsStdWideGlyphData
[];
205 #define GRAPHICS_CONSOLE_DEV_SIGNATURE EFI_SIGNATURE_32 ('g', 's', 't', 'o')
214 UINT32 GopModeNumber
;
215 } GRAPHICS_CONSOLE_MODE_DATA
;
217 #define GRAPHICS_MAX_MODE 4
221 EFI_GRAPHICS_OUTPUT_PROTOCOL
*GraphicsOutput
;
222 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
223 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput
;
224 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode
;
225 GRAPHICS_CONSOLE_MODE_DATA ModeData
[GRAPHICS_MAX_MODE
];
226 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*LineBuffer
;
227 EFI_HII_HANDLE HiiHandle
;
228 } GRAPHICS_CONSOLE_DEV
;
230 #define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
231 CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
236 extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding
;
242 ReturnNarrowFontSize (
253 GraphicsConsoleConOutReset (
254 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
255 IN BOOLEAN ExtendedVerification
260 GraphicsConsoleConOutOutputString (
261 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
267 GraphicsConsoleConOutTestString (
268 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
274 GraphicsConsoleConOutQueryMode (
275 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
283 GraphicsConsoleConOutSetMode (
284 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
290 GraphicsConsoleConOutSetAttribute (
291 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
297 GraphicsConsoleConOutClearScreen (
298 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
303 GraphicsConsoleConOutSetCursorPosition (
304 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
311 GraphicsConsoleConOutEnableCursor (
312 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
318 GraphicsConsoleControllerDriverSupported (
319 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
320 IN EFI_HANDLE Controller
,
321 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
326 GraphicsConsoleControllerDriverStart (
327 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
328 IN EFI_HANDLE Controller
,
329 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
334 GraphicsConsoleControllerDriverStop (
335 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
336 IN EFI_HANDLE Controller
,
337 IN UINTN NumberOfChildren
,
338 IN EFI_HANDLE
*ChildHandleBuffer
342 EfiLocateHiiProtocol (