diff options
| author | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
|---|---|---|
| committer | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
| commit | 7e2ccccace24636f29ddc210b94606abd4c7e42b (patch) | |
| tree | 545d43ea12671048956cafeb12303e84d601e571 /MdeModulePkg/Universal/DebugPortDxe | |
| parent | 27b044605cd5f6b33a3d231576003850b3fe305b (diff) | |
| download | edk2-trunk.tar.xz | |
Renormalized end-of-lines from master@27b044605cd5f6b33a3d231576003850b3fe305btrunk
Diffstat (limited to 'MdeModulePkg/Universal/DebugPortDxe')
| -rw-r--r-- | MdeModulePkg/Universal/DebugPortDxe/ComponentName.c | 350 | ||||
| -rw-r--r-- | MdeModulePkg/Universal/DebugPortDxe/DebugPort.c | 1502 | ||||
| -rw-r--r-- | MdeModulePkg/Universal/DebugPortDxe/DebugPort.h | 776 | ||||
| -rw-r--r-- | MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.inf | 132 | ||||
| -rw-r--r-- | MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.uni | 34 | ||||
| -rw-r--r-- | MdeModulePkg/Universal/DebugPortDxe/DebugPortDxeExtra.uni | 28 |
6 files changed, 1411 insertions, 1411 deletions
diff --git a/MdeModulePkg/Universal/DebugPortDxe/ComponentName.c b/MdeModulePkg/Universal/DebugPortDxe/ComponentName.c index 324d83adb0..bda63b0281 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/ComponentName.c +++ b/MdeModulePkg/Universal/DebugPortDxe/ComponentName.c @@ -1,175 +1,175 @@ -/** @file
- UEFI Component Name(2) protocol implementation for DebugPort driver.
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "DebugPort.h"
-
-//
-// EFI Component Name Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName = {
- DebugPortComponentNameGetDriverName,
- DebugPortComponentNameGetControllerName,
- "eng"
-};
-
-//
-// EFI Component Name 2 Protocol
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)DebugPortComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)DebugPortComponentNameGetControllerName,
- "en"
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDebugPortDriverNameTable[] = {
- {
- "eng;en",
- (CHAR16 *)L"DebugPort Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-/**
- Retrieves a Unicode string that is the user readable name of the driver.
-
- This function retrieves the user readable name of a driver in the form of a
- Unicode string. If the driver specified by This has a user readable name in
- the language specified by Language, then a pointer to the driver name is
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
- by This does not support the language specified by Language,
- then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified
- in RFC 4646 or ISO 639-2 language code format.
-
- @param DriverName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by
- This and the language specified by Language was
- returned in DriverName.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mDebugPortDriverNameTable,
- DriverName,
- (BOOLEAN)(This == &gDebugPortComponentName)
- );
-}
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by a driver.
-
- This function retrieves the user readable name of the controller specified by
- ControllerHandle and ChildHandle in the form of a Unicode string. If the
- driver specified by This has a user readable name in the language specified by
- Language, then a pointer to the controller name is returned in ControllerName,
- and EFI_SUCCESS is returned. If the driver specified by This is not currently
- managing the controller specified by ControllerHandle and ChildHandle,
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not
- support the language specified by Language, then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param ControllerHandle[in] The handle of a controller that the driver
- specified by This is managing. This handle
- specifies the controller whose name is to be
- returned.
-
- @param ChildHandle[in] The handle of the child controller to retrieve
- the name of. This is an optional parameter that
- may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers
- that wish to retrieve the name of the bus
- controller. It will not be NULL for a bus
- driver that wishes to retrieve the name of a
- child controller.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified in
- RFC 4646 or ISO 639-2 language code format.
-
- @param ControllerName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- controller specified by ControllerHandle and
- ChildHandle in the language specified by
- Language from the point of view of the driver
- specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in
- the language specified by Language for the
- driver specified by This was returned in
- DriverName.
-
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
-
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- return EFI_UNSUPPORTED;
-}
+/** @file + UEFI Component Name(2) protocol implementation for DebugPort driver. + +Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "DebugPort.h" + +// +// EFI Component Name Protocol +// +GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName = { + DebugPortComponentNameGetDriverName, + DebugPortComponentNameGetControllerName, + "eng" +}; + +// +// EFI Component Name 2 Protocol +// +GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2 = { + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)DebugPortComponentNameGetDriverName, + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)DebugPortComponentNameGetControllerName, + "en" +}; + +GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDebugPortDriverNameTable[] = { + { + "eng;en", + (CHAR16 *)L"DebugPort Driver" + }, + { + NULL, + NULL + } +}; + +/** + Retrieves a Unicode string that is the user readable name of the driver. + + This function retrieves the user readable name of a driver in the form of a + Unicode string. If the driver specified by This has a user readable name in + the language specified by Language, then a pointer to the driver name is + returned in DriverName, and EFI_SUCCESS is returned. If the driver specified + by This does not support the language specified by Language, + then EFI_UNSUPPORTED is returned. + + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. + + @param Language[in] A pointer to a Null-terminated ASCII string + array indicating the language. This is the + language of the driver name that the caller is + requesting, and it must match one of the + languages specified in SupportedLanguages. The + number of languages supported by a driver is up + to the driver writer. Language is specified + in RFC 4646 or ISO 639-2 language code format. + + @param DriverName[out] A pointer to the Unicode string to return. + This Unicode string is the name of the + driver specified by This in the language + specified by Language. + + @retval EFI_SUCCESS The Unicode string for the Driver specified by + This and the language specified by Language was + returned in DriverName. + + @retval EFI_INVALID_PARAMETER Language is NULL. + + @retval EFI_INVALID_PARAMETER DriverName is NULL. + + @retval EFI_UNSUPPORTED The driver specified by This does not support + the language specified by Language. + +**/ +EFI_STATUS +EFIAPI +DebugPortComponentNameGetDriverName ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN CHAR8 *Language, + OUT CHAR16 **DriverName + ) +{ + return LookupUnicodeString2 ( + Language, + This->SupportedLanguages, + mDebugPortDriverNameTable, + DriverName, + (BOOLEAN)(This == &gDebugPortComponentName) + ); +} + +/** + Retrieves a Unicode string that is the user readable name of the controller + that is being managed by a driver. + + This function retrieves the user readable name of the controller specified by + ControllerHandle and ChildHandle in the form of a Unicode string. If the + driver specified by This has a user readable name in the language specified by + Language, then a pointer to the controller name is returned in ControllerName, + and EFI_SUCCESS is returned. If the driver specified by This is not currently + managing the controller specified by ControllerHandle and ChildHandle, + then EFI_UNSUPPORTED is returned. If the driver specified by This does not + support the language specified by Language, then EFI_UNSUPPORTED is returned. + + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. + + @param ControllerHandle[in] The handle of a controller that the driver + specified by This is managing. This handle + specifies the controller whose name is to be + returned. + + @param ChildHandle[in] The handle of the child controller to retrieve + the name of. This is an optional parameter that + may be NULL. It will be NULL for device + drivers. It will also be NULL for a bus drivers + that wish to retrieve the name of the bus + controller. It will not be NULL for a bus + driver that wishes to retrieve the name of a + child controller. + + @param Language[in] A pointer to a Null-terminated ASCII string + array indicating the language. This is the + language of the driver name that the caller is + requesting, and it must match one of the + languages specified in SupportedLanguages. The + number of languages supported by a driver is up + to the driver writer. Language is specified in + RFC 4646 or ISO 639-2 language code format. + + @param ControllerName[out] A pointer to the Unicode string to return. + This Unicode string is the name of the + controller specified by ControllerHandle and + ChildHandle in the language specified by + Language from the point of view of the driver + specified by This. + + @retval EFI_SUCCESS The Unicode string for the user readable name in + the language specified by Language for the + driver specified by This was returned in + DriverName. + + @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. + + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid + EFI_HANDLE. + + @retval EFI_INVALID_PARAMETER Language is NULL. + + @retval EFI_INVALID_PARAMETER ControllerName is NULL. + + @retval EFI_UNSUPPORTED The driver specified by This is not currently + managing the controller specified by + ControllerHandle and ChildHandle. + + @retval EFI_UNSUPPORTED The driver specified by This does not support + the language specified by Language. + +**/ +EFI_STATUS +EFIAPI +DebugPortComponentNameGetControllerName ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN CHAR8 *Language, + OUT CHAR16 **ControllerName + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c index f79ad0489c..69024e945a 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c +++ b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c @@ -1,751 +1,751 @@ -/** @file
- 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.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "DebugPort.h"
-
-//
-// Globals
-//
-EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = {
- DebugPortSupported,
- DebugPortStart,
- DebugPortStop,
- DEBUGPORT_DRIVER_VERSION,
- NULL,
- NULL
-};
-
-DEBUGPORT_DEVICE mDebugPortDevice = {
- DEBUGPORT_DEVICE_SIGNATURE,
- (EFI_HANDLE)0,
- (EFI_HANDLE)0,
- (EFI_DEVICE_PATH_PROTOCOL *)NULL,
- {
- DebugPortReset,
- DebugPortWrite,
- DebugPortRead,
- DebugPortPoll
- },
- (EFI_HANDLE)0,
- (EFI_SERIAL_IO_PROTOCOL *)NULL,
- DEBUGPORT_UART_DEFAULT_BAUDRATE,
- DEBUGPORT_UART_DEFAULT_FIFO_DEPTH,
- DEBUGPORT_UART_DEFAULT_TIMEOUT,
- (EFI_PARITY_TYPE)DEBUGPORT_UART_DEFAULT_PARITY,
- DEBUGPORT_UART_DEFAULT_DATA_BITS,
- (EFI_STOP_BITS_TYPE)DEBUGPORT_UART_DEFAULT_STOP_BITS
-};
-
-/**
- Local worker function to obtain device path information from DebugPort variable.
-
- Records requested settings in DebugPort device structure.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-GetDebugPortVariable (
- VOID
- )
-{
- UINTN DataSize;
- EFI_DEVICE_PATH_PROTOCOL *DebugPortVariable;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- GetVariable2 (EFI_DEBUGPORT_VARIABLE_NAME, &gEfiDebugPortVariableGuid, (VOID **)&DebugPortVariable, &DataSize);
- if (DebugPortVariable == NULL) {
- return NULL;
- }
-
- DevicePath = DebugPortVariable;
- while (!IsDevicePathEnd (DevicePath) && !IS_UART_DEVICEPATH (DevicePath)) {
- DevicePath = NextDevicePathNode (DevicePath);
- }
-
- if (IsDevicePathEnd (DevicePath)) {
- FreePool (DebugPortVariable);
- return NULL;
- } else {
- CopyMem (
- &mDebugPortDevice.BaudRate,
- &((UART_DEVICE_PATH *)DevicePath)->BaudRate,
- sizeof (((UART_DEVICE_PATH *)DevicePath)->BaudRate)
- );
- mDebugPortDevice.ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH;
- mDebugPortDevice.Timeout = DEBUGPORT_UART_DEFAULT_TIMEOUT;
- CopyMem (
- &mDebugPortDevice.Parity,
- &((UART_DEVICE_PATH *)DevicePath)->Parity,
- sizeof (((UART_DEVICE_PATH *)DevicePath)->Parity)
- );
- CopyMem (
- &mDebugPortDevice.DataBits,
- &((UART_DEVICE_PATH *)DevicePath)->DataBits,
- sizeof (((UART_DEVICE_PATH *)DevicePath)->DataBits)
- );
- CopyMem (
- &mDebugPortDevice.StopBits,
- &((UART_DEVICE_PATH *)DevicePath)->StopBits,
- sizeof (((UART_DEVICE_PATH *)DevicePath)->StopBits)
- );
- return DebugPortVariable;
- }
-}
-
-/**
- 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.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.
- @retval other Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeDebugPortDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Install driver model protocol(s).
- //
- Status = EfiLibInstallDriverBindingComponentName2 (
- ImageHandle,
- SystemTable,
- &gDebugPortDriverBinding,
- ImageHandle,
- &gDebugPortComponentName,
- &gDebugPortComponentName2
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- 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.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to test.
- @param RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCESS This driver supports this device.
- @retval EFI_UNSUPPORTED Debug Port device is not supported.
- @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.
- @retval others Some error occurs.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DebugPortVariable;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEBUGPORT_PROTOCOL *DebugPortInterface;
- EFI_HANDLE TempHandle;
-
- //
- // Check to see that there's not a debugport protocol already published,
- // since only one standard UART serial port could be supported by this driver.
- //
- if (gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&DebugPortInterface) != EFI_NOT_FOUND) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Read DebugPort variable to determine debug port selection and parameters
- //
- DebugPortVariable = GetDebugPortVariable ();
-
- if (DebugPortVariable != NULL) {
- //
- // There's a DEBUGPORT variable, so do LocateDevicePath and check to see if
- // the closest matching handle matches the controller handle, and if it does,
- // check to see that the remaining device path has the DebugPort GUIDed messaging
- // device path only. Otherwise, it's a mismatch and EFI_UNSUPPORTED is returned.
- //
- DevicePath = DebugPortVariable;
- Status = gBS->LocateDevicePath (
- &gEfiSerialIoProtocolGuid,
- &DevicePath,
- &TempHandle
- );
-
- if ((Status == EFI_SUCCESS) && (TempHandle != ControllerHandle)) {
- Status = EFI_UNSUPPORTED;
- }
-
- if ((Status == EFI_SUCCESS) &&
- ((DevicePath->Type != MESSAGING_DEVICE_PATH) ||
- (DevicePath->SubType != MSG_VENDOR_DP) ||
- (*((UINT16 *)DevicePath->Length) != sizeof (DEBUGPORT_DEVICE_PATH))))
- {
- Status = EFI_UNSUPPORTED;
- }
-
- if ((Status == EFI_SUCCESS) && !CompareGuid (&gEfiDebugPortDevicePathGuid, (GUID *)(DevicePath + 1))) {
- Status = EFI_UNSUPPORTED;
- }
-
- FreePool (DebugPortVariable);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID **)&SerialIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-/**
- Binds exclusively to serial io on the controller handle, Produces DebugPort
- protocol and DevicePath on new handle.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to bind driver to.
- @param RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCESS This driver is added to ControllerHandle.
- @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.
- @retval others Some error occurs.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- DEBUGPORT_DEVICE_PATH DebugPortDP;
- EFI_DEVICE_PATH_PROTOCOL EndDP;
- EFI_DEVICE_PATH_PROTOCOL *Dp1;
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID **)&mDebugPortDevice.SerialIoBinding,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- mDebugPortDevice.SerialIoDeviceHandle = ControllerHandle;
-
- //
- // Initialize the Serial Io interface...
- //
- Status = mDebugPortDevice.SerialIoBinding->SetAttributes (
- mDebugPortDevice.SerialIoBinding,
- mDebugPortDevice.BaudRate,
- mDebugPortDevice.ReceiveFifoDepth,
- mDebugPortDevice.Timeout,
- mDebugPortDevice.Parity,
- mDebugPortDevice.DataBits,
- mDebugPortDevice.StopBits
- );
- if (EFI_ERROR (Status)) {
- mDebugPortDevice.BaudRate = 0;
- mDebugPortDevice.Parity = DefaultParity;
- mDebugPortDevice.DataBits = 0;
- mDebugPortDevice.StopBits = DefaultStopBits;
- mDebugPortDevice.ReceiveFifoDepth = 0;
- Status = mDebugPortDevice.SerialIoBinding->SetAttributes (
- mDebugPortDevice.SerialIoBinding,
- mDebugPortDevice.BaudRate,
- mDebugPortDevice.ReceiveFifoDepth,
- mDebugPortDevice.Timeout,
- mDebugPortDevice.Parity,
- mDebugPortDevice.DataBits,
- mDebugPortDevice.StopBits
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
- }
-
- mDebugPortDevice.SerialIoBinding->Reset (mDebugPortDevice.SerialIoBinding);
-
- //
- // Create device path instance for DebugPort
- //
- DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH;
- DebugPortDP.Header.SubType = MSG_VENDOR_DP;
- SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP));
- CopyGuid (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid);
-
- Dp1 = DevicePathFromHandle (ControllerHandle);
- if (Dp1 == NULL) {
- Dp1 = &EndDP;
- SetDevicePathEndNode (Dp1);
- }
-
- mDebugPortDevice.DebugPortDevicePath = AppendDevicePathNode (Dp1, (EFI_DEVICE_PATH_PROTOCOL *)&DebugPortDP);
- if (mDebugPortDevice.DebugPortDevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Publish DebugPort and Device Path protocols
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mDebugPortDevice.DebugPortDeviceHandle,
- &gEfiDevicePathProtocolGuid,
- mDebugPortDevice.DebugPortDevicePath,
- &gEfiDebugPortProtocolGuid,
- &mDebugPortDevice.DebugPortInterface,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
-
- //
- // Connect debugport child to serial io
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID **)&mDebugPortDevice.SerialIoBinding,
- This->DriverBindingHandle,
- mDebugPortDevice.DebugPortDeviceHandle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Stop this driver on ControllerHandle by removing Serial IO protocol on
- the ControllerHandle.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to stop driver on
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
- children is zero stop the entire bus driver.
- @param ChildHandleBuffer List of Child Handles to Stop.
-
- @retval EFI_SUCCESS This driver is removed ControllerHandle.
- @retval other This driver was not removed from this device.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_STATUS Status;
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- mDebugPortDevice.SerialIoBinding = NULL;
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- FreePool (mDebugPortDevice.DebugPortDevicePath);
-
- return EFI_SUCCESS;
- } else {
- //
- // Disconnect SerialIo child handle
- //
- Status = gBS->CloseProtocol (
- mDebugPortDevice.SerialIoDeviceHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- mDebugPortDevice.DebugPortDeviceHandle
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Unpublish our protocols (DevicePath, DebugPort)
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- mDebugPortDevice.DebugPortDeviceHandle,
- &gEfiDevicePathProtocolGuid,
- mDebugPortDevice.DebugPortDevicePath,
- &gEfiDebugPortProtocolGuid,
- &mDebugPortDevice.DebugPortInterface,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID **)&mDebugPortDevice.SerialIoBinding,
- This->DriverBindingHandle,
- mDebugPortDevice.DebugPortDeviceHandle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- mDebugPortDevice.DebugPortDeviceHandle = NULL;
- }
- }
-
- return Status;
-}
-
-/**
- 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.
-
- @param This Protocol instance pointer.
-
- @return EFI_SUCCESS Always.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortReset (
- IN EFI_DEBUGPORT_PROTOCOL *This
- )
-{
- UINTN BufferSize;
- UINTN BitBucket;
-
- while (This->Poll (This) == EFI_SUCCESS) {
- BufferSize = 1;
- This->Read (This, 0, &BufferSize, &BitBucket);
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- DebugPort protocol member function. Calls SerialIo:Read() after setting
- if it's different than the last SerialIo access.
-
- @param This Pointer to DebugPort protocol.
- @param Timeout Timeout value.
- @param BufferSize On input, the size of Buffer.
- On output, the amount of data actually written.
- @param Buffer Pointer to buffer to read.
-
- @retval EFI_SUCCESS
- @retval others
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortRead (
- IN EFI_DEBUGPORT_PROTOCOL *This,
- IN UINT32 Timeout,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-{
- DEBUGPORT_DEVICE *DebugPortDevice;
- UINTN LocalBufferSize;
- EFI_STATUS Status;
- UINT8 *BufferPtr;
-
- DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);
- BufferPtr = Buffer;
- LocalBufferSize = *BufferSize;
-
- do {
- Status = DebugPortDevice->SerialIoBinding->Read (
- DebugPortDevice->SerialIoBinding,
- &LocalBufferSize,
- BufferPtr
- );
- if (Status == EFI_TIMEOUT) {
- if (Timeout > DEBUGPORT_UART_DEFAULT_TIMEOUT) {
- Timeout -= DEBUGPORT_UART_DEFAULT_TIMEOUT;
- } else {
- Timeout = 0;
- }
- } else if (EFI_ERROR (Status)) {
- break;
- }
-
- BufferPtr += LocalBufferSize;
- LocalBufferSize = *BufferSize - (BufferPtr - (UINT8 *)Buffer);
- } while (LocalBufferSize != 0 && Timeout > 0);
-
- *BufferSize = (UINTN)BufferPtr - (UINTN)Buffer;
-
- return Status;
-}
-
-/**
- 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.
-
- @param This Pointer to DebugPort protocol.
- @param Timeout Timeout value.
- @param BufferSize On input, the size of Buffer.
- On output, the amount of data actually written.
- @param Buffer Pointer to buffer to read.
-
- @retval EFI_SUCCESS The data was written.
- @retval others Fails when writting datas to debug port device.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortWrite (
- IN EFI_DEBUGPORT_PROTOCOL *This,
- IN UINT32 Timeout,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-{
- DEBUGPORT_DEVICE *DebugPortDevice;
- UINTN Position;
- UINTN WriteSize;
- EFI_STATUS Status;
- UINT32 SerialControl;
-
- Status = EFI_SUCCESS;
- DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);
-
- WriteSize = 8;
- for (Position = 0; Position < *BufferSize && !EFI_ERROR (Status); Position += WriteSize) {
- DebugPortDevice->SerialIoBinding->GetControl (
- DebugPortDevice->SerialIoBinding,
- &SerialControl
- );
- if (*BufferSize - Position < 8) {
- WriteSize = *BufferSize - Position;
- }
-
- Status = DebugPortDevice->SerialIoBinding->Write (
- DebugPortDevice->SerialIoBinding,
- &WriteSize,
- &((UINT8 *)Buffer)[Position]
- );
- }
-
- *BufferSize = Position;
- return Status;
-}
-
-/**
- DebugPort protocol member function. Calls SerialIo:Write() after setting
- if it's different than the last SerialIo access.
-
- @param This Pointer to DebugPort protocol.
-
- @retval EFI_SUCCESS At least 1 character is ready to be read from
- the DebugPort interface.
- @retval EFI_NOT_READY There are no characters ready to read from the
- DebugPort interface
- @retval EFI_DEVICE_ERROR A hardware failure occurred... (from SerialIo)
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortPoll (
- IN EFI_DEBUGPORT_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
- UINT32 SerialControl;
- DEBUGPORT_DEVICE *DebugPortDevice;
-
- DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);
-
- Status = DebugPortDevice->SerialIoBinding->GetControl (
- DebugPortDevice->SerialIoBinding,
- &SerialControl
- );
-
- if (!EFI_ERROR (Status)) {
- if ((SerialControl & EFI_SERIAL_INPUT_BUFFER_EMPTY) != 0) {
- Status = EFI_NOT_READY;
- } else {
- Status = EFI_SUCCESS;
- }
- }
-
- return Status;
-}
-
-/**
- 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.
-
- @param ImageHandle
-
- @retval EFI_SUCCESS Unload Debug Port driver successfully.
- @retval EFI_ABORTED Serial IO is still binding.
-
-**/
-EFI_STATUS
-EFIAPI
-ImageUnloadHandler (
- EFI_HANDLE ImageHandle
- )
-{
- EFI_STATUS Status;
- VOID *ComponentName;
- VOID *ComponentName2;
-
- if (mDebugPortDevice.SerialIoBinding != NULL) {
- return EFI_ABORTED;
- }
-
- //
- // Driver is stopped already.
- //
- Status = gBS->HandleProtocol (ImageHandle, &gEfiComponentNameProtocolGuid, &ComponentName);
- if (EFI_ERROR (Status)) {
- ComponentName = NULL;
- }
-
- Status = gBS->HandleProtocol (ImageHandle, &gEfiComponentName2ProtocolGuid, &ComponentName2);
- if (EFI_ERROR (Status)) {
- ComponentName2 = NULL;
- }
-
- if (ComponentName == NULL) {
- if (ComponentName2 == NULL) {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ImageHandle,
- &gEfiDriverBindingProtocolGuid,
- &gDebugPortDriverBinding,
- NULL
- );
- } else {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ImageHandle,
- &gEfiDriverBindingProtocolGuid,
- &gDebugPortDriverBinding,
- &gEfiComponentName2ProtocolGuid,
- ComponentName2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL) {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ImageHandle,
- &gEfiDriverBindingProtocolGuid,
- &gDebugPortDriverBinding,
- &gEfiComponentNameProtocolGuid,
- ComponentName,
- NULL
- );
- } else {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ImageHandle,
- &gEfiDriverBindingProtocolGuid,
- &gDebugPortDriverBinding,
- &gEfiComponentNameProtocolGuid,
- ComponentName,
- &gEfiComponentName2ProtocolGuid,
- ComponentName2,
- NULL
- );
- }
- }
-
- return Status;
-}
+/** @file + 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.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "DebugPort.h" + +// +// Globals +// +EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = { + DebugPortSupported, + DebugPortStart, + DebugPortStop, + DEBUGPORT_DRIVER_VERSION, + NULL, + NULL +}; + +DEBUGPORT_DEVICE mDebugPortDevice = { + DEBUGPORT_DEVICE_SIGNATURE, + (EFI_HANDLE)0, + (EFI_HANDLE)0, + (EFI_DEVICE_PATH_PROTOCOL *)NULL, + { + DebugPortReset, + DebugPortWrite, + DebugPortRead, + DebugPortPoll + }, + (EFI_HANDLE)0, + (EFI_SERIAL_IO_PROTOCOL *)NULL, + DEBUGPORT_UART_DEFAULT_BAUDRATE, + DEBUGPORT_UART_DEFAULT_FIFO_DEPTH, + DEBUGPORT_UART_DEFAULT_TIMEOUT, + (EFI_PARITY_TYPE)DEBUGPORT_UART_DEFAULT_PARITY, + DEBUGPORT_UART_DEFAULT_DATA_BITS, + (EFI_STOP_BITS_TYPE)DEBUGPORT_UART_DEFAULT_STOP_BITS +}; + +/** + Local worker function to obtain device path information from DebugPort variable. + + Records requested settings in DebugPort device structure. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +GetDebugPortVariable ( + VOID + ) +{ + UINTN DataSize; + EFI_DEVICE_PATH_PROTOCOL *DebugPortVariable; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + + GetVariable2 (EFI_DEBUGPORT_VARIABLE_NAME, &gEfiDebugPortVariableGuid, (VOID **)&DebugPortVariable, &DataSize); + if (DebugPortVariable == NULL) { + return NULL; + } + + DevicePath = DebugPortVariable; + while (!IsDevicePathEnd (DevicePath) && !IS_UART_DEVICEPATH (DevicePath)) { + DevicePath = NextDevicePathNode (DevicePath); + } + + if (IsDevicePathEnd (DevicePath)) { + FreePool (DebugPortVariable); + return NULL; + } else { + CopyMem ( + &mDebugPortDevice.BaudRate, + &((UART_DEVICE_PATH *)DevicePath)->BaudRate, + sizeof (((UART_DEVICE_PATH *)DevicePath)->BaudRate) + ); + mDebugPortDevice.ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH; + mDebugPortDevice.Timeout = DEBUGPORT_UART_DEFAULT_TIMEOUT; + CopyMem ( + &mDebugPortDevice.Parity, + &((UART_DEVICE_PATH *)DevicePath)->Parity, + sizeof (((UART_DEVICE_PATH *)DevicePath)->Parity) + ); + CopyMem ( + &mDebugPortDevice.DataBits, + &((UART_DEVICE_PATH *)DevicePath)->DataBits, + sizeof (((UART_DEVICE_PATH *)DevicePath)->DataBits) + ); + CopyMem ( + &mDebugPortDevice.StopBits, + &((UART_DEVICE_PATH *)DevicePath)->StopBits, + sizeof (((UART_DEVICE_PATH *)DevicePath)->StopBits) + ); + return DebugPortVariable; + } +} + +/** + 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. + + @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device. + @retval other Some error occurs when executing this entry point. + +**/ +EFI_STATUS +EFIAPI +InitializeDebugPortDriver ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Install driver model protocol(s). + // + Status = EfiLibInstallDriverBindingComponentName2 ( + ImageHandle, + SystemTable, + &gDebugPortDriverBinding, + ImageHandle, + &gDebugPortComponentName, + &gDebugPortComponentName2 + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + 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. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device. + @retval EFI_UNSUPPORTED Debug Port device is not supported. + @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device. + @retval others Some error occurs. + +**/ +EFI_STATUS +EFIAPI +DebugPortSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ) +{ + EFI_STATUS Status; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_DEVICE_PATH_PROTOCOL *DebugPortVariable; + EFI_SERIAL_IO_PROTOCOL *SerialIo; + EFI_DEBUGPORT_PROTOCOL *DebugPortInterface; + EFI_HANDLE TempHandle; + + // + // Check to see that there's not a debugport protocol already published, + // since only one standard UART serial port could be supported by this driver. + // + if (gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&DebugPortInterface) != EFI_NOT_FOUND) { + return EFI_UNSUPPORTED; + } + + // + // Read DebugPort variable to determine debug port selection and parameters + // + DebugPortVariable = GetDebugPortVariable (); + + if (DebugPortVariable != NULL) { + // + // There's a DEBUGPORT variable, so do LocateDevicePath and check to see if + // the closest matching handle matches the controller handle, and if it does, + // check to see that the remaining device path has the DebugPort GUIDed messaging + // device path only. Otherwise, it's a mismatch and EFI_UNSUPPORTED is returned. + // + DevicePath = DebugPortVariable; + Status = gBS->LocateDevicePath ( + &gEfiSerialIoProtocolGuid, + &DevicePath, + &TempHandle + ); + + if ((Status == EFI_SUCCESS) && (TempHandle != ControllerHandle)) { + Status = EFI_UNSUPPORTED; + } + + if ((Status == EFI_SUCCESS) && + ((DevicePath->Type != MESSAGING_DEVICE_PATH) || + (DevicePath->SubType != MSG_VENDOR_DP) || + (*((UINT16 *)DevicePath->Length) != sizeof (DEBUGPORT_DEVICE_PATH)))) + { + Status = EFI_UNSUPPORTED; + } + + if ((Status == EFI_SUCCESS) && !CompareGuid (&gEfiDebugPortDevicePathGuid, (GUID *)(DevicePath + 1))) { + Status = EFI_UNSUPPORTED; + } + + FreePool (DebugPortVariable); + if (EFI_ERROR (Status)) { + return Status; + } + } + + Status = gBS->OpenProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + (VOID **)&SerialIo, + This->DriverBindingHandle, + ControllerHandle, + EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = gBS->CloseProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + + return Status; +} + +/** + Binds exclusively to serial io on the controller handle, Produces DebugPort + protocol and DevicePath on new handle. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle. + @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device. + @retval others Some error occurs. + +**/ +EFI_STATUS +EFIAPI +DebugPortStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ) +{ + EFI_STATUS Status; + DEBUGPORT_DEVICE_PATH DebugPortDP; + EFI_DEVICE_PATH_PROTOCOL EndDP; + EFI_DEVICE_PATH_PROTOCOL *Dp1; + + Status = gBS->OpenProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + (VOID **)&mDebugPortDevice.SerialIoBinding, + This->DriverBindingHandle, + ControllerHandle, + EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE + ); + if (EFI_ERROR (Status)) { + return Status; + } + + mDebugPortDevice.SerialIoDeviceHandle = ControllerHandle; + + // + // Initialize the Serial Io interface... + // + Status = mDebugPortDevice.SerialIoBinding->SetAttributes ( + mDebugPortDevice.SerialIoBinding, + mDebugPortDevice.BaudRate, + mDebugPortDevice.ReceiveFifoDepth, + mDebugPortDevice.Timeout, + mDebugPortDevice.Parity, + mDebugPortDevice.DataBits, + mDebugPortDevice.StopBits + ); + if (EFI_ERROR (Status)) { + mDebugPortDevice.BaudRate = 0; + mDebugPortDevice.Parity = DefaultParity; + mDebugPortDevice.DataBits = 0; + mDebugPortDevice.StopBits = DefaultStopBits; + mDebugPortDevice.ReceiveFifoDepth = 0; + Status = mDebugPortDevice.SerialIoBinding->SetAttributes ( + mDebugPortDevice.SerialIoBinding, + mDebugPortDevice.BaudRate, + mDebugPortDevice.ReceiveFifoDepth, + mDebugPortDevice.Timeout, + mDebugPortDevice.Parity, + mDebugPortDevice.DataBits, + mDebugPortDevice.StopBits + ); + if (EFI_ERROR (Status)) { + gBS->CloseProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + return Status; + } + } + + mDebugPortDevice.SerialIoBinding->Reset (mDebugPortDevice.SerialIoBinding); + + // + // Create device path instance for DebugPort + // + DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH; + DebugPortDP.Header.SubType = MSG_VENDOR_DP; + SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP)); + CopyGuid (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid); + + Dp1 = DevicePathFromHandle (ControllerHandle); + if (Dp1 == NULL) { + Dp1 = &EndDP; + SetDevicePathEndNode (Dp1); + } + + mDebugPortDevice.DebugPortDevicePath = AppendDevicePathNode (Dp1, (EFI_DEVICE_PATH_PROTOCOL *)&DebugPortDP); + if (mDebugPortDevice.DebugPortDevicePath == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // Publish DebugPort and Device Path protocols + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &mDebugPortDevice.DebugPortDeviceHandle, + &gEfiDevicePathProtocolGuid, + mDebugPortDevice.DebugPortDevicePath, + &gEfiDebugPortProtocolGuid, + &mDebugPortDevice.DebugPortInterface, + NULL + ); + + if (EFI_ERROR (Status)) { + gBS->CloseProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + return Status; + } + + // + // Connect debugport child to serial io + // + Status = gBS->OpenProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + (VOID **)&mDebugPortDevice.SerialIoBinding, + This->DriverBindingHandle, + mDebugPortDevice.DebugPortDeviceHandle, + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER + ); + + if (EFI_ERROR (Status)) { + gBS->CloseProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + return Status; + } + + return EFI_SUCCESS; +} + +/** + Stop this driver on ControllerHandle by removing Serial IO protocol on + the ControllerHandle. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle. + @retval other This driver was not removed from this device. + +**/ +EFI_STATUS +EFIAPI +DebugPortStop ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ) +{ + EFI_STATUS Status; + + if (NumberOfChildren == 0) { + // + // Close the bus driver + // + gBS->CloseProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + + mDebugPortDevice.SerialIoBinding = NULL; + + gBS->CloseProtocol ( + ControllerHandle, + &gEfiDevicePathProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + + FreePool (mDebugPortDevice.DebugPortDevicePath); + + return EFI_SUCCESS; + } else { + // + // Disconnect SerialIo child handle + // + Status = gBS->CloseProtocol ( + mDebugPortDevice.SerialIoDeviceHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + mDebugPortDevice.DebugPortDeviceHandle + ); + + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Unpublish our protocols (DevicePath, DebugPort) + // + Status = gBS->UninstallMultipleProtocolInterfaces ( + mDebugPortDevice.DebugPortDeviceHandle, + &gEfiDevicePathProtocolGuid, + mDebugPortDevice.DebugPortDevicePath, + &gEfiDebugPortProtocolGuid, + &mDebugPortDevice.DebugPortInterface, + NULL + ); + + if (EFI_ERROR (Status)) { + gBS->OpenProtocol ( + ControllerHandle, + &gEfiSerialIoProtocolGuid, + (VOID **)&mDebugPortDevice.SerialIoBinding, + This->DriverBindingHandle, + mDebugPortDevice.DebugPortDeviceHandle, + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER + ); + } else { + mDebugPortDevice.DebugPortDeviceHandle = NULL; + } + } + + return Status; +} + +/** + 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. + + @param This Protocol instance pointer. + + @return EFI_SUCCESS Always. + +**/ +EFI_STATUS +EFIAPI +DebugPortReset ( + IN EFI_DEBUGPORT_PROTOCOL *This + ) +{ + UINTN BufferSize; + UINTN BitBucket; + + while (This->Poll (This) == EFI_SUCCESS) { + BufferSize = 1; + This->Read (This, 0, &BufferSize, &BitBucket); + } + + return EFI_SUCCESS; +} + +/** + DebugPort protocol member function. Calls SerialIo:Read() after setting + if it's different than the last SerialIo access. + + @param This Pointer to DebugPort protocol. + @param Timeout Timeout value. + @param BufferSize On input, the size of Buffer. + On output, the amount of data actually written. + @param Buffer Pointer to buffer to read. + + @retval EFI_SUCCESS + @retval others + +**/ +EFI_STATUS +EFIAPI +DebugPortRead ( + IN EFI_DEBUGPORT_PROTOCOL *This, + IN UINT32 Timeout, + IN OUT UINTN *BufferSize, + IN VOID *Buffer + ) +{ + DEBUGPORT_DEVICE *DebugPortDevice; + UINTN LocalBufferSize; + EFI_STATUS Status; + UINT8 *BufferPtr; + + DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This); + BufferPtr = Buffer; + LocalBufferSize = *BufferSize; + + do { + Status = DebugPortDevice->SerialIoBinding->Read ( + DebugPortDevice->SerialIoBinding, + &LocalBufferSize, + BufferPtr + ); + if (Status == EFI_TIMEOUT) { + if (Timeout > DEBUGPORT_UART_DEFAULT_TIMEOUT) { + Timeout -= DEBUGPORT_UART_DEFAULT_TIMEOUT; + } else { + Timeout = 0; + } + } else if (EFI_ERROR (Status)) { + break; + } + + BufferPtr += LocalBufferSize; + LocalBufferSize = *BufferSize - (BufferPtr - (UINT8 *)Buffer); + } while (LocalBufferSize != 0 && Timeout > 0); + + *BufferSize = (UINTN)BufferPtr - (UINTN)Buffer; + + return Status; +} + +/** + 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. + + @param This Pointer to DebugPort protocol. + @param Timeout Timeout value. + @param BufferSize On input, the size of Buffer. + On output, the amount of data actually written. + @param Buffer Pointer to buffer to read. + + @retval EFI_SUCCESS The data was written. + @retval others Fails when writting datas to debug port device. + +**/ +EFI_STATUS +EFIAPI +DebugPortWrite ( + IN EFI_DEBUGPORT_PROTOCOL *This, + IN UINT32 Timeout, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +{ + DEBUGPORT_DEVICE *DebugPortDevice; + UINTN Position; + UINTN WriteSize; + EFI_STATUS Status; + UINT32 SerialControl; + + Status = EFI_SUCCESS; + DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This); + + WriteSize = 8; + for (Position = 0; Position < *BufferSize && !EFI_ERROR (Status); Position += WriteSize) { + DebugPortDevice->SerialIoBinding->GetControl ( + DebugPortDevice->SerialIoBinding, + &SerialControl + ); + if (*BufferSize - Position < 8) { + WriteSize = *BufferSize - Position; + } + + Status = DebugPortDevice->SerialIoBinding->Write ( + DebugPortDevice->SerialIoBinding, + &WriteSize, + &((UINT8 *)Buffer)[Position] + ); + } + + *BufferSize = Position; + return Status; +} + +/** + DebugPort protocol member function. Calls SerialIo:Write() after setting + if it's different than the last SerialIo access. + + @param This Pointer to DebugPort protocol. + + @retval EFI_SUCCESS At least 1 character is ready to be read from + the DebugPort interface. + @retval EFI_NOT_READY There are no characters ready to read from the + DebugPort interface + @retval EFI_DEVICE_ERROR A hardware failure occurred... (from SerialIo) + +**/ +EFI_STATUS +EFIAPI +DebugPortPoll ( + IN EFI_DEBUGPORT_PROTOCOL *This + ) +{ + EFI_STATUS Status; + UINT32 SerialControl; + DEBUGPORT_DEVICE *DebugPortDevice; + + DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This); + + Status = DebugPortDevice->SerialIoBinding->GetControl ( + DebugPortDevice->SerialIoBinding, + &SerialControl + ); + + if (!EFI_ERROR (Status)) { + if ((SerialControl & EFI_SERIAL_INPUT_BUFFER_EMPTY) != 0) { + Status = EFI_NOT_READY; + } else { + Status = EFI_SUCCESS; + } + } + + return Status; +} + +/** + 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. + + @param ImageHandle + + @retval EFI_SUCCESS Unload Debug Port driver successfully. + @retval EFI_ABORTED Serial IO is still binding. + +**/ +EFI_STATUS +EFIAPI +ImageUnloadHandler ( + EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + VOID *ComponentName; + VOID *ComponentName2; + + if (mDebugPortDevice.SerialIoBinding != NULL) { + return EFI_ABORTED; + } + + // + // Driver is stopped already. + // + Status = gBS->HandleProtocol (ImageHandle, &gEfiComponentNameProtocolGuid, &ComponentName); + if (EFI_ERROR (Status)) { + ComponentName = NULL; + } + + Status = gBS->HandleProtocol (ImageHandle, &gEfiComponentName2ProtocolGuid, &ComponentName2); + if (EFI_ERROR (Status)) { + ComponentName2 = NULL; + } + + if (ComponentName == NULL) { + if (ComponentName2 == NULL) { + Status = gBS->UninstallMultipleProtocolInterfaces ( + ImageHandle, + &gEfiDriverBindingProtocolGuid, + &gDebugPortDriverBinding, + NULL + ); + } else { + Status = gBS->UninstallMultipleProtocolInterfaces ( + ImageHandle, + &gEfiDriverBindingProtocolGuid, + &gDebugPortDriverBinding, + &gEfiComponentName2ProtocolGuid, + ComponentName2, + NULL + ); + } + } else { + if (ComponentName2 == NULL) { + Status = gBS->UninstallMultipleProtocolInterfaces ( + ImageHandle, + &gEfiDriverBindingProtocolGuid, + &gDebugPortDriverBinding, + &gEfiComponentNameProtocolGuid, + ComponentName, + NULL + ); + } else { + Status = gBS->UninstallMultipleProtocolInterfaces ( + ImageHandle, + &gEfiDriverBindingProtocolGuid, + &gDebugPortDriverBinding, + &gEfiComponentNameProtocolGuid, + ComponentName, + &gEfiComponentName2ProtocolGuid, + ComponentName2, + NULL + ); + } + } + + return Status; +} diff --git a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.h b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.h index 48be8ef16b..3e09607986 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.h +++ b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.h @@ -1,388 +1,388 @@ -/** @file
- Definitions and prototypes for DebugPort driver.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __DEBUGPORT_H__
-#define __DEBUGPORT_H__
-
-#include <Uefi.h>
-
-#include <Protocol/DevicePath.h>
-#include <Protocol/ComponentName.h>
-#include <Protocol/DriverBinding.h>
-#include <Protocol/SerialIo.h>
-#include <Protocol/DebugPort.h>
-
-#include <Library/DebugLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/DevicePathLib.h>
-
-//
-// Driver Binding Externs
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2;
-
-//
-// local type definitions
-//
-#define DEBUGPORT_DEVICE_SIGNATURE SIGNATURE_32 ('D', 'B', 'G', 'P')
-
-//
-// Device structure used by driver
-//
-typedef struct {
- UINT32 Signature;
- EFI_HANDLE DriverBindingHandle;
- EFI_HANDLE DebugPortDeviceHandle;
-
- EFI_DEVICE_PATH_PROTOCOL *DebugPortDevicePath;
- EFI_DEBUGPORT_PROTOCOL DebugPortInterface;
-
- EFI_HANDLE SerialIoDeviceHandle;
- EFI_SERIAL_IO_PROTOCOL *SerialIoBinding;
- UINT64 BaudRate;
- UINT32 ReceiveFifoDepth;
- UINT32 Timeout;
- EFI_PARITY_TYPE Parity;
- UINT8 DataBits;
- EFI_STOP_BITS_TYPE StopBits;
-} DEBUGPORT_DEVICE;
-
-#define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE)
-
-#define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500)
-#define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501)
-
-#define DEBUGPORT_UART_DEFAULT_BAUDRATE 115200
-#define DEBUGPORT_UART_DEFAULT_PARITY 0
-#define DEBUGPORT_UART_DEFAULT_FIFO_DEPTH 16
-#define DEBUGPORT_UART_DEFAULT_TIMEOUT 50000///< 5 ms
-#define DEBUGPORT_UART_DEFAULT_DATA_BITS 8
-#define DEBUGPORT_UART_DEFAULT_STOP_BITS 1
-
-#define DEBUGPORT_DRIVER_VERSION 1
-
-#define IS_UART_DEVICEPATH(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP)
-
-/**
- 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.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The entry point is executed successfully.
- @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.
- @retval other Some error occurs when executing this entry point.
-
-**/
-EFI_STATUS
-EFIAPI
-InitializeDebugPortDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-/**
- 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.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to test.
- @param RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCESS This driver supports this device.
- @retval EFI_UNSUPPORTED Debug Port device is not supported.
- @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.
- @retval others Some error occurs.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-/**
- Binds exclusively to serial io on the controller handle, Produces DebugPort
- protocol and DevicePath on new handle.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to bind driver to.
- @param RemainingDevicePath Optional parameter use to pick a specific child
- device to start.
-
- @retval EFI_SUCCESS This driver is added to ControllerHandle.
- @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device.
- @retval others Some error occurs.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-/**
- Stop this driver on ControllerHandle by removing Serial IO protocol on
- the ControllerHandle.
-
- @param This Protocol instance pointer.
- @param ControllerHandle Handle of device to stop driver on
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
- children is zero stop the entire bus driver.
- @param ChildHandleBuffer List of Child Handles to Stop.
-
- @retval EFI_SUCCESS This driver is removed ControllerHandle.
- @retval other This driver was not removed from this device.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-
-/**
- Retrieves a Unicode string that is the user readable name of the driver.
-
- This function retrieves the user readable name of a driver in the form of a
- Unicode string. If the driver specified by This has a user readable name in
- the language specified by Language, then a pointer to the driver name is
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
- by This does not support the language specified by Language,
- then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified
- in RFC 4646 or ISO 639-2 language code format.
-
- @param DriverName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by
- This and the language specified by Language was
- returned in DriverName.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by a driver.
-
- This function retrieves the user readable name of the controller specified by
- ControllerHandle and ChildHandle in the form of a Unicode string. If the
- driver specified by This has a user readable name in the language specified by
- Language, then a pointer to the controller name is returned in ControllerName,
- and EFI_SUCCESS is returned. If the driver specified by This is not currently
- managing the controller specified by ControllerHandle and ChildHandle,
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not
- support the language specified by Language, then EFI_UNSUPPORTED is returned.
-
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
- EFI_COMPONENT_NAME_PROTOCOL instance.
-
- @param ControllerHandle[in] The handle of a controller that the driver
- specified by This is managing. This handle
- specifies the controller whose name is to be
- returned.
-
- @param ChildHandle[in] The handle of the child controller to retrieve
- the name of. This is an optional parameter that
- may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers
- that wish to retrieve the name of the bus
- controller. It will not be NULL for a bus
- driver that wishes to retrieve the name of a
- child controller.
-
- @param Language[in] A pointer to a Null-terminated ASCII string
- array indicating the language. This is the
- language of the driver name that the caller is
- requesting, and it must match one of the
- languages specified in SupportedLanguages. The
- number of languages supported by a driver is up
- to the driver writer. Language is specified in
- RFC 4646 or ISO 639-2 language code format.
-
- @param ControllerName[out] A pointer to the Unicode string to return.
- This Unicode string is the name of the
- controller specified by ControllerHandle and
- ChildHandle in the language specified by
- Language from the point of view of the driver
- specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in
- the language specified by Language for the
- driver specified by This was returned in
- DriverName.
-
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
-
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
-
- @retval EFI_INVALID_PARAMETER Language is NULL.
-
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
-
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
-
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-/**
- 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.
-
- @param This Protocol instance pointer.
-
- @return EFI_SUCCESS Always.
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortReset (
- IN EFI_DEBUGPORT_PROTOCOL *This
- );
-
-/**
- DebugPort protocol member function. Calls SerialIo:Read() after setting
- if it's different than the last SerialIo access.
-
- @param This Pointer to DebugPort protocol.
- @param Timeout Timeout value.
- @param BufferSize On input, the size of Buffer.
- On output, the amount of data actually written.
- @param Buffer Pointer to buffer to read.
-
- @retval EFI_SUCCESS
- @retval others
-
-**/
-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: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.
-
- @param This Pointer to DebugPort protocol.
- @param Timeout Timeout value.
- @param BufferSize On input, the size of Buffer.
- On output, the amount of data actually written.
- @param Buffer Pointer to buffer to read.
-
- @retval EFI_SUCCESS The data was written.
- @retval others Fails when writting datas to debug port device.
-
-**/
-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() after setting
- if it's different than the last SerialIo access.
-
- @param This Pointer to DebugPort protocol.
-
- @retval EFI_SUCCESS At least 1 character is ready to be read from
- the DebugPort interface.
- @retval EFI_NOT_READY There are no characters ready to read from the
- DebugPort interface
- @retval EFI_DEVICE_ERROR A hardware failure occurred... (from SerialIo)
-
-**/
-EFI_STATUS
-EFIAPI
-DebugPortPoll (
- IN EFI_DEBUGPORT_PROTOCOL *This
- );
-
-#endif
+/** @file + Definitions and prototypes for DebugPort driver. + +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __DEBUGPORT_H__ +#define __DEBUGPORT_H__ + +#include <Uefi.h> + +#include <Protocol/DevicePath.h> +#include <Protocol/ComponentName.h> +#include <Protocol/DriverBinding.h> +#include <Protocol/SerialIo.h> +#include <Protocol/DebugPort.h> + +#include <Library/DebugLib.h> +#include <Library/UefiDriverEntryPoint.h> +#include <Library/UefiLib.h> +#include <Library/BaseMemoryLib.h> +#include <Library/MemoryAllocationLib.h> +#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiRuntimeServicesTableLib.h> +#include <Library/DevicePathLib.h> + +// +// Driver Binding Externs +// +extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding; +extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2; + +// +// local type definitions +// +#define DEBUGPORT_DEVICE_SIGNATURE SIGNATURE_32 ('D', 'B', 'G', 'P') + +// +// Device structure used by driver +// +typedef struct { + UINT32 Signature; + EFI_HANDLE DriverBindingHandle; + EFI_HANDLE DebugPortDeviceHandle; + + EFI_DEVICE_PATH_PROTOCOL *DebugPortDevicePath; + EFI_DEBUGPORT_PROTOCOL DebugPortInterface; + + EFI_HANDLE SerialIoDeviceHandle; + EFI_SERIAL_IO_PROTOCOL *SerialIoBinding; + UINT64 BaudRate; + UINT32 ReceiveFifoDepth; + UINT32 Timeout; + EFI_PARITY_TYPE Parity; + UINT8 DataBits; + EFI_STOP_BITS_TYPE StopBits; +} DEBUGPORT_DEVICE; + +#define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE) + +#define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500) +#define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501) + +#define DEBUGPORT_UART_DEFAULT_BAUDRATE 115200 +#define DEBUGPORT_UART_DEFAULT_PARITY 0 +#define DEBUGPORT_UART_DEFAULT_FIFO_DEPTH 16 +#define DEBUGPORT_UART_DEFAULT_TIMEOUT 50000///< 5 ms +#define DEBUGPORT_UART_DEFAULT_DATA_BITS 8 +#define DEBUGPORT_UART_DEFAULT_STOP_BITS 1 + +#define DEBUGPORT_DRIVER_VERSION 1 + +#define IS_UART_DEVICEPATH(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP) + +/** + 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. + + @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device. + @retval other Some error occurs when executing this entry point. + +**/ +EFI_STATUS +EFIAPI +InitializeDebugPortDriver ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); + +/** + 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. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device. + @retval EFI_UNSUPPORTED Debug Port device is not supported. + @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device. + @retval others Some error occurs. + +**/ +EFI_STATUS +EFIAPI +DebugPortSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +/** + Binds exclusively to serial io on the controller handle, Produces DebugPort + protocol and DevicePath on new handle. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle. + @retval EFI_OUT_OF_RESOURCES Fails to allocate memory for device. + @retval others Some error occurs. + +**/ +EFI_STATUS +EFIAPI +DebugPortStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +/** + Stop this driver on ControllerHandle by removing Serial IO protocol on + the ControllerHandle. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle. + @retval other This driver was not removed from this device. + +**/ +EFI_STATUS +EFIAPI +DebugPortStop ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ); + +// +// EFI Component Name Functions +// + +/** + Retrieves a Unicode string that is the user readable name of the driver. + + This function retrieves the user readable name of a driver in the form of a + Unicode string. If the driver specified by This has a user readable name in + the language specified by Language, then a pointer to the driver name is + returned in DriverName, and EFI_SUCCESS is returned. If the driver specified + by This does not support the language specified by Language, + then EFI_UNSUPPORTED is returned. + + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. + + @param Language[in] A pointer to a Null-terminated ASCII string + array indicating the language. This is the + language of the driver name that the caller is + requesting, and it must match one of the + languages specified in SupportedLanguages. The + number of languages supported by a driver is up + to the driver writer. Language is specified + in RFC 4646 or ISO 639-2 language code format. + + @param DriverName[out] A pointer to the Unicode string to return. + This Unicode string is the name of the + driver specified by This in the language + specified by Language. + + @retval EFI_SUCCESS The Unicode string for the Driver specified by + This and the language specified by Language was + returned in DriverName. + + @retval EFI_INVALID_PARAMETER Language is NULL. + + @retval EFI_INVALID_PARAMETER DriverName is NULL. + + @retval EFI_UNSUPPORTED The driver specified by This does not support + the language specified by Language. + +**/ +EFI_STATUS +EFIAPI +DebugPortComponentNameGetDriverName ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN CHAR8 *Language, + OUT CHAR16 **DriverName + ); + +/** + Retrieves a Unicode string that is the user readable name of the controller + that is being managed by a driver. + + This function retrieves the user readable name of the controller specified by + ControllerHandle and ChildHandle in the form of a Unicode string. If the + driver specified by This has a user readable name in the language specified by + Language, then a pointer to the controller name is returned in ControllerName, + and EFI_SUCCESS is returned. If the driver specified by This is not currently + managing the controller specified by ControllerHandle and ChildHandle, + then EFI_UNSUPPORTED is returned. If the driver specified by This does not + support the language specified by Language, then EFI_UNSUPPORTED is returned. + + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. + + @param ControllerHandle[in] The handle of a controller that the driver + specified by This is managing. This handle + specifies the controller whose name is to be + returned. + + @param ChildHandle[in] The handle of the child controller to retrieve + the name of. This is an optional parameter that + may be NULL. It will be NULL for device + drivers. It will also be NULL for a bus drivers + that wish to retrieve the name of the bus + controller. It will not be NULL for a bus + driver that wishes to retrieve the name of a + child controller. + + @param Language[in] A pointer to a Null-terminated ASCII string + array indicating the language. This is the + language of the driver name that the caller is + requesting, and it must match one of the + languages specified in SupportedLanguages. The + number of languages supported by a driver is up + to the driver writer. Language is specified in + RFC 4646 or ISO 639-2 language code format. + + @param ControllerName[out] A pointer to the Unicode string to return. + This Unicode string is the name of the + controller specified by ControllerHandle and + ChildHandle in the language specified by + Language from the point of view of the driver + specified by This. + + @retval EFI_SUCCESS The Unicode string for the user readable name in + the language specified by Language for the + driver specified by This was returned in + DriverName. + + @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. + + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid + EFI_HANDLE. + + @retval EFI_INVALID_PARAMETER Language is NULL. + + @retval EFI_INVALID_PARAMETER ControllerName is NULL. + + @retval EFI_UNSUPPORTED The driver specified by This is not currently + managing the controller specified by + ControllerHandle and ChildHandle. + + @retval EFI_UNSUPPORTED The driver specified by This does not support + the language specified by Language. + +**/ +EFI_STATUS +EFIAPI +DebugPortComponentNameGetControllerName ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN CHAR8 *Language, + OUT CHAR16 **ControllerName + ); + +/** + 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. + + @param This Protocol instance pointer. + + @return EFI_SUCCESS Always. + +**/ +EFI_STATUS +EFIAPI +DebugPortReset ( + IN EFI_DEBUGPORT_PROTOCOL *This + ); + +/** + DebugPort protocol member function. Calls SerialIo:Read() after setting + if it's different than the last SerialIo access. + + @param This Pointer to DebugPort protocol. + @param Timeout Timeout value. + @param BufferSize On input, the size of Buffer. + On output, the amount of data actually written. + @param Buffer Pointer to buffer to read. + + @retval EFI_SUCCESS + @retval others + +**/ +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: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. + + @param This Pointer to DebugPort protocol. + @param Timeout Timeout value. + @param BufferSize On input, the size of Buffer. + On output, the amount of data actually written. + @param Buffer Pointer to buffer to read. + + @retval EFI_SUCCESS The data was written. + @retval others Fails when writting datas to debug port device. + +**/ +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() after setting + if it's different than the last SerialIo access. + + @param This Pointer to DebugPort protocol. + + @retval EFI_SUCCESS At least 1 character is ready to be read from + the DebugPort interface. + @retval EFI_NOT_READY There are no characters ready to read from the + DebugPort interface + @retval EFI_DEVICE_ERROR A hardware failure occurred... (from SerialIo) + +**/ +EFI_STATUS +EFIAPI +DebugPortPoll ( + IN EFI_DEBUGPORT_PROTOCOL *This + ); + +#endif diff --git a/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.inf b/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.inf index 66da0dea93..ddef581434 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.inf +++ b/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.inf @@ -1,66 +1,66 @@ -## @file
-# This driver produces Debug Port protocol to be used by debug agent to communicate with the remote debug host.
-#
-# This driver binds exclusively to a standard UART serial port on the controller handle,
-# and initializes serial Io interface, publishs Debug Port and Device Path Protocol.
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DebugPortDxe
- MODULE_UNI_FILE = DebugPortDxe.uni
- FILE_GUID = 73E9457A-CEA1-4917-9A9C-9F1F0F0FD322
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- ENTRY_POINT = InitializeDebugPortDriver
- UNLOAD_IMAGE = ImageUnloadHandler
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 EBC
-#
-# DRIVER_BINDING = gDebugPortDriverBinding
-# COMPONENT_NAME = gDebugPortComponentName
-# COMPONENT_NAME2 = gDebugPortComponentName2
-# Variable Guid C Name: gEfiDebugPortProtocolGuid Variable Name: L"DEBUGPORT"
-#
-#
-
-[Sources]
- ComponentName.c
- DebugPort.c
- DebugPort.h
-
-
-[Packages]
- MdePkg/MdePkg.dec
-
-
-[LibraryClasses]
- DevicePathLib
- UefiRuntimeServicesTableLib
- UefiBootServicesTableLib
- MemoryAllocationLib
- BaseMemoryLib
- UefiLib
- UefiDriverEntryPoint
- DebugLib
-
-[Guids]
- gEfiDebugPortVariableGuid ## SOMETIMES_CONSUMES ## Variable:L"DEBUGPORT"
- gEfiDebugPortDevicePathGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Device path
-
-[Protocols]
- gEfiSerialIoProtocolGuid ## TO_START
- gEfiDevicePathProtocolGuid ## BY_START
- gEfiDebugPortProtocolGuid ## BY_START
-
-[UserExtensions.TianoCore."ExtraFiles"]
- DebugPortDxeExtra.uni
+## @file +# This driver produces Debug Port protocol to be used by debug agent to communicate with the remote debug host. +# +# This driver binds exclusively to a standard UART serial port on the controller handle, +# and initializes serial Io interface, publishs Debug Port and Device Path Protocol. +# +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DebugPortDxe + MODULE_UNI_FILE = DebugPortDxe.uni + FILE_GUID = 73E9457A-CEA1-4917-9A9C-9F1F0F0FD322 + MODULE_TYPE = UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = InitializeDebugPortDriver + UNLOAD_IMAGE = ImageUnloadHandler + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 EBC +# +# DRIVER_BINDING = gDebugPortDriverBinding +# COMPONENT_NAME = gDebugPortComponentName +# COMPONENT_NAME2 = gDebugPortComponentName2 +# Variable Guid C Name: gEfiDebugPortProtocolGuid Variable Name: L"DEBUGPORT" +# +# + +[Sources] + ComponentName.c + DebugPort.c + DebugPort.h + + +[Packages] + MdePkg/MdePkg.dec + + +[LibraryClasses] + DevicePathLib + UefiRuntimeServicesTableLib + UefiBootServicesTableLib + MemoryAllocationLib + BaseMemoryLib + UefiLib + UefiDriverEntryPoint + DebugLib + +[Guids] + gEfiDebugPortVariableGuid ## SOMETIMES_CONSUMES ## Variable:L"DEBUGPORT" + gEfiDebugPortDevicePathGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Device path + +[Protocols] + gEfiSerialIoProtocolGuid ## TO_START + gEfiDevicePathProtocolGuid ## BY_START + gEfiDebugPortProtocolGuid ## BY_START + +[UserExtensions.TianoCore."ExtraFiles"] + DebugPortDxeExtra.uni diff --git a/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.uni b/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.uni index 2f631eadad..c05502dabd 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.uni +++ b/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.uni @@ -1,17 +1,17 @@ -// /** @file
-// This driver produces Debug Port protocol to be used by debug agent to communicate with the remote debug host.
-//
-// This driver binds exclusively to a standard UART serial port on the controller handle,
-// and initializes serial Io interface, publishs Debug Port and Device Path Protocol.
-//
-// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Produces Debug Port protocol to be used by debug agent to communicate with the remote debug host and initializes serial Io interface, publishes Debug Port and Device Path Protocol."
-
-#string STR_MODULE_DESCRIPTION #language en-US "This driver binds exclusively to a standard UART serial port on the controller handle, and initializes serial Io interface, publishes Debug Port and Device Path Protocol."
-
+// /** @file +// This driver produces Debug Port protocol to be used by debug agent to communicate with the remote debug host. +// +// This driver binds exclusively to a standard UART serial port on the controller handle, +// and initializes serial Io interface, publishs Debug Port and Device Path Protocol. +// +// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Produces Debug Port protocol to be used by debug agent to communicate with the remote debug host and initializes serial Io interface, publishes Debug Port and Device Path Protocol." + +#string STR_MODULE_DESCRIPTION #language en-US "This driver binds exclusively to a standard UART serial port on the controller handle, and initializes serial Io interface, publishes Debug Port and Device Path Protocol." + diff --git a/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxeExtra.uni b/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxeExtra.uni index 3450ab45b8..92cf4616c0 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxeExtra.uni +++ b/MdeModulePkg/Universal/DebugPortDxe/DebugPortDxeExtra.uni @@ -1,14 +1,14 @@ -// /** @file
-// DebugPortDxe Localized Strings and Content
-//
-// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"Debug Port DXE Driver"
-
-
+// /** @file +// DebugPortDxe Localized Strings and Content +// +// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Debug Port DXE Driver" + + |
