TianoCore EDK2 master
|
#include "DebugPort.h"
Go to the source code of this file.
Variables | |
EFI_DRIVER_BINDING_PROTOCOL | gDebugPortDriverBinding |
DEBUGPORT_DEVICE | mDebugPortDevice |
Top level C file for debugport driver. Contains initialization function. This driver layers on top of SerialIo. ALL CODE IN THE SERIALIO STACK MUST BE RE-ENTRANT AND CALLABLE FROM INTERRUPT CONTEXT
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DebugPort.c.
EFI_STATUS EFIAPI DebugPortPoll | ( | IN EFI_DEBUGPORT_PROTOCOL * | This | ) |
DebugPort protocol member function. Calls SerialIo:Write() after setting if it's different than the last SerialIo access.
This | Pointer to DebugPort protocol. |
EFI_SUCCESS | At least 1 character is ready to be read from the DebugPort interface. |
EFI_NOT_READY | There are no characters ready to read from the DebugPort interface |
EFI_DEVICE_ERROR | A hardware failure occurred... (from SerialIo) |
Definition at line 644 of file DebugPort.c.
EFI_STATUS EFIAPI DebugPortRead | ( | IN EFI_DEBUGPORT_PROTOCOL * | This, |
IN UINT32 | Timeout, | ||
IN OUT UINTN * | BufferSize, | ||
IN VOID * | Buffer | ||
) |
DebugPort protocol member function. Calls SerialIo:Read() after setting if it's different than the last SerialIo access.
This | Pointer to DebugPort protocol. |
Timeout | Timeout value. |
BufferSize | On input, the size of Buffer. On output, the amount of data actually written. |
Buffer | Pointer to buffer to read. |
EFI_SUCCESS | |
others |
Definition at line 534 of file DebugPort.c.
EFI_STATUS EFIAPI DebugPortReset | ( | IN EFI_DEBUGPORT_PROTOCOL * | This | ) |
DebugPort protocol member function. Calls SerialIo:GetControl to flush buffer. We cannot call SerialIo:SetAttributes because it uses pool services, which use locks, which affect TPL, so it's not interrupt context safe or re-entrant. SerialIo:Reset() calls SetAttributes, so it can't be used either.
The port itself should be fine since it was set up during initialization.
This | Protocol instance pointer. |
Definition at line 503 of file DebugPort.c.
EFI_STATUS EFIAPI DebugPortStart | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Binds exclusively to serial io on the controller handle, Produces DebugPort protocol and DevicePath on new handle.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to bind driver to. |
RemainingDevicePath | Optional parameter use to pick a specific child device to start. |
EFI_SUCCESS | This driver is added to ControllerHandle. |
EFI_OUT_OF_RESOURCES | Fails to allocate memory for device. |
others | Some error occurs. |
Definition at line 265 of file DebugPort.c.
EFI_STATUS EFIAPI DebugPortStop | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN UINTN | NumberOfChildren, | ||
IN EFI_HANDLE * | ChildHandleBuffer | ||
) |
Stop this driver on ControllerHandle by removing Serial IO protocol on the ControllerHandle.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to stop driver on |
NumberOfChildren | Number of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver. |
ChildHandleBuffer | List of Child Handles to Stop. |
EFI_SUCCESS | This driver is removed ControllerHandle. |
other | This driver was not removed from this device. |
Definition at line 412 of file DebugPort.c.
EFI_STATUS EFIAPI DebugPortSupported | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Checks to see if there's not already a DebugPort interface somewhere.
If there's a DEBUGPORT variable, the device path must match exactly. If there's no DEBUGPORT variable, then device path is not checked and does not matter. Checks to see that there's a serial io interface on the controller handle that can be bound BY_DRIVER | EXCLUSIVE. If all these tests succeed, then we return EFI_SUCCESS, else, EFI_UNSUPPORTED or other error returned by OpenProtocol.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to test. |
RemainingDevicePath | Optional parameter use to pick a specific child device to start. |
EFI_SUCCESS | This driver supports this device. |
EFI_UNSUPPORTED | Debug Port device is not supported. |
EFI_OUT_OF_RESOURCES | Fails to allocate memory for device. |
others | Some error occurs. |
Definition at line 165 of file DebugPort.c.
EFI_STATUS EFIAPI DebugPortWrite | ( | IN EFI_DEBUGPORT_PROTOCOL * | This, |
IN UINT32 | Timeout, | ||
IN OUT UINTN * | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
DebugPort protocol member function. Calls SerialIo:Write() Writes 8 bytes at a time and does a GetControl between 8 byte writes to help insure reads are interspersed This is poor-man's flow control.
This | Pointer to DebugPort protocol. |
Timeout | Timeout value. |
BufferSize | On input, the size of Buffer. On output, the amount of data actually written. |
Buffer | Pointer to buffer to read. |
EFI_SUCCESS | The data was written. |
others | Fails when writting datas to debug port device. |
Definition at line 592 of file DebugPort.c.
EFI_DEVICE_PATH_PROTOCOL * GetDebugPortVariable | ( | VOID | ) |
Local worker function to obtain device path information from DebugPort variable.
Records requested settings in DebugPort device structure.
Definition at line 54 of file DebugPort.c.
EFI_STATUS EFIAPI ImageUnloadHandler | ( | EFI_HANDLE | ImageHandle | ) |
Unload function that is registered in the LoadImage protocol. It un-installs protocols produced and deallocates pool used by the driver. Called by the core when unloading the driver.
ImageHandle |
EFI_SUCCESS | Unload Debug Port driver successfully. |
EFI_ABORTED | Serial IO is still binding. |
Definition at line 683 of file DebugPort.c.
EFI_STATUS EFIAPI InitializeDebugPortDriver | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Debug Port Driver entry point.
Reads DebugPort variable to determine what device and settings to use as the debug port. Binds exclusively to SerialIo. Reverts to defaults if no variable is found.
[in] | ImageHandle | The firmware allocated handle for the EFI image. |
[in] | SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The entry point is executed successfully. |
EFI_OUT_OF_RESOURCES | Fails to allocate memory for device. |
other | Some error occurs when executing this entry point. |
Definition at line 119 of file DebugPort.c.
EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding |
Definition at line 17 of file DebugPort.c.
DEBUGPORT_DEVICE mDebugPortDevice |
Definition at line 26 of file DebugPort.c.