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