]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
add functions header for ConPlatformDxe and ConSplitterdxe modules.
[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
859b72fa
A
18#include <Uefi.h>\r
19#include <Protocol/SimpleTextOut.h>\r
20#include <Guid/GlobalVariable.h>\r
21#include <Guid/ConsoleInDevice.h>\r
fb0b259e 22#include <Guid/StandardErrorDevice.h>\r
23#include <Guid/ConsoleOutDevice.h>\r
859b72fa
A
24#include <Protocol/DevicePath.h>\r
25#include <Protocol/SimpleTextIn.h>\r
26#include <Guid/HotPlugDevice.h>\r
fb0b259e 27\r
859b72fa
A
28#include <Library/DebugLib.h>\r
29#include <Library/UefiDriverEntryPoint.h>\r
30#include <Library/UefiLib.h>\r
31#include <Library/BaseMemoryLib.h>\r
32#include <Library/UefiBootServicesTableLib.h>\r
33#include <Library/UefiRuntimeServicesTableLib.h>\r
34#include <Library/DevicePathLib.h>\r
35#include <Library/MemoryAllocationLib.h>\r
36\r
95276127 37//\r
859b72fa 38// Driver Binding Externs\r
95276127 39//\r
5bca971e 40extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;\r
41extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r
42extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;\r
43extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;\r
44extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r
45extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;\r
95276127 46\r
95276127 47\r
48typedef enum {\r
49 CHECK,\r
50 APPEND,\r
51 DELETE\r
52} CONPLATFORM_VAR_OPERATION;\r
53\r
9359e53f 54/**\r
55 Test to see if specific Protocol could be supported on the ControllerHandle. \r
56\r
57 @param This Protocol instance pointer.\r
58 @param ControllerHandle Handle of device to test.\r
59 @param RemainingDevicePath Optional parameter use to pick a specific child\r
60 device to start.\r
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 67EFI_STATUS\r
68ConPlatformDriverBindingSupported (\r
69 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
70 IN EFI_HANDLE ControllerHandle,\r
71 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,\r
72 IN EFI_GUID *ProtocolGuid\r
73 );\r
74\r
9359e53f 75/**\r
76 Test to see if EFI Text In Protocol could be supported on the ControllerHandle. \r
77\r
78 @param This Protocol instance pointer.\r
79 @param ControllerHandle Handle of device to test.\r
80 @param RemainingDevicePath Optional parameter use to pick a specific child\r
81 device to start.\r
82\r
83 @retval EFI_SUCCESS This driver supports this device\r
84 @retval other This driver does not support this device\r
85\r
86**/\r
95276127 87EFI_STATUS\r
88EFIAPI\r
89ConPlatformTextInDriverBindingSupported (\r
90 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
91 IN EFI_HANDLE Handle,\r
92 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
93 );\r
94\r
9359e53f 95/**\r
96 Test to see if EFI Text Out Protocol could be supported on the ControllerHandle. \r
97\r
98 @param This Protocol instance pointer.\r
99 @param ControllerHandle Handle of device to test.\r
100 @param RemainingDevicePath Optional parameter use to pick a specific child\r
101 device to start.\r
102\r
103 @retval EFI_SUCCESS This driver supports this device\r
104 @retval other This driver does not support this device\r
105\r
106**/\r
95276127 107EFI_STATUS\r
108EFIAPI\r
109ConPlatformTextOutDriverBindingSupported (\r
110 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
111 IN EFI_HANDLE Handle,\r
112 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
113 );\r
114\r
9359e53f 115/**\r
116 Start this driver on ControllerHandle by opening Simple Text In 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
129 @retval other This driver does not support this device\r
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
141 Start this driver on ControllerHandle by opening Simple Text Out protocol,\r
24248368 142 reading Device Path, and installing Console Out Devcice GUID, Standard Error\r
9359e53f 143 Device GUID on ControllerHandle.\r
144\r
145 If this devcie is not one hot-plug devce, append its device path into the \r
146 console environment variables ConOutDev, StdErrDev.\r
147 \r
148 @param This Protocol instance pointer.\r
149 @param ControllerHandle Handle of device to bind driver to\r
150 @param RemainingDevicePath Optional parameter use to pick a specific child\r
151 device to start.\r
152\r
153 @retval EFI_SUCCESS This driver is added to ControllerHandle\r
154 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
155 @retval other This driver does not support this device\r
156\r
157**/\r
95276127 158EFI_STATUS\r
159EFIAPI\r
160ConPlatformTextOutDriverBindingStart (\r
161 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
162 IN EFI_HANDLE Handle,\r
163 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
164 );\r
165\r
9359e53f 166/**\r
24248368 167 Stop this driver on ControllerHandle by removing Console In Devcice GUID \r
9359e53f 168 and closing the Simple Text In protocol on ControllerHandle.\r
169\r
170 @param This Protocol instance pointer.\r
171 @param ControllerHandle Handle of device to stop driver on\r
172 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
173 children is zero stop the entire bus driver.\r
174 @param ChildHandleBuffer List of Child Handles to Stop.\r
175\r
176 @retval EFI_SUCCESS This driver is removed ControllerHandle\r
177 @retval other This driver was not removed from this device\r
178\r
179**/\r
95276127 180EFI_STATUS\r
181EFIAPI\r
182ConPlatformTextInDriverBindingStop (\r
183 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
184 IN EFI_HANDLE Handle,\r
185 IN UINTN NumberOfChildren,\r
186 IN EFI_HANDLE *ChildHandleBuffer\r
187 );\r
188\r
9359e53f 189/**\r
24248368 190 Stop this driver on ControllerHandle by removing Console Out Devcice GUID \r
9359e53f 191 and closing the Simple Text Out protocol on ControllerHandle.\r
192\r
193 @param This Protocol instance pointer.\r
194 @param ControllerHandle Handle of device to stop driver on\r
195 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
196 children is zero stop the entire bus driver.\r
197 @param ChildHandleBuffer List of Child Handles to Stop.\r
198\r
199 @retval EFI_SUCCESS This driver is removed ControllerHandle\r
200 @retval other This driver was not removed from this device\r
201\r
202**/\r
95276127 203EFI_STATUS\r
204EFIAPI\r
205ConPlatformTextOutDriverBindingStop (\r
206 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
207 IN EFI_HANDLE Handle,\r
208 IN UINTN NumberOfChildren,\r
209 IN EFI_HANDLE *ChildHandleBuffer\r
210 );\r
211\r
9359e53f 212/**\r
213 Unstall the specific protocol.\r
214\r
215 @param This Protocol instance pointer.\r
216 @param Handle Handle of device to unstall protocol on.\r
217 @param ProtocolGuid The specific protocol need to be uninstalled.\r
218\r
219 @return None.\r
220\r
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
233\r
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
237 Caller is repsoncible freeing the buffer.\r
238 NULL - Variable was not read\r
239\r
240**/\r
95276127 241VOID *\r
242ConPlatformGetVariable (\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
260 @return The function returns EFI_SUCCESS if the Single is contained within Multi.\r
261 Otherwise, EFI_NOT_FOUND is returned.\r
262\r
263**/\r
95276127 264EFI_STATUS\r
265ConPlatformMatchDevicePaths (\r
9359e53f 266 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
267 IN EFI_DEVICE_PATH_PROTOCOL *Single,\r
95276127 268 IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,\r
269 IN BOOLEAN Delete\r
270 );\r
271\r
9359e53f 272/**\r
273 Update console devicein console environment variables. \r
274\r
275 @param VariableName Console environment variables, ConOutDev, ConInDev\r
276 StdErrDev, ConIn or ConOut.\r
277 @param DevicePath Console devcie's device path.\r
278 @param Operation Variable operations, such as APPEND or DELETE.\r
279\r
280 @retval EFI_SUCCESS Variable operates successfully.\r
281 @retval EFI_OUT_OF_RESOURCES If variable cannot be appended.\r
282 @retval other Variable updating failed.\r
283\r
284**/\r
95276127 285EFI_STATUS\r
286ConPlatformUpdateDeviceVariable (\r
287 IN CHAR16 *VariableName,\r
288 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
289 IN CONPLATFORM_VAR_OPERATION Operation\r
290 );\r
291\r
9359e53f 292/**\r
293 Check if the device is one hot-plug supported.\r
294\r
295 @param DriverBindingHandle Protocol instance pointer.\r
296 @param ControllerHandle Handle of device to check.\r
297\r
298 @retval TRUE The devcie is a hot-plug device\r
299 @retval FALSE The devcie is not a hot-plug device.\r
300\r
301**/\r
95276127 302BOOLEAN\r
303IsHotPlugDevice (\r
304 EFI_HANDLE DriverBindingHandle,\r
305 EFI_HANDLE ControllerHandle\r
306 );\r
307\r
859b72fa
A
308//\r
309// EFI Component Name Functions\r
310//\r
5bca971e 311/**\r
312 Retrieves a Unicode string that is the user readable name of the driver.\r
313\r
314 This function retrieves the user readable name of a driver in the form of a\r
315 Unicode string. If the driver specified by This has a user readable name in\r
316 the language specified by Language, then a pointer to the driver name is\r
317 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
318 by This does not support the language specified by Language,\r
319 then EFI_UNSUPPORTED is returned.\r
320\r
321 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
322 EFI_COMPONENT_NAME_PROTOCOL instance.\r
323\r
324 @param Language[in] A pointer to a Null-terminated ASCII string\r
325 array indicating the language. This is the\r
326 language of the driver name that the caller is\r
327 requesting, and it must match one of the\r
328 languages specified in SupportedLanguages. The\r
329 number of languages supported by a driver is up\r
330 to the driver writer. Language is specified\r
331 in RFC 3066 or ISO 639-2 language code format.\r
332\r
333 @param DriverName[out] A pointer to the Unicode string to return.\r
334 This Unicode string is the name of the\r
335 driver specified by This in the language\r
336 specified by Language.\r
337\r
338 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
339 This and the language specified by Language was\r
340 returned in DriverName.\r
341\r
342 @retval EFI_INVALID_PARAMETER Language is NULL.\r
343\r
344 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
345\r
346 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
347 the language specified by Language.\r
348\r
349**/\r
859b72fa
A
350EFI_STATUS\r
351EFIAPI\r
352ConPlatformComponentNameGetDriverName (\r
353 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
354 IN CHAR8 *Language,\r
355 OUT CHAR16 **DriverName\r
356 );\r
357\r
5bca971e 358\r
359/**\r
360 Retrieves a Unicode string that is the user readable name of the controller\r
361 that is being managed by a driver.\r
362\r
363 This function retrieves the user readable name of the controller specified by\r
364 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
365 driver specified by This has a user readable name in the language specified by\r
366 Language, then a pointer to the controller name is returned in ControllerName,\r
367 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
368 managing the controller specified by ControllerHandle and ChildHandle,\r
369 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
370 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
371\r
372 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
373 EFI_COMPONENT_NAME_PROTOCOL instance.\r
374\r
375 @param ControllerHandle[in] The handle of a controller that the driver\r
376 specified by This is managing. This handle\r
377 specifies the controller whose name is to be\r
378 returned.\r
379\r
380 @param ChildHandle[in] The handle of the child controller to retrieve\r
381 the name of. This is an optional parameter that\r
382 may be NULL. It will be NULL for device\r
383 drivers. It will also be NULL for a bus drivers\r
384 that wish to retrieve the name of the bus\r
385 controller. It will not be NULL for a bus\r
386 driver that wishes to retrieve the name of a\r
387 child controller.\r
388\r
389 @param Language[in] A pointer to a Null-terminated ASCII string\r
390 array indicating the language. This is the\r
391 language of the driver name that the caller is\r
392 requesting, and it must match one of the\r
393 languages specified in SupportedLanguages. The\r
394 number of languages supported by a driver is up\r
395 to the driver writer. Language is specified in\r
396 RFC 3066 or ISO 639-2 language code format.\r
397\r
398 @param ControllerName[out] A pointer to the Unicode string to return.\r
399 This Unicode string is the name of the\r
400 controller specified by ControllerHandle and\r
401 ChildHandle in the language specified by\r
402 Language from the point of view of the driver\r
403 specified by This.\r
404\r
405 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
406 the language specified by Language for the\r
407 driver specified by This was returned in\r
408 DriverName.\r
409\r
410 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
411\r
412 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
413 EFI_HANDLE.\r
414\r
415 @retval EFI_INVALID_PARAMETER Language is NULL.\r
416\r
417 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
418\r
419 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
420 managing the controller specified by\r
421 ControllerHandle and ChildHandle.\r
422\r
423 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
424 the language specified by Language.\r
425\r
426**/\r
859b72fa
A
427EFI_STATUS\r
428EFIAPI\r
429ConPlatformComponentNameGetControllerName (\r
430 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
431 IN EFI_HANDLE ControllerHandle,\r
432 IN EFI_HANDLE ChildHandle OPTIONAL,\r
433 IN CHAR8 *Language,\r
434 OUT CHAR16 **ControllerName\r
435 );\r
436\r
5bca971e 437\r
95276127 438#endif\r