]>
Commit | Line | Data |
---|---|---|
fb0b259e | 1 | /** @file\r |
2 | Header file for Console Platfrom DXE Driver.\r | |
95276127 | 3 | \r |
9359e53f | 4 | Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r |
fb0b259e | 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 | |
95276127 | 9 | \r |
fb0b259e | 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 |
415df2a3 | 15 | #ifndef _CON_PLATFORM_H_\r |
16 | #define _CON_PLATFORM_H_\r | |
95276127 | 17 | \r |
60c93673 | 18 | #include <Uefi.h>\r |
7b9ff698 | 19 | \r |
859b72fa | 20 | #include <Protocol/SimpleTextOut.h>\r |
7b9ff698 | 21 | #include <Protocol/DevicePath.h>\r |
22 | #include <Protocol/SimpleTextIn.h>\r | |
23 | \r | |
859b72fa A |
24 | #include <Guid/GlobalVariable.h>\r |
25 | #include <Guid/ConsoleInDevice.h>\r | |
fb0b259e | 26 | #include <Guid/StandardErrorDevice.h>\r |
27 | #include <Guid/ConsoleOutDevice.h>\r | |
859b72fa | 28 | #include <Guid/HotPlugDevice.h>\r |
fb0b259e | 29 | \r |
859b72fa A |
30 | #include <Library/DebugLib.h>\r |
31 | #include <Library/UefiDriverEntryPoint.h>\r | |
32 | #include <Library/UefiLib.h>\r | |
33 | #include <Library/BaseMemoryLib.h>\r | |
34 | #include <Library/UefiBootServicesTableLib.h>\r | |
35 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
36 | #include <Library/DevicePathLib.h>\r | |
37 | #include <Library/MemoryAllocationLib.h>\r | |
38 | \r | |
95276127 | 39 | //\r |
859b72fa | 40 | // Driver Binding Externs\r |
95276127 | 41 | //\r |
5bca971e | 42 | extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;\r |
43 | extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r | |
44 | extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;\r | |
45 | extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;\r | |
46 | extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r | |
47 | extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;\r | |
95276127 | 48 | \r |
95276127 | 49 | \r |
50 | typedef enum {\r | |
51 | CHECK,\r | |
52 | APPEND,\r | |
53 | DELETE\r | |
54 | } CONPLATFORM_VAR_OPERATION;\r | |
55 | \r | |
9359e53f | 56 | /**\r |
c5ed97f6 | 57 | Test to see if specific protocol could be supported on the ControllerHandle. \r |
9359e53f | 58 | \r |
59 | @param This Protocol instance pointer.\r | |
60 | @param ControllerHandle Handle of device to test.\r | |
9359e53f | 61 | @param ProtocolGuid The specfic protocol.\r |
62 | \r | |
63 | @retval EFI_SUCCESS This driver supports this device\r | |
64 | @retval other This driver does not support this device\r | |
65 | \r | |
66 | **/\r | |
95276127 | 67 | EFI_STATUS\r |
68 | ConPlatformDriverBindingSupported (\r | |
69 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
70 | IN EFI_HANDLE ControllerHandle,\r | |
95276127 | 71 | IN EFI_GUID *ProtocolGuid\r |
72 | );\r | |
73 | \r | |
9359e53f | 74 | /**\r |
c5ed97f6 | 75 | Test to see if EFI_SIMPLE_TEXT_INPUT_PROTOCOL is supported on ControllerHandle. \r |
9359e53f | 76 | \r |
77 | @param This Protocol instance pointer.\r | |
78 | @param ControllerHandle Handle of device to test.\r | |
79 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
80 | device to start.\r | |
81 | \r | |
c5ed97f6 | 82 | @retval EFI_SUCCESS This driver supports this device.\r |
83 | @retval other This driver does not support this device.\r | |
9359e53f | 84 | \r |
85 | **/\r | |
95276127 | 86 | EFI_STATUS\r |
87 | EFIAPI\r | |
88 | ConPlatformTextInDriverBindingSupported (\r | |
89 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
90 | IN EFI_HANDLE Handle,\r | |
c5ed97f6 | 91 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r |
95276127 | 92 | );\r |
93 | \r | |
9359e53f | 94 | /**\r |
c5ed97f6 | 95 | Test to see if EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is supported on ControllerHandle. \r |
9359e53f | 96 | \r |
97 | @param This Protocol instance pointer.\r | |
98 | @param ControllerHandle Handle of device to test.\r | |
99 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
100 | device to start.\r | |
101 | \r | |
c5ed97f6 | 102 | @retval EFI_SUCCESS This driver supports this device.\r |
103 | @retval other This driver does not support this device.\r | |
9359e53f | 104 | \r |
105 | **/\r | |
95276127 | 106 | EFI_STATUS\r |
107 | EFIAPI\r | |
108 | ConPlatformTextOutDriverBindingSupported (\r | |
109 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
110 | IN EFI_HANDLE Handle,\r | |
c5ed97f6 | 111 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r |
95276127 | 112 | );\r |
113 | \r | |
9359e53f | 114 | /**\r |
c5ed97f6 | 115 | Start this driver on the device for console input.\r |
116 | \r | |
117 | Start this driver on ControllerHandle by opening Simple Text Input Protocol,\r | |
24248368 | 118 | reading Device Path, and installing Console In Devcice GUID on ControllerHandle.\r |
9359e53f | 119 | \r |
120 | If this devcie is not one hot-plug devce, append its device path into the \r | |
121 | console environment variables ConInDev.\r | |
122 | \r | |
123 | @param This Protocol instance pointer.\r | |
124 | @param ControllerHandle Handle of device to bind driver to\r | |
125 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
126 | device to start.\r | |
127 | \r | |
128 | @retval EFI_SUCCESS This driver is added to ControllerHandle\r | |
129 | @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r | |
c5ed97f6 | 130 | @retval other This driver does not support this device.\r |
9359e53f | 131 | \r |
132 | **/\r | |
95276127 | 133 | EFI_STATUS\r |
134 | EFIAPI\r | |
135 | ConPlatformTextInDriverBindingStart (\r | |
136 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
137 | IN EFI_HANDLE Handle,\r | |
138 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
139 | );\r | |
140 | \r | |
9359e53f | 141 | /**\r |
c5ed97f6 | 142 | Start this driver on the device for console output and stardard error output.\r |
143 | \r | |
144 | Start this driver on ControllerHandle by opening Simple Text Output Protocol,\r | |
145 | reading Device Path, and installing Console Out Devcic GUID, Standard Error\r | |
9359e53f | 146 | Device GUID on ControllerHandle.\r |
147 | \r | |
148 | If this devcie is not one hot-plug devce, append its device path into the \r | |
149 | console environment variables ConOutDev, StdErrDev.\r | |
150 | \r | |
151 | @param This Protocol instance pointer.\r | |
152 | @param ControllerHandle Handle of device to bind driver to\r | |
153 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
154 | device to start.\r | |
155 | \r | |
156 | @retval EFI_SUCCESS This driver is added to ControllerHandle\r | |
157 | @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r | |
158 | @retval other This driver does not support this device\r | |
159 | \r | |
160 | **/\r | |
95276127 | 161 | EFI_STATUS\r |
162 | EFIAPI\r | |
163 | ConPlatformTextOutDriverBindingStart (\r | |
164 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
165 | IN EFI_HANDLE Handle,\r | |
166 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
167 | );\r | |
168 | \r | |
9359e53f | 169 | /**\r |
24248368 | 170 | Stop this driver on ControllerHandle by removing Console In Devcice GUID \r |
c5ed97f6 | 171 | and closing the Simple Text Input protocol on ControllerHandle.\r |
9359e53f | 172 | \r |
173 | @param This Protocol instance pointer.\r | |
174 | @param ControllerHandle Handle of device to stop driver on\r | |
175 | @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r | |
176 | children is zero stop the entire bus driver.\r | |
177 | @param ChildHandleBuffer List of Child Handles to Stop.\r | |
178 | \r | |
179 | @retval EFI_SUCCESS This driver is removed ControllerHandle\r | |
180 | @retval other This driver was not removed from this device\r | |
181 | \r | |
182 | **/\r | |
95276127 | 183 | EFI_STATUS\r |
184 | EFIAPI\r | |
185 | ConPlatformTextInDriverBindingStop (\r | |
186 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
187 | IN EFI_HANDLE Handle,\r | |
188 | IN UINTN NumberOfChildren,\r | |
189 | IN EFI_HANDLE *ChildHandleBuffer\r | |
190 | );\r | |
191 | \r | |
9359e53f | 192 | /**\r |
24248368 | 193 | Stop this driver on ControllerHandle by removing Console Out Devcice GUID \r |
c5ed97f6 | 194 | and closing the Simple Text Output protocol on ControllerHandle.\r |
9359e53f | 195 | \r |
196 | @param This Protocol instance pointer.\r | |
197 | @param ControllerHandle Handle of device to stop driver on\r | |
198 | @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r | |
199 | children is zero stop the entire bus driver.\r | |
200 | @param ChildHandleBuffer List of Child Handles to Stop.\r | |
201 | \r | |
202 | @retval EFI_SUCCESS This driver is removed ControllerHandle\r | |
203 | @retval other This driver was not removed from this device\r | |
204 | \r | |
205 | **/\r | |
95276127 | 206 | EFI_STATUS\r |
207 | EFIAPI\r | |
208 | ConPlatformTextOutDriverBindingStop (\r | |
209 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
210 | IN EFI_HANDLE Handle,\r | |
211 | IN UINTN NumberOfChildren,\r | |
212 | IN EFI_HANDLE *ChildHandleBuffer\r | |
213 | );\r | |
214 | \r | |
9359e53f | 215 | /**\r |
7b9ff698 | 216 | Uninstall the specified protocol.\r |
9359e53f | 217 | \r |
218 | @param This Protocol instance pointer.\r | |
7b9ff698 | 219 | @param Handle Handle of device to uninstall protocol on.\r |
220 | @param ProtocolGuid The specified protocol need to be uninstalled.\r | |
9359e53f | 221 | \r |
9359e53f | 222 | **/\r |
95276127 | 223 | VOID\r |
224 | ConPlatformUnInstallProtocol (\r | |
225 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
226 | IN EFI_HANDLE Handle,\r | |
227 | IN EFI_GUID *ProtocolGuid\r | |
228 | );\r | |
229 | \r | |
9359e53f | 230 | /**\r |
231 | Read the EFI variable (Name) and return a dynamically allocated\r | |
232 | buffer, and the size of the buffer. On failure return NULL.\r | |
233 | \r | |
9359e53f | 234 | @param Name String part of EFI variable name\r |
235 | \r | |
236 | @return Dynamically allocated memory that contains a copy of the EFI variable.\r | |
7b9ff698 | 237 | Caller is repsoncible freeing the buffer. Return NULL means Variable \r |
238 | was not read.\r | |
9359e53f | 239 | \r |
240 | **/\r | |
95276127 | 241 | VOID *\r |
242 | ConPlatformGetVariable (\r | |
243 | IN CHAR16 *Name\r | |
244 | );\r | |
245 | \r | |
9359e53f | 246 | /**\r |
247 | Function compares a device path data structure to that of all the nodes of a\r | |
248 | second device path instance.\r | |
249 | \r | |
250 | \r | |
251 | @param Multi A pointer to a multi-instance device path data structure.\r | |
252 | @param Single A pointer to a single-instance device path data structure.\r | |
253 | @param NewDevicePath If Delete is TRUE, this parameter must not be null, and it\r | |
254 | points to the remaining device path data structure.\r | |
255 | (remaining device path = Multi - Single.)\r | |
256 | @param Delete If TRUE, means removing Single from Multi.\r | |
257 | If FALSE, the routine just check whether Single matches\r | |
258 | with any instance in Multi.\r | |
259 | \r | |
c5ed97f6 | 260 | @retval EFI_SUCCESS If the Single is contained within Multi.\r |
261 | @retval EFI_NOT_FOUND If the Single is not contained within Multi.\r | |
262 | @retval EFI_INVALID_PARAMETER Multi is NULL.\r | |
263 | @retval EFI_INVALID_PARAMETER Single is NULL.\r | |
264 | @retval EFI_INVALID_PARAMETER NewDevicePath is NULL when Delete is TRUE.\r | |
9359e53f | 265 | \r |
266 | **/\r | |
95276127 | 267 | EFI_STATUS\r |
268 | ConPlatformMatchDevicePaths (\r | |
9359e53f | 269 | IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r |
270 | IN EFI_DEVICE_PATH_PROTOCOL *Single,\r | |
c5ed97f6 | 271 | OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,\r |
95276127 | 272 | IN BOOLEAN Delete\r |
273 | );\r | |
274 | \r | |
9359e53f | 275 | /**\r |
7b9ff698 | 276 | Update console environment variables.\r |
9359e53f | 277 | \r |
278 | @param VariableName Console environment variables, ConOutDev, ConInDev\r | |
279 | StdErrDev, ConIn or ConOut.\r | |
280 | @param DevicePath Console devcie's device path.\r | |
c5ed97f6 | 281 | @param Operation Variable operations, including APPEND, CHECK and DELETE.\r |
9359e53f | 282 | \r |
283 | @retval EFI_SUCCESS Variable operates successfully.\r | |
284 | @retval EFI_OUT_OF_RESOURCES If variable cannot be appended.\r | |
285 | @retval other Variable updating failed.\r | |
286 | \r | |
287 | **/\r | |
95276127 | 288 | EFI_STATUS\r |
289 | ConPlatformUpdateDeviceVariable (\r | |
290 | IN CHAR16 *VariableName,\r | |
291 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
292 | IN CONPLATFORM_VAR_OPERATION Operation\r | |
293 | );\r | |
294 | \r | |
9359e53f | 295 | /**\r |
c5ed97f6 | 296 | Check if the device supports hot-plug.\r |
9359e53f | 297 | \r |
298 | @param DriverBindingHandle Protocol instance pointer.\r | |
299 | @param ControllerHandle Handle of device to check.\r | |
300 | \r | |
301 | @retval TRUE The devcie is a hot-plug device\r | |
302 | @retval FALSE The devcie is not a hot-plug device.\r | |
303 | \r | |
304 | **/\r | |
95276127 | 305 | BOOLEAN\r |
306 | IsHotPlugDevice (\r | |
307 | EFI_HANDLE DriverBindingHandle,\r | |
308 | EFI_HANDLE ControllerHandle\r | |
309 | );\r | |
310 | \r | |
859b72fa A |
311 | //\r |
312 | // EFI Component Name Functions\r | |
313 | //\r | |
5bca971e | 314 | /**\r |
315 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
316 | \r | |
317 | This function retrieves the user readable name of a driver in the form of a\r | |
318 | Unicode string. If the driver specified by This has a user readable name in\r | |
319 | the language specified by Language, then a pointer to the driver name is\r | |
320 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
321 | by This does not support the language specified by Language,\r | |
322 | then EFI_UNSUPPORTED is returned.\r | |
323 | \r | |
324 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
325 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
5bca971e | 326 | @param Language[in] A pointer to a Null-terminated ASCII string\r |
327 | array indicating the language. This is the\r | |
328 | language of the driver name that the caller is\r | |
329 | requesting, and it must match one of the\r | |
330 | languages specified in SupportedLanguages. The\r | |
331 | number of languages supported by a driver is up\r | |
332 | to the driver writer. Language is specified\r | |
333 | in RFC 3066 or ISO 639-2 language code format.\r | |
5bca971e | 334 | @param DriverName[out] A pointer to the Unicode string to return.\r |
335 | This Unicode string is the name of the\r | |
336 | driver specified by This in the language\r | |
337 | specified by Language.\r | |
338 | \r | |
339 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
340 | This and the language specified by Language was\r | |
341 | returned in DriverName.\r | |
5bca971e | 342 | @retval EFI_INVALID_PARAMETER Language is NULL.\r |
5bca971e | 343 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r |
5bca971e | 344 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r |
345 | the language specified by Language.\r | |
346 | \r | |
347 | **/\r | |
859b72fa A |
348 | EFI_STATUS\r |
349 | EFIAPI\r | |
350 | ConPlatformComponentNameGetDriverName (\r | |
351 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
352 | IN CHAR8 *Language,\r | |
353 | OUT CHAR16 **DriverName\r | |
354 | );\r | |
355 | \r | |
5bca971e | 356 | \r |
357 | /**\r | |
358 | Retrieves a Unicode string that is the user readable name of the controller\r | |
359 | that is being managed by a driver.\r | |
360 | \r | |
361 | This function retrieves the user readable name of the controller specified by\r | |
362 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
363 | driver specified by This has a user readable name in the language specified by\r | |
364 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
365 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
366 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
367 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
368 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
369 | \r | |
370 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
371 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
5bca971e | 372 | @param ControllerHandle[in] The handle of a controller that the driver\r |
373 | specified by This is managing. This handle\r | |
374 | specifies the controller whose name is to be\r | |
375 | returned.\r | |
5bca971e | 376 | @param ChildHandle[in] The handle of the child controller to retrieve\r |
377 | the name of. This is an optional parameter that\r | |
378 | may be NULL. It will be NULL for device\r | |
379 | drivers. It will also be NULL for a bus drivers\r | |
380 | that wish to retrieve the name of the bus\r | |
381 | controller. It will not be NULL for a bus\r | |
382 | driver that wishes to retrieve the name of a\r | |
383 | child controller.\r | |
5bca971e | 384 | @param Language[in] A pointer to a Null-terminated ASCII string\r |
385 | array indicating the language. This is the\r | |
386 | language of the driver name that the caller is\r | |
387 | requesting, and it must match one of the\r | |
388 | languages specified in SupportedLanguages. The\r | |
389 | number of languages supported by a driver is up\r | |
390 | to the driver writer. Language is specified in\r | |
391 | RFC 3066 or ISO 639-2 language code format.\r | |
5bca971e | 392 | @param ControllerName[out] A pointer to the Unicode string to return.\r |
393 | This Unicode string is the name of the\r | |
394 | controller specified by ControllerHandle and\r | |
395 | ChildHandle in the language specified by\r | |
396 | Language from the point of view of the driver\r | |
397 | specified by This.\r | |
398 | \r | |
399 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
400 | the language specified by Language for the\r | |
401 | driver specified by This was returned in\r | |
402 | DriverName.\r | |
5bca971e | 403 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r |
5bca971e | 404 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r |
405 | EFI_HANDLE.\r | |
5bca971e | 406 | @retval EFI_INVALID_PARAMETER Language is NULL.\r |
5bca971e | 407 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r |
5bca971e | 408 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r |
409 | managing the controller specified by\r | |
410 | ControllerHandle and ChildHandle.\r | |
5bca971e | 411 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r |
412 | the language specified by Language.\r | |
413 | \r | |
414 | **/\r | |
859b72fa A |
415 | EFI_STATUS\r |
416 | EFIAPI\r | |
417 | ConPlatformComponentNameGetControllerName (\r | |
418 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
419 | IN EFI_HANDLE ControllerHandle,\r | |
420 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
421 | IN CHAR8 *Language,\r | |
422 | OUT CHAR16 **ControllerName\r | |
423 | );\r | |
424 | \r | |
5bca971e | 425 | \r |
95276127 | 426 | #endif\r |