X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FConsole%2FConSplitterDxe%2FConSplitter.c;h=3389f62f98051c4bff361360ab204bffec474663;hb=8a67d804b3b660b233ba58e24fee81c76786001b;hp=234f733bd63b00d9e16ef069ee15a19fd743bb28;hpb=fc753d3b82f545cfe2c2d2e084b44a0c0e2a9c52;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 234f733bd6..3389f62f98 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -12,11 +12,11 @@ These 3 virtual handles would be installed on gST. Each virtual handle, that supports the Console I/O protocol, will be produced - in the driver entry point. The virtual handle are added on driver entry and - never removed. Such design ensures sytem function well during none console + in the driver entry point. The virtual handle are added on driver entry and + 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 }; @@ -337,7 +300,7 @@ EFI_DRIVER_BINDING_PROTOCOL gConSplitterAbsolutePointerDriverBinding = Installs driver module protocols and. Creates virtual device handles for ConIn, ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol, - Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers. + Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers. Installs Graphics Output protocol and/or UGA Draw protocol if needed. @param[in] ImageHandle The firmware allocated handle for the EFI image. @@ -410,31 +373,17 @@ ConSplitterDriverEntry( ASSERT_EFI_ERROR (Status); // - // One of Either Graphics Output protocol and UGA Draw protocol must be supported. + // Either Graphics Output protocol or UGA Draw protocol must be supported. // ASSERT (FeaturePcdGet (PcdConOutGopSupport) || FeaturePcdGet (PcdConOutUgaSupport)); // - // The driver creates virtual handles for ConIn, ConOut, and StdErr. + // The driver creates virtual handles for ConIn, ConOut. // The virtual handles will always exist even if no console exist in the // system. This is need to support hotplug devices like USB. // // - // Create virtual device handle for StdErr Splitter - // - Status = ConSplitterTextOutConstructor (&mStdErr); - if (!EFI_ERROR (Status)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &mStdErr.VirtualHandle, - &gEfiSimpleTextOutProtocolGuid, - &mStdErr.TextOut, - &gEfiPrimaryStandardErrorDeviceGuid, - NULL, - NULL - ); - } - // // Create virtual device handle for ConIn Splitter // Status = ConSplitterTextInConstructor (&mConIn); @@ -449,8 +398,6 @@ ConSplitterDriverEntry( &mConIn.SimplePointer, &gEfiAbsolutePointerProtocolGuid, &mConIn.AbsolutePointer, - &gEfiPrimaryConsoleInDeviceGuid, - NULL, NULL ); if (!EFI_ERROR (Status)) { @@ -469,7 +416,7 @@ ConSplitterDriverEntry( if (!EFI_ERROR (Status)) { if (!FeaturePcdGet (PcdConOutGopSupport)) { // - // If Graphics Outpurt protocol not supported, UGA Draw protocol is installed + // If Graphics Outpurt protocol not supported, UGA Draw protocol is installed // on the virtual handle. // Status = gBS->InstallMultipleProtocolInterfaces ( @@ -478,10 +425,6 @@ ConSplitterDriverEntry( &mConOut.TextOut, &gEfiUgaDrawProtocolGuid, &mConOut.UgaDraw, - &gEfiConsoleControlProtocolGuid, - &mConOut.ConsoleControl, - &gEfiPrimaryConsoleOutDeviceGuid, - NULL, NULL ); } else if (!FeaturePcdGet (PcdConOutUgaSupport)) { @@ -495,10 +438,6 @@ ConSplitterDriverEntry( &mConOut.TextOut, &gEfiGraphicsOutputProtocolGuid, &mConOut.GraphicsOutput, - &gEfiConsoleControlProtocolGuid, - &mConOut.ConsoleControl, - &gEfiPrimaryConsoleOutDeviceGuid, - NULL, NULL ); } else { @@ -514,10 +453,6 @@ ConSplitterDriverEntry( &mConOut.GraphicsOutput, &gEfiUgaDrawProtocolGuid, &mConOut.UgaDraw, - &gEfiConsoleControlProtocolGuid, - &mConOut.ConsoleControl, - &gEfiPrimaryConsoleOutDeviceGuid, - NULL, NULL ); } @@ -565,7 +500,7 @@ ConSplitterTextInConstructor ( EFI_STATUS Status; // - // Allocate buffer for Simple Text Input device + // Allocate buffer for Simple Text Input device // Status = ConSplitterGrowBuffer ( sizeof (EFI_SIMPLE_TEXT_INPUT_PROTOCOL *), @@ -575,19 +510,9 @@ 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 + // Create Event to wait for a key // Status = gBS->CreateEvent ( EVT_NOTIFY_WAIT, @@ -599,7 +524,7 @@ ConSplitterTextInConstructor ( ASSERT_EFI_ERROR (Status); // - // Allocate buffer for Simple Text Input Ex device + // Allocate buffer for Simple Text Input Ex device // Status = ConSplitterGrowBuffer ( sizeof (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *), @@ -625,7 +550,7 @@ ConSplitterTextInConstructor ( ConInPrivate->AbsolutePointer.Mode = &ConInPrivate->AbsolutePointerMode; // - // Allocate buffer for Absolute Pointer device + // Allocate buffer for Absolute Pointer device // Status = ConSplitterGrowBuffer ( sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *), @@ -649,7 +574,7 @@ ConSplitterTextInConstructor ( ConInPrivate->SimplePointer.Mode = &ConInPrivate->SimplePointerMode; // - // Allocate buffer for Simple Pointer device + // Allocate buffer for Simple Pointer device // Status = ConSplitterGrowBuffer ( sizeof (EFI_SIMPLE_POINTER_PROTOCOL *), @@ -712,7 +637,7 @@ ConSplitterTextOutConstructor ( // ConOutPrivate->TextOutMode.Mode = 0xFF; // - // Allocate buffer for Console Out device + // Allocate buffer for Console Out device // Status = ConSplitterGrowBuffer ( sizeof (TEXT_OUT_AND_GOP_DATA), @@ -735,15 +660,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); } @@ -793,7 +719,7 @@ ConSplitterTextOutConstructor ( /** - Test to see if the specified protocol could be supported on the specified device. + Test to see if the specified protocol could be supported on the specified device. @param This Driver Binding protocol pointer. @param ControllerHandle Handle of device to test. @@ -819,7 +745,7 @@ ConSplitterSupported ( // if (ControllerHandle == mConIn.VirtualHandle || ControllerHandle == mConOut.VirtualHandle || - ControllerHandle == mStdErr.VirtualHandle + ControllerHandle == mStdErr.VirtualHandle ) { return EFI_UNSUPPORTED; } @@ -851,7 +777,7 @@ ConSplitterSupported ( } /** - Test to see if Console In Device could be supported on the Controller. + Test to see if Console In Device could be supported on the Controller. @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to test. @@ -878,7 +804,7 @@ ConSplitterConInDriverBindingSupported ( } /** - Test to see if Simple Pointer protocol could be supported on the Controller. + Test to see if Simple Pointer protocol could be supported on the Controller. @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to test. @@ -905,7 +831,7 @@ ConSplitterSimplePointerDriverBindingSupported ( } /** - Test to see if Absolute Pointer protocol could be supported on the Controller. + Test to see if Absolute Pointer protocol could be supported on the Controller. @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to test. @@ -933,7 +859,7 @@ ConSplitterAbsolutePointerDriverBindingSupported ( /** - Test to see if Console Out Device could be supported on the Controller. + Test to see if Console Out Device could be supported on the Controller. @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to test. @@ -960,7 +886,7 @@ ConSplitterConOutDriverBindingSupported ( } /** - Test to see if Standard Error Device could be supported on the Controller. + Test to see if Standard Error Device could be supported on the Controller. @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to test. @@ -988,9 +914,9 @@ ConSplitterStdErrDriverBindingSupported ( /** - Start ConSplitter on devcie handle by opening Console Device Guid on device handle + Start ConSplitter on devcie handle by opening Console Device Guid on device handle and the console virtual handle. And Get the console interface on controller handle. - + @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device. @param ConSplitterVirtualHandle Console virtual Handle. @@ -1031,7 +957,7 @@ ConSplitterStart ( if (EFI_ERROR (Status)) { return Status; } - + // // Create virtual handle and open DeviceGuid on the virtul handle. // @@ -1089,8 +1015,8 @@ Err: /** - Start Console In Consplitter on device handle. - + Start Console In Consplitter on device handle. + @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to bind driver to. @param RemainingDevicePath Optional parameter use to pick a specific child @@ -1157,8 +1083,8 @@ ConSplitterConInDriverBindingStart ( /** - Start Simple Pointer Consplitter on device handle. - + Start Simple Pointer Consplitter on device handle. + @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to bind driver to. @param RemainingDevicePath Optional parameter use to pick a specific child @@ -1203,8 +1129,8 @@ ConSplitterSimplePointerDriverBindingStart ( /** - Start Absolute Pointer Consplitter on device handle. - + Start Absolute Pointer Consplitter on device handle. + @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to bind driver to. @param RemainingDevicePath Optional parameter use to pick a specific child @@ -1250,8 +1176,8 @@ ConSplitterAbsolutePointerDriverBindingStart ( /** - Start Console Out Consplitter on device handle. - + Start Console Out Consplitter on device handle. + @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to bind driver to. @param RemainingDevicePath Optional parameter use to pick a specific child @@ -1269,10 +1195,12 @@ ConSplitterConOutDriverBindingStart ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { - EFI_STATUS Status; - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; - EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; - EFI_UGA_DRAW_PROTOCOL *UgaDraw; + EFI_STATUS Status; + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; + EFI_UGA_DRAW_PROTOCOL *UgaDraw; + UINTN SizeOfInfo; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; // // Start ConSplitter on ControllerHandle, and create the virtual @@ -1308,14 +1236,14 @@ ConSplitterConOutDriverBindingStart ( // // Open UGA DRAW protocol // - Status = gBS->OpenProtocol ( - ControllerHandle, - &gEfiUgaDrawProtocolGuid, - (VOID **) &UgaDraw, - This->DriverBindingHandle, - mConOut.VirtualHandle, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); + gBS->OpenProtocol ( + ControllerHandle, + &gEfiUgaDrawProtocolGuid, + (VOID **) &UgaDraw, + This->DriverBindingHandle, + mConOut.VirtualHandle, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); } // @@ -1331,12 +1259,26 @@ ConSplitterConOutDriverBindingStart ( Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw); ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)); - if (FeaturePcdGet (PcdConOutUgaSupport) && FeaturePcdGet (PcdUgaConsumeSupport)) { + if (FeaturePcdGet (PcdConOutUgaSupport)) { // - // Match the UGA mode data of ConOut with the current mode + // Get the UGA mode data of ConOut from the current mode // - if (UgaDraw != NULL) { - UgaDraw->GetMode ( + if (GraphicsOutput != NULL) { + Status = GraphicsOutput->QueryMode (GraphicsOutput, GraphicsOutput->Mode->Mode, &SizeOfInfo, &Info); + if (EFI_ERROR (Status)) { + return Status; + } + ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)); + + mConOut.UgaHorizontalResolution = Info->HorizontalResolution; + mConOut.UgaVerticalResolution = Info->VerticalResolution; + mConOut.UgaColorDepth = 32; + mConOut.UgaRefreshRate = 60; + + FreePool (Info); + + } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + Status = UgaDraw->GetMode ( UgaDraw, &mConOut.UgaHorizontalResolution, &mConOut.UgaVerticalResolution, @@ -1345,13 +1287,14 @@ ConSplitterConOutDriverBindingStart ( ); } } + return Status; } /** - Start Standard Error Consplitter on device handle. - + Start Standard Error Consplitter on device handle. + @param This Driver Binding protocol instance pointer. @param ControllerHandle Handle of device to bind driver to. @param RemainingDevicePath Optional parameter use to pick a specific child @@ -1372,6 +1315,25 @@ ConSplitterStdErrDriverBindingStart ( EFI_STATUS Status; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; + if (mStdErr.CurrentNumberOfConsoles == 0) { + // + // Create virtual device handle for StdErr Splitter + // + Status = ConSplitterTextOutConstructor (&mStdErr); + if (!EFI_ERROR (Status)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &mStdErr.VirtualHandle, + &gEfiSimpleTextOutProtocolGuid, + &mStdErr.TextOut, + NULL + ); + } + + if (EFI_ERROR (Status)) { + return Status; + } + } + // // Start ConSplitter on ControllerHandle, and create the virtual // agrogated console device on first call Start for a StandardError handle. @@ -1405,6 +1367,19 @@ ConSplitterStdErrDriverBindingStart ( } if (mStdErr.CurrentNumberOfConsoles == 1) { + // + // Create virtual device handle for StdErr Splitter + // + Status = ConSplitterTextOutConstructor (&mStdErr); + if (!EFI_ERROR (Status)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &mStdErr.VirtualHandle, + &gEfiSimpleTextOutProtocolGuid, + &mStdErr.TextOut, + NULL + ); + } + gST->StandardErrorHandle = mStdErr.VirtualHandle; gST->StdErr = &mStdErr.TextOut; // @@ -1423,9 +1398,9 @@ ConSplitterStdErrDriverBindingStart ( /** - Stop ConSplitter on device handle by closing Console Device Guid on device handle + Stop ConSplitter on device handle by closing Console Device Guid on device handle and the console virtual handle. - + @param This Protocol instance pointer. @param ControllerHandle Handle of device. @param ConSplitterVirtualHandle Console virtual Handle. @@ -1524,7 +1499,7 @@ ConSplitterConInDriverBindingStop ( // // If Simple Text Input Ex protocol exists, // remove device from Text Input Ex devices list. - // + // Status = ConSplitterTextInExDeleteDevice (&mConIn, TextInEx); if (EFI_ERROR (Status)) { return Status; @@ -1548,7 +1523,7 @@ ConSplitterConInDriverBindingStop ( // // Remove device from Text Input devices list. - // + // return ConSplitterTextInDeleteDevice (&mConIn, TextIn); } @@ -1771,6 +1746,16 @@ ConSplitterStdErrDriverBindingStop ( gST->Hdr.HeaderSize, &gST->Hdr.CRC32 ); + + // + // Uninstall Simple Text Output protocol from StdErr Handle. + // + gBS->UninstallMultipleProtocolInterfaces ( + mStdErr.VirtualHandle, + &gEfiSimpleTextOutProtocolGuid, + &mStdErr.TextOut, + NULL + ); } return Status; @@ -1808,7 +1793,7 @@ ConSplitterGrowBuffer ( // *Count += CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT; Ptr = ReallocatePool ( - SizeOfCount * ((*Count) - CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT), + SizeOfCount * ((*Count) - CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT), SizeOfCount * (*Count), *Buffer ); @@ -2220,7 +2205,7 @@ ConSplitterGrowMapTable ( @param Private Text Out Splitter pointer @param TextOut Simple Text Output protocol pointer. - + @retval EFI_SUCCESS Device added successfully. @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. @@ -2366,11 +2351,11 @@ ConSplitterGetIntersection ( } /** - Add the device's output mode to console splitter's mode list. + Sync the device's output mode to console splitter's mode list. @param Private Text Out Splitter pointer. @param TextOut Simple Text Output protocol pointer. - + **/ VOID ConSplitterSyncOutputMode ( @@ -2614,7 +2599,7 @@ ConSplitterGetIntersectionBetweenConOutAndStrErr ( /** - Add display (GOP or UGA) output modes into Consplitter Text Out list. + Add Grahpics Output modes into Consplitter Text Out list. @param Private Text Out Splitter pointer. @param GraphicsOutput Graphics Output protocol pointer. @@ -2625,7 +2610,7 @@ ConSplitterGetIntersectionBetweenConOutAndStrErr ( **/ EFI_STATUS -ConSplitterAddDisplayOutputMode ( +ConSplitterAddGraphicsOutputMode ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput, IN EFI_UGA_DRAW_PROTOCOL *UgaDraw @@ -2648,9 +2633,7 @@ ConSplitterAddDisplayOutputMode ( UINT32 UgaColorDepth; UINT32 UgaRefreshRate; - if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) { - return EFI_UNSUPPORTED; - } + ASSERT (GraphicsOutput != NULL || UgaDraw != NULL); CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode; @@ -2677,7 +2660,7 @@ ConSplitterAddDisplayOutputMode ( CurrentGraphicsOutputMode->SizeOfInfo = GraphicsOutput->Mode->SizeOfInfo; CurrentGraphicsOutputMode->FrameBufferBase = GraphicsOutput->Mode->FrameBufferBase; CurrentGraphicsOutputMode->FrameBufferSize = GraphicsOutput->Mode->FrameBufferSize; - + // // Allocate resource for the private mode buffer // @@ -2730,7 +2713,7 @@ ConSplitterAddDisplayOutputMode ( if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) { // - // If GOP device supports one mode in current mode buffer, + // If GOP device supports one mode in current mode buffer, // it will be added into matched mode buffer // Match = TRUE; @@ -2742,7 +2725,7 @@ ConSplitterAddDisplayOutputMode ( if (Match) { AlreadyExist = FALSE; - + // // Check if GOP mode has been in the mode buffer, ModeBuffer = MatchedMode at begin. // @@ -2811,8 +2794,7 @@ ConSplitterAddDisplayOutputMode ( } } } - } - if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { // // Graphics console driver can ensure the same mode for all GOP devices // so we can get the current mode from this video device @@ -2828,11 +2810,11 @@ ConSplitterAddDisplayOutputMode ( CurrentGraphicsOutputMode->MaxMode = 1; Info = CurrentGraphicsOutputMode->Info; Info->Version = 0; - Info->HorizontalResolution = UgaHorizontalResolution; - Info->VerticalResolution = UgaVerticalResolution; - Info->PixelFormat = PixelBltOnly; - Info->PixelsPerScanLine = UgaHorizontalResolution; - CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); + Info->HorizontalResolution = UgaHorizontalResolution; + Info->VerticalResolution = UgaVerticalResolution; + Info->PixelFormat = PixelBltOnly; + Info->PixelsPerScanLine = UgaHorizontalResolution; + CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL; CurrentGraphicsOutputMode->FrameBufferSize = 0; @@ -2881,8 +2863,9 @@ Done: return Status; } - /** + Set the current console out mode. + This routine will get the current console mode information (column, row) from ConsoleOutMode variable and set it; if the variable does not exist, set to user defined console mode. @@ -2895,54 +2878,31 @@ ConsplitterSetConsoleOutMode ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private ) { - UINTN Col; - UINTN Row; - UINTN Mode; - UINTN PreferMode; - UINTN BaseMode; - UINTN ModeInfoSize; - UINTN MaxMode; - EFI_STATUS Status; - CONSOLE_OUT_MODE *ModeInfo; + UINTN Col; + UINTN Row; + UINTN Mode; + UINTN PreferMode; + UINTN BaseMode; + UINTN MaxMode; + EFI_STATUS Status; + CONSOLE_OUT_MODE ModeInfo; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; PreferMode = 0xFF; BaseMode = 0xFF; TextOut = &Private->TextOut; MaxMode = (UINTN) (TextOut->Mode->MaxMode); - ModeInfoSize = sizeof (CONSOLE_OUT_MODE); - - ModeInfo = AllocateZeroPool (sizeof(CONSOLE_OUT_MODE)); - ASSERT(ModeInfo != NULL); - Status = gRT->GetVariable ( - VARCONOUTMODE, - &gEfiGenericPlatformVariableGuid, - NULL, - &ModeInfoSize, - ModeInfo - ); + ModeInfo.Column = PcdGet32 (PcdConOutColumn); + ModeInfo.Row = PcdGet32 (PcdConOutRow); // - // Set to the default mode 80 x 25 required by EFI/UEFI spec; - // user can also define other valid default console mode here. + // To find the prefer mode and basic mode from Text Out mode list // - if (EFI_ERROR(Status)) { - ModeInfo->Column = 80; - ModeInfo->Row = 25; - Status = gRT->SetVariable ( - VARCONOUTMODE, - &gEfiGenericPlatformVariableGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, - sizeof (CONSOLE_OUT_MODE), - ModeInfo - ); - } - for (Mode = 0; Mode < MaxMode; Mode++) { Status = TextOut->QueryMode (TextOut, Mode, &Col, &Row); if (!EFI_ERROR(Status)) { - if (Col == ModeInfo->Column && Row == ModeInfo->Row) { + if (Col == ModeInfo.Column && Row == ModeInfo.Row) { PreferMode = Mode; } if (Col == 80 && Row == 25) { @@ -2951,31 +2911,22 @@ ConsplitterSetConsoleOutMode ( } } - Status = TextOut->SetMode (TextOut, PreferMode); - // - // if current mode setting is failed, default 80x25 mode will be set. + // Set prefer mode to Text Out devices. // + Status = TextOut->SetMode (TextOut, PreferMode); if (EFI_ERROR(Status)) { - Status = TextOut->SetMode (TextOut, BaseMode); - ASSERT(!EFI_ERROR(Status)); - - ModeInfo->Column = 80; - ModeInfo->Row = 25; - // - // Update ConOutMode variable + // if current mode setting is failed, default 80x25 mode will be set. // - Status = gRT->SetVariable ( - VARCONOUTMODE, - &gEfiGenericPlatformVariableGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, - sizeof (CONSOLE_OUT_MODE), - ModeInfo - ); + Status = TextOut->SetMode (TextOut, BaseMode); + ASSERT(!EFI_ERROR(Status)); + + PcdSet32 (PcdConOutColumn, 80); + PcdSet32 (PcdConOutRow, 25); } - gBS->FreePool (ModeInfo); + return ; } @@ -2999,15 +2950,16 @@ ConSplitterTextOutAddDevice ( IN EFI_UGA_DRAW_PROTOCOL *UgaDraw ) { - EFI_STATUS Status; - UINTN CurrentNumOfConsoles; - INT32 CurrentMode; - INT32 MaxMode; - UINT32 UgaHorizontalResolution; - UINT32 UgaVerticalResolution; - UINT32 UgaColorDepth; - UINT32 UgaRefreshRate; - TEXT_OUT_AND_GOP_DATA *TextAndGop; + EFI_STATUS Status; + UINTN CurrentNumOfConsoles; + INT32 MaxMode; + UINT32 UgaHorizontalResolution; + UINT32 UgaVerticalResolution; + UINT32 UgaColorDepth; + UINT32 UgaRefreshRate; + TEXT_OUT_AND_GOP_DATA *TextAndGop; + UINTN SizeOfInfo; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; Status = EFI_SUCCESS; CurrentNumOfConsoles = Private->CurrentNumberOfConsoles; @@ -3035,21 +2987,9 @@ ConSplitterTextOutAddDevice ( TextAndGop = &Private->TextOutList[CurrentNumOfConsoles]; - TextAndGop->TextOut = TextOut; + TextAndGop->TextOut = TextOut; 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); - } + TextAndGop->UgaDraw = UgaDraw; if (CurrentNumOfConsoles == 0) { // @@ -3069,20 +3009,41 @@ ConSplitterTextOutAddDevice ( // ConSplitterGetIntersectionBetweenConOutAndStrErr (); - CurrentMode = Private->TextOutMode.Mode; MaxMode = Private->TextOutMode.MaxMode; ASSERT (MaxMode >= 1); - // - // Update DevNull mode according to current video device - // if (FeaturePcdGet (PcdConOutGopSupport)) { - if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) { - ConSplitterAddDisplayOutputMode (Private, GraphicsOutput, UgaDraw); + // + // If GOP is produced by Consplitter, this device display mode will be added into Graphics Ouput modes. + // + if ((GraphicsOutput != NULL) || (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport))) { + ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw); } } + if (FeaturePcdGet (PcdConOutUgaSupport)) { - if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { + UgaHorizontalResolution = 800; + UgaVerticalResolution = 600; + UgaColorDepth = 32; + UgaRefreshRate = 60; + + Status = EFI_DEVICE_ERROR; + // + // If UGA is produced by Consplitter + // + if (GraphicsOutput != NULL) { + Status = GraphicsOutput->QueryMode (GraphicsOutput, GraphicsOutput->Mode->Mode, &SizeOfInfo, &Info); + if (EFI_ERROR (Status)) { + return Status; + } + ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)); + + UgaHorizontalResolution = Info->HorizontalResolution; + UgaVerticalResolution = Info->VerticalResolution; + + FreePool (Info); + + } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) { Status = UgaDraw->GetMode ( UgaDraw, &UgaHorizontalResolution, @@ -3090,51 +3051,26 @@ ConSplitterTextOutAddDevice ( &UgaColorDepth, &UgaRefreshRate ); - if (!EFI_ERROR (Status)) { - Status = ConSpliterUgaDrawSetMode ( - &Private->UgaDraw, - UgaHorizontalResolution, - UgaVerticalResolution, - UgaColorDepth, - UgaRefreshRate - ); - } - // - // If GetMode/SetMode is failed, set to 800x600 mode - // - if(EFI_ERROR (Status)) { - Status = ConSpliterUgaDrawSetMode ( - &Private->UgaDraw, - 800, - 600, - 32, - 60 - ); - } } - } - if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) { - // - // We just added a new GOP or UGA device in graphics mode // - if (FeaturePcdGet (PcdConOutGopSupport)) { - DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw); - } else if (FeaturePcdGet (PcdConOutUgaSupport)) { - 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 + // Set UGA Draw mode, + // if GetMode is failed, set to 800x600 mode // - DevNullSyncStdOut (Private); - } else { - // - // If ConOut, then set the mode to Mode #0 which us 80 x 25 - // - Private->TextOut.SetMode (&Private->TextOut, 0); + Status = ConSpliterUgaDrawSetMode ( + &Private->UgaDraw, + UgaHorizontalResolution, + UgaVerticalResolution, + UgaColorDepth, + UgaRefreshRate + ); } + // + // 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 // synced to the current shared mode. @@ -3198,13 +3134,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; } @@ -3336,149 +3272,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; -} - - -/** - This timer event will fire when StdIn is locked. It will check the key - sequence on StdIn to see if it matches the password. Any error in the - password will cause the check to reset. As long 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 it's an ENTER, match password - // - if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN) && (Key.ScanCode == SCAN_NULL)) { - mConIn.PwdAttempt[mConIn.PwdIndex] = CHAR_NULL; - if (StrCmp (mConIn.Password, mConIn.PwdAttempt)) { - // - // 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 - // - 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 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 - ) -{ - 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; - 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. @@ -3499,12 +3296,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; @@ -3513,8 +3304,8 @@ ConSplitterTextInReadKeyStroke ( /** - This event agregates all the events of the ConIn devices in the spliter. - If the ConIn is password locked then return. + This event aggregates all the events of the ConIn devices in the spliter. + If any events of physical ConIn devices are signaled, signal the ConIn spliter event. This will cause the calling code to call ConSplitterTextInReadKeyStroke (). @@ -3535,22 +3326,17 @@ ConSplitterTextInWaitForKey ( UINTN Index; Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context; - if (Private->PasswordEnabled) { - // - // If StdIn Locked return not ready - // - return ; - } - // - // if KeyEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke() - // if (Private->KeyEventSignalState) { + // + // If KeyEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke() + // gBS->SignalEvent (Event); return ; } + // - // if any physical console input device has key input, signal the event. + // If any physical console input device has key input, signal the event. // for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) { Status = gBS->CheckEvent (Private->TextInList[Index]->WaitForKey); @@ -3686,12 +3472,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; @@ -3785,7 +3565,7 @@ ConSplitterTextInSetState ( successfully. @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data structures. - @retval EFI_INVALID_PARAMETER KeyData or NotifyHandle is NULL. + @retval EFI_INVALID_PARAMETER KeyData or KeyNotificationFunction or NotifyHandle is NULL. **/ EFI_STATUS @@ -3812,7 +3592,7 @@ ConSplitterTextInRegisterKeyNotify ( Private = TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS (This); // - // if no physical console input device exists, + // If no physical console input device exists, // return EFI_SUCCESS directly. // if (Private->CurrentNumberOfExConsoles <= 0) { @@ -3846,6 +3626,7 @@ ConSplitterTextInRegisterKeyNotify ( } NewNotify->Signature = TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE; NewNotify->KeyNotificationFn = KeyNotificationFunction; + NewNotify->NotifyHandle = (EFI_HANDLE) NewNotify; CopyMem (&NewNotify->KeyData, KeyData, sizeof (KeyData)); // @@ -3866,17 +3647,6 @@ ConSplitterTextInRegisterKeyNotify ( } } - // - // Use gSimpleTextInExNotifyGuid to get a valid EFI_HANDLE - // - Status = gBS->InstallMultipleProtocolInterfaces ( - &NewNotify->NotifyHandle, - &gSimpleTextInExNotifyGuid, - NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); - InsertTailList (&mConIn.NotifyList, &NewNotify->NotifyEntry); *NotifyHandle = NewNotify->NotifyHandle; @@ -3896,7 +3666,6 @@ ConSplitterTextInRegisterKeyNotify ( @retval EFI_SUCCESS The notification function was unregistered successfully. @retval EFI_INVALID_PARAMETER The NotificationHandle is invalid. - @retval EFI_NOT_FOUND Can not find the matching entry in database. **/ EFI_STATUS @@ -3916,18 +3685,10 @@ ConSplitterTextInUnregisterKeyNotify ( return EFI_INVALID_PARAMETER; } - Status = gBS->OpenProtocol ( - NotificationHandle, - &gSimpleTextInExNotifyGuid, - NULL, - NULL, - NULL, - EFI_OPEN_PROTOCOL_TEST_PROTOCOL - ); - if (EFI_ERROR (Status)) { + if (((TEXT_IN_EX_SPLITTER_NOTIFY *) NotificationHandle)->Signature != TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE) { return EFI_INVALID_PARAMETER; - } - + } + Private = TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS (This); // @@ -3951,21 +3712,17 @@ ConSplitterTextInUnregisterKeyNotify ( } } RemoveEntryList (&CurrentNotify->NotifyEntry); - Status = gBS->UninstallMultipleProtocolInterfaces ( - CurrentNotify->NotifyHandle, - &gSimpleTextInExNotifyGuid, - NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); + gBS->FreePool (CurrentNotify->NotifyHandleList); gBS->FreePool (CurrentNotify); return EFI_SUCCESS; } } - return EFI_NOT_FOUND; - + // + // NotificationHandle is not found in database + // + return EFI_INVALID_PARAMETER; } @@ -4095,7 +3852,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 @@ -4116,12 +3872,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; @@ -4131,7 +3881,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 (). @@ -4152,12 +3901,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() @@ -4255,12 +3998,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; @@ -4309,7 +4046,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 (). @@ -4330,12 +4066,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, @@ -4388,25 +4118,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; } @@ -4450,40 +4176,39 @@ ConSplitterTextOutOutputString ( Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This); BackSpaceCount = 0; + for (TargetString = WString; *TargetString != L'\0'; TargetString++) { if (*TargetString == CHAR_BACKSPACE) { BackSpaceCount++; } - } if (BackSpaceCount == 0) { TargetString = WString; } else { TargetString = AllocatePool (sizeof (CHAR16) * (StrLen (WString) + BackSpaceCount + 1)); + ASSERT (TargetString != NULL); + StrCpy (TargetString, WString); } // // 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; } } + if (Private->CurrentNumberOfConsoles > 0) { + Private->TextOutMode.CursorColumn = Private->TextOutList[0].TextOut->Mode->CursorColumn; + Private->TextOutMode.CursorRow = Private->TextOutList[0].TextOut->Mode->CursorRow; + } + if (BackSpaceCount > 0) { FreePool (TargetString); } @@ -4525,14 +4250,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; } } // @@ -4659,32 +4382,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; } @@ -4732,15 +4450,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; } } @@ -4779,19 +4494,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; } @@ -4858,20 +4574,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; } @@ -4909,19 +4628,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; }