From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web08.3014.1605583029268007512 for ; Mon, 16 Nov 2020 19:17:11 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 17 Nov 2020 11:17:03 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: "'Heng Luo'" , Cc: "'Eric Dong'" , "'Chasel Chiu'" , "'Nate DeSimone'" References: <20201116013124.1983-1-heng.luo@intel.com> <20201116013124.1983-3-heng.luo@intel.com> In-Reply-To: <20201116013124.1983-3-heng.luo@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUGF0Y2ggVjcgMy8zXSBNaW5QbGF0Zm9ybVBrZzogQWRkIFNlcmlhbFBvcnRUZXJtaW5hbExpYiB0byBzdXBvcnQgU2VyaWFsIFRlcm1pbmFsIGZlYXR1cmU=?= Date: Tue, 17 Nov 2020 11:17:03 +0800 Message-ID: <008501d6bc90$1f4052b0$5dc0f810$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJaa6Rrx7SzUV3uud1hjopkywRPdAH+pbHjqLRTPoA= Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Heng: Thanks for your update. This version is good to me. Reviewed-by: = Liming Gao Besides, please let me know your test case for this case.=20 Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: Heng Luo > =B7=A2=CB=CD=CA=B1=BC=E4: 2020=C4=EA11=D4=C216=C8=D5 9:31 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Eric Dong ; Chasel Chiu > ; Nate DeSimone = ; > Liming Gao > =D6=F7=CC=E2: [Patch V7 3/3] MinPlatformPkg: Add SerialPortTerminalLib = to suport > Serial Terminal feature >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3014 >=20 > 1. Add SerialPortTerminalLib to MinPlatformPkg/Library. > 2. Add SerialPortTerminalLib to BdsDxe driver, to add the serial = device to > ConIn and ConOut variables > 3. Include SerialDxe and TerminalDxe to CoreDxeInclude.dsc and > CoreUefiBootInclude.fdf. >=20 > Cc: Eric Dong > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Liming Gao > Signed-off-by: Heng Luo > --- > Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc > | 15 +++++++++++++-- > Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf > | 8 +++++++- >=20 > Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTer= mi > nalLib.c | 102 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++ >=20 > Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTer= mi > nalLib.h | 34 ++++++++++++++++++++++++++++++++++ >=20 > Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTer= mi > nalLib.inf | 40 ++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 196 insertions(+), 3 deletions(-) >=20 > diff --git = a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc > b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc > index f0e578f8cc..1038a29c5c 100644 > --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc > +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreDxeInclude.dsc > @@ -1,7 +1,7 @@ > ## @file >=20 > # Platform description. >=20 > # >=20 > -# Copyright (c) 2017 - 2019, Intel Corporation. All rights = reserved.
>=20 > +# Copyright (c) 2017 - 2020, Intel Corporation. All rights = reserved.
>=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > @@ -46,7 +46,18 @@ >=20 >=20 >=20 > MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounte > rRuntimeDxe.inf >=20 >=20 >=20 > - MdeModulePkg/Universal/BdsDxe/BdsDxe.inf >=20 > + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { >=20 > + >=20 > +!if gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable =3D=3D TRUE >=20 > + > = NULL|MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.i= n > f >=20 > +!endif >=20 > + } >=20 > + >=20 > +!if gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable =3D=3D TRUE >=20 > + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf >=20 > + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf >=20 > +!endif >=20 > + >=20 >=20 > MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerD > xe.inf >=20 > MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { >=20 > >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf > b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf > index 7859c0b1a5..ef4576eedf 100644 > --- = a/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf > +++ = b/Platform/Intel/MinPlatformPkg/Include/Fdf/CoreUefiBootInclude.fdf > @@ -1,7 +1,7 @@ > ## @file >=20 > # FDF file of Platform. >=20 > # >=20 > -# Copyright (c) 2017 - 2019, Intel Corporation. All rights = reserved.
>=20 > +# Copyright (c) 2017 - 2020, Intel Corporation. All rights = reserved.
>=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > @@ -26,6 +26,12 @@ INF > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf > INF > MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounte > rRuntimeDxe.inf >=20 >=20 >=20 > INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf >=20 > + >=20 > +!if gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable =3D=3D TRUE >=20 > +INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf >=20 > +INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf >=20 > +!endif >=20 > + >=20 > INF > MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerD > xe.inf >=20 > INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf >=20 > INF > MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.c > b/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.c > new file mode 100644 > index 0000000000..66e8ee018b > --- /dev/null > +++ > b/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.c > @@ -0,0 +1,102 @@ > +/** @file >=20 > + Main file for NULL named library for Serial Port Terminal = Redirection > library. >=20 > + >=20 > + Copyright (c) 2020, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include "SerialPortTerminalLib.h" >=20 > + >=20 > +GLOBAL_REMOVE_IF_UNREFERENCED SERIAL_DEVICE_PATH > mSerialDevicePath =3D { >=20 > + { >=20 > + { >=20 > + HARDWARE_DEVICE_PATH, >=20 > + HW_VENDOR_DP, >=20 > + { >=20 > + (UINT8) sizeof (VENDOR_DEVICE_PATH), >=20 > + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) >=20 > + } >=20 > + }, >=20 > + EDKII_SERIAL_PORT_LIB_VENDOR_GUID >=20 > + }, >=20 > + { >=20 > + { >=20 > + MESSAGING_DEVICE_PATH, >=20 > + MSG_UART_DP, >=20 > + { >=20 > + (UINT8) sizeof (UART_DEVICE_PATH), >=20 > + (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) >=20 > + } >=20 > + }, >=20 > + 0, // Reserved >=20 > + 0, // BaudRate >=20 > + 0, // DataBits >=20 > + 0, // Parity >=20 > + 0 // StopBits >=20 > + }, >=20 > + { >=20 > + { >=20 > + MESSAGING_DEVICE_PATH, >=20 > + MSG_VENDOR_DP, >=20 > + { >=20 > + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), >=20 > + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8), >=20 > + } >=20 > + }, >=20 > + DEVICE_PATH_MESSAGING_PC_ANSI >=20 > + }, >=20 > + gEndEntire >=20 > +}; >=20 > + >=20 > +/** >=20 > + Updates the ConOut, ConIn, ErrOut variables with the serial = terminal > device path >=20 > + @param none >=20 > + @retval none >=20 > +**/ >=20 > +VOID >=20 > +AddSerialTerminal ( >=20 > + VOID >=20 > + ) >=20 > +{ >=20 > + DEBUG ((DEBUG_INFO, "[AddSerialPortTerminal]\n")); >=20 > + >=20 > + // >=20 > + // Append Serial Terminal into "ConIn" >=20 > + // >=20 > + EfiBootManagerUpdateConsoleVariable (ConOut, > (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); >=20 > + EfiBootManagerUpdateConsoleVariable (ConIn, > (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); >=20 > + EfiBootManagerUpdateConsoleVariable (ErrOut, > (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL); >=20 > +} >=20 > + >=20 > + >=20 > +/** >=20 > + Constructor for the Serial Port Device controller library. >=20 > + >=20 > + @param ImageHandle the image handle of the process >=20 > + @param SystemTable the EFI System Table pointer >=20 > + >=20 > + @retval EFI_SUCCESS the shell command handlers were > installed sucessfully >=20 > + @retval EFI_UNSUPPORTED the shell level required was not found. >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +SerialPortTerminalLibConstructor ( >=20 > + IN EFI_HANDLE ImageHandle, >=20 > + IN EFI_SYSTEM_TABLE *SystemTable >=20 > + ) >=20 > +{ >=20 > + mSerialDevicePath.Uart.BaudRate =3D = PcdGet64(PcdUartDefaultBaudRate); >=20 > + mSerialDevicePath.Uart.DataBits =3D = PcdGet8(PcdUartDefaultDataBits); >=20 > + mSerialDevicePath.Uart.Parity =3D PcdGet8(PcdUartDefaultParity); >=20 > + mSerialDevicePath.Uart.StopBits =3D = PcdGet8(PcdUartDefaultStopBits); >=20 > + DEBUG ((DEBUG_INFO, "[SerialPortTerminalLibConstructor] > [%d, %d, %d, %d]\n", >=20 > + mSerialDevicePath.Uart.BaudRate, >=20 > + mSerialDevicePath.Uart.DataBits, >=20 > + mSerialDevicePath.Uart.Parity, >=20 > + mSerialDevicePath.Uart.StopBits)); >=20 > + >=20 > + AddSerialTerminal(); >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.h > b/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.h > new file mode 100644 > index 0000000000..bfa73cca7d > --- /dev/null > +++ > b/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.h > @@ -0,0 +1,34 @@ > +/** @file >=20 > + Header file for NULL named library for for Serial Port Terminal Redirection > library. >=20 > + >=20 > + Copyright (c) 2020, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef _SERIAL_PORT_TERMINAL_LIB_H_ >=20 > +#define _SERIAL_PORT_TERMINAL_LIB_H_ >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +// >=20 > +// Below is the platform console device path >=20 > +// >=20 > +typedef struct { >=20 > + VENDOR_DEVICE_PATH Guid; >=20 > + UART_DEVICE_PATH Uart; >=20 > + VENDOR_DEVICE_PATH TerminalType; >=20 > + EFI_DEVICE_PATH_PROTOCOL End; >=20 > +} SERIAL_DEVICE_PATH; >=20 > + >=20 > +#define gEndEntire \ >=20 > + { \ >=20 > + END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, > { END_DEVICE_PATH_LENGTH, 0 } \ >=20 > + } >=20 > + >=20 > +#endif >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.inf > b/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.inf > new file mode 100644 > index 0000000000..2d95fe79f2 > --- /dev/null > +++ > b/Platform/Intel/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortT= er > minalLib.inf > @@ -0,0 +1,40 @@ > +## @file >=20 > +# Component information file for Serial Port Terminal Redirection = Library >=20 > +# >=20 > +# INTEL CONFIDENTIAL >=20 > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010006 >=20 > + BASE_NAME =3D SerialPortTerminalLib >=20 > + FILE_GUID =3D > E12BFA46-95F2-4ADC-9774-7E38DE78741E >=20 > + MODULE_TYPE =3D UEFI_DRIVER >=20 > + VERSION_STRING =3D 1.2 >=20 > + LIBRARY_CLASS =3D NULL|UEFI_DRIVER DXE_DRIVER > DXE_RUNTIME_DRIVER >=20 > + CONSTRUCTOR =3D > SerialPortTerminalLibConstructor >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + BoardModulePkg/BoardModulePkg.dec >=20 > + MinPlatformPkg/MinPlatformPkg.dec >=20 > + >=20 > +[Sources] >=20 > + SerialPortTerminalLib.c >=20 > + SerialPortTerminalLib.h >=20 > + >=20 > +[LibraryClasses] >=20 > + DevicePathLib >=20 > + DebugLib >=20 > + UefiDriverEntryPoint >=20 > + UefiBootManagerLib >=20 > + UefiLib >=20 > + >=20 > +[Pcd] >=20 > + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate >=20 > + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits >=20 > + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity >=20 > + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits >=20 > -- > 2.24.0.windows.2