From a550d468a6ca577d9e9c57a0eafcf2fc9fbb8c97 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Sun, 5 Dec 2021 14:53:57 -0800 Subject: EmulatorPkg: Apply uncrustify changes REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the EmulatorPkg package Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Signed-off-by: Michael Kubacki Reviewed-by: Ray Ni --- EmulatorPkg/EmuGopDxe/ComponentName.c | 36 ++++--- EmulatorPkg/EmuGopDxe/Gop.h | 115 ++++++++++----------- EmulatorPkg/EmuGopDxe/GopDriver.c | 123 ++++++++++++----------- EmulatorPkg/EmuGopDxe/GopInput.c | 181 +++++++++++++++------------------- EmulatorPkg/EmuGopDxe/GopScreen.c | 176 ++++++++++++++++----------------- 5 files changed, 296 insertions(+), 335 deletions(-) (limited to 'EmulatorPkg/EmuGopDxe') diff --git a/EmulatorPkg/EmuGopDxe/ComponentName.c b/EmulatorPkg/EmuGopDxe/ComponentName.c index d096a2405f..b288c26a5b 100644 --- a/EmulatorPkg/EmuGopDxe/ComponentName.c +++ b/EmulatorPkg/EmuGopDxe/ComponentName.c @@ -28,17 +28,17 @@ EmuGopComponentNameGetDriverName ( EFI_STATUS EFIAPI EmuGopComponentNameGetControllerName ( - 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 ); // // EFI Component Name Protocol // -EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName = { +EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName = { EmuGopComponentNameGetDriverName, EmuGopComponentNameGetControllerName, "eng" @@ -47,19 +47,17 @@ EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName = { // // EFI Component Name 2 Protocol // -GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2 = { - (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuGopComponentNameGetDriverName, - (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuGopComponentNameGetControllerName, +GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2 = { + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmuGopComponentNameGetDriverName, + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmuGopComponentNameGetControllerName, "en" }; - -EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] = { +EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] = { { "eng", L"Emulator GOP Driver" }, - { NULL , NULL } + { NULL, NULL } }; - /** Retrieves a Unicode string that is the user readable name of the driver. @@ -116,7 +114,6 @@ EmuGopComponentNameGetDriverName ( ); } - /** Retrieves a Unicode string that is the user readable name of the controller that is being managed by a driver. @@ -188,11 +185,11 @@ EmuGopComponentNameGetDriverName ( EFI_STATUS EFIAPI EmuGopComponentNameGetControllerName ( - 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 ) { EFI_STATUS Status; @@ -217,6 +214,7 @@ EmuGopComponentNameGetControllerName ( if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; } + // // Get our context back // diff --git a/EmulatorPkg/EmuGopDxe/Gop.h b/EmulatorPkg/EmuGopDxe/Gop.h index 3896663276..7f7dc4e8eb 100644 --- a/EmulatorPkg/EmuGopDxe/Gop.h +++ b/EmulatorPkg/EmuGopDxe/Gop.h @@ -29,78 +29,73 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include - -#define MAX_Q 256 +#define MAX_Q 256 typedef struct { - UINTN Front; - UINTN Rear; - UINTN Count; - EFI_INPUT_KEY Q[MAX_Q]; + UINTN Front; + UINTN Rear; + UINTN Count; + EFI_INPUT_KEY Q[MAX_Q]; } GOP_QUEUE_FIXED; -#define EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('U', 'g', 'S', 'n') +#define EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('U', 'g', 'S', 'n') typedef struct _EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY { - UINTN Signature; - EFI_HANDLE NotifyHandle; - EFI_KEY_DATA KeyData; - EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn; - EFI_EVENT Event; - LIST_ENTRY NotifyEntry; + UINTN Signature; + EFI_HANDLE NotifyHandle; + EFI_KEY_DATA KeyData; + EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn; + EFI_EVENT Event; + LIST_ENTRY NotifyEntry; } EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY; -#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff +#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff typedef struct { - UINT32 HorizontalResolution; - UINT32 VerticalResolution; - UINT32 ColorDepth; - UINT32 RefreshRate; + UINT32 HorizontalResolution; + UINT32 VerticalResolution; + UINT32 ColorDepth; + UINT32 RefreshRate; } GOP_MODE_DATA; +extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding; +extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName; - -extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding; -extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName; - -#define EMU_UGA_CLASS_NAME L"EmuGopWindow" +#define EMU_UGA_CLASS_NAME L"EmuGopWindow" #define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('G', 'o', 'p', 'N') typedef struct { - UINT64 Signature; + UINT64 Signature; - EFI_HANDLE Handle; - EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput; - EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn; - EFI_SIMPLE_POINTER_PROTOCOL SimplePointer; + EFI_HANDLE Handle; + EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput; + EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn; + EFI_SIMPLE_POINTER_PROTOCOL SimplePointer; - EMU_IO_THUNK_PROTOCOL *EmuIoThunk; - EMU_GRAPHICS_WINDOW_PROTOCOL *EmuGraphicsWindow; + EMU_IO_THUNK_PROTOCOL *EmuIoThunk; + EMU_GRAPHICS_WINDOW_PROTOCOL *EmuGraphicsWindow; - EFI_UNICODE_STRING_TABLE *ControllerNameTable; + EFI_UNICODE_STRING_TABLE *ControllerNameTable; - EFI_SIMPLE_POINTER_MODE PointerMode; + EFI_SIMPLE_POINTER_MODE PointerMode; // // GOP Private Data for QueryMode () // - GOP_MODE_DATA *ModeData; - + GOP_MODE_DATA *ModeData; // // UGA Private Data knowing when to start hardware // - BOOLEAN HardwareNeedsStarting; + BOOLEAN HardwareNeedsStarting; - CHAR16 *WindowName; + CHAR16 *WindowName; - GOP_QUEUE_FIXED Queue; + GOP_QUEUE_FIXED Queue; - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx; - EFI_KEY_STATE KeyState; - LIST_ENTRY NotifyList; + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx; + EFI_KEY_STATE KeyState; + LIST_ENTRY NotifyList; } GOP_PRIVATE_DATA; - #define GOP_PRIVATE_DATA_FROM_THIS(a) \ CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE) @@ -113,13 +108,12 @@ typedef struct { #define GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS(a) \ CR(a, GOP_PRIVATE_DATA, SimplePointer, GOP_PRIVATE_DATA_SIGNATURE) - // // Global Protocol Variables // -extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding; -extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName; -extern EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2; +extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding; +extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2; // // Gop Hardware abstraction internal worker functions @@ -131,38 +125,37 @@ EmuGopSupported ( EFI_STATUS EmuGopConstructor ( - IN GOP_PRIVATE_DATA *Private + IN GOP_PRIVATE_DATA *Private ); EFI_STATUS EmuGopDestructor ( - IN GOP_PRIVATE_DATA *Private + IN GOP_PRIVATE_DATA *Private ); - EFI_STATUS GopPrivateAddQ ( - IN GOP_PRIVATE_DATA *Private, - IN EFI_INPUT_KEY Key + IN GOP_PRIVATE_DATA *Private, + IN EFI_INPUT_KEY Key ); EFI_STATUS EmuGopInitializeSimpleTextInForWindow ( - IN GOP_PRIVATE_DATA *Private + IN GOP_PRIVATE_DATA *Private ); EFI_STATUS EmuGopInitializeSimplePointerForWindow ( - IN GOP_PRIVATE_DATA *Private + IN GOP_PRIVATE_DATA *Private ); EFI_STATUS EmuGopStartWindow ( - IN GOP_PRIVATE_DATA *Private, - IN UINT32 HorizontalResolution, - IN UINT32 VerticalResolution, - IN UINT32 ColorDepth, - IN UINT32 RefreshRate + IN GOP_PRIVATE_DATA *Private, + IN UINT32 HorizontalResolution, + IN UINT32 VerticalResolution, + IN UINT32 ColorDepth, + IN UINT32 RefreshRate ); VOID @@ -175,15 +168,15 @@ ShutdownGopEvent ( VOID EFIAPI GopPrivateMakeCallbackFunction ( - IN VOID *Context, - IN EFI_KEY_DATA *KeyData + IN VOID *Context, + IN EFI_KEY_DATA *KeyData ); VOID EFIAPI GopPrivateBreakCallbackFunction ( - IN VOID *Context, - IN EFI_KEY_DATA *KeyData + IN VOID *Context, + IN EFI_KEY_DATA *KeyData ); #endif diff --git a/EmulatorPkg/EmuGopDxe/GopDriver.c b/EmulatorPkg/EmuGopDxe/GopDriver.c index d0215c33e7..4b716e35e1 100644 --- a/EmulatorPkg/EmuGopDxe/GopDriver.c +++ b/EmulatorPkg/EmuGopDxe/GopDriver.c @@ -9,11 +9,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "Gop.h" - EFI_STATUS FreeNotifyList ( - IN OUT LIST_ENTRY *ListHead + IN OUT LIST_ENTRY *ListHead ) + /*++ Routine Description: @@ -29,11 +29,12 @@ Returns: **/ { - EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NotifyNode; + EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NotifyNode; if (ListHead == NULL) { return EFI_INVALID_PARAMETER; } + while (!IsListEmpty (ListHead)) { NotifyNode = CR ( ListHead->ForwardLink, @@ -48,7 +49,6 @@ Returns: return EFI_SUCCESS; } - /** Tests to see if this driver supports a given controller. If a child device is provided, it further tests to see if this driver supports creating a handle for the specified child device. @@ -94,13 +94,13 @@ Returns: EFI_STATUS EFIAPI EmuGopDriverBindingSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Handle, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Handle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { - EFI_STATUS Status; - EMU_IO_THUNK_PROTOCOL *EmuIoThunk; + EFI_STATUS Status; + EMU_IO_THUNK_PROTOCOL *EmuIoThunk; // // Open the IO Abstraction(s) needed to perform the supported test @@ -123,16 +123,15 @@ EmuGopDriverBindingSupported ( // Close the I/O Abstraction(s) used to perform the supported test // gBS->CloseProtocol ( - Handle, - &gEmuIoThunkProtocolGuid, - This->DriverBindingHandle, - Handle - ); + Handle, + &gEmuIoThunkProtocolGuid, + This->DriverBindingHandle, + Handle + ); return Status; } - /** Starts a device controller or a bus controller. @@ -171,14 +170,14 @@ EmuGopDriverBindingSupported ( EFI_STATUS EFIAPI EmuGopDriverBindingStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Handle, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Handle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { - EMU_IO_THUNK_PROTOCOL *EmuIoThunk; - EFI_STATUS Status; - GOP_PRIVATE_DATA *Private; + EMU_IO_THUNK_PROTOCOL *EmuIoThunk; + EFI_STATUS Status; + GOP_PRIVATE_DATA *Private; // // Grab the protocols we need @@ -199,14 +198,15 @@ EmuGopDriverBindingStart ( // Allocate Private context data for SGO inteface. // Private = NULL; - Status = gBS->AllocatePool ( - EfiBootServicesData, - sizeof (GOP_PRIVATE_DATA), - (VOID **)&Private - ); + Status = gBS->AllocatePool ( + EfiBootServicesData, + sizeof (GOP_PRIVATE_DATA), + (VOID **)&Private + ); if (EFI_ERROR (Status)) { goto Done; } + // // Set up context record // @@ -234,27 +234,31 @@ EmuGopDriverBindingStart ( if (EFI_ERROR (Status)) { goto Done; } + // // Publish the Gop interface to the world // Status = gBS->InstallMultipleProtocolInterfaces ( &Private->Handle, - &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput, - &gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn, - &gEfiSimplePointerProtocolGuid, &Private->SimplePointer, - &gEfiSimpleTextInputExProtocolGuid, &Private->SimpleTextInEx, + &gEfiGraphicsOutputProtocolGuid, + &Private->GraphicsOutput, + &gEfiSimpleTextInProtocolGuid, + &Private->SimpleTextIn, + &gEfiSimplePointerProtocolGuid, + &Private->SimplePointer, + &gEfiSimpleTextInputExProtocolGuid, + &Private->SimpleTextInEx, NULL ); Done: if (EFI_ERROR (Status)) { - gBS->CloseProtocol ( - Handle, - &gEmuIoThunkProtocolGuid, - This->DriverBindingHandle, - Handle - ); + Handle, + &gEmuIoThunkProtocolGuid, + This->DriverBindingHandle, + Handle + ); if (Private != NULL) { // @@ -263,12 +267,15 @@ Done: if (Private->ControllerNameTable != NULL) { FreeUnicodeStringTable (Private->ControllerNameTable); } + if (Private->SimpleTextIn.WaitForKey != NULL) { gBS->CloseEvent (Private->SimpleTextIn.WaitForKey); } + if (Private->SimpleTextInEx.WaitForKeyEx != NULL) { gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx); } + FreeNotifyList (&Private->NotifyList); gBS->FreePool (Private); @@ -278,8 +285,6 @@ Done: return Status; } - - /** Stops a device controller or a bus controller. @@ -315,9 +320,9 @@ EmuGopDriverBindingStop ( IN EFI_HANDLE *ChildHandleBuffer ) { - EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; - EFI_STATUS Status; - GOP_PRIVATE_DATA *Private; + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; + EFI_STATUS Status; + GOP_PRIVATE_DATA *Private; Status = gBS->OpenProtocol ( Handle, @@ -344,10 +349,14 @@ EmuGopDriverBindingStop ( // Status = gBS->UninstallMultipleProtocolInterfaces ( Private->Handle, - &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput, - &gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn, - &gEfiSimplePointerProtocolGuid, &Private->SimplePointer, - &gEfiSimpleTextInputExProtocolGuid, &Private->SimpleTextInEx, + &gEfiGraphicsOutputProtocolGuid, + &Private->GraphicsOutput, + &gEfiSimpleTextInProtocolGuid, + &Private->SimpleTextIn, + &gEfiSimplePointerProtocolGuid, + &Private->SimplePointer, + &gEfiSimpleTextInputExProtocolGuid, + &Private->SimpleTextInEx, NULL ); if (!EFI_ERROR (Status)) { @@ -360,11 +369,11 @@ EmuGopDriverBindingStop ( } gBS->CloseProtocol ( - Handle, - &gEmuIoThunkProtocolGuid, - This->DriverBindingHandle, - Handle - ); + Handle, + &gEmuIoThunkProtocolGuid, + This->DriverBindingHandle, + Handle + ); // // Free our instance data @@ -380,18 +389,16 @@ EmuGopDriverBindingStop ( FreeNotifyList (&Private->NotifyList); gBS->FreePool (Private); - } return Status; } - /// /// This protocol provides the services required to determine if a driver supports a given controller. /// If a controller is supported, then it also provides routines to start and stop the controller. /// -EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding = { +EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding = { EmuGopDriverBindingSupported, EmuGopDriverBindingStart, EmuGopDriverBindingStop, @@ -400,8 +407,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding = { NULL }; - - /** The user Entry Point for module EmuGop. The user code starts with this function. @@ -415,11 +420,11 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding = { EFI_STATUS EFIAPI InitializeEmuGop ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; + EFI_STATUS Status; Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, @@ -431,7 +436,5 @@ InitializeEmuGop ( ); ASSERT_EFI_ERROR (Status); - return Status; } - diff --git a/EmulatorPkg/EmuGopDxe/GopInput.c b/EmulatorPkg/EmuGopDxe/GopInput.c index 2a23564a21..a48293912d 100644 --- a/EmulatorPkg/EmuGopDxe/GopInput.c +++ b/EmulatorPkg/EmuGopDxe/GopInput.c @@ -9,12 +9,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "Gop.h" - BOOLEAN GopPrivateIsKeyRegistered ( IN EFI_KEY_DATA *RegsiteredData, IN EFI_KEY_DATA *InputData ) + /*++ Routine Description: @@ -35,37 +35,39 @@ Returns: ASSERT (RegsiteredData != NULL && InputData != NULL); if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) || - (RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) { + (RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) + { return FALSE; } // // Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored. // - if (RegsiteredData->KeyState.KeyShiftState != 0 && - RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) { + if ((RegsiteredData->KeyState.KeyShiftState != 0) && + (RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState)) + { return FALSE; } - if (RegsiteredData->KeyState.KeyToggleState != 0 && - RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState) { + + if ((RegsiteredData->KeyState.KeyToggleState != 0) && + (RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState)) + { return FALSE; } return TRUE; - } - VOID EFIAPI GopPrivateMakeCallbackFunction ( - IN VOID *Context, - IN EFI_KEY_DATA *KeyData + IN VOID *Context, + IN EFI_KEY_DATA *KeyData ) { - LIST_ENTRY *Link; + LIST_ENTRY *Link; EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify; - GOP_PRIVATE_DATA *Private = (GOP_PRIVATE_DATA *)Context; + GOP_PRIVATE_DATA *Private = (GOP_PRIVATE_DATA *)Context; KeyMapMake (KeyData); @@ -84,19 +86,16 @@ GopPrivateMakeCallbackFunction ( } } - VOID EFIAPI GopPrivateBreakCallbackFunction ( - IN VOID *Context, - IN EFI_KEY_DATA *KeyData + IN VOID *Context, + IN EFI_KEY_DATA *KeyData ) { KeyMapBreak (KeyData); } - - // // Simple Text In implementation. // @@ -114,8 +113,8 @@ GopPrivateBreakCallbackFunction ( EFI_STATUS EFIAPI EmuGopSimpleTextInReset ( - IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, - IN BOOLEAN ExtendedVerification + IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, + IN BOOLEAN ExtendedVerification ) { GOP_PRIVATE_DATA *Private; @@ -135,8 +134,8 @@ EmuGopSimpleTextInReset ( // // A reset is draining the Queue // - while (Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, &KeyData) == EFI_SUCCESS) - ; + while (Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, &KeyData) == EFI_SUCCESS) { + } // // Leave critical section and return @@ -145,7 +144,6 @@ EmuGopSimpleTextInReset ( return EFI_SUCCESS; } - /** Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existence of a keystroke via WaitForEvent () call. @@ -163,8 +161,8 @@ EmuGopSimpleTextInReset ( EFI_STATUS EFIAPI EmuGopSimpleTextInReadKeyStroke ( - IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, - OUT EFI_INPUT_KEY *Key + IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, + OUT EFI_INPUT_KEY *Key ) { GOP_PRIVATE_DATA *Private; @@ -180,9 +178,9 @@ EmuGopSimpleTextInReadKeyStroke ( // // Enter critical section // - OldTpl = gBS->RaiseTPL (TPL_NOTIFY); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); - Status = Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, &KeyData); + Status = Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, &KeyData); if (!EFI_ERROR (Status)) { if ((KeyData.Key.ScanCode == 0) && (KeyData.Key.UnicodeChar == 0)) { // Modifier key was pressed @@ -200,8 +198,6 @@ EmuGopSimpleTextInReadKeyStroke ( return Status; } - - /** SimpleTextIn and SimpleTextInEx Notify Wait Event @@ -212,15 +208,15 @@ EmuGopSimpleTextInReadKeyStroke ( VOID EFIAPI EmuGopSimpleTextInWaitForKey ( - IN EFI_EVENT Event, - IN VOID *Context + IN EFI_EVENT Event, + IN VOID *Context ) { GOP_PRIVATE_DATA *Private; EFI_STATUS Status; EFI_TPL OldTpl; - Private = (GOP_PRIVATE_DATA *) Context; + Private = (GOP_PRIVATE_DATA *)Context; if (Private->EmuGraphicsWindow == NULL) { return; } @@ -228,27 +224,26 @@ EmuGopSimpleTextInWaitForKey ( // // Enter critical section // - OldTpl = gBS->RaiseTPL (TPL_NOTIFY); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); - Status = Private->EmuGraphicsWindow->CheckKey (Private->EmuGraphicsWindow); + Status = Private->EmuGraphicsWindow->CheckKey (Private->EmuGraphicsWindow); if (!EFI_ERROR (Status)) { // // If a there is a key in the queue signal our event. // gBS->SignalEvent (Event); } + // // Leave critical section and return // gBS->RestoreTPL (OldTpl); } - // // Simple Text Input Ex protocol functions // - /** The Reset() function resets the input device hardware. As part of initialization process, the firmware/device will make a quick @@ -280,6 +275,7 @@ EmuGopSimpleTextInExResetEx ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification ) + /*++ Routine Description: @@ -297,8 +293,6 @@ EmuGopSimpleTextInExResetEx ( return EFI_SUCCESS; } - - /** The function reads the next keystroke from the input device. If there is no pending keystroke the function returns @@ -351,9 +345,10 @@ EmuGopSimpleTextInExResetEx ( EFI_STATUS EFIAPI EmuGopSimpleTextInExReadKeyStrokeEx ( - IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - OUT EFI_KEY_DATA *KeyData + IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + OUT EFI_KEY_DATA *KeyData ) + /*++ Routine Description: @@ -378,7 +373,6 @@ EmuGopSimpleTextInExReadKeyStrokeEx ( GOP_PRIVATE_DATA *Private; EFI_TPL OldTpl; - if (KeyData == NULL) { return EFI_INVALID_PARAMETER; } @@ -391,9 +385,9 @@ EmuGopSimpleTextInExReadKeyStrokeEx ( // // Enter critical section // - OldTpl = gBS->RaiseTPL (TPL_NOTIFY); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); - Status = Private->EmuGraphicsWindow->GetKey(Private->EmuGraphicsWindow, KeyData); + Status = Private->EmuGraphicsWindow->GetKey (Private->EmuGraphicsWindow, KeyData); // // Leave critical section and return @@ -403,8 +397,6 @@ EmuGopSimpleTextInExReadKeyStrokeEx ( return Status; } - - /** The SetState() function allows the input device hardware to have state settings adjusted. @@ -446,16 +438,17 @@ EmuGopSimpleTextInExSetState ( } if (((Private->KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) || - ((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID)) { + ((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID)) + { return EFI_UNSUPPORTED; } // // Enter critical section // - OldTpl = gBS->RaiseTPL (TPL_NOTIFY); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); - Status = Private->EmuGraphicsWindow->KeySetState (Private->EmuGraphicsWindow, KeyToggleState); + Status = Private->EmuGraphicsWindow->KeySetState (Private->EmuGraphicsWindow, KeyToggleState); // // Leave critical section and return // @@ -464,7 +457,6 @@ EmuGopSimpleTextInExSetState ( return Status; } - /** SimpleTextIn and SimpleTextInEx Notify Wait Event @@ -475,17 +467,15 @@ EmuGopSimpleTextInExSetState ( VOID EFIAPI EmuGopRegisterKeyCallback ( - IN EFI_EVENT Event, - IN VOID *Context + IN EFI_EVENT Event, + IN VOID *Context ) { - EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *ExNotify = (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *)Context; + EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *ExNotify = (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *)Context; ExNotify->KeyNotificationFn (&ExNotify->KeyData); } - - /** The RegisterKeystrokeNotify() function registers a function which will be called when a specified keystroke will occur. @@ -520,13 +510,13 @@ EmuGopSimpleTextInExRegisterKeyNotify ( OUT VOID **NotifyHandle ) { - EFI_STATUS Status; - GOP_PRIVATE_DATA *Private; - EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify; - LIST_ENTRY *Link; - EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NewNotify; + EFI_STATUS Status; + GOP_PRIVATE_DATA *Private; + EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify; + LIST_ENTRY *Link; + EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NewNotify; - if (KeyData == NULL || KeyNotificationFunction == NULL || NotifyHandle == NULL) { + if ((KeyData == NULL) || (KeyNotificationFunction == NULL) || (NotifyHandle == NULL)) { return EFI_INVALID_PARAMETER; } @@ -553,14 +543,14 @@ EmuGopSimpleTextInExRegisterKeyNotify ( // // Allocate resource to save the notification function // - NewNotify = (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) AllocateZeroPool (sizeof (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY)); + NewNotify = (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *)AllocateZeroPool (sizeof (EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY)); if (NewNotify == NULL) { return EFI_OUT_OF_RESOURCES; } NewNotify->Signature = EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE; NewNotify->KeyNotificationFn = KeyNotificationFunction; - NewNotify->NotifyHandle = (EFI_HANDLE) NewNotify; + NewNotify->NotifyHandle = (EFI_HANDLE)NewNotify; CopyMem (&NewNotify->KeyData, KeyData, sizeof (KeyData)); InsertTailList (&Private->NotifyList, &NewNotify->NotifyEntry); @@ -573,14 +563,11 @@ EmuGopSimpleTextInExRegisterKeyNotify ( ); ASSERT_EFI_ERROR (Status); - *NotifyHandle = NewNotify->NotifyHandle; return EFI_SUCCESS; - } - /** The UnregisterKeystrokeNotify() function removes the notification which was previously registered. @@ -602,6 +589,7 @@ EmuGopSimpleTextInExUnregisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN VOID *NotificationHandle ) + /*++ Routine Description: @@ -617,15 +605,15 @@ EmuGopSimpleTextInExUnregisterKeyNotify ( **/ { - GOP_PRIVATE_DATA *Private; - LIST_ENTRY *Link; - EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify; + GOP_PRIVATE_DATA *Private; + LIST_ENTRY *Link; + EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *CurrentNotify; if (NotificationHandle == NULL) { return EFI_INVALID_PARAMETER; } - if (((EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *) NotificationHandle)->Signature != EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE) { + if (((EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY *)NotificationHandle)->Signature != EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE) { return EFI_INVALID_PARAMETER; } @@ -657,8 +645,6 @@ EmuGopSimpleTextInExUnregisterKeyNotify ( return EFI_INVALID_PARAMETER; } - - /** Initialize SimplelTextIn and SimpleTextInEx protocols in the Private context structure. @@ -670,7 +656,7 @@ EmuGopSimpleTextInExUnregisterKeyNotify ( **/ EFI_STATUS EmuGopInitializeSimpleTextInForWindow ( - IN GOP_PRIVATE_DATA *Private + IN GOP_PRIVATE_DATA *Private ) { EFI_STATUS Status; @@ -690,7 +676,6 @@ EmuGopInitializeSimpleTextInForWindow ( ); ASSERT_EFI_ERROR (Status); - // // Initialize Simple Text In Ex // @@ -714,21 +699,13 @@ EmuGopInitializeSimpleTextInForWindow ( ); ASSERT_EFI_ERROR (Status); - return Status; } - - - - - - // // Simple Pointer implementation. // - /** Resets the pointer device hardware. @@ -744,13 +721,13 @@ EmuGopInitializeSimpleTextInForWindow ( EFI_STATUS EFIAPI EmuGopSimplePointerReset ( - IN EFI_SIMPLE_POINTER_PROTOCOL *This, - IN BOOLEAN ExtendedVerification + IN EFI_SIMPLE_POINTER_PROTOCOL *This, + IN BOOLEAN ExtendedVerification ) { - GOP_PRIVATE_DATA *Private; - EFI_SIMPLE_POINTER_STATE State; - EFI_TPL OldTpl; + GOP_PRIVATE_DATA *Private; + EFI_SIMPLE_POINTER_STATE State; + EFI_TPL OldTpl; Private = GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS (This); if (Private->EmuGraphicsWindow == NULL) { @@ -765,8 +742,8 @@ EmuGopSimplePointerReset ( // // A reset is draining the Queue // - while (Private->EmuGraphicsWindow->GetPointerState (Private->EmuGraphicsWindow, &State) == EFI_SUCCESS) - ; + while (Private->EmuGraphicsWindow->GetPointerState (Private->EmuGraphicsWindow, &State) == EFI_SUCCESS) { + } // // Leave critical section and return @@ -775,7 +752,6 @@ EmuGopSimplePointerReset ( return EFI_SUCCESS; } - /** Retrieves the current state of a pointer device. @@ -793,8 +769,8 @@ EmuGopSimplePointerReset ( EFI_STATUS EFIAPI EmuGopSimplePointerGetState ( - IN EFI_SIMPLE_POINTER_PROTOCOL *This, - IN OUT EFI_SIMPLE_POINTER_STATE *State + IN EFI_SIMPLE_POINTER_PROTOCOL *This, + IN OUT EFI_SIMPLE_POINTER_STATE *State ) { GOP_PRIVATE_DATA *Private; @@ -809,9 +785,9 @@ EmuGopSimplePointerGetState ( // // Enter critical section // - OldTpl = gBS->RaiseTPL (TPL_NOTIFY); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); - Status = Private->EmuGraphicsWindow->GetPointerState (Private->EmuGraphicsWindow, State); + Status = Private->EmuGraphicsWindow->GetPointerState (Private->EmuGraphicsWindow, State); // // Leave critical section and return // @@ -820,7 +796,6 @@ EmuGopSimplePointerGetState ( return Status; } - /** SimplePointer Notify Wait Event @@ -831,15 +806,15 @@ EmuGopSimplePointerGetState ( VOID EFIAPI EmuGopSimplePointerWaitForInput ( - IN EFI_EVENT Event, - IN VOID *Context + IN EFI_EVENT Event, + IN VOID *Context ) { GOP_PRIVATE_DATA *Private; EFI_STATUS Status; EFI_TPL OldTpl; - Private = (GOP_PRIVATE_DATA *) Context; + Private = (GOP_PRIVATE_DATA *)Context; if (Private->EmuGraphicsWindow == NULL) { return; } @@ -847,22 +822,22 @@ EmuGopSimplePointerWaitForInput ( // // Enter critical section // - OldTpl = gBS->RaiseTPL (TPL_NOTIFY); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); - Status = Private->EmuGraphicsWindow->CheckPointer (Private->EmuGraphicsWindow); + Status = Private->EmuGraphicsWindow->CheckPointer (Private->EmuGraphicsWindow); if (!EFI_ERROR (Status)) { // // If the pointer state has changed, signal our event. // gBS->SignalEvent (Event); } + // // Leave critical section and return // gBS->RestoreTPL (OldTpl); } - /** SimplePointer constructor @@ -873,7 +848,7 @@ EmuGopSimplePointerWaitForInput ( **/ EFI_STATUS EmuGopInitializeSimplePointerForWindow ( - IN GOP_PRIVATE_DATA *Private + IN GOP_PRIVATE_DATA *Private ) { EFI_STATUS Status; @@ -887,9 +862,9 @@ EmuGopInitializeSimplePointerForWindow ( Private->PointerMode.LeftButton = TRUE; Private->PointerMode.RightButton = TRUE; - Private->SimplePointer.Reset = EmuGopSimplePointerReset; - Private->SimplePointer.GetState = EmuGopSimplePointerGetState; - Private->SimplePointer.Mode = &Private->PointerMode; + Private->SimplePointer.Reset = EmuGopSimplePointerReset; + Private->SimplePointer.GetState = EmuGopSimplePointerGetState; + Private->SimplePointer.Mode = &Private->PointerMode; Status = gBS->CreateEvent ( EVT_NOTIFY_WAIT, diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c b/EmulatorPkg/EmuGopDxe/GopScreen.c index 05fd236151..41f748bc64 100644 --- a/EmulatorPkg/EmuGopDxe/GopScreen.c +++ b/EmulatorPkg/EmuGopDxe/GopScreen.c @@ -18,17 +18,15 @@ Abstract: #include "Gop.h" +EFI_EVENT mGopScreenExitBootServicesEvent; -EFI_EVENT mGopScreenExitBootServicesEvent; - -GOP_MODE_DATA mGopModeData[] = { - { 800, 600, 0, 0 }, - { 640, 480, 0, 0 }, - { 720, 400, 0, 0 }, - {1024, 768, 0, 0 }, - {1280, 1024, 0, 0 } - }; - +GOP_MODE_DATA mGopModeData[] = { + { 800, 600, 0, 0 }, + { 640, 480, 0, 0 }, + { 720, 400, 0, 0 }, + { 1024, 768, 0, 0 }, + { 1280, 1024, 0, 0 } +}; /** Returns information for an available graphics mode that the graphics device @@ -59,7 +57,7 @@ EmuGopQuerytMode ( Private = GOP_PRIVATE_DATA_FROM_THIS (This); - if (Info == NULL || SizeOfInfo == NULL || (UINTN) ModeNumber >= This->Mode->MaxMode) { + if ((Info == NULL) || (SizeOfInfo == NULL) || ((UINTN)ModeNumber >= This->Mode->MaxMode)) { return EFI_INVALID_PARAMETER; } @@ -70,17 +68,15 @@ EmuGopQuerytMode ( *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); - (*Info)->Version = 0; + (*Info)->Version = 0; (*Info)->HorizontalResolution = Private->ModeData[ModeNumber].HorizontalResolution; (*Info)->VerticalResolution = Private->ModeData[ModeNumber].VerticalResolution; - (*Info)->PixelFormat = PixelBltOnly; - (*Info)->PixelsPerScanLine = (*Info)->HorizontalResolution; + (*Info)->PixelFormat = PixelBltOnly; + (*Info)->PixelsPerScanLine = (*Info)->HorizontalResolution; return EFI_SUCCESS; } - - /** Set the video device into the specified mode and clears the visible portions of the output display to black. @@ -100,10 +96,10 @@ EmuGopSetMode ( IN UINT32 ModeNumber ) { - EFI_STATUS Status; - GOP_PRIVATE_DATA *Private; - GOP_MODE_DATA *ModeData; - EFI_GRAPHICS_OUTPUT_BLT_PIXEL Fill; + EFI_STATUS Status; + GOP_PRIVATE_DATA *Private; + GOP_MODE_DATA *ModeData; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL Fill; Private = GOP_PRIVATE_DATA_FROM_THIS (This); @@ -111,20 +107,20 @@ EmuGopSetMode ( return EFI_UNSUPPORTED; } - ModeData = &Private->ModeData[ModeNumber]; - This->Mode->Mode = ModeNumber; + ModeData = &Private->ModeData[ModeNumber]; + This->Mode->Mode = ModeNumber; Private->GraphicsOutput.Mode->Info->HorizontalResolution = ModeData->HorizontalResolution; - Private->GraphicsOutput.Mode->Info->VerticalResolution = ModeData->VerticalResolution; - Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution; + Private->GraphicsOutput.Mode->Info->VerticalResolution = ModeData->VerticalResolution; + Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution; if (Private->HardwareNeedsStarting) { Status = EmuGopStartWindow ( - Private, - ModeData->HorizontalResolution, - ModeData->VerticalResolution, - ModeData->ColorDepth, - ModeData->RefreshRate - ); + Private, + ModeData->HorizontalResolution, + ModeData->VerticalResolution, + ModeData->ColorDepth, + ModeData->RefreshRate + ); if (EFI_ERROR (Status)) { return EFI_DEVICE_ERROR; } @@ -132,13 +128,11 @@ EmuGopSetMode ( Private->HardwareNeedsStarting = FALSE; } - - Status = Private->EmuGraphicsWindow->Size( - Private->EmuGraphicsWindow, - ModeData->HorizontalResolution, - ModeData->VerticalResolution - ); - + Status = Private->EmuGraphicsWindow->Size ( + Private->EmuGraphicsWindow, + ModeData->HorizontalResolution, + ModeData->VerticalResolution + ); Fill.Red = 0; Fill.Green = 0; @@ -158,8 +152,6 @@ EmuGopSetMode ( return EFI_SUCCESS; } - - /** Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer. @@ -183,22 +175,22 @@ EmuGopSetMode ( EFI_STATUS EFIAPI EmuGopBlt ( - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, - IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, - IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, - IN UINTN SourceX, - IN UINTN SourceY, - IN UINTN DestinationX, - IN UINTN DestinationY, - IN UINTN Width, - IN UINTN Height, - IN UINTN Delta OPTIONAL + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, + IN UINTN SourceX, + IN UINTN SourceY, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height, + IN UINTN Delta OPTIONAL ) { - GOP_PRIVATE_DATA *Private; - EFI_TPL OriginalTPL; - EFI_STATUS Status; - EMU_GRAPHICS_WINDOWS__BLT_ARGS GopBltArgs; + GOP_PRIVATE_DATA *Private; + EFI_TPL OriginalTPL; + EFI_STATUS Status; + EMU_GRAPHICS_WINDOWS__BLT_ARGS GopBltArgs; Private = GOP_PRIVATE_DATA_FROM_THIS (This); @@ -206,9 +198,10 @@ EmuGopBlt ( return EFI_INVALID_PARAMETER; } - if (Width == 0 || Height == 0) { + if ((Width == 0) || (Height == 0)) { return EFI_INVALID_PARAMETER; } + // // If Delta is zero, then the entire BltBuffer is being used, so Delta // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size, @@ -236,19 +229,18 @@ EmuGopBlt ( GopBltArgs.SourceX = SourceX; GopBltArgs.SourceY = SourceY; GopBltArgs.Delta = Delta; - Status = Private->EmuGraphicsWindow->Blt ( - Private->EmuGraphicsWindow, - (EFI_UGA_PIXEL *)BltBuffer, - (EFI_UGA_BLT_OPERATION)BltOperation, - &GopBltArgs - ); + Status = Private->EmuGraphicsWindow->Blt ( + Private->EmuGraphicsWindow, + (EFI_UGA_PIXEL *)BltBuffer, + (EFI_UGA_BLT_OPERATION)BltOperation, + &GopBltArgs + ); gBS->RestoreTPL (OriginalTPL); return Status; } - // // Construction and Destruction functions // @@ -270,17 +262,16 @@ EmuGopSupported ( return EFI_SUCCESS; } - EFI_STATUS EmuGopStartWindow ( - IN GOP_PRIVATE_DATA *Private, - IN UINT32 HorizontalResolution, - IN UINT32 VerticalResolution, - IN UINT32 ColorDepth, - IN UINT32 RefreshRate + IN GOP_PRIVATE_DATA *Private, + IN UINT32 HorizontalResolution, + IN UINT32 VerticalResolution, + IN UINT32 ColorDepth, + IN UINT32 RefreshRate ) { - EFI_STATUS Status; + EFI_STATUS Status; // // Register to be notified on exit boot services so we can destroy the window. @@ -298,27 +289,28 @@ EmuGopStartWindow ( Private->EmuGraphicsWindow = Private->EmuIoThunk->Interface; // Register callback to support RegisterKeyNotify() - Status = Private->EmuGraphicsWindow->RegisterKeyNotify ( - Private->EmuGraphicsWindow, - GopPrivateMakeCallbackFunction, - GopPrivateBreakCallbackFunction, - Private - ); + Status = Private->EmuGraphicsWindow->RegisterKeyNotify ( + Private->EmuGraphicsWindow, + GopPrivateMakeCallbackFunction, + GopPrivateBreakCallbackFunction, + Private + ); ASSERT_EFI_ERROR (Status); } + return Status; } EFI_STATUS EmuGopConstructor ( - GOP_PRIVATE_DATA *Private + GOP_PRIVATE_DATA *Private ) { Private->ModeData = mGopModeData; - Private->GraphicsOutput.QueryMode = EmuGopQuerytMode; - Private->GraphicsOutput.SetMode = EmuGopSetMode; - Private->GraphicsOutput.Blt = EmuGopBlt; + Private->GraphicsOutput.QueryMode = EmuGopQuerytMode; + Private->GraphicsOutput.SetMode = EmuGopSetMode; + Private->GraphicsOutput.Blt = EmuGopBlt; // // Allocate buffer for Graphics Output Protocol mode information @@ -327,26 +319,27 @@ EmuGopConstructor ( if (Private->GraphicsOutput.Mode == NULL) { return EFI_OUT_OF_RESOURCES; } + Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)); if (Private->GraphicsOutput.Mode->Info == NULL) { return EFI_OUT_OF_RESOURCES; } - Private->GraphicsOutput.Mode->MaxMode = sizeof(mGopModeData) / sizeof(GOP_MODE_DATA); + Private->GraphicsOutput.Mode->MaxMode = sizeof (mGopModeData) / sizeof (GOP_MODE_DATA); // // Till now, we have no idea about the window size. // - Private->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER; - Private->GraphicsOutput.Mode->Info->Version = 0; + Private->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER; + Private->GraphicsOutput.Mode->Info->Version = 0; Private->GraphicsOutput.Mode->Info->HorizontalResolution = 0; - Private->GraphicsOutput.Mode->Info->VerticalResolution = 0; - Private->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly; - Private->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); - Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL; - Private->GraphicsOutput.Mode->FrameBufferSize = 0; + Private->GraphicsOutput.Mode->Info->VerticalResolution = 0; + Private->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly; + Private->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); + Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS)(UINTN)NULL; + Private->GraphicsOutput.Mode->FrameBufferSize = 0; - Private->HardwareNeedsStarting = TRUE; - Private->EmuGraphicsWindow = NULL; + Private->HardwareNeedsStarting = TRUE; + Private->EmuGraphicsWindow = NULL; EmuGopInitializeSimpleTextInForWindow (Private); @@ -355,11 +348,9 @@ EmuGopConstructor ( return EFI_SUCCESS; } - - EFI_STATUS EmuGopDestructor ( - GOP_PRIVATE_DATA *Private + GOP_PRIVATE_DATA *Private ) { if (!Private->HardwareNeedsStarting) { @@ -374,19 +365,20 @@ EmuGopDestructor ( if (Private->GraphicsOutput.Mode->Info != NULL) { FreePool (Private->GraphicsOutput.Mode->Info); } + FreePool (Private->GraphicsOutput.Mode); } return EFI_SUCCESS; } - VOID EFIAPI ShutdownGopEvent ( IN EFI_EVENT Event, IN VOID *Context ) + /*++ Routine Description: -- cgit v1.2.3