From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 A38FC21D046AC for ; Mon, 18 Sep 2017 19:57:15 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2017 20:00:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,415,1500966000"; d="scan'208";a="313579384" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 18 Sep 2017 20:00:18 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 20:00:18 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 20:00:18 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Tue, 19 Sep 2017 11:00:16 +0800 From: "Zeng, Star" To: Pankaj Bansal , "edk2-devel@lists.01.org" CC: "Zeng, Star" , "Laszlo Ersek (lersek@redhat.com)" Thread-Topic: [edk2] [PATCH v2] MdeModulePkg/SerialDxe: Fix not able to change serial attributes Thread-Index: AQHTMFGbbB90nzvDnEW3q+qgCT4hSKK6a/aQgAEIzHA= Date: Tue, 19 Sep 2017 03:00:15 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B972E6E@shsmsx102.ccr.corp.intel.com> References: <1505720565-28495-1-git-send-email-pankaj.bansal@nxp.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B970A8B@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B970A8B@shsmsx102.ccr.corp.intel.com> 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] MdeModulePkg/SerialDxe: Fix not able to change serial attributes 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: Tue, 19 Sep 2017 02:57:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pankaj, Thanks for your explanation at https://lists.01.org/pipermail/edk2-devel/20= 17-September/014832.html about the execute flow to reproduce the issue. How about also include the explanation to the commit log like below? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Issue : When try to change serial attributes using sermode command, the default values are set with the execute flow as below. The sermode command calls SerialSetAttributes, which sets H/W attributes of Serial device. After that the SerialIo protocol is reinstalled, which causes MdeModulePkg/Universal/Console/TerminalDxe and MdeModulePkg/Universal/Console/ConPlatformDxe drivers' bindings to stop and then start. This in turn calls SerialReset, which undoes changes of SerialSetAttributes. Cause : The SerialReset command resets the attributes' values to default. Fix : Serial Reset command should set the attributes which have been changed by user after calling SerialSetAttributes. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Another minor comment, how about update "COM port" to be "Serial Port" in t= he change? If you agree with above comments, you do not need to send an update patch a= nd I will help push the patch with the updates I comment above and Reviewed-by= : Star Zeng , and of course Regression-tested-by: Laszlo Ersek . Thanks, Star -----Original Message----- From: Zeng, Star=20 Sent: Monday, September 18, 2017 6:12 PM To: Pankaj Bansal ; edk2-devel@lists.01.org Cc: Zeng, Star Subject: RE: [edk2] [PATCH v2] MdeModulePkg/SerialDxe: Fix not able to chan= ge serial attributes Pankaj, Thanks for the update. I raised a question in the V1 patch review, could you help kindly provide t= he feedback? "how you reproduce the issue by sermode command as I see sermode command on= ly calls SerialIo->SetAttributes() but not SerialIo->Reset()" Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Pank= aj Bansal Sent: Monday, September 18, 2017 3:43 PM To: edk2-devel@lists.01.org Cc: Pankaj Bansal Subject: [edk2] [PATCH v2] MdeModulePkg/SerialDxe: Fix not able to change s= erial attributes Issue : When try to change serial attributes using sermode command, the def= ault values are set Cause : The SerialReset command resets the attributes' = values to default Fix : Serial Reset command should set the attributes whic= h have been changed by user after calling SerialSetAttributes. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pankaj Bansal --- Changes in v2: - Modified Patch description MdeModulePkg/Universal/SerialDxe/SerialIo.c | 66 ++++++++-----------------= ---- 1 file changed, 18 insertions(+), 48 deletions(-) diff --git a/MdeModulePkg/Universal/SerialDxe/SerialIo.c b/MdeModulePkg/Uni= versal/SerialDxe/SerialIo.c index 43d33db..dc7e13a 100644 --- a/MdeModulePkg/Universal/SerialDxe/SerialIo.c +++ b/MdeModulePkg/Universal/SerialDxe/SerialIo.c @@ -220,7 +220,6 @@ SerialReset ( ) { EFI_STATUS Status; - EFI_TPL Tpl; =20 Status =3D SerialPortInitialize (); if (EFI_ERROR (Status)) { @@ -228,49 +227,17 @@ SerialReset ( } =20 // - // Set the Serial I/O mode and update the device path - // - - Tpl =3D gBS->RaiseTPL (TPL_NOTIFY); - - // - // Set the Serial I/O mode - // - This->Mode->ReceiveFifoDepth =3D PcdGet16 (PcdUartDefaultReceiveFifoDep= th); - This->Mode->Timeout =3D 1000 * 1000; - This->Mode->BaudRate =3D PcdGet64 (PcdUartDefaultBaudRate); - This->Mode->DataBits =3D (UINT32) PcdGet8 (PcdUartDefaultDataBi= ts); - This->Mode->Parity =3D (UINT32) PcdGet8 (PcdUartDefaultParity= ); - This->Mode->StopBits =3D (UINT32) PcdGet8 (PcdUartDefaultStopBi= ts); - - // - // Check if the device path has actually changed - // - if (mSerialDevicePath.Uart.BaudRate =3D=3D This->Mode->BaudRate && - mSerialDevicePath.Uart.DataBits =3D=3D (UINT8) This->Mode->DataBits = && - mSerialDevicePath.Uart.Parity =3D=3D (UINT8) This->Mode->Parity && - mSerialDevicePath.Uart.StopBits =3D=3D (UINT8) This->Mode->StopBits - ) { - gBS->RestoreTPL (Tpl); - return EFI_SUCCESS; - } - - // - // Update the device path + // Go set the current attributes // - mSerialDevicePath.Uart.BaudRate =3D This->Mode->BaudRate; - mSerialDevicePath.Uart.DataBits =3D (UINT8) This->Mode->DataBits; - mSerialDevicePath.Uart.Parity =3D (UINT8) This->Mode->Parity; - mSerialDevicePath.Uart.StopBits =3D (UINT8) This->Mode->StopBits; - - Status =3D gBS->ReinstallProtocolInterface ( - mSerialHandle, - &gEfiDevicePathProtocolGuid, - &mSerialDevicePath, - &mSerialDevicePath - ); - - gBS->RestoreTPL (Tpl); + Status =3D This->SetAttributes ( + This, + This->Mode->BaudRate, + This->Mode->ReceiveFifoDepth, + This->Mode->Timeout, + (EFI_PARITY_TYPE) This->Mode->Parity, + (UINT8) This->Mode->DataBits, + (EFI_STOP_BITS_TYPE) This->Mode->StopBits + ); =20 return Status; } @@ -513,11 +480,6 @@ SerialDxeInitialize ( { EFI_STATUS Status; =20 - Status =3D SerialPortInitialize (); - if (EFI_ERROR (Status)) { - return Status; - } - mSerialIoMode.BaudRate =3D PcdGet64 (PcdUartDefaultBaudRate); mSerialIoMode.DataBits =3D (UINT32) PcdGet8 (PcdUartDefaultDataBits); mSerialIoMode.Parity =3D (UINT32) PcdGet8 (PcdUartDefaultParity); @@ -529,6 +491,14 @@ SerialDxeInitialize ( mSerialDevicePath.Uart.StopBits =3D PcdGet8 (PcdUartDefaultStopBits); =20 // + // Issue a reset to initialize the COM port // Status =3D=20 + mSerialIoTemplate.Reset (&mSerialIoTemplate); if (EFI_ERROR (Status))=20 + { + return Status; + } + + // // Make a new handle with Serial IO protocol and its device path on it. // Status =3D gBS->InstallMultipleProtocolInterfaces ( -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel