]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DebugPortDxe/DebugPort.h
Update prototype of DxeLoadCore().
[mirror_edk2.git] / MdeModulePkg / Universal / DebugPortDxe / DebugPort.h
CommitLineData
fb0b259e 1/** @file\r
2 Definitions and prototypes for DebugPort driver.\r
c1f23d63 3\r
fb0b259e 4Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
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
c1f23d63 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
c1f23d63 12\r
fb0b259e 13**/\r
c1f23d63 14\r
15#ifndef __DEBUGPORT_H__\r
16#define __DEBUGPORT_H__\r
17\r
ed7748fe 18\r
c1f23d63 19#include <Uefi.h>\r
ed7748fe 20\r
c1f23d63 21#include <Protocol/DevicePath.h>\r
22#include <Protocol/ComponentName.h>\r
23#include <Protocol/DriverBinding.h>\r
24#include <Protocol/SerialIo.h>\r
25#include <Protocol/DebugPort.h>\r
ed7748fe 26\r
c1f23d63 27#include <Library/DebugLib.h>\r
28#include <Library/UefiDriverEntryPoint.h>\r
29#include <Library/UefiLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31#include <Library/MemoryAllocationLib.h>\r
32#include <Library/UefiBootServicesTableLib.h>\r
33#include <Library/UefiRuntimeServicesTableLib.h>\r
34#include <Library/DevicePathLib.h>\r
35\r
36//\r
37// Driver Binding Externs\r
38//\r
19f97f7e 39extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding;\r
40extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName;\r
41extern EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2;\r
c1f23d63 42\r
43//\r
44// local type definitions\r
45//\r
46#define DEBUGPORT_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('D', 'B', 'G', 'P')\r
47\r
48//\r
49// Device structure used by driver\r
50//\r
51typedef struct {\r
52 UINT32 Signature;\r
53 EFI_HANDLE DriverBindingHandle;\r
54 EFI_HANDLE DebugPortDeviceHandle;\r
55 VOID *DebugPortVariable;\r
56\r
57 EFI_DRIVER_BINDING_PROTOCOL DriverBindingInterface;\r
58 EFI_COMPONENT_NAME_PROTOCOL ComponentNameInterface;\r
59 EFI_DEVICE_PATH_PROTOCOL *DebugPortDevicePath;\r
60 EFI_DEBUGPORT_PROTOCOL DebugPortInterface;\r
61\r
62 EFI_HANDLE SerialIoDeviceHandle;\r
63 EFI_SERIAL_IO_PROTOCOL *SerialIoBinding;\r
64 UINT64 BaudRate;\r
65 UINT32 ReceiveFifoDepth;\r
66 UINT32 Timeout;\r
67 EFI_PARITY_TYPE Parity;\r
68 UINT8 DataBits;\r
69 EFI_STOP_BITS_TYPE StopBits;\r
70} DEBUGPORT_DEVICE;\r
71\r
72#define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE)\r
73\r
74#define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500)\r
75#define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501)\r
76\r
77#define DEBUGPORT_UART_DEFAULT_BAUDRATE 115200\r
78#define DEBUGPORT_UART_DEFAULT_PARITY 0\r
79#define DEBUGPORT_UART_DEFAULT_FIFO_DEPTH 16\r
80#define DEBUGPORT_UART_DEFAULT_TIMEOUT 50000 // 5 ms\r
81#define DEBUGPORT_UART_DEFAULT_DATA_BITS 8\r
82#define DEBUGPORT_UART_DEFAULT_STOP_BITS 1\r
83\r
84#define DEBUGPORT_DRIVER_VERSION 1\r
85\r
86#define EfiIsUartDevicePath(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP)\r
87\r
88//\r
89// globals\r
90//\r
19f97f7e 91extern DEBUGPORT_DEVICE *gDebugPortDevice;\r
c1f23d63 92\r
93//\r
94// Driver binding interface functions...\r
95//\r
96EFI_STATUS\r
97DebugPortEntryPoint (\r
98 IN EFI_HANDLE ImageHandle,\r
99 IN EFI_SYSTEM_TABLE *SystemTable\r
100 )\r
101;\r
102\r
103EFI_STATUS\r
104EFIAPI\r
105DebugPortSupported (\r
106 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
107 IN EFI_HANDLE Controller,\r
108 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
109 )\r
110;\r
111\r
112EFI_STATUS\r
113EFIAPI\r
114DebugPortStart (\r
115 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
116 IN EFI_HANDLE Controller,\r
117 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
118 )\r
119;\r
120\r
121EFI_STATUS\r
122EFIAPI\r
123DebugPortStop (\r
124 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
125 IN EFI_HANDLE Controller,\r
126 IN UINTN NumberOfChildren,\r
127 IN EFI_HANDLE *ChildHandleBuffer\r
128 )\r
129;\r
130\r
131//\r
132// EFI Component Name Functions\r
133//\r
19f97f7e 134/**\r
135 Retrieves a Unicode string that is the user readable name of the driver.\r
136\r
137 This function retrieves the user readable name of a driver in the form of a\r
138 Unicode string. If the driver specified by This has a user readable name in\r
139 the language specified by Language, then a pointer to the driver name is\r
140 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
141 by This does not support the language specified by Language,\r
142 then EFI_UNSUPPORTED is returned.\r
143\r
144 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
145 EFI_COMPONENT_NAME_PROTOCOL instance.\r
146\r
147 @param Language[in] A pointer to a Null-terminated ASCII string\r
148 array indicating the language. This is the\r
149 language of the driver name that the caller is\r
150 requesting, and it must match one of the\r
151 languages specified in SupportedLanguages. The\r
152 number of languages supported by a driver is up\r
153 to the driver writer. Language is specified\r
154 in RFC 3066 or ISO 639-2 language code format.\r
155\r
156 @param DriverName[out] A pointer to the Unicode string to return.\r
157 This Unicode string is the name of the\r
158 driver specified by This in the language\r
159 specified by Language.\r
160\r
161 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
162 This and the language specified by Language was\r
163 returned in DriverName.\r
164\r
165 @retval EFI_INVALID_PARAMETER Language is NULL.\r
166\r
167 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
168\r
169 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
170 the language specified by Language.\r
171\r
172**/\r
c1f23d63 173EFI_STATUS\r
174EFIAPI\r
175DebugPortComponentNameGetDriverName (\r
19f97f7e 176 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
177 IN CHAR8 *Language,\r
178 OUT CHAR16 **DriverName\r
179 );\r
180\r
181\r
182/**\r
183 Retrieves a Unicode string that is the user readable name of the controller\r
184 that is being managed by a driver.\r
185\r
186 This function retrieves the user readable name of the controller specified by\r
187 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
188 driver specified by This has a user readable name in the language specified by\r
189 Language, then a pointer to the controller name is returned in ControllerName,\r
190 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
191 managing the controller specified by ControllerHandle and ChildHandle,\r
192 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
193 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
194\r
195 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
196 EFI_COMPONENT_NAME_PROTOCOL instance.\r
c1f23d63 197\r
19f97f7e 198 @param ControllerHandle[in] The handle of a controller that the driver\r
199 specified by This is managing. This handle\r
200 specifies the controller whose name is to be\r
201 returned.\r
202\r
203 @param ChildHandle[in] The handle of the child controller to retrieve\r
204 the name of. This is an optional parameter that\r
205 may be NULL. It will be NULL for device\r
206 drivers. It will also be NULL for a bus drivers\r
207 that wish to retrieve the name of the bus\r
208 controller. It will not be NULL for a bus\r
209 driver that wishes to retrieve the name of a\r
210 child controller.\r
211\r
212 @param Language[in] A pointer to a Null-terminated ASCII string\r
213 array indicating the language. This is the\r
214 language of the driver name that the caller is\r
215 requesting, and it must match one of the\r
216 languages specified in SupportedLanguages. The\r
217 number of languages supported by a driver is up\r
218 to the driver writer. Language is specified in\r
219 RFC 3066 or ISO 639-2 language code format.\r
220\r
221 @param ControllerName[out] A pointer to the Unicode string to return.\r
222 This Unicode string is the name of the\r
223 controller specified by ControllerHandle and\r
224 ChildHandle in the language specified by\r
225 Language from the point of view of the driver\r
226 specified by This.\r
227\r
228 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
229 the language specified by Language for the\r
230 driver specified by This was returned in\r
231 DriverName.\r
232\r
233 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
234\r
235 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
236 EFI_HANDLE.\r
237\r
238 @retval EFI_INVALID_PARAMETER Language is NULL.\r
239\r
240 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
241\r
242 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
243 managing the controller specified by\r
244 ControllerHandle and ChildHandle.\r
245\r
246 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
247 the language specified by Language.\r
248\r
249**/\r
c1f23d63 250EFI_STATUS\r
251EFIAPI\r
252DebugPortComponentNameGetControllerName (\r
19f97f7e 253 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
254 IN EFI_HANDLE ControllerHandle,\r
255 IN EFI_HANDLE ChildHandle OPTIONAL,\r
256 IN CHAR8 *Language,\r
257 OUT CHAR16 **ControllerName\r
258 );\r
259\r
c1f23d63 260\r
261//\r
262// DebugPort member functions\r
263//\r
264EFI_STATUS\r
265EFIAPI\r
266DebugPortReset (\r
267 IN EFI_DEBUGPORT_PROTOCOL *This\r
268 )\r
269;\r
270\r
271EFI_STATUS\r
272EFIAPI\r
273DebugPortRead (\r
274 IN EFI_DEBUGPORT_PROTOCOL *This,\r
275 IN UINT32 Timeout,\r
276 IN OUT UINTN *BufferSize,\r
277 IN VOID *Buffer\r
278 )\r
279;\r
280\r
281EFI_STATUS\r
282EFIAPI\r
283DebugPortWrite (\r
284 IN EFI_DEBUGPORT_PROTOCOL *This,\r
285 IN UINT32 Timeout,\r
286 IN OUT UINTN *BufferSize,\r
287 OUT VOID *Buffer\r
288 )\r
289;\r
290\r
291EFI_STATUS\r
292EFIAPI\r
293DebugPortPoll (\r
294 IN EFI_DEBUGPORT_PROTOCOL *This\r
295 )\r
296;\r
297\r
298#endif\r