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