1. Fixed bugs in DxeNetLib to meet consistence with network module DriverBinding protocol.

2. Sync bugs in console modules.
3. Sync bugs in PlatDriOverLib.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4571 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2008-01-17 05:56:45 +00:00
parent b290614d49
commit 3012ce5cf7
12 changed files with 595 additions and 261 deletions

View File

@ -24,6 +24,7 @@ Abstract:
#include <PiDxe.h> #include <PiDxe.h>
#include <Protocol/PlatformDriverOverride.h> #include <Protocol/PlatformDriverOverride.h>
#include <Protocol/DevicePath.h> #include <Protocol/DevicePath.h>
#include <Protocol/DriverBinding.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <VariableFormat.h> #include <VariableFormat.h>
@ -252,4 +253,19 @@ DeleteDriverImage (
IN LIST_ENTRY *MappingDataBase IN LIST_ENTRY *MappingDataBase
); );
/**
Get the first Binding protocol which has the specific image handle
@param Image Image handle
@return Pointer into the Binding Protocol interface
**/
EFI_DRIVER_BINDING_PROTOCOL *
EFIAPI
GetBindingProtocolFromImageHandle (
IN EFI_HANDLE ImageHandle,
OUT EFI_HANDLE *BindingHandle
);
#endif #endif

View File

@ -25,6 +25,8 @@ Abstract:
#include <Protocol/SimpleNetwork.h> #include <Protocol/SimpleNetwork.h>
#include <Protocol/LoadedImage.h> #include <Protocol/LoadedImage.h>
#include <Protocol/NicIp4Config.h> #include <Protocol/NicIp4Config.h>
#include <Protocol/ComponentName.h>
#include <Protocol/ComponentName2.h>
#include <Library/NetLib.h> #include <Library/NetLib.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
@ -842,8 +844,7 @@ NetLibDefaultUnload (
UINTN Index; UINTN Index;
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
EFI_COMPONENT_NAME_PROTOCOL *ComponentName; EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration; EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics;
// //
// Get the list of all the handles in the handle database. // Get the list of all the handles in the handle database.
@ -912,29 +913,14 @@ NetLibDefaultUnload (
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
DeviceHandleBuffer[Index], DeviceHandleBuffer[Index],
&gEfiDriverConfigurationProtocolGuid, &gEfiComponentName2ProtocolGuid,
(VOID **) &DriverConfiguration (VOID **) &ComponentName2
); );
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
gBS->UninstallProtocolInterface ( gBS->UninstallProtocolInterface (
ImageHandle, ImageHandle,
&gEfiDriverConfigurationProtocolGuid, &gEfiComponentName2ProtocolGuid,
DriverConfiguration ComponentName2
);
}
Status = gBS->HandleProtocol (
DeviceHandleBuffer[Index],
&gEfiDriverDiagnosticsProtocolGuid,
(VOID **) &DriverDiagnostics
);
if (!EFI_ERROR (Status)) {
gBS->UninstallProtocolInterface (
ImageHandle,
&gEfiDriverDiagnosticsProtocolGuid,
DriverDiagnostics
); );
} }
} }

View File

@ -56,3 +56,5 @@
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiNicIp4ConfigProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiNicIp4ConfigProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiDpcProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiDpcProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED

View File

