From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 8E16821D046AC for ; Mon, 18 Sep 2017 20:19:03 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 18 Sep 2017 20:22:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,415,1500966000"; d="scan'208";a="1015927616" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 18 Sep 2017 20:22:06 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 20:22:06 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 20:22:06 -0700 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; Tue, 19 Sep 2017 11:22:04 +0800 From: "Zeng, Star" To: Pankaj Bansal , "edk2-devel@lists.01.org" CC: "Laszlo Ersek (lersek@redhat.com)" , "Zeng, Star" Thread-Topic: [edk2] [PATCH v2] MdeModulePkg/SerialDxe: Fix not able to change serial attributes Thread-Index: AQHTMFGbbB90nzvDnEW3q+qgCT4hSKK6a/aQgAEIzHD//4yogIAAipwQ Date: Tue, 19 Sep 2017 03:22:03 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B972EF0@shsmsx102.ccr.corp.intel.com> References: <1505720565-28495-1-git-send-email-pankaj.bansal@nxp.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B970A8B@shsmsx102.ccr.corp.intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B972E6E@shsmsx102.ccr.corp.intel.com> In-Reply-To: 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 03:19:03 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pushed at 91cc526b15ffbbbdec5a57906596f37e059f80be :) -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Pank= aj Bansal Sent: Tuesday, September 19, 2017 11:05 AM To: Zeng, Star ; edk2-devel@lists.01.org Cc: Laszlo Ersek (lersek@redhat.com) Subject: Re: [edk2] [PATCH v2] MdeModulePkg/SerialDxe: Fix not able to chan= ge serial attributes Hi Zeng, Thanks for suggestion. I agree, that this looks nicer and gives more details. Please push the patch with comment updates and signatures as you have menti= oned. Thanks & Regards, Pankaj Bansal -----Original Message----- From: Zeng, Star [mailto:star.zeng@intel.com] Sent: Tuesday, September 19, 2017 8:30 AM To: Pankaj Bansal ; edk2-devel@lists.01.org Cc: Zeng, Star ; Laszlo Ersek (lersek@redhat.com) Subject: RE: [edk2] [PATCH v2] MdeModulePkg/SerialDxe: Fix not able to chan= ge serial attributes 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 def= ault 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 caus= es 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 Se= rialSetAttributes. Cause : The SerialReset command resets the attributes' values to default. Fix : Serial Reset command should set the attributes which have been change= d 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: L= aszlo Ersek . Thanks, Star -----Original Message----- From: Zeng, Star 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel