]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DebugPortDxe/DebugPort.h
clean up the un-suitable ';' location when declaring the functions.
[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
ed66e1bc 100 );\r
c1f23d63 101\r
102EFI_STATUS\r
103EFIAPI\r
104DebugPortSupported (\r
105 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
106 IN EFI_HANDLE Controller,\r
107 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
ed66e1bc 108 );\r
c1f23d63 109\r
110EFI_STATUS\r
111EFIAPI\r
112DebugPortStart (\r
113 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
114 IN EFI_HANDLE Controller,\r
115 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
ed66e1bc 116 );\r
c1f23d63 117\r
118EFI_STATUS\r
119EFIAPI\r
120DebugPortStop (\r
121 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
122 IN EFI_HANDLE Controller,\r
123 IN UINTN NumberOfChildren,\r
124 IN EFI_HANDLE *ChildHandleBuffer\r
ed66e1bc 125 );\r
c1f23d63 126\r
127//\r
128// EFI Component Name Functions\r
129//\r
19f97f7e 130/**\r
131 Retrieves a Unicode string that is the user readable name of the driver.\r
132\r
133 This function retrieves the user readable name of a driver in the form of a\r
134 Unicode string. If the driver specified by This has a user readable name in\r
135 the language specified by Language, then a pointer to the driver name is\r
136 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
137 by This does not support the language specified by Language,\r
138 then EFI_UNSUPPORTED is returned.\r
139\r
140 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
141 EFI_COMPONENT_NAME_PROTOCOL instance.\r
142\r
143 @param Language[in] A pointer to a Null-terminated ASCII string\r
144 array indicating the language. This is the\r
145 language of the driver name that the caller is\r
146 requesting, and it must match one of the\r
147 languages specified in SupportedLanguages. The\r
148 number of languages supported by a driver is up\r
149 to the driver writer. Language is specified\r
150 in RFC 3066 or ISO 639-2 language code format.\r
151\r
152 @param DriverName[out] A pointer to the Unicode string to return.\r
153 This Unicode string is the name of the\r
154 driver specified by This in the language\r
155 specified by Language.\r
156\r
157 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
158 This and the language specified by Language was\r
159 returned in DriverName.\r
160\r
161 @retval EFI_INVALID_PARAMETER Language is NULL.\r
162\r
163 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
164\r
165 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
166 the language specified by Language.\r
167\r
168**/\r
c1f23d63 169EFI_STATUS\r
170EFIAPI\r
171DebugPortComponentNameGetDriverName (\r
19f97f7e 172 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
173 IN CHAR8 *Language,\r
174 OUT CHAR16 **DriverName\r
175 );\r
176\r
177\r
178/**\r
179 Retrieves a Unicode string that is the user readable name of the controller\r
180 that is being managed by a driver.\r
181\r
182 This function retrieves the user readable name of the controller specified by\r
183 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
184 driver specified by This has a user readable name in the language specified by\r
185 Language, then a pointer to the controller name is returned in ControllerName,\r
186 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
187 managing the controller specified by ControllerHandle and ChildHandle,\r
188 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
189 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
190\r
191 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
192 EFI_COMPONENT_NAME_PROTOCOL instance.\r
c1f23d63 193\r
19f97f7e 194 @param ControllerHandle[in] The handle of a controller that the driver\r
195 specified by This is managing. This handle\r
196 specifies the controller whose name is to be\r
197 returned.\r
198\r
199 @param ChildHandle[in] The handle of the child controller to retrieve\r
200 the name of. This is an optional parameter that\r
201 may be NULL. It will be NULL for device\r
202 drivers. It will also be NULL for a bus drivers\r
203 that wish to retrieve the name of the bus\r
204 controller. It will not be NULL for a bus\r
205 driver that wishes to retrieve the name of a\r
206 child controller.\r
207\r
208 @param Language[in] A pointer to a Null-terminated ASCII string\r
209 array indicating the language. This is the\r
210 language of the driver name that the caller is\r
211 requesting, and it must match one of the\r
212 languages specified in SupportedLanguages. The\r
213 number of languages supported by a driver is up\r
214 to the driver writer. Language is specified in\r
215 RFC 3066 or ISO 639-2 language code format.\r
216\r
217 @param ControllerName[out] A pointer to the Unicode string to return.\r
218 This Unicode string is the name of the\r
219 controller specified by ControllerHandle and\r
220 ChildHandle in the language specified by\r
221 Language from the point of view of the driver\r
222 specified by This.\r
223\r
224 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
225 the language specified by Language for the\r
226 driver specified by This was returned in\r
227 DriverName.\r
228\r
229 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
230\r
231 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
232 EFI_HANDLE.\r
233\r
234 @retval EFI_INVALID_PARAMETER Language is NULL.\r
235\r
236 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
237\r
238 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
239 managing the controller specified by\r
240 ControllerHandle and ChildHandle.\r
241\r
242 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
243 the language specified by Language.\r
244\r
245**/\r
c1f23d63 246EFI_STATUS\r
247EFIAPI\r
248DebugPortComponentNameGetControllerName (\r
19f97f7e 249 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
250 IN EFI_HANDLE ControllerHandle,\r
251 IN EFI_HANDLE ChildHandle OPTIONAL,\r
252 IN CHAR8 *Language,\r
253 OUT CHAR16 **ControllerName\r
254 );\r
255\r
c1f23d63 256\r
257//\r
258// DebugPort member functions\r
259//\r
260EFI_STATUS\r
261EFIAPI\r
262DebugPortReset (\r
263 IN EFI_DEBUGPORT_PROTOCOL *This\r
ed66e1bc 264 );\r
c1f23d63 265\r
266EFI_STATUS\r
267EFIAPI\r
268DebugPortRead (\r
269 IN EFI_DEBUGPORT_PROTOCOL *This,\r
270 IN UINT32 Timeout,\r
271 IN OUT UINTN *BufferSize,\r
272 IN VOID *Buffer\r
ed66e1bc 273 );\r
c1f23d63 274\r
275EFI_STATUS\r
276EFIAPI\r
277DebugPortWrite (\r
278 IN EFI_DEBUGPORT_PROTOCOL *This,\r
279 IN UINT32 Timeout,\r
280 IN OUT UINTN *BufferSize,\r
281 OUT VOID *Buffer\r
ed66e1bc 282 );\r
c1f23d63 283\r
284EFI_STATUS\r
285EFIAPI\r
286DebugPortPoll (\r
287 IN EFI_DEBUGPORT_PROTOCOL *This\r
ed66e1bc 288 );\r
c1f23d63 289\r
290#endif\r