From: vanjeff Date: Wed, 1 Apr 2009 02:52:17 +0000 (+0000) Subject: 1. retired console control protocol. X-Git-Tag: edk2-stable201903~18269 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=9937b36506924de4b721f03addc50ed318474a5e 1. retired console control protocol. 2. removed NULL console device from consplitter module. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7995 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Include/Protocol/ConsoleControl.h b/MdeModulePkg/Include/Protocol/ConsoleControl.h deleted file mode 100644 index 1dd4babc4c..0000000000 --- a/MdeModulePkg/Include/Protocol/ConsoleControl.h +++ /dev/null @@ -1,101 +0,0 @@ -/** @file - - This protocol provides the interfaces to Get/Set the current video mode for GOP/UGA screen - -Copyright (c) 2006 - 2008, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __CONSOLE_CONTROL_H__ -#define __CONSOLE_CONTROL_H__ - -#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \ - { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21 } } - -typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL; - - -typedef enum { - EfiConsoleControlScreenText, ///> Text Mode - EfiConsoleControlScreenGraphics, ///> Graphics Mode - EfiConsoleControlScreenMaxValue -} EFI_CONSOLE_CONTROL_SCREEN_MODE; - -/** - Return the current video mode information. Also returns info about existence - of Graphics Output devices or UGA Draw devices in system, and whether the Std - In device is locked. GopUgaExists and StdInLocked parameters are optional, and - only returned if a non NULL pointer is passed in. - - @param This Protocol instance pointer. - @param Mode Current video mode. - @param GopUgaExists TRUE if GOP Spliter has found a GOP/UGA device - @param StdInLocked TRUE if StdIn device is keyboard locked - - @retval EFI_SUCCESS Video mode information is returned. - @retval EFI_INVALID_PARAMETER Invalid parameters if Mode == NULL. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE)( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode, - OUT BOOLEAN *GopUgaExists, OPTIONAL - OUT BOOLEAN *StdInLocked OPTIONAL - ); - -/** - Set the current video mode to either text or graphics. Graphics is - for Quiet Boot. - - @param This Protocol instance pointer. - @param Mode Video mode is to be set. - - @retval EFI_SUCCESS Mode is set successfully. - @retval EFI_INVALID_PARAMETER Mode is not the valid mode value. - @retval EFI_UNSUPPORTED Mode is unsupported by console device. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE)( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - OUT EFI_CONSOLE_CONTROL_SCREEN_MODE Mode - ); - -/** - If Password is NULL or the Password is too big, then return an error. If the - Password is valid, then store the password, lock StdIn and arm the periodic timer. - - @param This Protocol instance pointer. - @param Password The password input. - - @retval EFI_SUCCESS Lock the StdIn device. - @retval EFI_INVALID_PARAMETER Password is NULL. - @retval EFI_OUT_OF_RESOURCES Buffer allocation to store the password fails. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN)( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - IN CHAR16 *Password - ); - -struct _EFI_CONSOLE_CONTROL_PROTOCOL { - EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE GetMode; - EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE SetMode; - EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn; -}; - -extern EFI_GUID gEfiConsoleControlProtocolGuid; - -#endif diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 7571eb592a..95c7e7a583 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -150,10 +150,6 @@ ## Include/Protocol/GenericMemoryTest.h gEfiGenericMemTestProtocolGuid = { 0x309DE7F1, 0x7F5E, 0x4ACE, { 0xB4, 0x9C, 0x53, 0x1B, 0xE5, 0xAA, 0x95, 0xEF }} - ## This protocol provides the interfaces to Get/Set the current video mode for GOP/UGA screen - ## Include/Protocol/ConsoleControl.h - gEfiConsoleControlProtocolGuid = { 0xF42F7782, 0x012E, 0x4C12, { 0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21 }} - ## Include/Protocol/NicIp4Config.h gEfiNicIp4ConfigProtocolGuid = {0xdca3d4d, 0x12da, 0x4728, { 0xbf, 0x7e, 0x86, 0xce, 0xb9, 0x28, 0xd0, 0x67 }} diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 04ea719e59..7838c54a70 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -16,7 +16,7 @@ never removed. Such design ensures sytem function well during none console device situation. -Copyright (c) 2006 - 2008 Intel Corporation.
+Copyright (c) 2006 - 2009, Intel Corporation.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. GLOBAL_REMOVE_IF_UNREFERENCED TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE, (EFI_HANDLE) NULL, + { ConSplitterTextInReset, ConSplitterTextInReadKeyStroke, @@ -43,6 +44,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { 0, (EFI_SIMPLE_TEXT_INPUT_PROTOCOL **) NULL, 0, + { ConSplitterTextInResetEx, ConSplitterTextInReadKeyStrokeEx, @@ -82,7 +84,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { (EFI_EVENT) NULL, (EFI_ABSOLUTE_POINTER_MODE *) NULL }, - { 0, // AbsoluteMinX 0, // AbsoluteMinY @@ -97,22 +98,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { 0, FALSE, - FALSE, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - 0, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - (EFI_EVENT) NULL, - FALSE, FALSE }; @@ -164,6 +149,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = { 0, FALSE, }, + { NULL, NULL, @@ -173,35 +159,23 @@ GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = { 0, 0, 0, - (EFI_UGA_PIXEL *) NULL, + { NULL, NULL, NULL, NULL }, - (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL, (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *) NULL, 0, 0, TRUE, - { - ConSpliterConsoleControlGetMode, - ConSpliterConsoleControlSetMode, - ConSpliterConsoleControlLockStdIn - }, 0, (TEXT_OUT_AND_GOP_DATA *) NULL, 0, (TEXT_OUT_SPLITTER_QUERY_DATA *) NULL, 0, - (INT32 *) NULL, - - EfiConsoleControlScreenText, - 0, - 0, - (CHAR16 *) NULL, (INT32 *) NULL }; @@ -231,6 +205,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = { 0, FALSE, }, + { NULL, NULL, @@ -240,35 +215,23 @@ GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = { 0, 0, 0, - (EFI_UGA_PIXEL *) NULL, + { NULL, NULL, NULL, NULL }, - (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL, (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *) NULL, 0, 0, TRUE, - { - ConSpliterConsoleControlGetMode, - ConSpliterConsoleControlSetMode, - ConSpliterConsoleControlLockStdIn - }, 0, (TEXT_OUT_AND_GOP_DATA *) NULL, 0, (TEXT_OUT_SPLITTER_QUERY_DATA *) NULL, 0, - (INT32 *) NULL, - - EfiConsoleControlScreenText, - 0, - 0, - (CHAR16 *) NULL, (INT32 *) NULL }; @@ -474,8 +437,6 @@ ConSplitterDriverEntry( &mConOut.TextOut, &gEfiUgaDrawProtocolGuid, &mConOut.UgaDraw, - &gEfiConsoleControlProtocolGuid, - &mConOut.ConsoleControl, NULL ); } else if (!FeaturePcdGet (PcdConOutUgaSupport)) { @@ -489,8 +450,6 @@ ConSplitterDriverEntry( &mConOut.TextOut, &gEfiGraphicsOutputProtocolGuid, &mConOut.GraphicsOutput, - &gEfiConsoleControlProtocolGuid, - &mConOut.ConsoleControl, NULL ); } else { @@ -506,8 +465,6 @@ ConSplitterDriverEntry( &mConOut.GraphicsOutput, &gEfiUgaDrawProtocolGuid, &mConOut.UgaDraw, - &gEfiConsoleControlProtocolGuid, - &mConOut.ConsoleControl, NULL ); } @@ -565,17 +522,7 @@ ConSplitterTextInConstructor ( if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } - // - // Create Event to support locking StdIn Device - // - Status = gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - ConSpliterConsoleControlLockStdInEvent, - NULL, - &ConInPrivate->LockEvent - ); - ASSERT_EFI_ERROR (Status); + // // Create Event to wait for a key // @@ -725,15 +672,16 @@ ConSplitterTextOutConstructor ( } // - // Setup the DevNullTextOut console to 80 x 25 + // Setup the default console to 80 x 25 and mode to 0 // ConOutPrivate->TextOutQueryData[0].Columns = 80; ConOutPrivate->TextOutQueryData[0].Rows = 25; - DevNullTextOutSetMode (ConOutPrivate, 0); + TextOutSetMode (ConOutPrivate, 0); + if (FeaturePcdGet (PcdConOutUgaSupport)) { // - // Setup the DevNullUgaDraw to 800 x 600 x 32 bits per pixel, 60Hz. + // Setup the UgaDraw to 800 x 600 x 32 bits per pixel, 60Hz. // ConSpliterUgaDrawSetMode (&ConOutPrivate->UgaDraw, 800, 600, 32, 60); } @@ -2974,7 +2922,6 @@ ConSplitterTextOutAddDevice ( { EFI_STATUS Status; UINTN CurrentNumOfConsoles; - INT32 CurrentMode; INT32 MaxMode; UINT32 UgaHorizontalResolution; UINT32 UgaVerticalResolution; @@ -3014,18 +2961,6 @@ ConSplitterTextOutAddDevice ( TextAndGop->GraphicsOutput = GraphicsOutput; TextAndGop->UgaDraw = UgaDraw; - if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) { - // - // If No GOP/UGA device then use the ConOut device - // - TextAndGop->TextOutEnabled = TRUE; - } else { - // - // If GOP/UGA device use ConOut device only used if screen is in Text mode - // - TextAndGop->TextOutEnabled = (BOOLEAN) (Private->ConsoleOutputMode == EfiConsoleControlScreenText); - } - if (CurrentNumOfConsoles == 0) { // // Add the first device's output mode to console splitter's mode list @@ -3044,7 +2979,6 @@ ConSplitterTextOutAddDevice ( // ConSplitterGetIntersectionBetweenConOutAndStrErr (); - CurrentMode = Private->TextOutMode.Mode; MaxMode = Private->TextOutMode.MaxMode; ASSERT (MaxMode >= 1); @@ -3102,32 +3036,10 @@ ConSplitterTextOutAddDevice ( ); } - if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) { - // - // We just added a new GOP or UGA device in graphics mode - // - if (FeaturePcdGet (PcdConOutGopSupport)) { - // - // Sync display output on new device based on GOP settings. - // - DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw); - } else if (FeaturePcdGet (PcdConOutUgaSupport)) { - // - // Sync display output on new device based on UGA settings. - // - DevNullUgaSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw); - } - } else if ((CurrentMode >= 0) && ((GraphicsOutput != NULL) || (UgaDraw != NULL)) && (CurrentMode < Private->TextOutMode.MaxMode)) { - // - // The new console supports the same mode of the current console so sync up - // - DevNullSyncStdOut (Private); - } else { - // - // If ConOut, then set the mode to Mode #0 which us 80 x 25 - // - Private->TextOut.SetMode (&Private->TextOut, 0); - } + // + // If ConOut, then set the mode to Mode #0 which us 80 x 25 + // + Private->TextOut.SetMode (&Private->TextOut, 0); // // After adding new console device, all existing console devices should be @@ -3192,13 +3104,13 @@ ConSplitterTextOutDeleteDevice ( if (CurrentNumOfConsoles == 0) { // - // If the number of consoles is zero clear the Dev NULL device + // If the number of consoles is zero, reset all parameters // Private->CurrentNumberOfConsoles = 0; Private->TextOutMode.MaxMode = 1; Private->TextOutQueryData[0].Columns = 80; Private->TextOutQueryData[0].Rows = 25; - DevNullTextOutSetMode (Private, 0); + TextOutSetMode (Private, 0); return EFI_SUCCESS; } @@ -3330,157 +3242,10 @@ ConSplitterTextInPrivateReadKeyStroke ( return EFI_NOT_READY; } -/** - Return TRUE if StdIn is locked. The ConIn device on the virtual handle is - the only device locked. - - @retval TRUE StdIn locked - @retval FALSE StdIn working normally - -**/ -BOOLEAN -ConSpliterConssoleControlStdInLocked ( - VOID - ) -{ - return mConIn.PasswordEnabled; -} - - -/** - Record and check key sequence on StdIn. - - This timer event will fire when StdIn is locked. It will record the key sequence - on StdIn and also check to see if it matches the password. Any error in the - password will cause the check to reset. As long as a mConIn.PasswordEnabled is - TRUE, the StdIn splitter will not report any input. - - @param Event The Event this notify function registered to. - @param Context Pointer to the context data registerd to the - Event. -**/ -VOID -EFIAPI -ConSpliterConsoleControlLockStdInEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - EFI_STATUS Status; - EFI_INPUT_KEY Key; - CHAR16 BackSpaceString[2]; - CHAR16 SpaceString[2]; - - do { - Status = ConSplitterTextInPrivateReadKeyStroke (&mConIn, &Key); - if (!EFI_ERROR (Status)) { - // - // If key read successfully - // - if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN) && (Key.ScanCode == SCAN_NULL)) { - // - // If it's an ENTER, match password - // - mConIn.PwdAttempt[mConIn.PwdIndex] = CHAR_NULL; - if (StrCmp (mConIn.Password, mConIn.PwdAttempt) != 0) { - // - // Password not match - // - ConSplitterTextOutOutputString (&mConOut.TextOut, (CHAR16 *) L"\n\rPassword not correct\n\r"); - mConIn.PwdIndex = 0; - } else { - // - // Key matches password sequence - // - gBS->SetTimer (mConIn.LockEvent, TimerPeriodic, 0); - mConIn.PasswordEnabled = FALSE; - Status = EFI_NOT_READY; - } - } else if ((Key.UnicodeChar == CHAR_BACKSPACE) && (Key.ScanCode == SCAN_NULL)) { - // - // BackSpace met - // - if (mConIn.PwdIndex > 0) { - BackSpaceString[0] = CHAR_BACKSPACE; - BackSpaceString[1] = 0; - - SpaceString[0] = L' '; - SpaceString[1] = 0; - - ConSplitterTextOutOutputString (&mConOut.TextOut, BackSpaceString); - ConSplitterTextOutOutputString (&mConOut.TextOut, SpaceString); - ConSplitterTextOutOutputString (&mConOut.TextOut, BackSpaceString); - - mConIn.PwdIndex--; - } - } else if ((Key.ScanCode == SCAN_NULL) && (Key.UnicodeChar >= 32)) { - // - // If it's not an ENTER, neigher a function key, nor a CTRL-X or ALT-X, record the input, - // value 32 stands for a Blank Space key. - // - if (mConIn.PwdIndex < (MAX_STD_IN_PASSWORD - 1)) { - if (mConIn.PwdIndex == 0) { - ConSplitterTextOutOutputString (&mConOut.TextOut, (CHAR16 *) L"\n\r"); - } - - ConSplitterTextOutOutputString (&mConOut.TextOut, (CHAR16 *) L"*"); - mConIn.PwdAttempt[mConIn.PwdIndex] = Key.UnicodeChar; - mConIn.PwdIndex++; - } - } - } - } while (!EFI_ERROR (Status)); -} - - -/** - If Password is NULL or the Password is too big, then return an error. If the - Password is valid, then store the password, lock StdIn and arm the periodic timer. - - @param This Console Control protocol pointer. - @param Password The password input. - - @retval EFI_SUCCESS Lock the StdIn device. - @retval EFI_INVALID_PARAMETER Password is NULL. - @retval EFI_OUT_OF_RESOURCES Buffer allocation to store the password fails. - -**/ -EFI_STATUS -EFIAPI -ConSpliterConsoleControlLockStdIn ( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - IN CHAR16 *Password - ) -{ - if (Password == NULL) { - return EFI_INVALID_PARAMETER; - } - - if (StrLen (Password) >= MAX_STD_IN_PASSWORD) { - // - // Currently have a max password size - // - return EFI_OUT_OF_RESOURCES; - } - // - // Save the password, initialize state variables and arm event timer - // - StrCpy (mConIn.Password, Password); - mConIn.PasswordEnabled = TRUE; - mConIn.PwdIndex = 0; - // - // Lock Timer Periodic is 25ms. - // - gBS->SetTimer (mConIn.LockEvent, TimerPeriodic, 10000 * 25); - - return EFI_SUCCESS; -} - /** Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existance of a keystroke via WaitForEvent () call. - If the ConIn is password locked make it look like no keystroke is availible @param This Protocol instance pointer. @param Key Driver may perform diagnostics on reset. @@ -3501,12 +3266,6 @@ ConSplitterTextInReadKeyStroke ( TEXT_IN_SPLITTER_PRIVATE_DATA *Private; Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS (This); - if (Private->PasswordEnabled) { - // - // If StdIn Locked return not ready - // - return EFI_NOT_READY; - } Private->KeyEventSignalState = FALSE; @@ -3517,7 +3276,6 @@ ConSplitterTextInReadKeyStroke ( /** This event aggregates all the events of the ConIn devices in the spliter. - If the ConIn is password locked then return. If any events of physical ConIn devices are signaled, signal the ConIn spliter event. This will cause the calling code to call ConSplitterTextInReadKeyStroke (). @@ -3539,13 +3297,6 @@ ConSplitterTextInWaitForKey ( Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context; - if (Private->PasswordEnabled) { - // - // If StdIn Locked return not ready - // - return ; - } - if (Private->KeyEventSignalState) { // // If KeyEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke() @@ -3691,12 +3442,6 @@ ConSplitterTextInReadKeyStrokeEx ( } Private = TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS (This); - if (Private->PasswordEnabled) { - // - // If StdIn Locked return not ready - // - return EFI_NOT_READY; - } Private->KeyEventSignalState = FALSE; @@ -4076,7 +3821,6 @@ ConSplitterSimplePointerPrivateGetState ( /** Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existance of a keystroke via WaitForEvent () call. - If the ConIn is password locked make it look like no keystroke is availible @param This A pointer to protocol instance. @param State A pointer to state information on the pointer device @@ -4097,12 +3841,6 @@ ConSplitterSimplePointerGetState ( TEXT_IN_SPLITTER_PRIVATE_DATA *Private; Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_SIMPLE_POINTER_THIS (This); - if (Private->PasswordEnabled) { - // - // If StdIn Locked return not ready - // - return EFI_NOT_READY; - } Private->InputEventSignalState = FALSE; @@ -4112,7 +3850,6 @@ ConSplitterSimplePointerGetState ( /** This event agregates all the events of the ConIn devices in the spliter. - If the ConIn is password locked then return. If any events of physical ConIn devices are signaled, signal the ConIn spliter event. This will cause the calling code to call ConSplitterTextInReadKeyStroke (). @@ -4133,12 +3870,6 @@ ConSplitterSimplePointerWaitForInput ( UINTN Index; Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context; - if (Private->PasswordEnabled) { - // - // If StdIn Locked return not ready - // - return ; - } // // if InputEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke() @@ -4236,12 +3967,6 @@ ConSplitterAbsolutePointerGetState ( Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This); - if (Private->PasswordEnabled) { - // - // If StdIn Locked return not ready - // - return EFI_NOT_READY; - } Private->AbsoluteInputEventSignalState = FALSE; @@ -4290,7 +4015,6 @@ ConSplitterAbsolutePointerGetState ( /** This event agregates all the events of the pointer devices in the splitter. - If the ConIn is password locked then return. If any events of physical pointer devices are signaled, signal the pointer splitter event. This will cause the calling code to call ConSplitterAbsolutePointerGetState (). @@ -4311,12 +4035,6 @@ ConSplitterAbsolutePointerWaitForInput ( UINTN Index; Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context; - if (Private->PasswordEnabled) { - // - // If StdIn Locked return not ready - // - return ; - } // // if AbsoluteInputEventSignalState is flagged before, @@ -4369,25 +4087,21 @@ ConSplitterTextOutReset ( // return the worst status met // for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { - - if (Private->TextOutList[Index].TextOutEnabled) { - - Status = Private->TextOutList[Index].TextOut->Reset ( - Private->TextOutList[Index].TextOut, - ExtendedVerification - ); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + Status = Private->TextOutList[Index].TextOut->Reset ( + Private->TextOutList[Index].TextOut, + ExtendedVerification + ); + if (EFI_ERROR (Status)) { + ReturnStatus = Status; } } This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BLACK)); - Status = DevNullTextOutSetMode (Private, 0); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + // + // reset all mode parameters + // + TextOutSetMode (Private, 0); return ReturnStatus; } @@ -4449,24 +4163,19 @@ ConSplitterTextOutOutputString ( // // return the worst status met // - Status = DevNullTextOutOutputString (Private, TargetString); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } - for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { - - if (Private->TextOutList[Index].TextOutEnabled) { - Status = Private->TextOutList[Index].TextOut->OutputString ( - Private->TextOutList[Index].TextOut, - TargetString - ); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + Status = Private->TextOutList[Index].TextOut->OutputString ( + Private->TextOutList[Index].TextOut, + TargetString + ); + if (EFI_ERROR (Status)) { + ReturnStatus = Status; } } + Private->TextOutMode.CursorColumn = Private->TextOutList[0].TextOut->Mode->CursorColumn; + Private->TextOutMode.CursorRow = Private->TextOutList[0].TextOut->Mode->CursorRow; + if (BackSpaceCount > 0) { FreePool (TargetString); } @@ -4508,14 +4217,12 @@ ConSplitterTextOutTestString ( // return the worst status met // for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { - if (Private->TextOutList[Index].TextOutEnabled) { - Status = Private->TextOutList[Index].TextOut->TestString ( - Private->TextOutList[Index].TextOut, - WString - ); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + Status = Private->TextOutList[Index].TextOut->TestString ( + Private->TextOutList[Index].TextOut, + WString + ); + if (EFI_ERROR (Status)) { + ReturnStatus = Status; } } // @@ -4642,32 +4349,27 @@ ConSplitterTextOutSetMode ( // TextOutModeMap = Private->TextOutModeMap + Private->TextOutListCount * ModeNumber; for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { + Status = Private->TextOutList[Index].TextOut->SetMode ( + Private->TextOutList[Index].TextOut, + TextOutModeMap[Index] + ); + // + // If this console device is based on a GOP or UGA device, then sync up the bitmap from + // the GOP/UGA splitter and reclear the text portion of the display in the new mode. + // + if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) { + Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut); + } - if (Private->TextOutList[Index].TextOutEnabled) { - Status = Private->TextOutList[Index].TextOut->SetMode ( - Private->TextOutList[Index].TextOut, - TextOutModeMap[Index] - ); - // - // If this console device is based on a GOP or UGA device, then sync up the bitmap from - // the GOP/UGA splitter and reclear the text portion of the display in the new mode. - // - if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) { - Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut); - } - - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + if (EFI_ERROR (Status)) { + ReturnStatus = Status; } } + // - // The DevNull Console will support any possible mode as it allocates memory + // Set mode parameter to specified mode number // - Status = DevNullTextOutSetMode (Private, ModeNumber); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + TextOutSetMode (Private, ModeNumber); return ReturnStatus; } @@ -4715,15 +4417,12 @@ ConSplitterTextOutSetAttribute ( // return the worst status met // for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { - - if (Private->TextOutList[Index].TextOutEnabled) { - Status = Private->TextOutList[Index].TextOut->SetAttribute ( - Private->TextOutList[Index].TextOut, - Attribute - ); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + Status = Private->TextOutList[Index].TextOut->SetAttribute ( + Private->TextOutList[Index].TextOut, + Attribute + ); + if (EFI_ERROR (Status)) { + ReturnStatus = Status; } } @@ -4762,19 +4461,20 @@ ConSplitterTextOutClearScreen ( // return the worst status met // for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { - - if (Private->TextOutList[Index].TextOutEnabled) { - Status = Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + Status = Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut); + if (EFI_ERROR (Status)) { + ReturnStatus = Status; } } - Status = DevNullTextOutClearScreen (Private); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + // + // No need to do extra check here as whether (Column, Row) is valid has + // been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should + // always be supported. + // + Private->TextOutMode.CursorColumn = 0; + Private->TextOutMode.CursorRow = 0; + Private->TextOutMode.CursorVisible = TRUE; return ReturnStatus; } @@ -4841,20 +4541,23 @@ ConSplitterTextOutSetCursorPosition ( // return the worst status met // for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { - - if (Private->TextOutList[Index].TextOutEnabled) { - Status = Private->TextOutList[Index].TextOut->SetCursorPosition ( - Private->TextOutList[Index].TextOut, - Column, - Row - ); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + Status = Private->TextOutList[Index].TextOut->SetCursorPosition ( + Private->TextOutList[Index].TextOut, + Column, + Row + ); + if (EFI_ERROR (Status)) { + ReturnStatus = Status; } } - DevNullTextOutSetCursorPosition (Private, Column, Row); + // + // No need to do extra check here as whether (Column, Row) is valid has + // been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should + // always be supported. + // + Private->TextOutMode.CursorColumn = (INT32) Column; + Private->TextOutMode.CursorRow = (INT32) Row; return ReturnStatus; } @@ -4892,19 +4595,16 @@ ConSplitterTextOutEnableCursor ( // return the worst status met // for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) { - - if (Private->TextOutList[Index].TextOutEnabled) { - Status = Private->TextOutList[Index].TextOut->EnableCursor ( - Private->TextOutList[Index].TextOut, - Visible - ); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } + Status = Private->TextOutList[Index].TextOut->EnableCursor ( + Private->TextOutList[Index].TextOut, + Visible + ); + if (EFI_ERROR (Status)) { + ReturnStatus = Status; } } - DevNullTextOutEnableCursor (Private, Visible); + Private->TextOutMode.CursorVisible = Visible; return ReturnStatus; } diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h index 0069405242..3bfa24548a 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h @@ -1,7 +1,7 @@ /** @file Private data structures for the Console Splitter driver -Copyright (c) 2006 - 2008 Intel Corporation.
+Copyright (c) 2006 - 2009, Intel Corporation.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -20,7 +20,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include @@ -77,7 +76,6 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2; // #define CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT 32 #define CONSOLE_SPLITTER_MODES_ALLOC_UNIT 32 -#define MAX_STD_IN_PASSWORD 80 typedef struct { @@ -146,12 +144,6 @@ typedef struct { UINTN AbsolutePointerListCount; BOOLEAN AbsoluteInputEventSignalState; - BOOLEAN PasswordEnabled; - CHAR16 Password[MAX_STD_IN_PASSWORD]; - UINTN PwdIndex; - CHAR16 PwdAttempt[MAX_STD_IN_PASSWORD]; - EFI_EVENT LockEvent; - BOOLEAN KeyEventSignalState; BOOLEAN InputEventSignalState; } TEXT_IN_SPLITTER_PRIVATE_DATA; @@ -190,7 +182,6 @@ typedef struct { EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; EFI_UGA_DRAW_PROTOCOL *UgaDraw; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; - BOOLEAN TextOutEnabled; } TEXT_OUT_AND_GOP_DATA; // @@ -207,17 +198,13 @@ typedef struct { UINT32 UgaVerticalResolution; UINT32 UgaColorDepth; UINT32 UgaRefreshRate; - EFI_UGA_PIXEL *UgaBlt; EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput; - EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GraphicsOutputBlt; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GraphicsOutputModeBuffer; UINTN CurrentNumberOfGraphicsOutput; UINTN CurrentNumberOfUgaDraw; BOOLEAN HardwareNeedsStarting; - EFI_CONSOLE_CONTROL_PROTOCOL ConsoleControl; - UINTN CurrentNumberOfConsoles; TEXT_OUT_AND_GOP_DATA *TextOutList; UINTN TextOutListCount; @@ -225,13 +212,6 @@ typedef struct { UINTN TextOutQueryDataCount; INT32 *TextOutModeMap; - EFI_CONSOLE_CONTROL_SCREEN_MODE ConsoleOutputMode; - - UINTN DevNullColumns; - UINTN DevNullRows; - CHAR16 *DevNullScreen; - INT32 *DevNullAttributes; - } TEXT_OUT_SPLITTER_PRIVATE_DATA; #define TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \ @@ -713,7 +693,7 @@ ConSplitterAbsolutePointerGetState ( /** This event agregates all the events of the pointer devices in the splitter. - If the ConIn is password locked then return. + If any events of physical pointer devices are signaled, signal the pointer splitter event. This will cause the calling code to call ConSplitterAbsolutePointerGetState (). @@ -1283,7 +1263,6 @@ ConSplitterTextInReset ( /** Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existance of a keystroke via WaitForEvent () call. - If the ConIn is password locked make it look like no keystroke is availible @param This Protocol instance pointer. @param Key Driver may perform diagnostics on reset. @@ -1455,7 +1434,6 @@ ConSplitterTextInUnregisterKeyNotify ( /** This event aggregates all the events of the ConIn devices in the spliter. - If the ConIn is password locked then return. If any events of physical ConIn devices are signaled, signal the ConIn spliter event. This will cause the calling code to call ConSplitterTextInReadKeyStroke (). @@ -1471,57 +1449,6 @@ ConSplitterTextInWaitForKey ( IN VOID *Context ); -/** - Return TRUE if StdIn is locked. The ConIn device on the virtual handle is - the only device locked. - - @retval TRUE StdIn locked - @retval FALSE StdIn working normally - -**/ -BOOLEAN -ConSpliterConssoleControlStdInLocked ( - VOID - ); - -/** - Record and check key sequence on StdIn. - - This timer event will fire when StdIn is locked. It will record the key sequence - on StdIn and also check to see if it matches the password. Any error in the - password will cause the check to reset. As long as a mConIn.PasswordEnabled is - TRUE, the StdIn splitter will not report any input. - - @param Event The Event this notify function registered to. - @param Context Pointer to the context data registerd to the - Event. -**/ -VOID -EFIAPI -ConSpliterConsoleControlLockStdInEvent ( - IN EFI_EVENT Event, - IN VOID *Context - ); - -/** - If Password is NULL unlock the password state variable and set the event - timer. If the Password is too big return an error. If the Password is valid - Copy the Password and enable state variable and then arm the periodic timer - - @param This Console Control protocol pointer. - @param Password The password input. - - @retval EFI_SUCCESS Lock the StdIn device - @retval EFI_INVALID_PARAMETER Password is NULL - @retval EFI_OUT_OF_RESOURCES Buffer allocation to store the password fails - -**/ -EFI_STATUS -EFIAPI -ConSpliterConsoleControlLockStdIn ( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - IN CHAR16 *Password - ); /** Reads the next keystroke from the input device. The WaitForKey Event can @@ -1564,7 +1491,6 @@ ConSplitterSimplePointerReset ( /** Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existance of a keystroke via WaitForEvent () call. - If the ConIn is password locked make it look like no keystroke is availible @param This A pointer to protocol instance. @param State A pointer to state information on the pointer device @@ -1584,7 +1510,6 @@ ConSplitterSimplePointerGetState ( /** This event agregates all the events of the ConIn devices in the spliter. - If the ConIn is password locked then return. If any events of physical ConIn devices are signaled, signal the ConIn spliter event. This will cause the calling code to call ConSplitterTextInReadKeyStroke (). @@ -1829,48 +1754,6 @@ ConSplitterGrowBuffer ( IN OUT VOID **Buffer ); -/** - Return the current video mode information. Also returns info about existence - of Graphics Output devices or UGA Draw devices in system, and if the Std In device is locked. All the - arguments are optional and only returned if a non NULL pointer is passed in. - - @param This Protocol instance pointer. - @param Mode Are we in text of grahics mode. - @param GopUgaExists TRUE if Console Spliter has found a GOP or UGA device - @param StdInLocked TRUE if StdIn device is keyboard locked - - @retval EFI_SUCCESS Mode information returned. - @retval EFI_INVALID_PARAMETER Invalid parameters. - -**/ -EFI_STATUS -EFIAPI -ConSpliterConsoleControlGetMode ( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode, - OUT BOOLEAN *GopUgaExists, - OUT BOOLEAN *StdInLocked - ); - -/** - Set the current mode to either text or graphics. Graphics is - for Quiet Boot. - - @param This Console Control Protocol instance pointer. - @param Mode Mode to set. - - @retval EFI_SUCCESS Mode information returned. - @retval EFI_INVALID_PARAMETER Invalid parameter. - @retval EFI_UNSUPPORTED Operation unsupported. - -**/ -EFI_STATUS -EFIAPI -ConSpliterConsoleControlSetMode ( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode - ); - /** Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. @@ -1978,26 +1861,6 @@ ConSpliterGraphicsOutputBlt ( IN UINTN Delta OPTIONAL ); -/** - Write data from the buffer to video display based on Graphics Output setting. - - @param Private Consplitter Text Out pointer. - @param GraphicsOutput Graphics Output protocol pointer. - @param UgaDraw UGA Draw protocol pointer. - - @retval EFI_UNSUPPORTED No graphics devcie available . - @retval EFI_SUCCESS The Blt operation completed. - @retval EFI_INVALID_PARAMETER BltOperation is not valid. - @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer. - - -**/ -EFI_STATUS -DevNullGopSync ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput, - IN EFI_UGA_DRAW_PROTOCOL *UgaDraw - ); /** Return the current video mode information. @@ -2111,138 +1974,18 @@ ConSpliterUgaDrawBlt ( IN UINTN Delta OPTIONAL ); -/** - Write data from the buffer to video display based on UGA Draw setting. - - @param Private Consplitter Text Out pointer. - @param GraphicsOutput Graphics Output protocol pointer. - @param UgaDraw UGA Draw protocol pointer. - - @retval EFI_UNSUPPORTED No graphics devcie available . - @retval EFI_SUCCESS The Blt operation completed. - @retval EFI_INVALID_PARAMETER BltOperation is not valid. - @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer. - -**/ -EFI_STATUS -DevNullUgaSync ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput, - IN EFI_UGA_DRAW_PROTOCOL *UgaDraw - ); - -/** - Write a Unicode string to the output device. - - @param Private Pointer to the console output splitter's private - data. It indicates the calling context. - @param WString The NULL-terminated Unicode string to be - displayed on the output device(s). All output - devices must also support the Unicode drawing - defined in this file. - - @retval EFI_SUCCESS The string was output to the device. - @retval EFI_DEVICE_ERROR The device reported an error while attempting to - output the text. - @retval EFI_UNSUPPORTED The output device's mode is not currently in a - defined text mode. - @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the - characters in the Unicode string could not be - rendered and were skipped. - -**/ -EFI_STATUS -DevNullTextOutOutputString ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN CHAR16 *WString - ); - /** Sets the output device(s) to a specified mode. @param Private Text Out Splitter pointer. @param ModeNumber The mode number to set. - @retval EFI_SUCCESS The requested text mode was set. - @retval EFI_DEVICE_ERROR The device had an error and could not complete - the request. - @retval EFI_UNSUPPORTED The mode number was not valid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - **/ -EFI_STATUS -DevNullTextOutSetMode ( +VOID +TextOutSetMode ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, IN UINTN ModeNumber ); -/** - Clears the output device(s) display to the currently selected background - color. - - @param Private Text Out Splitter pointer. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR The device had an error and could not complete - the request. - @retval EFI_UNSUPPORTED The output device is not in a valid text mode. - -**/ -EFI_STATUS -DevNullTextOutClearScreen ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private - ); - -/** - Sets the current coordinates of the cursor position on NULL device. - - @param Private Text Out Splitter pointer. - @param Column The column position to set the cursor to. Must be - greater than or equal to zero and less than the - number of columns by QueryMode (). - @param Row The row position to set the cursor to. Must be - greater than or equal to zero and less than the - number of rows by QueryMode (). - - @retval EFI_SUCCESS Always returned. - -**/ -EFI_STATUS -DevNullTextOutSetCursorPosition ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN UINTN Column, - IN UINTN Row - ); - -/** - Set cursor visibility property on NULL device. - - @param Private Text Out Splitter pointer. - @param Visible If TRUE, the cursor is set to be visible, If - FALSE, the cursor is set to be invisible. - - @retval EFI_SUCCESS Always returned. - -**/ -EFI_STATUS -DevNullTextOutEnableCursor ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN BOOLEAN Visible - ); - -/** - Take the DevNull TextOut device and update the Simple Text Out on every - UGA device. - - @param Private Text Out Splitter pointer. - - @retval EFI_SUCCESS The request is valid. - @retval other Return status of TextOut->OutputString () - -**/ -EFI_STATUS -DevNullSyncStdOut ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private - ); #endif diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf index fcb42475f1..0d6ac27cb7 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf @@ -10,7 +10,7 @@ # Note: If only UGA Draw protocol is installed in system table, PcdUgaConsumeSupport # should be set to TRUE. # -# Copyright (c) 2006 - 2008, Intel Corporation +# Copyright (c) 2006 - 2009, Intel Corporation # # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -76,7 +76,6 @@ [Protocols] - gEfiConsoleControlProtocolGuid ## PRODUCES gEfiSimplePointerProtocolGuid ## BY_START gEfiAbsolutePointerProtocolGuid ## BY_START gEfiSimpleTextInProtocolGuid ## BY_START @@ -95,10 +94,3 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn -# [Event] -# ## -# # mConIn.LockEvent, used to record and check key sequence on StdIn. Periodic is 25ms. -# # -# EVENT_TYPE_PREIODIC_TIMER ## PRODUCES -# -# \ No newline at end of file diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c index 4ffffdbb54..31b8468e05 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c @@ -1,10 +1,7 @@ /** @file - Support for ConsoleControl protocol. Support for Graphics output spliter. - Support for DevNull Console Out. This console uses memory buffers - to represnt the console. It allows a console to start very early and - when a new console is added it is synced up with the current console. - -Copyright (c) 2006 - 2008, Intel Corporation.
+ Support for Graphics output spliter. + +Copyright (c) 2006 - 2009, Intel Corporation.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -21,135 +18,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL }; - -/** - Return the current video mode information. Also returns info about existence - of Graphics Output devices or UGA Draw devices in system, and whether the Std - In device is locked. GopUgaExists and StdInLocked parameters are optional, and - only returned if a non NULL pointer is passed in. - - @param This Protocol instance pointer. - @param Mode Current video mode. - @param GopUgaExists TRUE if GOP Spliter has found a GOP/UGA device - @param StdInLocked TRUE if StdIn device is keyboard locked - - @retval EFI_SUCCESS Video mode information is returned. - @retval EFI_INVALID_PARAMETER Invalid parameters if Mode == NULL. - -**/ -EFI_STATUS -EFIAPI -ConSpliterConsoleControlGetMode ( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode, - OUT BOOLEAN *GopUgaExists, - OUT BOOLEAN *StdInLocked - ) -{ - TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; - UINTN Index; - - Private = CONSOLE_CONTROL_SPLITTER_PRIVATE_DATA_FROM_THIS (This); - - if (Mode == NULL) { - return EFI_INVALID_PARAMETER; - } - - *Mode = Private->ConsoleOutputMode; - - if (GopUgaExists != NULL) { - *GopUgaExists = FALSE; - for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) { - if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) { - *GopUgaExists = TRUE; - break; - } - } - } - - if (StdInLocked != NULL) { - *StdInLocked = ConSpliterConssoleControlStdInLocked (); - } - - return EFI_SUCCESS; -} - - -/** - Set the current video mode to either text or graphics. Graphics is - for Quiet Boot. - - @param This Console Control Protocol instance pointer. - @param Mode Video mode is to be set. - - @retval EFI_SUCCESS Mode is set successfully. - @retval EFI_INVALID_PARAMETER Mode is not the valid mode value. - @retval EFI_UNSUPPORTED Mode is unsupported by console device. - -**/ -EFI_STATUS -EFIAPI -ConSpliterConsoleControlSetMode ( - IN EFI_CONSOLE_CONTROL_PROTOCOL *This, - IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode - ) -{ - TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; - UINTN Index; - TEXT_OUT_AND_GOP_DATA *TextAndGop; - BOOLEAN Supported; - - Private = CONSOLE_CONTROL_SPLITTER_PRIVATE_DATA_FROM_THIS (This); - - if (Mode >= EfiConsoleControlScreenMaxValue) { - return EFI_INVALID_PARAMETER; - } - - // - // Judge current mode with wanted mode at first. - // - if (Private->ConsoleOutputMode == Mode) { - return EFI_SUCCESS; - } - - Supported = FALSE; - TextAndGop = &Private->TextOutList[0]; - for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndGop++) { - if ((TextAndGop->GraphicsOutput != NULL) || (TextAndGop->UgaDraw != NULL)) { - Supported = TRUE; - break; - } - } - - if ((!Supported) && (Mode == EfiConsoleControlScreenGraphics)) { - return EFI_UNSUPPORTED; - } - - Private->ConsoleOutputMode = Mode; - - TextAndGop = &Private->TextOutList[0]; - for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndGop++) { - - TextAndGop->TextOutEnabled = TRUE; - // - // If we are going into Graphics mode disable ConOut to any UGA device - // - if ((Mode == EfiConsoleControlScreenGraphics) &&((TextAndGop->GraphicsOutput != NULL) || (TextAndGop->UgaDraw != NULL))) { - TextAndGop->TextOutEnabled = FALSE; - if (FeaturePcdGet (PcdConOutGopSupport)) { - DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw); - } else if (FeaturePcdGet (PcdConOutUgaSupport)) { - DevNullUgaSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw); - } - } - } - if (Mode == EfiConsoleControlScreenText) { - DevNullSyncStdOut (Private); - } - return EFI_SUCCESS; -} - - /** Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. @@ -229,7 +97,6 @@ ConSpliterGraphicsOutputSetMode ( UINTN Index; EFI_STATUS ReturnStatus; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode; - UINTN Size; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; UINTN NumberIndex; UINTN SizeOfInfo; @@ -245,27 +112,9 @@ ConSpliterGraphicsOutputSetMode ( } Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This); - - ReturnStatus = EFI_SUCCESS; - - // - // Free the old version - // - if (Private->GraphicsOutputBlt != NULL) { - FreePool (Private->GraphicsOutputBlt); - } - - // - // Allocate the virtual Blt buffer - // Mode = &Private->GraphicsOutputModeBuffer[ModeNumber]; - Size = Mode->HorizontalResolution * Mode->VerticalResolution * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL); - Private->GraphicsOutputBlt = AllocateZeroPool (Size); - - if (Private->GraphicsOutputBlt == NULL) { - return EFI_OUT_OF_RESOURCES; - } + ReturnStatus = EFI_SUCCESS; // // return the worst status met // @@ -324,168 +173,6 @@ ConSpliterGraphicsOutputSetMode ( return ReturnStatus; } -/** - The following table defines actions for BltOperations. - - EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) - directly to every pixel of the video display rectangle - (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). - Only one pixel will be used from the BltBuffer. Delta is NOT used. - EfiBltVideoToBltBuffer - Read data from the video display rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in - the BltBuffer rectangle (DestinationX, DestinationY ) - (DestinationX + Width, DestinationY + Height). If DestinationX or - DestinationY is not zero then Delta must be set to the length in bytes - of a row in the BltBuffer. - EfiBltBufferToVideo - Write data from the BltBuffer rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the - video display rectangle (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is - not zero then Delta must be set to the length in bytes of a row in the - BltBuffer. - EfiBltVideoToVideo - Copy from the video display rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) . - to the video display rectangle (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). - The BltBuffer and Delta are not used in this mode. - - @param Private Protocol instance pointer. - @param BltBuffer Buffer containing data to blit into video buffer. - This buffer has a size of - Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) - @param BltOperation Operation to perform on BlitBuffer and video - memory - @param SourceX X coordinate of source for the BltBuffer. - @param SourceY Y coordinate of source for the BltBuffer. - @param DestinationX X coordinate of destination for the BltBuffer. - @param DestinationY Y coordinate of destination for the BltBuffer. - @param Width Width of rectangle in BltBuffer in pixels. - @param Height Hight of rectangle in BltBuffer in pixels. - @param Delta OPTIONAL. - - @retval EFI_SUCCESS The Blt operation completed. - @retval EFI_INVALID_PARAMETER BltOperation is not valid. - @retval EFI_DEVICE_ERROR A hardware error occured writting to the video - buffer. - -**/ -EFI_STATUS -DevNullGraphicsOutputBlt ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - 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 - ) -{ - UINTN SrcY; - BOOLEAN Forward; - UINTN Index; - EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltPtr; - EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ScreenPtr; - UINTN HorizontalResolution; - UINTN VerticalResolution; - - if ((BltOperation < EfiBltVideoFill) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) { - return EFI_INVALID_PARAMETER; - } - - if (Width == 0 || Height == 0) { - return EFI_INVALID_PARAMETER; - } - - if (Delta == 0) { - Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL); - } - - HorizontalResolution = Private->GraphicsOutput.Mode->Info->HorizontalResolution; - VerticalResolution = Private->GraphicsOutput.Mode->Info->VerticalResolution; - - // - // We need to fill the Virtual Screen buffer with the blt data. - // - if (BltOperation == EfiBltVideoToBltBuffer) { - // - // Video to BltBuffer: Source is Video, destination is BltBuffer - // - if ((SourceY + Height) > VerticalResolution) { - return EFI_INVALID_PARAMETER; - } - - if ((SourceX + Width) > HorizontalResolution) { - return EFI_INVALID_PARAMETER; - } - - BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + DestinationY * Delta + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - ScreenPtr = &Private->GraphicsOutputBlt[SourceY * HorizontalResolution + SourceX]; - while (Height > 0) { - CopyMem (BltPtr, ScreenPtr, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltPtr + Delta); - ScreenPtr += HorizontalResolution; - Height--; - } - } else { - // - // BltBuffer to Video: Source is BltBuffer, destination is Video - // - if (DestinationY + Height > VerticalResolution) { - return EFI_INVALID_PARAMETER; - } - - if (DestinationX + Width > HorizontalResolution) { - return EFI_INVALID_PARAMETER; - } - - if ((BltOperation == EfiBltVideoToVideo) && (DestinationY > SourceY)) { - // - // Copy backwards, only care the Video to Video Blt - // - ScreenPtr = &Private->GraphicsOutputBlt[(DestinationY + Height - 1) * HorizontalResolution + DestinationX]; - SrcY = SourceY + Height - 1; - Forward = FALSE; - } else { - // - // Copy forwards, for other cases - // - ScreenPtr = &Private->GraphicsOutputBlt[DestinationY * HorizontalResolution + DestinationX]; - SrcY = SourceY; - Forward = TRUE; - } - - while (Height != 0) { - if (BltOperation == EfiBltVideoFill) { - for (Index = 0; Index < Width; Index++) { - ScreenPtr[Index] = *BltBuffer; - } - } else { - if (BltOperation == EfiBltBufferToVideo) { - BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + SrcY * Delta + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - } else { - BltPtr = &Private->GraphicsOutputBlt[SrcY * HorizontalResolution + SourceX]; - } - - CopyMem (ScreenPtr, BltPtr, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - } - - if (Forward) { - ScreenPtr += HorizontalResolution; - SrcY ++; - } else { - ScreenPtr -= HorizontalResolution; - SrcY --; - } - Height--; - } - } - - return EFI_SUCCESS; -} /** @@ -550,7 +237,7 @@ ConSpliterGraphicsOutputBlt ( ) { EFI_STATUS Status; - EFI_STATUS ReturnStatus; + EFI_STATUS ReturnStatus = EFI_DEVICE_ERROR; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; UINTN Index; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; @@ -558,7 +245,6 @@ ConSpliterGraphicsOutputBlt ( Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This); - ReturnStatus = EFI_SUCCESS; // // return the worst status met // @@ -615,58 +301,6 @@ ConSpliterGraphicsOutputBlt ( return ReturnStatus; } -/** - Write data from the buffer to video display based on Graphics Output setting. - - @param Private Consplitter Text Out pointer. - @param GraphicsOutput Graphics Output protocol pointer. - @param UgaDraw UGA Draw protocol pointer. - - @retval EFI_UNSUPPORTED No graphics devcie available . - @retval EFI_SUCCESS The Blt operation completed. - @retval EFI_INVALID_PARAMETER BltOperation is not valid. - @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer. - - -**/ -EFI_STATUS -DevNullGopSync ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput, - IN EFI_UGA_DRAW_PROTOCOL *UgaDraw - ) -{ - if (GraphicsOutput != NULL) { - return GraphicsOutput->Blt ( - GraphicsOutput, - Private->GraphicsOutputBlt, - EfiBltBufferToVideo, - 0, - 0, - 0, - 0, - Private->GraphicsOutput.Mode->Info->HorizontalResolution, - Private->GraphicsOutput.Mode->Info->VerticalResolution, - 0 - ); - } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { - return UgaDraw->Blt ( - UgaDraw, - (EFI_UGA_PIXEL *) Private->GraphicsOutputBlt, - EfiUgaBltBufferToVideo, - 0, - 0, - 0, - 0, - Private->GraphicsOutput.Mode->Info->HorizontalResolution, - Private->GraphicsOutput.Mode->Info->VerticalResolution, - 0 - ); - } else { - return EFI_UNSUPPORTED; - } -} - /** Return the current video mode information. @@ -741,7 +375,6 @@ ConSpliterUgaDrawSetMode ( TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; UINTN Index; EFI_STATUS ReturnStatus; - UINTN Size; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; UINTN NumberIndex; UINTN SizeOfInfo; @@ -750,27 +383,8 @@ ConSpliterUgaDrawSetMode ( Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This); - // - // UgaDevNullSetMode () - // ReturnStatus = EFI_SUCCESS; - // - // Free the old version - // - if (Private->UgaBlt != NULL) { - FreePool (Private->UgaBlt); - } - - // - // Allocate the virtual Blt buffer - // - Size = HorizontalResolution * VerticalResolution * sizeof (EFI_UGA_PIXEL); - Private->UgaBlt = AllocateZeroPool (Size); - if (Private->UgaBlt == NULL) { - return EFI_OUT_OF_RESOURCES; - } - // // Update the Mode data // @@ -779,9 +393,6 @@ ConSpliterUgaDrawSetMode ( Private->UgaColorDepth = ColorDepth; Private->UgaRefreshRate = RefreshRate; - if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) { - return ReturnStatus; - } // // return the worst status met // @@ -828,174 +439,6 @@ ConSpliterUgaDrawSetMode ( return ReturnStatus; } -/** - Blt a rectangle of pixels on the graphics screen. - - The following table defines actions for BltOperations. - - EfiUgaVideoFill: - Write data from the BltBuffer pixel (SourceX, SourceY) - directly to every pixel of the video display rectangle - (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). - Only one pixel will be used from the BltBuffer. Delta is NOT used. - EfiUgaVideoToBltBuffer: - Read data from the video display rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in - the BltBuffer rectangle (DestinationX, DestinationY ) - (DestinationX + Width, DestinationY + Height). If DestinationX or - DestinationY is not zero then Delta must be set to the length in bytes - of a row in the BltBuffer. - EfiUgaBltBufferToVideo: - Write data from the BltBuffer rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the - video display rectangle (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is - not zero then Delta must be set to the length in bytes of a row in the - BltBuffer. - EfiUgaVideoToVideo: - Copy from the video display rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) . - to the video display rectangle (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). - The BltBuffer and Delta are not used in this mode. - - @param Private Text Out Splitter pointer. - @param BltBuffer Buffer containing data to blit into video buffer. - This buffer has a size of - Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) - @param BltOperation Operation to perform on BlitBuffer and video - memory - @param SourceX X coordinate of source for the BltBuffer. - @param SourceY Y coordinate of source for the BltBuffer. - @param DestinationX X coordinate of destination for the BltBuffer. - @param DestinationY Y coordinate of destination for the BltBuffer. - @param Width Width of rectangle in BltBuffer in pixels. - @param Height Hight of rectangle in BltBuffer in pixels. - @param Delta OPTIONAL. - - @retval EFI_SUCCESS The Blt operation completed. - @retval EFI_INVALID_PARAMETER BltOperation is not valid. - @retval EFI_DEVICE_ERROR A hardware error occured writting to the video - buffer. - -**/ -EFI_STATUS -DevNullUgaBlt ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL - IN EFI_UGA_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 - ) -{ - UINTN SrcY; - BOOLEAN Forward; - UINTN Index; - EFI_UGA_PIXEL *BltPtr; - EFI_UGA_PIXEL *ScreenPtr; - UINT32 HorizontalResolution; - UINT32 VerticalResolution; - - if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) { - return EFI_INVALID_PARAMETER; - } - - if (Width == 0 || Height == 0) { - return EFI_INVALID_PARAMETER; - } - - if (Delta == 0) { - Delta = Width * sizeof (EFI_UGA_PIXEL); - } - - HorizontalResolution = Private->UgaHorizontalResolution; - VerticalResolution = Private->UgaVerticalResolution; - - // - // We need to fill the Virtual Screen buffer with the blt data. - // - if (BltOperation == EfiUgaVideoToBltBuffer) { - // - // Video to BltBuffer: Source is Video, destination is BltBuffer - // - if ((SourceY + Height) > VerticalResolution) { - return EFI_INVALID_PARAMETER; - } - - if ((SourceX + Width) > HorizontalResolution) { - return EFI_INVALID_PARAMETER; - } - - BltPtr = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + DestinationY * Delta + DestinationX * sizeof (EFI_UGA_PIXEL)); - ScreenPtr = &Private->UgaBlt[SourceY * HorizontalResolution + SourceX]; - while (Height > 0) { - CopyMem (BltPtr, ScreenPtr, Width * sizeof (EFI_UGA_PIXEL)); - BltPtr = (EFI_UGA_PIXEL *) ((UINT8 *) BltPtr + Delta); - ScreenPtr += HorizontalResolution; - Height--; - } - } else { - // - // BltBuffer to Video: Source is BltBuffer, destination is Video - // - if (DestinationY + Height > VerticalResolution) { - return EFI_INVALID_PARAMETER; - } - - if (DestinationX + Width > HorizontalResolution) { - return EFI_INVALID_PARAMETER; - } - - if ((BltOperation == EfiUgaVideoToVideo) && (DestinationY > SourceY)) { - // - // Copy backwards, only care the Video to Video Blt - // - ScreenPtr = &Private->UgaBlt[(DestinationY + Height - 1) * HorizontalResolution + DestinationX]; - SrcY = SourceY + Height - 1; - Forward = FALSE; - } else { - // - // Copy forwards, for other cases - // - ScreenPtr = &Private->UgaBlt[DestinationY * HorizontalResolution + DestinationX]; - SrcY = SourceY; - Forward = TRUE; - } - - while (Height != 0) { - if (BltOperation == EfiUgaVideoFill) { - for (Index = 0; Index < Width; Index++) { - ScreenPtr[Index] = *BltBuffer; - } - } else { - if (BltOperation == EfiUgaBltBufferToVideo) { - BltPtr = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + SrcY * Delta + SourceX * sizeof (EFI_UGA_PIXEL)); - } else { - BltPtr = &Private->UgaBlt[SrcY * HorizontalResolution + SourceX]; - } - - CopyMem (ScreenPtr, BltPtr, Width * sizeof (EFI_UGA_PIXEL)); - } - - if (Forward) { - ScreenPtr += HorizontalResolution; - SrcY ++; - } else { - ScreenPtr -= HorizontalResolution; - SrcY --; - } - Height--; - } - } - - return EFI_SUCCESS; -} /** Blt a rectangle of pixels on the graphics screen. @@ -1069,24 +512,7 @@ ConSpliterUgaDrawBlt ( Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This); - // - // Sync up DevNull UGA device - // - ReturnStatus = DevNullUgaBlt ( - Private, - BltBuffer, - BltOperation, - SourceX, - SourceY, - DestinationX, - DestinationY, - Width, - Height, - Delta - ); - if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) { - return ReturnStatus; - } + ReturnStatus = EFI_SUCCESS; // // return the worst status met // @@ -1142,601 +568,28 @@ ConSpliterUgaDrawBlt ( return ReturnStatus; } -/** - Write data from the buffer to video display based on UGA Draw setting. - - @param Private Consplitter Text Out pointer. - @param GraphicsOutput Graphics Output protocol pointer. - @param UgaDraw UGA Draw protocol pointer. - - @retval EFI_UNSUPPORTED No graphics devcie available . - @retval EFI_SUCCESS The Blt operation completed. - @retval EFI_INVALID_PARAMETER BltOperation is not valid. - @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer. - -**/ -EFI_STATUS -DevNullUgaSync ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput, - IN EFI_UGA_DRAW_PROTOCOL *UgaDraw - ) -{ - if (GraphicsOutput != NULL) { - return GraphicsOutput->Blt ( - GraphicsOutput, - (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt, - EfiBltBufferToVideo, - 0, - 0, - 0, - 0, - Private->UgaHorizontalResolution, - Private->UgaVerticalResolution, - 0 - ); - } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { - return UgaDraw->Blt ( - UgaDraw, - Private->UgaBlt, - EfiUgaBltBufferToVideo, - 0, - 0, - 0, - 0, - Private->UgaHorizontalResolution, - Private->UgaVerticalResolution, - Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL) - ); - } else { - return EFI_UNSUPPORTED; - } -} - - -/** - Write a Unicode string to the output device. - - @param Private Pointer to the console output splitter's private - data. It indicates the calling context. - @param WString The NULL-terminated Unicode string to be - displayed on the output device(s). All output - devices must also support the Unicode drawing - defined in this file. - - @retval EFI_SUCCESS The string was output to the device. - @retval EFI_DEVICE_ERROR The device reported an error while attempting to - output the text. - @retval EFI_UNSUPPORTED The output device's mode is not currently in a - defined text mode. - @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the - characters in the Unicode string could not be - rendered and were skipped. - -**/ -EFI_STATUS -DevNullTextOutOutputString ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN CHAR16 *WString - ) -{ - UINTN SizeScreen; - UINTN SizeAttribute; - UINTN Index; - EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode; - CHAR16 *Screen; - CHAR16 *NullScreen; - CHAR16 InsertChar; - CHAR16 TempChar; - CHAR16 *PStr; - INT32 *Attribute; - INT32 *NullAttributes; - INT32 CurrentWidth; - UINTN LastRow; - UINTN MaxColumn; - - Mode = &Private->TextOutMode; - NullScreen = Private->DevNullScreen; - NullAttributes = Private->DevNullAttributes; - LastRow = Private->DevNullRows - 1; - MaxColumn = Private->DevNullColumns; - - if ((Mode->Attribute & EFI_WIDE_ATTRIBUTE) != 0) { - CurrentWidth = 2; - } else { - CurrentWidth = 1; - } - - while (*WString != L'\0') { - - if (*WString == CHAR_BACKSPACE) { - // - // If the cursor is at the left edge of the display, then move the cursor - // one row up. - // - if (Mode->CursorColumn == 0 && Mode->CursorRow > 0) { - Mode->CursorRow--; - Mode->CursorColumn = (INT32) MaxColumn; - } - - // - // If the cursor is not at the left edge of the display, - // then move the cursor left one column. - // - if (Mode->CursorColumn > 0) { - Mode->CursorColumn--; - if (Mode->CursorColumn > 0 && - NullAttributes[Mode->CursorRow * MaxColumn + Mode->CursorColumn - 1] & EFI_WIDE_ATTRIBUTE - ) { - Mode->CursorColumn--; - - // - // Insert an extra backspace - // - InsertChar = CHAR_BACKSPACE; - PStr = WString + 1; - while (*PStr != L'\0') { - TempChar = *PStr; - *PStr = InsertChar; - InsertChar = TempChar; - PStr++; - } - - *PStr = InsertChar; - *(++PStr) = 0; - - WString++; - } - } - - WString++; - - } else if (*WString == CHAR_LINEFEED) { - // - // If the cursor is at the bottom of the display, - // then scroll the display one row, and do not update - // the cursor position. Otherwise, move the cursor down one row. - // - if (Mode->CursorRow == (INT32) (LastRow)) { - // - // Scroll Screen Up One Row - // - SizeAttribute = LastRow * MaxColumn; - CopyMem ( - NullAttributes, - NullAttributes + MaxColumn, - SizeAttribute * sizeof (INT32) - ); - - // - // Each row has an ending CHAR_NULL. So one more character each line - // for DevNullScreen than DevNullAttributes - // - SizeScreen = SizeAttribute + LastRow; - CopyMem ( - NullScreen, - NullScreen + (MaxColumn + 1), - SizeScreen * sizeof (CHAR16) - ); - - // - // Print Blank Line at last line - // - Screen = NullScreen + SizeScreen; - Attribute = NullAttributes + SizeAttribute; - - for (Index = 0; Index < MaxColumn; Index++, Screen++, Attribute++) { - *Screen = L' '; - *Attribute = Mode->Attribute; - } - } else { - Mode->CursorRow++; - } - - WString++; - } else if (*WString == CHAR_CARRIAGE_RETURN) { - // - // Move the cursor to the beginning of the current row. - // - Mode->CursorColumn = 0; - WString++; - } else { - // - // Print the character at the current cursor position and - // move the cursor right one column. If this moves the cursor - // past the right edge of the display, then the line should wrap to - // the beginning of the next line. This is equivalent to inserting - // a CR and an LF. Note that if the cursor is at the bottom of the - // display, and the line wraps, then the display will be scrolled - // one line. - // - Index = Mode->CursorRow * MaxColumn + Mode->CursorColumn; - - while (Mode->CursorColumn < (INT32) MaxColumn) { - if (*WString == CHAR_NULL) { - break; - } - - if (*WString == CHAR_BACKSPACE) { - break; - } - - if (*WString == CHAR_LINEFEED) { - break; - } - - if (*WString == CHAR_CARRIAGE_RETURN) { - break; - } - - if (*WString == UNICODE_WIDE_CHAR || *WString == UNICODE_NARROW_CHAR) { - CurrentWidth = (*WString == UNICODE_WIDE_CHAR) ? 2 : 1; - WString++; - continue; - } - - if (Mode->CursorColumn + CurrentWidth > (INT32) MaxColumn) { - // - // If a wide char is at the rightmost column, then move the char - // to the beginning of the next row - // - NullScreen[Index + Mode->CursorRow] = L' '; - NullAttributes[Index] = Mode->Attribute | (UINT32) EFI_WIDE_ATTRIBUTE; - Index++; - Mode->CursorColumn++; - } else { - NullScreen[Index + Mode->CursorRow] = *WString; - NullAttributes[Index] = Mode->Attribute; - if (CurrentWidth == 1) { - NullAttributes[Index] &= (~ (UINT32) EFI_WIDE_ATTRIBUTE); - } else { - NullAttributes[Index] |= (UINT32) EFI_WIDE_ATTRIBUTE; - NullAttributes[Index + 1] &= (~ (UINT32) EFI_WIDE_ATTRIBUTE); - } - - Index += CurrentWidth; - WString++; - Mode->CursorColumn += CurrentWidth; - } - } - // - // At the end of line, output carriage return and line feed - // - if (Mode->CursorColumn >= (INT32) MaxColumn) { - DevNullTextOutOutputString (Private, mCrLfString); - } - } - } - - return EFI_SUCCESS; -} - - /** Sets the output device(s) to a specified mode. @param Private Text Out Splitter pointer. @param ModeNumber The mode number to set. - @retval EFI_SUCCESS The requested text mode was set. - @retval EFI_DEVICE_ERROR The device had an error and could not complete - the request. - @retval EFI_UNSUPPORTED The mode number was not valid. - @retval EFI_OUT_OF_RESOURCES Out of resources. - **/ -EFI_STATUS -DevNullTextOutSetMode ( +VOID +TextOutSetMode ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, IN UINTN ModeNumber ) -{ - UINTN Size; - INT32 CurrentMode; - UINTN Row; - UINTN Column; - TEXT_OUT_SPLITTER_QUERY_DATA *Mode; - - // - // No extra check for ModeNumber here, as it has been checked in - // ConSplitterTextOutSetMode. And mode 0 should always be supported. - // Row and Column should be fetched from intersection map. - // - if (Private->TextOutModeMap != NULL) { - CurrentMode = *(Private->TextOutModeMap + Private->TextOutListCount * ModeNumber); - } else { - CurrentMode = (INT32) (ModeNumber); - } - Mode = &(Private->TextOutQueryData[CurrentMode]); - Row = Mode->Rows; - Column = Mode->Columns; - - if (Row == 0 || Column == 0) { - return EFI_UNSUPPORTED; - } - - if (Private->TextOutMode.Mode != (INT32) ModeNumber) { - - Private->TextOutMode.Mode = (INT32) ModeNumber; - Private->DevNullColumns = Column; - Private->DevNullRows = Row; - - if (Private->DevNullScreen != NULL) { - FreePool (Private->DevNullScreen); - } - - Size = (Row * (Column + 1)) * sizeof (CHAR16); - Private->DevNullScreen = AllocateZeroPool (Size); - if (Private->DevNullScreen == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if (Private->DevNullAttributes != NULL) { - FreePool (Private->DevNullAttributes); - } - - Size = Row * Column * sizeof (INT32); - Private->DevNullAttributes = AllocateZeroPool (Size); - if (Private->DevNullAttributes == NULL) { - return EFI_OUT_OF_RESOURCES; - } - } - - DevNullTextOutClearScreen (Private); - - return EFI_SUCCESS; -} - - -/** - Clears the output device(s) display to the currently selected background - color. - - @param Private Text Out Splitter pointer. - - @retval EFI_SUCCESS The operation completed successfully. - @retval EFI_DEVICE_ERROR The device had an error and could not complete - the request. - @retval EFI_UNSUPPORTED The output device is not in a valid text mode. - -**/ -EFI_STATUS -DevNullTextOutClearScreen ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private - ) -{ - UINTN Row; - UINTN Column; - CHAR16 *Screen; - INT32 *Attributes; - INT32 CurrentAttribute; - - // - // Clear the DevNull Text Out Buffers. - // The screen is filled with spaces. - // The attributes are all synced with the current Simple Text Out Attribute - // - Screen = Private->DevNullScreen; - Attributes = Private->DevNullAttributes; - CurrentAttribute = Private->TextOutMode.Attribute; - - for (Row = 0; Row < Private->DevNullRows; Row++) { - for (Column = 0; Column < Private->DevNullColumns; Column++, Screen++, Attributes++) { - *Screen = L' '; - *Attributes = CurrentAttribute; - } - // - // Each line of the screen has a NULL on the end so we must skip over it - // - Screen++; - } - - DevNullTextOutSetCursorPosition (Private, 0, 0); - - return DevNullTextOutEnableCursor (Private, TRUE); -} - - -/** - Sets the current coordinates of the cursor position on NULL device. - - @param Private Text Out Splitter pointer. - @param Column The column position to set the cursor to. Must be - greater than or equal to zero and less than the - number of columns by QueryMode (). - @param Row The row position to set the cursor to. Must be - greater than or equal to zero and less than the - number of rows by QueryMode (). - - @retval EFI_SUCCESS Always returned. - -**/ -EFI_STATUS -DevNullTextOutSetCursorPosition ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN UINTN Column, - IN UINTN Row - ) { // // No need to do extra check here as whether (Column, Row) is valid has // been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should // always be supported. // - Private->TextOutMode.CursorColumn = (INT32) Column; - Private->TextOutMode.CursorRow = (INT32) Row; - - return EFI_SUCCESS; -} - - -/** - Set cursor visibility property on NULL device. + Private->TextOutMode.Mode = (INT32) ModeNumber; + Private->TextOutMode.CursorColumn = 0; + Private->TextOutMode.CursorRow = 0; + Private->TextOutMode.CursorVisible = TRUE; - @param Private Text Out Splitter pointer. - @param Visible If TRUE, the cursor is set to be visible, If - FALSE, the cursor is set to be invisible. - - @retval EFI_SUCCESS Always returned. - -**/ -EFI_STATUS -DevNullTextOutEnableCursor ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, - IN BOOLEAN Visible - ) -{ - Private->TextOutMode.CursorVisible = Visible; - - return EFI_SUCCESS; -} - - -/** - Take the DevNull TextOut device and update the Simple Text Out on every - UGA device. - - @param Private Text Out Splitter pointer. - - @retval EFI_SUCCESS The request is valid. - @retval other Return status of TextOut->OutputString () - -**/ -EFI_STATUS -DevNullSyncStdOut ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private - ) -{ - EFI_STATUS Status; - EFI_STATUS ReturnStatus; - UINTN Row; - UINTN Column; - UINTN List; - UINTN MaxColumn; - UINTN CurrentColumn; - UINTN StartRow; - UINTN StartColumn; - INT32 StartAttribute; - BOOLEAN StartCursorState; - CHAR16 *Screen; - CHAR16 *Str; - CHAR16 *Buffer; - CHAR16 *BufferTail; - CHAR16 *ScreenStart; - INT32 CurrentAttribute; - INT32 *Attributes; - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto; - - // - // Save the devices Attributes, Cursor enable state and location - // - StartColumn = Private->TextOutMode.CursorColumn; - StartRow = Private->TextOutMode.CursorRow; - StartAttribute = Private->TextOutMode.Attribute; - StartCursorState = Private->TextOutMode.CursorVisible; - - for (List = 0; List < Private->CurrentNumberOfConsoles; List++) { - - Sto = Private->TextOutList[List].TextOut; - - // - // Skip non GOP/UGA devices - // - if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) { - Sto->EnableCursor (Sto, FALSE); - Sto->ClearScreen (Sto); - } - } - - ReturnStatus = EFI_SUCCESS; - Screen = Private->DevNullScreen; - Attributes = Private->DevNullAttributes; - MaxColumn = Private->DevNullColumns; - - Buffer = AllocateZeroPool ((MaxColumn + 1) * sizeof (CHAR16)); - if (Buffer == NULL) { - return ReturnStatus; - } - - for (Row = 0; Row < Private->DevNullRows; Row++, Screen += (MaxColumn + 1), Attributes += MaxColumn) { - - if (Row == (Private->DevNullRows - 1)) { - // - // Don't ever sync the last character as it will scroll the screen - // - Screen[MaxColumn - 1] = 0x00; - } - - Column = 0; - while (Column < MaxColumn) { - if (Screen[Column] > 0) { - CurrentAttribute = Attributes[Column]; - CurrentColumn = Column; - ScreenStart = &Screen[Column]; - - // - // the line end is alway 0x0. So Column should be less than MaxColumn - // It should be still in the same row - // - for (Str = ScreenStart, BufferTail = Buffer; *Str != 0; Str++, Column++) { - - if (Attributes[Column] != CurrentAttribute) { - Column--; - break; - } - - *BufferTail = *Str; - BufferTail++; - if ((Attributes[Column] & EFI_WIDE_ATTRIBUTE) != 0) { - Str++; - Column++; - } - } - - *BufferTail = 0; - - for (List = 0; List < Private->CurrentNumberOfConsoles; List++) { - - Sto = Private->TextOutList[List].TextOut; - - // - // Skip non GOP/UGA devices - // - if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) { - Sto->SetAttribute (Sto, CurrentAttribute); - Sto->SetCursorPosition (Sto, CurrentColumn, Row); - Status = Sto->OutputString (Sto, Buffer); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } - } - } - - } - - Column++; - } - } - // - // Restore the devices Attributes, Cursor enable state and location - // - for (List = 0; List < Private->CurrentNumberOfConsoles; List++) { - Sto = Private->TextOutList[List].TextOut; - - // - // Skip non GOP/UGA devices - // - if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) { - Sto->SetAttribute (Sto, StartAttribute); - Sto->SetCursorPosition (Sto, StartColumn, StartRow); - Status = Sto->EnableCursor (Sto, StartCursorState); - if (EFI_ERROR (Status)) { - ReturnStatus = Status; - } - } - } - - FreePool (Buffer); - - return ReturnStatus; + return; } diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h index 344f967f78..04dbdc81f0 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h @@ -1,7 +1,7 @@ /** @file Private structures definitions in HiiDatabase. -Copyright (c) 2007 - 2008, Intel Corporation +Copyright (c) 2007 - 2009, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -17,7 +17,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include -#include #include #include #include diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index cbdcbd5a1d..d8e7ca2d2e 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -28,7 +28,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf index 7b027a4d68..b945322920 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf +++ b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf @@ -1,7 +1,7 @@ #/** @file # The DXE driver produces FORM BROWSER protocols defined in UEFI HII 2.1 specificatin. # -# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved. +# Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved. # # All rights reserved. This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -74,7 +74,6 @@ gEfiHiiConfigRoutingProtocolGuid ## CONSUMES gEfiHiiDatabaseProtocolGuid ## CONSUMES gEfiUnicodeCollation2ProtocolGuid ## CONSUMES - gEfiConsoleControlProtocolGuid ## CONSUMES [FeaturePcd.common] gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport