never removed. Such design ensures sytem function well during none console\r
device situation.\r
\r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
//\r
Status = ConSplitterTextOutConstructor (&mConOut);\r
if (!EFI_ERROR (Status)) {\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
- &gEfiSimpleTextOutProtocolGuid,\r
- &mConOut.TextOut,\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
- &gEfiSimpleTextOutProtocolGuid,\r
- &mConOut.TextOut,\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
- &gEfiSimpleTextOutProtocolGuid,\r
- &mConOut.TextOut,\r
- &gEfiGraphicsOutputProtocolGuid,\r
- &mConOut.GraphicsOutput,\r
- &gEfiUgaDrawProtocolGuid,\r
- &mConOut.UgaDraw,\r
- NULL\r
- );\r
- }\r
-\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
ConSplitterEmptyCallbackFunction,\r
NULL,\r
&gConnectConInEventGuid,\r
- &ConInPrivate->ConnectConIn\r
+ &ConInPrivate->ConnectConInEvent\r
);\r
\r
return Status;\r
\r
FreePool (Info);\r
\r
- } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+ } else if (UgaDraw != NULL) {\r
Status = UgaDraw->GetMode (\r
UgaDraw,\r
&mConOut.UgaHorizontalResolution,\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
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
- TextOutModeMap += NewSize;\r
- 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
\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
+ // corresponding entry in the map table is set to 1.\r
//\r
Mode = 0;\r
while (Mode < ConOutMaxMode) {\r
}\r
}\r
}\r
- } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\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
if (GraphicsOutput != NULL) {\r
Private->CurrentNumberOfGraphicsOutput++;\r
}\r
- if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+ if (UgaDraw != NULL) {\r
Private->CurrentNumberOfUgaDraw++;\r
}\r
\r
Status = TextOut->SetMode (TextOut, BaseMode);\r
ASSERT(!EFI_ERROR(Status));\r
\r
- PcdSet32 (PcdConOutColumn, 80);\r
- PcdSet32 (PcdConOutRow, 25);\r
+ Status = PcdSet32S (PcdConOutColumn, 80);\r
+ ASSERT(!EFI_ERROR(Status));\r
+ Status = PcdSet32S (PcdConOutRow, 25);\r
+ ASSERT(!EFI_ERROR(Status));\r
}\r
\r
return ;\r
ASSERT (MaxMode >= 1);\r
\r
DeviceStatus = EFI_DEVICE_ERROR;\r
- if (FeaturePcdGet (PcdConOutGopSupport)) {\r
- //\r
- // If GOP is produced by Consplitter, this device display mode will be added into Graphics Ouput modes.\r
- //\r
- if ((GraphicsOutput != NULL) || (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport))) {\r
- DeviceStatus = ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);\r
- }\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
FreePool (Info);\r
\r
- } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+ } else if (UgaDraw != NULL) {\r
Status = UgaDraw->GetMode (\r
UgaDraw,\r
&UgaHorizontalResolution,\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
TextOutList = Private->TextOutList;\r
while (Index >= 0) {\r
if (TextOutList->TextOut == TextOut) {\r
- if (TextOutList->UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+ if (TextOutList->UgaDraw != NULL) {\r
Private->CurrentNumberOfUgaDraw--;\r
}\r
if (TextOutList->GraphicsOutput != NULL) {\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
if (!mConInIsConnect && PcdGetBool (PcdConInConnectOnDemand)) {\r
DEBUG ((EFI_D_INFO, "Connect ConIn in first ReadKeyStoke in Lazy ConIn mode.\n")); \r
- gBS->SignalEvent (Private->ConnectConIn);\r
+ gBS->SignalEvent (Private->ConnectConInEvent);\r
mConInIsConnect = TRUE;\r
}\r
\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->ConnectConIn);\r
+ gBS->SignalEvent (Private->ConnectConInEvent);\r
mConInIsConnect = TRUE;\r
}\r
\r
EFI_STATUS ReturnStatus;\r
UINTN Index;\r
EFI_ABSOLUTE_POINTER_STATE CurrentState;\r
-\r
+ UINT64 MinX;\r
+ UINT64 MinY;\r
+ UINT64 MinZ;\r
+ UINT64 MaxX;\r
+ UINT64 MaxY;\r
+ UINT64 MaxZ;\r
+ UINT64 VirtualMinX;\r
+ UINT64 VirtualMinY;\r
+ UINT64 VirtualMinZ;\r
+ UINT64 VirtualMaxX;\r
+ UINT64 VirtualMaxY;\r
+ UINT64 VirtualMaxZ;\r
\r
Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);\r
\r
State->CurrentZ = 0;\r
State->ActiveButtons = 0;\r
\r
+ VirtualMinX = Private->AbsolutePointerMode.AbsoluteMinX;\r
+ VirtualMinY = Private->AbsolutePointerMode.AbsoluteMinY;\r
+ VirtualMinZ = Private->AbsolutePointerMode.AbsoluteMinZ;\r
+ VirtualMaxX = Private->AbsolutePointerMode.AbsoluteMaxX;\r
+ VirtualMaxY = Private->AbsolutePointerMode.AbsoluteMaxY;\r
+ VirtualMaxZ = Private->AbsolutePointerMode.AbsoluteMaxZ;\r
+\r
//\r
// if no physical pointer device exists, return EFI_NOT_READY;\r
// if any physical pointer device has changed state,\r
ReturnStatus = EFI_SUCCESS;\r
}\r
\r
+ MinX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinX;\r
+ MinY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinY;\r
+ MinZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinZ;\r
+ MaxX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxX;\r
+ MaxY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxY;\r
+ MaxZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxZ;\r
+\r
State->ActiveButtons = CurrentState.ActiveButtons;\r
\r
- if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 && Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {\r
- State->CurrentX = CurrentState.CurrentX;\r
+ //\r
+ // Rescale to Con Splitter virtual Absolute Pointer's resolution.\r
+ //\r
+ if (!(MinX == 0 && MaxX == 0)) {\r
+ State->CurrentX = VirtualMinX + DivU64x64Remainder (\r
+ MultU64x64 (\r
+ CurrentState.CurrentX,\r
+ VirtualMaxX - VirtualMinX\r
+ ),\r
+ MaxX - MinX,\r
+ NULL\r
+ );\r
}\r
- if (!(Private->AbsolutePointerMode.AbsoluteMinY == 0 && Private->AbsolutePointerMode.AbsoluteMaxY == 0)) {\r
- State->CurrentY = CurrentState.CurrentY;\r
+ if (!(MinY == 0 && MaxY == 0)) {\r
+ State->CurrentY = VirtualMinY + DivU64x64Remainder (\r
+ MultU64x64 (\r
+ CurrentState.CurrentY,\r
+ VirtualMaxY - VirtualMinY\r
+ ),\r
+ MaxY - MinY,\r
+ NULL\r
+ );\r
}\r
- if (!(Private->AbsolutePointerMode.AbsoluteMinZ == 0 && Private->AbsolutePointerMode.AbsoluteMaxZ == 0)) {\r
- State->CurrentZ = CurrentState.CurrentZ;\r
+ if (!(MinZ == 0 && MaxZ == 0)) {\r
+ State->CurrentZ = VirtualMinZ + DivU64x64Remainder (\r
+ MultU64x64 (\r
+ CurrentState.CurrentZ,\r
+ VirtualMaxZ - VirtualMinZ\r
+ ),\r
+ MaxZ - MinZ,\r
+ NULL\r
+ );\r
}\r
\r
} else if (Status == EFI_DEVICE_ERROR) {\r
//\r
// Check whether param Attribute is valid.\r
//\r
- if ( (Attribute > (UINTN)(((UINT32)-1)>>1)) ) {\r
+ if ((Attribute | 0x7F) != 0x7F) {\r
return EFI_UNSUPPORTED;\r
}\r
\r
IN VOID *Context\r
)\r
{\r
- return;\r
}\r