]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.h
Initial import.
[mirror_edk2.git] / EdkModulePkg / Universal / Debugger / Debugport / Dxe / 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 //
25 // local type definitions
26 //
27 #define DEBUGPORT_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('D', 'B', 'G', 'P')
28
29 //
30 // Device structure used by driver
31 //
32 typedef struct {
33 UINT32 Signature;
34 EFI_HANDLE DriverBindingHandle;
35 EFI_HANDLE DebugPortDeviceHandle;
36 VOID *DebugPortVariable;
37
38 EFI_DRIVER_BINDING_PROTOCOL DriverBindingInterface;
39 EFI_COMPONENT_NAME_PROTOCOL ComponentNameInterface;
40 EFI_DEVICE_PATH_PROTOCOL *DebugPortDevicePath;
41 EFI_DEBUGPORT_PROTOCOL DebugPortInterface;
42
43 EFI_HANDLE SerialIoDeviceHandle;
44 EFI_SERIAL_IO_PROTOCOL *SerialIoBinding;
45 UINT64 BaudRate;
46 UINT32 ReceiveFifoDepth;
47 UINT32 Timeout;
48 EFI_PARITY_TYPE Parity;
49 UINT8 DataBits;
50 EFI_STOP_BITS_TYPE StopBits;
51 } DEBUGPORT_DEVICE;
52
53 #define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE)
54
55 #define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500)
56 #define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501)
57
58 #define DEBUGPORT_UART_DEFAULT_BAUDRATE 115200
59 #define DEBUGPORT_UART_DEFAULT_PARITY 0
60 #define DEBUGPORT_UART_DEFAULT_FIFO_DEPTH 16
61 #define DEBUGPORT_UART_DEFAULT_TIMEOUT 50000 // 5 ms
62 #define DEBUGPORT_UART_DEFAULT_DATA_BITS 8
63 #define DEBUGPORT_UART_DEFAULT_STOP_BITS 1
64
65 #define DEBUGPORT_DRIVER_VERSION 1
66
67 #define EfiIsUartDevicePath(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP)
68
69 //
70 // globals
71 //
72 extern DEBUGPORT_DEVICE *gDebugPortDevice;
73
74 //
75 // Driver binding interface functions...
76 //
77 EFI_STATUS
78 DebugPortEntryPoint (
79 IN EFI_HANDLE ImageHandle,
80 IN EFI_SYSTEM_TABLE *SystemTable
81 )
82 ;
83
84 EFI_STATUS
85 EFIAPI
86 DebugPortSupported (
87 IN EFI_DRIVER_BINDING_PROTOCOL *This,
88 IN EFI_HANDLE Controller,
89 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
90 )
91 ;
92
93 EFI_STATUS
94 EFIAPI
95 DebugPortStart (
96 IN EFI_DRIVER_BINDING_PROTOCOL *This,
97 IN EFI_HANDLE Controller,
98 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
99 )
100 ;
101
102 EFI_STATUS
103 EFIAPI
104 DebugPortStop (
105 IN EFI_DRIVER_BINDING_PROTOCOL *This,
106 IN EFI_HANDLE Controller,
107 IN UINTN NumberOfChildren,
108 IN EFI_HANDLE *ChildHandleBuffer
109 )
110 ;
111
112 //
113 // EFI Component Name Functions
114 //
115 EFI_STATUS
116 EFIAPI
117 DebugPortComponentNameGetDriverName (
118 IN EFI_COMPONENT_NAME_PROTOCOL *This,
119 IN CHAR8 *Language,
120 OUT CHAR16 **DriverName
121 )
122 ;
123
124 EFI_STATUS
125 EFIAPI
126 DebugPortComponentNameGetControllerName (
127 IN EFI_COMPONENT_NAME_PROTOCOL *This,
128 IN EFI_HANDLE ControllerHandle,
129 IN EFI_HANDLE ChildHandle OPTIONAL,
130 IN CHAR8 *Language,
131 OUT CHAR16 **ControllerName
132 )
133 ;
134
135 //
136 // DebugPort member functions
137 //
138 EFI_STATUS
139 EFIAPI
140 DebugPortReset (
141 IN EFI_DEBUGPORT_PROTOCOL *This
142 )
143 ;
144
145 EFI_STATUS
146 EFIAPI
147 DebugPortRead (
148 IN EFI_DEBUGPORT_PROTOCOL *This,
149 IN UINT32 Timeout,
150 IN OUT UINTN *BufferSize,
151 IN VOID *Buffer
152 )
153 ;
154
155 EFI_STATUS
156 EFIAPI
157 DebugPortWrite (
158 IN EFI_DEBUGPORT_PROTOCOL *This,
159 IN UINT32 Timeout,
160 IN OUT UINTN *BufferSize,
161 OUT VOID *Buffer
162 )
163 ;
164
165 EFI_STATUS
166 EFIAPI
167 DebugPortPoll (
168 IN EFI_DEBUGPORT_PROTOCOL *This
169 )
170 ;
171
172 #endif