From 1436aea4d5707e672672a11bda72be2c63c936c3 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Sun, 5 Dec 2021 14:54:02 -0800 Subject: MdeModulePkg: Apply uncrustify changes REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Signed-off-by: Michael Kubacki Reviewed-by: Liming Gao --- .../Universal/DebugPortDxe/ComponentName.c | 21 +- MdeModulePkg/Universal/DebugPortDxe/DebugPort.c | 292 +++++++++++---------- MdeModulePkg/Universal/DebugPortDxe/DebugPort.h | 86 +++--- 3 files changed, 204 insertions(+), 195 deletions(-) (limited to 'MdeModulePkg/Universal/DebugPortDxe') diff --git a/MdeModulePkg/Universal/DebugPortDxe/ComponentName.c b/MdeModulePkg/Universal/DebugPortDxe/ComponentName.c index 69915b8..324d83a 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/ComponentName.c +++ b/MdeModulePkg/Universal/DebugPortDxe/ComponentName.c @@ -20,17 +20,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentNa // // 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, +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[] = { +GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDebugPortDriverNameTable[] = { { "eng;en", - (CHAR16 *) L"DebugPort Driver" + (CHAR16 *)L"DebugPort Driver" }, { NULL, @@ -165,11 +164,11 @@ DebugPortComponentNameGetDriverName ( 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 + 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 172c1cb..f79ad04 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c +++ b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.c @@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // Globals // -EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = { +EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = { DebugPortSupported, DebugPortStart, DebugPortStop, @@ -23,25 +23,25 @@ EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = { NULL }; -DEBUGPORT_DEVICE mDebugPortDevice = { +DEBUGPORT_DEVICE mDebugPortDevice = { DEBUGPORT_DEVICE_SIGNATURE, - (EFI_HANDLE) 0, - (EFI_HANDLE) 0, - (EFI_DEVICE_PATH_PROTOCOL *) NULL, + (EFI_HANDLE)0, + (EFI_HANDLE)0, + (EFI_DEVICE_PATH_PROTOCOL *)NULL, { DebugPortReset, DebugPortWrite, DebugPortRead, DebugPortPoll }, - (EFI_HANDLE) 0, - (EFI_SERIAL_IO_PROTOCOL *) NULL, + (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, + (EFI_PARITY_TYPE)DEBUGPORT_UART_DEFAULT_PARITY, DEBUGPORT_UART_DEFAULT_DATA_BITS, - (EFI_STOP_BITS_TYPE) DEBUGPORT_UART_DEFAULT_STOP_BITS + (EFI_STOP_BITS_TYPE)DEBUGPORT_UART_DEFAULT_STOP_BITS }; /** @@ -59,7 +59,7 @@ GetDebugPortVariable ( EFI_DEVICE_PATH_PROTOCOL *DebugPortVariable; EFI_DEVICE_PATH_PROTOCOL *DevicePath; - GetVariable2 (EFI_DEBUGPORT_VARIABLE_NAME, &gEfiDebugPortVariableGuid, (VOID **) &DebugPortVariable, &DataSize); + GetVariable2 (EFI_DEBUGPORT_VARIABLE_NAME, &gEfiDebugPortVariableGuid, (VOID **)&DebugPortVariable, &DataSize); if (DebugPortVariable == NULL) { return NULL; } @@ -75,25 +75,25 @@ GetDebugPortVariable ( } else { CopyMem ( &mDebugPortDevice.BaudRate, - &((UART_DEVICE_PATH *) DevicePath)->BaudRate, - sizeof (((UART_DEVICE_PATH *) DevicePath)->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) + &((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) + &((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) + &((UART_DEVICE_PATH *)DevicePath)->StopBits, + sizeof (((UART_DEVICE_PATH *)DevicePath)->StopBits) ); return DebugPortVariable; } @@ -117,11 +117,11 @@ GetDebugPortVariable ( EFI_STATUS EFIAPI InitializeDebugPortDriver ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; + EFI_STATUS Status; // // Install driver model protocol(s). @@ -163,9 +163,9 @@ InitializeDebugPortDriver ( EFI_STATUS EFIAPI DebugPortSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { EFI_STATUS Status; @@ -179,9 +179,10 @@ DebugPortSupported ( // 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) { + if (gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&DebugPortInterface) != EFI_NOT_FOUND) { return EFI_UNSUPPORTED; } + // // Read DebugPort variable to determine debug port selection and parameters // @@ -195,25 +196,25 @@ DebugPortSupported ( // device path only. Otherwise, it's a mismatch and EFI_UNSUPPORTED is returned. // DevicePath = DebugPortVariable; - Status = gBS->LocateDevicePath ( - &gEfiSerialIoProtocolGuid, - &DevicePath, - &TempHandle - ); + Status = gBS->LocateDevicePath ( + &gEfiSerialIoProtocolGuid, + &DevicePath, + &TempHandle + ); - if (Status == EFI_SUCCESS && TempHandle != ControllerHandle) { + 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))) { - + 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))) { + if ((Status == EFI_SUCCESS) && !CompareGuid (&gEfiDebugPortDevicePathGuid, (GUID *)(DevicePath + 1))) { Status = EFI_UNSUPPORTED; } @@ -226,7 +227,7 @@ DebugPortSupported ( Status = gBS->OpenProtocol ( ControllerHandle, &gEfiSerialIoProtocolGuid, - (VOID **) &SerialIo, + (VOID **)&SerialIo, This->DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE @@ -262,9 +263,9 @@ DebugPortSupported ( EFI_STATUS EFIAPI DebugPortStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { EFI_STATUS Status; @@ -275,7 +276,7 @@ DebugPortStart ( Status = gBS->OpenProtocol ( ControllerHandle, &gEfiSerialIoProtocolGuid, - (VOID **) &mDebugPortDevice.SerialIoBinding, + (VOID **)&mDebugPortDevice.SerialIoBinding, This->DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE @@ -290,36 +291,36 @@ DebugPortStart ( // Initialize the Serial Io interface... // Status = mDebugPortDevice.SerialIoBinding->SetAttributes ( - mDebugPortDevice.SerialIoBinding, - mDebugPortDevice.BaudRate, - mDebugPortDevice.ReceiveFifoDepth, - mDebugPortDevice.Timeout, - mDebugPortDevice.Parity, - mDebugPortDevice.DataBits, - mDebugPortDevice.StopBits - ); + 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 - ); + 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 - ); + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); return Status; } } @@ -329,8 +330,8 @@ DebugPortStart ( // // Create device path instance for DebugPort // - DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH; - DebugPortDP.Header.SubType = MSG_VENDOR_DP; + DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH; + DebugPortDP.Header.SubType = MSG_VENDOR_DP; SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP)); CopyGuid (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid); @@ -340,10 +341,11 @@ DebugPortStart ( SetDevicePathEndNode (Dp1); } - mDebugPortDevice.DebugPortDevicePath = AppendDevicePathNode (Dp1, (EFI_DEVICE_PATH_PROTOCOL *) &DebugPortDP); + mDebugPortDevice.DebugPortDevicePath = AppendDevicePathNode (Dp1, (EFI_DEVICE_PATH_PROTOCOL *)&DebugPortDP); if (mDebugPortDevice.DebugPortDevicePath == NULL) { return EFI_OUT_OF_RESOURCES; } + // // Publish DebugPort and Device Path protocols // @@ -358,20 +360,21 @@ DebugPortStart ( if (EFI_ERROR (Status)) { gBS->CloseProtocol ( - ControllerHandle, - &gEfiSerialIoProtocolGuid, - This->DriverBindingHandle, - ControllerHandle - ); + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); return Status; } + // // Connect debugport child to serial io // Status = gBS->OpenProtocol ( ControllerHandle, &gEfiSerialIoProtocolGuid, - (VOID **) &mDebugPortDevice.SerialIoBinding, + (VOID **)&mDebugPortDevice.SerialIoBinding, This->DriverBindingHandle, mDebugPortDevice.DebugPortDeviceHandle, EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER @@ -379,11 +382,11 @@ DebugPortStart ( if (EFI_ERROR (Status)) { gBS->CloseProtocol ( - ControllerHandle, - &gEfiSerialIoProtocolGuid, - This->DriverBindingHandle, - ControllerHandle - ); + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); return Status; } @@ -407,10 +410,10 @@ DebugPortStart ( EFI_STATUS EFIAPI DebugPortStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer ) { EFI_STATUS Status; @@ -420,20 +423,20 @@ DebugPortStop ( // Close the bus driver // gBS->CloseProtocol ( - ControllerHandle, - &gEfiSerialIoProtocolGuid, - This->DriverBindingHandle, - ControllerHandle - ); + ControllerHandle, + &gEfiSerialIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); mDebugPortDevice.SerialIoBinding = NULL; gBS->CloseProtocol ( - ControllerHandle, - &gEfiDevicePathProtocolGuid, - This->DriverBindingHandle, - ControllerHandle - ); + ControllerHandle, + &gEfiDevicePathProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); FreePool (mDebugPortDevice.DebugPortDevicePath); @@ -452,6 +455,7 @@ DebugPortStop ( if (EFI_ERROR (Status)) { return Status; } + // // Unpublish our protocols (DevicePath, DebugPort) // @@ -466,13 +470,13 @@ DebugPortStop ( if (EFI_ERROR (Status)) { gBS->OpenProtocol ( - ControllerHandle, - &gEfiSerialIoProtocolGuid, - (VOID **) &mDebugPortDevice.SerialIoBinding, - This->DriverBindingHandle, - mDebugPortDevice.DebugPortDeviceHandle, - EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER - ); + ControllerHandle, + &gEfiSerialIoProtocolGuid, + (VOID **)&mDebugPortDevice.SerialIoBinding, + This->DriverBindingHandle, + mDebugPortDevice.DebugPortDeviceHandle, + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER + ); } else { mDebugPortDevice.DebugPortDeviceHandle = NULL; } @@ -497,11 +501,11 @@ DebugPortStop ( EFI_STATUS EFIAPI DebugPortReset ( - IN EFI_DEBUGPORT_PROTOCOL *This + IN EFI_DEBUGPORT_PROTOCOL *This ) { - UINTN BufferSize; - UINTN BitBucket; + UINTN BufferSize; + UINTN BitBucket; while (This->Poll (This) == EFI_SUCCESS) { BufferSize = 1; @@ -528,10 +532,10 @@ DebugPortReset ( EFI_STATUS EFIAPI DebugPortRead ( - IN EFI_DEBUGPORT_PROTOCOL *This, - IN UINT32 Timeout, - IN OUT UINTN *BufferSize, - IN VOID *Buffer + IN EFI_DEBUGPORT_PROTOCOL *This, + IN UINT32 Timeout, + IN OUT UINTN *BufferSize, + IN VOID *Buffer ) { DEBUGPORT_DEVICE *DebugPortDevice; @@ -545,10 +549,10 @@ DebugPortRead ( do { Status = DebugPortDevice->SerialIoBinding->Read ( - DebugPortDevice->SerialIoBinding, - &LocalBufferSize, - BufferPtr - ); + DebugPortDevice->SerialIoBinding, + &LocalBufferSize, + BufferPtr + ); if (Status == EFI_TIMEOUT) { if (Timeout > DEBUGPORT_UART_DEFAULT_TIMEOUT) { Timeout -= DEBUGPORT_UART_DEFAULT_TIMEOUT; @@ -559,11 +563,11 @@ DebugPortRead ( break; } - BufferPtr += LocalBufferSize; - LocalBufferSize = *BufferSize - (BufferPtr - (UINT8 *) Buffer); + BufferPtr += LocalBufferSize; + LocalBufferSize = *BufferSize - (BufferPtr - (UINT8 *)Buffer); } while (LocalBufferSize != 0 && Timeout > 0); - *BufferSize = (UINTN) BufferPtr - (UINTN) Buffer; + *BufferSize = (UINTN)BufferPtr - (UINTN)Buffer; return Status; } @@ -586,10 +590,10 @@ DebugPortRead ( EFI_STATUS EFIAPI DebugPortWrite ( - IN EFI_DEBUGPORT_PROTOCOL *This, - IN UINT32 Timeout, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer + IN EFI_DEBUGPORT_PROTOCOL *This, + IN UINT32 Timeout, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer ) { DEBUGPORT_DEVICE *DebugPortDevice; @@ -601,7 +605,7 @@ DebugPortWrite ( Status = EFI_SUCCESS; DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This); - WriteSize = 8; + WriteSize = 8; for (Position = 0; Position < *BufferSize && !EFI_ERROR (Status); Position += WriteSize) { DebugPortDevice->SerialIoBinding->GetControl ( DebugPortDevice->SerialIoBinding, @@ -612,10 +616,10 @@ DebugPortWrite ( } Status = DebugPortDevice->SerialIoBinding->Write ( - DebugPortDevice->SerialIoBinding, - &WriteSize, - &((UINT8 *) Buffer)[Position] - ); + DebugPortDevice->SerialIoBinding, + &WriteSize, + &((UINT8 *)Buffer)[Position] + ); } *BufferSize = Position; @@ -638,7 +642,7 @@ DebugPortWrite ( EFI_STATUS EFIAPI DebugPortPoll ( - IN EFI_DEBUGPORT_PROTOCOL *This + IN EFI_DEBUGPORT_PROTOCOL *This ) { EFI_STATUS Status; @@ -648,9 +652,9 @@ DebugPortPoll ( DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This); Status = DebugPortDevice->SerialIoBinding->GetControl ( - DebugPortDevice->SerialIoBinding, - &SerialControl - ); + DebugPortDevice->SerialIoBinding, + &SerialControl + ); if (!EFI_ERROR (Status)) { if ((SerialControl & EFI_SERIAL_INPUT_BUFFER_EMPTY) != 0) { @@ -677,7 +681,7 @@ DebugPortPoll ( EFI_STATUS EFIAPI ImageUnloadHandler ( - EFI_HANDLE ImageHandle + EFI_HANDLE ImageHandle ) { EFI_STATUS Status; @@ -705,14 +709,17 @@ ImageUnloadHandler ( if (ComponentName2 == NULL) { Status = gBS->UninstallMultipleProtocolInterfaces ( ImageHandle, - &gEfiDriverBindingProtocolGuid, &gDebugPortDriverBinding, + &gEfiDriverBindingProtocolGuid, + &gDebugPortDriverBinding, NULL ); } else { Status = gBS->UninstallMultipleProtocolInterfaces ( ImageHandle, - &gEfiDriverBindingProtocolGuid, &gDebugPortDriverBinding, - &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverBindingProtocolGuid, + &gDebugPortDriverBinding, + &gEfiComponentName2ProtocolGuid, + ComponentName2, NULL ); } @@ -720,16 +727,21 @@ ImageUnloadHandler ( if (ComponentName2 == NULL) { Status = gBS->UninstallMultipleProtocolInterfaces ( ImageHandle, - &gEfiDriverBindingProtocolGuid, &gDebugPortDriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, + &gEfiDriverBindingProtocolGuid, + &gDebugPortDriverBinding, + &gEfiComponentNameProtocolGuid, + ComponentName, NULL ); } else { Status = gBS->UninstallMultipleProtocolInterfaces ( ImageHandle, - &gEfiDriverBindingProtocolGuid, &gDebugPortDriverBinding, - &gEfiComponentNameProtocolGuid, ComponentName, - &gEfiComponentName2ProtocolGuid, ComponentName2, + &gEfiDriverBindingProtocolGuid, + &gDebugPortDriverBinding, + &gEfiComponentNameProtocolGuid, + ComponentName, + &gEfiComponentName2ProtocolGuid, + ComponentName2, NULL ); } diff --git a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.h b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.h index 12fca8e..48be8ef 100644 --- a/MdeModulePkg/Universal/DebugPortDxe/DebugPort.h +++ b/MdeModulePkg/Universal/DebugPortDxe/DebugPort.h @@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef __DEBUGPORT_H__ #define __DEBUGPORT_H__ - #include #include @@ -30,9 +29,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // // Driver Binding Externs // -extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding; -extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName; -extern EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2; +extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding; +extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2; // // local type definitions @@ -60,21 +59,21 @@ typedef struct { EFI_STOP_BITS_TYPE StopBits; } DEBUGPORT_DEVICE; -#define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE) +#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 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_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 DEBUGPORT_DRIVER_VERSION 1 -#define IS_UART_DEVICEPATH(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP) +#define IS_UART_DEVICEPATH(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP) /** Debug Port Driver entry point. @@ -94,8 +93,8 @@ typedef struct { EFI_STATUS EFIAPI InitializeDebugPortDriver ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ); /** @@ -122,9 +121,9 @@ InitializeDebugPortDriver ( EFI_STATUS EFIAPI DebugPortSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ); /** @@ -144,9 +143,9 @@ DebugPortSupported ( EFI_STATUS EFIAPI DebugPortStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ); /** @@ -166,15 +165,16 @@ DebugPortStart ( EFI_STATUS EFIAPI DebugPortStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer + 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. @@ -222,7 +222,6 @@ DebugPortComponentNameGetDriverName ( OUT CHAR16 **DriverName ); - /** Retrieves a Unicode string that is the user readable name of the controller that is being managed by a driver. @@ -294,14 +293,13 @@ DebugPortComponentNameGetDriverName ( 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 + 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 @@ -318,7 +316,7 @@ DebugPortComponentNameGetControllerName ( EFI_STATUS EFIAPI DebugPortReset ( - IN EFI_DEBUGPORT_PROTOCOL *This + IN EFI_DEBUGPORT_PROTOCOL *This ); /** @@ -338,10 +336,10 @@ DebugPortReset ( EFI_STATUS EFIAPI DebugPortRead ( - IN EFI_DEBUGPORT_PROTOCOL *This, - IN UINT32 Timeout, - IN OUT UINTN *BufferSize, - IN VOID *Buffer + IN EFI_DEBUGPORT_PROTOCOL *This, + IN UINT32 Timeout, + IN OUT UINTN *BufferSize, + IN VOID *Buffer ); /** @@ -362,10 +360,10 @@ DebugPortRead ( EFI_STATUS EFIAPI DebugPortWrite ( - IN EFI_DEBUGPORT_PROTOCOL *This, - IN UINT32 Timeout, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer + IN EFI_DEBUGPORT_PROTOCOL *This, + IN UINT32 Timeout, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer ); /** @@ -384,7 +382,7 @@ DebugPortWrite ( EFI_STATUS EFIAPI DebugPortPoll ( - IN EFI_DEBUGPORT_PROTOCOL *This + IN EFI_DEBUGPORT_PROTOCOL *This ); #endif -- cgit v1.1