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