/** @file
Console Splitter Driver. Any Handle that attatched console I/O protocols
(Console In device, Console Out device, Console Error device, Simple Pointer
protocol, Absolute Pointer protocol) can be bound by this driver.
SimpleTextOut protocol with EFI_OPEN_PROTOCOL_BY_DRIVER attributes. The big
difference is this driver does not layer a protocol on the passed in
handle, or construct a child handle like a standard device or bus driver.
This driver produces three virtual handles as children, one for console input
splitter, one for console output splitter and one for error output splitter.
These 3 virtual handles would be installed on gST.
Each virtual handle, that supports the Console I/O protocol, will be produced
in the driver entry point. The virtual handle are added on driver entry and
never removed. Such design ensures sytem function well during none console
device situation.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "ConSplitter.h"
//
// Text In Splitter Private Data template
//
(EFI_HANDLE) NULL,
{
},
0,
0,
{
},
0,
0,
{
(LIST_ENTRY *) NULL,
(LIST_ENTRY *) NULL
},
{
},
{
0x10000,
0x10000,
0x10000,
TRUE,
},
0,
0,
{
},
{
0, // AbsoluteMinX
0, // AbsoluteMinY
0, // AbsoluteMinZ
0x10000, // AbsoluteMaxX
0x10000, // AbsoluteMaxY
0x10000, // AbsoluteMaxZ
0 // Attributes
},
0,
0,
};
//
// Uga Draw Protocol Private Data template
//
};
//
// Graphics Output Protocol Private Data template
//
};
//
// Text Out Splitter Private Data template
//
(EFI_HANDLE) NULL,
{
},
{
1,
0,
0,
0,
0,
},
{
NULL,
NULL,
},
0,
0,
0,
0,
{
NULL,
NULL,
NULL,
},
0,
0,
0,
0,
0,
};
//
// Standard Error Text Out Splitter Data Template
//
(EFI_HANDLE) NULL,
{
},
{
1,
0,
0,
0,
0,
},
{
NULL,
NULL,
},
0,
0,
0,
0,
{
NULL,
NULL,
NULL,
},
0,
0,
0,
0,
0,
};
//
// Driver binding instance for Console Input Device
//
0xa,
NULL,
};
//
// Driver binding instance for Console Out device
//
0xa,
NULL,
};
//
// Driver binding instance for Standard Error device
//
0xa,
NULL,
};
//
// Driver binding instance for Simple Pointer protocol
//
0xa,
NULL,
};
//
// Driver binding instance for Absolute Pointer protocol
//
0xa,
NULL,
};
/**
The Entry Point for module ConSplitter. The user code starts with this function.
Installs driver module protocols and. Creates virtual device handles for ConIn,
ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol,
Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval other Some error occurs when executing this entry point.
**/
)
{
//
// Install driver model protocol(s).
//
);
NULL,
);
NULL,
);
NULL,
);
NULL,
);
//
// Either Graphics Output protocol or UGA Draw protocol must be supported.
//
//
// The driver creates virtual handles for ConIn, ConOut, StdErr.
// The virtual handles will always exist even if no console exist in the
// system. This is need to support hotplug devices like USB.
//
//
// Create virtual device handle for ConIn Splitter
//
);
//
// Update the EFI System Table with new virtual console
// and update the pointer to Simple Text Input protocol.
//
}
}
//
// Create virtual device handle for ConOut Splitter
//
if (!FeaturePcdGet (PcdConOutGopSupport)) {
//
// If Graphics Outpurt protocol not supported, UGA Draw protocol is installed
// on the virtual handle.
//
);
} else if (!FeaturePcdGet (PcdConOutUgaSupport)) {
//
// If UGA Draw protocol not supported, Graphics Output Protocol is installed
// on virtual handle.
//
);
} else {
//
// Boot Graphics Output protocol and UGA Draw protocol are supported,
// both they will be installed on virtual handle.
//
);
}
//
// Update the EFI System Table with new virtual console
// and Update the pointer to Text Output protocol.
//
}
}
//
// Create virtual device handle for StdErr Splitter
//
);
//
// Update the EFI System Table with new virtual console
// and update the pointer to Text Output protocol.
//
}
}
//
// Update the CRC32 in the EFI System Table header
//
);
return EFI_SUCCESS;
}
/**
Construct console input devices' private data.
@param ConInPrivate A pointer to the TEXT_IN_SPLITTER_PRIVATE_DATA
structure.
@retval EFI_OUT_OF_RESOURCES Out of resources.
@retval EFI_SUCCESS Text Input Devcie's private data has been constructed.
@retval other Failed to construct private data.
**/
)
{
//
// Allocate buffer for Simple Text Input device
//
sizeof (EFI_SIMPLE_TEXT_INPUT_PROTOCOL *),
);
return EFI_OUT_OF_RESOURCES;
}
//
// Create Event to wait for a key
//
);
//
// Allocate buffer for Simple Text Input Ex device
//
sizeof (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *),
);
return EFI_OUT_OF_RESOURCES;
}
//
// Create Event to wait for a key Ex
//
);
//
// Allocate buffer for Absolute Pointer device
//
sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *),
);
return EFI_OUT_OF_RESOURCES;
}
//
// Create Event to wait for device input for Absolute pointer device
//
);
//
// Allocate buffer for Simple Pointer device
//
sizeof (EFI_SIMPLE_POINTER_PROTOCOL *),
);
return EFI_OUT_OF_RESOURCES;
}
//
// Create Event to wait for device input for Simple pointer device
//
);
return Status;
}
/**
Construct console output devices' private data.
@param ConOutPrivate A pointer to the TEXT_OUT_SPLITTER_PRIVATE_DATA
structure.
@retval EFI_OUT_OF_RESOURCES Out of resources.
@retval EFI_SUCCESS Text Input Devcie's private data has been constructed.
**/
)
{
//
// Copy protocols template
//
if (FeaturePcdGet (PcdConOutUgaSupport)) {
}
if (FeaturePcdGet (PcdConOutGopSupport)) {
CopyMem (&ConOutPrivate->GraphicsOutput, &mGraphicsOutputProtocolTemplate, sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL));
}
//
// Initilize console output splitter's private data.
//
//
// When new console device is added, the new mode will be set later,
// so put current mode back to init state.
//
//
// Allocate buffer for Console Out device
//
sizeof (TEXT_OUT_AND_GOP_DATA),
);
return EFI_OUT_OF_RESOURCES;
}
//
// Allocate buffer for Text Out query data
//
sizeof (TEXT_OUT_SPLITTER_QUERY_DATA),
);
return EFI_OUT_OF_RESOURCES;
}
//
// Setup the default console to 80 x 25 and mode to 0
//
TextOutSetMode (ConOutPrivate, 0);
if (FeaturePcdGet (PcdConOutUgaSupport)) {
//
// Setup the UgaDraw to 800 x 600 x 32 bits per pixel, 60Hz.
//
}
if (FeaturePcdGet (PcdConOutGopSupport)) {
//
// Setup resource for mode information in Graphics Output Protocol interface
//
if ((ConOutPrivate->GraphicsOutput.Mode = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE))) == NULL) {
return EFI_OUT_OF_RESOURCES;
}
if ((ConOutPrivate->GraphicsOutput.Mode->Info = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Setup the DevNullGraphicsOutput to 800 x 600 x 32 bits per pixel
// DevNull will be updated to user-defined mode after driver has started.
//
if ((ConOutPrivate->GraphicsOutputModeBuffer = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem (ConOutPrivate->GraphicsOutput.Mode->Info, Info, sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
//
// Initialize the following items, theset items remain unchanged in GraphicsOutput->SetMode()
// GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize
//
//
// Initial current mode to unknown state, and then set to mode 0
//
}
return EFI_SUCCESS;
}
/**
Test to see if the specified protocol could be supported on the specified device.
@param This Driver Binding protocol pointer.
@param ControllerHandle Handle of device to test.
@param Guid The specified protocol.
@retval EFI_SUCCESS The specified protocol is supported on this device.
@retval EFI_UNSUPPORTED The specified protocol attempts to be installed on virtul handle.
@retval other Failed to open specified protocol on this device.
**/
)
{
//
// Make sure the Console Splitter does not attempt to attach to itself
//
) {
return EFI_UNSUPPORTED;
}
//
// Check to see whether the specific protocol could be opened BY_DRIVER
//
Guid,
&Instance,
);
return Status;
}
gBS->CloseProtocol (
Guid,
);
return EFI_SUCCESS;
}
/**
Test to see if Console In Device could be supported on the Controller.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to test.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS This driver supports this device.
@retval other This driver does not support this device.
**/
)
{
return ConSplitterSupported (
This,
);
}
/**
Test to see if Simple Pointer protocol could be supported on the Controller.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to test.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS This driver supports this device.
@retval other This driver does not support this device.
**/
)
{
return ConSplitterSupported (
This,
);
}
/**
Test to see if Absolute Pointer protocol could be supported on the Controller.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to test.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS This driver supports this device.
@retval other This driver does not support this device.
**/
)
{
return ConSplitterSupported (
This,
);
}
/**
Test to see if Console Out Device could be supported on the Controller.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to test.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS This driver supports this device.
@retval other This driver does not support this device.
**/
)
{
return ConSplitterSupported (
This,
);
}
/**
Test to see if Standard Error Device could be supported on the Controller.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to test.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS This driver supports this device.
@retval other This driver does not support this device.
**/
)
{
return ConSplitterSupported (
This,
);
}
/**
Start ConSplitter on devcie handle by opening Console Device Guid on device handle
and the console virtual handle. And Get the console interface on controller handle.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device.
@param ConSplitterVirtualHandle Console virtual Handle.
@param DeviceGuid The specified Console Device, such as ConInDev,
ConOutDev.
@param InterfaceGuid The specified protocol to be opened.
@param Interface Protocol interface returned.
@retval EFI_SUCCESS This driver supports this device.
@retval other Failed to open the specified Console Device Guid
or specified protocol.
**/
)
{
//
// Check to see whether the ControllerHandle has the DeviceGuid on it.
//
&Instance,
);
return Status;
}
//
// Open the Parent Handle for the child.
//
&Instance,
);
goto Err;
}
//
// Open InterfaceGuid on the virtul handle.
//
);
return EFI_SUCCESS;
}
//
// close the DeviceGuid on ConSplitter VirtualHandle.
//
gBS->CloseProtocol (
);
Err:
//
// close the DeviceGuid on ControllerHandle.
//
gBS->CloseProtocol (
);
return Status;
}
/**
Start Console In Consplitter on device handle.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to bind driver to.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS Console In Consplitter is added to ControllerHandle.
@retval other Console In Consplitter does not support this device.
**/
)
{
//
// Start ConSplitter on ControllerHandle, and create the virtual
// agrogated console device on first call Start for a SimpleTextIn handle.
//
This,
);
return Status;
}
//
// Add this device into Text In devices list.
//
return Status;
}
);
//
// If Simple Text Input Ex protocol exists,
// add this device into Text In Ex devices list.
//
}
return Status;
}
/**
Start Simple Pointer Consplitter on device handle.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to bind driver to.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS Simple Pointer Consplitter is added to ControllerHandle.
@retval other Simple Pointer Consplitter does not support this device.
**/
)
{
//
// Start ConSplitter on ControllerHandle, and create the virtual
// agrogated console device on first call Start for a SimplePointer handle.
//
This,
(VOID **) &SimplePointer
);
return Status;
}
//
// Add this devcie into Simple Pointer devices list.
//
}
/**
Start Absolute Pointer Consplitter on device handle.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to bind driver to.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS Absolute Pointer Consplitter is added to ControllerHandle.
@retval other Absolute Pointer Consplitter does not support this device.
**/
)
{
//
// Start ConSplitter on ControllerHandle, and create the virtual
// agrogated console device on first call Start for a AbsolutePointer handle.
//
This,
(VOID **) &AbsolutePointer
);
return Status;
}
//
// Add this devcie into Absolute Pointer devices list.
//
}
/**
Start Console Out Consplitter on device handle.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to bind driver to.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS Console Out Consplitter is added to ControllerHandle.
@retval other Console Out Consplitter does not support this device.
**/
)
{
//
// Start ConSplitter on ControllerHandle, and create the virtual
// agrogated console device on first call Start for a ConsoleOut handle.
//
This,
);
return Status;
}
//
// Try to Open Graphics Output protocol
//
(VOID **) &GraphicsOutput,
);
//
// Open UGA DRAW protocol
//
gBS->OpenProtocol (
);
}
//
// When new console device is added, the new mode will be set later,
// so put current mode back to init state.
//
//
// If both ConOut and StdErr incorporate the same Text Out device,
// their MaxMode and QueryData should be the intersection of both.
//
if (FeaturePcdGet (PcdConOutUgaSupport)) {
//
// Get the UGA mode data of ConOut from the current mode
//
if (GraphicsOutput != NULL) {
Status = GraphicsOutput->QueryMode (GraphicsOutput, GraphicsOutput->Mode->Mode, &SizeOfInfo, &Info);
return Status;
}
);
}
}
return Status;
}
/**
Start Standard Error Consplitter on device handle.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to bind driver to.
@param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
@retval EFI_SUCCESS Standard Error Consplitter is added to ControllerHandle.
@retval other Standard Error Consplitter does not support this device.
**/
)
{
//
// Start ConSplitter on ControllerHandle, and create the virtual
// agrogated console device on first call Start for a StandardError handle.
//
This,
);
return Status;
}
//
// When new console device is added, the new mode will be set later,
// so put current mode back to init state.
//
//
// If both ConOut and StdErr incorporate the same Text Out device,
// their MaxMode and QueryData should be the intersection of both.
//
return Status;
}
return Status;
}
/**
Stop ConSplitter on device handle by closing Console Device Guid on device handle
and the console virtual handle.
@param This Protocol instance pointer.
@param ControllerHandle Handle of device.
@param ConSplitterVirtualHandle Console virtual Handle.
@param DeviceGuid The specified Console Device, such as ConInDev,
ConOutDev.
@param InterfaceGuid The specified protocol to be opened.
@param Interface Protocol interface returned.
@retval EFI_SUCCESS Stop ConSplitter on ControllerHandle successfully.
@retval other Failed to Stop ConSplitter on ControllerHandle.
**/
)
{
);
return Status;
}
//
// close the protocol refered.
//
gBS->CloseProtocol (
);
gBS->CloseProtocol (
);
return EFI_SUCCESS;
}
/**
Stop Console In ConSplitter on ControllerHandle by closing Console In Devcice GUID.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to stop driver on
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
children is zero stop the entire bus driver.
@param ChildHandleBuffer List of Child Handles to Stop.
@retval EFI_SUCCESS This driver is removed ControllerHandle
@retval other This driver was not removed from this device
**/
)
{
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
);
//
// If Simple Text Input Ex protocol exists,
// remove device from Text Input Ex devices list.
//
return Status;
}
}
//
// Close Simple Text In protocol on controller handle and virtual handle.
//
This,
);
return Status;
}
//
// Remove device from Text Input devices list.
//
}
/**
Stop Simple Pointer protocol ConSplitter on ControllerHandle by closing
Simple Pointer protocol.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to stop driver on
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
children is zero stop the entire bus driver.
@param ChildHandleBuffer List of Child Handles to Stop.
@retval EFI_SUCCESS This driver is removed ControllerHandle
@retval other This driver was not removed from this device
**/
)
{
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
//
// Close Simple Pointer protocol on controller handle and virtual handle.
//
This,
(VOID **) &SimplePointer
);
return Status;
}
//
// Remove this device from Simple Pointer device list.
//
}
/**
Stop Absolute Pointer protocol ConSplitter on ControllerHandle by closing
Absolute Pointer protocol.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to stop driver on
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
children is zero stop the entire bus driver.
@param ChildHandleBuffer List of Child Handles to Stop.
@retval EFI_SUCCESS This driver is removed ControllerHandle
@retval other This driver was not removed from this device
**/
)
{
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
//
// Close Absolute Pointer protocol on controller handle and virtual handle.
//
This,
(VOID **) &AbsolutePointer
);
return Status;
}
//
// Remove this device from Absolute Pointer device list.
//
}
/**
Stop Console Out ConSplitter on device handle by closing Console Out Devcice GUID.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to stop driver on
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
children is zero stop the entire bus driver.
@param ChildHandleBuffer List of Child Handles to Stop.
@retval EFI_SUCCESS This driver is removed ControllerHandle
@retval other This driver was not removed from this device
**/
)
{
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
//
// Close Absolute Pointer protocol on controller handle and virtual handle.
//
This,
);
return Status;
}
//
// Remove this device from Text Out device list.
//
}
/**
Stop Standard Error ConSplitter on ControllerHandle by closing Standard Error GUID.
@param This Driver Binding protocol instance pointer.
@param ControllerHandle Handle of device to stop driver on
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
children is zero stop the entire bus driver.
@param ChildHandleBuffer List of Child Handles to Stop.
@retval EFI_SUCCESS This driver is removed ControllerHandle
@retval other This driver was not removed from this device
**/
)
{
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
//
// Close Standard Error Device on controller handle and virtual handle.
//
This,
);
return Status;
}
//
// Delete this console error out device's data structures.
//
}
/**
Take the passed in Buffer of size SizeOfCount and grow the buffer
by MAX (CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT, MaxGrow) * SizeOfCount
bytes. Copy the current data in Buffer to the new version of Buffer
and free the old version of buffer.
@param SizeOfCount Size of element in array.
@param Count Current number of elements in array.
@param Buffer Bigger version of passed in Buffer with all the
data.
@retval EFI_SUCCESS Buffer size has grown.
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
//
// grow the buffer to new buffer size,
// copy the old buffer's content to the new-size buffer,
// then free the old buffer.
//
Ptr = ReallocatePool (
SizeOfCount * (*Count),
);
return EFI_OUT_OF_RESOURCES;
}
return EFI_SUCCESS;
}
/**
Add Text Input Device in Consplitter Text Input list.
@param Private Text In Splitter pointer.
@param TextIn Simple Text Input protocol pointer.
@retval EFI_SUCCESS Text Input Device added successfully.
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
//
// If the Text In List is full, enlarge it by calling ConSplitterGrowBuffer().
//
sizeof (EFI_SIMPLE_TEXT_INPUT_PROTOCOL *),
);
return EFI_OUT_OF_RESOURCES;
}
}
//
// Add the new text-in device data structure into the Text In List.
//
//
// Extra CheckEvent added to reduce the double CheckEvent().
//
return EFI_SUCCESS;
}
/**
Remove Text Input Device from Consplitter Text Input list.
@param Private Text In Splitter pointer.
@param TextIn Simple Text protocol pointer.
@retval EFI_SUCCESS Simple Text Device removed successfully.
@retval EFI_NOT_FOUND No Simple Text Device found.
**/
)
{
//
// Remove the specified text-in device data structure from the Text In List,
// and rearrange the remaining data structures in the Text In List.
//
}
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
/**
Add Text Input Ex Device in Consplitter Text Input Ex list.
@param Private Text In Splitter pointer.
@param TextInEx Simple Text Input Ex Input protocol pointer.
@retval EFI_SUCCESS Text Input Ex Device added successfully.
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
//
// If the Text Input Ex List is full, enlarge it by calling ConSplitterGrowBuffer().
//
sizeof (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *),
);
return EFI_OUT_OF_RESOURCES;
}
}
//
// Add the new text-in device data structure into the Text Input Ex List.
//
//
// Extra CheckEvent added to reduce the double CheckEvent().
//
return EFI_SUCCESS;
}
/**
Remove Text Ex Device from Consplitter Text Input Ex list.
@param Private Text In Splitter pointer.
@param TextInEx Simple Text Ex protocol pointer.
@retval EFI_SUCCESS Simple Text Input Ex Device removed successfully.
@retval EFI_NOT_FOUND No Simple Text Input Ex Device found.
**/
)
{
//
// Remove the specified text-in device data structure from the Text Input Ex List,
// and rearrange the remaining data structures in the Text In List.
//
}
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
/**
Add Simple Pointer Device in Consplitter Simple Pointer list.
@param Private Text In Splitter pointer.
@param SimplePointer Simple Pointer protocol pointer.
@retval EFI_SUCCESS Simple Pointer Device added successfully.
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
//
// If the Simple Pointer List is full, enlarge it by calling ConSplitterGrowBuffer().
//
sizeof (EFI_SIMPLE_POINTER_PROTOCOL *),
);
return EFI_OUT_OF_RESOURCES;
}
}
//
// Add the new text-in device data structure into the Simple Pointer List.
//
return EFI_SUCCESS;
}
/**
Remove Simple Pointer Device from Consplitter Simple Pointer list.
@param Private Text In Splitter pointer.
@param SimplePointer Simple Pointer protocol pointer.
@retval EFI_SUCCESS Simple Pointer Device removed successfully.
@retval EFI_NOT_FOUND No Simple Pointer Device found.
**/
)
{
//
// Remove the specified text-in device data structure from the Simple Pointer List,
// and rearrange the remaining data structures in the Text In List.
//
}
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
/**
Add Absolute Pointer Device in Consplitter Absolute Pointer list.
@param Private Text In Splitter pointer.
@param AbsolutePointer Absolute Pointer protocol pointer.
@retval EFI_SUCCESS Absolute Pointer Device added successfully.
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
//
// If the Absolute Pointer List is full, enlarge it by calling ConSplitterGrowBuffer().
//
sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *),
);
return EFI_OUT_OF_RESOURCES;
}
}
//
// Add the new text-in device data structure into the Absolute Pointer List.
//
return EFI_SUCCESS;
}
/**
Remove Absolute Pointer Device from Consplitter Absolute Pointer list.
@param Private Text In Splitter pointer.
@param AbsolutePointer Absolute Pointer protocol pointer.
@retval EFI_SUCCESS Absolute Pointer Device removed successfully.
@retval EFI_NOT_FOUND No Absolute Pointer Device found.
**/
)
{
//
// Remove the specified text-in device data structure from the Absolute Pointer List,
// and rearrange the remaining data structures from the Absolute Pointer List.
//
}
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
/**
Reallocate Text Out mode map.
Allocate new buffer and copy original buffer into the new buffer.
@param Private Consplitter Text Out pointer.
@retval EFI_SUCCESS Buffer size has grown
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
//
// Allocate new buffer for Text Out List.
//
if (TextOutModeMap == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// If TextOutList has been enlarged, need to realloc the mode map table
// The mode map table is regarded as a two dimension array.
//
// Old New
// 0 ---------> TextOutListCount ----> TextOutListCount
// | -------------------------------------------
// | | | |
// | | | |
// | | | |
// | | | |
// | | | |
// \/ | | |
// -------------------------------------------
// QueryDataCount
//
if (OldTextOutModeMap != NULL) {
Index = 0;
//
// Copy the old data to the new one
//
SrcAddress += Size;
Index++;
}
//
// Free the old buffer
//
}
return EFI_SUCCESS;
}
/**
Add new device's output mode to console splitter's mode list.
@param Private Text Out Splitter pointer
@param TextOut Simple Text Output protocol pointer.
@retval EFI_SUCCESS Device added successfully.
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
//
// Grow the buffer if query data buffer is not large enough to
// hold all the mode supported by the first console.
//
sizeof (TEXT_OUT_SPLITTER_QUERY_DATA),
);
return EFI_OUT_OF_RESOURCES;
}
}
//
// Allocate buffer for the output mode map
//
return EFI_OUT_OF_RESOURCES;
}
//
// As the first textout device, directly add the mode in to QueryData
// and at the same time record the mapping between QueryData and TextOut.
//
Mode = 0;
Index = 0;
Mode,
);
//
// If mode 1 (80x50) is not supported, make sure mode 1 in TextOutQueryData
// is clear to 0x0.
//
}
Mode++;
}
return EFI_SUCCESS;
}
/**
Reconstruct TextOutModeMap to get intersection of modes.
This routine reconstruct TextOutModeMap to get the intersection
mode 0 is 80x25, mode 1 is 80x50, this routine will not check the
intersection for mode 0 and mode 1.
@param TextOutModeMap Current text out mode map, begin with the mode 80x25
@param NewlyAddedMap New text out mode map, begin with the mode 80x25
@param MapStepSize Mode step size for one console device
@param NewMapStepSize New Mode step size for one console device
@param MaxMode IN: Current max text mode, OUT: Updated max text mode.
@param CurrentMode IN: Current text mode, OUT: Updated current text mode.
**/
)
{
//
// for 80x25 and 80x50 in Simple Text Out protocol, so don't make intersection
// for mode 0 and mode 1, mode number starts from 2.
//
Index = 2;
Mode = *CurrentMode;
while (Index < CurrentMaxMode) {
if (*NewMapEntry == -1) {
//
// This mode is not supported any more. Remove it. Special care
// must be taken as this remove will also affect current mode;
//
if (Index == *CurrentMode) {
Mode = -1;
} else if (Index < *CurrentMode) {
Mode--;
}
(*MaxMode)--;
} else {
if (CurrentMapEntry != NextMapEntry) {
}
}
Index++;
}
*CurrentMode = Mode;
return ;
}
/**
Sync the device's output mode to console splitter's mode list.
@param Private Text Out Splitter pointer.
@param TextOut Simple Text Output protocol pointer.
**/
)
{
//
// Must make sure that current mode won't change even if mode number changes
//
//
// Query all the mode that the newly added TextOut supports
//
Mode = 0;
if (Mode == 1) {
//
// If mode 1 (80x50) is not supported, make sure mode 1 in TextOutQueryData
// is clear to 0x0.
//
}
Mode++;
continue;
}
//
// Search the intersection map and QueryData database to see if they intersects
//
Index = 0;
while (Index < CurrentMaxMode) {
if ((TextOutQueryData[QueryMode].Rows == Rows) && (TextOutQueryData[QueryMode].Columns == Columns)) {
break;
}
Index++;
}
Mode++;
}
//
// Now search the TextOutModeMap table to find the intersection of supported
// mode between ConSplitter and the newly added device.
//
);
return ;
}
/**
Sync output device between ConOut and StdErr output.
@retval EFI_SUCCESS Sync implemented successfully.
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
Indexi = 0;
Indexj = 0;
while (Indexj < StdErrNumOfConsoles) {
break;
}
Indexj++;
}
Indexi++;
}
if (!FoundTheSameTextOut) {
return EFI_SUCCESS;
}
//
// Must make sure that current mode won't change even if mode number changes
//
//
// Allocate the map table and set the map table's index to -1.
//
if (ConOutMapTable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
if (StdErrMapTable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Find the intersection of the two set of modes. If they actually intersect, the
// correponding entry in the map table is set to 1.
//
Mode = 0;
while (Mode < ConOutMaxMode) {
//
// Search the intersection map and QueryData database to see if they intersect
//
Index = 0;
while (Index < StdErrMaxMode) {
break;
}
Index++;
}
Mode++;
}
//
// Now search the TextOutModeMap table to find the intersection of supported
// mode between ConSplitter and the newly added device.
//
1,
);
}
1,
);
}
return EFI_SUCCESS;
}
/**
Add Grahpics Output modes into Consplitter Text Out list.
@param Private Text Out Splitter pointer.
@param GraphicsOutput Graphics Output protocol pointer.
@param UgaDraw UGA Draw protocol pointer.
@retval EFI_SUCCESS Output mode added successfully.
@retval other Failed to add output mode.
**/
)
{
Index = 0;
CurrentIndex = 0;
if (Private->CurrentNumberOfUgaDraw != 0) {
//
// If any UGA device has already been added, then there is no need to
// since only one display mode will be exported (i.e. user-defined mode)
//
goto Done;
}
if (GraphicsOutput != NULL) {
if (Private->CurrentNumberOfGraphicsOutput == 0) {
//
// This is the first Graphics Output device added
//
CopyMem (CurrentGraphicsOutputMode->Info, GraphicsOutput->Mode->Info, GraphicsOutput->Mode->SizeOfInfo);
//
// Allocate resource for the private mode buffer
//
ModeBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) * GraphicsOutput->Mode->MaxMode);
if (ModeBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Store all supported display modes to the private mode buffer
//
Mode = ModeBuffer;
//
// The Info buffer would be allocated by callee
//
return Status;
}
Mode++;
}
} else {
//
// Check intersection of display mode
//
ModeBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION) * CurrentGraphicsOutputMode->MaxMode);
if (ModeBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// The Info buffer would be allocated by callee
//
return Status;
}
//
// If GOP device supports one mode in current mode buffer,
// it will be added into matched mode buffer
//
break;
}
}
if (Match) {
//
// Check if GOP mode has been in the mode buffer, ModeBuffer = MatchedMode at begin.
//
AlreadyExist = TRUE;
break;
}
}
if (!AlreadyExist) {
//
// Physical frame buffer is no longer available, change PixelFormat to PixelBltOnly
//
MatchedMode->Version = 0;
MatchedMode++;
}
}
Mode++;
}
//
// Drop the old mode buffer, assign it to a new one
//
//
// Physical frame buffer is no longer available when there are more than one physical GOP devices
//
CurrentGraphicsOutputMode->MaxMode = (UINT32) (((UINTN) MatchedMode - (UINTN) ModeBuffer) / sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
}
//
// Graphics console driver can ensure the same mode for all GOP devices
//
break;
}
}
//
// if user defined mode is not found, set to default mode 800x600
//
break;
}
}
}
//
// Graphics console driver can ensure the same mode for all GOP devices
// so we can get the current mode from this video device
//
);
//
// Update the private mode buffer
//
CopyMem (&Private->GraphicsOutputModeBuffer[0], Info, sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
//
// Only mode 0 is available to be set
//
CurrentIndex = 0;
}
Done:
if (GraphicsOutput != NULL) {
}
}
//
// Force GraphicsOutput mode to be set,
//
if ((GraphicsOutput != NULL) &&
//
// If all existing video device has been set to common mode, only set new GOP device to
// the common mode
//
return Status;
}
if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {
break;
}
}
}
} else {
//
// Current mode number may need update now, so set it to an invalid mode number
//
//
// Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.
//
//
// If user defined mode is not valid for display device, set to the default mode 800x600.
//
}
}
return Status;
}
/**
Set the current console out mode.
This routine will get the current console mode information (column, row)
from ConsoleOutMode variable and set it; if the variable does not exist,
set to user defined console mode.
@param Private Consplitter Text Out pointer.
**/
)
{
PreferMode = 0xFF;
BaseMode = 0xFF;
MaxModeInfo.Column = 0;
MaxModeInfo.Row = 0;
//
// To find the prefer mode and basic mode from Text Out mode list
//
//
// Use user defined column and row
//
PreferMode = Mode;
}
} else {
//
// If user sets PcdConOutColumn or PcdConOutRow to 0,
// find and set the highest text mode.
//
PreferMode = Mode;
}
}
}
}
}
//
// Set prefer mode to Text Out devices.
//
//
// if current mode setting is failed, default 80x25 mode will be set.
//
}
return ;
}
/**
Add Text Output Device in Consplitter Text Output list.
@param Private Text Out Splitter pointer.
@param TextOut Simple Text Output protocol pointer.
@param GraphicsOutput Graphics Output protocol pointer.
@param UgaDraw UGA Draw protocol pointer.
@retval EFI_SUCCESS Text Output Device added successfully.
@retval EFI_OUT_OF_RESOURCES Could not grow the buffer size.
**/
)
{
//
// If the Text Out List is full, enlarge it by calling ConSplitterGrowBuffer().
//
sizeof (TEXT_OUT_AND_GOP_DATA),
);
return EFI_OUT_OF_RESOURCES;
}
//
// Also need to reallocate the TextOutModeMap table
//
return EFI_OUT_OF_RESOURCES;
}
}
if (CurrentNumOfConsoles == 0) {
//
// Add the first device's output mode to console splitter's mode list
//
} else {
}
//
// Scan both TextOutList, for the intersection TextOut device
// maybe both ConOut and StdErr incorporate the same Text Out
// device in them, thus the output of both should be synced.
//
if (FeaturePcdGet (PcdConOutGopSupport)) {
//
// If GOP is produced by Consplitter, this device display mode will be added into Graphics Ouput modes.
//
}
}
if (FeaturePcdGet (PcdConOutUgaSupport)) {
//
// If UGA is produced by Consplitter
//
if (GraphicsOutput != NULL) {
Status = GraphicsOutput->QueryMode (GraphicsOutput, GraphicsOutput->Mode->Mode, &SizeOfInfo, &Info);
return Status;
}
);
//
// if GetMode is successfully and UGA device hasn't been set, set it
//
);
}
//
//
800,
600,
32,
60
);
}
}
}
//
// After adding new console device, all existing console devices should be
// synced to the current shared mode.
//
return Status;
}
/**
Remove Text Out Device in Consplitter Text Out list.
@param Private Text Out Splitter pointer.
@param TextOut Simple Text Output Pointer protocol pointer.
@retval EFI_SUCCESS Text Out Device removed successfully.
@retval EFI_NOT_FOUND No Text Out Device found.
**/
)
{
//
// Remove the specified text-out device data structure from the Text out List,
// and rearrange the remaining data structures in the Text out List.
//
while (Index >= 0) {
}
}
break;
}
Index--;
TextOutList++;
}
//
// The specified TextOut is not managed by the ConSplitter driver
//
if (Index < 0) {
return EFI_NOT_FOUND;
}
if (CurrentNumOfConsoles == 0) {
//
// If the number of consoles is zero, reset all parameters
//
TextOutSetMode (Private, 0);
return EFI_SUCCESS;
}
//
// Max Mode is realy an intersection of the QueryMode command to all
// devices. So we must copy the QueryMode of the first device to
// QueryData.
//
ZeroMem (
);
//
// Add the first TextOut to the QueryData array and ModeMap table
//
//
// Now add one by one
//
Index = 1;
TextOutList++;
Index++;
TextOutList++;
}
return Status;
}
/**
Reset the input device and optionaly run diagnostics
@param This Protocol instance pointer.
@param ExtendedVerification Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The device was reset.
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
not be reset.
**/
)
{
//
// return the worst status met
//
);
}
}
return ReturnStatus;
}
/**
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
@param Private Protocol instance pointer.
@param Key Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The keystroke information was returned.
@retval EFI_NOT_READY There was no keystroke data availiable.
@retval EFI_DEVICE_ERROR The keydtroke information was not returned due
to hardware errors.
**/
)
{
Key->UnicodeChar = 0;
//
// if no physical console input device exists, return EFI_NOT_READY;
// if any physical console input device has key input,
// return the key and EFI_SUCCESS.
//
);
*Key = CurrentKey;
return Status;
}
}
return EFI_NOT_READY;
}
/**
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
@param This Protocol instance pointer.
@param Key Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The keystroke information was returned.
@retval EFI_NOT_READY There was no keystroke data availiable.
@retval EFI_DEVICE_ERROR The keydtroke information was not returned due
to hardware errors.
**/
)
{
}
/**
This event aggregates all the events of the ConIn devices in the spliter.
If any events of physical ConIn devices are signaled, signal the ConIn
spliter event. This will cause the calling code to call
ConSplitterTextInReadKeyStroke ().
@param Event The Event assoicated with callback.
@param Context Context registered when Event was created.
**/
)
{
if (Private->KeyEventSignalState) {
//
// If KeyEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke()
//
return ;
}
//
// If any physical console input device has key input, signal the event.
//
}
}
}
/**
Test if the key has been registered on input device.
@param RegsiteredData A pointer to a buffer that is filled in with the
keystroke state data for the key that was
registered.
@param InputData A pointer to a buffer that is filled in with the
keystroke state data for the key that was
pressed.
@retval TRUE Key be pressed matches a registered key.
@retval FLASE Match failed.
**/
)
{
return FALSE;
}
//
// Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.
//
return FALSE;
}
return FALSE;
}
return TRUE;
}
/**
Reset the input device and optionaly run diagnostics
@param This Protocol instance pointer.
@param ExtendedVerification Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The device was reset.
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
not be reset.
**/
)
{
//
// return the worst status met
//
);
}
}
return ReturnStatus;
}
/**
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
@param This Protocol instance pointer.
@param KeyData A pointer to a buffer that is filled in with the
keystroke state data for the key that was
pressed.
@retval EFI_SUCCESS The keystroke information was returned.
@retval EFI_NOT_READY There was no keystroke data availiable.
@retval EFI_DEVICE_ERROR The keystroke information was not returned due
to hardware errors.
@retval EFI_INVALID_PARAMETER KeyData is NULL.
**/
)
{
return EFI_INVALID_PARAMETER;
}
//
// if no physical console input device exists, return EFI_NOT_READY;
// if any physical console input device has key input,
// return the key and EFI_SUCCESS.
//
);
return Status;
}
}
return EFI_NOT_READY;
}
/**
Set certain state for the input device.
@param This Protocol instance pointer.
@param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the
state for the input device.
@retval EFI_SUCCESS The device state was set successfully.
@retval EFI_DEVICE_ERROR The device is not functioning correctly and
could not have the setting adjusted.
@retval EFI_UNSUPPORTED The device does not have the ability to set its
state.
@retval EFI_INVALID_PARAMETER KeyToggleState is NULL.
**/
)
{
if (KeyToggleState == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// if no physical console input device exists, return EFI_SUCCESS;
// otherwise return the status of setting state of physical console input device
//
);
return Status;
}
}
return EFI_SUCCESS;
}
/**
Register a notification function for a particular keystroke for the input device.
@param This Protocol instance pointer.
@param KeyData A pointer to a buffer that is filled in with the
keystroke information data for the key that was
pressed.
@param KeyNotificationFunction Points to the function to be called when the key
sequence is typed specified by KeyData.
@param NotifyHandle Points to the unique handle assigned to the
registered notification.
@retval EFI_SUCCESS The notification function was registered
successfully.
@retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data
structures.
@retval EFI_INVALID_PARAMETER KeyData or KeyNotificationFunction or NotifyHandle is NULL.
**/
)
{
return EFI_INVALID_PARAMETER;
}
//
// If no physical console input device exists,
// return EFI_SUCCESS directly.
//
if (Private->CurrentNumberOfExConsoles <= 0) {
return EFI_SUCCESS;
}
//
// Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered.
//
for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {
return EFI_SUCCESS;
}
}
}
//
// Allocate resource to save the notification function
//
return EFI_OUT_OF_RESOURCES;
}
NewNotify->NotifyHandleList = (EFI_HANDLE *) AllocateZeroPool (sizeof (EFI_HANDLE) * Private->CurrentNumberOfExConsoles);
return EFI_OUT_OF_RESOURCES;
}
//
// Return the wrong status of registering key notify of
// physical console input device if meet problems
//
);
return Status;
}
}
return EFI_SUCCESS;
}
/**
Remove a registered notification function from a particular keystroke.
@param This Protocol instance pointer.
@param NotificationHandle The handle of the notification function being
unregistered.
@retval EFI_SUCCESS The notification function was unregistered
successfully.
@retval EFI_INVALID_PARAMETER The NotificationHandle is invalid.
**/
)
{
if (NotificationHandle == NULL) {
return EFI_INVALID_PARAMETER;
}
if (((TEXT_IN_EX_SPLITTER_NOTIFY *) NotificationHandle)->Signature != TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
//
// if no physical console input device exists,
// return EFI_SUCCESS directly.
//
if (Private->CurrentNumberOfExConsoles <= 0) {
return EFI_SUCCESS;
}
for (Link = Private->NotifyList.ForwardLink; Link != &Private->NotifyList; Link = Link->ForwardLink) {
);
return Status;
}
}
return EFI_SUCCESS;
}
}
//
// NotificationHandle is not found in database
//
return EFI_INVALID_PARAMETER;
}
/**
Reset the input device and optionaly run diagnostics
@param This Protocol instance pointer.
@param ExtendedVerification Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The device was reset.
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
not be reset.
**/
)
{
if (Private->CurrentNumberOfPointers == 0) {
return EFI_SUCCESS;
}
//
// return the worst status met
//
);
}
}
return ReturnStatus;
}
/**
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
@param Private Protocol instance pointer.
@param State The state information of simple pointer device.
@retval EFI_SUCCESS The keystroke information was returned.
@retval EFI_NOT_READY There was no keystroke data availiable.
@retval EFI_DEVICE_ERROR The keydtroke information was not returned due
to hardware errors.
**/
)
{
State->RelativeMovementX = 0;
State->RelativeMovementY = 0;
State->RelativeMovementZ = 0;
//
// if no physical console input device exists, return EFI_NOT_READY;
// if any physical console input device has key input,
// return the key and EFI_SUCCESS.
//
);
if (ReturnStatus == EFI_NOT_READY) {
}
if (CurrentState.LeftButton) {
}
if (CurrentState.RightButton) {
}
State->RelativeMovementX += (CurrentState.RelativeMovementX * (INT32) Private->SimplePointerMode.ResolutionX) / (INT32) Private->PointerList[Index]->Mode->ResolutionX;
}
State->RelativeMovementY += (CurrentState.RelativeMovementY * (INT32) Private->SimplePointerMode.ResolutionY) / (INT32) Private->PointerList[Index]->Mode->ResolutionY;
}
State->RelativeMovementZ += (CurrentState.RelativeMovementZ * (INT32) Private->SimplePointerMode.ResolutionZ) / (INT32) Private->PointerList[Index]->Mode->ResolutionZ;
}
} else if (Status == EFI_DEVICE_ERROR) {
}
}
return ReturnStatus;
}
/**
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
@param This A pointer to protocol instance.
@param State A pointer to state information on the pointer device
@retval EFI_SUCCESS The keystroke information was returned in State.
@retval EFI_NOT_READY There was no keystroke data availiable.
@retval EFI_DEVICE_ERROR The keydtroke information was not returned due
to hardware errors.
**/
)
{
}
/**
This event agregates all the events of the ConIn devices in the spliter.
If any events of physical ConIn devices are signaled, signal the ConIn
spliter event. This will cause the calling code to call
ConSplitterTextInReadKeyStroke ().
@param Event The Event assoicated with callback.
@param Context Context registered when Event was created.
**/
)
{
//
// if InputEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke()
//
if (Private->InputEventSignalState) {
return ;
}
//
// if any physical console input device has key input, signal the event.
//
}
}
}
/**
Resets the pointer device hardware.
@param This Protocol instance pointer.
@param ExtendedVerification Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The device was reset.
@retval EFI_DEVICE_ERROR The device is not functioning correctly and
could not be reset.
**/
)
{
if (Private->CurrentNumberOfAbsolutePointers == 0) {
return EFI_SUCCESS;
}
//
// return the worst status met
//
for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {
);
}
}
return ReturnStatus;
}
/**
Retrieves the current state of a pointer device.
@param This Protocol instance pointer.
@param State A pointer to the state information on the
pointer device.
@retval EFI_SUCCESS The state of the pointer device was returned in
State..
@retval EFI_NOT_READY The state of the pointer device has not changed
since the last call to GetState().
@retval EFI_DEVICE_ERROR A device error occurred while attempting to
retrieve the pointer device's current state.
**/
)
{
State->ActiveButtons = 0;
//
// if no physical pointer device exists, return EFI_NOT_READY;
// if any physical pointer device has changed state,
// return the state and EFI_SUCCESS.
//
);
if (ReturnStatus == EFI_NOT_READY) {
}
if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 && Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {
}
if (!(Private->AbsolutePointerMode.AbsoluteMinY == 0 && Private->AbsolutePointerMode.AbsoluteMaxY == 0)) {
}
if (!(Private->AbsolutePointerMode.AbsoluteMinZ == 0 && Private->AbsolutePointerMode.AbsoluteMaxZ == 0)) {
}
} else if (Status == EFI_DEVICE_ERROR) {
}
}
return ReturnStatus;
}
/**
This event agregates all the events of the pointer devices in the splitter.
If any events of physical pointer devices are signaled, signal the pointer
splitter event. This will cause the calling code to call
ConSplitterAbsolutePointerGetState ().
@param Event The Event assoicated with callback.
@param Context Context registered when Event was created.
**/
)
{
//
// if AbsoluteInputEventSignalState is flagged before,
// and not cleared by Reset() or GetState(), signal it
//
if (Private->AbsoluteInputEventSignalState) {
return ;
}
//
// if any physical console input device has key input, signal the event.
//
}
}
}
/**
Reset the text output device hardware and optionaly run diagnostics
@param This Protocol instance pointer.
@param ExtendedVerification Driver may perform more exhaustive verfication
operation of the device during reset.
@retval EFI_SUCCESS The text output device was reset.
@retval EFI_DEVICE_ERROR The text output device is not functioning
correctly and could not be reset.
**/
)
{
//
// return the worst status met
//
);
}
}
//
// reset all mode parameters
//
TextOutSetMode (Private, 0);
return ReturnStatus;
}
/**
Write a Unicode string to the output device.
@param This Protocol instance pointer.
@param WString The NULL-terminated Unicode string to be
displayed on the output device(s). All output
devices must also support the Unicode drawing
defined in this file.
@retval EFI_SUCCESS The string was output to the device.
@retval EFI_DEVICE_ERROR The device reported an error while attempting to
output the text.
@retval EFI_UNSUPPORTED The output device's mode is not currently in a
defined text mode.
@retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the
characters in the Unicode string could not be
rendered and were skipped.
**/
)
{
//
// return the worst status met
//
);
}
}
if (Private->CurrentNumberOfConsoles > 0) {
} else {
//
// When there is no real console devices in system,
// update cursor position for the virtual device in consplitter.
//
);
switch (*WString) {
case CHAR_BACKSPACE:
}
break;
case CHAR_LINEFEED:
}
break;
case CHAR_CARRIAGE_RETURN:
break;
default:
} else {
}
}
break;
}
}
}
return ReturnStatus;
}
/**
Verifies that all characters in a Unicode string can be output to the
target device.
@param This Protocol instance pointer.
@param WString The NULL-terminated Unicode string to be
examined for the output device(s).
@retval EFI_SUCCESS The device(s) are capable of rendering the
output string.
@retval EFI_UNSUPPORTED Some of the characters in the Unicode string
cannot be rendered by one or more of the output
devices mapped by the EFI handle.
**/
)
{
//
// return the worst status met
//
);
}
}
//
// There is no DevNullTextOutTestString () since a Unicode buffer would
// always return EFI_SUCCESS.
// ReturnStatus will be EFI_SUCCESS if no consoles are present
//
return ReturnStatus;
}
/**
Returns information for an available text mode that the output device(s)
supports.
@param This Protocol instance pointer.
@param ModeNumber The mode number to return information on.
@param Columns Returns the columns of the text output device
for the requested ModeNumber.
@param Rows Returns the rows of the text output device
for the requested ModeNumber.
@retval EFI_SUCCESS The requested mode information was returned.
@retval EFI_DEVICE_ERROR The device had an error and could not complete
the request.
@retval EFI_UNSUPPORTED The mode number was not valid.
**/
)
{
//
// Check whether param ModeNumber is valid.
// ModeNumber should be within range 0 ~ MaxMode - 1.
//
return EFI_UNSUPPORTED;
}
return EFI_UNSUPPORTED;
}
//
// We get the available mode from mode intersection map if it's available
//
} else {
}
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}
/**
Sets the output device(s) to a specified mode.
@param This Protocol instance pointer.
@param ModeNumber The mode number to set.
@retval EFI_SUCCESS The requested text mode was set.
@retval EFI_DEVICE_ERROR The device had an error and could not complete
the request.
@retval EFI_UNSUPPORTED The mode number was not valid.
**/
)
{
//
// Check whether param ModeNumber is valid.
// ModeNumber should be within range 0 ~ MaxMode - 1.
//
return EFI_UNSUPPORTED;
}
return EFI_UNSUPPORTED;
}
//
// If the mode is being set to the curent mode, then just clear the screen and return.
//
return ConSplitterTextOutClearScreen (This);
}
//
// return the worst status met
//
);
}
}
//
// Set mode parameter to specified mode number
//
return ReturnStatus;
}
/**
Sets the background and foreground colors for the OutputString () and
ClearScreen () functions.
@param This Protocol instance pointer.
@param Attribute The attribute to set. Bits 0..3 are the
foreground color, and bits 4..6 are the
background color. All other bits are undefined
and must be zero. The valid Attributes are
defined in this file.
@retval EFI_SUCCESS The attribute was set.
@retval EFI_DEVICE_ERROR The device had an error and could not complete
the request.
@retval EFI_UNSUPPORTED The attribute requested is not defined.
**/
)
{
//
// Check whether param Attribute is valid.
//
return EFI_UNSUPPORTED;
}
//
// return the worst status met
//
);
}
}
return ReturnStatus;
}
/**
Clears the output device(s) display to the currently selected background
color.
@param This Protocol instance pointer.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_DEVICE_ERROR The device had an error and could not complete
the request.
@retval EFI_UNSUPPORTED The output device is not in a valid text mode.
**/
)
{
//
// return the worst status met
//
}
}
//
// No need to do extra check here as whether (Column, Row) is valid has
// been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should
// always be supported.
//
return ReturnStatus;
}
/**
Sets the current coordinates of the cursor position
@param This Protocol instance pointer.
@param Column The column position to set the cursor to. Must be
greater than or equal to zero and less than the
number of columns by QueryMode ().
@param Row The row position to set the cursor to. Must be
greater than or equal to zero and less than the
number of rows by QueryMode ().
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_DEVICE_ERROR The device had an error and could not complete
the request.
@retval EFI_UNSUPPORTED The output device is not in a valid text mode,
or the cursor position is invalid for the
current mode.
**/
)
{
//
// Get current MaxColumn and MaxRow from intersection map
//
} else {
}
return EFI_UNSUPPORTED;
}
//
// return the worst status met
//
);
}
}
//
// No need to do extra check here as whether (Column, Row) is valid has
// been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should
// always be supported.
//
return ReturnStatus;
}
/**
Makes the cursor visible or invisible
@param This Protocol instance pointer.
@param Visible If TRUE, the cursor is set to be visible. If
FALSE, the cursor is set to be invisible.
@retval EFI_SUCCESS The operation completed successfully.
@retval EFI_DEVICE_ERROR The device had an error and could not complete
the request, or the device does not support
changing the cursor mode.
@retval EFI_UNSUPPORTED The output device is not in a valid text mode.
**/
)
{
//
// return the worst status met
//
);
}
}
return ReturnStatus;
}