X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FConsole%2FConSplitterDxe%2FConSplitter.c;h=153974a051108a494d0cb81385b282786d21f459;hb=f890b1e053c20f386fbd6bc9a8db39b5104a5777;hp=88274b117a8d11bcfb898ff45b9a975cbc83b4dc;hpb=0ce1dd70a9d2b70fbedaefb1ba9d664b8a7bb4ef;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 88274b117a..153974a051 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -1,6 +1,7 @@ -/**@file - Console Splitter Driver. Any Handle that attatched - EFI_CONSOLE_IDENTIFIER_PROTOCOL can be bound by this driver. +/** @file + Console Splitter Driver. Any Handle that attatched console I/O protocols + (Console In device, Console Out device, Console Error device, Simple Pointer + protocol, Absolute Pointer protocol) can be bound by this driver. So far it works like any other driver by opening a SimpleTextIn and/or SimpleTextOut protocol with EFI_OPEN_PROTOCOL_BY_DRIVER attributes. The big @@ -8,15 +9,14 @@ handle, or construct a child handle like a standard device or bus driver. This driver produces three virtual handles as children, one for console input splitter, one for console output splitter and one for error output splitter. - EFI_CONSOLE_SPLIT_PROTOCOL will be attatched onto each virtual handle to - identify the splitter type. + These 3 virtual handles would be installed on gST. - Each virtual handle, that supports both the EFI_CONSOLE_SPLIT_PROTOCOL - and 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 device situation. + 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 + device situation. -Copyright (c) 2006 - 2007 Intel Corporation.
+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 @@ -30,9 +30,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "ConSplitter.h" // -// Global Variables +// Text In Splitter Private Data template // -STATIC TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { +GLOBAL_REMOVE_IF_UNREFERENCED TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE, (EFI_HANDLE) NULL, { @@ -55,8 +55,8 @@ STATIC TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL **) NULL, 0, { - (struct _LIST_ENTRY *) NULL, - (struct _LIST_ENTRY *) NULL + (LIST_ENTRY *) NULL, + (LIST_ENTRY *) NULL }, { @@ -84,13 +84,13 @@ STATIC TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { }, { - 0, //AbsoluteMinX - 0, //AbsoluteMinY - 0, //AbsoluteMinZ - 0x10000, //AbsoluteMaxX - 0x10000, //AbsoluteMaxY - 0x10000, //AbsoluteMaxZ - 0 //Attributes + 0, // AbsoluteMinX + 0, // AbsoluteMinY + 0, // AbsoluteMinZ + 0x10000, // AbsoluteMaxX + 0x10000, // AbsoluteMaxY + 0x10000, // AbsoluteMaxZ + 0 // Attributes }, 0, (EFI_ABSOLUTE_POINTER_PROTOCOL **) NULL, @@ -117,20 +117,31 @@ STATIC TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = { FALSE }; -GLOBAL_REMOVE_IF_UNREFERENCED EFI_UGA_DRAW_PROTOCOL gUgaDrawProtocolTemplate = { + +// +// Uga Draw Protocol Private Data template +// +GLOBAL_REMOVE_IF_UNREFERENCED EFI_UGA_DRAW_PROTOCOL mUgaDrawProtocolTemplate = { ConSpliterUgaDrawGetMode, ConSpliterUgaDrawSetMode, ConSpliterUgaDrawBlt }; -GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_PROTOCOL gGraphicsOutputProtocolTemplate = { +// +// Graphics Output Protocol Private Data template +// +GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_PROTOCOL mGraphicsOutputProtocolTemplate = { ConSpliterGraphicsOutputQueryMode, ConSpliterGraphicsOutputSetMode, ConSpliterGraphicsOutputBlt, NULL }; -STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = { + +// +// Text Out Splitter Private Data template +// +GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = { TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE, (EFI_HANDLE) NULL, { @@ -194,7 +205,10 @@ STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = { (INT32 *) NULL }; -STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = { +// +// Standard Error Text Out Splitter Data Template +// +GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = { TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE, (EFI_HANDLE) NULL, { @@ -258,6 +272,9 @@ STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = { (INT32 *) NULL }; +// +// Driver binding instance for Console Input Device +// EFI_DRIVER_BINDING_PROTOCOL gConSplitterConInDriverBinding = { ConSplitterConInDriverBindingSupported, ConSplitterConInDriverBindingStart, @@ -267,47 +284,61 @@ EFI_DRIVER_BINDING_PROTOCOL gConSplitterConInDriverBinding = { NULL }; -EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding = { - ConSplitterSimplePointerDriverBindingSupported, - ConSplitterSimplePointerDriverBindingStart, - ConSplitterSimplePointerDriverBindingStop, +// +// Driver binding instance for Console Out device +// +EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding = { + ConSplitterConOutDriverBindingSupported, + ConSplitterConOutDriverBindingStart, + ConSplitterConOutDriverBindingStop, 0xa, NULL, NULL }; // -// Driver binding instance for Absolute Pointer protocol +// Driver binding instance for Standard Error device // -EFI_DRIVER_BINDING_PROTOCOL gConSplitterAbsolutePointerDriverBinding = { - ConSplitterAbsolutePointerDriverBindingSupported, - ConSplitterAbsolutePointerDriverBindingStart, - ConSplitterAbsolutePointerDriverBindingStop, +EFI_DRIVER_BINDING_PROTOCOL gConSplitterStdErrDriverBinding = { + ConSplitterStdErrDriverBindingSupported, + ConSplitterStdErrDriverBindingStart, + ConSplitterStdErrDriverBindingStop, 0xa, NULL, NULL }; -EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding = { - ConSplitterConOutDriverBindingSupported, - ConSplitterConOutDriverBindingStart, - ConSplitterConOutDriverBindingStop, +// +// Driver binding instance for Simple Pointer protocol +// +EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding = { + ConSplitterSimplePointerDriverBindingSupported, + ConSplitterSimplePointerDriverBindingStart, + ConSplitterSimplePointerDriverBindingStop, 0xa, NULL, NULL }; -EFI_DRIVER_BINDING_PROTOCOL gConSplitterStdErrDriverBinding = { - ConSplitterStdErrDriverBindingSupported, - ConSplitterStdErrDriverBindingStart, - ConSplitterStdErrDriverBindingStop, +// +// Driver binding instance for Absolute Pointer protocol +// +EFI_DRIVER_BINDING_PROTOCOL gConSplitterAbsolutePointerDriverBinding = { + ConSplitterAbsolutePointerDriverBindingSupported, + ConSplitterAbsolutePointerDriverBindingStart, + ConSplitterAbsolutePointerDriverBindingStop, 0xa, NULL, NULL }; /** - The user Entry Point for module ConSplitter. The user code starts with this function. + The Entry Point for module ConSplitter. The user code starts with this function. + + 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. + Installs Graphics Output protocol and/or UGA Draw protocol if needed. @param[in] ImageHandle The firmware allocated handle for the EFI image. @param[in] SystemTable A pointer to the EFI System Table. @@ -318,7 +349,7 @@ EFI_DRIVER_BINDING_PROTOCOL gConSplitterStdErrDriverBinding = { **/ EFI_STATUS EFIAPI -InitializeConSplitter( +ConSplitterDriverEntry( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) @@ -378,40 +409,12 @@ InitializeConSplitter( ); ASSERT_EFI_ERROR (Status); - // - // Call the original Entry Point + // Either Graphics Output protocol or UGA Draw protocol must be supported. // - Status = ConSplitterDriverEntry (ImageHandle, SystemTable); - - return Status; -} - - -EFI_STATUS -EFIAPI -ConSplitterDriverEntry ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - -Routine Description: - Intialize a virtual console device to act as an agrigator of physical console - devices. - -Arguments: - ImageHandle - (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT) - SystemTable - (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT) -Returns: - EFI_SUCCESS - ---*/ -{ - EFI_STATUS Status; - ASSERT (FeaturePcdGet (PcdConOutGopSupport) || FeaturePcdGet (PcdConOutUgaSupport)); + // // The driver creates virtual handles for ConIn, ConOut, and StdErr. // The virtual handles will always exist even if no console exist in the @@ -453,6 +456,7 @@ Returns: if (!EFI_ERROR (Status)) { // // Update the EFI System Table with new virtual console + // and update the pointer to Simple Text Input protocol. // gST->ConsoleInHandle = mConIn.VirtualHandle; gST->ConIn = &mConIn.TextIn; @@ -465,7 +469,8 @@ Returns: if (!EFI_ERROR (Status)) { if (!FeaturePcdGet (PcdConOutGopSupport)) { // - // In EFI mode, UGA Draw protocol is installed + // If Graphics Outpurt protocol not supported, UGA Draw protocol is installed + // on the virtual handle. // Status = gBS->InstallMultipleProtocolInterfaces ( &mConOut.VirtualHandle, @@ -481,7 +486,8 @@ Returns: ); } else if (!FeaturePcdGet (PcdConOutUgaSupport)) { // - // In UEFI mode, Graphics Output Protocol is installed on virtual handle. + // If UGA Draw protocol not supported, Graphics Output Protocol is installed + // on virtual handle. // Status = gBS->InstallMultipleProtocolInterfaces ( &mConOut.VirtualHandle, @@ -497,8 +503,8 @@ Returns: ); } else { // - // In EFI and UEFI comptible mode, Graphics Output Protocol and UGA are - // installed on virtual handle. + // Boot Graphics Output protocol and UGA Draw protocol are supported, + // both they will be installed on virtual handle. // Status = gBS->InstallMultipleProtocolInterfaces ( &mConOut.VirtualHandle, @@ -519,6 +525,7 @@ Returns: if (!EFI_ERROR (Status)) { // // Update the EFI System Table with new virtual console + // and Update the pointer to Text Output protocol. // gST->ConsoleOutHandle = mConOut.VirtualHandle; gST->ConOut = &mConOut.TextOut; @@ -536,31 +543,29 @@ Returns: ); return EFI_SUCCESS; + } +/** + Construct console input devices' private data. + + @param ConInPrivate A pointer to the TEXT_IN_SPLITTER_PRIVATE_DATA + structure. + + @retval EFI_OUT_OF_RESOURCES Out of resources. + @retval EFI_SUCCESS Text Input Devcie's private data has been constructed. + @retval other Failed to construct private data. + +**/ EFI_STATUS ConSplitterTextInConstructor ( TEXT_IN_SPLITTER_PRIVATE_DATA *ConInPrivate ) -/*++ - -Routine Description: - - Construct the ConSplitter. - -Arguments: - - ConInPrivate - A pointer to the TEXT_IN_SPLITTER_PRIVATE_DATA structure. - -Returns: - EFI_OUT_OF_RESOURCES - Out of resources. - ---*/ { EFI_STATUS Status; // - // Initilize console input splitter's private data. + // Allocate buffer for Simple Text Input device // Status = ConSplitterGrowBuffer ( sizeof (EFI_SIMPLE_TEXT_INPUT_PROTOCOL *), @@ -581,7 +586,9 @@ Returns: &ConInPrivate->LockEvent ); ASSERT_EFI_ERROR (Status); - + // + // Create Event to wait for a key + // Status = gBS->CreateEvent ( EVT_NOTIFY_WAIT, TPL_NOTIFY, @@ -592,7 +599,7 @@ Returns: ASSERT_EFI_ERROR (Status); // - // Buffer for Simple Text Input Ex Protocol + // Allocate buffer for Simple Text Input Ex device // Status = ConSplitterGrowBuffer ( sizeof (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *), @@ -602,7 +609,9 @@ Returns: if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } - + // + // Create Event to wait for a key Ex + // Status = gBS->CreateEvent ( EVT_NOTIFY_WAIT, TPL_NOTIFY, @@ -614,11 +623,10 @@ Returns: InitializeListHead (&ConInPrivate->NotifyList); + ConInPrivate->AbsolutePointer.Mode = &ConInPrivate->AbsolutePointerMode; // - // Allocate Buffer and Create Event for Absolute Pointer and Simple Pointer Protocols + // Allocate buffer for Absolute Pointer device // - ConInPrivate->AbsolutePointer.Mode = &ConInPrivate->AbsolutePointerMode; - Status = ConSplitterGrowBuffer ( sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *), &ConInPrivate->AbsolutePointerListCount, @@ -627,7 +635,9 @@ Returns: if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } - + // + // Create Event to wait for device input for Absolute pointer device + // Status = gBS->CreateEvent ( EVT_NOTIFY_WAIT, TPL_NOTIFY, @@ -638,7 +648,9 @@ Returns: ASSERT_EFI_ERROR (Status); ConInPrivate->SimplePointer.Mode = &ConInPrivate->SimplePointerMode; - + // + // Allocate buffer for Simple Pointer device + // Status = ConSplitterGrowBuffer ( sizeof (EFI_SIMPLE_POINTER_PROTOCOL *), &ConInPrivate->PointerListCount, @@ -647,7 +659,9 @@ Returns: if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } - + // + // Create Event to wait for device input for Simple pointer device + // Status = gBS->CreateEvent ( EVT_NOTIFY_WAIT, TPL_NOTIFY, @@ -659,6 +673,16 @@ Returns: return Status; } +/** + Construct console output devices' private data. + + @param ConOutPrivate A pointer to the TEXT_OUT_SPLITTER_PRIVATE_DATA + structure. + + @retval EFI_OUT_OF_RESOURCES Out of resources. + @retval EFI_SUCCESS Text Input Devcie's private data has been constructed. + +**/ EFI_STATUS ConSplitterTextOutConstructor ( TEXT_OUT_SPLITTER_PRIVATE_DATA *ConOutPrivate @@ -671,11 +695,10 @@ ConSplitterTextOutConstructor ( // Copy protocols template // if (FeaturePcdGet (PcdConOutUgaSupport)) { - CopyMem (&ConOutPrivate->UgaDraw, &gUgaDrawProtocolTemplate, sizeof (EFI_UGA_DRAW_PROTOCOL)); + CopyMem (&ConOutPrivate->UgaDraw, &mUgaDrawProtocolTemplate, sizeof (EFI_UGA_DRAW_PROTOCOL)); } - if (FeaturePcdGet (PcdConOutGopSupport)) { - CopyMem (&ConOutPrivate->GraphicsOutput, &gGraphicsOutputProtocolTemplate, sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL)); + CopyMem (&ConOutPrivate->GraphicsOutput, &mGraphicsOutputProtocolTemplate, sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL)); } // @@ -688,7 +711,9 @@ ConSplitterTextOutConstructor ( // so put current mode back to init state. // ConOutPrivate->TextOutMode.Mode = 0xFF; - + // + // Allocate buffer for Console Out device + // Status = ConSplitterGrowBuffer ( sizeof (TEXT_OUT_AND_GOP_DATA), &ConOutPrivate->TextOutListCount, @@ -697,7 +722,9 @@ ConSplitterTextOutConstructor ( if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } - + // + // Allocate buffer for Text Out query data + // Status = ConSplitterGrowBuffer ( sizeof (TEXT_OUT_SPLITTER_QUERY_DATA), &ConOutPrivate->TextOutQueryDataCount, @@ -706,6 +733,7 @@ ConSplitterTextOutConstructor ( if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } + // // Setup the DevNullTextOut console to 80 x 25 // @@ -715,7 +743,7 @@ ConSplitterTextOutConstructor ( if (FeaturePcdGet (PcdConOutUgaSupport)) { // - // Setup the DevNullUgaDraw to 800 x 600 x 32 bits per pixel + // Setup the DevNullUgaDraw to 800 x 600 x 32 bits per pixel, 60Hz. // ConSpliterUgaDrawSetMode (&ConOutPrivate->UgaDraw, 800, 600, 32, 60); } @@ -754,38 +782,34 @@ ConSplitterTextOutConstructor ( ConOutPrivate->GraphicsOutput.Mode->MaxMode = 1; // - // Initial current mode to unknow state, and then set to mode 0 + // Initial current mode to unknown state, and then set to mode 0 // ConOutPrivate->GraphicsOutput.Mode->Mode = 0xffff; ConOutPrivate->GraphicsOutput.SetMode (&ConOutPrivate->GraphicsOutput, 0); } - return Status; + return EFI_SUCCESS; } -STATIC + +/** + 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. + @param Guid The specified protocol. + + @retval EFI_SUCCESS The specified protocol is supported on this device. + @retval EFI_UNSUPPORTED The specified protocol attempts to be installed on virtul handle. + @retval other Failed to open specified protocol on this device. + +**/ EFI_STATUS ConSplitterSupported ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_GUID *Guid ) -/*++ - -Routine Description: - Generic Supported Check - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller Handle. - Guid - Guid. - -Returns: - - EFI_UNSUPPORTED - unsupported. - EFI_SUCCESS - operation is OK. - ---*/ { EFI_STATUS Status; VOID *Instance; @@ -793,19 +817,15 @@ Returns: // // Make sure the Console Splitter does not attempt to attach to itself // - if (ControllerHandle == mConIn.VirtualHandle) { - return EFI_UNSUPPORTED; - } - - if (ControllerHandle == mConOut.VirtualHandle) { + if (ControllerHandle == mConIn.VirtualHandle || + ControllerHandle == mConOut.VirtualHandle || + ControllerHandle == mStdErr.VirtualHandle + ) { return EFI_UNSUPPORTED; } - if (ControllerHandle == mStdErr.VirtualHandle) { - return EFI_UNSUPPORTED; - } // - // Check to see whether the handle has the ConsoleInDevice GUID on it + // Check to see whether the specific protocol could be opened BY_DRIVER // Status = gBS->OpenProtocol ( ControllerHandle, @@ -830,6 +850,18 @@ Returns: return EFI_SUCCESS; } +/** + 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. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device. + @retval other This driver does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterConInDriverBindingSupported ( @@ -837,21 +869,6 @@ ConSplitterConInDriverBindingSupported ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Console In Supported Check - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - - EFI_STATUS - ---*/ { return ConSplitterSupported ( This, @@ -860,6 +877,18 @@ Returns: ); } +/** + 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. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device. + @retval other This driver does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterSimplePointerDriverBindingSupported ( @@ -867,21 +896,6 @@ ConSplitterSimplePointerDriverBindingSupported ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Standard Error Supported Check - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - - EFI_STATUS - ---*/ { return ConSplitterSupported ( This, @@ -890,6 +904,18 @@ Returns: ); } +/** + 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. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device. + @retval other This driver does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterAbsolutePointerDriverBindingSupported ( @@ -897,21 +923,6 @@ ConSplitterAbsolutePointerDriverBindingSupported ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Absolute Pointer Supported Check - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - - EFI_STATUS - ---*/ { return ConSplitterSupported ( This, @@ -920,6 +931,19 @@ Returns: ); } + +/** + 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. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device. + @retval other This driver does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterConOutDriverBindingSupported ( @@ -927,21 +951,6 @@ ConSplitterConOutDriverBindingSupported ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Console Out Supported Check - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - - EFI_STATUS - ---*/ { return ConSplitterSupported ( This, @@ -950,6 +959,18 @@ Returns: ); } +/** + 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. + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device. + @retval other This driver does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterStdErrDriverBindingSupported ( @@ -957,21 +978,6 @@ ConSplitterStdErrDriverBindingSupported ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Standard Error Supported Check - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - - EFI_STATUS - ---*/ { return ConSplitterSupported ( This, @@ -980,36 +986,39 @@ Returns: ); } -STATIC + +/** + 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. + @param DeviceGuid The specified Console Device, such as ConInDev, + ConOutDev. + @param InterfaceGuid The specified protocol to be opened. + @param Interface Protocol interface returned. + + @retval EFI_SUCCESS This driver supports this device. + @retval other Failed to open the specified Console Device Guid + or specified protocol. + +**/ EFI_STATUS -EFIAPI ConSplitterStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ConSplitterVirtualHandle, IN EFI_GUID *DeviceGuid, IN EFI_GUID *InterfaceGuid, - IN VOID **Interface + OUT VOID **Interface ) -/*++ - -Routine Description: - Start ConSplitter on ControllerHandle, and create the virtual - agrogated console device on first call Start for a SimpleTextIn handle. - -Arguments: - (Standard DriverBinding Protocol Start() function) - -Returns: - EFI_ERROR if a SimpleTextIn protocol is not started. - ---*/ { EFI_STATUS Status; VOID *Instance; // - // Check to see whether the handle has the ConsoleInDevice GUID on it + // Check to see whether the ControllerHandle has the DeviceGuid on it. // Status = gBS->OpenProtocol ( ControllerHandle, @@ -1023,6 +1032,9 @@ Returns: return Status; } + // + // Create virtual handle and open DeviceGuid on the virtul handle. + // Status = gBS->OpenProtocol ( ControllerHandle, DeviceGuid, @@ -1032,10 +1044,13 @@ Returns: EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER ); if (EFI_ERROR (Status)) { - return Status; + goto Err; } - return gBS->OpenProtocol ( + // + // Open InterfaceGuid on the virtul handle. + // + Status = gBS->OpenProtocol ( ControllerHandle, InterfaceGuid, Interface, @@ -1043,8 +1058,48 @@ Returns: ConSplitterVirtualHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); + + if (!EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + + // + // close the DeviceGuid on ConSplitter VirtualHandle. + // + gBS->CloseProtocol ( + ControllerHandle, + DeviceGuid, + This->DriverBindingHandle, + ConSplitterVirtualHandle + ); + +Err: + // + // close the DeviceGuid on ControllerHandle. + // + gBS->CloseProtocol ( + ControllerHandle, + DeviceGuid, + This->DriverBindingHandle, + ControllerHandle + ); + + return Status; } + +/** + 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 + device to start. + + @retval EFI_SUCCESS Console In Consplitter is added to ControllerHandle. + @retval other Console In Consplitter does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterConInDriverBindingStart ( @@ -1052,27 +1107,10 @@ ConSplitterConInDriverBindingStart ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Start ConSplitter on ControllerHandle, and create the virtual - agrogated console device on first call Start for a SimpleTextIn handle. - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - - EFI_STATUS - EFI_ERROR if a SimpleTextIn protocol is not started. - ---*/ { - EFI_STATUS Status; - EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn; - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx; + EFI_STATUS Status; + EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn; + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx; // // Start ConSplitter on ControllerHandle, and create the virtual @@ -1090,6 +1128,9 @@ Returns: return Status; } + // + // Add this device into Text In devices list. + // Status = ConSplitterTextInAddDevice (&mConIn, TextIn); if (EFI_ERROR (Status)) { return Status; @@ -1103,15 +1144,30 @@ Returns: mConIn.VirtualHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); - if (EFI_ERROR (Status)) { - return Status; + if (!EFI_ERROR (Status)) { + // + // If Simple Text Input Ex protocol exists, + // add this device into Text In Ex devices list. + // + Status = ConSplitterTextInExAddDevice (&mConIn, TextInEx); } - Status = ConSplitterTextInExAddDevice (&mConIn, TextInEx); - return Status; } + +/** + 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 + device to start. + + @retval EFI_SUCCESS Simple Pointer Consplitter is added to ControllerHandle. + @retval other Simple Pointer Consplitter does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterSimplePointerDriverBindingStart ( @@ -1119,26 +1175,14 @@ ConSplitterSimplePointerDriverBindingStart ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Start ConSplitter on ControllerHandle, and create the virtual - agrogated console device on first call Start for a SimpleTextIn handle. - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - - EFI_ERROR if a SimpleTextIn protocol is not started. - ---*/ { EFI_STATUS Status; EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer; + // + // Start ConSplitter on ControllerHandle, and create the virtual + // agrogated console device on first call Start for a SimplePointer handle. + // Status = ConSplitterStart ( This, ControllerHandle, @@ -1151,9 +1195,25 @@ Returns: return Status; } + // + // Add this devcie into Simple Pointer devices list. + // return ConSplitterSimplePointerAddDevice (&mConIn, SimplePointer); } + +/** + 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 + device to start. + + @retval EFI_SUCCESS Absolute Pointer Consplitter is added to ControllerHandle. + @retval other Absolute Pointer Consplitter does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterAbsolutePointerDriverBindingStart ( @@ -1161,26 +1221,14 @@ ConSplitterAbsolutePointerDriverBindingStart ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Start ConSplitter on ControllerHandle, and create the virtual - agrogated console device on first call Start for a ConIn handle. - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - - EFI_ERROR if a AbsolutePointer protocol is not started. - ---*/ { EFI_STATUS Status; EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer; + // + // Start ConSplitter on ControllerHandle, and create the virtual + // agrogated console device on first call Start for a AbsolutePointer handle. + // Status = ConSplitterStart ( This, ControllerHandle, @@ -1194,9 +1242,25 @@ Returns: return Status; } + // + // Add this devcie into Absolute Pointer devices list. + // return ConSplitterAbsolutePointerAddDevice (&mConIn, AbsolutePointer); } + +/** + 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 + device to start. + + @retval EFI_SUCCESS Console Out Consplitter is added to ControllerHandle. + @retval other Console Out Consplitter does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterConOutDriverBindingStart ( @@ -1204,27 +1268,18 @@ ConSplitterConOutDriverBindingStart ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Start ConSplitter on ControllerHandle, and create the virtual - agrogated console device on first call Start for a SimpleTextIn handle. - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - EFI_ERROR if a SimpleTextIn protocol is not started. - ---*/ { - 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 + // agrogated console device on first call Start for a ConsoleOut handle. + // Status = ConSplitterStart ( This, ControllerHandle, @@ -1253,16 +1308,16 @@ Returns: if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { // - // Open UGA_DRAW protocol + // 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 + ); } // @@ -1278,12 +1333,26 @@ Returns: 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, @@ -1292,9 +1361,23 @@ Returns: ); } } + return Status; } + +/** + 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 + device to start. + + @retval EFI_SUCCESS Standard Error Consplitter is added to ControllerHandle. + @retval other Standard Error Consplitter does not support this device. + +**/ EFI_STATUS EFIAPI ConSplitterStdErrDriverBindingStart ( @@ -1302,25 +1385,14 @@ ConSplitterStdErrDriverBindingStart ( IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) -/*++ - -Routine Description: - Start ConSplitter on ControllerHandle, and create the virtual - agrogated console device on first call Start for a SimpleTextIn handle. - -Arguments: - This - Pointer to protocol. - ControllerHandle - Controller handle. - RemainingDevicePath - Remaining device path. - -Returns: - EFI_ERROR if a SimpleTextIn protocol is not started. - ---*/ { EFI_STATUS Status; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; + // + // Start ConSplitter on ControllerHandle, and create the virtual + // agrogated console device on first call Start for a StandardError handle. + // Status = ConSplitterStart ( This, ControllerHandle, @@ -1366,9 +1438,24 @@ Returns: return Status; } -STATIC + +/** + 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. + @param DeviceGuid The specified Console Device, such as ConInDev, + ConOutDev. + @param InterfaceGuid The specified protocol to be opened. + @param Interface Protocol interface returned. + + @retval EFI_SUCCESS Stop ConSplitter on ControllerHandle successfully. + @retval other Failed to Stop ConSplitter on ControllerHandle. + +**/ EFI_STATUS -EFIAPI ConSplitterStop ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, @@ -1377,18 +1464,6 @@ ConSplitterStop ( IN EFI_GUID *InterfaceGuid, IN VOID **Interface ) -/*++ - -Routine Description: - -Arguments: - (Standard DriverBinding Protocol Stop() function) - -Returns: - - None - ---*/ { EFI_STATUS Status; @@ -1412,6 +1487,7 @@ Returns: This->DriverBindingHandle, ConSplitterVirtualHandle ); + gBS->CloseProtocol ( ControllerHandle, DeviceGuid, @@ -1422,6 +1498,20 @@ Returns: return EFI_SUCCESS; } + +/** + Stop Console In ConSplitter on ControllerHandle by closing Console In Devcice GUID. + + @param This Driver Binding protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI ConSplitterConInDriverBindingStop ( @@ -1430,23 +1520,11 @@ ConSplitterConInDriverBindingStop ( IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer ) -/*++ - -Routine Description: - -Arguments: - (Standard DriverBinding Protocol Stop() function) - -Returns: - - None - ---*/ { - EFI_STATUS Status; - EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn; - + EFI_STATUS Status; + EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn; EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx; + if (NumberOfChildren == 0) { return EFI_SUCCESS; } @@ -1459,16 +1537,20 @@ Returns: ControllerHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = ConSplitterTextInExDeleteDevice (&mConIn, TextInEx); - if (EFI_ERROR (Status)) { - return Status; + if (!EFI_ERROR (Status)) { + // + // 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; + } } - + // + // Close Simple Text In protocol on controller handle and virtual handle. + // Status = ConSplitterStop ( This, ControllerHandle, @@ -1480,12 +1562,28 @@ Returns: if (EFI_ERROR (Status)) { return Status; } + // - // Delete this console input device's data structures. + // Remove device from Text Input devices list. // return ConSplitterTextInDeleteDevice (&mConIn, TextIn); } + +/** + Stop Simple Pointer protocol ConSplitter on ControllerHandle by closing + Simple Pointer protocol. + + @param This Driver Binding protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI ConSplitterSimplePointerDriverBindingStop ( @@ -1494,18 +1592,6 @@ ConSplitterSimplePointerDriverBindingStop ( IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer ) -/*++ - -Routine Description: - -Arguments: - (Standard DriverBinding Protocol Stop() function) - -Returns: - - None - ---*/ { EFI_STATUS Status; EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer; @@ -1514,6 +1600,9 @@ Returns: return EFI_SUCCESS; } + // + // Close Simple Pointer protocol on controller handle and virtual handle. + // Status = ConSplitterStop ( This, ControllerHandle, @@ -1525,12 +1614,28 @@ Returns: if (EFI_ERROR (Status)) { return Status; } + // - // Delete this console input device's data structures. + // Remove this device from Simple Pointer device list. // return ConSplitterSimplePointerDeleteDevice (&mConIn, SimplePointer); } + +/** + Stop Absolute Pointer protocol ConSplitter on ControllerHandle by closing + Absolute Pointer protocol. + + @param This Driver Binding protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI ConSplitterAbsolutePointerDriverBindingStop ( @@ -1539,18 +1644,6 @@ ConSplitterAbsolutePointerDriverBindingStop ( IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer ) -/*++ - -Routine Description: - -Arguments: - (Standard DriverBinding Protocol Stop() function) - -Returns: - - None - ---*/ { EFI_STATUS Status; EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer; @@ -1559,6 +1652,9 @@ Returns: return EFI_SUCCESS; } + // + // Close Absolute Pointer protocol on controller handle and virtual handle. + // Status = ConSplitterStop ( This, ControllerHandle, @@ -1570,12 +1666,27 @@ Returns: if (EFI_ERROR (Status)) { return Status; } + // - // Delete this console input device's data structures. + // Remove this device from Absolute Pointer device list. // return ConSplitterAbsolutePointerDeleteDevice (&mConIn, AbsolutePointer); } + +/** + Stop Console Out ConSplitter on device handle by closing Console Out Devcice GUID. + + @param This Driver Binding protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI ConSplitterConOutDriverBindingStop ( @@ -1584,18 +1695,6 @@ ConSplitterConOutDriverBindingStop ( IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer ) -/*++ - -Routine Description: - -Arguments: - (Standard DriverBinding Protocol Stop() function) - -Returns: - - None - ---*/ { EFI_STATUS Status; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; @@ -1604,6 +1703,9 @@ Returns: return EFI_SUCCESS; } + // + // Close Absolute Pointer protocol on controller handle and virtual handle. + // Status = ConSplitterStop ( This, ControllerHandle, @@ -1617,11 +1719,25 @@ Returns: } // - // Delete this console output device's data structures. + // Remove this device from Text Out device list. // return ConSplitterTextOutDeleteDevice (&mConOut, TextOut); } + +/** + Stop Standard Error ConSplitter on ControllerHandle by closing Standard Error GUID. + + @param This Driver Binding protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ EFI_STATUS EFIAPI ConSplitterStdErrDriverBindingStop ( @@ -1630,18 +1746,6 @@ ConSplitterStdErrDriverBindingStop ( IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer ) -/*++ - -Routine Description: - -Arguments: - (Standard DriverBinding Protocol Stop() function) - -Returns: - - EFI_SUCCESS - Complete successfully. - ---*/ { EFI_STATUS Status; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut; @@ -1650,6 +1754,9 @@ Returns: return EFI_SUCCESS; } + // + // Close Standard Error Device on controller handle and virtual handle. + // Status = ConSplitterStop ( This, ControllerHandle, @@ -1686,36 +1793,29 @@ Returns: return Status; } -EFI_STATUS -ConSplitterGrowBuffer ( - IN UINTN SizeOfCount, - IN UINTN *Count, - IN OUT VOID **Buffer - ) -/*++ -Routine Description: +/** Take the passed in Buffer of size SizeOfCount and grow the buffer by MAX (CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT, MaxGrow) * SizeOfCount bytes. Copy the current data in Buffer to the new version of Buffer and free the old version of buffer. + @param SizeOfCount Size of element in array. + @param Count Current number of elements in array. + @param Buffer Bigger version of passed in Buffer with all the + data. -Arguments: - SizeOfCount - Size of element in array - Count - Current number of elements in array - Buffer - Bigger version of passed in Buffer with all the data - -Returns: - EFI_SUCCESS - Buffer size has grown - EFI_OUT_OF_RESOURCES - Could not grow the buffer size + @retval EFI_SUCCESS Buffer size has grown. + @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. - None - ---*/ +**/ +EFI_STATUS +ConSplitterGrowBuffer ( + IN UINTN SizeOfCount, + IN UINTN *Count, + IN OUT VOID **Buffer + ) { - UINTN NewSize; - UINTN OldSize; VOID *Ptr; // @@ -1723,48 +1823,40 @@ Returns: // copy the old buffer's content to the new-size buffer, // then free the old buffer. // - OldSize = *Count * SizeOfCount; *Count += CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT; - NewSize = *Count * SizeOfCount; - - Ptr = AllocateZeroPool (NewSize); + Ptr = ReallocatePool ( + SizeOfCount * ((*Count) - CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT), + SizeOfCount * (*Count), + *Buffer + ); if (Ptr == NULL) { return EFI_OUT_OF_RESOURCES; } + *Buffer = Ptr; + return EFI_SUCCESS; +} - CopyMem (Ptr, *Buffer, OldSize); - if (*Buffer != NULL) { - FreePool (*Buffer); - } +/** + Add Text Input Device in Consplitter Text Input list. - *Buffer = Ptr; + @param Private Text In Splitter pointer. + @param TextIn Simple Text Input protocol pointer. - return EFI_SUCCESS; -} + @retval EFI_SUCCESS Text Input Device added successfully. + @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. +**/ EFI_STATUS ConSplitterTextInAddDevice ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - EFI_SUCCESS - EFI_OUT_OF_RESOURCES - ---*/ { EFI_STATUS Status; // - // If the Text In List is full, enlarge it by calling growbuffer(). + // If the Text In List is full, enlarge it by calling ConSplitterGrowBuffer(). // if (Private->CurrentNumberOfConsoles >= Private->TextInListCount) { Status = ConSplitterGrowBuffer ( @@ -1783,30 +1875,29 @@ Returns: Private->CurrentNumberOfConsoles++; // - // Extra CheckEvent added to reduce the double CheckEvent() in UI.c + // Extra CheckEvent added to reduce the double CheckEvent(). // gBS->CheckEvent (TextIn->WaitForKey); return EFI_SUCCESS; } + +/** + Remove Text Input Device from Consplitter Text Input list. + + @param Private Text In Splitter pointer. + @param TextIn Simple Text protocol pointer. + + @retval EFI_SUCCESS Simple Text Device removed successfully. + @retval EFI_NOT_FOUND No Simple Text Device found. + +**/ EFI_STATUS ConSplitterTextInDeleteDevice ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - EFI_SUCCESS - EFI_NOT_FOUND - ---*/ { UINTN Index; // @@ -1827,6 +1918,16 @@ Returns: return EFI_NOT_FOUND; } +/** + Add Text Input Ex Device in Consplitter Text Input Ex list. + + @param Private Text In Splitter pointer. + @param TextInEx Simple Text Input Ex Input protocol pointer. + + @retval EFI_SUCCESS Text Input Ex Device added successfully. + @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. + +**/ EFI_STATUS ConSplitterTextInExAddDevice ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, @@ -1836,7 +1937,7 @@ ConSplitterTextInExAddDevice ( EFI_STATUS Status; // - // If the TextInEx List is full, enlarge it by calling growbuffer(). + // If the Text Input Ex List is full, enlarge it by calling ConSplitterGrowBuffer(). // if (Private->CurrentNumberOfExConsoles >= Private->TextInExListCount) { Status = ConSplitterGrowBuffer ( @@ -1849,19 +1950,29 @@ ConSplitterTextInExAddDevice ( } } // - // Add the new text-in device data structure into the Text In List. + // Add the new text-in device data structure into the Text Input Ex List. // Private->TextInExList[Private->CurrentNumberOfExConsoles] = TextInEx; Private->CurrentNumberOfExConsoles++; // - // Extra CheckEvent added to reduce the double CheckEvent() in UI.c + // Extra CheckEvent added to reduce the double CheckEvent(). // gBS->CheckEvent (TextInEx->WaitForKeyEx); return EFI_SUCCESS; } +/** + Remove Text Ex Device from Consplitter Text Input Ex list. + + @param Private Text In Splitter pointer. + @param TextInEx Simple Text Ex protocol pointer. + + @retval EFI_SUCCESS Simple Text Input Ex Device removed successfully. + @retval EFI_NOT_FOUND No Simple Text Input Ex Device found. + +**/ EFI_STATUS ConSplitterTextInExDeleteDevice ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, @@ -1870,7 +1981,7 @@ ConSplitterTextInExDeleteDevice ( { UINTN Index; // - // Remove the specified text-in device data structure from the Text In List, + // Remove the specified text-in device data structure from the Text Input Ex List, // and rearrange the remaining data structures in the Text In List. // for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) { @@ -1887,28 +1998,27 @@ ConSplitterTextInExDeleteDevice ( return EFI_NOT_FOUND; } + +/** + Add Simple Pointer Device in Consplitter Simple Pointer list. + + @param Private Text In Splitter pointer. + @param SimplePointer Simple Pointer protocol pointer. + + @retval EFI_SUCCESS Simple Pointer Device added successfully. + @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. + +**/ EFI_STATUS ConSplitterSimplePointerAddDevice ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - EFI_OUT_OF_RESOURCES - EFI_SUCCESS - ---*/ { EFI_STATUS Status; // - // If the Text In List is full, enlarge it by calling growbuffer(). + // If the Simple Pointer List is full, enlarge it by calling ConSplitterGrowBuffer(). // if (Private->CurrentNumberOfPointers >= Private->PointerListCount) { Status = ConSplitterGrowBuffer ( @@ -1921,33 +2031,34 @@ Returns: } } // - // Add the new text-in device data structure into the Text In List. + // Add the new text-in device data structure into the Simple Pointer List. // Private->PointerList[Private->CurrentNumberOfPointers] = SimplePointer; Private->CurrentNumberOfPointers++; + return EFI_SUCCESS; } + +/** + Remove Simple Pointer Device from Consplitter Simple Pointer list. + + @param Private Text In Splitter pointer. + @param SimplePointer Simple Pointer protocol pointer. + + @retval EFI_SUCCESS Simple Pointer Device removed successfully. + @retval EFI_NOT_FOUND No Simple Pointer Device found. + +**/ EFI_STATUS ConSplitterSimplePointerDeleteDevice ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - None - ---*/ { UINTN Index; // - // Remove the specified text-in device data structure from the Text In List, + // Remove the specified text-in device data structure from the Simple Pointer List, // and rearrange the remaining data structures in the Text In List. // for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) { @@ -1964,28 +2075,27 @@ Returns: return EFI_NOT_FOUND; } + +/** + Add Absolute Pointer Device in Consplitter Absolute Pointer list. + + @param Private Text In Splitter pointer. + @param AbsolutePointer Absolute Pointer protocol pointer. + + @retval EFI_SUCCESS Absolute Pointer Device added successfully. + @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. + +**/ EFI_STATUS ConSplitterAbsolutePointerAddDevice ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - EFI_OUT_OF_RESOURCES - EFI_SUCCESS - ---*/ { EFI_STATUS Status; // - // If the Absolute Pointer List is full, enlarge it by calling growbuffer(). + // If the Absolute Pointer List is full, enlarge it by calling ConSplitterGrowBuffer(). // if (Private->CurrentNumberOfAbsolutePointers >= Private->AbsolutePointerListCount) { Status = ConSplitterGrowBuffer ( @@ -1998,34 +2108,35 @@ Returns: } } // - // Add the new text-in device data structure into the Text In List. + // Add the new text-in device data structure into the Absolute Pointer List. // Private->AbsolutePointerList[Private->CurrentNumberOfAbsolutePointers] = AbsolutePointer; Private->CurrentNumberOfAbsolutePointers++; + return EFI_SUCCESS; } + +/** + Remove Absolute Pointer Device from Consplitter Absolute Pointer list. + + @param Private Text In Splitter pointer. + @param AbsolutePointer Absolute Pointer protocol pointer. + + @retval EFI_SUCCESS Absolute Pointer Device removed successfully. + @retval EFI_NOT_FOUND No Absolute Pointer Device found. + +**/ EFI_STATUS ConSplitterAbsolutePointerDeleteDevice ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - None - ---*/ { UINTN Index; // - // Remove the specified text-in device data structure from the Text In List, - // and rearrange the remaining data structures in the Text In List. + // Remove the specified text-in device data structure from the Absolute Pointer List, + // and rearrange the remaining data structures from the Absolute Pointer List. // for (Index = 0; Index < Private->CurrentNumberOfAbsolutePointers; Index++) { if (Private->AbsolutePointerList[Index] == AbsolutePointer) { @@ -2041,22 +2152,21 @@ Returns: return EFI_NOT_FOUND; } -STATIC -EFI_STATUS -ConSplitterGrowMapTable ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private - ) -/*++ - -Routine Description: +/** + Reallocate Text Out mode map. -Arguments: + Allocate new buffer and copy original buffer into the new buffer. -Returns: + @param Private Consplitter Text Out pointer. - None + @retval EFI_SUCCESS Buffer size has grown + @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. ---*/ +**/ +EFI_STATUS +ConSplitterGrowMapTable ( + IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private + ) { UINTN Size; UINTN NewSize; @@ -2068,9 +2178,12 @@ Returns: NewSize = Private->TextOutListCount * sizeof (INT32); OldTextOutModeMap = Private->TextOutModeMap; - TotalSize = NewSize * Private->TextOutQueryDataCount; + TotalSize = NewSize * (Private->TextOutQueryDataCount); - TextOutModeMap = AllocateZeroPool (TotalSize); + // + // Allocate new buffer for Text Out List. + // + TextOutModeMap = AllocatePool (TotalSize); if (TextOutModeMap == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -2118,23 +2231,22 @@ Returns: return EFI_SUCCESS; } -STATIC + +/** + Add new device's output mode to console splitter's mode list. + + @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. + +**/ EFI_STATUS ConSplitterAddOutputMode ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - None - ---*/ { EFI_STATUS Status; INT32 MaxMode; @@ -2195,37 +2307,35 @@ Returns: } /** - Reconstruct TextOutModeMap to get intersection of modes + Reconstruct TextOutModeMap to get intersection of modes. This routine reconstruct TextOutModeMap to get the intersection of modes for all console out devices. Because EFI/UEFI spec require mode 0 is 80x25, mode 1 is 80x50, this routine will not check the intersection for mode 0 and mode 1. - @parm TextOutModeMap Current text out mode map, begin with the mode 80x25 - @parm NewlyAddedMap New text out mode map, begin with the mode 80x25 - @parm MapStepSize Mode step size for one console device - @parm NewMapStepSize Mode step size for one console device - @parm MaxMode Current max text mode - @parm CurrentMode Current text mode - - @retval None + @param TextOutModeMap Current text out mode map, begin with the mode 80x25 + @param NewlyAddedMap New text out mode map, begin with the mode 80x25 + @param MapStepSize Mode step size for one console device + @param NewMapStepSize New Mode step size for one console device + @param MaxMode IN: Current max text mode, OUT: Updated max text mode. + @param CurrentMode IN: Current text mode, OUT: Updated current text mode. **/ -STATIC VOID ConSplitterGetIntersection ( - IN INT32 *TextOutModeMap, - IN INT32 *NewlyAddedMap, - IN UINTN MapStepSize, - IN UINTN NewMapStepSize, - OUT INT32 *MaxMode, - OUT INT32 *CurrentMode + IN INT32 *TextOutModeMap, + IN INT32 *NewlyAddedMap, + IN UINTN MapStepSize, + IN UINTN NewMapStepSize, + IN OUT INT32 *MaxMode, + IN OUT INT32 *CurrentMode ) { INT32 Index; INT32 *CurrentMapEntry; INT32 *NextMapEntry; + INT32 *NewMapEntry; INT32 CurrentMaxMode; INT32 Mode; @@ -2236,14 +2346,14 @@ ConSplitterGetIntersection ( // Index = 2; CurrentMapEntry = &TextOutModeMap[MapStepSize * 2]; - NextMapEntry = &TextOutModeMap[MapStepSize * 2]; - NewlyAddedMap = &NewlyAddedMap[NewMapStepSize * 2]; + NextMapEntry = CurrentMapEntry; + NewMapEntry = &NewlyAddedMap[NewMapStepSize * 2]; CurrentMaxMode = *MaxMode; Mode = *CurrentMode; while (Index < CurrentMaxMode) { - if (*NewlyAddedMap == -1) { + if (*NewMapEntry == -1) { // // This mode is not supported any more. Remove it. Special care // must be taken as this remove will also affect current mode; @@ -2263,7 +2373,7 @@ ConSplitterGetIntersection ( } CurrentMapEntry += MapStepSize; - NewlyAddedMap += NewMapStepSize; + NewMapEntry += NewMapStepSize; Index++; } @@ -2272,24 +2382,18 @@ ConSplitterGetIntersection ( return ; } -STATIC +/** + 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 ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut ) -/*++ - -Routine Description: - -Arguments: - Private - Private data structure. - TextOut - Text Out Protocol. -Returns: - - None - ---*/ { INT32 CurrentMaxMode; INT32 Mode; @@ -2318,8 +2422,13 @@ Returns: MapTable = TextOutModeMap + Private->CurrentNumberOfConsoles; while (Mode < TextOut->Mode->MaxMode) { Status = TextOut->QueryMode (TextOut, Mode, &Columns, &Rows); + if (EFI_ERROR(Status)) { if (Mode == 1) { + // + // If mode 1 (80x50) is not supported, make sure mode 1 in TextOutQueryData + // is clear to 0x0. + // MapTable[StepSize] = Mode; TextOutQueryData[Mode].Columns = 0; TextOutQueryData[Mode].Rows = 0; @@ -2337,10 +2446,8 @@ Returns: MapTable[Index * StepSize] = Mode; break; } - Index++; } - Mode++; } // @@ -2359,23 +2466,18 @@ Returns: return ; } -STATIC + +/** + Sync output device between ConOut and StdErr output. + + @retval EFI_SUCCESS Sync implemented successfully. + @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. + +**/ EFI_STATUS ConSplitterGetIntersectionBetweenConOutAndStrErr ( VOID ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - EFI_SUCCESS - EFI_OUT_OF_RESOURCES - ---*/ { UINTN ConOutNumOfConsoles; UINTN StdErrNumOfConsoles; @@ -2503,6 +2605,7 @@ Returns: &(mConOut.TextOutMode.MaxMode), &(mConOut.TextOutMode.Mode) ); + if (mConOut.TextOutMode.Mode < 0) { mConOut.TextOut.SetMode (&(mConOut.TextOut), 0); } @@ -2515,6 +2618,7 @@ Returns: &(mStdErr.TextOutMode.MaxMode), &(mStdErr.TextOutMode.Mode) ); + if (mStdErr.TextOutMode.Mode < 0) { mStdErr.TextOut.SetMode (&(mStdErr.TextOut), 0); } @@ -2525,24 +2629,24 @@ Returns: return EFI_SUCCESS; } -STATIC + +/** + Add Grahpics Output modes into Consplitter Text Out list. + + @param Private Text Out Splitter pointer. + @param GraphicsOutput Graphics Output protocol pointer. + @param UgaDraw UGA Draw protocol pointer. + + @retval EFI_SUCCESS Output mode added successfully. + @retval other Failed to add output mode. + +**/ EFI_STATUS ConSplitterAddGraphicsOutputMode ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput, IN EFI_UGA_DRAW_PROTOCOL *UgaDraw ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - None - ---*/ { EFI_STATUS Status; UINTN Index; @@ -2561,9 +2665,7 @@ Returns: UINT32 UgaColorDepth; UINT32 UgaRefreshRate; - if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) { - return EFI_UNSUPPORTED; - } + ASSERT (GraphicsOutput != NULL || UgaDraw != NULL); CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode; @@ -2590,11 +2692,11 @@ Returns: CurrentGraphicsOutputMode->SizeOfInfo = GraphicsOutput->Mode->SizeOfInfo; CurrentGraphicsOutputMode->FrameBufferBase = GraphicsOutput->Mode->FrameBufferBase; CurrentGraphicsOutputMode->FrameBufferSize = GraphicsOutput->Mode->FrameBufferSize; - + // // Allocate resource for the private mode buffer // - ModeBuffer = AllocatePool (GraphicsOutput->Mode->SizeOfInfo * GraphicsOutput->Mode->MaxMode); + ModeBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) * GraphicsOutput->Mode->MaxMode); if (ModeBuffer == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -2606,10 +2708,14 @@ Returns: // Mode = ModeBuffer; for (Index = 0; Index < GraphicsOutput->Mode->MaxMode; Index++) { + // + // The Info buffer would be allocated by callee + // Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) Index, &SizeOfInfo, &Info); if (EFI_ERROR (Status)) { return Status; } + ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION)); CopyMem (Mode, Info, SizeOfInfo); Mode++; FreePool (Info); @@ -2629,12 +2735,19 @@ Returns: Match = FALSE; for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex++) { + // + // The Info buffer would be allocated by callee + // Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info); if (EFI_ERROR (Status)) { return Status; } if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) { + // + // If GOP device supports one mode in current mode buffer, + // it will be added into matched mode buffer + // Match = TRUE; FreePool (Info); break; @@ -2645,6 +2758,9 @@ Returns: if (Match) { AlreadyExist = FALSE; + // + // Check if GOP mode has been in the mode buffer, ModeBuffer = MatchedMode at begin. + // for (Info = ModeBuffer; Info < MatchedMode; Info++) { if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) { @@ -2710,8 +2826,7 @@ Returns: } } } - } - 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 @@ -2727,11 +2842,11 @@ Returns: 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; @@ -2768,11 +2883,10 @@ Done: // Graphics console can ensure all GOP devices have the same mode which can be taken as current mode. // Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex); - - // - // If user defined mode is not valid for UGA, set to the default mode 800x600. - // if (EFI_ERROR(Status)) { + // + // If user defined mode is not valid for display device, set to the default mode 800x600. + // (Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800; (Private->GraphicsOutputModeBuffer[0]).VerticalResolution = 600; Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0); @@ -2781,76 +2895,70 @@ Done: return Status; } -VOID -ConsplitterSetConsoleOutMode ( - IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private - ) -/*++ - -Routine Description: +/** + 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. -Arguments: - - None - -Returns: + @param Private Consplitter Text Out pointer. - None - ---*/ +**/ +VOID +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; + UINTN ModeInfoSize; 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); + ModeInfoSize = sizeof (CONSOLE_OUT_MODE); Status = gRT->GetVariable ( - VarConOutMode, + VARCONOUTMODE, &gEfiGenericPlatformVariableGuid, NULL, &ModeInfoSize, - ModeInfo + &ModeInfo ); - // - // Set to the default mode 80 x 25 required by EFI/UEFI spec; - // user can also define other valid default console mode here. - // 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 - ); + // + // If fail to get variable, set variable to the default mode 80 x 25 + // required by UEFI spec; + // + ModeInfo.Column = 80; + ModeInfo.Row = 25; + + gRT->SetVariable ( + VARCONOUTMODE, + &gEfiGenericPlatformVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, + sizeof (CONSOLE_OUT_MODE), + &ModeInfo + ); } + // + // To find the prefer mode and basic mode from Text Out mode list + // 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) { @@ -2859,34 +2967,48 @@ Returns: } } - Status = TextOut->SetMode (TextOut, PreferMode); - // - // if current mode setting is failed, default 80x25 mode will be set. + // Set perfer mode to Text Out devices. // + Status = TextOut->SetMode (TextOut, PreferMode); if (EFI_ERROR(Status)) { + // + // if current mode setting is failed, default 80x25 mode will be set. + // Status = TextOut->SetMode (TextOut, BaseMode); ASSERT(!EFI_ERROR(Status)); - ModeInfo->Column = 80; - ModeInfo->Row = 25; + ModeInfo.Column = 80; + ModeInfo.Row = 25; // // Update ConOutMode variable // - Status = gRT->SetVariable ( - VarConOutMode, - &gEfiGenericPlatformVariableGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, - sizeof (CONSOLE_OUT_MODE), - ModeInfo - ); + gRT->SetVariable ( + VARCONOUTMODE, + &gEfiGenericPlatformVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, + sizeof (CONSOLE_OUT_MODE), + &ModeInfo + ); } - gBS->FreePool (ModeInfo); + return ; } +/** + Add Text Output Device in Consplitter Text Output list. + + @param Private Text Out Splitter pointer. + @param TextOut Simple Text Output protocol pointer. + @param GraphicsOutput Graphics Output protocol pointer. + @param UgaDraw UGA Draw protocol pointer. + + @retval EFI_SUCCESS Text Output Device added successfully. + @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size. + +**/ EFI_STATUS ConSplitterTextOutAddDevice ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, @@ -2894,33 +3016,24 @@ ConSplitterTextOutAddDevice ( IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput, IN EFI_UGA_DRAW_PROTOCOL *UgaDraw ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - None - ---*/ { - 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 CurrentMode; + 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; // - // If the Text Out List is full, enlarge it by calling growbuffer(). + // If the Text Out List is full, enlarge it by calling ConSplitterGrowBuffer(). // while (CurrentNumOfConsoles >= Private->TextOutListCount) { Status = ConSplitterGrowBuffer ( @@ -2942,9 +3055,9 @@ Returns: TextAndGop = &Private->TextOutList[CurrentNumOfConsoles]; - TextAndGop->TextOut = TextOut; + TextAndGop->TextOut = TextOut; TextAndGop->GraphicsOutput = GraphicsOutput; - TextAndGop->UgaDraw = UgaDraw; + TextAndGop->UgaDraw = UgaDraw; if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) { // @@ -2980,16 +3093,38 @@ Returns: MaxMode = Private->TextOutMode.MaxMode; ASSERT (MaxMode >= 1); - // - // Update DevNull mode according to current video device - // if (FeaturePcdGet (PcdConOutGopSupport)) { - if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) { + // + // 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, @@ -2997,28 +3132,19 @@ Returns: &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 - ); - } } + + // + // Set UGA Draw mode, + // if GetMode is failed, set to 800x600 mode + // + Status = ConSpliterUgaDrawSetMode ( + &Private->UgaDraw, + UgaHorizontalResolution, + UgaVerticalResolution, + UgaColorDepth, + UgaRefreshRate + ); } if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) { @@ -3026,8 +3152,14 @@ Returns: // 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)) { @@ -3051,22 +3183,22 @@ Returns: return Status; } + +/** + Remove Text Out Device in Consplitter Text Out list. + + @param Private Text Out Splitter pointer. + @param TextOut Simple Text Output Pointer protocol pointer. + + @retval EFI_SUCCESS Text Out Device removed successfully. + @retval EFI_NOT_FOUND No Text Out Device found. + +**/ EFI_STATUS ConSplitterTextOutDeleteDevice ( IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private, IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut ) -/*++ - -Routine Description: - -Arguments: - -Returns: - - None - ---*/ { INT32 Index; UINTN CurrentNumOfConsoles; @@ -3151,30 +3283,25 @@ Returns: return Status; } -// -// ConSplitter TextIn member functions -// + + +/** + Reset the input device and optionaly run diagnostics + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could + not be reset. + +**/ EFI_STATUS EFIAPI ConSplitterTextInReset ( IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification ) -/*++ - - Routine Description: - Reset the input device and optionaly run diagnostics - - Arguments: - This - Protocol instance pointer. - ExtendedVerification - Driver may perform diagnostics on reset. - - Returns: - EFI_SUCCESS - The device was reset. - EFI_DEVICE_ERROR - The device is not functioning properly and could - not be reset. - ---*/ { EFI_STATUS Status; EFI_STATUS ReturnStatus; @@ -3201,29 +3328,26 @@ ConSplitterTextInReset ( return ReturnStatus; } + +/** + Reads the next keystroke from the input device. The WaitForKey Event can + be used to test for existance of a keystroke via WaitForEvent () call. + + @param Private Protocol instance pointer. + @param Key Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The keystroke information was returned. + @retval EFI_NOT_READY There was no keystroke data availiable. + @retval EFI_DEVICE_ERROR The keydtroke information was not returned due + to hardware errors. + +**/ EFI_STATUS EFIAPI ConSplitterTextInPrivateReadKeyStroke ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, OUT EFI_INPUT_KEY *Key ) -/*++ - - Routine Description: - Reads the next keystroke from the input device. The WaitForKey Event can - be used to test for existance of a keystroke via WaitForEvent () call. - - Arguments: - This - Protocol instance pointer. - Key - Driver may perform diagnostics on reset. - - Returns: - EFI_SUCCESS - The keystroke information was returned. - EFI_NOT_READY - There was no keystroke data availiable. - EFI_DEVICE_ERROR - The keydtroke information was not returned due to - hardware errors. - ---*/ { EFI_STATUS Status; UINTN Index; @@ -3251,49 +3375,41 @@ ConSplitterTextInPrivateReadKeyStroke ( return EFI_NOT_READY; } -BOOLEAN -ConSpliterConssoleControlStdInLocked ( - VOID - ) -/*++ - -Routine Description: +/** Return TRUE if StdIn is locked. The ConIn device on the virtual handle is the only device locked. -Arguments: - NONE + @retval TRUE StdIn locked + @retval FALSE StdIn working normally -Returns: - TRUE - StdIn locked - 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 ) -/*++ - -Routine Description: - 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. - -Arguments: - (Standard EFI_EVENT_NOTIFY) - -Returns: - None - ---*/ { EFI_STATUS Status; EFI_INPUT_KEY Key; @@ -3304,11 +3420,14 @@ Returns: Status = ConSplitterTextInPrivateReadKeyStroke (&mConIn, &Key); if (!EFI_ERROR (Status)) { // - // if it's an ENTER, match password + // 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)) { + if (StrCmp (mConIn.Password, mConIn.PwdAttempt) != 0) { // // Password not match // @@ -3330,7 +3449,7 @@ Returns: BackSpaceString[0] = CHAR_BACKSPACE; BackSpaceString[1] = 0; - SpaceString[0] = ' '; + SpaceString[0] = L' '; SpaceString[1] = 0; ConSplitterTextOutOutputString (&mConOut.TextOut, BackSpaceString); @@ -3341,7 +3460,8 @@ Returns: } } 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 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) { @@ -3357,27 +3477,25 @@ Returns: } 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 ) -/*++ - -Routine Description: - 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 - -Arguments: - -Returns: - EFI_SUCCESS - Lock the StdIn device - EFI_INVALID_PARAMETER - Password is NULL - EFI_OUT_OF_RESOURCES - Buffer allocation to store the password fails - ---*/ { if (Password == NULL) { return EFI_INVALID_PARAMETER; @@ -3395,35 +3513,35 @@ Returns: StrCpy (mConIn.Password, Password); mConIn.PasswordEnabled = TRUE; mConIn.PwdIndex = 0; - gBS->SetTimer (mConIn.LockEvent, TimerPeriodic, (10000 * 25)); + // + // 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. + + @retval EFI_SUCCESS The keystroke information was returned. + @retval EFI_NOT_READY There was no keystroke data availiable. + @retval EFI_DEVICE_ERROR The keydtroke information was not returned due + to hardware errors. + +**/ EFI_STATUS EFIAPI ConSplitterTextInReadKeyStroke ( IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, OUT EFI_INPUT_KEY *Key ) -/*++ - - Routine Description: - 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 - - Arguments: - This - Protocol instance pointer. - Key - Driver may perform diagnostics on reset. - - Returns: - EFI_SUCCESS - The keystroke information was returned. - EFI_NOT_READY - There was no keystroke data availiable. - EFI_DEVICE_ERROR - The keydtroke information was not returned due to - hardware errors. - ---*/ { TEXT_IN_SPLITTER_PRIVATE_DATA *Private; @@ -3440,35 +3558,32 @@ ConSplitterTextInReadKeyStroke ( return ConSplitterTextInPrivateReadKeyStroke (Private, Key); } -VOID -EFIAPI -ConSplitterTextInWaitForKey ( - IN EFI_EVENT Event, - IN VOID *Context - ) -/*++ -Routine Description: - This event agregates all the events of the ConIn devices in the spliter. +/** + 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 (). -Arguments: - Event - The Event assoicated with callback. - Context - Context registered when Event was created. + @param Event The Event assoicated with callback. + @param Context Context registered when Event was created. -Returns: - None - ---*/ +**/ +VOID +EFIAPI +ConSplitterTextInWaitForKey ( + IN EFI_EVENT Event, + IN VOID *Context + ) { EFI_STATUS Status; TEXT_IN_SPLITTER_PRIVATE_DATA *Private; UINTN Index; Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context; + if (Private->PasswordEnabled) { // // If StdIn Locked return not ready @@ -3476,15 +3591,16 @@ Returns: 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); @@ -3496,28 +3612,26 @@ Returns: } -STATIC + +/** + Test if the key has been registered on input device. + + @param RegsiteredData A pointer to a buffer that is filled in with the + keystroke state data for the key that was + registered. + @param InputData A pointer to a buffer that is filled in with the + keystroke state data for the key that was + pressed. + + @retval TRUE Key be pressed matches a registered key. + @retval FLASE Match failed. + +**/ BOOLEAN IsKeyRegistered ( IN EFI_KEY_DATA *RegsiteredData, IN EFI_KEY_DATA *InputData ) -/*++ - -Routine Description: - -Arguments: - - RegsiteredData - A pointer to a buffer that is filled in with the keystroke - state data for the key that was registered. - InputData - A pointer to a buffer that is filled in with the keystroke - state data for the key that was pressed. - -Returns: - TRUE - Key be pressed matches a registered key. - FLASE - Match failed. - ---*/ { ASSERT (RegsiteredData != NULL && InputData != NULL); @@ -3542,31 +3656,24 @@ Returns: } -// -// Simple Text Input Ex protocol functions -// +/** + Reset the input device and optionaly run diagnostics + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could + not be reset. + +**/ EFI_STATUS EFIAPI ConSplitterTextInResetEx ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification ) -/*++ - - Routine Description: - Reset the input device and optionaly run diagnostics - - Arguments: - This - Protocol instance pointer. - ExtendedVerification - Driver may perform diagnostics on reset. - - Returns: - EFI_SUCCESS - The device was reset. - EFI_DEVICE_ERROR - The device is not functioning properly and could - not be reset. - ---*/ { EFI_STATUS Status; EFI_STATUS ReturnStatus; @@ -3594,31 +3701,29 @@ ConSplitterTextInResetEx ( } + +/** + Reads the next keystroke from the input device. The WaitForKey Event can + be used to test for existance of a keystroke via WaitForEvent () call. + + @param This Protocol instance pointer. + @param KeyData A pointer to a buffer that is filled in with the + keystroke state data for the key that was + pressed. + + @retval EFI_SUCCESS The keystroke information was returned. + @retval EFI_NOT_READY There was no keystroke data availiable. + @retval EFI_DEVICE_ERROR The keystroke information was not returned due + to hardware errors. + @retval EFI_INVALID_PARAMETER KeyData is NULL. + +**/ EFI_STATUS EFIAPI ConSplitterTextInReadKeyStrokeEx ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, OUT EFI_KEY_DATA *KeyData ) -/*++ - - Routine Description: - Reads the next keystroke from the input device. The WaitForKey Event can - be used to test for existance of a keystroke via WaitForEvent () call. - - Arguments: - This - Protocol instance pointer. - KeyData - A pointer to a buffer that is filled in with the keystroke - state data for the key that was pressed. - - Returns: - EFI_SUCCESS - The keystroke information was returned. - EFI_NOT_READY - There was no keystroke data availiable. - EFI_DEVICE_ERROR - The keystroke information was not returned due to - hardware errors. - EFI_INVALID_PARAMETER - KeyData is NULL. - ---*/ { TEXT_IN_SPLITTER_PRIVATE_DATA *Private; EFI_STATUS Status; @@ -3662,30 +3767,28 @@ ConSplitterTextInReadKeyStrokeEx ( return EFI_NOT_READY; } + +/** + Set certain state for the input device. + + @param This Protocol instance pointer. + @param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the + state for the input device. + + @retval EFI_SUCCESS The device state was set successfully. + @retval EFI_DEVICE_ERROR The device is not functioning correctly and + could not have the setting adjusted. + @retval EFI_UNSUPPORTED The device does not have the ability to set its + state. + @retval EFI_INVALID_PARAMETER KeyToggleState is NULL. + +**/ EFI_STATUS EFIAPI ConSplitterTextInSetState ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_TOGGLE_STATE *KeyToggleState ) -/*++ - - Routine Description: - Set certain state for the input device. - - Arguments: - This - Protocol instance pointer. - KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the - state for the input device. - - Returns: - EFI_SUCCESS - The device state was set successfully. - EFI_DEVICE_ERROR - The device is not functioning correctly and could - not have the setting adjusted. - EFI_UNSUPPORTED - The device does not have the ability to set its state. - EFI_INVALID_PARAMETER - KeyToggleState is NULL. - ---*/ { TEXT_IN_SPLITTER_PRIVATE_DATA *Private; EFI_STATUS Status; @@ -3715,6 +3818,26 @@ ConSplitterTextInSetState ( } + +/** + Register a notification function for a particular keystroke for the input device. + + @param This Protocol instance pointer. + @param KeyData A pointer to a buffer that is filled in with the + keystroke information data for the key that was + pressed. + @param KeyNotificationFunction Points to the function to be called when the key + sequence is typed specified by KeyData. + @param NotifyHandle Points to the unique handle assigned to the + registered notification. + + @retval EFI_SUCCESS The notification function was registered + successfully. + @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data + structures. + @retval EFI_INVALID_PARAMETER KeyData or KeyNotificationFunction or NotifyHandle is NULL. + +**/ EFI_STATUS EFIAPI ConSplitterTextInRegisterKeyNotify ( @@ -3723,25 +3846,6 @@ ConSplitterTextInRegisterKeyNotify ( IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, OUT EFI_HANDLE *NotifyHandle ) -/*++ - - Routine Description: - Register a notification function for a particular keystroke for the input device. - - Arguments: - This - Protocol instance pointer. - KeyData - A pointer to a buffer that is filled in with the keystroke - information data for the key that was pressed. - KeyNotificationFunction - Points to the function to be called when the key - sequence is typed specified by KeyData. - NotifyHandle - Points to the unique handle assigned to the registered notification. - - Returns: - EFI_SUCCESS - The notification function was registered successfully. - EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures. - EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL. - ---*/ { TEXT_IN_SPLITTER_PRIVATE_DATA *Private; EFI_STATUS Status; @@ -3758,7 +3862,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) { @@ -3769,12 +3873,7 @@ ConSplitterTextInRegisterKeyNotify ( // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered. // for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) { - CurrentNotify = CR ( - Link, - TEXT_IN_EX_SPLITTER_NOTIFY, - NotifyEntry, - TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE - ); + CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link); if (IsKeyRegistered (&CurrentNotify->KeyData, KeyData)) { if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) { *NotifyHandle = CurrentNotify->NotifyHandle; @@ -3836,27 +3935,26 @@ ConSplitterTextInRegisterKeyNotify ( } + +/** + Remove a registered notification function from a particular keystroke. + + @param This Protocol instance pointer. + @param NotificationHandle The handle of the notification function being + unregistered. + + @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 EFIAPI ConSplitterTextInUnregisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_HANDLE NotificationHandle ) -/*++ - - Routine Description: - Remove a registered notification function from a particular keystroke. - - Arguments: - This - Protocol instance pointer. - NotificationHandle - The handle of the notification function being unregistered. - - Returns: - EFI_SUCCESS - The notification function was unregistered successfully. - EFI_INVALID_PARAMETER - The NotificationHandle is invalid. - EFI_NOT_FOUND - Can not find the matching entry in database. - ---*/ { TEXT_IN_SPLITTER_PRIVATE_DATA *Private; EFI_STATUS Status; @@ -3891,7 +3989,7 @@ ConSplitterTextInUnregisterKeyNotify ( } for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) { - CurrentNotify = CR (Link, TEXT_IN_EX_SPLITTER_NOTIFY, NotifyEntry, TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE); + CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link); if (CurrentNotify->NotifyHandle == NotificationHandle) { for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) { Status = Private->TextInExList[Index]->UnregisterKeyNotify ( @@ -3920,27 +4018,24 @@ ConSplitterTextInUnregisterKeyNotify ( } + +/** + Reset the input device and optionaly run diagnostics + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could + not be reset. + +**/ EFI_STATUS EFIAPI ConSplitterSimplePointerReset ( IN EFI_SIMPLE_POINTER_PROTOCOL *This, IN BOOLEAN ExtendedVerification ) -/*++ - - Routine Description: - Reset the input device and optionaly run diagnostics - - Arguments: - This - Protocol instance pointer. - ExtendedVerification - Driver may perform diagnostics on reset. - - Returns: - EFI_SUCCESS - The device was reset. - EFI_DEVICE_ERROR - The device is not functioning properly and could - not be reset. - ---*/ { EFI_STATUS Status; EFI_STATUS ReturnStatus; @@ -3970,30 +4065,26 @@ ConSplitterSimplePointerReset ( return ReturnStatus; } -STATIC + +/** + Reads the next keystroke from the input device. The WaitForKey Event can + be used to test for existance of a keystroke via WaitForEvent () call. + + @param Private Protocol instance pointer. + @param State The state information of simple pointer device. + + @retval EFI_SUCCESS The keystroke information was returned. + @retval EFI_NOT_READY There was no keystroke data availiable. + @retval EFI_DEVICE_ERROR The keydtroke information was not returned due + to hardware errors. + +**/ EFI_STATUS EFIAPI ConSplitterSimplePointerPrivateGetState ( IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private, IN OUT EFI_SIMPLE_POINTER_STATE *State ) -/*++ - - Routine Description: - Reads the next keystroke from the input device. The WaitForKey Event can - be used to test for existance of a keystroke via WaitForEvent () call. - - Arguments: - This - Protocol instance pointer. - State - - - Returns: - EFI_SUCCESS - The keystroke information was returned. - EFI_NOT_READY - There was no keystroke data availiable. - EFI_DEVICE_ERROR - The keydtroke information was not returned due to - hardware errors. - ---*/ { EFI_STATUS Status; EFI_STATUS ReturnStatus; @@ -4050,30 +4141,27 @@ ConSplitterSimplePointerPrivateGetState ( return ReturnStatus; } + +/** + 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 + + @retval EFI_SUCCESS The keystroke information was returned in State. + @retval EFI_NOT_READY There was no keystroke data availiable. + @retval EFI_DEVICE_ERROR The keydtroke information was not returned due + to hardware errors. + +**/ EFI_STATUS EFIAPI ConSplitterSimplePointerGetState ( IN EFI_SIMPLE_POINTER_PROTOCOL *This, IN OUT EFI_SIMPLE_POINTER_STATE *State ) -/*++ - - Routine Description: - 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 - - Arguments: - This - Protocol instance pointer. - State - - - Returns: - EFI_SUCCESS - The keystroke information was returned. - EFI_NOT_READY - There was no keystroke data availiable. - EFI_DEVICE_ERROR - The keydtroke information was not returned due to - hardware errors. - ---*/ { TEXT_IN_SPLITTER_PRIVATE_DATA *Private; @@ -4090,29 +4178,24 @@ ConSplitterSimplePointerGetState ( return ConSplitterSimplePointerPrivateGetState (Private, State); } -VOID -EFIAPI -ConSplitterSimplePointerWaitForInput ( - IN EFI_EVENT Event, - IN VOID *Context - ) -/*++ -Routine Description: +/** 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 (). -Arguments: - Event - The Event assoicated with callback. - Context - Context registered when Event was created. + @param Event The Event assoicated with callback. + @param Context Context registered when Event was created. -Returns: - None - ---*/ +**/ +VOID +EFIAPI +ConSplitterSimplePointerWaitForInput ( + IN EFI_EVENT Event, + IN VOID *Context + ) { EFI_STATUS Status; TEXT_IN_SPLITTER_PRIVATE_DATA *Private; @@ -4145,31 +4228,23 @@ Returns: } } -// -// Absolute Pointer Protocol functions -// +/** + Resets the pointer device hardware. + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform diagnostics on reset. + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning correctly and + could not be reset. + +**/ EFI_STATUS EFIAPI ConSplitterAbsolutePointerReset ( IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, IN BOOLEAN ExtendedVerification ) -/*++ - - Routine Description: - Resets the pointer device hardware. - - Arguments: - This - Protocol instance pointer. - ExtendedVerification - Driver may perform diagnostics on reset. - - Returns: - EFI_SUCCESS - The device was reset. - EFI_DEVICE_ERROR - The device is not functioning correctly and could - not be reset. - ---*/ { EFI_STATUS Status; EFI_STATUS ReturnStatus; @@ -4199,28 +4274,28 @@ ConSplitterAbsolutePointerReset ( return ReturnStatus; } + +/** + Retrieves the current state of a pointer device. + + @param This Protocol instance pointer. + @param State A pointer to the state information on the + pointer device. + + @retval EFI_SUCCESS The state of the pointer device was returned in + State.. + @retval EFI_NOT_READY The state of the pointer device has not changed + since the last call to GetState(). + @retval EFI_DEVICE_ERROR A device error occurred while attempting to + retrieve the pointer device's current state. + +**/ EFI_STATUS EFIAPI ConSplitterAbsolutePointerGetState ( IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, IN OUT EFI_ABSOLUTE_POINTER_STATE *State ) -/*++ - - Routine Description: - Retrieves the current state of a pointer device. - - Arguments: - This - Protocol instance pointer. - State - A pointer to the state information on the pointer device. - - Returns: - EFI_SUCCESS - The state of the pointer device was returned in State.. - EFI_NOT_READY - The state of the pointer device has not changed since the last call to - GetState(). - EFI_DEVICE_ERROR - A device error occurred while attempting to retrieve the pointer - device's current state. ---*/ { TEXT_IN_SPLITTER_PRIVATE_DATA *Private; EFI_STATUS Status; @@ -4281,29 +4356,24 @@ ConSplitterAbsolutePointerGetState ( return ReturnStatus; } -VOID -EFIAPI -ConSplitterAbsolutePointerWaitForInput ( - IN EFI_EVENT Event, - IN VOID *Context - ) -/*++ -Routine Description: +/** 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 (). -Arguments: - Event - The Event assoicated with callback. - Context - Context registered when Event was created. - -Returns: - None + @param Event The Event assoicated with callback. + @param Context Context registered when Event was created. ---*/ +**/ +VOID +EFIAPI +ConSplitterAbsolutePointerWaitForInput ( + IN EFI_EVENT Event, + IN VOID *Context + ) { EFI_STATUS Status; TEXT_IN_SPLITTER_PRIVATE_DATA *Private; @@ -4337,28 +4407,25 @@ Returns: } } + +/** + Reset the text output device hardware and optionaly run diagnostics + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform more exhaustive verfication + operation of the device during reset. + + @retval EFI_SUCCESS The text output device was reset. + @retval EFI_DEVICE_ERROR The text output device is not functioning + correctly and could not be reset. + +**/ EFI_STATUS EFIAPI ConSplitterTextOutReset ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification ) -/*++ - - Routine Description: - Reset the text output device hardware and optionaly run diagnostics - - Arguments: - This - Protocol instance pointer. - ExtendedVerification - Driver may perform more exhaustive verfication - operation of the device during reset. - - Returns: - EFI_SUCCESS - The text output device was reset. - EFI_DEVICE_ERROR - The text output device is not functioning correctly and - could not be reset. - ---*/ { EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; @@ -4394,34 +4461,32 @@ ConSplitterTextOutReset ( return ReturnStatus; } + +/** + Write a Unicode string to the output device. + + @param This Protocol instance pointer. + @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 EFIAPI ConSplitterTextOutOutputString ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN CHAR16 *WString ) -/*++ - - Routine Description: - Write a Unicode string to the output device. - - Arguments: - This - Protocol instance pointer. - String - 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. - - Returns: - EFI_SUCCESS - The string was output to the device. - EFI_DEVICE_ERROR - The device reported an error while attempting to output - the text. - EFI_UNSUPPORTED - The output device's mode is not currently in a - defined text mode. - 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 Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; @@ -4435,7 +4500,7 @@ ConSplitterTextOutOutputString ( Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This); BackSpaceCount = 0; - for (TargetString = WString; *TargetString; TargetString++) { + for (TargetString = WString; *TargetString != L'\0'; TargetString++) { if (*TargetString == CHAR_BACKSPACE) { BackSpaceCount++; } @@ -4446,6 +4511,8 @@ ConSplitterTextOutOutputString ( TargetString = WString; } else { TargetString = AllocatePool (sizeof (CHAR16) * (StrLen (WString) + BackSpaceCount + 1)); + ASSERT (TargetString != NULL); + StrCpy (TargetString, WString); } // @@ -4469,37 +4536,35 @@ ConSplitterTextOutOutputString ( } } - if (BackSpaceCount) { + if (BackSpaceCount > 0) { FreePool (TargetString); } return ReturnStatus; } + +/** + Verifies that all characters in a Unicode string can be output to the + target device. + + @param This Protocol instance pointer. + @param WString The NULL-terminated Unicode string to be + examined for the output device(s). + + @retval EFI_SUCCESS The device(s) are capable of rendering the + output string. + @retval EFI_UNSUPPORTED Some of the characters in the Unicode string + cannot be rendered by one or more of the output + devices mapped by the EFI handle. + +**/ EFI_STATUS EFIAPI ConSplitterTextOutTestString ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN CHAR16 *WString ) -/*++ - - Routine Description: - Verifies that all characters in a Unicode string can be output to the - target device. - - Arguments: - This - Protocol instance pointer. - String - The NULL-terminated Unicode string to be examined for the output - device(s). - - Returns: - EFI_SUCCESS - The device(s) are capable of rendering the output string. - EFI_UNSUPPORTED - Some of the characters in the Unicode string cannot be - rendered by one or more of the output devices mapped - by the EFI handle. - ---*/ { EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; @@ -4530,6 +4595,24 @@ ConSplitterTextOutTestString ( return ReturnStatus; } + +/** + Returns information for an available text mode that the output device(s) + supports. + + @param This Protocol instance pointer. + @param ModeNumber The mode number to return information on. + @param Columns Returns the columns of the text output device + for the requested ModeNumber. + @param Rows Returns the rows of the text output device + for the requested ModeNumber. + + @retval EFI_SUCCESS The requested mode information was returned. + @retval EFI_DEVICE_ERROR The device had an error and could not complete + the request. + @retval EFI_UNSUPPORTED The mode number was not valid. + +**/ EFI_STATUS EFIAPI ConSplitterTextOutQueryMode ( @@ -4538,25 +4621,6 @@ ConSplitterTextOutQueryMode ( OUT UINTN *Columns, OUT UINTN *Rows ) -/*++ - - Routine Description: - Returns information for an available text mode that the output device(s) - supports. - - Arguments: - This - Protocol instance pointer. - ModeNumber - The mode number to return information on. - Columns, Rows - Returns the geometry of the text output device for the - requested ModeNumber. - - Returns: - EFI_SUCCESS - The requested mode information was returned. - EFI_DEVICE_ERROR - The device had an error and could not - complete the request. - EFI_UNSUPPORTED - The mode number was not valid. - ---*/ { TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; UINTN CurrentMode; @@ -4597,28 +4661,25 @@ ConSplitterTextOutQueryMode ( return EFI_SUCCESS; } + +/** + Sets the output device(s) to a specified mode. + + @param This Protocol instance 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. + +**/ EFI_STATUS EFIAPI ConSplitterTextOutSetMode ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber ) -/*++ - - Routine Description: - Sets the output device(s) to a specified mode. - - Arguments: - This - Protocol instance pointer. - ModeNumber - The mode number to set. - - Returns: - EFI_SUCCESS - The requested text mode was set. - EFI_DEVICE_ERROR - The device had an error and - could not complete the request. - EFI_UNSUPPORTED - The mode number was not valid. - ---*/ { EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; @@ -4680,31 +4741,30 @@ ConSplitterTextOutSetMode ( return ReturnStatus; } + +/** + Sets the background and foreground colors for the OutputString () and + ClearScreen () functions. + + @param This Protocol instance pointer. + @param Attribute The attribute to set. Bits 0..3 are the + foreground color, and bits 4..6 are the + background color. All other bits are undefined + and must be zero. The valid Attributes are + defined in this file. + + @retval EFI_SUCCESS The attribute was set. + @retval EFI_DEVICE_ERROR The device had an error and could not complete + the request. + @retval EFI_UNSUPPORTED The attribute requested is not defined. + +**/ EFI_STATUS EFIAPI ConSplitterTextOutSetAttribute ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN Attribute ) -/*++ - - Routine Description: - Sets the background and foreground colors for the OutputString () and - ClearScreen () functions. - - Arguments: - This - Protocol instance pointer. - Attribute - The attribute to set. Bits 0..3 are the foreground color, and - bits 4..6 are the background color. All other bits are undefined - and must be zero. The valid Attributes are defined in this file. - - Returns: - EFI_SUCCESS - The attribute was set. - EFI_DEVICE_ERROR - The device had an error and - could not complete the request. - EFI_UNSUPPORTED - The attribute requested is not defined. - ---*/ { EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; @@ -4741,27 +4801,24 @@ ConSplitterTextOutSetAttribute ( return ReturnStatus; } + +/** + Clears the output device(s) display to the currently selected background + color. + + @param This Protocol instance 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 EFIAPI ConSplitterTextOutClearScreen ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This ) -/*++ - - Routine Description: - Clears the output device(s) display to the currently selected background - color. - - Arguments: - This - Protocol instance pointer. - - Returns: - EFI_SUCCESS - The operation completed successfully. - EFI_DEVICE_ERROR - The device had an error and - could not complete the request. - EFI_UNSUPPORTED - The output device is not in a valid text mode. - ---*/ { EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; @@ -4791,6 +4848,26 @@ ConSplitterTextOutClearScreen ( return ReturnStatus; } + +/** + Sets the current coordinates of the cursor position + + @param This Protocol instance 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 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, + or the cursor position is invalid for the + current mode. + +**/ EFI_STATUS EFIAPI ConSplitterTextOutSetCursorPosition ( @@ -4798,25 +4875,6 @@ ConSplitterTextOutSetCursorPosition ( IN UINTN Column, IN UINTN Row ) -/*++ - - Routine Description: - Sets the current coordinates of the cursor position - - Arguments: - This - Protocol instance pointer. - Column, Row - the position to set the cursor to. Must be greater than or - equal to zero and less than the number of columns and rows - by QueryMode (). - - Returns: - EFI_SUCCESS - The operation completed successfully. - EFI_DEVICE_ERROR - The device had an error and - could not complete the request. - EFI_UNSUPPORTED - The output device is not in a valid text mode, or the - cursor position is invalid for the current mode. - ---*/ { EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; @@ -4870,30 +4928,27 @@ ConSplitterTextOutSetCursorPosition ( return ReturnStatus; } + +/** + Makes the cursor visible or invisible + + @param This Protocol instance pointer. + @param Visible If TRUE, the cursor is set to be visible. If + FALSE, the cursor is set to be invisible. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_DEVICE_ERROR The device had an error and could not complete + the request, or the device does not support + changing the cursor mode. + @retval EFI_UNSUPPORTED The output device is not in a valid text mode. + +**/ EFI_STATUS EFIAPI ConSplitterTextOutEnableCursor ( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN Visible ) -/*++ - - Routine Description: - Makes the cursor visible or invisible - - Arguments: - This - Protocol instance pointer. - Visible - If TRUE, the cursor is set to be visible. If FALSE, the cursor is - set to be invisible. - - Returns: - EFI_SUCCESS - The operation completed successfully. - EFI_DEVICE_ERROR - The device had an error and could not complete the - request, or the device does not support changing - the cursor mode. - EFI_UNSUPPORTED - The output device is not in a valid text mode. - ---*/ { EFI_STATUS Status; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;