From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 5154121D046CA for ; Mon, 18 Sep 2017 03:09:08 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2017 03:12:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,412,1500966000"; d="scan'208";a="150358008" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 18 Sep 2017 03:12:03 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 03:12:02 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 03:12:02 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Mon, 18 Sep 2017 18:12:00 +0800 From: "Zeng, Star" To: Pankaj Bansal , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [edk2] [PATCH v2] MdeModulePkg/SerialDxe: Fix not able to change serial attributes Thread-Index: AQHTMFGbbB90nzvDnEW3q+qgCT4hSKK6a/aQ Date: Mon, 18 Sep 2017 10:11:59 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B970A8B@shsmsx102.ccr.corp.intel.com> References: <1505720565-28495-1-git-send-email-pankaj.bansal@nxp.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: Mon, 18 Sep 2017 10:09:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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