]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConPlatformDxe / ConPlatform.h
... / ...
CommitLineData
1/** @file\r
2 Header file for Console Platfrom DXE Driver.\r
3\r
4Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
5This 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
9\r
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
12\r
13**/\r
14\r
15#ifndef _CON_PLATFORM_H_\r
16#define _CON_PLATFORM_H_\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Protocol/SimpleTextOut.h>\r
21#include <Protocol/DevicePath.h>\r
22#include <Protocol/SimpleTextIn.h>\r
23\r
24#include <Guid/GlobalVariable.h>\r
25#include <Guid/ConsoleInDevice.h>\r
26#include <Guid/StandardErrorDevice.h>\r
27#include <Guid/ConsoleOutDevice.h>\r
28\r
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
38//\r
39// Driver Binding Externs\r
40//\r
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
47\r
48\r
49typedef enum {\r
50 Check,\r
51 Append,\r
52 Delete\r
53} CONPLATFORM_VAR_OPERATION;\r
54\r
55/**\r
56 Test to see if specific protocol could be supported on the ControllerHandle. \r
57\r
58 @param This Protocol instance pointer.\r
59 @param ControllerHandle Handle of device to test.\r
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
66EFI_STATUS\r
67ConPlatformDriverBindingSupported (\r
68 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
69 IN EFI_HANDLE ControllerHandle,\r
70 IN EFI_GUID *ProtocolGuid\r
71 );\r
72\r
73/**\r
74 Test to see if EFI_SIMPLE_TEXT_INPUT_PROTOCOL is supported on ControllerHandle. \r
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
81 @retval EFI_SUCCESS This driver supports this device.\r
82 @retval other This driver does not support this device.\r
83\r
84**/\r
85EFI_STATUS\r
86EFIAPI\r
87ConPlatformTextInDriverBindingSupported (\r
88 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
89 IN EFI_HANDLE Handle,\r
90 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
91 );\r
92\r
93/**\r
94 Test to see if EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is supported on ControllerHandle. \r
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
101 @retval EFI_SUCCESS This driver supports this device.\r
102 @retval other This driver does not support this device.\r
103\r
104**/\r
105EFI_STATUS\r
106EFIAPI\r
107ConPlatformTextOutDriverBindingSupported (\r
108 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
109 IN EFI_HANDLE Handle,\r
110 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
111 );\r
112\r
113/**\r
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
117 reading Device Path, and installing Console In Devcice GUID on ControllerHandle.\r
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
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
140/**\r
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
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
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
168/**\r
169 Stop this driver on ControllerHandle by removing Console In Devcice GUID \r
170 and closing the Simple Text Input 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
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
191/**\r
192 Stop this driver on ControllerHandle by removing Console Out Devcice GUID \r
193 and closing the Simple Text Output 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
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
214/**\r
215 Uninstall the specified protocol.\r
216\r
217 @param This Protocol instance pointer.\r
218 @param Handle Handle of device to uninstall protocol on.\r
219 @param ProtocolGuid The specified protocol need to be uninstalled.\r
220\r
221**/\r
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
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 @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
236 Caller is repsoncible freeing the buffer. Return NULL means Variable \r
237 was not read.\r
238\r
239**/\r
240VOID *\r
241ConPlatformGetVariable (\r
242 IN CHAR16 *Name\r
243 );\r
244\r
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
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
264\r
265**/\r
266EFI_STATUS\r
267ConPlatformMatchDevicePaths (\r
268 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
269 IN EFI_DEVICE_PATH_PROTOCOL *Single,\r
270 OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,\r
271 IN BOOLEAN Delete\r
272 );\r
273\r
274/**\r
275 Update console environment variables.\r
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
280 @param Operation Variable operations, including APPEND, CHECK and DELETE.\r
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
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
294/**\r
295 Check if the device supports hot-plug through its device path.\r
296\r
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
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
306BOOLEAN\r
307IsHotPlugDevice (\r
308 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
309 );\r
310\r
311//\r
312// EFI Component Name Functions\r
313//\r
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
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 4646 or ISO 639-2 language code format.\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 @retval EFI_INVALID_PARAMETER Language is NULL.\r
343 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
344 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
345 the language specified by Language.\r
346\r
347**/\r
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
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
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
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
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 4646 or ISO 639-2 language code format.\r
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
403 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
404 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
405 EFI_HANDLE.\r
406 @retval EFI_INVALID_PARAMETER Language is NULL.\r
407 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
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
411 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
412 the language specified by Language.\r
413\r
414**/\r
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
425\r
426#endif\r