From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E1B1121A1099A for ; Sun, 26 Nov 2017 17:49:00 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2017 17:53:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,462,1505804400"; d="scan'208";a="6235617" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 26 Nov 2017 17:53:21 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 26 Nov 2017 17:53:21 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Mon, 27 Nov 2017 09:53:20 +0800 From: "Zeng, Star" To: Julien Grall , "Dong, Eric" , "pankaj.bansal@nxp.com" , "lersek@redhat.com" , "leif.lindholm@linaro.org" CC: "edk2-devel@lists.01.org" , "Zeng, Star" Thread-Topic: [PATCH v2 3/3] MdeModulePkg/SerialDxe: Do not fail reset when SetAttributes is not supported Thread-Index: AQHTZUAy9Fa46drviEquwX/HDu/K2aMnekJw Date: Mon, 27 Nov 2017 01:53:19 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9BC1B0@shsmsx102.ccr.corp.intel.com> References: <20171124162030.31156-1-julien.grall@linaro.org> <20171124162030.31156-4-julien.grall@linaro.org> In-Reply-To: <20171124162030.31156-4-julien.grall@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2 3/3] MdeModulePkg/SerialDxe: Do not fail reset when SetAttributes is not supported X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 01:49:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Typos in commit log? Propated -> propagated Instropecting -> introspecting Thanks, Star -----Original Message----- From: Julien Grall [mailto:julien.grall@linaro.org]=20 Sent: Saturday, November 25, 2017 12:21 AM To: Zeng, Star ; Dong, Eric ; pan= kaj.bansal@nxp.com; lersek@redhat.com; leif.lindholm@linaro.org Cc: edk2-devel@lists.01.org; Julien Grall Subject: [PATCH v2 3/3] MdeModulePkg/SerialDxe: Do not fail reset when SetA= ttributes is not supported After commit 91cc526b15 "MdeModulePkg/SerialDxe: Fix not able to change serial attributes", serial is initialized using the reset method that will call SetAttributes. However, SetAttributes may return EFI_INVALID_PARAMETER when a driver does not support some parameters. This will be propated by the reset function and lead to UEFI failing to get the console setup. For instance, this is the case when using the Xen console driver. Fix it by instropecting the result and return EFI_SUCCESS when the SetAttributes report an invalid parameter (i.e EFI_INVALID_PARAMETER). Contributed-under: Tianocore Contribution Agreement 1.1 Signed-off-by: Julien Grall --- MdeModulePkg/Universal/SerialDxe/SerialIo.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MdeModulePkg/Universal/SerialDxe/SerialIo.c b/MdeModulePkg/Uni= versal/SerialDxe/SerialIo.c index 08b95a4a33..53d2785fed 100644 --- a/MdeModulePkg/Universal/SerialDxe/SerialIo.c +++ b/MdeModulePkg/Universal/SerialDxe/SerialIo.c @@ -239,6 +239,15 @@ SerialReset ( (EFI_STOP_BITS_TYPE) This->Mode->StopBits ); =20 + // + // The serial device may not support some of the attributes. To prevent + // later failure, always return EFI_SUCCESS when SetAttributes is return= ing + // EFI_INVALID_PARAMETER. + // + if (Status =3D=3D EFI_INVALID_PARAMETER) { + return EFI_SUCCESS; + } + return Status; } =20 --=20 2.11.0