From 802c39b03bdfddfea7c70545a9479d4418d5deaa Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Tue, 10 Jan 2017 13:17:35 +0800 Subject: MdeModulePkg/TerminalDxe: Refine SetTerminalDevicePath Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Star Zeng Reviewed-by: Feng Tian --- .../Universal/Console/TerminalDxe/Terminal.c | 41 ++-------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index 3b2e34f..129d7b3 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -1577,46 +1577,11 @@ SetTerminalDevicePath ( { VENDOR_DEVICE_PATH Node; - *TerminalDevicePath = NULL; + ASSERT (TerminalType < ARRAY_SIZE (mTerminalType)); Node.Header.Type = MESSAGING_DEVICE_PATH; Node.Header.SubType = MSG_VENDOR_DP; - - // - // Generate terminal device path node according to terminal type. - // - switch (TerminalType) { - - case TerminalTypePcAnsi: - CopyGuid (&Node.Guid, &gEfiPcAnsiGuid); - break; - - case TerminalTypeVt100: - CopyGuid (&Node.Guid, &gEfiVT100Guid); - break; - - case TerminalTypeVt100Plus: - CopyGuid (&Node.Guid, &gEfiVT100PlusGuid); - break; - - case TerminalTypeVtUtf8: - CopyGuid (&Node.Guid, &gEfiVTUTF8Guid); - break; - - case TerminalTypeTtyTerm: - CopyGuid (&Node.Guid, &gEfiTtyTermGuid); - break; - - default: - return EFI_UNSUPPORTED; - } - - // - // Get VENDOR_DEVCIE_PATH size and put into Node.Header - // - SetDevicePathNodeLength ( - &Node.Header, - sizeof (VENDOR_DEVICE_PATH) - ); + SetDevicePathNodeLength (&Node, sizeof (VENDOR_DEVICE_PATH)); + CopyGuid (&Node.Guid, mTerminalType[TerminalType]); // // Append the terminal node onto parent device path -- cgit v1.1