]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
Replace references to RFC 3066 with RFC 4646.
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConPlatformDxe / ConPlatform.h
CommitLineData
fb0b259e 1/** @file\r
2 Header file for Console Platfrom DXE Driver.\r
95276127 3\r
9359e53f 4Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
fb0b259e 5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
95276127 9\r
fb0b259e 10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT 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
fb0b259e 28\r
859b72fa
A
29#include <Library/DebugLib.h>\r
30#include <Library/UefiDriverEntryPoint.h>\r
31#include <Library/UefiLib.h>\r
32#include <Library/BaseMemoryLib.h>\r
33#include <Library/UefiBootServicesTableLib.h>\r
34#include <Library/UefiRuntimeServicesTableLib.h>\r
35#include <Library/DevicePathLib.h>\r
36#include <Library/MemoryAllocationLib.h>\r
37\r
95276127 38//\r
859b72fa 39// Driver Binding Externs\r
95276127 40//\r
5bca971e 41extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;\r
42extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r
43extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;\r
44extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;\r
45extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r
46extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;\r
95276127 47\r
95276127 48\r
49typedef enum {\r
50 CHECK,\r
51 APPEND,\r
52 DELETE\r
53} CONPLATFORM_VAR_OPERATION;\r
54\r
9359e53f 55/**\r
c5ed97f6 56 Test to see if specific protocol could be supported on the ControllerHandle. \r
9359e53f 57\r
58 @param This Protocol instance pointer.\r
59 @param ControllerHandle Handle of device to test.\r
9359e53f 60 @param ProtocolGuid The specfic protocol.\r
61\r
62 @retval EFI_SUCCESS This driver supports this device\r
63 @retval other This driver does not support this device\r
64\r
65**/\r
95276127 66EFI_STATUS\r
67ConPlatformDriverBindingSupported (\r
68 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
69 IN EFI_HANDLE ControllerHandle,\r
95276127 70 IN EFI_GUID *ProtocolGuid\r
71 );\r
72\r
9359e53f 73/**\r
c5ed97f6 74 Test to see if EFI_SIMPLE_TEXT_INPUT_PROTOCOL is supported on ControllerHandle. \r
9359e53f 75\r
76 @param This Protocol instance pointer.\r
77 @param ControllerHandle Handle of device to test.\r
78 @param RemainingDevicePath Optional parameter use to pick a specific child\r
79 device to start.\r
80\r
c5ed97f6 81 @retval EFI_SUCCESS This driver supports this device.\r
82 @retval other This driver does not support this device.\r
9359e53f 83\r
84**/\r
95276127 85EFI_STATUS\r
86EFIAPI\r
87ConPlatformTextInDriverBindingSupported (\r
88 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
89 IN EFI_HANDLE Handle,\r
c5ed97f6 90 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
95276127 91 );\r
92\r
9359e53f 93/**\r
c5ed97f6 94 Test to see if EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is supported on ControllerHandle. \r
9359e53f 95\r
96 @param This Protocol instance pointer.\r
97 @param ControllerHandle Handle of device to test.\r
98 @param RemainingDevicePath Optional parameter use to pick a specific child\r
99 device to start.\r
100\r
c5ed97f6 101 @retval EFI_SUCCESS This driver supports this device.\r
102 @retval other This driver does not support this device.\r
9359e53f 103\r
104**/\r
95276127 105EFI_STATUS\r
106EFIAPI\r
107ConPlatformTextOutDriverBindingSupported (\r
108 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
109 IN EFI_HANDLE Handle,\r
c5ed97f6 110 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
95276127 111 );\r
112\r
9359e53f 113/**\r
c5ed97f6 114 Start this driver on the device for console input.\r
115\r
116 Start this driver on ControllerHandle by opening Simple Text Input Protocol,\r
24248368 117 reading Device Path, and installing Console In Devcice GUID on ControllerHandle.\r
9359e53f 118\r
119 If this devcie is not one hot-plug devce, append its device path into the \r
120 console environment variables ConInDev.\r
121 \r
122 @param This Protocol instance pointer.\r
123 @param ControllerHandle Handle of device to bind driver to\r
124 @param RemainingDevicePath Optional parameter use to pick a specific child\r
125 device to start.\r
126\r
127 @retval EFI_SUCCESS This driver is added to ControllerHandle\r
128 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
c5ed97f6 129 @retval other This driver does not support this device.\r
9359e53f 130\r
131**/\r
95276127 132EFI_STATUS\r
133EFIAPI\r
134ConPlatformTextInDriverBindingStart (\r
135 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
136 IN EFI_HANDLE Handle,\r
137 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
138 );\r
139\r
9359e53f 140/**\r
c5ed97f6 141 Start this driver on the device for console output and stardard error output.\r
142\r
143 Start this driver on ControllerHandle by opening Simple Text Output Protocol,\r
144 reading Device Path, and installing Console Out Devcic 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 160EFI_STATUS\r
161EFIAPI\r
162ConPlatformTextOutDriverBindingStart (\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
c5ed97f6 170 and closing the Simple Text Input protocol on ControllerHandle.\r
9359e53f 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 182EFI_STATUS\r
183EFIAPI\r
184ConPlatformTextInDriverBindingStop (\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
c5ed97f6 193 and closing the Simple Text Output protocol on ControllerHandle.\r
9359e53f 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 205EFI_STATUS\r
206EFIAPI\r
207ConPlatformTextOutDriverBindingStop (\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
9359e53f 221**/\r
95276127 222VOID\r
223ConPlatformUnInstallProtocol (\r
224 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
225 IN EFI_HANDLE Handle,\r
226 IN EFI_GUID *ProtocolGuid\r
227 );\r
228\r
9359e53f 229/**\r
230 Read the EFI variable (Name) and return a dynamically allocated\r
231 buffer, and the size of the buffer. On failure return NULL.\r
232\r
9359e53f 233 @param Name String part of EFI variable name\r
234\r
235 @return Dynamically allocated memory that contains a copy of the EFI variable.\r
7b9ff698 236 Caller is repsoncible freeing the buffer. Return NULL means Variable \r
237 was not read.\r
9359e53f 238\r
239**/\r
95276127 240VOID *\r
241ConPlatformGetVariable (\r
242 IN CHAR16 *Name\r
243 );\r
244\r
9359e53f 245/**\r
246 Function compares a device path data structure to that of all the nodes of a\r
247 second device path instance.\r
248\r
249\r
250 @param Multi A pointer to a multi-instance device path data structure.\r
251 @param Single A pointer to a single-instance device path data structure.\r
252 @param NewDevicePath If Delete is TRUE, this parameter must not be null, and it\r
253 points to the remaining device path data structure.\r
254 (remaining device path = Multi - Single.)\r
255 @param Delete If TRUE, means removing Single from Multi.\r
256 If FALSE, the routine just check whether Single matches\r
257 with any instance in Multi.\r
258\r
c5ed97f6 259 @retval EFI_SUCCESS If the Single is contained within Multi.\r
260 @retval EFI_NOT_FOUND If the Single is not contained within Multi.\r
261 @retval EFI_INVALID_PARAMETER Multi is NULL.\r
262 @retval EFI_INVALID_PARAMETER Single is NULL.\r
263 @retval EFI_INVALID_PARAMETER NewDevicePath is NULL when Delete is TRUE.\r
9359e53f 264\r
265**/\r
95276127 266EFI_STATUS\r
267ConPlatformMatchDevicePaths (\r
9359e53f 268 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
269 IN EFI_DEVICE_PATH_PROTOCOL *Single,\r
c5ed97f6 270 OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,\r
95276127 271 IN BOOLEAN Delete\r
272 );\r
273\r
9359e53f 274/**\r
7b9ff698 275 Update console environment variables.\r
9359e53f 276\r
277 @param VariableName Console environment variables, ConOutDev, ConInDev\r
278 StdErrDev, ConIn or ConOut.\r
279 @param DevicePath Console devcie's device path.\r
c5ed97f6 280 @param Operation Variable operations, including APPEND, CHECK and DELETE.\r
9359e53f 281\r
282 @retval EFI_SUCCESS Variable operates successfully.\r
283 @retval EFI_OUT_OF_RESOURCES If variable cannot be appended.\r
284 @retval other Variable updating failed.\r
285\r
286**/\r
95276127 287EFI_STATUS\r
288ConPlatformUpdateDeviceVariable (\r
289 IN CHAR16 *VariableName,\r
290 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
291 IN CONPLATFORM_VAR_OPERATION Operation\r
292 );\r
293\r
9359e53f 294/**\r
f1aec6cc 295 Check if the device supports hot-plug through its device path.\r
9359e53f 296\r
f1aec6cc 297 This function could be updated to check more types of Hot Plug devices.\r
298 Currently, it checks USB and PCCard device.\r
299\r
300 @param DevicePath Pointer to device's device path.\r
9359e53f 301\r
302 @retval TRUE The devcie is a hot-plug device\r
303 @retval FALSE The devcie is not a hot-plug device.\r
304\r
305**/\r
95276127 306BOOLEAN\r
307IsHotPlugDevice (\r
f1aec6cc 308 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
95276127 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
0254efc0 333 in RFC 4646 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
348EFI_STATUS\r
349EFIAPI\r
350ConPlatformComponentNameGetDriverName (\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
0254efc0 391 RFC 4646 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
415EFI_STATUS\r
416EFIAPI\r
417ConPlatformComponentNameGetControllerName (\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