@ -63,7 +63,7 @@ InstallPlatformDriverOverrideProtocol (
// //
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
if (HandleBuffer != NULL) { if (HandleBuffer != NULL) {
gBS->FreePool (HandleBuffer); FreePool (HandleBuffer);
} }
return EFI_ALREADY_STARTED; return EFI_ALREADY_STARTED;
} }
@ -536,6 +536,92 @@ SaveOverridesMapping (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Get the first Binding protocol which has the specific image handle
@param Image Image handle
@return Pointer into the Binding Protocol interface
**/
EFI_DRIVER_BINDING_PROTOCOL *
EFIAPI
GetBindingProtocolFromImageHandle (
IN EFI_HANDLE ImageHandle,
OUT EFI_HANDLE *BindingHandle
)
{
EFI_STATUS Status;
UINTN Index;
UINTN DriverBindingHandleCount;
EFI_HANDLE *DriverBindingHandleBuffer;
EFI_DRIVER_BINDING_PROTOCOL *DriverBindingInterface;
if (BindingHandle == NULL || ImageHandle == NULL) {
return NULL;
}
//
// Get all driver which support binding protocol in second page
//
DriverBindingHandleCount = 0;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiDriverBindingProtocolGuid,
NULL,
&DriverBindingHandleCount,
&DriverBindingHandleBuffer
);
if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {
return NULL;
}
for (Index = 0; Index < DriverBindingHandleCount; Index++) {
DriverBindingInterface =NULL;
Status = gBS->OpenProtocol (
DriverBindingHandleBuffer[Index],
&gEfiDriverBindingProtocolGuid,
(VOID **) &DriverBindingInterface,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
continue;
}
if (DriverBindingInterface->ImageHandle == ImageHandle) {
*BindingHandle = DriverBindingHandleBuffer[Index];
FreePool (DriverBindingHandleBuffer);
return DriverBindingInterface;
}
}
FreePool (DriverBindingHandleBuffer);
*BindingHandle = NULL;
return NULL;
}
/**
return the current TPL, copied from the EDKII glue lib
@param VOID
@return Current TPL
**/
EFI_TPL
GetCurrentTpl (
VOID
)
{
EFI_TPL Tpl;
Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
gBS->RestoreTPL (Tpl);
return Tpl;
}
/** /**
Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database. Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
@ -582,6 +668,7 @@ GetDriverFromMapping (
UINTN Index; UINTN Index;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
EFI_HANDLE DriverBindingHandle;
BOOLEAN FoundLastReturned; BOOLEAN FoundLastReturned;
PLATFORM_OVERRIDE_ITEM *OverrideItem; PLATFORM_OVERRIDE_ITEM *OverrideItem;
DRIVER_IMAGE_INFO *DriverImageInfo; DRIVER_IMAGE_INFO *DriverImageInfo;
@ -741,18 +828,27 @@ GetDriverFromMapping (
} }
if (ImageFound) { if (ImageFound) {
Status = gBS->HandleProtocol ( //
// Find its related driver binding protocol
// Driver binding handle may be different with its driver's Image handle,
//
DriverBindingHandle = NULL;
DriverBinding = GetBindingProtocolFromImageHandle (
ImageHandleBuffer[Index], ImageHandleBuffer[Index],
&gEfiDriverBindingProtocolGuid, &DriverBindingHandle
(VOID **) &DriverBinding
); );
ASSERT (!EFI_ERROR (Status)); ASSERT (DriverBinding != NULL);
DriverImageInfo->ImageHandle = ImageHandleBuffer[Index]; DriverImageInfo->ImageHandle = ImageHandleBuffer[Index];
} else { } else if (GetCurrentTpl() <= TPL_CALLBACK){
// //
// The driver image has not been loaded and started, need try to load and start it now // The driver image has not been loaded and started, need try to load and start it now
// Try to connect all device in the driver image path // Try to connect all device in the driver image path
// //
// Note: LoadImage() and StartImage() should be called under CALLBACK TPL in theory, but
// since many device need to be connected in CALLBACK level environment( e.g. Usb devices )
// and the Fat and Patition driver can endure executing in CALLBACK level in fact, so here permit
// to use LoadImage() and StartImage() in CALLBACK TPL.
//
Status = ConnectDevicePath (DriverImageInfo->DriverImagePath); Status = ConnectDevicePath (DriverImageInfo->DriverImagePath);
// //
// check whether it points to a PCI Option Rom image, and try to use bus override protocol to get its first option rom image driver // check whether it points to a PCI Option Rom image, and try to use bus override protocol to get its first option rom image driver
@ -774,12 +870,16 @@ GetDriverFromMapping (
&ImageHandle &ImageHandle
); );
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = gBS->HandleProtocol ( //
// Find its related driver binding protocol
// Driver binding handle may be different with its driver's Image handle
//
DriverBindingHandle = NULL;
DriverBinding = GetBindingProtocolFromImageHandle (
ImageHandle, ImageHandle,
&gEfiDriverBindingProtocolGuid, &DriverBindingHandle
(VOID **) &DriverBinding
); );
ASSERT (!EFI_ERROR (Status)); ASSERT (DriverBinding != NULL);
DriverImageInfo->ImageHandle = ImageHandle; DriverImageInfo->ImageHandle = ImageHandle;
} }
} }
@ -814,12 +914,16 @@ GetDriverFromMapping (
DriverImageInfo->UnStartable = TRUE; DriverImageInfo->UnStartable = TRUE;
DriverImageInfo->ImageHandle = NULL; DriverImageInfo->ImageHandle = NULL;
} else { } else {
Status = gBS->HandleProtocol ( //
// Find its related driver binding protocol
// Driver binding handle may be different with its driver's Image handle
//
DriverBindingHandle = NULL;
DriverBinding = GetBindingProtocolFromImageHandle (
ImageHandle, ImageHandle,
&gEfiDriverBindingProtocolGuid, &DriverBindingHandle
(VOID **) &DriverBinding
); );
ASSERT (!EFI_ERROR (Status)); ASSERT (DriverBinding != NULL);
DriverImageInfo->ImageHandle = ImageHandle; DriverImageInfo->ImageHandle = ImageHandle;
} }
} else { } else {

View File

@ -240,108 +240,108 @@
################################################################################ ################################################################################
[Components.common] [Components.common]
MdeModulePkg/Core/Pei/PeiMain.inf # MdeModulePkg/Core/Pei/PeiMain.inf
MdeModulePkg/Core/Dxe/DxeMain.inf { # MdeModulePkg/Core/Dxe/DxeMain.inf {
<LibraryClasses> # <LibraryClasses>
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf # NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
} # }
#
MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf # MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf # MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf # MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
MdeModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.inf # MdeModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.inf
#
MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf # MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf # MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf # MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf # MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
#
MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf # MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf
#
MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf # MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf # MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
#
MdeModulePkg/Universal/iScsi/IScsi.inf # MdeModulePkg/Universal/iScsi/IScsi.inf
#
MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf # MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf # MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf # MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf # MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf # MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf # MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
MdeModulePkg/Universal/Network/PxeBcDxe/PxeBcDxe.inf # MdeModulePkg/Universal/Network/PxeBcDxe/PxeBcDxe.inf
MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf # MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4Dxe.inf # MdeModulePkg/Universal/Network/PxeDhcp4Dxe/PxeDhcp4Dxe.inf
MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf # MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf # MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf # MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf # MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
#
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf # MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf
#
MdeModulePkg/Application/HelloWorld/HelloWorld.inf # MdeModulePkg/Application/HelloWorld/HelloWorld.inf
#
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf # MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf # MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
#
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf # MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf # MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf # MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf # MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf # MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
#
MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/FtwLite.inf # MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/FtwLite.inf
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf # MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf # MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf # MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
#
MdeModulePkg/Universal/WatchDogTimerDxe/WatchDogTimer.inf # MdeModulePkg/Universal/WatchDogTimerDxe/WatchDogTimer.inf
MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.inf # MdeModulePkg/Universal/DebugPortDxe/DebugPortDxe.inf
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
MdeModulePkg/Universal/PCD/Pei/Pcd.inf # MdeModulePkg/Universal/PCD/Pei/Pcd.inf
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf
MdeModulePkg/Application/HelloWorld/HelloWorld.inf # MdeModulePkg/Application/HelloWorld/HelloWorld.inf
MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf # MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf # MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf # MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf # MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf # MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf # MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointerDxe.inf # MdeModulePkg/Bus/Usb/UsbMouseAbsolutePointerDxe/UsbMouseAbsolutePointerDxe.inf
#
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf # MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
MdeModulePkg/Universal/Variable/Application/VariableInfo.inf # MdeModulePkg/Universal/Variable/Application/VariableInfo.inf
#
[Components.IA32] #[Components.IA32]
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf # MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf # MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf # MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf # MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf # MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf # MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf
#
[Components.X64] #[Components.X64]
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf # MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf # MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf # MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf # MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf # MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf # MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf # MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf # MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf
#
[Components.IPF] #[Components.IPF]
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf # MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf # MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf # MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
#
[Components.EBC] #[Components.EBC]
#BugBug: Need DXE I/O library instance for EBC. # #BugBug: Need DXE I/O library instance for EBC.
#MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf # #MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf # MdeModulePkg/Bus/Pci/UndiRuntimeDxe/UndiRuntimeDxe.inf
#

View File

@ -2243,6 +2243,7 @@ Returns:
INT32 Index; INT32 Index;
INT32 *TextOutModeMap; INT32 *TextOutModeMap;
INT32 *MapTable; INT32 *MapTable;
INT32 QueryMode;
TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData; TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;
UINTN Rows; UINTN Rows;
UINTN Columns; UINTN Columns;
@ -2263,13 +2264,15 @@ Returns:
MapTable = TextOutModeMap + Private->CurrentNumberOfConsoles; MapTable = TextOutModeMap + Private->CurrentNumberOfConsoles;
while (Mode < TextOut->Mode->MaxMode) { while (Mode < TextOut->Mode->MaxMode) {
TextOut->QueryMode (TextOut, Mode, &Columns, &Rows); TextOut->QueryMode (TextOut, Mode, &Columns, &Rows);
MapTable[StepSize] = Mode;
// //
// Search the QueryData database to see if they intersects // Search the intersection map and QueryData database to see if they intersects
// //
Index = 0; Index = 0;
while (Index < CurrentMaxMode) { while (Index < CurrentMaxMode) {
if ((TextOutQueryData[Index].Rows == Rows) && (TextOutQueryData[Index].Columns == Columns)) { QueryMode = *(TextOutModeMap + Index * StepSize);
if ((TextOutQueryData[QueryMode].Rows == Rows) && (TextOutQueryData[QueryMode].Columns == Columns)) {
MapTable[Index * StepSize] = Mode; MapTable[Index * StepSize] = Mode;
break; break;
} }
@ -2308,7 +2311,7 @@ Arguments:
Returns: Returns:
None EFI_SUCCESS
EFI_OUT_OF_RESOURCES EFI_OUT_OF_RESOURCES
--*/ --*/
@ -2319,10 +2322,14 @@ Returns:
TEXT_OUT_AND_GOP_DATA *StdErrTextOutList; TEXT_OUT_AND_GOP_DATA *StdErrTextOutList;
UINTN Indexi; UINTN Indexi;
UINTN Indexj; UINTN Indexj;
UINTN Rows; UINTN ConOutRows;
UINTN Columns; UINTN ConOutColumns;
UINTN StdErrRows;
UINTN StdErrColumns;
INT32 ConOutMaxMode; INT32 ConOutMaxMode;
INT32 StdErrMaxMode; INT32 StdErrMaxMode;
INT32 ConOutMode;
INT32 StdErrMode;
INT32 Mode; INT32 Mode;
INT32 Index; INT32 Index;
INT32 *ConOutModeMap; INT32 *ConOutModeMap;
@ -2331,6 +2338,8 @@ Returns:
INT32 *StdErrMapTable; INT32 *StdErrMapTable;
TEXT_OUT_SPLITTER_QUERY_DATA *ConOutQueryData; TEXT_OUT_SPLITTER_QUERY_DATA *ConOutQueryData;
TEXT_OUT_SPLITTER_QUERY_DATA *StdErrQueryData; TEXT_OUT_SPLITTER_QUERY_DATA *StdErrQueryData;
UINTN ConOutStepSize;
UINTN StdErrStepSize;
BOOLEAN FoundTheSameTextOut; BOOLEAN FoundTheSameTextOut;
UINTN ConOutMapTableSize; UINTN ConOutMapTableSize;
UINTN StdErrMapTableSize; UINTN StdErrMapTableSize;
@ -2366,10 +2375,12 @@ Returns:
// //
ConOutMaxMode = mConOut.TextOutMode.MaxMode; ConOutMaxMode = mConOut.TextOutMode.MaxMode;
ConOutModeMap = mConOut.TextOutModeMap; ConOutModeMap = mConOut.TextOutModeMap;
ConOutStepSize = mConOut.TextOutListCount;
ConOutQueryData = mConOut.TextOutQueryData; ConOutQueryData = mConOut.TextOutQueryData;
StdErrMaxMode = mStdErr.TextOutMode.MaxMode; StdErrMaxMode = mStdErr.TextOutMode.MaxMode;
StdErrModeMap = mStdErr.TextOutModeMap; StdErrModeMap = mStdErr.TextOutModeMap;
StdErrStepSize = mStdErr.TextOutListCount;
StdErrQueryData = mStdErr.TextOutQueryData; StdErrQueryData = mStdErr.TextOutQueryData;
// //
@ -2398,13 +2409,17 @@ Returns:
Mode = 0; Mode = 0;
while (Mode < ConOutMaxMode) { while (Mode < ConOutMaxMode) {
// //
// Search the other's QueryData database to see if they intersect // Search the intersection map and QueryData database to see if they intersect
// //
Index = 0; Index = 0;
Rows = ConOutQueryData[Mode].Rows; ConOutMode = *(ConOutModeMap + Mode * ConOutStepSize);
Columns = ConOutQueryData[Mode].Columns; ConOutRows = ConOutQueryData[ConOutMode].Rows;
ConOutColumns = ConOutQueryData[ConOutMode].Columns;
while (Index < StdErrMaxMode) { while (Index < StdErrMaxMode) {
if ((StdErrQueryData[Index].Rows == Rows) && (StdErrQueryData[Index].Columns == Columns)) { StdErrMode = *(StdErrModeMap + Index * StdErrStepSize);
StdErrRows = StdErrQueryData[StdErrMode].Rows;
StdErrColumns = StdErrQueryData[StdErrMode].Columns;
if ((StdErrRows == ConOutRows) && (StdErrColumns == ConOutColumns)) {
ConOutMapTable[Mode] = 1; ConOutMapTable[Mode] = 1;
StdErrMapTable[Index] = 1; StdErrMapTable[Index] = 1;
break; break;
@ -2470,6 +2485,7 @@ Returns:
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN Index; UINTN Index;
UINTN CurrentIndex;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode;
UINTN SizeOfInfo; UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
@ -2479,6 +2495,10 @@ Returns:
UINTN NumberIndex; UINTN NumberIndex;
BOOLEAN Match; BOOLEAN Match;
BOOLEAN AlreadyExist; BOOLEAN AlreadyExist;
UINT32 UgaHorizontalResolution;
UINT32 UgaVerticalResolution;
UINT32 UgaColorDepth;
UINT32 UgaRefreshRate;
if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) { if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
@ -2487,6 +2507,7 @@ Returns:
CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode; CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode;
Index = 0; Index = 0;
CurrentIndex = 0;
if (Private->CurrentNumberOfUgaDraw != 0) { if (Private->CurrentNumberOfUgaDraw != 0) {
// //
@ -2606,34 +2627,49 @@ Returns:
} }
// //
// Select a prefered Display mode 800x600 // Graphics console driver can ensure the same mode for all GOP devices
//
for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {
Mode = &Private->GraphicsOutputModeBuffer[Index];
if ((Mode->HorizontalResolution == GraphicsOutput->Mode->Info->HorizontalResolution) &&
(Mode->VerticalResolution == GraphicsOutput->Mode->Info->VerticalResolution)) {
CurrentIndex = Index;
break;
}
}
if (Index >= CurrentGraphicsOutputMode->MaxMode) {
//
// if user defined mode is not found, set to default mode 800x600
// //
for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) { for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {
Mode = &Private->GraphicsOutputModeBuffer[Index]; Mode = &Private->GraphicsOutputModeBuffer[Index];
if ((Mode->HorizontalResolution == 800) && (Mode->VerticalResolution == 600)) { if ((Mode->HorizontalResolution == 800) && (Mode->VerticalResolution == 600)) {
CurrentIndex = Index;
break; break;
} }
} }
//
// Prefered mode is not found, set to mode 0
//
if (Index >= CurrentGraphicsOutputMode->MaxMode) {
Index = 0;
} }
} }
if (UgaDraw != NULL) { if (UgaDraw != NULL) {
// //
// For UGA device, it's inconvenient to retrieve all the supported display modes. // Graphics console driver can ensure the same mode for all GOP devices
// To simplify the implementation, only add one resolution(800x600, 32bit color depth) as defined in UEFI spec // so we can get the current mode from this video device
// //
UgaDraw->GetMode (
UgaDraw,
&UgaHorizontalResolution,
&UgaVerticalResolution,
&UgaColorDepth,
&UgaRefreshRate
);
CurrentGraphicsOutputMode->MaxMode = 1; CurrentGraphicsOutputMode->MaxMode = 1;
Info = CurrentGraphicsOutputMode->Info; Info = CurrentGraphicsOutputMode->Info;
Info->Version = 0; Info->Version = 0;
Info->HorizontalResolution = 800; Info->HorizontalResolution = UgaHorizontalResolution;
Info->VerticalResolution = 600; Info->VerticalResolution = UgaVerticalResolution;
Info->PixelFormat = PixelBltOnly; Info->PixelFormat = PixelBltOnly;
Info->PixelsPerScanLine = 800; Info->PixelsPerScanLine = UgaHorizontalResolution;
CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL; CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;
CurrentGraphicsOutputMode->FrameBufferSize = 0; CurrentGraphicsOutputMode->FrameBufferSize = 0;
@ -2646,7 +2682,7 @@ Returns:
// //
// Only mode 0 is available to be set // Only mode 0 is available to be set
// //
Index = 0; CurrentIndex = 0;
} }
Done: Done:
@ -2666,7 +2702,20 @@ Done:
// //
// Current mode number may need update now, so set it to an invalid mode number // Current mode number may need update now, so set it to an invalid mode number
// //
Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) Index); CurrentGraphicsOutputMode->Mode = 0xffff;
//
// Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.
//
Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex);
//
// If user defined mode is not valid for UGA, set to the default mode 800x600.
//
if (EFI_ERROR(Status)) {
(Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800;
(Private->GraphicsOutputModeBuffer[0]).VerticalResolution = 600;
Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0);
}
return Status; return Status;
} }
@ -2694,6 +2743,10 @@ Returns:
UINTN CurrentNumOfConsoles; UINTN CurrentNumOfConsoles;
INT32 CurrentMode; INT32 CurrentMode;
INT32 MaxMode; INT32 MaxMode;
UINT32 UgaHorizontalResolution;
UINT32 UgaVerticalResolution;
UINT32 UgaColorDepth;
UINT32 UgaRefreshRate;
TEXT_OUT_AND_GOP_DATA *TextAndGop; TEXT_OUT_AND_GOP_DATA *TextAndGop;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
@ -2728,12 +2781,12 @@ Returns:
if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) { if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
// //
// If No UGA device then use the ConOut device // If No GOP/UGA device then use the ConOut device
// //
TextAndGop->TextOutEnabled = TRUE; TextAndGop->TextOutEnabled = TRUE;
} else { } else {
// //
// If UGA device use ConOut device only used if UGA screen is in Text mode // If GOP/UGA device use ConOut device only used if screen is in Text mode
// //
TextAndGop->TextOutEnabled = (BOOLEAN) (Private->ConsoleOutputMode == EfiConsoleControlScreenText); TextAndGop->TextOutEnabled = (BOOLEAN) (Private->ConsoleOutputMode == EfiConsoleControlScreenText);
} }
@ -2760,15 +2813,50 @@ Returns:
MaxMode = Private->TextOutMode.MaxMode; MaxMode = Private->TextOutMode.MaxMode;
ASSERT (MaxMode >= 1); ASSERT (MaxMode >= 1);
//
// Update DevNull mode according to current video device
//
if (FeaturePcdGet (PcdConOutGopSupport)) { if (FeaturePcdGet (PcdConOutGopSupport)) {
if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) { if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {
ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw); ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);
} }
} }
if (FeaturePcdGet (PcdConOutUgaSupport)) {
if (UgaDraw != NULL) {
Status = UgaDraw->GetMode (
UgaDraw,
&UgaHorizontalResolution,
&UgaVerticalResolution,
&UgaColorDepth,
&UgaRefreshRate
);
if (!EFI_ERROR (Status)) {
Status = ConSpliterUgaDrawSetMode (
&Private->UgaDraw,
UgaHorizontalResolution,
UgaVerticalResolution,
UgaColorDepth,
UgaRefreshRate
);
}
//
// If GetMode/SetMode is failed, set to 800x600 mode
//
if(EFI_ERROR (Status)) {
Status = ConSpliterUgaDrawSetMode (
&Private->UgaDraw,
800,
600,
32,
60
);
}
}
}
if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) { if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) {
// //
// We just added a new UGA device in graphics mode // We just added a new GOP or UGA device in graphics mode
// //
if (FeaturePcdGet (PcdConOutGopSupport)) { if (FeaturePcdGet (PcdConOutGopSupport)) {
DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw); DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);
@ -2823,14 +2911,12 @@ Returns:
if (TextOutList->TextOut == TextOut) { if (TextOutList->TextOut == TextOut) {
CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index); CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index);
CurrentNumOfConsoles--; CurrentNumOfConsoles--;
if (FeaturePcdGet (PcdConOutGopSupport)) {
if (TextOutList->UgaDraw != NULL) { if (TextOutList->UgaDraw != NULL) {
Private->CurrentNumberOfUgaDraw--; Private->CurrentNumberOfUgaDraw--;
} }
if (TextOutList->GraphicsOutput != NULL) { if (TextOutList->GraphicsOutput != NULL) {
Private->CurrentNumberOfGraphicsOutput--; Private->CurrentNumberOfGraphicsOutput--;
} }
}
break; break;
} }
@ -4300,6 +4386,8 @@ ConSplitterTextOutQueryMode (
--*/ --*/
{ {
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private; TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
UINTN CurrentMode;
INT32 *TextOutModeMap;
Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This); Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
@ -4315,8 +4403,18 @@ ConSplitterTextOutQueryMode (
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
//
// We get the available mode from mode intersection map if it's available
//
if (Private->TextOutModeMap != NULL) {
TextOutModeMap = Private->TextOutModeMap + Private->TextOutListCount * ModeNumber;
CurrentMode = (UINTN)(*TextOutModeMap);
*Columns = Private->TextOutQueryData[CurrentMode].Columns;
*Rows = Private->TextOutQueryData[CurrentMode].Rows;
} else {
*Columns = Private->TextOutQueryData[ModeNumber].Columns; *Columns = Private->TextOutQueryData[ModeNumber].Columns;
*Rows = Private->TextOutQueryData[ModeNumber].Rows; *Rows = Private->TextOutQueryData[ModeNumber].Rows;
}
if (*Columns <= 0 && *Rows <= 0) { if (*Columns <= 0 && *Rows <= 0) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
@ -4386,8 +4484,8 @@ ConSplitterTextOutSetMode (
TextOutModeMap[Index] TextOutModeMap[Index]
); );
// //
// If this console device is based on a UGA device, then sync up the bitmap from // If this console device is based on a GOP or UGA device, then sync up the bitmap from
// the UGA splitter and reclear the text portion of the display in the new mode. // the GOP/UGA splitter and reclear the text portion of the display in the new mode.
// //
if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) { if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {
Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut); Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut);
@ -4651,3 +4749,4 @@ ConSplitterTextOutEnableCursor (
return ReturnStatus; return ReturnStatus;
} }

View File

@ -1350,6 +1350,7 @@ DevNullTextOutSetMode (
--*/ --*/
{ {
UINTN Size; UINTN Size;
INT32 CurrentMode;
UINTN Row; UINTN Row;
UINTN Column; UINTN Column;
TEXT_OUT_SPLITTER_QUERY_DATA *Mode; TEXT_OUT_SPLITTER_QUERY_DATA *Mode;
@ -1357,8 +1358,14 @@ DevNullTextOutSetMode (
// //
// No extra check for ModeNumber here, as it has been checked in // No extra check for ModeNumber here, as it has been checked in
// ConSplitterTextOutSetMode. And mode 0 should always be supported. // ConSplitterTextOutSetMode. And mode 0 should always be supported.
// Row and Column should be fetched from intersection map.
// //
Mode = &(Private->TextOutQueryData[ModeNumber]); if (Private->TextOutModeMap != NULL) {
CurrentMode = *(Private->TextOutModeMap + Private->TextOutListCount * ModeNumber);
} else {
CurrentMode = (INT32)(ModeNumber);
}
Mode = &(Private->TextOutQueryData[CurrentMode]);
Row = Mode->Rows; Row = Mode->Rows;
Column = Mode->Columns; Column = Mode->Columns;

View File

@ -41,6 +41,14 @@ EraseCursor (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
); );
EFI_STATUS
CheckModeSupported (
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
OUT UINT32 *CurrentModeNumber
);
// //
// Globals // Globals
// //
@ -71,7 +79,8 @@ GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
{ {
{ 80, 25, 0, 0, 0, 0 }, // Mode 0 { 80, 25, 0, 0, 0, 0 }, // Mode 0
{ 80, 50, 0, 0, 0, 0 }, // Mode 1 { 80, 50, 0, 0, 0, 0 }, // Mode 1
{ 0, 0, 0, 0, 0, 0 } // Mode 2 { 100,31, 0, 0, 0, 0 }, // Mode 2
{ 0, 0, 0, 0, 0, 0 } // Mode 3
}, },
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
(EFI_HII_HANDLE) 0 (EFI_HII_HANDLE) 0
@ -252,8 +261,6 @@ GraphicsConsoleControllerDriverStart (
UINTN Rows; UINTN Rows;
UINT8 *Location; UINT8 *Location;
UINT32 ModeNumber; UINT32 ModeNumber;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
ModeNumber = 0; ModeNumber = 0;
@ -336,26 +343,32 @@ GraphicsConsoleControllerDriverStart (
if (Private->GraphicsOutput != NULL) { if (Private->GraphicsOutput != NULL) {
// //
// The console is build on top of Graphics Output Protocol, find the mode number for 800x600 // The console is build on top of Graphics Output Protocol, find the mode number
// for the user-defined mode; if there are multiple video devices,
// graphic console driver will set all the video devices to the same mode.
// //
for (ModeNumber = 0; ModeNumber < Private->GraphicsOutput->Mode->MaxMode; ModeNumber++) { Status = CheckModeSupported (
Status = Private->GraphicsOutput->QueryMode (
Private->GraphicsOutput, Private->GraphicsOutput,
ModeNumber, CURRENT_HORIZONTAL_RESOLUTION,
&SizeOfInfo, CURRENT_VERTICAL_RESOLUTION,
&Info &ModeNumber
);
if (!EFI_ERROR(Status)) {
//
// Update default mode to current mode
//
HorizontalResolution = CURRENT_HORIZONTAL_RESOLUTION;
VerticalResolution = CURRENT_VERTICAL_RESOLUTION;
} else {
//
// if not supporting current mode, try 800x600 which is required by UEFI/EFI spec
//
Status = CheckModeSupported (
Private->GraphicsOutput,
800,
600,
&ModeNumber
); );
if (!EFI_ERROR (Status)) {
if ((Info->HorizontalResolution == 800) &&
(Info->VerticalResolution == 600)) {
Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);
if (!EFI_ERROR (Status)) {
FreePool (Info);
break;
}
}
FreePool (Info);
}
} }
if (EFI_ERROR (Status) || (ModeNumber == Private->GraphicsOutput->Mode->MaxMode)) { if (EFI_ERROR (Status) || (ModeNumber == Private->GraphicsOutput->Mode->MaxMode)) {
@ -368,10 +381,24 @@ GraphicsConsoleControllerDriverStart (
} }
} else { } else {
// //
// The console is build on top of UGA Draw Protocol // At first try to set user-defined resolution
// //
ColorDepth = 32; ColorDepth = 32;
RefreshRate = 60; RefreshRate = 60;
Status = Private->UgaDraw->SetMode (
Private->UgaDraw,
CURRENT_HORIZONTAL_RESOLUTION,
CURRENT_VERTICAL_RESOLUTION,
ColorDepth,
RefreshRate
);
if (!EFI_ERROR (Status)) {
HorizontalResolution = CURRENT_HORIZONTAL_RESOLUTION;
VerticalResolution = CURRENT_VERTICAL_RESOLUTION;
} else {
//
// Try to set 800*600 which is required by UEFI/EFI spec
//
Status = Private->UgaDraw->SetMode ( Status = Private->UgaDraw->SetMode (
Private->UgaDraw, Private->UgaDraw,
HorizontalResolution, HorizontalResolution,
@ -380,9 +407,6 @@ GraphicsConsoleControllerDriverStart (
RefreshRate RefreshRate
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
//
// Get the current mode information from the UGA Draw Protocol
//
Status = Private->UgaDraw->GetMode ( Status = Private->UgaDraw->GetMode (
Private->UgaDraw, Private->UgaDraw,
&HorizontalResolution, &HorizontalResolution,
@ -395,6 +419,7 @@ GraphicsConsoleControllerDriverStart (
} }
} }
} }
}
// //
// Compute the maximum number of text Rows and Columns that this current graphics mode can support // Compute the maximum number of text Rows and Columns that this current graphics mode can support
@ -430,31 +455,47 @@ GraphicsConsoleControllerDriverStart (
Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * GLYPH_HEIGHT)) >> 1; Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * GLYPH_HEIGHT)) >> 1;
MaxMode++; MaxMode++;
} }
//
// If the graphics mode is 800x600, than add a text mode that uses the entire display
//
if (HorizontalResolution == 800 && VerticalResolution == 600) {
//
// If it is not to support Mode #1 - 80x50, then skip it
//
if (MaxMode < 2) { if (MaxMode < 2) {
Private->ModeData[MaxMode].Columns = 0; Private->ModeData[MaxMode].Columns = 0;
Private->ModeData[MaxMode].Rows = 0; Private->ModeData[MaxMode].Rows = 0;
Private->ModeData[MaxMode].GopWidth = 800; Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
Private->ModeData[MaxMode].GopHeight = 600; Private->ModeData[MaxMode].GopHeight = VerticalResolution;
Private->ModeData[MaxMode].GopModeNumber = ModeNumber; Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
Private->ModeData[MaxMode].DeltaX = 0; Private->ModeData[MaxMode].DeltaX = 0;
Private->ModeData[MaxMode].DeltaY = 0; Private->ModeData[MaxMode].DeltaY = 0;
MaxMode++; MaxMode++;
} }
Private->ModeData[MaxMode].Columns = 800 / GLYPH_WIDTH; //
Private->ModeData[MaxMode].Rows = 600 / GLYPH_HEIGHT; // Add Mode #2 that must be 100x31 (graphic mode >= 800x600)
Private->ModeData[MaxMode].GopWidth = 800; //
Private->ModeData[MaxMode].GopHeight = 600; if (Columns >= 100 && Rows >= 31) {
Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
Private->ModeData[MaxMode].GopHeight = VerticalResolution;
Private->ModeData[MaxMode].GopModeNumber = ModeNumber; Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
Private->ModeData[MaxMode].DeltaX = (800 % GLYPH_WIDTH) >> 1; Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (100 * GLYPH_WIDTH)) >> 1;
Private->ModeData[MaxMode].DeltaY = (600 % GLYPH_HEIGHT) >> 1; Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (31 * GLYPH_HEIGHT)) >> 1;
MaxMode++; MaxMode++;
} }
//
// Add Mode #3 that uses the entire display for user-defined mode
//
if (HorizontalResolution > 800 && VerticalResolution > 600) {
Private->ModeData[MaxMode].Columns = HorizontalResolution/GLYPH_WIDTH;
Private->ModeData[MaxMode].Rows = VerticalResolution/GLYPH_HEIGHT;
Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
Private->ModeData[MaxMode].GopHeight = VerticalResolution;
Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
Private->ModeData[MaxMode].DeltaX = (HorizontalResolution % GLYPH_WIDTH) >> 1;
Private->ModeData[MaxMode].DeltaY = (VerticalResolution % GLYPH_HEIGHT) >> 1;
MaxMode++;
}
// //
// Update the maximum number of modes // Update the maximum number of modes
// //
@ -587,6 +628,49 @@ GraphicsConsoleControllerDriverStop (
return Status; return Status;
} }
EFI_STATUS
CheckModeSupported (
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
OUT UINT32 *CurrentModeNumber
)
{
UINT32 ModeNumber;
EFI_STATUS Status;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
Status = EFI_SUCCESS;
for (ModeNumber = 0; ModeNumber < GraphicsOutput->Mode->MaxMode; ModeNumber++) {
Status = GraphicsOutput->QueryMode (
GraphicsOutput,
ModeNumber,
&SizeOfInfo,
&Info
);
if (!EFI_ERROR (Status)) {
if ((Info->HorizontalResolution == HorizontalResolution) &&
(Info->VerticalResolution == VerticalResolution)) {
Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
if (!EFI_ERROR (Status)) {
gBS->FreePool (Info);
break;
}
}
gBS->FreePool (Info);
}
}
if (ModeNumber == GraphicsOutput->Mode->MaxMode) {
Status = EFI_UNSUPPORTED;
}
*CurrentModeNumber = ModeNumber;
return Status;
}
EFI_STATUS EFI_STATUS
EfiLocateHiiProtocol ( EfiLocateHiiProtocol (
VOID VOID

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -177,6 +177,13 @@ GraphicsConsoleComponentNameGetControllerName (
#define GLYPH_WIDTH 8 #define GLYPH_WIDTH 8
#define GLYPH_HEIGHT 19 #define GLYPH_HEIGHT 19
//
// User can define valid graphic resolution here
// e.g. 640x480, 800x600, 1024x768...
//
#define CURRENT_HORIZONTAL_RESOLUTION 800
#define CURRENT_VERTICAL_RESOLUTION 600
typedef union { typedef union {
EFI_NARROW_GLYPH NarrowGlyph; EFI_NARROW_GLYPH NarrowGlyph;
EFI_WIDE_GLYPH WideGlyph; EFI_WIDE_GLYPH WideGlyph;
@ -200,7 +207,7 @@ typedef struct {
UINT32 GopModeNumber; UINT32 GopModeNumber;
} GRAPHICS_CONSOLE_MODE_DATA; } GRAPHICS_CONSOLE_MODE_DATA;
#define GRAPHICS_MAX_MODE 3 #define GRAPHICS_MAX_MODE 4
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;

View File

@ -489,8 +489,30 @@ TerminalDriverBindingStart (
// //
// Simple Text Output Protocol // Simple Text Output Protocol
// //
TerminalDevice->SimpleTextOutput.Reset = TerminalConOutReset;
TerminalDevice->SimpleTextOutput.OutputString = TerminalConOutOutputString;
TerminalDevice->SimpleTextOutput.TestString = TerminalConOutTestString;
TerminalDevice->SimpleTextOutput.QueryMode = TerminalConOutQueryMode;
TerminalDevice->SimpleTextOutput.SetMode = TerminalConOutSetMode;
TerminalDevice->SimpleTextOutput.SetAttribute = TerminalConOutSetAttribute;
TerminalDevice->SimpleTextOutput.ClearScreen = TerminalConOutClearScreen;
TerminalDevice->SimpleTextOutput.SetCursorPosition = TerminalConOutSetCursorPosition;
TerminalDevice->SimpleTextOutput.EnableCursor = TerminalConOutEnableCursor;
TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode; TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode;
TerminalDevice->SimpleTextOutputMode.MaxMode = 2;
//
// For terminal devices, cursor is always visible
//
TerminalDevice->SimpleTextOutputMode.CursorVisible = TRUE;
Status = TerminalDevice->SimpleTextOutput.SetAttribute (
&TerminalDevice->SimpleTextOutput,
EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)
);
if (EFI_ERROR (Status)) {
goto ReportError;
}
Status = TerminalDevice->SimpleTextOutput.Reset ( Status = TerminalDevice->SimpleTextOutput.Reset (
&TerminalDevice->SimpleTextOutput, &TerminalDevice->SimpleTextOutput,
FALSE FALSE

View File

@ -143,6 +143,8 @@ typedef union {
#define MODE0_COLUMN_COUNT 80 #define MODE0_COLUMN_COUNT 80
#define MODE0_ROW_COUNT 25 #define MODE0_ROW_COUNT 25
#define MODE1_COLUMN_COUNT 100
#define MODE1_ROW_COUNT 31
#define BACKSPACE 8 #define BACKSPACE 8
#define ESC 27 #define ESC 27
#define CSI 0x9B #define CSI 0x9B

View File

@ -226,11 +226,11 @@ TerminalConOutOutputString (
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This); TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
// //
// get current display mode // Get current display mode
// Terminal driver only support mode 0
// //
Mode = This->Mode; Mode = This->Mode;
if (Mode->Mode != 0) {
if (Mode->Mode > 1) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -464,15 +464,17 @@ TerminalConOutQueryMode (
--*/ --*/
{ {
if (This->Mode->MaxMode > 1) { if (This->Mode->MaxMode > 2) {
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }
if (ModeNumber == 0) { if (ModeNumber == 0) {
*Columns = MODE0_COLUMN_COUNT; *Columns = MODE0_COLUMN_COUNT;
*Rows = MODE0_ROW_COUNT; *Rows = MODE0_ROW_COUNT;
return EFI_SUCCESS;
} else if (ModeNumber == 1) {
*Columns = MODE1_COLUMN_COUNT;
*Rows = MODE1_ROW_COUNT;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -521,11 +523,14 @@ TerminalConOutSetMode (
// //
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This); TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
if (ModeNumber != 0) { if (ModeNumber > 1) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
This->Mode->Mode = 0; //
// Set the current mode
//
This->Mode->Mode = (INT32) ModeNumber;
This->ClearScreen (This); This->ClearScreen (This);
@ -537,7 +542,7 @@ TerminalConOutSetMode (
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }
This->Mode->Mode = 0; This->Mode->Mode = (INT32) ModeNumber;
Status = This->ClearScreen (This); Status = This->ClearScreen (This);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {