summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Console/TerminalDxe
diff options
context:
space:
mode:
authorHeyi Guo <heyi.guo@linaro.org>2015-07-16 08:50:43 +0000
committerabiesheuvel <abiesheuvel@Edk2>2015-07-16 08:50:43 +0000
commitcf1e634b4b2b153a01e06cdb63d822c0b7ae7c42 (patch)
tree07bdb53b7b20fdac37e19d19730e53b9f61441f3 /MdeModulePkg/Universal/Console/TerminalDxe
parentf8fdf8cd0a4856f2af3837b22a230ff75ca3ce93 (diff)
downloadedk2-platforms-cf1e634b4b2b153a01e06cdb63d822c0b7ae7c42.tar.xz
MdeModulePkg/TerminalDxe: Some improvements
1. Get default terminal type from PCD rather than using PCANSI directly in BuildTeminalDevpath; 2. Only terminal type is needed to create an TerminalDev instance, so remove the useless code of creating and freeing DefaultNode. 3. Some white space refining. Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18027 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Console/TerminalDxe')
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index 75bfdec5da..6fde3b2c7a 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -258,14 +258,13 @@ BuildTerminalDevpath (
EFI_STATUS Status;
TerminalDevicePath = NULL;
- TerminalType = PCANSITYPE;
//
// Use the RemainingDevicePath to determine the terminal type
//
Node = (VENDOR_DEVICE_PATH *) RemainingDevicePath;
if (Node == NULL) {
- TerminalType = PCANSITYPE;
+ TerminalType = PcdGet8 (PcdDefaultTerminalType);
} else if (CompareGuid (&Node->Guid, &gEfiPcAnsiGuid)) {
@@ -545,7 +544,6 @@ TerminalDriverBindingStart (
EFI_SERIAL_IO_PROTOCOL *SerialIo;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
VENDOR_DEVICE_PATH *Node;
- VENDOR_DEVICE_PATH *DefaultNode;
EFI_SERIAL_IO_MODE *Mode;
UINTN SerialInTimeOut;
TERMINAL_DEV *TerminalDevice;
@@ -565,9 +563,8 @@ TerminalDriverBindingStart (
UINTN ModeCount;
TerminalDevice = NULL;
- DefaultNode = NULL;
- ConInSelected = FALSE;
- ConOutSelected = FALSE;
+ ConInSelected = FALSE;
+ ConOutSelected = FALSE;
NullRemaining = FALSE;
SimTxtInInstalled = FALSE;
SimTxtOutInstalled = FALSE;
@@ -709,23 +706,14 @@ TerminalDriverBindingStart (
}
//
- // If RemainingDevicePath is NULL, then create default device path node
+ // If RemainingDevicePath is NULL, use default terminal type
//
if (RemainingDevicePath == NULL) {
- DefaultNode = AllocateZeroPool (sizeof (VENDOR_DEVICE_PATH));
- if (DefaultNode == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
-
TerminalType = PcdGet8 (PcdDefaultTerminalType);
//
// Must be between PCANSITYPE (0) and TTYTERMTYPE (4)
//
ASSERT (TerminalType <= TTYTERMTYPE);
-
- CopyMem (&DefaultNode->Guid, gTerminalType[TerminalType], sizeof (EFI_GUID));
- RemainingDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) DefaultNode;
} else if (!IsDevicePathEnd (RemainingDevicePath)) {
//
// If RemainingDevicePath isn't the End of Device Path Node,
@@ -1183,9 +1171,6 @@ TerminalDriverBindingStart (
goto Error;
}
}
- if (DefaultNode != NULL) {
- FreePool (DefaultNode);
- }
return EFI_SUCCESS;
@@ -1254,10 +1239,6 @@ Error:
}
}
- if (DefaultNode != NULL) {
- FreePool (DefaultNode);
- }
-
This->Stop (This, Controller, 0, NULL);
return Status;