]>
Commit | Line | Data |
---|---|---|
c1f23d63 | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | DebugPort.h\r | |
14 | \r | |
15 | Abstract:\r | |
16 | Definitions and prototypes for DebugPort driver\r | |
17 | \r | |
18 | --*/\r | |
19 | \r | |
20 | #ifndef __DEBUGPORT_H__\r | |
21 | #define __DEBUGPORT_H__\r | |
22 | \r | |
23 | //\r | |
24 | // The package level header files this module uses\r | |
25 | //\r | |
26 | #include <Uefi.h>\r | |
27 | //\r | |
28 | // The protocols, PPI and GUID defintions for this module\r | |
29 | //\r | |
30 | #include <Protocol/DevicePath.h>\r | |
31 | #include <Protocol/ComponentName.h>\r | |
32 | #include <Protocol/DriverBinding.h>\r | |
33 | #include <Protocol/SerialIo.h>\r | |
34 | #include <Protocol/DebugPort.h>\r | |
35 | //\r | |
36 | // The Library classes this module consumes\r | |
37 | //\r | |
38 | #include <Library/DebugLib.h>\r | |
39 | #include <Library/UefiDriverEntryPoint.h>\r | |
40 | #include <Library/UefiLib.h>\r | |
41 | #include <Library/BaseMemoryLib.h>\r | |
42 | #include <Library/MemoryAllocationLib.h>\r | |
43 | #include <Library/UefiBootServicesTableLib.h>\r | |
44 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
45 | #include <Library/DevicePathLib.h>\r | |
46 | \r | |
47 | //\r | |
48 | // Driver Binding Externs\r | |
49 | //\r | |
50 | extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding;\r | |
51 | extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName;\r | |
52 | \r | |
53 | //\r | |
54 | // local type definitions\r | |
55 | //\r | |
56 | #define DEBUGPORT_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('D', 'B', 'G', 'P')\r | |
57 | \r | |
58 | //\r | |
59 | // Device structure used by driver\r | |
60 | //\r | |
61 | typedef struct {\r | |
62 | UINT32 Signature;\r | |
63 | EFI_HANDLE DriverBindingHandle;\r | |
64 | EFI_HANDLE DebugPortDeviceHandle;\r | |
65 | VOID *DebugPortVariable;\r | |
66 | \r | |
67 | EFI_DRIVER_BINDING_PROTOCOL DriverBindingInterface;\r | |
68 | EFI_COMPONENT_NAME_PROTOCOL ComponentNameInterface;\r | |
69 | EFI_DEVICE_PATH_PROTOCOL *DebugPortDevicePath;\r | |
70 | EFI_DEBUGPORT_PROTOCOL DebugPortInterface;\r | |
71 | \r | |
72 | EFI_HANDLE SerialIoDeviceHandle;\r | |
73 | EFI_SERIAL_IO_PROTOCOL *SerialIoBinding;\r | |
74 | UINT64 BaudRate;\r | |
75 | UINT32 ReceiveFifoDepth;\r | |
76 | UINT32 Timeout;\r | |
77 | EFI_PARITY_TYPE Parity;\r | |
78 | UINT8 DataBits;\r | |
79 | EFI_STOP_BITS_TYPE StopBits;\r | |
80 | } DEBUGPORT_DEVICE;\r | |
81 | \r | |
82 | #define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE)\r | |
83 | \r | |
84 | #define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500)\r | |
85 | #define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501)\r | |
86 | \r | |
87 | #define DEBUGPORT_UART_DEFAULT_BAUDRATE 115200\r | |
88 | #define DEBUGPORT_UART_DEFAULT_PARITY 0\r | |
89 | #define DEBUGPORT_UART_DEFAULT_FIFO_DEPTH 16\r | |
90 | #define DEBUGPORT_UART_DEFAULT_TIMEOUT 50000 // 5 ms\r | |
91 | #define DEBUGPORT_UART_DEFAULT_DATA_BITS 8\r | |
92 | #define DEBUGPORT_UART_DEFAULT_STOP_BITS 1\r | |
93 | \r | |
94 | #define DEBUGPORT_DRIVER_VERSION 1\r | |
95 | \r | |
96 | #define EfiIsUartDevicePath(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP)\r | |
97 | \r | |
98 | //\r | |
99 | // globals\r | |
100 | //\r | |
101 | extern DEBUGPORT_DEVICE *gDebugPortDevice;\r | |
102 | \r | |
103 | //\r | |
104 | // Driver binding interface functions...\r | |
105 | //\r | |
106 | EFI_STATUS\r | |
107 | DebugPortEntryPoint (\r | |
108 | IN EFI_HANDLE ImageHandle,\r | |
109 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
110 | )\r | |
111 | ;\r | |
112 | \r | |
113 | EFI_STATUS\r | |
114 | EFIAPI\r | |
115 | DebugPortSupported (\r | |
116 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
117 | IN EFI_HANDLE Controller,\r | |
118 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
119 | )\r | |
120 | ;\r | |
121 | \r | |
122 | EFI_STATUS\r | |
123 | EFIAPI\r | |
124 | DebugPortStart (\r | |
125 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
126 | IN EFI_HANDLE Controller,\r | |
127 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
128 | )\r | |
129 | ;\r | |
130 | \r | |
131 | EFI_STATUS\r | |
132 | EFIAPI\r | |
133 | DebugPortStop (\r | |
134 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
135 | IN EFI_HANDLE Controller,\r | |
136 | IN UINTN NumberOfChildren,\r | |
137 | IN EFI_HANDLE *ChildHandleBuffer\r | |
138 | )\r | |
139 | ;\r | |
140 | \r | |
141 | //\r | |
142 | // EFI Component Name Functions\r | |
143 | //\r | |
144 | EFI_STATUS\r | |
145 | EFIAPI\r | |
146 | DebugPortComponentNameGetDriverName (\r | |
147 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
148 | IN CHAR8 *Language,\r | |
149 | OUT CHAR16 **DriverName\r | |
150 | )\r | |
151 | ;\r | |
152 | \r | |
153 | EFI_STATUS\r | |
154 | EFIAPI\r | |
155 | DebugPortComponentNameGetControllerName (\r | |
156 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
157 | IN EFI_HANDLE ControllerHandle,\r | |
158 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
159 | IN CHAR8 *Language,\r | |
160 | OUT CHAR16 **ControllerName\r | |
161 | )\r | |
162 | ;\r | |
163 | \r | |
164 | //\r | |
165 | // DebugPort member functions\r | |
166 | //\r | |
167 | EFI_STATUS\r | |
168 | EFIAPI\r | |
169 | DebugPortReset (\r | |
170 | IN EFI_DEBUGPORT_PROTOCOL *This\r | |
171 | )\r | |
172 | ;\r | |
173 | \r | |
174 | EFI_STATUS\r | |
175 | EFIAPI\r | |
176 | DebugPortRead (\r | |
177 | IN EFI_DEBUGPORT_PROTOCOL *This,\r | |
178 | IN UINT32 Timeout,\r | |
179 | IN OUT UINTN *BufferSize,\r | |
180 | IN VOID *Buffer\r | |
181 | )\r | |
182 | ;\r | |
183 | \r | |
184 | EFI_STATUS\r | |
185 | EFIAPI\r | |
186 | DebugPortWrite (\r | |
187 | IN EFI_DEBUGPORT_PROTOCOL *This,\r | |
188 | IN UINT32 Timeout,\r | |
189 | IN OUT UINTN *BufferSize,\r | |
190 | OUT VOID *Buffer\r | |
191 | )\r | |
192 | ;\r | |
193 | \r | |
194 | EFI_STATUS\r | |
195 | EFIAPI\r | |
196 | DebugPortPoll (\r | |
197 | IN EFI_DEBUGPORT_PROTOCOL *This\r | |
198 | )\r | |
199 | ;\r | |
200 | \r | |
201 | #endif\r |