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