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