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
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.
16 Definitions and prototypes for DebugPort driver
20 #ifndef __DEBUGPORT_H__
21 #define __DEBUGPORT_H__
24 // The package level header files this module uses
28 // The protocols, PPI and GUID defintions for this module
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>
36 // The Library classes this module consumes
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>
48 // Driver Binding Externs
50 extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding
;
51 extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName
;
54 // local type definitions
56 #define DEBUGPORT_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('D', 'B', 'G', 'P')
59 // Device structure used by driver
63 EFI_HANDLE DriverBindingHandle
;
64 EFI_HANDLE DebugPortDeviceHandle
;
65 VOID
*DebugPortVariable
;
67 EFI_DRIVER_BINDING_PROTOCOL DriverBindingInterface
;
68 EFI_COMPONENT_NAME_PROTOCOL ComponentNameInterface
;
69 EFI_DEVICE_PATH_PROTOCOL
*DebugPortDevicePath
;
70 EFI_DEBUGPORT_PROTOCOL DebugPortInterface
;
72 EFI_HANDLE SerialIoDeviceHandle
;
73 EFI_SERIAL_IO_PROTOCOL
*SerialIoBinding
;
75 UINT32 ReceiveFifoDepth
;
77 EFI_PARITY_TYPE Parity
;
79 EFI_STOP_BITS_TYPE StopBits
;
82 #define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE)
84 #define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500)
85 #define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501)
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
94 #define DEBUGPORT_DRIVER_VERSION 1
96 #define EfiIsUartDevicePath(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP)
101 extern DEBUGPORT_DEVICE
*gDebugPortDevice
;
104 // Driver binding interface functions...
107 DebugPortEntryPoint (
108 IN EFI_HANDLE ImageHandle
,
109 IN EFI_SYSTEM_TABLE
*SystemTable
116 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
117 IN EFI_HANDLE Controller
,
118 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
125 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
126 IN EFI_HANDLE Controller
,
127 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
134 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
135 IN EFI_HANDLE Controller
,
136 IN UINTN NumberOfChildren
,
137 IN EFI_HANDLE
*ChildHandleBuffer
142 // EFI Component Name Functions
146 DebugPortComponentNameGetDriverName (
147 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
149 OUT CHAR16
**DriverName
155 DebugPortComponentNameGetControllerName (
156 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
157 IN EFI_HANDLE ControllerHandle
,
158 IN EFI_HANDLE ChildHandle OPTIONAL
,
160 OUT CHAR16
**ControllerName
165 // DebugPort member functions
170 IN EFI_DEBUGPORT_PROTOCOL
*This
177 IN EFI_DEBUGPORT_PROTOCOL
*This
,
179 IN OUT UINTN
*BufferSize
,
187 IN EFI_DEBUGPORT_PROTOCOL
*This
,
189 IN OUT UINTN
*BufferSize
,
197 IN EFI_DEBUGPORT_PROTOCOL
*This