From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.3677.1603329809292840694 for ; Wed, 21 Oct 2020 18:23:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=gFlcYIrC; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: eric.dong@intel.com) IronPort-SDR: 23FUCciiFhYwV9Mb/wDcsMDhHUiVMcCTdB0HqGQmVj/ty3+Yy3pbcWqhx8x1dVYaLTNOyFJa+x mESJHZzXGEzQ== X-IronPort-AV: E=McAfee;i="6000,8403,9781"; a="164863027" X-IronPort-AV: E=Sophos;i="5.77,402,1596524400"; d="scan'208";a="164863027" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2020 18:23:27 -0700 IronPort-SDR: zwdPEcC0NG9RVmn4+SFqlvDxUtufTEMdIZUPqawbQGiY17ljDKzoQd6revXKmVL8SRdRTiMMfD T/9xNNDRcsHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,402,1596524400"; d="scan'208";a="533751691" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga005.jf.intel.com with ESMTP; 21 Oct 2020 18:23:27 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 21 Oct 2020 18:23:26 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 21 Oct 2020 18:23:26 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 21 Oct 2020 18:23:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aKz6UkifnjF77qz+pHJLX3RngTRSZhjt2qwVLFv43Yjtz1jltNBO/rkKPSc07PneqAimftXyIYjAwnJIx2kZYspWONOBLsUbLNVWj8xUy2jUvSuelU1izmsnAYXBrbaDR28VZS4CDdMhPueWLXZ+4rfVmfD8Ixxh2cP3UvMgrlqa3j9Cam5aD+rICV0Q4q1QYQxB8Rn76ZvYiErkj4lJlO3zOhqfSZMBO3yL6ugD9eoIl6gNEFwhVvz2GEahQbRQ/ji2xUMmrQd3A4M2FvV77YrSExGqix1Guvxl4IR35uJxnEkLCPQaqSlUFrRE7MbURUWuZwNow2yNvdQDKCjWDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u4wVaf2yY6JvARRkmTcPDXfG24LyN0BquYHkCtO5zWY=; b=Eonzx4ViNIVRcbUJDVM5G0cOQn9hONwWj4ImaABJ/F3V70sRfz3CY6fJvGpXwY5xPfxKT//fZoJMJvGWlPOOa1qIvLFNeIt2PxHAl98wE8qkQKZJqbgr3weWCETRLlapOBS3+N1mduClZ7yTO7C0lvyb122GvfFx6wafwkAKIvq44b+OGQQ7MLf0TnmuI8ZYNw659Wt+2LwpX9YsjNI9vdNKe14JyfTq6vlXmepwhs548z+/du/9DfLwRV34Q7F9ye1D8Rc405n4Kn7y+8ZXS67HrDG5VkBlG1EttyQWpxbD5ei2O1Sxzgmubp/eY3KzxJVJwqOTDtMJ58httCGtcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u4wVaf2yY6JvARRkmTcPDXfG24LyN0BquYHkCtO5zWY=; b=gFlcYIrChBgTfssdRGRhT3OStZ0wAGjq8epmbtIgUXA+rZ85iCNqANRuDPfrTI+ri3W6IWqIp12JHAYIaFcokYsW6JHsN4PFAPNWoKDqshPlCpTwZ77DmDeKjJwDdQKhL1d9io4/HBeu6Hhd0z8K5wSA8CInFsxJ4iR2y6VFi0I= Received: from CY4PR11MB1272.namprd11.prod.outlook.com (2603:10b6:903:29::9) by CY4PR1101MB2277.namprd11.prod.outlook.com (2603:10b6:910:1a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 22 Oct 2020 01:23:15 +0000 Received: from CY4PR11MB1272.namprd11.prod.outlook.com ([fe80::5cb2:9510:d640:fa56]) by CY4PR11MB1272.namprd11.prod.outlook.com ([fe80::5cb2:9510:d640:fa56%4]) with mapi id 15.20.3499.018; Thu, 22 Oct 2020 01:23:15 +0000 From: "Dong, Eric" To: "Luo, Heng" , "devel@edk2.groups.io" CC: "Chiu, Chasel" , "Desimone, Nathaniel L" Subject: Re: [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib Thread-Topic: [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib Thread-Index: AQHWpofRgHd9P0fqtEKLe5ipCR5B8ami1lpQ Date: Thu, 22 Oct 2020 01:23:15 +0000 Message-ID: References: <20201020022144.2261-1-heng.luo@intel.com> <20201020022144.2261-2-heng.luo@intel.com> In-Reply-To: <20201020022144.2261-2-heng.luo@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0080e433-6528-4c2d-e56b-08d876290cd0 x-ms-traffictypediagnostic: CY4PR1101MB2277: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wJqzgylPo6TGDZPQTxgKCSZDuwoIK9s+b18DiWjaUlmcYIRG3fqphzL2AhDz/UY7kQ60eX8M1mYegXtKQSex+u0vKKipaYL3D19JTcRyAWrVkbGsuKn57diOYxU/5eR7VAd3wL0YHqNBH4zwJ1uVTTwhhzzQKZT0RnPOccOW7aQ+qEgUIz1CHxPW2H6MLP2f1SsXjgRynDFJVHXlXasn+eyvOM11Rco7UKg7Te1bnFoSyS8/wveJ2JoeCHFZwhHLJZuA/HlDP2jnSatDfovBnRXce7jbg7YtiK7tr6vlbw5i6AQKOuXK9uYgPmGfvLhYQO3aY/6Ryk2sfCoN8jkRJILIwzfYGpHwn+5ho5EWfyKVSCRcZf2ObfmHqKWtzXg5cVzZdB+b1h+LKno06EqeyA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR11MB1272.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(346002)(39860400002)(376002)(366004)(136003)(66446008)(66556008)(64756008)(7696005)(186003)(66476007)(966005)(76116006)(83380400001)(52536014)(8676002)(66946007)(71200400001)(55016002)(9686003)(110136005)(5660300002)(478600001)(53546011)(86362001)(4326008)(26005)(33656002)(107886003)(54906003)(2906002)(316002)(6506007)(8936002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: FNACUVEvMTR6cmYFpmZ6MyFsAbl6RzcCyf+2H3z3Cqxqeu3nCs8VI4nq/Q1cMA/S3FTBtuFsGqDwtC6ovBV7T25lxJS5O640dUShgkL7P4TjOngTVtu5shWkFuwuCL/Hk/dRldIUU9Ud6xkSXfsyDZPcdqtgN7LsJ8UEriaM8/SipSWJCQLY/Sm+bT4WDPKAVDO1tjriuWNCV7zhpkTJbFTdJ76DzEXly+fb0sDQZf+phgAzFz1p8pmznCslrtLfXduDlpjvH69Zi6RhbP6rOKu5Ia9YKxdKpntQxey1wZaax9YkrsrburDtZYFf2cCxUURRn2tBeN7kuJL4lioW1r5KeayXGUs1EUWUjJW4myT3BYS+NbrDXBgjnykA/j/64qF7zrMUB8a7cXdm6kKncG0RnoCsY629WGOTlU56V9IOI/KXP5Ujx22YgEfCoGb4W4d25cggkeOCMCUg4aQ20ZtYZwtfeHI23O1UflG4v+Hj1/At0AsLq4hifRSaJlNvTx69oKmJD7DtdQzcYdSkqevSgMpnfB001zAJiEmJlKLnOYw99uLAJJ4W0AtlwgWnrd0pbNk9hUrY3PnkVMowSIYIBKdokAD9xmSSoMh9r4r7YG8n9DOES6KsTlBjZIteqBr5ZTJr6eJXAdh77EXZLw== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1272.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0080e433-6528-4c2d-e56b-08d876290cd0 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2020 01:23:15.1959 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vhlxsw/3qfaSLP8oWk5OLIS+4QToc+V7hErr/sVLuIJETeAjVN2cpFR/TksEKXonvgZEDDS8So80RANyan27wQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1101MB2277 Return-Path: eric.dong@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Heng, Seems like it is a common feature not related to board scope, I think Featu= res folder is a better place to hold it. Thanks, Eric -----Original Message----- From: Luo, Heng =20 Sent: Tuesday, October 20, 2020 10:22 AM To: devel@edk2.groups.io Cc: Dong, Eric ; Chiu, Chasel ;= Desimone, Nathaniel L Subject: [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3014 Add the serial port terminal library to get console redirect after the shell is loaded. Cc: Eric Dong Cc: Chasel Chiu Cc: Nate DeSimone Signed-off-by: Heng Luo --- Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerm= inalLib.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++ Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerm= inalLib.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerm= inalLib.inf | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 177 insertions(+) diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/Se= rialPortTerminalLib.c b/Platform/Intel/BoardModulePkg/Library/SerialPortTer= minalLib/SerialPortTerminalLib.c new file mode 100644 index 0000000000..36c0e7110f --- /dev/null +++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPor= tTerminalLib.c @@ -0,0 +1,93 @@ +/** @file + Main file for NULL named library for Serial Port Deviceboard controller = librarr. + + INTEL CONFIDENTIAL + Copyright (c) 2020, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SerialPortTerminalLib.h" + +GLOBAL_REMOVE_IF_UNREFERENCED SERIAL_DEVICE_PATH mSerialDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) sizeof (VENDOR_DEVICE_PATH), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + EDKII_SERIAL_PORT_LIB_VENDOR_GUID + }, + { + { + MESSAGING_DEVICE_PATH, + MSG_UART_DP, + { + (UINT8) sizeof (UART_DEVICE_PATH), + (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) + } + }, + 0, // Reserved + 115200, // BaudRate + 8, // DataBits + 1, // Parity + 1 // StopBits + }, + { + { + MESSAGING_DEVICE_PATH, + MSG_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8), + } + }, + DEVICE_PATH_MESSAGING_PC_ANSI + }, + gEndEntire +}; + +/** + Updates the ConOut, ConIn, ErrOut variables with the serial terminal dev= ice path + @param none + @retval none +**/ +VOID +AddSerialTerminal ( + VOID + ) +{ + DEBUG ((DEBUG_INFO, "[AddSerialPortTerminal]\n")); + + // + // Append Serial Terminal into "ConIn" + // + EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *= ) &mSerialDevicePath, NULL); + EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *)= &mSerialDevicePath, NULL); + EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *= ) &mSerialDevicePath, NULL); +} + + +/** + Constructor for the Serial Port Device controller library. + + @param ImageHandle the image handle of the process + @param SystemTable the EFI System Table pointer + + @retval EFI_SUCCESS the shell command handlers were installed suc= essfully + @retval EFI_UNSUPPORTED the shell level required was not found. +**/ +EFI_STATUS +EFIAPI +SerialPortTerminalLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + AddSerialTerminal(); + + return EFI_SUCCESS; +} diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/Se= rialPortTerminalLib.h b/Platform/Intel/BoardModulePkg/Library/SerialPortTer= minalLib/SerialPortTerminalLib.h new file mode 100644 index 0000000000..afb3eb2cb3 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPor= tTerminalLib.h @@ -0,0 +1,49 @@ +/** @file + Header file for NULL named library for Ps2 keyboard controller library. + + INTEL CONFIDENTIAL + Copyright (c) 2020, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PS2_KBC_LIB_H +#define _PS2_KBC_LIB_H + +#include +#include +#include +#include +#include +#include + +// +// Below is the platform console device path +// +typedef struct { + VENDOR_DEVICE_PATH Guid; + UART_DEVICE_PATH Uart; + VENDOR_DEVICE_PATH TerminalType; + EFI_DEVICE_PATH_PROTOCOL End; +} SERIAL_DEVICE_PATH; + +#define gPciRootBridge \ + { \ + { \ + ACPI_DEVICE_PATH, \ + ACPI_DP, \ + { \ + (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \ + (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \ + }, \ + }, \ + EISA_PNP_ID (0x0A03), \ + 0 \ + } + +#define gEndEntire \ + { \ + END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { END_DEVICE_PAT= H_LENGTH, 0 } \ + } + +#endif diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/Se= rialPortTerminalLib.inf b/Platform/Intel/BoardModulePkg/Library/SerialPortT= erminalLib/SerialPortTerminalLib.inf new file mode 100644 index 0000000000..4f63d1626f --- /dev/null +++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPor= tTerminalLib.inf @@ -0,0 +1,35 @@ +## @file +# Component information file for Serial Port Terminal Redirection Library +# +# INTEL CONFIDENTIAL +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## +[Defines] + INF_VERSION =3D 0x00010006 + BASE_NAME =3D SerialPortTerminalLib + FILE_GUID =3D E12BFA46-95F2-4ADC-9774-7E38DE78741E + MODULE_TYPE =3D UEFI_DRIVER + VERSION_STRING =3D 1.2 + LIBRARY_CLASS =3D NULL|UEFI_DRIVER + CONSTRUCTOR =3D SerialPortTerminalLibConstructor + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + BoardModulePkg/BoardModulePkg.dec + +[Sources] + SerialPortTerminalLib.c + SerialPortTerminalLib.h + +[LibraryClasses] + DevicePathLib + DebugLib + UefiDriverEntryPoint + UefiBootManagerLib + UefiLib + +[Pcd] --=20 2.24.0.windows.2