+++ /dev/null
-/** @file\r
- Console Splitter Driver. Any Handle that attatched console I/O protocols\r
- (Console In device, Console Out device, Console Error device, Simple Pointer\r
- protocol, Absolute Pointer protocol) can be bound by this driver.\r
-\r
- So far it works like any other driver by opening a SimpleTextIn and/or\r
- SimpleTextOut protocol with EFI_OPEN_PROTOCOL_BY_DRIVER attributes. The big\r
- difference is this driver does not layer a protocol on the passed in\r
- handle, or construct a child handle like a standard device or bus driver.\r
- This driver produces three virtual handles as children, one for console input\r
- splitter, one for console output splitter and one for error output splitter.\r
- These 3 virtual handles would be installed on gST.\r
-\r
- Each virtual handle, that supports the Console I/O protocol, will be produced\r
- in the driver entry point. The virtual handle are added on driver entry and\r
- never removed. Such design ensures sytem function well during none console\r
- device situation.\r
-\r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "ConSplitter.h"\r
-\r
-//\r
-// Identify if ConIn is connected in PcdConInConnectOnDemand enabled mode. \r
-// default not connect\r
-//\r
-BOOLEAN mConInIsConnect = FALSE;\r
-\r
-//\r
-// Text In Splitter Private Data template\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = {\r
- TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE,\r
- (EFI_HANDLE) NULL,\r
-\r
- {\r
- ConSplitterTextInReset,\r
- ConSplitterTextInReadKeyStroke,\r
- (EFI_EVENT) NULL\r
- },\r
- 0,\r
- (EFI_SIMPLE_TEXT_INPUT_PROTOCOL **) NULL,\r
- 0,\r
-\r
- {\r
- ConSplitterTextInResetEx,\r
- ConSplitterTextInReadKeyStrokeEx,\r
- (EFI_EVENT) NULL,\r
- ConSplitterTextInSetState,\r
- ConSplitterTextInRegisterKeyNotify,\r
- ConSplitterTextInUnregisterKeyNotify\r
- },\r
- 0,\r
- (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL **) NULL,\r
- 0,\r
- {\r
- (LIST_ENTRY *) NULL,\r
- (LIST_ENTRY *) NULL\r
- },\r
-\r
- {\r
- ConSplitterSimplePointerReset,\r
- ConSplitterSimplePointerGetState,\r
- (EFI_EVENT) NULL,\r
- (EFI_SIMPLE_POINTER_MODE *) NULL\r
- },\r
- {\r
- 0x10000,\r
- 0x10000,\r
- 0x10000,\r
- TRUE,\r
- TRUE\r
- },\r
- 0,\r
- (EFI_SIMPLE_POINTER_PROTOCOL **) NULL,\r
- 0,\r
-\r
- {\r
- ConSplitterAbsolutePointerReset,\r
- ConSplitterAbsolutePointerGetState,\r
- (EFI_EVENT) NULL,\r
- (EFI_ABSOLUTE_POINTER_MODE *) NULL\r
- },\r
- {\r
- 0, // AbsoluteMinX\r
- 0, // AbsoluteMinY\r
- 0, // AbsoluteMinZ\r
- 0x10000, // AbsoluteMaxX\r
- 0x10000, // AbsoluteMaxY\r
- 0x10000, // AbsoluteMaxZ\r
- 0 // Attributes\r
- },\r
- 0,\r
- (EFI_ABSOLUTE_POINTER_PROTOCOL **) NULL,\r
- 0,\r
- FALSE,\r
-\r
- FALSE,\r
- FALSE\r
-};\r
-\r
-\r
-//\r
-// Uga Draw Protocol Private Data template\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UGA_DRAW_PROTOCOL mUgaDrawProtocolTemplate = {\r
- ConSplitterUgaDrawGetMode,\r
- ConSplitterUgaDrawSetMode,\r
- ConSplitterUgaDrawBlt\r
-};\r
-\r
-//\r
-// Graphics Output Protocol Private Data template\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_PROTOCOL mGraphicsOutputProtocolTemplate = {\r
- ConSplitterGraphicsOutputQueryMode,\r
- ConSplitterGraphicsOutputSetMode,\r
- ConSplitterGraphicsOutputBlt,\r
- NULL\r
-};\r
-\r
-\r
-//\r
-// Text Out Splitter Private Data template\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE,\r
- (EFI_HANDLE) NULL,\r
- {\r
- ConSplitterTextOutReset,\r
- ConSplitterTextOutOutputString,\r
- ConSplitterTextOutTestString,\r
- ConSplitterTextOutQueryMode,\r
- ConSplitterTextOutSetMode,\r
- ConSplitterTextOutSetAttribute,\r
- ConSplitterTextOutClearScreen,\r
- ConSplitterTextOutSetCursorPosition,\r
- ConSplitterTextOutEnableCursor,\r
- (EFI_SIMPLE_TEXT_OUTPUT_MODE *) NULL\r
- },\r
- {\r
- 1,\r
- 0,\r
- 0,\r
- 0,\r
- 0,\r
- FALSE,\r
- },\r
-\r
- {\r
- NULL,\r
- NULL,\r
- NULL\r
- },\r
- 0,\r
- 0,\r
- 0,\r
- 0,\r
-\r
- {\r
- NULL,\r
- NULL,\r
- NULL,\r
- NULL\r
- },\r
- (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *) NULL,\r
- 0,\r
- 0,\r
-\r
- 0,\r
- (TEXT_OUT_AND_GOP_DATA *) NULL,\r
- 0,\r
- (TEXT_OUT_SPLITTER_QUERY_DATA *) NULL,\r
- 0,\r
- (INT32 *) NULL\r
-};\r
-\r
-//\r
-// Standard Error Text Out Splitter Data Template\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE,\r
- (EFI_HANDLE) NULL,\r
- {\r
- ConSplitterTextOutReset,\r
- ConSplitterTextOutOutputString,\r
- ConSplitterTextOutTestString,\r
- ConSplitterTextOutQueryMode,\r
- ConSplitterTextOutSetMode,\r
- ConSplitterTextOutSetAttribute,\r
- ConSplitterTextOutClearScreen,\r
- ConSplitterTextOutSetCursorPosition,\r
- ConSplitterTextOutEnableCursor,\r
- (EFI_SIMPLE_TEXT_OUTPUT_MODE *) NULL\r
- },\r
- {\r
- 1,\r
- 0,\r
- 0,\r
- 0,\r
- 0,\r
- FALSE,\r
- },\r
-\r
- {\r
- NULL,\r
- NULL,\r
- NULL\r
- },\r
- 0,\r
- 0,\r
- 0,\r
- 0,\r
-\r
- {\r
- NULL,\r
- NULL,\r
- NULL,\r
- NULL\r
- },\r
- (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *) NULL,\r
- 0,\r
- 0,\r
-\r
- 0,\r
- (TEXT_OUT_AND_GOP_DATA *) NULL,\r
- 0,\r
- (TEXT_OUT_SPLITTER_QUERY_DATA *) NULL,\r
- 0,\r
- (INT32 *) NULL\r
-};\r
-\r
-//\r
-// Driver binding instance for Console Input Device\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterConInDriverBinding = {\r
- ConSplitterConInDriverBindingSupported,\r
- ConSplitterConInDriverBindingStart,\r
- ConSplitterConInDriverBindingStop,\r
- 0xa,\r
- NULL,\r
- NULL\r
-};\r
-\r
-//\r
-// Driver binding instance for Console Out device\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding = {\r
- ConSplitterConOutDriverBindingSupported,\r
- ConSplitterConOutDriverBindingStart,\r
- ConSplitterConOutDriverBindingStop,\r
- 0xa,\r
- NULL,\r
- NULL\r
-};\r
-\r
-//\r
-// Driver binding instance for Standard Error device\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterStdErrDriverBinding = {\r
- ConSplitterStdErrDriverBindingSupported,\r
- ConSplitterStdErrDriverBindingStart,\r
- ConSplitterStdErrDriverBindingStop,\r
- 0xa,\r
- NULL,\r
- NULL\r
-};\r
-\r
-//\r
-// Driver binding instance for Simple Pointer protocol\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding = {\r
- ConSplitterSimplePointerDriverBindingSupported,\r
- ConSplitterSimplePointerDriverBindingStart,\r
- ConSplitterSimplePointerDriverBindingStop,\r
- 0xa,\r
- NULL,\r
- NULL\r
-};\r
-\r
-//\r
-// Driver binding instance for Absolute Pointer protocol\r
-//\r
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterAbsolutePointerDriverBinding = {\r
- ConSplitterAbsolutePointerDriverBindingSupported,\r
- ConSplitterAbsolutePointerDriverBindingStart,\r
- ConSplitterAbsolutePointerDriverBindingStop,\r
- 0xa,\r
- NULL,\r
- NULL\r
-};\r
-\r
-/**\r
- The Entry Point for module ConSplitter. The user code starts with this function.\r
-\r
- Installs driver module protocols and. Creates virtual device handles for ConIn,\r
- ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol,\r
- Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers.\r
- Installs Graphics Output protocol and/or UGA Draw protocol if needed.\r
-\r
- @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
- @param[in] SystemTable A pointer to the EFI System Table.\r
-\r
- @retval EFI_SUCCESS The entry point is executed successfully.\r
- @retval other Some error occurs when executing this entry point.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterDriverEntry(\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Install driver model protocol(s).\r
- //\r
- Status = EfiLibInstallDriverBindingComponentName2 (\r
- ImageHandle,\r
- SystemTable,\r
- &gConSplitterConInDriverBinding,\r
- ImageHandle,\r
- &gConSplitterConInComponentName,\r
- &gConSplitterConInComponentName2\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Status = EfiLibInstallDriverBindingComponentName2 (\r
- ImageHandle,\r
- SystemTable,\r
- &gConSplitterSimplePointerDriverBinding,\r
- NULL,\r
- &gConSplitterSimplePointerComponentName,\r
- &gConSplitterSimplePointerComponentName2\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Status = EfiLibInstallDriverBindingComponentName2 (\r
- ImageHandle,\r
- SystemTable,\r
- &gConSplitterAbsolutePointerDriverBinding,\r
- NULL,\r
- &gConSplitterAbsolutePointerComponentName,\r
- &gConSplitterAbsolutePointerComponentName2\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Status = EfiLibInstallDriverBindingComponentName2 (\r
- ImageHandle,\r
- SystemTable,\r
- &gConSplitterConOutDriverBinding,\r
- NULL,\r
- &gConSplitterConOutComponentName,\r
- &gConSplitterConOutComponentName2\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Status = EfiLibInstallDriverBindingComponentName2 (\r
- ImageHandle,\r
- SystemTable,\r
- &gConSplitterStdErrDriverBinding,\r
- NULL,\r
- &gConSplitterStdErrComponentName,\r
- &gConSplitterStdErrComponentName2\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Either Graphics Output protocol or UGA Draw protocol must be supported.\r
- //\r
- ASSERT (FeaturePcdGet (PcdConOutGopSupport) ||\r
- FeaturePcdGet (PcdConOutUgaSupport));\r
-\r
- //\r
- // The driver creates virtual handles for ConIn, ConOut, StdErr.\r
- // The virtual handles will always exist even if no console exist in the\r
- // system. This is need to support hotplug devices like USB.\r
- //\r
- //\r
- // Create virtual device handle for ConIn Splitter\r
- //\r
- Status = ConSplitterTextInConstructor (&mConIn);\r
- if (!EFI_ERROR (Status)) {\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &mConIn.VirtualHandle,\r
- &gEfiSimpleTextInProtocolGuid,\r
- &mConIn.TextIn,\r
- &gEfiSimpleTextInputExProtocolGuid,\r
- &mConIn.TextInEx,\r
- &gEfiSimplePointerProtocolGuid,\r
- &mConIn.SimplePointer,\r
- &gEfiAbsolutePointerProtocolGuid,\r
- &mConIn.AbsolutePointer,\r
- NULL\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Update the EFI System Table with new virtual console\r
- // and update the pointer to Simple Text Input protocol.\r
- //\r
- gST->ConsoleInHandle = mConIn.VirtualHandle;\r
- gST->ConIn = &mConIn.TextIn;\r
- }\r
- }\r
- //\r
- // Create virtual device handle for ConOut Splitter\r
- //\r
- Status = ConSplitterTextOutConstructor (&mConOut);\r
- if (!EFI_ERROR (Status)) {\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &mConOut.VirtualHandle,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- &mConOut.TextOut,\r
- NULL\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Update the EFI System Table with new virtual console\r
- // and Update the pointer to Text Output protocol.\r
- //\r
- gST->ConsoleOutHandle = mConOut.VirtualHandle;\r
- gST->ConOut = &mConOut.TextOut;\r
- }\r
-\r
- }\r
-\r
- //\r
- // Create virtual device handle for StdErr Splitter\r
- //\r
- Status = ConSplitterTextOutConstructor (&mStdErr);\r
- if (!EFI_ERROR (Status)) {\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &mStdErr.VirtualHandle,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- &mStdErr.TextOut,\r
- NULL\r
- );\r
- if (!EFI_ERROR (Status)) { \r
- //\r
- // Update the EFI System Table with new virtual console\r
- // and update the pointer to Text Output protocol.\r
- //\r
- gST->StandardErrorHandle = mStdErr.VirtualHandle;\r
- gST->StdErr = &mStdErr.TextOut;\r
- }\r
- }\r
- \r
- //\r
- // Update the CRC32 in the EFI System Table header\r
- //\r
- gST->Hdr.CRC32 = 0;\r
- gBS->CalculateCrc32 (\r
- (UINT8 *) &gST->Hdr,\r
- gST->Hdr.HeaderSize,\r
- &gST->Hdr.CRC32\r
- );\r
-\r
- return EFI_SUCCESS;\r
-\r
-}\r
-\r
-/**\r
- Construct console input devices' private data.\r
-\r
- @param ConInPrivate A pointer to the TEXT_IN_SPLITTER_PRIVATE_DATA\r
- structure.\r
-\r
- @retval EFI_OUT_OF_RESOURCES Out of resources.\r
- @retval EFI_SUCCESS Text Input Devcie's private data has been constructed.\r
- @retval other Failed to construct private data.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInConstructor (\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *ConInPrivate\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Allocate buffer for Simple Text Input device\r
- //\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_SIMPLE_TEXT_INPUT_PROTOCOL *),\r
- &ConInPrivate->TextInListCount,\r
- (VOID **) &ConInPrivate->TextInList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- //\r
- // Create Event to wait for a key\r
- //\r
- Status = gBS->CreateEvent (\r
- EVT_NOTIFY_WAIT,\r
- TPL_NOTIFY,\r
- ConSplitterTextInWaitForKey,\r
- ConInPrivate,\r
- &ConInPrivate->TextIn.WaitForKey\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Allocate buffer for Simple Text Input Ex device\r
- //\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *),\r
- &ConInPrivate->TextInExListCount,\r
- (VOID **) &ConInPrivate->TextInExList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- //\r
- // Create Event to wait for a key Ex\r
- //\r
- Status = gBS->CreateEvent (\r
- EVT_NOTIFY_WAIT,\r
- TPL_NOTIFY,\r
- ConSplitterTextInWaitForKey,\r
- ConInPrivate,\r
- &ConInPrivate->TextInEx.WaitForKeyEx\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- InitializeListHead (&ConInPrivate->NotifyList);\r
-\r
- ConInPrivate->AbsolutePointer.Mode = &ConInPrivate->AbsolutePointerMode;\r
- //\r
- // Allocate buffer for Absolute Pointer device\r
- //\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *),\r
- &ConInPrivate->AbsolutePointerListCount,\r
- (VOID **) &ConInPrivate->AbsolutePointerList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- //\r
- // Create Event to wait for device input for Absolute pointer device\r
- //\r
- Status = gBS->CreateEvent (\r
- EVT_NOTIFY_WAIT,\r
- TPL_NOTIFY,\r
- ConSplitterAbsolutePointerWaitForInput,\r
- ConInPrivate,\r
- &ConInPrivate->AbsolutePointer.WaitForInput\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- ConInPrivate->SimplePointer.Mode = &ConInPrivate->SimplePointerMode;\r
- //\r
- // Allocate buffer for Simple Pointer device\r
- //\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_SIMPLE_POINTER_PROTOCOL *),\r
- &ConInPrivate->PointerListCount,\r
- (VOID **) &ConInPrivate->PointerList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- //\r
- // Create Event to wait for device input for Simple pointer device\r
- //\r
- Status = gBS->CreateEvent (\r
- EVT_NOTIFY_WAIT,\r
- TPL_NOTIFY,\r
- ConSplitterSimplePointerWaitForInput,\r
- ConInPrivate,\r
- &ConInPrivate->SimplePointer.WaitForInput\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- //\r
- // Create Event to signal ConIn connection request\r
- //\r
- Status = gBS->CreateEventEx (\r
- EVT_NOTIFY_SIGNAL,\r
- TPL_CALLBACK,\r
- ConSplitterEmptyCallbackFunction,\r
- NULL,\r
- &gConnectConInEventGuid,\r
- &ConInPrivate->ConnectConInEvent\r
- );\r
-\r
- return Status;\r
-}\r
-\r
-/**\r
- Construct console output devices' private data.\r
-\r
- @param ConOutPrivate A pointer to the TEXT_OUT_SPLITTER_PRIVATE_DATA\r
- structure.\r
-\r
- @retval EFI_OUT_OF_RESOURCES Out of resources.\r
- @retval EFI_SUCCESS Text Input Devcie's private data has been constructed.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextOutConstructor (\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *ConOutPrivate\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
-\r
- //\r
- // Copy protocols template\r
- //\r
- if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
- CopyMem (&ConOutPrivate->UgaDraw, &mUgaDrawProtocolTemplate, sizeof (EFI_UGA_DRAW_PROTOCOL));\r
- }\r
- if (FeaturePcdGet (PcdConOutGopSupport)) {\r
- CopyMem (&ConOutPrivate->GraphicsOutput, &mGraphicsOutputProtocolTemplate, sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL));\r
- }\r
-\r
- //\r
- // Initilize console output splitter's private data.\r
- //\r
- ConOutPrivate->TextOut.Mode = &ConOutPrivate->TextOutMode;\r
-\r
- //\r
- // When new console device is added, the new mode will be set later,\r
- // so put current mode back to init state.\r
- //\r
- ConOutPrivate->TextOutMode.Mode = 0xFF;\r
- //\r
- // Allocate buffer for Console Out device\r
- //\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (TEXT_OUT_AND_GOP_DATA),\r
- &ConOutPrivate->TextOutListCount,\r
- (VOID **) &ConOutPrivate->TextOutList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- //\r
- // Allocate buffer for Text Out query data\r
- //\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (TEXT_OUT_SPLITTER_QUERY_DATA),\r
- &ConOutPrivate->TextOutQueryDataCount,\r
- (VOID **) &ConOutPrivate->TextOutQueryData\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- //\r
- // Setup the default console to 80 x 25 and mode to 0\r
- //\r
- ConOutPrivate->TextOutQueryData[0].Columns = 80;\r
- ConOutPrivate->TextOutQueryData[0].Rows = 25;\r
- TextOutSetMode (ConOutPrivate, 0);\r
-\r
-\r
- if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
- //\r
- // Setup the UgaDraw to 800 x 600 x 32 bits per pixel, 60Hz.\r
- //\r
- ConSplitterUgaDrawSetMode (&ConOutPrivate->UgaDraw, 800, 600, 32, 60);\r
- }\r
- if (FeaturePcdGet (PcdConOutGopSupport)) {\r
- //\r
- // Setup resource for mode information in Graphics Output Protocol interface\r
- //\r
- if ((ConOutPrivate->GraphicsOutput.Mode = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE))) == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- if ((ConOutPrivate->GraphicsOutput.Mode->Info = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- //\r
- // Setup the DevNullGraphicsOutput to 800 x 600 x 32 bits per pixel\r
- // DevNull will be updated to user-defined mode after driver has started.\r
- //\r
- if ((ConOutPrivate->GraphicsOutputModeBuffer = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- Info = &ConOutPrivate->GraphicsOutputModeBuffer[0];\r
- Info->Version = 0;\r
- Info->HorizontalResolution = 800;\r
- Info->VerticalResolution = 600;\r
- Info->PixelFormat = PixelBltOnly;\r
- Info->PixelsPerScanLine = 800;\r
- CopyMem (ConOutPrivate->GraphicsOutput.Mode->Info, Info, sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
- ConOutPrivate->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
-\r
- //\r
- // Initialize the following items, theset items remain unchanged in GraphicsOutput->SetMode()\r
- // GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize\r
- //\r
- ConOutPrivate->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;\r
- ConOutPrivate->GraphicsOutput.Mode->FrameBufferSize = 0;\r
-\r
- ConOutPrivate->GraphicsOutput.Mode->MaxMode = 1;\r
- //\r
- // Initial current mode to unknown state, and then set to mode 0\r
- //\r
- ConOutPrivate->GraphicsOutput.Mode->Mode = 0xffff;\r
- ConOutPrivate->GraphicsOutput.SetMode (&ConOutPrivate->GraphicsOutput, 0);\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Test to see if the specified protocol could be supported on the specified device.\r
-\r
- @param This Driver Binding protocol pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param Guid The specified protocol.\r
-\r
- @retval EFI_SUCCESS The specified protocol is supported on this device.\r
- @retval EFI_UNSUPPORTED The specified protocol attempts to be installed on virtul handle.\r
- @retval other Failed to open specified protocol on this device.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_GUID *Guid\r
- )\r
-{\r
- EFI_STATUS Status;\r
- VOID *Instance;\r
-\r
- //\r
- // Make sure the Console Splitter does not attempt to attach to itself\r
- //\r
- if (ControllerHandle == mConIn.VirtualHandle ||\r
- ControllerHandle == mConOut.VirtualHandle ||\r
- ControllerHandle == mStdErr.VirtualHandle\r
- ) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // Check to see whether the specific protocol could be opened BY_DRIVER\r
- //\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- Guid,\r
- &Instance,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_BY_DRIVER\r
- );\r
-\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- gBS->CloseProtocol (\r
- ControllerHandle,\r
- Guid,\r
- This->DriverBindingHandle,\r
- ControllerHandle\r
- );\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Test to see if Console In Device could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConInDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- return ConSplitterSupported (\r
- This,\r
- ControllerHandle,\r
- &gEfiConsoleInDeviceGuid\r
- );\r
-}\r
-\r
-/**\r
- Test to see if Simple Pointer protocol could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- return ConSplitterSupported (\r
- This,\r
- ControllerHandle,\r
- &gEfiSimplePointerProtocolGuid\r
- );\r
-}\r
-\r
-/**\r
- Test to see if Absolute Pointer protocol could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- return ConSplitterSupported (\r
- This,\r
- ControllerHandle,\r
- &gEfiAbsolutePointerProtocolGuid\r
- );\r
-}\r
-\r
-\r
-/**\r
- Test to see if Console Out Device could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConOutDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- return ConSplitterSupported (\r
- This,\r
- ControllerHandle,\r
- &gEfiConsoleOutDeviceGuid\r
- );\r
-}\r
-\r
-/**\r
- Test to see if Standard Error Device could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterStdErrDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- return ConSplitterSupported (\r
- This,\r
- ControllerHandle,\r
- &gEfiStandardErrorDeviceGuid\r
- );\r
-}\r
-\r
-\r
-/**\r
- Start ConSplitter on devcie handle by opening Console Device Guid on device handle\r
- and the console virtual handle. And Get the console interface on controller handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device.\r
- @param ConSplitterVirtualHandle Console virtual Handle.\r
- @param DeviceGuid The specified Console Device, such as ConInDev,\r
- ConOutDev.\r
- @param InterfaceGuid The specified protocol to be opened.\r
- @param Interface Protocol interface returned.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other Failed to open the specified Console Device Guid\r
- or specified protocol.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ConSplitterVirtualHandle,\r
- IN EFI_GUID *DeviceGuid,\r
- IN EFI_GUID *InterfaceGuid,\r
- OUT VOID **Interface\r
- )\r
-{\r
- EFI_STATUS Status;\r
- VOID *Instance;\r
-\r
- //\r
- // Check to see whether the ControllerHandle has the DeviceGuid on it.\r
- //\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- DeviceGuid,\r
- &Instance,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_BY_DRIVER\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Open the Parent Handle for the child.\r
- //\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- DeviceGuid,\r
- &Instance,\r
- This->DriverBindingHandle,\r
- ConSplitterVirtualHandle,\r
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto Err;\r
- }\r
-\r
- //\r
- // Open InterfaceGuid on the virtul handle.\r
- //\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- InterfaceGuid,\r
- Interface,\r
- This->DriverBindingHandle,\r
- ConSplitterVirtualHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
-\r
- if (!EFI_ERROR (Status)) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- //\r
- // close the DeviceGuid on ConSplitter VirtualHandle.\r
- //\r
- gBS->CloseProtocol (\r
- ControllerHandle,\r
- DeviceGuid,\r
- This->DriverBindingHandle,\r
- ConSplitterVirtualHandle\r
- );\r
-\r
-Err:\r
- //\r
- // close the DeviceGuid on ControllerHandle.\r
- //\r
- gBS->CloseProtocol (\r
- ControllerHandle,\r
- DeviceGuid,\r
- This->DriverBindingHandle,\r
- ControllerHandle\r
- );\r
-\r
- return Status;\r
-}\r
-\r
-\r
-/**\r
- Start Console In Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Console In Consplitter is added to ControllerHandle.\r
- @retval other Console In Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConInDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn;\r
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx;\r
-\r
- //\r
- // Start ConSplitter on ControllerHandle, and create the virtual\r
- // agrogated console device on first call Start for a SimpleTextIn handle.\r
- //\r
- Status = ConSplitterStart (\r
- This,\r
- ControllerHandle,\r
- mConIn.VirtualHandle,\r
- &gEfiConsoleInDeviceGuid,\r
- &gEfiSimpleTextInProtocolGuid,\r
- (VOID **) &TextIn\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Add this device into Text In devices list.\r
- //\r
- Status = ConSplitterTextInAddDevice (&mConIn, TextIn);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gEfiSimpleTextInputExProtocolGuid,\r
- (VOID **) &TextInEx,\r
- This->DriverBindingHandle,\r
- mConIn.VirtualHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // If Simple Text Input Ex protocol exists,\r
- // add this device into Text In Ex devices list.\r
- //\r
- Status = ConSplitterTextInExAddDevice (&mConIn, TextInEx);\r
- }\r
-\r
- return Status;\r
-}\r
-\r
-\r
-/**\r
- Start Simple Pointer Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Simple Pointer Consplitter is added to ControllerHandle.\r
- @retval other Simple Pointer Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer;\r
-\r
- //\r
- // Start ConSplitter on ControllerHandle, and create the virtual\r
- // agrogated console device on first call Start for a SimplePointer handle.\r
- //\r
- Status = ConSplitterStart (\r
- This,\r
- ControllerHandle,\r
- mConIn.VirtualHandle,\r
- &gEfiSimplePointerProtocolGuid,\r
- &gEfiSimplePointerProtocolGuid,\r
- (VOID **) &SimplePointer\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Add this devcie into Simple Pointer devices list.\r
- //\r
- return ConSplitterSimplePointerAddDevice (&mConIn, SimplePointer);\r
-}\r
-\r
-\r
-/**\r
- Start Absolute Pointer Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Absolute Pointer Consplitter is added to ControllerHandle.\r
- @retval other Absolute Pointer Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer;\r
-\r
- //\r
- // Start ConSplitter on ControllerHandle, and create the virtual\r
- // agrogated console device on first call Start for a AbsolutePointer handle.\r
- //\r
- Status = ConSplitterStart (\r
- This,\r
- ControllerHandle,\r
- mConIn.VirtualHandle,\r
- &gEfiAbsolutePointerProtocolGuid,\r
- &gEfiAbsolutePointerProtocolGuid,\r
- (VOID **) &AbsolutePointer\r
- );\r
-\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Add this devcie into Absolute Pointer devices list.\r
- //\r
- return ConSplitterAbsolutePointerAddDevice (&mConIn, AbsolutePointer);\r
-}\r
-\r
-\r
-/**\r
- Start Console Out Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Console Out Consplitter is added to ControllerHandle.\r
- @retval other Console Out Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConOutDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;\r
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
- UINTN SizeOfInfo;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
-\r
- //\r
- // Start ConSplitter on ControllerHandle, and create the virtual\r
- // agrogated console device on first call Start for a ConsoleOut handle.\r
- //\r
- Status = ConSplitterStart (\r
- This,\r
- ControllerHandle,\r
- mConOut.VirtualHandle,\r
- &gEfiConsoleOutDeviceGuid,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- (VOID **) &TextOut\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- GraphicsOutput = NULL;\r
- UgaDraw = NULL;\r
- //\r
- // Try to Open Graphics Output protocol\r
- //\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gEfiGraphicsOutputProtocolGuid,\r
- (VOID **) &GraphicsOutput,\r
- This->DriverBindingHandle,\r
- mConOut.VirtualHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
-\r
- if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
- //\r
- // Open UGA DRAW protocol\r
- //\r
- gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gEfiUgaDrawProtocolGuid,\r
- (VOID **) &UgaDraw,\r
- This->DriverBindingHandle,\r
- mConOut.VirtualHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- }\r
-\r
- //\r
- // When new console device is added, the new mode will be set later,\r
- // so put current mode back to init state.\r
- //\r
- mConOut.TextOutMode.Mode = 0xFF;\r
-\r
- //\r
- // If both ConOut and StdErr incorporate the same Text Out device,\r
- // their MaxMode and QueryData should be the intersection of both.\r
- //\r
- Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw);\r
- ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
-\r
- if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
- //\r
- // Get the UGA mode data of ConOut from the current mode\r
- //\r
- if (GraphicsOutput != NULL) {\r
- Status = GraphicsOutput->QueryMode (GraphicsOutput, GraphicsOutput->Mode->Mode, &SizeOfInfo, &Info);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
-\r
- mConOut.UgaHorizontalResolution = Info->HorizontalResolution;\r
- mConOut.UgaVerticalResolution = Info->VerticalResolution;\r
- mConOut.UgaColorDepth = 32;\r
- mConOut.UgaRefreshRate = 60;\r
-\r
- FreePool (Info);\r
-\r
- } else if (UgaDraw != NULL) {\r
- Status = UgaDraw->GetMode (\r
- UgaDraw,\r
- &mConOut.UgaHorizontalResolution,\r
- &mConOut.UgaVerticalResolution,\r
- &mConOut.UgaColorDepth,\r
- &mConOut.UgaRefreshRate\r
- );\r
- }\r
- }\r
-\r
- return Status;\r
-}\r
-\r
-\r
-/**\r
- Start Standard Error Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Standard Error Consplitter is added to ControllerHandle.\r
- @retval other Standard Error Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterStdErrDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;\r
-\r
- //\r
- // Start ConSplitter on ControllerHandle, and create the virtual\r
- // agrogated console device on first call Start for a StandardError handle.\r
- //\r
- Status = ConSplitterStart (\r
- This,\r
- ControllerHandle,\r
- mStdErr.VirtualHandle,\r
- &gEfiStandardErrorDeviceGuid,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- (VOID **) &TextOut\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // When new console device is added, the new mode will be set later,\r
- // so put current mode back to init state.\r
- //\r
- mStdErr.TextOutMode.Mode = 0xFF;\r
-\r
- //\r
- // If both ConOut and StdErr incorporate the same Text Out device,\r
- // their MaxMode and QueryData should be the intersection of both.\r
- //\r
- Status = ConSplitterTextOutAddDevice (&mStdErr, TextOut, NULL, NULL);\r
- ConSplitterTextOutSetAttribute (&mStdErr.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- return Status;\r
-}\r
-\r
-\r
-/**\r
- Stop ConSplitter on device handle by closing Console Device Guid on device handle\r
- and the console virtual handle.\r
-\r
- @param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device.\r
- @param ConSplitterVirtualHandle Console virtual Handle.\r
- @param DeviceGuid The specified Console Device, such as ConInDev,\r
- ConOutDev.\r
- @param InterfaceGuid The specified protocol to be opened.\r
- @param Interface Protocol interface returned.\r
-\r
- @retval EFI_SUCCESS Stop ConSplitter on ControllerHandle successfully.\r
- @retval other Failed to Stop ConSplitter on ControllerHandle.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ConSplitterVirtualHandle,\r
- IN EFI_GUID *DeviceGuid,\r
- IN EFI_GUID *InterfaceGuid,\r
- IN VOID **Interface\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- InterfaceGuid,\r
- Interface,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- //\r
- // close the protocol refered.\r
- //\r
- gBS->CloseProtocol (\r
- ControllerHandle,\r
- DeviceGuid,\r
- This->DriverBindingHandle,\r
- ConSplitterVirtualHandle\r
- );\r
-\r
- gBS->CloseProtocol (\r
- ControllerHandle,\r
- DeviceGuid,\r
- This->DriverBindingHandle,\r
- ControllerHandle\r
- );\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Stop Console In ConSplitter on ControllerHandle by closing Console In Devcice GUID.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConInDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn;\r
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx;\r
-\r
- if (NumberOfChildren == 0) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gEfiSimpleTextInputExProtocolGuid,\r
- (VOID **) &TextInEx,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // If Simple Text Input Ex protocol exists,\r
- // remove device from Text Input Ex devices list.\r
- //\r
- Status = ConSplitterTextInExDeleteDevice (&mConIn, TextInEx);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- }\r
-\r
- //\r
- // Close Simple Text In protocol on controller handle and virtual handle.\r
- //\r
- Status = ConSplitterStop (\r
- This,\r
- ControllerHandle,\r
- mConIn.VirtualHandle,\r
- &gEfiConsoleInDeviceGuid,\r
- &gEfiSimpleTextInProtocolGuid,\r
- (VOID **) &TextIn\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Remove device from Text Input devices list.\r
- //\r
- return ConSplitterTextInDeleteDevice (&mConIn, TextIn);\r
-}\r
-\r
-\r
-/**\r
- Stop Simple Pointer protocol ConSplitter on ControllerHandle by closing\r
- Simple Pointer protocol.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer;\r
-\r
- if (NumberOfChildren == 0) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- //\r
- // Close Simple Pointer protocol on controller handle and virtual handle.\r
- //\r
- Status = ConSplitterStop (\r
- This,\r
- ControllerHandle,\r
- mConIn.VirtualHandle,\r
- &gEfiSimplePointerProtocolGuid,\r
- &gEfiSimplePointerProtocolGuid,\r
- (VOID **) &SimplePointer\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Remove this device from Simple Pointer device list.\r
- //\r
- return ConSplitterSimplePointerDeleteDevice (&mConIn, SimplePointer);\r
-}\r
-\r
-\r
-/**\r
- Stop Absolute Pointer protocol ConSplitter on ControllerHandle by closing\r
- Absolute Pointer protocol.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer;\r
-\r
- if (NumberOfChildren == 0) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- //\r
- // Close Absolute Pointer protocol on controller handle and virtual handle.\r
- //\r
- Status = ConSplitterStop (\r
- This,\r
- ControllerHandle,\r
- mConIn.VirtualHandle,\r
- &gEfiAbsolutePointerProtocolGuid,\r
- &gEfiAbsolutePointerProtocolGuid,\r
- (VOID **) &AbsolutePointer\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Remove this device from Absolute Pointer device list.\r
- //\r
- return ConSplitterAbsolutePointerDeleteDevice (&mConIn, AbsolutePointer);\r
-}\r
-\r
-\r
-/**\r
- Stop Console Out ConSplitter on device handle by closing Console Out Devcice GUID.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConOutDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;\r
-\r
- if (NumberOfChildren == 0) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- //\r
- // Close Absolute Pointer protocol on controller handle and virtual handle.\r
- //\r
- Status = ConSplitterStop (\r
- This,\r
- ControllerHandle,\r
- mConOut.VirtualHandle,\r
- &gEfiConsoleOutDeviceGuid,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- (VOID **) &TextOut\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Remove this device from Text Out device list.\r
- //\r
- return ConSplitterTextOutDeleteDevice (&mConOut, TextOut);\r
-}\r
-\r
-\r
-/**\r
- Stop Standard Error ConSplitter on ControllerHandle by closing Standard Error GUID.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterStdErrDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;\r
-\r
- if (NumberOfChildren == 0) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- //\r
- // Close Standard Error Device on controller handle and virtual handle.\r
- //\r
- Status = ConSplitterStop (\r
- This,\r
- ControllerHandle,\r
- mStdErr.VirtualHandle,\r
- &gEfiStandardErrorDeviceGuid,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- (VOID **) &TextOut\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- //\r
- // Delete this console error out device's data structures.\r
- //\r
- return ConSplitterTextOutDeleteDevice (&mStdErr, TextOut);\r
-}\r
-\r
-\r
-/**\r
- Take the passed in Buffer of size ElementSize and grow the buffer\r
- by CONSOLE_SPLITTER_ALLOC_UNIT * ElementSize bytes.\r
- Copy the current data in Buffer to the new version of Buffer and\r
- free the old version of buffer.\r
-\r
- @param ElementSize Size of element in array.\r
- @param Count Current number of elements in array.\r
- @param Buffer Bigger version of passed in Buffer with all the\r
- data.\r
-\r
- @retval EFI_SUCCESS Buffer size has grown.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterGrowBuffer (\r
- IN UINTN ElementSize,\r
- IN OUT UINTN *Count,\r
- IN OUT VOID **Buffer\r
- )\r
-{\r
- VOID *Ptr;\r
-\r
- //\r
- // grow the buffer to new buffer size,\r
- // copy the old buffer's content to the new-size buffer,\r
- // then free the old buffer.\r
- //\r
- Ptr = ReallocatePool (\r
- ElementSize * (*Count),\r
- ElementSize * ((*Count) + CONSOLE_SPLITTER_ALLOC_UNIT),\r
- *Buffer\r
- );\r
- if (Ptr == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- *Count += CONSOLE_SPLITTER_ALLOC_UNIT;\r
- *Buffer = Ptr;\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Add Text Input Device in Consplitter Text Input list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param TextIn Simple Text Input protocol pointer.\r
-\r
- @retval EFI_SUCCESS Text Input Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInAddDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // If the Text In List is full, enlarge it by calling ConSplitterGrowBuffer().\r
- //\r
- if (Private->CurrentNumberOfConsoles >= Private->TextInListCount) {\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_SIMPLE_TEXT_INPUT_PROTOCOL *),\r
- &Private->TextInListCount,\r
- (VOID **) &Private->TextInList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- }\r
- //\r
- // Add the new text-in device data structure into the Text In List.\r
- //\r
- Private->TextInList[Private->CurrentNumberOfConsoles] = TextIn;\r
- Private->CurrentNumberOfConsoles++;\r
-\r
- //\r
- // Extra CheckEvent added to reduce the double CheckEvent().\r
- //\r
- gBS->CheckEvent (TextIn->WaitForKey);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Remove Text Input Device from Consplitter Text Input list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param TextIn Simple Text protocol pointer.\r
-\r
- @retval EFI_SUCCESS Simple Text Device removed successfully.\r
- @retval EFI_NOT_FOUND No Simple Text Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInDeleteDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn\r
- )\r
-{\r
- UINTN Index;\r
- //\r
- // Remove the specified text-in device data structure from the Text In List,\r
- // and rearrange the remaining data structures in the Text In List.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- if (Private->TextInList[Index] == TextIn) {\r
- for (; Index < Private->CurrentNumberOfConsoles - 1; Index++) {\r
- Private->TextInList[Index] = Private->TextInList[Index + 1];\r
- }\r
-\r
- Private->CurrentNumberOfConsoles--;\r
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- Add Text Input Ex Device in Consplitter Text Input Ex list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param TextInEx Simple Text Input Ex Input protocol pointer.\r
-\r
- @retval EFI_SUCCESS Text Input Ex Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInExAddDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx\r
- )\r
-{\r
- EFI_STATUS Status;\r
- LIST_ENTRY *Link;\r
- TEXT_IN_EX_SPLITTER_NOTIFY *CurrentNotify;\r
- UINTN TextInExListCount;\r
-\r
- //\r
- // Enlarge the NotifyHandleList and the TextInExList\r
- //\r
- if (Private->CurrentNumberOfExConsoles >= Private->TextInExListCount) {\r
- for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
- CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link);\r
- TextInExListCount = Private->TextInExListCount;\r
-\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_HANDLE),\r
- &TextInExListCount,\r
- (VOID **) &CurrentNotify->NotifyHandleList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- }\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *),\r
- &Private->TextInExListCount,\r
- (VOID **) &Private->TextInExList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- }\r
-\r
- //\r
- // Register the key notify in the new text-in device\r
- //\r
- for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
- CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link);\r
- Status = TextInEx->RegisterKeyNotify (\r
- TextInEx,\r
- &CurrentNotify->KeyData,\r
- CurrentNotify->KeyNotificationFn,\r
- &CurrentNotify->NotifyHandleList[Private->CurrentNumberOfExConsoles]\r
- );\r
- if (EFI_ERROR (Status)) {\r
- for (Link = Link->BackLink; Link != &Private->NotifyList; Link = Link->BackLink) {\r
- CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link);\r
- TextInEx->UnregisterKeyNotify (\r
- TextInEx,\r
- CurrentNotify->NotifyHandleList[Private->CurrentNumberOfExConsoles]\r
- );\r
- }\r
- return Status;\r
- }\r
- }\r
-\r
- //\r
- // Add the new text-in device data structure into the Text Input Ex List.\r
- //\r
- Private->TextInExList[Private->CurrentNumberOfExConsoles] = TextInEx;\r
- Private->CurrentNumberOfExConsoles++;\r
-\r
- //\r
- // Extra CheckEvent added to reduce the double CheckEvent().\r
- //\r
- gBS->CheckEvent (TextInEx->WaitForKeyEx);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Remove Text Ex Device from Consplitter Text Input Ex list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param TextInEx Simple Text Ex protocol pointer.\r
-\r
- @retval EFI_SUCCESS Simple Text Input Ex Device removed successfully.\r
- @retval EFI_NOT_FOUND No Simple Text Input Ex Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInExDeleteDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx\r
- )\r
-{\r
- UINTN Index;\r
- //\r
- // Remove the specified text-in device data structure from the Text Input Ex List,\r
- // and rearrange the remaining data structures in the Text In List.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) {\r
- if (Private->TextInExList[Index] == TextInEx) {\r
- for (; Index < Private->CurrentNumberOfExConsoles - 1; Index++) {\r
- Private->TextInExList[Index] = Private->TextInExList[Index + 1];\r
- }\r
-\r
- Private->CurrentNumberOfExConsoles--;\r
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-\r
-/**\r
- Add Simple Pointer Device in Consplitter Simple Pointer list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param SimplePointer Simple Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Simple Pointer Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterSimplePointerAddDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // If the Simple Pointer List is full, enlarge it by calling ConSplitterGrowBuffer().\r
- //\r
- if (Private->CurrentNumberOfPointers >= Private->PointerListCount) {\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_SIMPLE_POINTER_PROTOCOL *),\r
- &Private->PointerListCount,\r
- (VOID **) &Private->PointerList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- }\r
- //\r
- // Add the new text-in device data structure into the Simple Pointer List.\r
- //\r
- Private->PointerList[Private->CurrentNumberOfPointers] = SimplePointer;\r
- Private->CurrentNumberOfPointers++;\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Remove Simple Pointer Device from Consplitter Simple Pointer list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param SimplePointer Simple Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Simple Pointer Device removed successfully.\r
- @retval EFI_NOT_FOUND No Simple Pointer Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterSimplePointerDeleteDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer\r
- )\r
-{\r
- UINTN Index;\r
- //\r
- // Remove the specified text-in device data structure from the Simple Pointer List,\r
- // and rearrange the remaining data structures in the Text In List.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) {\r
- if (Private->PointerList[Index] == SimplePointer) {\r
- for (; Index < Private->CurrentNumberOfPointers - 1; Index++) {\r
- Private->PointerList[Index] = Private->PointerList[Index + 1];\r
- }\r
-\r
- Private->CurrentNumberOfPointers--;\r
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-\r
-/**\r
- Add Absolute Pointer Device in Consplitter Absolute Pointer list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param AbsolutePointer Absolute Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Absolute Pointer Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterAbsolutePointerAddDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // If the Absolute Pointer List is full, enlarge it by calling ConSplitterGrowBuffer().\r
- //\r
- if (Private->CurrentNumberOfAbsolutePointers >= Private->AbsolutePointerListCount) {\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *),\r
- &Private->AbsolutePointerListCount,\r
- (VOID **) &Private->AbsolutePointerList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- }\r
- //\r
- // Add the new text-in device data structure into the Absolute Pointer List.\r
- //\r
- Private->AbsolutePointerList[Private->CurrentNumberOfAbsolutePointers] = AbsolutePointer;\r
- Private->CurrentNumberOfAbsolutePointers++;\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Remove Absolute Pointer Device from Consplitter Absolute Pointer list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param AbsolutePointer Absolute Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Absolute Pointer Device removed successfully.\r
- @retval EFI_NOT_FOUND No Absolute Pointer Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterAbsolutePointerDeleteDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer\r
- )\r
-{\r
- UINTN Index;\r
- //\r
- // Remove the specified text-in device data structure from the Absolute Pointer List,\r
- // and rearrange the remaining data structures from the Absolute Pointer List.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {\r
- if (Private->AbsolutePointerList[Index] == AbsolutePointer) {\r
- for (; Index < Private->CurrentNumberOfAbsolutePointers - 1; Index++) {\r
- Private->AbsolutePointerList[Index] = Private->AbsolutePointerList[Index + 1];\r
- }\r
-\r
- Private->CurrentNumberOfAbsolutePointers--;\r
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- Reallocate Text Out mode map.\r
-\r
- Allocate new buffer and copy original buffer into the new buffer.\r
-\r
- @param Private Consplitter Text Out pointer.\r
-\r
- @retval EFI_SUCCESS Buffer size has grown\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterGrowMapTable (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private\r
- )\r
-{\r
- UINTN Size;\r
- UINTN NewSize;\r
- UINTN TotalSize;\r
- INT32 *TextOutModeMap;\r
- INT32 *OldTextOutModeMap;\r
- INT32 *SrcAddress;\r
- INT32 Index;\r
- UINTN OldStepSize;\r
- UINTN NewStepSize;\r
-\r
- NewSize = Private->TextOutListCount * sizeof (INT32);\r
- OldTextOutModeMap = Private->TextOutModeMap;\r
- TotalSize = NewSize * (Private->TextOutQueryDataCount);\r
-\r
- //\r
- // Allocate new buffer for Text Out List.\r
- //\r
- TextOutModeMap = AllocatePool (TotalSize);\r
- if (TextOutModeMap == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- SetMem (TextOutModeMap, TotalSize, 0xFF);\r
- Private->TextOutModeMap = TextOutModeMap;\r
-\r
- //\r
- // If TextOutList has been enlarged, need to realloc the mode map table\r
- // The mode map table is regarded as a two dimension array.\r
- //\r
- // Old New\r
- // 0 ---------> TextOutListCount ----> TextOutListCount\r
- // | -------------------------------------------\r
- // | | | |\r
- // | | | |\r
- // | | | |\r
- // | | | |\r
- // | | | |\r
- // \/ | | |\r
- // -------------------------------------------\r
- // QueryDataCount\r
- //\r
- if (OldTextOutModeMap != NULL) {\r
-\r
- Size = Private->CurrentNumberOfConsoles * sizeof (INT32);\r
- Index = 0;\r
- SrcAddress = OldTextOutModeMap;\r
- NewStepSize = NewSize / sizeof(INT32); \r
- // If Private->CurrentNumberOfConsoles is not zero and OldTextOutModeMap\r
- // is not NULL, it indicates that the original TextOutModeMap is not enough\r
- // for the new console devices and has been enlarged by CONSOLE_SPLITTER_ALLOC_UNIT columns.\r
- //\r
- OldStepSize = NewStepSize - CONSOLE_SPLITTER_ALLOC_UNIT;\r
-\r
- //\r
- // Copy the old data to the new one\r
- //\r
- while (Index < Private->TextOutMode.MaxMode) {\r
- CopyMem (TextOutModeMap, SrcAddress, Size);\r
- //\r
- // Go to next row of new TextOutModeMap.\r
- //\r
- TextOutModeMap += NewStepSize;\r
- //\r
- // Go to next row of old TextOutModeMap.\r
- //\r
- SrcAddress += OldStepSize;\r
- Index++;\r
- }\r
- //\r
- // Free the old buffer\r
- //\r
- FreePool (OldTextOutModeMap);\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Add new device's output mode to console splitter's mode list.\r
-\r
- @param Private Text Out Splitter pointer\r
- @param TextOut Simple Text Output protocol pointer.\r
-\r
- @retval EFI_SUCCESS Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterAddOutputMode (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut\r
- )\r
-{\r
- EFI_STATUS Status;\r
- INT32 MaxMode;\r
- INT32 Mode;\r
- UINTN Index;\r
-\r
- MaxMode = TextOut->Mode->MaxMode;\r
- Private->TextOutMode.MaxMode = MaxMode;\r
-\r
- //\r
- // Grow the buffer if query data buffer is not large enough to\r
- // hold all the mode supported by the first console.\r
- //\r
- while (MaxMode > (INT32) Private->TextOutQueryDataCount) {\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (TEXT_OUT_SPLITTER_QUERY_DATA),\r
- &Private->TextOutQueryDataCount,\r
- (VOID **) &Private->TextOutQueryData\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- }\r
- //\r
- // Allocate buffer for the output mode map\r
- //\r
- Status = ConSplitterGrowMapTable (Private);\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- //\r
- // As the first textout device, directly add the mode in to QueryData\r
- // and at the same time record the mapping between QueryData and TextOut.\r
- //\r
- Mode = 0;\r
- Index = 0;\r
- while (Mode < MaxMode) {\r
- Status = TextOut->QueryMode (\r
- TextOut,\r
- Mode,\r
- &Private->TextOutQueryData[Mode].Columns,\r
- &Private->TextOutQueryData[Mode].Rows\r
- );\r
- //\r
- // If mode 1 (80x50) is not supported, make sure mode 1 in TextOutQueryData\r
- // is clear to 0x0.\r
- //\r
- if ((EFI_ERROR(Status)) && (Mode == 1)) {\r
- Private->TextOutQueryData[Mode].Columns = 0;\r
- Private->TextOutQueryData[Mode].Rows = 0;\r
- }\r
- Private->TextOutModeMap[Index] = Mode;\r
- Mode++;\r
- Index += Private->TextOutListCount;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Reconstruct TextOutModeMap to get intersection of modes.\r
-\r
- This routine reconstruct TextOutModeMap to get the intersection\r
- of modes for all console out devices. Because EFI/UEFI spec require\r
- mode 0 is 80x25, mode 1 is 80x50, this routine will not check the\r
- intersection for mode 0 and mode 1.\r
-\r
- @param TextOutModeMap Current text out mode map, begin with the mode 80x25\r
- @param NewlyAddedMap New text out mode map, begin with the mode 80x25\r
- @param MapStepSize Mode step size for one console device\r
- @param NewMapStepSize New Mode step size for one console device\r
- @param MaxMode IN: Current max text mode, OUT: Updated max text mode.\r
- @param CurrentMode IN: Current text mode, OUT: Updated current text mode.\r
-\r
-**/\r
-VOID\r
-ConSplitterGetIntersection (\r
- IN INT32 *TextOutModeMap,\r
- IN INT32 *NewlyAddedMap,\r
- IN UINTN MapStepSize,\r
- IN UINTN NewMapStepSize,\r
- IN OUT INT32 *MaxMode,\r
- IN OUT INT32 *CurrentMode\r
- )\r
-{\r
- INT32 Index;\r
- INT32 *CurrentMapEntry;\r
- INT32 *NextMapEntry;\r
- INT32 *NewMapEntry;\r
- INT32 CurrentMaxMode;\r
- INT32 Mode;\r
-\r
- //\r
- // According to EFI/UEFI spec, mode 0 and mode 1 have been reserved\r
- // for 80x25 and 80x50 in Simple Text Out protocol, so don't make intersection\r
- // for mode 0 and mode 1, mode number starts from 2.\r
- //\r
- Index = 2;\r
- CurrentMapEntry = &TextOutModeMap[MapStepSize * 2];\r
- NextMapEntry = CurrentMapEntry;\r
- NewMapEntry = &NewlyAddedMap[NewMapStepSize * 2];\r
-\r
- CurrentMaxMode = *MaxMode;\r
- Mode = *CurrentMode;\r
-\r
- while (Index < CurrentMaxMode) {\r
- if (*NewMapEntry == -1) {\r
- //\r
- // This mode is not supported any more. Remove it. Special care\r
- // must be taken as this remove will also affect current mode;\r
- //\r
- if (Index == *CurrentMode) {\r
- Mode = -1;\r
- } else if (Index < *CurrentMode) {\r
- Mode--;\r
- }\r
- (*MaxMode)--;\r
- } else {\r
- if (CurrentMapEntry != NextMapEntry) {\r
- CopyMem (NextMapEntry, CurrentMapEntry, MapStepSize * sizeof (INT32));\r
- }\r
-\r
- NextMapEntry += MapStepSize;\r
- }\r
-\r
- CurrentMapEntry += MapStepSize;\r
- NewMapEntry += NewMapStepSize;\r
- Index++;\r
- }\r
-\r
- *CurrentMode = Mode;\r
-\r
- return ;\r
-}\r
-\r
-/**\r
- Sync the device's output mode to console splitter's mode list.\r
-\r
- @param Private Text Out Splitter pointer.\r
- @param TextOut Simple Text Output protocol pointer.\r
-\r
-**/\r
-VOID\r
-ConSplitterSyncOutputMode (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut\r
- )\r
-{\r
- INT32 CurrentMaxMode;\r
- INT32 Mode;\r
- INT32 Index;\r
- INT32 *TextOutModeMap;\r
- INT32 *MapTable;\r
- INT32 QueryMode;\r
- TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;\r
- UINTN Rows;\r
- UINTN Columns;\r
- UINTN StepSize;\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Must make sure that current mode won't change even if mode number changes\r
- //\r
- CurrentMaxMode = Private->TextOutMode.MaxMode;\r
- TextOutModeMap = Private->TextOutModeMap;\r
- StepSize = Private->TextOutListCount;\r
- TextOutQueryData = Private->TextOutQueryData;\r
-\r
- //\r
- // Query all the mode that the newly added TextOut supports\r
- //\r
- Mode = 0;\r
- MapTable = TextOutModeMap + Private->CurrentNumberOfConsoles;\r
- while (Mode < TextOut->Mode->MaxMode) {\r
- Status = TextOut->QueryMode (TextOut, Mode, &Columns, &Rows);\r
-\r
- if (EFI_ERROR(Status)) {\r
- if (Mode == 1) {\r
- //\r
- // If mode 1 (80x50) is not supported, make sure mode 1 in TextOutQueryData\r
- // is clear to 0x0.\r
- //\r
- MapTable[StepSize] = Mode;\r
- TextOutQueryData[Mode].Columns = 0;\r
- TextOutQueryData[Mode].Rows = 0;\r
- }\r
- Mode++;\r
- continue;\r
- }\r
- //\r
- // Search the intersection map and QueryData database to see if they intersects\r
- //\r
- Index = 0;\r
- while (Index < CurrentMaxMode) {\r
- QueryMode = *(TextOutModeMap + Index * StepSize);\r
- if ((TextOutQueryData[QueryMode].Rows == Rows) && (TextOutQueryData[QueryMode].Columns == Columns)) {\r
- MapTable[Index * StepSize] = Mode;\r
- break;\r
- }\r
- Index++;\r
- }\r
- Mode++;\r
- }\r
- //\r
- // Now search the TextOutModeMap table to find the intersection of supported\r
- // mode between ConSplitter and the newly added device.\r
- //\r
- ConSplitterGetIntersection (\r
- TextOutModeMap,\r
- MapTable,\r
- StepSize,\r
- StepSize,\r
- &Private->TextOutMode.MaxMode,\r
- &Private->TextOutMode.Mode\r
- );\r
-\r
- return ;\r
-}\r
-\r
-\r
-/**\r
- Sync output device between ConOut and StdErr output.\r
-\r
- @retval EFI_SUCCESS Sync implemented successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterGetIntersectionBetweenConOutAndStrErr (\r
- VOID\r
- )\r
-{\r
- UINTN ConOutNumOfConsoles;\r
- UINTN StdErrNumOfConsoles;\r
- TEXT_OUT_AND_GOP_DATA *ConOutTextOutList;\r
- TEXT_OUT_AND_GOP_DATA *StdErrTextOutList;\r
- UINTN Indexi;\r
- UINTN Indexj;\r
- UINTN ConOutRows;\r
- UINTN ConOutColumns;\r
- UINTN StdErrRows;\r
- UINTN StdErrColumns;\r
- INT32 ConOutMaxMode;\r
- INT32 StdErrMaxMode;\r
- INT32 ConOutMode;\r
- INT32 StdErrMode;\r
- INT32 Mode;\r
- INT32 Index;\r
- INT32 *ConOutModeMap;\r
- INT32 *StdErrModeMap;\r
- INT32 *ConOutMapTable;\r
- INT32 *StdErrMapTable;\r
- TEXT_OUT_SPLITTER_QUERY_DATA *ConOutQueryData;\r
- TEXT_OUT_SPLITTER_QUERY_DATA *StdErrQueryData;\r
- UINTN ConOutStepSize;\r
- UINTN StdErrStepSize;\r
- BOOLEAN FoundTheSameTextOut;\r
- UINTN ConOutMapTableSize;\r
- UINTN StdErrMapTableSize;\r
-\r
- ConOutNumOfConsoles = mConOut.CurrentNumberOfConsoles;\r
- StdErrNumOfConsoles = mStdErr.CurrentNumberOfConsoles;\r
- ConOutTextOutList = mConOut.TextOutList;\r
- StdErrTextOutList = mStdErr.TextOutList;\r
-\r
- Indexi = 0;\r
- FoundTheSameTextOut = FALSE;\r
- while ((Indexi < ConOutNumOfConsoles) && (!FoundTheSameTextOut)) {\r
- Indexj = 0;\r
- while (Indexj < StdErrNumOfConsoles) {\r
- if (ConOutTextOutList->TextOut == StdErrTextOutList->TextOut) {\r
- FoundTheSameTextOut = TRUE;\r
- break;\r
- }\r
-\r
- Indexj++;\r
- StdErrTextOutList++;\r
- }\r
-\r
- Indexi++;\r
- ConOutTextOutList++;\r
- }\r
-\r
- if (!FoundTheSameTextOut) {\r
- return EFI_SUCCESS;\r
- }\r
- //\r
- // Must make sure that current mode won't change even if mode number changes\r
- //\r
- ConOutMaxMode = mConOut.TextOutMode.MaxMode;\r
- ConOutModeMap = mConOut.TextOutModeMap;\r
- ConOutStepSize = mConOut.TextOutListCount;\r
- ConOutQueryData = mConOut.TextOutQueryData;\r
-\r
- StdErrMaxMode = mStdErr.TextOutMode.MaxMode;\r
- StdErrModeMap = mStdErr.TextOutModeMap;\r
- StdErrStepSize = mStdErr.TextOutListCount;\r
- StdErrQueryData = mStdErr.TextOutQueryData;\r
-\r
- //\r
- // Allocate the map table and set the map table's index to -1.\r
- //\r
- ConOutMapTableSize = ConOutMaxMode * sizeof (INT32);\r
- ConOutMapTable = AllocateZeroPool (ConOutMapTableSize);\r
- if (ConOutMapTable == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- SetMem (ConOutMapTable, ConOutMapTableSize, 0xFF);\r
-\r
- StdErrMapTableSize = StdErrMaxMode * sizeof (INT32);\r
- StdErrMapTable = AllocateZeroPool (StdErrMapTableSize);\r
- if (StdErrMapTable == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- SetMem (StdErrMapTable, StdErrMapTableSize, 0xFF);\r
-\r
- //\r
- // Find the intersection of the two set of modes. If they actually intersect, the\r
- // correponding entry in the map table is set to 1.\r
- //\r
- Mode = 0;\r
- while (Mode < ConOutMaxMode) {\r
- //\r
- // Search the intersection map and QueryData database to see if they intersect\r
- //\r
- Index = 0;\r
- ConOutMode = *(ConOutModeMap + Mode * ConOutStepSize);\r
- ConOutRows = ConOutQueryData[ConOutMode].Rows;\r
- ConOutColumns = ConOutQueryData[ConOutMode].Columns;\r
- while (Index < StdErrMaxMode) {\r
- StdErrMode = *(StdErrModeMap + Index * StdErrStepSize);\r
- StdErrRows = StdErrQueryData[StdErrMode].Rows;\r
- StdErrColumns = StdErrQueryData[StdErrMode].Columns;\r
- if ((StdErrRows == ConOutRows) && (StdErrColumns == ConOutColumns)) {\r
- ConOutMapTable[Mode] = 1;\r
- StdErrMapTable[Index] = 1;\r
- break;\r
- }\r
-\r
- Index++;\r
- }\r
-\r
- Mode++;\r
- }\r
- //\r
- // Now search the TextOutModeMap table to find the intersection of supported\r
- // mode between ConSplitter and the newly added device.\r
- //\r
- ConSplitterGetIntersection (\r
- ConOutModeMap,\r
- ConOutMapTable,\r
- mConOut.TextOutListCount,\r
- 1,\r
- &(mConOut.TextOutMode.MaxMode),\r
- &(mConOut.TextOutMode.Mode)\r
- );\r
-\r
- if (mConOut.TextOutMode.Mode < 0) {\r
- mConOut.TextOut.SetMode (&(mConOut.TextOut), 0);\r
- }\r
-\r
- ConSplitterGetIntersection (\r
- StdErrModeMap,\r
- StdErrMapTable,\r
- mStdErr.TextOutListCount,\r
- 1,\r
- &(mStdErr.TextOutMode.MaxMode),\r
- &(mStdErr.TextOutMode.Mode)\r
- );\r
-\r
- if (mStdErr.TextOutMode.Mode < 0) {\r
- mStdErr.TextOut.SetMode (&(mStdErr.TextOut), 0);\r
- }\r
-\r
- FreePool (ConOutMapTable);\r
- FreePool (StdErrMapTable);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Add Grahpics Output modes into Consplitter Text Out list.\r
-\r
- @param Private Text Out Splitter pointer.\r
- @param GraphicsOutput Graphics Output protocol pointer.\r
- @param UgaDraw UGA Draw protocol pointer.\r
-\r
- @retval EFI_SUCCESS Output mode added successfully.\r
- @retval other Failed to add output mode.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterAddGraphicsOutputMode (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,\r
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINTN Index;\r
- UINTN CurrentIndex;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode;\r
- UINTN SizeOfInfo;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
- EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *CurrentGraphicsOutputMode;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *ModeBuffer;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *MatchedMode;\r
- UINTN NumberIndex;\r
- BOOLEAN Match;\r
- BOOLEAN AlreadyExist;\r
- UINT32 UgaHorizontalResolution;\r
- UINT32 UgaVerticalResolution;\r
- UINT32 UgaColorDepth;\r
- UINT32 UgaRefreshRate;\r
-\r
- ASSERT (GraphicsOutput != NULL || UgaDraw != NULL);\r
-\r
- CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode;\r
-\r
- Index = 0;\r
- CurrentIndex = 0;\r
- Status = EFI_SUCCESS;\r
-\r
- if (Private->CurrentNumberOfUgaDraw != 0) {\r
- //\r
- // If any UGA device has already been added, then there is no need to\r
- // calculate intersection of display mode of different GOP/UGA device,\r
- // since only one display mode will be exported (i.e. user-defined mode)\r
- //\r
- goto Done;\r
- }\r
-\r
- if (GraphicsOutput != NULL) {\r
- if (Private->CurrentNumberOfGraphicsOutput == 0) {\r
- //\r
- // This is the first Graphics Output device added\r
- //\r
- CurrentGraphicsOutputMode->MaxMode = GraphicsOutput->Mode->MaxMode;\r
- CurrentGraphicsOutputMode->Mode = GraphicsOutput->Mode->Mode;\r
- CopyMem (CurrentGraphicsOutputMode->Info, GraphicsOutput->Mode->Info, GraphicsOutput->Mode->SizeOfInfo);\r
- CurrentGraphicsOutputMode->SizeOfInfo = GraphicsOutput->Mode->SizeOfInfo;\r
- CurrentGraphicsOutputMode->FrameBufferBase = GraphicsOutput->Mode->FrameBufferBase;\r
- CurrentGraphicsOutputMode->FrameBufferSize = GraphicsOutput->Mode->FrameBufferSize;\r
-\r
- //\r
- // Allocate resource for the private mode buffer\r
- //\r
- ModeBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) * GraphicsOutput->Mode->MaxMode);\r
- if (ModeBuffer == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- FreePool (Private->GraphicsOutputModeBuffer);\r
- Private->GraphicsOutputModeBuffer = ModeBuffer;\r
-\r
- //\r
- // Store all supported display modes to the private mode buffer\r
- //\r
- Mode = ModeBuffer;\r
- for (Index = 0; Index < GraphicsOutput->Mode->MaxMode; Index++) {\r
- //\r
- // The Info buffer would be allocated by callee\r
- //\r
- Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) Index, &SizeOfInfo, &Info);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
- CopyMem (Mode, Info, SizeOfInfo);\r
- Mode++;\r
- FreePool (Info);\r
- }\r
- } else {\r
- //\r
- // Check intersection of display mode\r
- //\r
- ModeBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) * CurrentGraphicsOutputMode->MaxMode);\r
- if (ModeBuffer == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- MatchedMode = ModeBuffer;\r
- Mode = &Private->GraphicsOutputModeBuffer[0];\r
- for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {\r
- Match = FALSE;\r
-\r
- for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex++) {\r
- //\r
- // The Info buffer would be allocated by callee\r
- //\r
- Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&\r
- (Info->VerticalResolution == Mode->VerticalResolution)) {\r
- //\r
- // If GOP device supports one mode in current mode buffer,\r
- // it will be added into matched mode buffer\r
- //\r
- Match = TRUE;\r
- FreePool (Info);\r
- break;\r
- }\r
- FreePool (Info);\r
- }\r
-\r
- if (Match) {\r
- AlreadyExist = FALSE;\r
-\r
- //\r
- // Check if GOP mode has been in the mode buffer, ModeBuffer = MatchedMode at begin.\r
- //\r
- for (Info = ModeBuffer; Info < MatchedMode; Info++) {\r
- if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&\r
- (Info->VerticalResolution == Mode->VerticalResolution)) {\r
- AlreadyExist = TRUE;\r
- break;\r
- }\r
- }\r
-\r
- if (!AlreadyExist) {\r
- CopyMem (MatchedMode, Mode, sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
-\r
- //\r
- // Physical frame buffer is no longer available, change PixelFormat to PixelBltOnly\r
- //\r
- MatchedMode->Version = 0;\r
- MatchedMode->PixelFormat = PixelBltOnly;\r
- ZeroMem (&MatchedMode->PixelInformation, sizeof (EFI_PIXEL_BITMASK));\r
-\r
- MatchedMode++;\r
- }\r
- }\r
-\r
- Mode++;\r
- }\r
-\r
- //\r
- // Drop the old mode buffer, assign it to a new one\r
- //\r
- FreePool (Private->GraphicsOutputModeBuffer);\r
- Private->GraphicsOutputModeBuffer = ModeBuffer;\r
-\r
- //\r
- // Physical frame buffer is no longer available when there are more than one physical GOP devices\r
- //\r
- CurrentGraphicsOutputMode->MaxMode = (UINT32) (((UINTN) MatchedMode - (UINTN) ModeBuffer) / sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
- CurrentGraphicsOutputMode->Info->PixelFormat = PixelBltOnly;\r
- ZeroMem (&CurrentGraphicsOutputMode->Info->PixelInformation, sizeof (EFI_PIXEL_BITMASK));\r
- CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
- CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;\r
- CurrentGraphicsOutputMode->FrameBufferSize = 0;\r
- }\r
-\r
- //\r
- // Graphics console driver can ensure the same mode for all GOP devices\r
- //\r
- for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {\r
- Mode = &Private->GraphicsOutputModeBuffer[Index];\r
- if ((Mode->HorizontalResolution == GraphicsOutput->Mode->Info->HorizontalResolution) &&\r
- (Mode->VerticalResolution == GraphicsOutput->Mode->Info->VerticalResolution)) {\r
- CurrentIndex = Index;\r
- break;\r
- }\r
- }\r
- if (Index >= CurrentGraphicsOutputMode->MaxMode) {\r
- //\r
- // if user defined mode is not found, set to default mode 800x600\r
- //\r
- for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {\r
- Mode = &Private->GraphicsOutputModeBuffer[Index];\r
- if ((Mode->HorizontalResolution == 800) && (Mode->VerticalResolution == 600)) {\r
- CurrentIndex = Index;\r
- break;\r
- }\r
- }\r
- }\r
- } else if (UgaDraw != NULL) {\r
- //\r
- // Graphics console driver can ensure the same mode for all GOP devices\r
- // so we can get the current mode from this video device\r
- //\r
- UgaDraw->GetMode (\r
- UgaDraw,\r
- &UgaHorizontalResolution,\r
- &UgaVerticalResolution,\r
- &UgaColorDepth,\r
- &UgaRefreshRate\r
- );\r
-\r
- CurrentGraphicsOutputMode->MaxMode = 1;\r
- Info = CurrentGraphicsOutputMode->Info;\r
- Info->Version = 0;\r
- Info->HorizontalResolution = UgaHorizontalResolution;\r
- Info->VerticalResolution = UgaVerticalResolution;\r
- Info->PixelFormat = PixelBltOnly;\r
- Info->PixelsPerScanLine = UgaHorizontalResolution;\r
- CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
- CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;\r
- CurrentGraphicsOutputMode->FrameBufferSize = 0;\r
-\r
- //\r
- // Update the private mode buffer\r
- //\r
- CopyMem (&Private->GraphicsOutputModeBuffer[0], Info, sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
-\r
- //\r
- // Only mode 0 is available to be set\r
- //\r
- CurrentIndex = 0;\r
- }\r
-\r
-Done:\r
-\r
- if (GraphicsOutput != NULL) {\r
- Private->CurrentNumberOfGraphicsOutput++;\r
- }\r
- if (UgaDraw != NULL) {\r
- Private->CurrentNumberOfUgaDraw++;\r
- }\r
-\r
- //\r
- // Force GraphicsOutput mode to be set,\r
- //\r
- \r
- Mode = &Private->GraphicsOutputModeBuffer[CurrentIndex];\r
- if ((GraphicsOutput != NULL) &&\r
- (Mode->HorizontalResolution == CurrentGraphicsOutputMode->Info->HorizontalResolution) &&\r
- (Mode->VerticalResolution == CurrentGraphicsOutputMode->Info->VerticalResolution)) {\r
- CurrentGraphicsOutputMode->Mode = (UINT32) CurrentIndex;\r
- if ((Mode->HorizontalResolution != GraphicsOutput->Mode->Info->HorizontalResolution) ||\r
- (Mode->VerticalResolution != GraphicsOutput->Mode->Info->VerticalResolution)) {\r
- //\r
- // If all existing video device has been set to common mode, only set new GOP device to\r
- // the common mode\r
- //\r
- for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {\r
- Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {\r
- FreePool (Info);\r
- break;\r
- }\r
- FreePool (Info);\r
- }\r
- Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r
- }\r
- } else {\r
- //\r
- // Current mode number may need update now, so set it to an invalid mode number\r
- //\r
- CurrentGraphicsOutputMode->Mode = 0xffff;\r
- //\r
- // Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.\r
- //\r
- Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex);\r
- if (EFI_ERROR(Status)) {\r
- //\r
- // If user defined mode is not valid for display device, set to the default mode 800x600.\r
- //\r
- (Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800;\r
- (Private->GraphicsOutputModeBuffer[0]).VerticalResolution = 600;\r
- Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0);\r
- }\r
- }\r
-\r
- return Status;\r
-}\r
-\r
-/**\r
- Set the current console out mode.\r
-\r
- This routine will get the current console mode information (column, row)\r
- from ConsoleOutMode variable and set it; if the variable does not exist,\r
- set to user defined console mode.\r
-\r
- @param Private Consplitter Text Out pointer.\r
-\r
-**/\r
-VOID\r
-ConsplitterSetConsoleOutMode (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private\r
- )\r
-{\r
- UINTN Col;\r
- UINTN Row;\r
- UINTN Mode;\r
- UINTN PreferMode;\r
- UINTN BaseMode;\r
- UINTN MaxMode;\r
- EFI_STATUS Status;\r
- CONSOLE_OUT_MODE ModeInfo;\r
- CONSOLE_OUT_MODE MaxModeInfo;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;\r
-\r
- PreferMode = 0xFF;\r
- BaseMode = 0xFF;\r
- TextOut = &Private->TextOut;\r
- MaxMode = (UINTN) (TextOut->Mode->MaxMode);\r
-\r
- MaxModeInfo.Column = 0;\r
- MaxModeInfo.Row = 0; \r
- ModeInfo.Column = PcdGet32 (PcdConOutColumn);\r
- ModeInfo.Row = PcdGet32 (PcdConOutRow);\r
-\r
- //\r
- // To find the prefer mode and basic mode from Text Out mode list\r
- //\r
- for (Mode = 0; Mode < MaxMode; Mode++) {\r
- Status = TextOut->QueryMode (TextOut, Mode, &Col, &Row);\r
- if (!EFI_ERROR(Status)) {\r
- if ((ModeInfo.Column != 0) && (ModeInfo.Row != 0)) {\r
- //\r
- // Use user defined column and row\r
- //\r
- if (Col == ModeInfo.Column && Row == ModeInfo.Row) {\r
- PreferMode = Mode;\r
- }\r
- } else {\r
- //\r
- // If user sets PcdConOutColumn or PcdConOutRow to 0,\r
- // find and set the highest text mode.\r
- //\r
- if ((Col >= MaxModeInfo.Column) && (Row >= MaxModeInfo.Row)) {\r
- MaxModeInfo.Column = Col;\r
- MaxModeInfo.Row = Row;\r
- PreferMode = Mode;\r
- }\r
- }\r
- if (Col == 80 && Row == 25) {\r
- BaseMode = Mode;\r
- }\r
- }\r
- }\r
-\r
- //\r
- // Set prefer mode to Text Out devices.\r
- //\r
- Status = TextOut->SetMode (TextOut, PreferMode);\r
- if (EFI_ERROR(Status)) {\r
- //\r
- // if current mode setting is failed, default 80x25 mode will be set.\r
- //\r
- Status = TextOut->SetMode (TextOut, BaseMode);\r
- ASSERT(!EFI_ERROR(Status));\r
-\r
- PcdSet32 (PcdConOutColumn, 80);\r
- PcdSet32 (PcdConOutRow, 25);\r
- }\r
-\r
- return ;\r
-}\r
-\r
-\r
-/**\r
- Add Text Output Device in Consplitter Text Output list.\r
-\r
- @param Private Text Out Splitter pointer.\r
- @param TextOut Simple Text Output protocol pointer.\r
- @param GraphicsOutput Graphics Output protocol pointer.\r
- @param UgaDraw UGA Draw protocol pointer.\r
-\r
- @retval EFI_SUCCESS Text Output Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextOutAddDevice (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut,\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,\r
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINTN CurrentNumOfConsoles;\r
- INT32 MaxMode;\r
- UINT32 UgaHorizontalResolution;\r
- UINT32 UgaVerticalResolution;\r
- UINT32 UgaColorDepth;\r
- UINT32 UgaRefreshRate;\r
- TEXT_OUT_AND_GOP_DATA *TextAndGop;\r
- UINTN SizeOfInfo;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
- EFI_STATUS DeviceStatus;\r
-\r
- Status = EFI_SUCCESS;\r
- CurrentNumOfConsoles = Private->CurrentNumberOfConsoles;\r
-\r
- //\r
- // If the Text Out List is full, enlarge it by calling ConSplitterGrowBuffer().\r
- //\r
- while (CurrentNumOfConsoles >= Private->TextOutListCount) {\r
- Status = ConSplitterGrowBuffer (\r
- sizeof (TEXT_OUT_AND_GOP_DATA),\r
- &Private->TextOutListCount,\r
- (VOID **) &Private->TextOutList\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- //\r
- // Also need to reallocate the TextOutModeMap table\r
- //\r
- Status = ConSplitterGrowMapTable (Private);\r
- if (EFI_ERROR (Status)) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- }\r
-\r
- TextAndGop = &Private->TextOutList[CurrentNumOfConsoles];\r
-\r
- TextAndGop->TextOut = TextOut;\r
- TextAndGop->GraphicsOutput = GraphicsOutput;\r
- TextAndGop->UgaDraw = UgaDraw;\r
-\r
- if (CurrentNumOfConsoles == 0) {\r
- //\r
- // Add the first device's output mode to console splitter's mode list\r
- //\r
- Status = ConSplitterAddOutputMode (Private, TextOut);\r
- } else {\r
- ConSplitterSyncOutputMode (Private, TextOut);\r
- }\r
-\r
- Private->CurrentNumberOfConsoles++;\r
-\r
- //\r
- // Scan both TextOutList, for the intersection TextOut device\r
- // maybe both ConOut and StdErr incorporate the same Text Out\r
- // device in them, thus the output of both should be synced.\r
- //\r
- ConSplitterGetIntersectionBetweenConOutAndStrErr ();\r
-\r
- MaxMode = Private->TextOutMode.MaxMode;\r
- ASSERT (MaxMode >= 1);\r
-\r
- DeviceStatus = EFI_DEVICE_ERROR;\r
- Status = EFI_DEVICE_ERROR;\r
- \r
- //\r
- // This device display mode will be added into Graphics Ouput modes.\r
- //\r
- if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {\r
- DeviceStatus = ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);\r
- }\r
-\r
- if (FeaturePcdGet (PcdConOutUgaSupport)) {\r
- //\r
- // If UGA is produced by Consplitter\r
- //\r
- if (GraphicsOutput != NULL) {\r
- Status = GraphicsOutput->QueryMode (GraphicsOutput, GraphicsOutput->Mode->Mode, &SizeOfInfo, &Info);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- ASSERT ( SizeOfInfo <= sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
-\r
- UgaHorizontalResolution = Info->HorizontalResolution;\r
- UgaVerticalResolution = Info->VerticalResolution;\r
-\r
- FreePool (Info);\r
-\r
- } else if (UgaDraw != NULL) {\r
- Status = UgaDraw->GetMode (\r
- UgaDraw,\r
- &UgaHorizontalResolution,\r
- &UgaVerticalResolution,\r
- &UgaColorDepth,\r
- &UgaRefreshRate\r
- );\r
- if (!EFI_ERROR (Status) && EFI_ERROR (DeviceStatus)) {\r
- //\r
- // if GetMode is successfully and UGA device hasn't been set, set it\r
- //\r
- Status = ConSplitterUgaDrawSetMode (\r
- &Private->UgaDraw,\r
- UgaHorizontalResolution,\r
- UgaVerticalResolution,\r
- UgaColorDepth,\r
- UgaRefreshRate\r
- );\r
- }\r
- //\r
- // If GetMode/SetMode is failed, set to 800x600 mode\r
- //\r
- if(EFI_ERROR (Status)) {\r
- Status = ConSplitterUgaDrawSetMode (\r
- &Private->UgaDraw,\r
- 800,\r
- 600,\r
- 32,\r
- 60\r
- );\r
- }\r
- }\r
- }\r
-\r
- if (((!EFI_ERROR (DeviceStatus)) || (!EFI_ERROR (Status))) &&\r
- ((Private->CurrentNumberOfGraphicsOutput + Private->CurrentNumberOfUgaDraw) == 1)) {\r
- if (!FeaturePcdGet (PcdConOutGopSupport)) {\r
- //\r
- // If Graphics Outpurt protocol not supported, UGA Draw protocol is installed\r
- // on the virtual handle.\r
- //\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &mConOut.VirtualHandle,\r
- &gEfiUgaDrawProtocolGuid,\r
- &mConOut.UgaDraw,\r
- NULL\r
- );\r
- } else if (!FeaturePcdGet (PcdConOutUgaSupport)) {\r
- //\r
- // If UGA Draw protocol not supported, Graphics Output Protocol is installed\r
- // on virtual handle.\r
- //\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &mConOut.VirtualHandle,\r
- &gEfiGraphicsOutputProtocolGuid,\r
- &mConOut.GraphicsOutput,\r
- NULL\r
- );\r
- } else {\r
- //\r
- // Boot Graphics Output protocol and UGA Draw protocol are supported,\r
- // both they will be installed on virtual handle.\r
- //\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &mConOut.VirtualHandle,\r
- &gEfiGraphicsOutputProtocolGuid,\r
- &mConOut.GraphicsOutput,\r
- &gEfiUgaDrawProtocolGuid,\r
- &mConOut.UgaDraw,\r
- NULL\r
- );\r
- }\r
- }\r
-\r
- //\r
- // After adding new console device, all existing console devices should be\r
- // synced to the current shared mode.\r
- //\r
- ConsplitterSetConsoleOutMode (Private);\r
-\r
- return Status;\r
-}\r
-\r
-\r
-/**\r
- Remove Text Out Device in Consplitter Text Out list.\r
-\r
- @param Private Text Out Splitter pointer.\r
- @param TextOut Simple Text Output Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Text Out Device removed successfully.\r
- @retval EFI_NOT_FOUND No Text Out Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextOutDeleteDevice (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut\r
- )\r
-{\r
- INT32 Index;\r
- UINTN CurrentNumOfConsoles;\r
- TEXT_OUT_AND_GOP_DATA *TextOutList;\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Remove the specified text-out device data structure from the Text out List,\r
- // and rearrange the remaining data structures in the Text out List.\r
- //\r
- CurrentNumOfConsoles = Private->CurrentNumberOfConsoles;\r
- Index = (INT32) CurrentNumOfConsoles - 1;\r
- TextOutList = Private->TextOutList;\r
- while (Index >= 0) {\r
- if (TextOutList->TextOut == TextOut) {\r
- if (TextOutList->UgaDraw != NULL) {\r
- Private->CurrentNumberOfUgaDraw--;\r
- }\r
- if (TextOutList->GraphicsOutput != NULL) {\r
- Private->CurrentNumberOfGraphicsOutput--;\r
- }\r
- CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index);\r
- CurrentNumOfConsoles--;\r
- break;\r
- }\r
-\r
- Index--;\r
- TextOutList++;\r
- }\r
- //\r
- // The specified TextOut is not managed by the ConSplitter driver\r
- //\r
- if (Index < 0) {\r
- return EFI_NOT_FOUND;\r
- }\r
-\r
- if ((Private->CurrentNumberOfGraphicsOutput == 0) && (Private->CurrentNumberOfUgaDraw == 0)) {\r
- //\r
- // If there is not any physical GOP and UGA device in system,\r
- // Consplitter GOP or UGA protocol will be uninstalled\r
- //\r
- if (!FeaturePcdGet (PcdConOutGopSupport)) {\r
- Status = gBS->UninstallProtocolInterface (\r
- Private->VirtualHandle,\r
- &gEfiUgaDrawProtocolGuid,\r
- &Private->UgaDraw\r
- ); \r
- } else if (!FeaturePcdGet (PcdConOutUgaSupport)) {\r
- Status = gBS->UninstallProtocolInterface (\r
- Private->VirtualHandle,\r
- &gEfiGraphicsOutputProtocolGuid,\r
- &Private->GraphicsOutput\r
- );\r
- } else {\r
- Status = gBS->UninstallMultipleProtocolInterfaces (\r
- Private->VirtualHandle,\r
- &gEfiUgaDrawProtocolGuid,\r
- &Private->UgaDraw,\r
- &gEfiGraphicsOutputProtocolGuid,\r
- &Private->GraphicsOutput,\r
- NULL\r
- );\r
- }\r
- }\r
-\r
- if (CurrentNumOfConsoles == 0) {\r
- //\r
- // If the number of consoles is zero, reset all parameters\r
- //\r
- Private->CurrentNumberOfConsoles = 0;\r
- Private->TextOutMode.MaxMode = 1;\r
- Private->TextOutQueryData[0].Columns = 80;\r
- Private->TextOutQueryData[0].Rows = 25;\r
- TextOutSetMode (Private, 0);\r
-\r
- return EFI_SUCCESS;\r
- }\r
- //\r
- // Max Mode is realy an intersection of the QueryMode command to all\r
- // devices. So we must copy the QueryMode of the first device to\r
- // QueryData.\r
- //\r
- ZeroMem (\r
- Private->TextOutQueryData,\r
- Private->TextOutQueryDataCount * sizeof (TEXT_OUT_SPLITTER_QUERY_DATA)\r
- );\r
-\r
- FreePool (Private->TextOutModeMap);\r
- Private->TextOutModeMap = NULL;\r
- TextOutList = Private->TextOutList;\r
-\r
- //\r
- // Add the first TextOut to the QueryData array and ModeMap table\r
- //\r
- Status = ConSplitterAddOutputMode (Private, TextOutList->TextOut);\r
-\r
- //\r
- // Now add one by one\r
- //\r
- Index = 1;\r
- Private->CurrentNumberOfConsoles = 1;\r
- TextOutList++;\r
- while ((UINTN) Index < CurrentNumOfConsoles) {\r
- ConSplitterSyncOutputMode (Private, TextOutList->TextOut);\r
- Index++;\r
- Private->CurrentNumberOfConsoles++;\r
- TextOutList++;\r
- }\r
-\r
- ConSplitterGetIntersectionBetweenConOutAndStrErr ();\r
-\r
- return Status;\r
-}\r
-\r
-\r
-/**\r
- Reset the input device and optionaly run diagnostics\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
- not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInReset (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_STATUS ReturnStatus;\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
-\r
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- Private->KeyEventSignalState = FALSE;\r
-\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextInList[Index]->Reset (\r
- Private->TextInList[Index],\r
- ExtendedVerification\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param Private Protocol instance pointer.\r
- @param Key Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keydtroke information was not returned due\r
- to hardware errors.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInPrivateReadKeyStroke (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- OUT EFI_INPUT_KEY *Key\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINTN Index;\r
- EFI_INPUT_KEY CurrentKey;\r
-\r
- Key->UnicodeChar = 0;\r
- Key->ScanCode = SCAN_NULL;\r
-\r
- //\r
- // if no physical console input device exists, return EFI_NOT_READY;\r
- // if any physical console input device has key input,\r
- // return the key and EFI_SUCCESS.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextInList[Index]->ReadKeyStroke (\r
- Private->TextInList[Index],\r
- &CurrentKey\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- *Key = CurrentKey;\r
- return Status;\r
- }\r
- }\r
-\r
- return EFI_NOT_READY;\r
-}\r
-\r
-\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param This Protocol instance pointer.\r
- @param Key Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keydtroke information was not returned due\r
- to hardware errors.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInReadKeyStroke (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- OUT EFI_INPUT_KEY *Key\r
- )\r
-{\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
-\r
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- Private->KeyEventSignalState = FALSE;\r
-\r
- //\r
- // Signal ConnectConIn event on first call in Lazy ConIn mode\r
- //\r
- if (!mConInIsConnect && PcdGetBool (PcdConInConnectOnDemand)) {\r
- DEBUG ((EFI_D_INFO, "Connect ConIn in first ReadKeyStoke in Lazy ConIn mode.\n")); \r
- gBS->SignalEvent (Private->ConnectConInEvent);\r
- mConInIsConnect = TRUE;\r
- }\r
-\r
- return ConSplitterTextInPrivateReadKeyStroke (Private, Key);\r
-}\r
-\r
-\r
-/**\r
- This event aggregates all the events of the ConIn devices in the spliter.\r
-\r
- If any events of physical ConIn devices are signaled, signal the ConIn\r
- spliter event. This will cause the calling code to call\r
- ConSplitterTextInReadKeyStroke ().\r
-\r
- @param Event The Event assoicated with callback.\r
- @param Context Context registered when Event was created.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ConSplitterTextInWaitForKey (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
-\r
- Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context;\r
-\r
- if (Private->KeyEventSignalState) {\r
- //\r
- // If KeyEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke()\r
- //\r
- gBS->SignalEvent (Event);\r
- return ;\r
- }\r
-\r
- //\r
- // If any physical console input device has key input, signal the event.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = gBS->CheckEvent (Private->TextInList[Index]->WaitForKey);\r
- if (!EFI_ERROR (Status)) {\r
- gBS->SignalEvent (Event);\r
- Private->KeyEventSignalState = TRUE;\r
- }\r
- }\r
-}\r
-\r
-\r
-\r
-/**\r
- Test if the key has been registered on input device.\r
-\r
- @param RegsiteredData A pointer to a buffer that is filled in with the\r
- keystroke state data for the key that was\r
- registered.\r
- @param InputData A pointer to a buffer that is filled in with the\r
- keystroke state data for the key that was\r
- pressed.\r
-\r
- @retval TRUE Key be pressed matches a registered key.\r
- @retval FLASE Match failed.\r
-\r
-**/\r
-BOOLEAN\r
-IsKeyRegistered (\r
- IN EFI_KEY_DATA *RegsiteredData,\r
- IN EFI_KEY_DATA *InputData\r
- )\r
-{\r
- ASSERT (RegsiteredData != NULL && InputData != NULL);\r
-\r
- if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||\r
- (RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) {\r
- return FALSE;\r
- }\r
-\r
- //\r
- // Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.\r
- //\r
- if (RegsiteredData->KeyState.KeyShiftState != 0 &&\r
- RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) {\r
- return FALSE;\r
- }\r
- if (RegsiteredData->KeyState.KeyToggleState != 0 &&\r
- RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState) {\r
- return FALSE;\r
- }\r
-\r
- return TRUE;\r
-\r
-}\r
-\r
-\r
-/**\r
- Reset the input device and optionaly run diagnostics\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
- not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInResetEx (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_STATUS ReturnStatus;\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
-\r
- Private = TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- Private->KeyEventSignalState = FALSE;\r
-\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfExConsoles; Index++) {\r
- Status = Private->TextInExList[Index]->Reset (\r
- Private->TextInExList[Index],\r
- ExtendedVerification\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- return ReturnStatus;\r
-\r
-}\r
-\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param This Protocol instance pointer.\r
- @param KeyData A pointer to a buffer that is filled in with the\r
- keystroke state data for the key that was\r
- pressed.\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keystroke information was not returned due\r
- to hardware errors.\r
- @retval EFI_INVALID_PARAMETER KeyData is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInReadKeyStrokeEx (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- OUT EFI_KEY_DATA *KeyData\r
- )\r
-{\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- EFI_STATUS Status;\r
- UINTN Index;\r
- EFI_KEY_DATA CurrentKeyData;\r
-\r
-\r
- if (KeyData == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Private = TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- Private->KeyEventSignalState = FALSE;\r
-\r
- KeyData->Key.UnicodeChar = 0;\r
- KeyData->Key.ScanCode = SCAN_NULL;\r
-\r
- //\r
- // Signal ConnectConIn event on first call in Lazy ConIn mode\r
- //\r
- if (!mConInIsConnect && PcdGetBool (PcdConInConnectOnDemand)) {\r
- DEBUG ((EFI_D_INFO, "Connect ConIn in first ReadKeyStoke in Lazy ConIn mode.\n")); \r
- gBS->SignalEvent (Private->ConnectConInEvent);\r
- mConInIsConnect = TRUE;\r
- }\r
-\r
- //\r
- // if no physical console input device exists, return EFI_NOT_READY;\r
- // if any physical console input device has key input,\r
- // return the key and EFI_SUCCESS.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) {\r
- Status = Private->TextInExList[Index]->ReadKeyStrokeEx (\r
- Private->TextInExList[Index],\r
- &CurrentKeyData\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- CopyMem (KeyData, &CurrentKeyData, sizeof (CurrentKeyData));\r
- return Status;\r
- }\r
- }\r
-\r
- return EFI_NOT_READY;\r
-}\r
-\r
-\r
-/**\r
- Set certain state for the input device.\r
-\r
- @param This Protocol instance pointer.\r
- @param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
- state for the input device.\r
-\r
- @retval EFI_SUCCESS The device state was set successfully.\r
- @retval EFI_DEVICE_ERROR The device is not functioning correctly and\r
- could not have the setting adjusted.\r
- @retval EFI_UNSUPPORTED The device does not have the ability to set its\r
- state.\r
- @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInSetState (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r
- )\r
-{\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- EFI_STATUS Status;\r
- UINTN Index;\r
-\r
- if (KeyToggleState == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Private = TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // if no physical console input device exists, return EFI_SUCCESS;\r
- // otherwise return the status of setting state of physical console input device\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) {\r
- Status = Private->TextInExList[Index]->SetState (\r
- Private->TextInExList[Index],\r
- KeyToggleState\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- }\r
-\r
- return EFI_SUCCESS;\r
-\r
-}\r
-\r
-\r
-/**\r
- Register a notification function for a particular keystroke for the input device.\r
-\r
- @param This Protocol instance pointer.\r
- @param KeyData A pointer to a buffer that is filled in with the\r
- keystroke information data for the key that was\r
- pressed.\r
- @param KeyNotificationFunction Points to the function to be called when the key\r
- sequence is typed specified by KeyData.\r
- @param NotifyHandle Points to the unique handle assigned to the\r
- registered notification.\r
-\r
- @retval EFI_SUCCESS The notification function was registered\r
- successfully.\r
- @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data\r
- structures.\r
- @retval EFI_INVALID_PARAMETER KeyData or KeyNotificationFunction or NotifyHandle is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInRegisterKeyNotify (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_KEY_DATA *KeyData,\r
- IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r
- OUT VOID **NotifyHandle\r
- )\r
-{\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- EFI_STATUS Status;\r
- UINTN Index;\r
- TEXT_IN_EX_SPLITTER_NOTIFY *NewNotify;\r
- LIST_ENTRY *Link;\r
- TEXT_IN_EX_SPLITTER_NOTIFY *CurrentNotify;\r
-\r
-\r
- if (KeyData == NULL || NotifyHandle == NULL || KeyNotificationFunction == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Private = TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered.\r
- //\r
- for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
- CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link);\r
- if (IsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {\r
- if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) {\r
- *NotifyHandle = CurrentNotify;\r
- return EFI_SUCCESS;\r
- }\r
- }\r
- }\r
-\r
- //\r
- // Allocate resource to save the notification function\r
- //\r
- NewNotify = (TEXT_IN_EX_SPLITTER_NOTIFY *) AllocateZeroPool (sizeof (TEXT_IN_EX_SPLITTER_NOTIFY));\r
- if (NewNotify == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- NewNotify->NotifyHandleList = (EFI_HANDLE *) AllocateZeroPool (sizeof (EFI_HANDLE) * Private->TextInExListCount);\r
- if (NewNotify->NotifyHandleList == NULL) {\r
- gBS->FreePool (NewNotify);\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- NewNotify->Signature = TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE;\r
- NewNotify->KeyNotificationFn = KeyNotificationFunction;\r
- CopyMem (&NewNotify->KeyData, KeyData, sizeof (EFI_KEY_DATA));\r
-\r
- //\r
- // Return the wrong status of registering key notify of\r
- // physical console input device if meet problems\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) {\r
- Status = Private->TextInExList[Index]->RegisterKeyNotify (\r
- Private->TextInExList[Index],\r
- KeyData,\r
- KeyNotificationFunction,\r
- &NewNotify->NotifyHandleList[Index]\r
- );\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // Un-register the key notify on all physical console input devices\r
- //\r
- while (Index-- != 0) {\r
- Private->TextInExList[Index]->UnregisterKeyNotify (\r
- Private->TextInExList[Index],\r
- NewNotify->NotifyHandleList[Index]\r
- );\r
- }\r
- gBS->FreePool (NewNotify->NotifyHandleList);\r
- gBS->FreePool (NewNotify);\r
- return Status;\r
- }\r
- }\r
-\r
- InsertTailList (&mConIn.NotifyList, &NewNotify->NotifyEntry);\r
-\r
- *NotifyHandle = NewNotify;\r
-\r
- return EFI_SUCCESS;\r
-\r
-}\r
-\r
-\r
-/**\r
- Remove a registered notification function from a particular keystroke.\r
-\r
- @param This Protocol instance pointer.\r
- @param NotificationHandle The handle of the notification function being\r
- unregistered.\r
-\r
- @retval EFI_SUCCESS The notification function was unregistered\r
- successfully.\r
- @retval EFI_INVALID_PARAMETER The NotificationHandle is invalid.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInUnregisterKeyNotify (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN VOID *NotificationHandle\r
- )\r
-{\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- TEXT_IN_EX_SPLITTER_NOTIFY *CurrentNotify;\r
- LIST_ENTRY *Link;\r
-\r
- if (NotificationHandle == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Private = TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {\r
- CurrentNotify = TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS (Link);\r
- if (CurrentNotify == NotificationHandle) {\r
- for (Index = 0; Index < Private->CurrentNumberOfExConsoles; Index++) {\r
- Private->TextInExList[Index]->UnregisterKeyNotify (\r
- Private->TextInExList[Index],\r
- CurrentNotify->NotifyHandleList[Index]\r
- );\r
- }\r
- RemoveEntryList (&CurrentNotify->NotifyEntry);\r
-\r
- gBS->FreePool (CurrentNotify->NotifyHandleList);\r
- gBS->FreePool (CurrentNotify);\r
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- //\r
- // NotificationHandle is not found in database\r
- //\r
- return EFI_INVALID_PARAMETER;\r
-}\r
-\r
-\r
-/**\r
- Reset the input device and optionaly run diagnostics\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
- not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerReset (\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_STATUS ReturnStatus;\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
-\r
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_SIMPLE_POINTER_THIS (This);\r
-\r
- Private->InputEventSignalState = FALSE;\r
-\r
- if (Private->CurrentNumberOfPointers == 0) {\r
- return EFI_SUCCESS;\r
- }\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfPointers; Index++) {\r
- Status = Private->PointerList[Index]->Reset (\r
- Private->PointerList[Index],\r
- ExtendedVerification\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param Private Protocol instance pointer.\r
- @param State The state information of simple pointer device.\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keydtroke information was not returned due\r
- to hardware errors.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerPrivateGetState (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN OUT EFI_SIMPLE_POINTER_STATE *State\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_STATUS ReturnStatus;\r
- UINTN Index;\r
- EFI_SIMPLE_POINTER_STATE CurrentState;\r
-\r
- State->RelativeMovementX = 0;\r
- State->RelativeMovementY = 0;\r
- State->RelativeMovementZ = 0;\r
- State->LeftButton = FALSE;\r
- State->RightButton = FALSE;\r
-\r
- //\r
- // if no physical console input device exists, return EFI_NOT_READY;\r
- // if any physical console input device has key input,\r
- // return the key and EFI_SUCCESS.\r
- //\r
- ReturnStatus = EFI_NOT_READY;\r
- for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) {\r
-\r
- Status = Private->PointerList[Index]->GetState (\r
- Private->PointerList[Index],\r
- &CurrentState\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- if (ReturnStatus == EFI_NOT_READY) {\r
- ReturnStatus = EFI_SUCCESS;\r
- }\r
-\r
- if (CurrentState.LeftButton) {\r
- State->LeftButton = TRUE;\r
- }\r
-\r
- if (CurrentState.RightButton) {\r
- State->RightButton = TRUE;\r
- }\r
-\r
- if (CurrentState.RelativeMovementX != 0 && Private->PointerList[Index]->Mode->ResolutionX != 0) {\r
- State->RelativeMovementX += (CurrentState.RelativeMovementX * (INT32) Private->SimplePointerMode.ResolutionX) / (INT32) Private->PointerList[Index]->Mode->ResolutionX;\r
- }\r
-\r
- if (CurrentState.RelativeMovementY != 0 && Private->PointerList[Index]->Mode->ResolutionY != 0) {\r
- State->RelativeMovementY += (CurrentState.RelativeMovementY * (INT32) Private->SimplePointerMode.ResolutionY) / (INT32) Private->PointerList[Index]->Mode->ResolutionY;\r
- }\r
-\r
- if (CurrentState.RelativeMovementZ != 0 && Private->PointerList[Index]->Mode->ResolutionZ != 0) {\r
- State->RelativeMovementZ += (CurrentState.RelativeMovementZ * (INT32) Private->SimplePointerMode.ResolutionZ) / (INT32) Private->PointerList[Index]->Mode->ResolutionZ;\r
- }\r
- } else if (Status == EFI_DEVICE_ERROR) {\r
- ReturnStatus = EFI_DEVICE_ERROR;\r
- }\r
- }\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param This A pointer to protocol instance.\r
- @param State A pointer to state information on the pointer device\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned in State.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keydtroke information was not returned due\r
- to hardware errors.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerGetState (\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r
- IN OUT EFI_SIMPLE_POINTER_STATE *State\r
- )\r
-{\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
-\r
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_SIMPLE_POINTER_THIS (This);\r
-\r
- Private->InputEventSignalState = FALSE;\r
-\r
- return ConSplitterSimplePointerPrivateGetState (Private, State);\r
-}\r
-\r
-\r
-/**\r
- This event agregates all the events of the ConIn devices in the spliter.\r
- If any events of physical ConIn devices are signaled, signal the ConIn\r
- spliter event. This will cause the calling code to call\r
- ConSplitterTextInReadKeyStroke ().\r
-\r
- @param Event The Event assoicated with callback.\r
- @param Context Context registered when Event was created.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ConSplitterSimplePointerWaitForInput (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
-\r
- Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context;\r
-\r
- //\r
- // if InputEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke()\r
- //\r
- if (Private->InputEventSignalState) {\r
- gBS->SignalEvent (Event);\r
- return ;\r
- }\r
- //\r
- // if any physical console input device has key input, signal the event.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) {\r
- Status = gBS->CheckEvent (Private->PointerList[Index]->WaitForInput);\r
- if (!EFI_ERROR (Status)) {\r
- gBS->SignalEvent (Event);\r
- Private->InputEventSignalState = TRUE;\r
- }\r
- }\r
-}\r
-\r
-/**\r
- Resets the pointer device hardware.\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning correctly and\r
- could not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerReset (\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_STATUS ReturnStatus;\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
-\r
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);\r
-\r
- Private->AbsoluteInputEventSignalState = FALSE;\r
-\r
- if (Private->CurrentNumberOfAbsolutePointers == 0) {\r
- return EFI_SUCCESS;\r
- }\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {\r
- Status = Private->AbsolutePointerList[Index]->Reset (\r
- Private->AbsolutePointerList[Index],\r
- ExtendedVerification\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Retrieves the current state of a pointer device.\r
-\r
- @param This Protocol instance pointer.\r
- @param State A pointer to the state information on the\r
- pointer device.\r
-\r
- @retval EFI_SUCCESS The state of the pointer device was returned in\r
- State..\r
- @retval EFI_NOT_READY The state of the pointer device has not changed\r
- since the last call to GetState().\r
- @retval EFI_DEVICE_ERROR A device error occurred while attempting to\r
- retrieve the pointer device's current state.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerGetState (\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
- IN OUT EFI_ABSOLUTE_POINTER_STATE *State\r
- )\r
-{\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- EFI_STATUS Status;\r
- EFI_STATUS ReturnStatus;\r
- UINTN Index;\r
- EFI_ABSOLUTE_POINTER_STATE CurrentState;\r
-\r
-\r
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);\r
-\r
- Private->AbsoluteInputEventSignalState = FALSE;\r
-\r
- State->CurrentX = 0;\r
- State->CurrentY = 0;\r
- State->CurrentZ = 0;\r
- State->ActiveButtons = 0;\r
-\r
- //\r
- // if no physical pointer device exists, return EFI_NOT_READY;\r
- // if any physical pointer device has changed state,\r
- // return the state and EFI_SUCCESS.\r
- //\r
- ReturnStatus = EFI_NOT_READY;\r
- for (Index = 0; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {\r
-\r
- Status = Private->AbsolutePointerList[Index]->GetState (\r
- Private->AbsolutePointerList[Index],\r
- &CurrentState\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- if (ReturnStatus == EFI_NOT_READY) {\r
- ReturnStatus = EFI_SUCCESS;\r
- }\r
-\r
- State->ActiveButtons = CurrentState.ActiveButtons;\r
-\r
- if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 && Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {\r
- State->CurrentX = CurrentState.CurrentX;\r
- }\r
- if (!(Private->AbsolutePointerMode.AbsoluteMinY == 0 && Private->AbsolutePointerMode.AbsoluteMaxY == 0)) {\r
- State->CurrentY = CurrentState.CurrentY;\r
- }\r
- if (!(Private->AbsolutePointerMode.AbsoluteMinZ == 0 && Private->AbsolutePointerMode.AbsoluteMaxZ == 0)) {\r
- State->CurrentZ = CurrentState.CurrentZ;\r
- }\r
-\r
- } else if (Status == EFI_DEVICE_ERROR) {\r
- ReturnStatus = EFI_DEVICE_ERROR;\r
- }\r
- }\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- This event agregates all the events of the pointer devices in the splitter.\r
- If any events of physical pointer devices are signaled, signal the pointer\r
- splitter event. This will cause the calling code to call\r
- ConSplitterAbsolutePointerGetState ().\r
-\r
- @param Event The Event assoicated with callback.\r
- @param Context Context registered when Event was created.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ConSplitterAbsolutePointerWaitForInput (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
-\r
- Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context;\r
-\r
- //\r
- // if AbsoluteInputEventSignalState is flagged before,\r
- // and not cleared by Reset() or GetState(), signal it\r
- //\r
- if (Private->AbsoluteInputEventSignalState) {\r
- gBS->SignalEvent (Event);\r
- return ;\r
- }\r
- //\r
- // if any physical console input device has key input, signal the event.\r
- //\r
- for (Index = 0; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {\r
- Status = gBS->CheckEvent (Private->AbsolutePointerList[Index]->WaitForInput);\r
- if (!EFI_ERROR (Status)) {\r
- gBS->SignalEvent (Event);\r
- Private->AbsoluteInputEventSignalState = TRUE;\r
- }\r
- }\r
-}\r
-\r
-\r
-/**\r
- Reset the text output device hardware and optionaly run diagnostics\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform more exhaustive verfication\r
- operation of the device during reset.\r
-\r
- @retval EFI_SUCCESS The text output device was reset.\r
- @retval EFI_DEVICE_ERROR The text output device is not functioning\r
- correctly and could not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutReset (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- EFI_STATUS ReturnStatus;\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextOutList[Index].TextOut->Reset (\r
- Private->TextOutList[Index].TextOut,\r
- ExtendedVerification\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BLACK));\r
-\r
- //\r
- // reset all mode parameters\r
- //\r
- TextOutSetMode (Private, 0);\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Write a Unicode string to the output device.\r
-\r
- @param This Protocol instance pointer.\r
- @param WString The NULL-terminated Unicode string to be\r
- displayed on the output device(s). All output\r
- devices must also support the Unicode drawing\r
- defined in this file.\r
-\r
- @retval EFI_SUCCESS The string was output to the device.\r
- @retval EFI_DEVICE_ERROR The device reported an error while attempting to\r
- output the text.\r
- @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r
- defined text mode.\r
- @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r
- characters in the Unicode string could not be\r
- rendered and were skipped.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutOutputString (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN CHAR16 *WString\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- EFI_STATUS ReturnStatus;\r
- UINTN MaxColumn;\r
- UINTN MaxRow;\r
-\r
- This->SetAttribute (This, This->Mode->Attribute);\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextOutList[Index].TextOut->OutputString (\r
- Private->TextOutList[Index].TextOut,\r
- WString\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- if (Private->CurrentNumberOfConsoles > 0) {\r
- Private->TextOutMode.CursorColumn = Private->TextOutList[0].TextOut->Mode->CursorColumn;\r
- Private->TextOutMode.CursorRow = Private->TextOutList[0].TextOut->Mode->CursorRow;\r
- } else {\r
- //\r
- // When there is no real console devices in system, \r
- // update cursor position for the virtual device in consplitter.\r
- //\r
- Private->TextOut.QueryMode (\r
- &Private->TextOut,\r
- Private->TextOutMode.Mode,\r
- &MaxColumn,\r
- &MaxRow\r
- ); \r
- for (; *WString != CHAR_NULL; WString++) {\r
- switch (*WString) {\r
- case CHAR_BACKSPACE:\r
- if (Private->TextOutMode.CursorColumn == 0 && Private->TextOutMode.CursorRow > 0) {\r
- Private->TextOutMode.CursorRow--;\r
- Private->TextOutMode.CursorColumn = (INT32) (MaxColumn - 1); \r
- } else if (Private->TextOutMode.CursorColumn > 0) {\r
- Private->TextOutMode.CursorColumn--;\r
- }\r
- break;\r
- \r
- case CHAR_LINEFEED:\r
- if (Private->TextOutMode.CursorRow < (INT32) (MaxRow - 1)) {\r
- Private->TextOutMode.CursorRow++;\r
- }\r
- break;\r
- \r
- case CHAR_CARRIAGE_RETURN:\r
- Private->TextOutMode.CursorColumn = 0;\r
- break;\r
- \r
- default:\r
- if (Private->TextOutMode.CursorColumn < (INT32) (MaxColumn - 1)) {\r
- Private->TextOutMode.CursorColumn++;\r
- } else {\r
- Private->TextOutMode.CursorColumn = 0;\r
- if (Private->TextOutMode.CursorRow < (INT32) (MaxRow - 1)) {\r
- Private->TextOutMode.CursorRow++;\r
- }\r
- }\r
- break;\r
- }\r
- }\r
- }\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Verifies that all characters in a Unicode string can be output to the\r
- target device.\r
-\r
- @param This Protocol instance pointer.\r
- @param WString The NULL-terminated Unicode string to be\r
- examined for the output device(s).\r
-\r
- @retval EFI_SUCCESS The device(s) are capable of rendering the\r
- output string.\r
- @retval EFI_UNSUPPORTED Some of the characters in the Unicode string\r
- cannot be rendered by one or more of the output\r
- devices mapped by the EFI handle.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutTestString (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN CHAR16 *WString\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- EFI_STATUS ReturnStatus;\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextOutList[Index].TextOut->TestString (\r
- Private->TextOutList[Index].TextOut,\r
- WString\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
- //\r
- // There is no DevNullTextOutTestString () since a Unicode buffer would\r
- // always return EFI_SUCCESS.\r
- // ReturnStatus will be EFI_SUCCESS if no consoles are present\r
- //\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Returns information for an available text mode that the output device(s)\r
- supports.\r
-\r
- @param This Protocol instance pointer.\r
- @param ModeNumber The mode number to return information on.\r
- @param Columns Returns the columns of the text output device\r
- for the requested ModeNumber.\r
- @param Rows Returns the rows of the text output device\r
- for the requested ModeNumber.\r
-\r
- @retval EFI_SUCCESS The requested mode information was returned.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The mode number was not valid.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutQueryMode (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN ModeNumber,\r
- OUT UINTN *Columns,\r
- OUT UINTN *Rows\r
- )\r
-{\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN CurrentMode;\r
- INT32 *TextOutModeMap;\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // Check whether param ModeNumber is valid.\r
- // ModeNumber should be within range 0 ~ MaxMode - 1.\r
- //\r
- if ( (ModeNumber > (UINTN)(((UINT32)-1)>>1)) ) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- if ((INT32) ModeNumber >= This->Mode->MaxMode) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // We get the available mode from mode intersection map if it's available\r
- //\r
- if (Private->TextOutModeMap != NULL) {\r
- TextOutModeMap = Private->TextOutModeMap + Private->TextOutListCount * ModeNumber;\r
- CurrentMode = (UINTN)(*TextOutModeMap);\r
- *Columns = Private->TextOutQueryData[CurrentMode].Columns;\r
- *Rows = Private->TextOutQueryData[CurrentMode].Rows;\r
- } else {\r
- *Columns = Private->TextOutQueryData[ModeNumber].Columns;\r
- *Rows = Private->TextOutQueryData[ModeNumber].Rows;\r
- }\r
-\r
- if (*Columns <= 0 && *Rows <= 0) {\r
- return EFI_UNSUPPORTED;\r
-\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Sets the output device(s) to a specified mode.\r
-\r
- @param This Protocol instance pointer.\r
- @param ModeNumber The mode number to set.\r
-\r
- @retval EFI_SUCCESS The requested text mode was set.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The mode number was not valid.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutSetMode (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN ModeNumber\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- INT32 *TextOutModeMap;\r
- EFI_STATUS ReturnStatus;\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // Check whether param ModeNumber is valid.\r
- // ModeNumber should be within range 0 ~ MaxMode - 1.\r
- //\r
- if ( (ModeNumber > (UINTN)(((UINT32)-1)>>1)) ) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- if ((INT32) ModeNumber >= This->Mode->MaxMode) {\r
- return EFI_UNSUPPORTED;\r
- }\r
- //\r
- // If the mode is being set to the curent mode, then just clear the screen and return.\r
- //\r
- if (Private->TextOutMode.Mode == (INT32) ModeNumber) {\r
- return ConSplitterTextOutClearScreen (This);\r
- }\r
- //\r
- // return the worst status met\r
- //\r
- TextOutModeMap = Private->TextOutModeMap + Private->TextOutListCount * ModeNumber;\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextOutList[Index].TextOut->SetMode (\r
- Private->TextOutList[Index].TextOut,\r
- TextOutModeMap[Index]\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- //\r
- // Set mode parameter to specified mode number\r
- //\r
- TextOutSetMode (Private, ModeNumber);\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Sets the background and foreground colors for the OutputString () and\r
- ClearScreen () functions.\r
-\r
- @param This Protocol instance pointer.\r
- @param Attribute The attribute to set. Bits 0..3 are the\r
- foreground color, and bits 4..6 are the\r
- background color. All other bits are undefined\r
- and must be zero. The valid Attributes are\r
- defined in this file.\r
-\r
- @retval EFI_SUCCESS The attribute was set.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The attribute requested is not defined.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutSetAttribute (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN Attribute\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- EFI_STATUS ReturnStatus;\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // Check whether param Attribute is valid.\r
- //\r
- if ((Attribute | 0x7F) != 0x7F) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextOutList[Index].TextOut->SetAttribute (\r
- Private->TextOutList[Index].TextOut,\r
- Attribute\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- Private->TextOutMode.Attribute = (INT32) Attribute;\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Clears the output device(s) display to the currently selected background\r
- color.\r
-\r
- @param This Protocol instance pointer.\r
-\r
- @retval EFI_SUCCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutClearScreen (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- EFI_STATUS ReturnStatus;\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut);\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- //\r
- // No need to do extra check here as whether (Column, Row) is valid has\r
- // been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should\r
- // always be supported.\r
- //\r
- Private->TextOutMode.CursorColumn = 0;\r
- Private->TextOutMode.CursorRow = 0;\r
- Private->TextOutMode.CursorVisible = TRUE;\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Sets the current coordinates of the cursor position\r
-\r
- @param This Protocol instance pointer.\r
- @param Column The column position to set the cursor to. Must be\r
- greater than or equal to zero and less than the\r
- number of columns by QueryMode ().\r
- @param Row The row position to set the cursor to. Must be\r
- greater than or equal to zero and less than the\r
- number of rows by QueryMode ().\r
-\r
- @retval EFI_SUCCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The output device is not in a valid text mode,\r
- or the cursor position is invalid for the\r
- current mode.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutSetCursorPosition (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN Column,\r
- IN UINTN Row\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- EFI_STATUS ReturnStatus;\r
- UINTN MaxColumn;\r
- UINTN MaxRow;\r
- INT32 *TextOutModeMap;\r
- INT32 ModeNumber;\r
- INT32 CurrentMode;\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
- TextOutModeMap = NULL;\r
- ModeNumber = Private->TextOutMode.Mode;\r
-\r
- //\r
- // Get current MaxColumn and MaxRow from intersection map\r
- //\r
- if (Private->TextOutModeMap != NULL) {\r
- TextOutModeMap = Private->TextOutModeMap + Private->TextOutListCount * ModeNumber;\r
- CurrentMode = *TextOutModeMap;\r
- } else {\r
- CurrentMode = ModeNumber;\r
- }\r
-\r
- MaxColumn = Private->TextOutQueryData[CurrentMode].Columns;\r
- MaxRow = Private->TextOutQueryData[CurrentMode].Rows;\r
-\r
- if (Column >= MaxColumn || Row >= MaxRow) {\r
- return EFI_UNSUPPORTED;\r
- }\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextOutList[Index].TextOut->SetCursorPosition (\r
- Private->TextOutList[Index].TextOut,\r
- Column,\r
- Row\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- //\r
- // No need to do extra check here as whether (Column, Row) is valid has\r
- // been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should\r
- // always be supported.\r
- //\r
- Private->TextOutMode.CursorColumn = (INT32) Column;\r
- Private->TextOutMode.CursorRow = (INT32) Row;\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- Makes the cursor visible or invisible\r
-\r
- @param This Protocol instance pointer.\r
- @param Visible If TRUE, the cursor is set to be visible. If\r
- FALSE, the cursor is set to be invisible.\r
-\r
- @retval EFI_SUCCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request, or the device does not support\r
- changing the cursor mode.\r
- @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutEnableCursor (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN BOOLEAN Visible\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r
- UINTN Index;\r
- EFI_STATUS ReturnStatus;\r
-\r
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- //\r
- // return the worst status met\r
- //\r
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {\r
- Status = Private->TextOutList[Index].TextOut->EnableCursor (\r
- Private->TextOutList[Index].TextOut,\r
- Visible\r
- );\r
- if (EFI_ERROR (Status)) {\r
- ReturnStatus = Status;\r
- }\r
- }\r
-\r
- Private->TextOutMode.CursorVisible = Visible;\r
-\r
- return ReturnStatus;\r
-}\r
-\r
-\r
-/**\r
- An empty function to pass error checking of CreateEventEx ().\r
-\r
- @param Event Event whose notification function is being invoked.\r
- @param Context Pointer to the notification function's context,\r
- which is implementation-dependent.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ConSplitterEmptyCallbackFunction (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-{\r
-}\r
+++ /dev/null
-/** @file\r
- Private data structures for the Console Splitter driver\r
-\r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _CON_SPLITTER_H_\r
-#define _CON_SPLITTER_H_\r
-\r
-#include <Uefi.h>\r
-#include <PiDxe.h>\r
-\r
-#include <Protocol/DevicePath.h>\r
-#include <Protocol/ComponentName.h>\r
-#include <Protocol/DriverBinding.h>\r
-#include <Protocol/SimplePointer.h>\r
-#include <Protocol/AbsolutePointer.h>\r
-#include <Protocol/SimpleTextOut.h>\r
-#include <Protocol/SimpleTextIn.h>\r
-#include <Protocol/SimpleTextInEx.h>\r
-#include <Protocol/GraphicsOutput.h>\r
-#include <Protocol/UgaDraw.h>\r
-\r
-#include <Guid/ConsoleInDevice.h>\r
-#include <Guid/StandardErrorDevice.h>\r
-#include <Guid/ConsoleOutDevice.h>\r
-#include <Guid/ConnectConInEvent.h>\r
-\r
-#include <Library/PcdLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-\r
-//\r
-// Driver Binding Externs\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterConInDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2;\r
-extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2;\r
-extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterAbsolutePointerDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2;\r
-extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2;\r
-extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterStdErrDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2;\r
-\r
-\r
-//\r
-// These definitions were in the old Hii protocol, but are not in the new UEFI\r
-// version. So they are defined locally.\r
-//\r
-#define UNICODE_NARROW_CHAR 0xFFF0\r
-#define UNICODE_WIDE_CHAR 0xFFF1\r
-\r
-\r
-//\r
-// Private Data Structures\r
-//\r
-#define CONSOLE_SPLITTER_ALLOC_UNIT 32\r
-\r
-\r
-typedef struct {\r
- UINTN Column;\r
- UINTN Row;\r
-} CONSOLE_OUT_MODE;\r
-\r
-typedef struct {\r
- UINTN Columns;\r
- UINTN Rows;\r
-} TEXT_OUT_SPLITTER_QUERY_DATA;\r
-\r
-\r
-#define TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'n')\r
-\r
-//\r
-// Private data for Text In Ex Splitter Notify\r
-//\r
-typedef struct _TEXT_IN_EX_SPLITTER_NOTIFY {\r
- UINTN Signature;\r
- VOID **NotifyHandleList;\r
- EFI_KEY_DATA KeyData;\r
- EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;\r
- LIST_ENTRY NotifyEntry;\r
-} TEXT_IN_EX_SPLITTER_NOTIFY;\r
-\r
-#define TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS(a) \\r
- CR ((a), \\r
- TEXT_IN_EX_SPLITTER_NOTIFY, \\r
- NotifyEntry, \\r
- TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE \\r
- )\r
-\r
-#define TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'p')\r
-\r
-//\r
-// Private data for the Console In splitter\r
-//\r
-typedef struct {\r
- UINT64 Signature;\r
- EFI_HANDLE VirtualHandle;\r
-\r
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL TextIn;\r
- UINTN CurrentNumberOfConsoles;\r
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL **TextInList;\r
- UINTN TextInListCount;\r
-\r
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL TextInEx;\r
- UINTN CurrentNumberOfExConsoles;\r
- EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL **TextInExList;\r
- UINTN TextInExListCount;\r
- LIST_ENTRY NotifyList;\r
-\r
-\r
- EFI_SIMPLE_POINTER_PROTOCOL SimplePointer;\r
- EFI_SIMPLE_POINTER_MODE SimplePointerMode;\r
- UINTN CurrentNumberOfPointers;\r
- EFI_SIMPLE_POINTER_PROTOCOL **PointerList;\r
- UINTN PointerListCount;\r
-\r
- EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointer;\r
- EFI_ABSOLUTE_POINTER_MODE AbsolutePointerMode;\r
- UINTN CurrentNumberOfAbsolutePointers;\r
- EFI_ABSOLUTE_POINTER_PROTOCOL **AbsolutePointerList;\r
- UINTN AbsolutePointerListCount;\r
- BOOLEAN AbsoluteInputEventSignalState;\r
-\r
- BOOLEAN KeyEventSignalState;\r
- BOOLEAN InputEventSignalState;\r
- EFI_EVENT ConnectConInEvent;\r
-} TEXT_IN_SPLITTER_PRIVATE_DATA;\r
-\r
-#define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
- CR ((a), \\r
- TEXT_IN_SPLITTER_PRIVATE_DATA, \\r
- TextIn, \\r
- TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
- )\r
-\r
-#define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_SIMPLE_POINTER_THIS(a) \\r
- CR ((a), \\r
- TEXT_IN_SPLITTER_PRIVATE_DATA, \\r
- SimplePointer, \\r
- TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
- )\r
-#define TEXT_IN_EX_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
- CR (a, \\r
- TEXT_IN_SPLITTER_PRIVATE_DATA, \\r
- TextInEx, \\r
- TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
- )\r
-\r
-#define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS(a) \\r
- CR (a, \\r
- TEXT_IN_SPLITTER_PRIVATE_DATA, \\r
- AbsolutePointer, \\r
- TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
- )\r
-\r
-\r
-#define TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'o', 'S', 'p')\r
-\r
-typedef struct {\r
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;\r
-} TEXT_OUT_AND_GOP_DATA;\r
-\r
-//\r
-// Private data for the Console Out splitter\r
-//\r
-typedef struct {\r
- UINT64 Signature;\r
- EFI_HANDLE VirtualHandle;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL TextOut;\r
- EFI_SIMPLE_TEXT_OUTPUT_MODE TextOutMode;\r
-\r
- EFI_UGA_DRAW_PROTOCOL UgaDraw;\r
- UINT32 UgaHorizontalResolution;\r
- UINT32 UgaVerticalResolution;\r
- UINT32 UgaColorDepth;\r
- UINT32 UgaRefreshRate;\r
-\r
- EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GraphicsOutputModeBuffer;\r
- UINTN CurrentNumberOfGraphicsOutput;\r
- UINTN CurrentNumberOfUgaDraw;\r
-\r
- UINTN CurrentNumberOfConsoles;\r
- TEXT_OUT_AND_GOP_DATA *TextOutList;\r
- UINTN TextOutListCount;\r
- TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;\r
- UINTN TextOutQueryDataCount;\r
- INT32 *TextOutModeMap;\r
-\r
-} TEXT_OUT_SPLITTER_PRIVATE_DATA;\r
-\r
-#define TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
- CR ((a), \\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA, \\r
- TextOut, \\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
- )\r
-\r
-#define GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
- CR ((a), \\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA, \\r
- GraphicsOutput, \\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
- )\r
-\r
-#define UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
- CR ((a), \\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA, \\r
- UgaDraw, \\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
- )\r
-\r
-#define CONSOLE_CONTROL_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \\r
- CR ((a), \\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA, \\r
- ConsoleControl, \\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \\r
- )\r
-\r
-//\r
-// Function Prototypes\r
-//\r
-\r
-/**\r
- The user Entry Point for module ConSplitter. The user code starts with this function.\r
-\r
- Installs driver module protocols and. Creates virtual device handles for ConIn,\r
- ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol,\r
- Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers.\r
- Installs Graphics Output protocol and/or UGA Draw protocol if needed.\r
-\r
- @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
- @param[in] SystemTable A pointer to the EFI System Table.\r
-\r
- @retval EFI_SUCCESS The entry point is executed successfully.\r
- @retval other Some error occurs when executing this entry point.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterDriverEntry (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- );\r
-\r
-/**\r
- Construct console input devices' private data.\r
-\r
- @param ConInPrivate A pointer to the TEXT_IN_SPLITTER_PRIVATE_DATA\r
- structure.\r
-\r
- @retval EFI_OUT_OF_RESOURCES Out of resources.\r
- @retval EFI_SUCCESS Text Input Devcie's private data has been constructed.\r
- @retval other Failed to construct private data.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInConstructor (\r
- TEXT_IN_SPLITTER_PRIVATE_DATA *ConInPrivate\r
- );\r
-\r
-/**\r
- Construct console output devices' private data.\r
-\r
- @param ConOutPrivate A pointer to the TEXT_OUT_SPLITTER_PRIVATE_DATA\r
- structure.\r
-\r
- @retval EFI_OUT_OF_RESOURCES Out of resources.\r
- @retval EFI_SUCCESS Text Input Devcie's private data has been constructed.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextOutConstructor (\r
- TEXT_OUT_SPLITTER_PRIVATE_DATA *ConOutPrivate\r
- );\r
-\r
-\r
-/**\r
- Test to see if Console In Device could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConInDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Test to see if Simple Pointer protocol could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Test to see if Console Out Device could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConOutDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Test to see if Standard Error Device could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterStdErrDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Start Console In Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Console In Consplitter is added to ControllerHandle.\r
- @retval other Console In Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConInDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Start Simple Pointer Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Simple Pointer Consplitter is added to ControllerHandle.\r
- @retval other Simple Pointer Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Start Console Out Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Console Out Consplitter is added to ControllerHandle.\r
- @retval other Console Out Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConOutDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Start Standard Error Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Standard Error Consplitter is added to ControllerHandle.\r
- @retval other Standard Error Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterStdErrDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Stop Console In ConSplitter on ControllerHandle by closing Console In Devcice GUID.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConInDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-/**\r
- Stop Simple Pointer protocol ConSplitter on ControllerHandle by closing\r
- Simple Pointer protocol.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-/**\r
- Stop Console Out ConSplitter on device handle by closing Console Out Devcice GUID.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConOutDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-/**\r
- Stop Standard Error ConSplitter on ControllerHandle by closing Standard Error GUID.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterStdErrDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-\r
-/**\r
- Test to see if Absolute Pointer protocol could be supported on the Controller.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to test.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS This driver supports this device.\r
- @retval other This driver does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Start Absolute Pointer Consplitter on device handle.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to.\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCESS Absolute Pointer Consplitter is added to ControllerHandle.\r
- @retval other Absolute Pointer Consplitter does not support this device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
- );\r
-\r
-/**\r
- Stop Absolute Pointer protocol ConSplitter on ControllerHandle by closing\r
- Absolute Pointer protocol.\r
-\r
- @param This Driver Binding protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCESS This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-/**\r
- Add Absolute Pointer Device in Consplitter Absolute Pointer list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param AbsolutePointer Absolute Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Absolute Pointer Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterAbsolutePointerAddDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer\r
- );\r
-\r
-/**\r
- Remove Absolute Pointer Device from Consplitter Absolute Pointer list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param AbsolutePointer Absolute Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Absolute Pointer Device removed successfully.\r
- @retval EFI_NOT_FOUND No Absolute Pointer Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterAbsolutePointerDeleteDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer\r
- );\r
-\r
-//\r
-// Absolute Pointer protocol interfaces\r
-//\r
-\r
-\r
-/**\r
- Resets the pointer device hardware.\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning correctly and\r
- could not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerReset (\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-\r
-/**\r
- Retrieves the current state of a pointer device.\r
-\r
- @param This Protocol instance pointer.\r
- @param State A pointer to the state information on the\r
- pointer device.\r
-\r
- @retval EFI_SUCCESS The state of the pointer device was returned in\r
- State..\r
- @retval EFI_NOT_READY The state of the pointer device has not changed\r
- since the last call to GetState().\r
- @retval EFI_DEVICE_ERROR A device error occurred while attempting to\r
- retrieve the pointer device's current state.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerGetState (\r
- IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
- IN OUT EFI_ABSOLUTE_POINTER_STATE *State\r
- );\r
-\r
-/**\r
- This event agregates all the events of the pointer devices in the splitter.\r
-\r
- If any events of physical pointer devices are signaled, signal the pointer\r
- splitter event. This will cause the calling code to call\r
- ConSplitterAbsolutePointerGetState ().\r
-\r
- @param Event The Event assoicated with callback.\r
- @param Context Context registered when Event was created.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ConSplitterAbsolutePointerWaitForInput (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the driver.\r
-\r
- This function retrieves the user readable name of a driver in the form of a\r
- Unicode string. If the driver specified by This has a user readable name in\r
- the language specified by Language, then a pointer to the driver name is\r
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
- by This does not support the language specified by Language,\r
- then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified\r
- in RFC 4646 or ISO 639-2 language code format.\r
-\r
- @param DriverName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- driver specified by This in the language\r
- specified by Language.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
- This and the language specified by Language was\r
- returned in DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterComponentNameGetDriverName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **DriverName\r
- );\r
-\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param ControllerHandle[in] The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
-\r
- @param ChildHandle[in] The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 4646 or ISO 639-2 language code format.\r
-\r
- @param ControllerName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConInComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param ControllerHandle[in] The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
-\r
- @param ChildHandle[in] The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 4646 or ISO 639-2 language code format.\r
-\r
- @param ControllerName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by an EFI Driver.\r
-\r
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL\r
- instance.\r
- @param ControllerHandle The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
- @param ChildHandle The handle of the child controller to retrieve the\r
- name of. This is an optional parameter that may\r
- be NULL. It will be NULL for device drivers. It\r
- will also be NULL for a bus drivers that wish to\r
- retrieve the name of the bus controller. It will\r
- not be NULL for a bus driver that wishes to\r
- retrieve the name of a child controller.\r
- @param Language A pointer to RFC4646 language identifier. This is\r
- the language of the controller name that that the\r
- caller is requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up to\r
- the driver writer.\r
- @param ControllerName A pointer to the Unicode string to return. This\r
- Unicode string is the name of the controller\r
- specified by ControllerHandle and ChildHandle in\r
- the language specified by Language from the point\r
- of view of the driver specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the driver\r
- specified by This was returned in DriverName.\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support the\r
- language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterAbsolutePointerComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param ControllerHandle[in] The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
-\r
- @param ChildHandle[in] The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 4646 or ISO 639-2 language code format.\r
-\r
- @param ControllerName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterConOutComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
- @param ControllerHandle[in] The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
-\r
- @param ChildHandle[in] The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
-\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 4646 or ISO 639-2 language code format.\r
-\r
- @param ControllerName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
-\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
-\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterStdErrComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-\r
-//\r
-// TextIn Constructor/Destructor functions\r
-//\r
-\r
-/**\r
- Add Text Input Device in Consplitter Text Input list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param TextIn Simple Text Input protocol pointer.\r
-\r
- @retval EFI_SUCCESS Text Input Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInAddDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn\r
- );\r
-\r
-/**\r
- Remove Text Input Device from Consplitter Text Input list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param TextIn Simple Text protocol pointer.\r
-\r
- @retval EFI_SUCCESS Simple Text Device removed successfully.\r
- @retval EFI_NOT_FOUND No Simple Text Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInDeleteDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn\r
- );\r
-\r
-//\r
-// SimplePointer Constuctor/Destructor functions\r
-//\r
-\r
-/**\r
- Add Simple Pointer Device in Consplitter Simple Pointer list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param SimplePointer Simple Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Simple Pointer Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterSimplePointerAddDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer\r
- );\r
-\r
-/**\r
- Remove Simple Pointer Device from Consplitter Simple Pointer list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param SimplePointer Simple Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Simple Pointer Device removed successfully.\r
- @retval EFI_NOT_FOUND No Simple Pointer Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterSimplePointerDeleteDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer\r
- );\r
-\r
-//\r
-// TextOut Constuctor/Destructor functions\r
-//\r
-\r
-/**\r
- Add Text Output Device in Consplitter Text Output list.\r
-\r
- @param Private Text Out Splitter pointer.\r
- @param TextOut Simple Text Output protocol pointer.\r
- @param GraphicsOutput Graphics Output protocol pointer.\r
- @param UgaDraw UGA Draw protocol pointer.\r
-\r
- @retval EFI_SUCCESS Text Output Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextOutAddDevice (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut,\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,\r
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw\r
- );\r
-\r
-/**\r
- Remove Text Out Device in Consplitter Text Out list.\r
-\r
- @param Private Text Out Splitter pointer.\r
- @param TextOut Simple Text Output Pointer protocol pointer.\r
-\r
- @retval EFI_SUCCESS Text Out Device removed successfully.\r
- @retval EFI_NOT_FOUND No Text Out Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextOutDeleteDevice (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut\r
- );\r
-\r
-//\r
-// TextIn I/O Functions\r
-//\r
-\r
-/**\r
- Reset the input device and optionaly run diagnostics\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
- not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInReset (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param This Protocol instance pointer.\r
- @param Key Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keydtroke information was not returned due\r
- to hardware errors.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInReadKeyStroke (\r
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r
- OUT EFI_INPUT_KEY *Key\r
- );\r
-\r
-/**\r
- Add Text Input Ex Device in Consplitter Text Input Ex list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param TextInEx Simple Text Input Ex Input protocol pointer.\r
-\r
- @retval EFI_SUCCESS Text Input Ex Device added successfully.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInExAddDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx\r
- );\r
-\r
-/**\r
- Remove Text Ex Device from Consplitter Text Input Ex list.\r
-\r
- @param Private Text In Splitter pointer.\r
- @param TextInEx Simple Text Ex protocol pointer.\r
-\r
- @retval EFI_SUCCESS Simple Text Input Ex Device removed successfully.\r
- @retval EFI_NOT_FOUND No Simple Text Input Ex Device found.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterTextInExDeleteDevice (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx\r
- );\r
-\r
-//\r
-// Simple Text Input Ex protocol function prototypes\r
-//\r
-\r
-/**\r
- Reset the input device and optionaly run diagnostics\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
- not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInResetEx (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param This Protocol instance pointer.\r
- @param KeyData A pointer to a buffer that is filled in with the\r
- keystroke state data for the key that was\r
- pressed.\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keystroke information was not returned due\r
- to hardware errors.\r
- @retval EFI_INVALID_PARAMETER KeyData is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInReadKeyStrokeEx (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- OUT EFI_KEY_DATA *KeyData\r
- );\r
-\r
-\r
-/**\r
- Set certain state for the input device.\r
-\r
- @param This Protocol instance pointer.\r
- @param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
- state for the input device.\r
-\r
- @retval EFI_SUCCESS The device state was set successfully.\r
- @retval EFI_DEVICE_ERROR The device is not functioning correctly and\r
- could not have the setting adjusted.\r
- @retval EFI_UNSUPPORTED The device does not have the ability to set its\r
- state.\r
- @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInSetState (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r
- );\r
-\r
-\r
-/**\r
- Register a notification function for a particular keystroke for the input device.\r
-\r
- @param This Protocol instance pointer.\r
- @param KeyData A pointer to a buffer that is filled in with the\r
- keystroke information data for the key that was\r
- pressed.\r
- @param KeyNotificationFunction Points to the function to be called when the key\r
- sequence is typed specified by KeyData.\r
- @param NotifyHandle Points to the unique handle assigned to the\r
- registered notification.\r
-\r
- @retval EFI_SUCCESS The notification function was registered\r
- successfully.\r
- @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data\r
- structures.\r
- @retval EFI_INVALID_PARAMETER KeyData or KeyNotificationFunction or NotifyHandle is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInRegisterKeyNotify (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN EFI_KEY_DATA *KeyData,\r
- IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r
- OUT VOID **NotifyHandle\r
- );\r
-\r
-\r
-/**\r
- Remove a registered notification function from a particular keystroke.\r
-\r
- @param This Protocol instance pointer.\r
- @param NotificationHandle The handle of the notification function being\r
- unregistered.\r
-\r
- @retval EFI_SUCCESS The notification function was unregistered\r
- successfully.\r
- @retval EFI_INVALID_PARAMETER The NotificationHandle is invalid.\r
- @retval EFI_NOT_FOUND Can not find the matching entry in database.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInUnregisterKeyNotify (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
- IN VOID *NotificationHandle\r
- );\r
-\r
-/**\r
- This event aggregates all the events of the ConIn devices in the spliter.\r
-\r
- If any events of physical ConIn devices are signaled, signal the ConIn\r
- spliter event. This will cause the calling code to call\r
- ConSplitterTextInReadKeyStroke ().\r
-\r
- @param Event The Event assoicated with callback.\r
- @param Context Context registered when Event was created.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ConSplitterTextInWaitForKey (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param Private Protocol instance pointer.\r
- @param Key Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keydtroke information was not returned due\r
- to hardware errors.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextInPrivateReadKeyStroke (\r
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,\r
- OUT EFI_INPUT_KEY *Key\r
- );\r
-\r
-/**\r
- Reset the input device and optionaly run diagnostics\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform diagnostics on reset.\r
-\r
- @retval EFI_SUCCESS The device was reset.\r
- @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
- not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerReset (\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-/**\r
- Reads the next keystroke from the input device. The WaitForKey Event can\r
- be used to test for existance of a keystroke via WaitForEvent () call.\r
-\r
- @param This A pointer to protocol instance.\r
- @param State A pointer to state information on the pointer device\r
-\r
- @retval EFI_SUCCESS The keystroke information was returned in State.\r
- @retval EFI_NOT_READY There was no keystroke data availiable.\r
- @retval EFI_DEVICE_ERROR The keydtroke information was not returned due\r
- to hardware errors.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterSimplePointerGetState (\r
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,\r
- IN OUT EFI_SIMPLE_POINTER_STATE *State\r
- );\r
-\r
-/**\r
- This event agregates all the events of the ConIn devices in the spliter.\r
- If any events of physical ConIn devices are signaled, signal the ConIn\r
- spliter event. This will cause the calling code to call\r
- ConSplitterTextInReadKeyStroke ().\r
-\r
- @param Event The Event assoicated with callback.\r
- @param Context Context registered when Event was created.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ConSplitterSimplePointerWaitForInput (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-//\r
-// TextOut I/O Functions\r
-//\r
-\r
-/**\r
- Reset the text output device hardware and optionaly run diagnostics\r
-\r
- @param This Protocol instance pointer.\r
- @param ExtendedVerification Driver may perform more exhaustive verfication\r
- operation of the device during reset.\r
-\r
- @retval EFI_SUCCESS The text output device was reset.\r
- @retval EFI_DEVICE_ERROR The text output device is not functioning\r
- correctly and could not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutReset (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN BOOLEAN ExtendedVerification\r
- );\r
-\r
-/**\r
- Write a Unicode string to the output device.\r
-\r
- @param This Protocol instance pointer.\r
- @param WString The NULL-terminated Unicode string to be\r
- displayed on the output device(s). All output\r
- devices must also support the Unicode drawing\r
- defined in this file.\r
-\r
- @retval EFI_SUCCESS The string was output to the device.\r
- @retval EFI_DEVICE_ERROR The device reported an error while attempting to\r
- output the text.\r
- @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r
- defined text mode.\r
- @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r
- characters in the Unicode string could not be\r
- rendered and were skipped.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutOutputString (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN CHAR16 *WString\r
- );\r
-\r
-/**\r
- Verifies that all characters in a Unicode string can be output to the\r
- target device.\r
-\r
- @param This Protocol instance pointer.\r
- @param WString The NULL-terminated Unicode string to be\r
- examined for the output device(s).\r
-\r
- @retval EFI_SUCCESS The device(s) are capable of rendering the\r
- output string.\r
- @retval EFI_UNSUPPORTED Some of the characters in the Unicode string\r
- cannot be rendered by one or more of the output\r
- devices mapped by the EFI handle.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutTestString (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN CHAR16 *WString\r
- );\r
-\r
-/**\r
- Returns information for an available text mode that the output device(s)\r
- supports.\r
-\r
- @param This Protocol instance pointer.\r
- @param ModeNumber The mode number to return information on.\r
- @param Columns Returns the columns of the text output device\r
- for the requested ModeNumber.\r
- @param Rows Returns the rows of the text output device\r
- for the requested ModeNumber.\r
-\r
- @retval EFI_SUCCESS The requested mode information was returned.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The mode number was not valid.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutQueryMode (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN ModeNumber,\r
- OUT UINTN *Columns,\r
- OUT UINTN *Rows\r
- );\r
-\r
-/**\r
- Sets the output device(s) to a specified mode.\r
-\r
- @param This Protocol instance pointer.\r
- @param ModeNumber The mode number to set.\r
-\r
- @retval EFI_SUCCESS The requested text mode was set.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The mode number was not valid.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutSetMode (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN ModeNumber\r
- );\r
-\r
-/**\r
- Sets the background and foreground colors for the OutputString () and\r
- ClearScreen () functions.\r
-\r
- @param This Protocol instance pointer.\r
- @param Attribute The attribute to set. Bits 0..3 are the\r
- foreground color, and bits 4..6 are the\r
- background color. All other bits are undefined\r
- and must be zero. The valid Attributes are\r
- defined in this file.\r
-\r
- @retval EFI_SUCCESS The attribute was set.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The attribute requested is not defined.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutSetAttribute (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN Attribute\r
- );\r
-\r
-/**\r
- Clears the output device(s) display to the currently selected background\r
- color.\r
-\r
- @param This Protocol instance pointer.\r
-\r
- @retval EFI_SUCCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutClearScreen (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
- );\r
-\r
-/**\r
- Sets the current coordinates of the cursor position\r
-\r
- @param This Protocol instance pointer.\r
- @param Column The column position to set the cursor to. Must be\r
- greater than or equal to zero and less than the\r
- number of columns by QueryMode ().\r
- @param Row The row position to set the cursor to. Must be\r
- greater than or equal to zero and less than the\r
- number of rows by QueryMode ().\r
-\r
- @retval EFI_SUCCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request.\r
- @retval EFI_UNSUPPORTED The output device is not in a valid text mode,\r
- or the cursor position is invalid for the\r
- current mode.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutSetCursorPosition (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN UINTN Column,\r
- IN UINTN Row\r
- );\r
-\r
-\r
-/**\r
- Makes the cursor visible or invisible\r
-\r
- @param This Protocol instance pointer.\r
- @param Visible If TRUE, the cursor is set to be visible. If\r
- FALSE, the cursor is set to be invisible.\r
-\r
- @retval EFI_SUCCESS The operation completed successfully.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete\r
- the request, or the device does not support\r
- changing the cursor mode.\r
- @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterTextOutEnableCursor (\r
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
- IN BOOLEAN Visible\r
- );\r
-\r
-/**\r
- Take the passed in Buffer of size ElementSize and grow the buffer\r
- by CONSOLE_SPLITTER_ALLOC_UNIT * ElementSize bytes.\r
- Copy the current data in Buffer to the new version of Buffer and\r
- free the old version of buffer.\r
-\r
- @param ElementSize Size of element in array.\r
- @param Count Current number of elements in array.\r
- @param Buffer Bigger version of passed in Buffer with all the\r
- data.\r
-\r
- @retval EFI_SUCCESS Buffer size has grown.\r
- @retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.\r
-\r
-**/\r
-EFI_STATUS\r
-ConSplitterGrowBuffer (\r
- IN UINTN ElementSize,\r
- IN OUT UINTN *Count,\r
- IN OUT VOID **Buffer\r
- );\r
-\r
-/**\r
- Returns information for an available graphics mode that the graphics device\r
- and the set of active video output devices supports.\r
-\r
- @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
- @param ModeNumber The mode number to return information on.\r
- @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.\r
- @param Info A pointer to callee allocated buffer that returns information about ModeNumber.\r
-\r
- @retval EFI_SUCCESS Mode information returned.\r
- @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.\r
- @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.\r
- @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
- @retval EFI_OUT_OF_RESOURCES No resource available.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterGraphicsOutputQueryMode (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN UINT32 ModeNumber,\r
- OUT UINTN *SizeOfInfo,\r
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r
- );\r
-\r
-/**\r
- Set the video device into the specified mode and clears the visible portions of\r
- the output display to black.\r
-\r
- @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
- @param ModeNumber Abstraction that defines the current video mode.\r
-\r
- @retval EFI_SUCCESS The graphics mode specified by ModeNumber was selected.\r
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
- @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.\r
- @retval EFI_OUT_OF_RESOURCES No resource available.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterGraphicsOutputSetMode (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,\r
- IN UINT32 ModeNumber\r
- );\r
-\r
-/**\r
- The following table defines actions for BltOperations.\r
-\r
- EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY)\r
- directly to every pixel of the video display rectangle\r
- (DestinationX, DestinationY)\r
- (DestinationX + Width, DestinationY + Height).\r
- Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
- EfiBltVideoToBltBuffer - Read data from the video display rectangle\r
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
- the BltBuffer rectangle (DestinationX, DestinationY )\r
- (DestinationX + Width, DestinationY + Height). If DestinationX or\r
- DestinationY is not zero then Delta must be set to the length in bytes\r
- of a row in the BltBuffer.\r
- EfiBltBufferToVideo - Write data from the BltBuffer rectangle\r
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
- video display rectangle (DestinationX, DestinationY)\r
- (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
- not zero then Delta must be set to the length in bytes of a row in the\r
- BltBuffer.\r
- EfiBltVideoToVideo - Copy from the video display rectangle\r
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
- to the video display rectangle (DestinationX, DestinationY)\r
- (DestinationX + Width, DestinationY + Height).\r
- The BltBuffer and Delta are not used in this mode.\r
-\r
- @param This Protocol instance pointer.\r
- @param BltBuffer Buffer containing data to blit into video buffer.\r
- This buffer has a size of\r
- Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
- @param BltOperation Operation to perform on BlitBuffer and video\r
- memory\r
- @param SourceX X coordinate of source for the BltBuffer.\r
- @param SourceY Y coordinate of source for the BltBuffer.\r
- @param DestinationX X coordinate of destination for the BltBuffer.\r
- @param DestinationY Y coordinate of destination for the BltBuffer.\r
- @param Width Width of rectangle in BltBuffer in pixels.\r
- @param Height Hight of rectangle in BltBuffer in pixels.\r
- @param Delta OPTIONAL.\r
-\r
- @retval EFI_SUCCESS The Blt operation completed.\r
- @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r
- @retval EFI_DEVICE_ERROR A hardware error occured writting to the video\r
- buffer.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterGraphicsOutputBlt (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta OPTIONAL\r
- );\r
-\r
-\r
-/**\r
- Return the current video mode information.\r
-\r
- @param This The EFI_UGA_DRAW_PROTOCOL instance.\r
- @param HorizontalResolution The size of video screen in pixels in the X dimension.\r
- @param VerticalResolution The size of video screen in pixels in the Y dimension.\r
- @param ColorDepth Number of bits per pixel, currently defined to be 32.\r
- @param RefreshRate The refresh rate of the monitor in Hertz.\r
-\r
- @retval EFI_SUCCESS Mode information returned.\r
- @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r
- @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterUgaDrawGetMode (\r
- IN EFI_UGA_DRAW_PROTOCOL *This,\r
- OUT UINT32 *HorizontalResolution,\r
- OUT UINT32 *VerticalResolution,\r
- OUT UINT32 *ColorDepth,\r
- OUT UINT32 *RefreshRate\r
- );\r
-\r
-/**\r
- Set the current video mode information.\r
-\r
- @param This The EFI_UGA_DRAW_PROTOCOL instance.\r
- @param HorizontalResolution The size of video screen in pixels in the X dimension.\r
- @param VerticalResolution The size of video screen in pixels in the Y dimension.\r
- @param ColorDepth Number of bits per pixel, currently defined to be 32.\r
- @param RefreshRate The refresh rate of the monitor in Hertz.\r
-\r
- @retval EFI_SUCCESS Mode information returned.\r
- @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r
- @retval EFI_OUT_OF_RESOURCES Out of resources.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterUgaDrawSetMode (\r
- IN EFI_UGA_DRAW_PROTOCOL *This,\r
- IN UINT32 HorizontalResolution,\r
- IN UINT32 VerticalResolution,\r
- IN UINT32 ColorDepth,\r
- IN UINT32 RefreshRate\r
- );\r
-\r
-/**\r
- Blt a rectangle of pixels on the graphics screen.\r
-\r
- The following table defines actions for BltOperations.\r
-\r
- EfiUgaVideoFill:\r
- Write data from the BltBuffer pixel (SourceX, SourceY)\r
- directly to every pixel of the video display rectangle\r
- (DestinationX, DestinationY)\r
- (DestinationX + Width, DestinationY + Height).\r
- Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
- EfiUgaVideoToBltBuffer:\r
- Read data from the video display rectangle\r
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
- the BltBuffer rectangle (DestinationX, DestinationY )\r
- (DestinationX + Width, DestinationY + Height). If DestinationX or\r
- DestinationY is not zero then Delta must be set to the length in bytes\r
- of a row in the BltBuffer.\r
- EfiUgaBltBufferToVideo:\r
- Write data from the BltBuffer rectangle\r
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
- video display rectangle (DestinationX, DestinationY)\r
- (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
- not zero then Delta must be set to the length in bytes of a row in the\r
- BltBuffer.\r
- EfiUgaVideoToVideo:\r
- Copy from the video display rectangle\r
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
- to the video display rectangle (DestinationX, DestinationY)\r
- (DestinationX + Width, DestinationY + Height).\r
- The BltBuffer and Delta are not used in this mode.\r
-\r
- @param This Protocol instance pointer.\r
- @param BltBuffer Buffer containing data to blit into video buffer. This\r
- buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)\r
- @param BltOperation Operation to perform on BlitBuffer and video memory\r
- @param SourceX X coordinate of source for the BltBuffer.\r
- @param SourceY Y coordinate of source for the BltBuffer.\r
- @param DestinationX X coordinate of destination for the BltBuffer.\r
- @param DestinationY Y coordinate of destination for the BltBuffer.\r
- @param Width Width of rectangle in BltBuffer in pixels.\r
- @param Height Hight of rectangle in BltBuffer in pixels.\r
- @param Delta OPTIONAL\r
-\r
- @retval EFI_SUCCESS The Blt operation completed.\r
- @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r
- @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-ConSplitterUgaDrawBlt (\r
- IN EFI_UGA_DRAW_PROTOCOL *This,\r
- IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL\r
- IN EFI_UGA_BLT_OPERATION BltOperation,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta OPTIONAL\r
- );\r
-\r
-/**\r
- Sets the output device(s) to a specified mode.\r
-\r
- @param Private Text Out Splitter pointer.\r
- @param ModeNumber The mode number to set.\r
-\r
-**/\r
-VOID\r
-TextOutSetMode (\r
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r
- IN UINTN ModeNumber\r
- );\r
-\r
-/**\r
- An empty function to pass error checking of CreateEventEx ().\r
-\r
- @param Event Event whose notification function is being invoked.\r
- @param Context Pointer to the notification function's context,\r
- which is implementation-dependent.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-ConSplitterEmptyCallbackFunction (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-\r
-#endif\r