From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0051.outbound.protection.outlook.com [104.47.40.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 09DF121E74914 for ; Fri, 15 Sep 2017 06:08:53 -0700 (PDT) Received: from CY4PR03CA0105.namprd03.prod.outlook.com (10.171.242.174) by MWHPR03MB2701.namprd03.prod.outlook.com (10.168.207.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Fri, 15 Sep 2017 13:11:52 +0000 Received: from BY2FFO11FD039.protection.gbl (2a01:111:f400:7c0c::108) by CY4PR03CA0105.outlook.office365.com (2603:10b6:910:4d::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.8 via Frontend Transport; Fri, 15 Sep 2017 13:11:52 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD039.mail.protection.outlook.com (10.1.14.224) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.13.11 via Frontend Transport; Fri, 15 Sep 2017 13:11:52 +0000 Received: from uefi-workstation.ap.freescale.net (uefi-workstation.ap.freescale.net [10.232.14.83]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v8FDBnsS011945; Fri, 15 Sep 2017 06:11:50 -0700 From: Pankaj Bansal To: CC: Pankaj Bansal Date: Fri, 15 Sep 2017 18:43:43 +0530 Message-ID: X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131499547122112342; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7966004)(346002)(376002)(39860400002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(110136004)(498600001)(50226002)(4326008)(81166006)(47776003)(81156014)(8676002)(104016004)(53936002)(33646002)(2351001)(85426001)(6916009)(6666003)(48376002)(50466002)(5660300001)(77096006)(8936002)(2906002)(356003)(5003940100001)(50986999)(316002)(189998001)(305945005)(118296001)(16586007)(86362001)(68736007)(106466001)(105606002)(97736004)(8656003)(36756003)(44824005); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2701; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD039; 1:MTvGNVqkZae/o0bPsC3KkxD0cMDC5ZP7wA5aOXCYif/k2cMGoxVQ6PvKLgi4Nu/nylDHHEIa29ZEhbNkjC1uYjV+09HsZ0WhM7fJhXOAjV6f/VrrtR/XR7xgykkP/dv6 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b094e35-fa98-4901-9756-08d4fc3b54cd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:MWHPR03MB2701; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 3:jl41QyLJtSCcykAxPub+YNGnhUqrdXMgSToqLzOKY0v9XKLC3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CUhuv70bGIt39CNY2Qa1CuYn7TOSY5wF2WEoNKTKhHDuqd5I364Zps2p5H/4fuJDGPds6iUDAjSCuI8R3qWFWWH6i0KEULp66qkSC1Poj0XxT3zNCFRalBylMeSORn+nog5lSK0DekW1Tar/pajL8apB2nignD1fbsRBdLhVqko+UH3Qvm9ZhAZp6GxM= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123565025)(20161123563025)(20161123559100)(20161123561025)(20161123556025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR03MB2701; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR03MB2701; X-Forefront-PRVS: 0431F981D8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2701; 23:ODkX/QMJOZHxE21arsZgB6Yh4apVhYFsiGpYV8niT?= =?us-ascii?Q?WuY7HsVipMpxG+l9ndDaGKHixWUxj0RyLIrvFHyu8wv9op0JheAnTVfnqgRn?= =?us-ascii?Q?T9NNtcAH8zzX33mexRflX5SHjGpKcU7pOqRytyTQFpHeuj97rqDtviI2ohll?= =?us-ascii?Q?ySIxGSeleekhD49OoPDZai+qrKvsA9dgmBgQaNf8Gjv8RcovuvKESQ2vxw93?= =?us-ascii?Q?K+ZUywbGY43RzPvhXHk70D7TdohfzLCl1bV3YzLNUPrrp8mXe+iOHKaduUJd?= =?us-ascii?Q?mJiZQ3YlbwqEbHivEF/E07gm3qCr+fTE7+9jLGEnerA32seCRS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ange-Diagnostics: 1; MWHPR03MB2701; 6:PLDDnAv/WJa+NoAKUoSmDZHikyV8JIOp4XIR9Qld3FQoxbXKct/rugItcL3JBnvHcBdlc9wXHfn12y8Sd3yzFhJot8qKKpUqewoUuJj6iApv+GtRcI26TDUJKY7UB6yD/ISs3pohdQiCf+mGPiHp7IVU24Xip5mOQsofpAhrDHLs+jYHPaTT8XCmFcrpM07eVr7kKJP3Nm8IqvMlPVIv9RFSPwPKQ7A4BBMQGiH8NnBgFSpOmDxAfzN9mbQOL7hdr/sRhLX9WTgkekVx+8xPvQLiK/OY3nlmb850MuBY7Wsj6QenyA98bX+5UUqKIhz5GkA3Wgj1ofqVMErpaovEtA==; 5:7DAu7dFzYk0rMZj9Cp64Do/pd3Ux+Y7U7sQHhrKRsUVXihwtUtHEB3XPAJxNK0d/rNE2gqVi/42kckiVgxFPjgn6WdVhNf9Ho8yqx/prggG7JCDLN4hQ4y/Deb1Xpp0DonuB+cUlb3iYo87aMrqpuw==; 24:7jm7ertDnz17Pt8kzcnqtDA4tiQ85WaiQNd0zR6fth6zv74nx9qpqB+QLMW8PpSylWf9maUUQyfgyp/pHwO383Cm5niPK/lW7xXMn2rqikc=; 7:TbGDikeQdyOFVEnHYoFzmSZPBQIi4D1pVxGAmXGnP0/TSt6wkFy0aO+EQFwrVs+NMXYmvYyz8BvhNArsbAD5eAo6G8cyvFO3Cjn1MEFET3TbEdRNBMBRR42fggdKmfCCd5OUU36U/IfOK16vm/sWFqJgmt0nuFSYL1agV/MMYdVExCgUUyHVe9Q6Su7xQcg8dO5LWOKU3sSpvgxnlxhraGAgfpAxQJdhQG7x4eMCX/M= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2017 13:11:52.0240 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2701 Subject: [PATCH] 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: Fri, 15 Sep 2017 13:08:53 -0000 Content-Type: text/plain Issue : When try to change serial attributes using sermode command, the default values are set 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. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pankaj Bansal --- MdeModulePkg/Universal/SerialDxe/SerialIo.c | 66 ++++++++--------------------- 1 file changed, 18 insertions(+), 48 deletions(-) diff --git a/MdeModulePkg/Universal/SerialDxe/SerialIo.c b/MdeModulePkg/Universal/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; Status = SerialPortInitialize (); if (EFI_ERROR (Status)) { @@ -228,49 +227,17 @@ SerialReset ( } // - // Set the Serial I/O mode and update the device path - // - - Tpl = gBS->RaiseTPL (TPL_NOTIFY); - - // - // Set the Serial I/O mode - // - This->Mode->ReceiveFifoDepth = PcdGet16 (PcdUartDefaultReceiveFifoDepth); - This->Mode->Timeout = 1000 * 1000; - This->Mode->BaudRate = PcdGet64 (PcdUartDefaultBaudRate); - This->Mode->DataBits = (UINT32) PcdGet8 (PcdUartDefaultDataBits); - This->Mode->Parity = (UINT32) PcdGet8 (PcdUartDefaultParity); - This->Mode->StopBits = (UINT32) PcdGet8 (PcdUartDefaultStopBits); - - // - // Check if the device path has actually changed - // - if (mSerialDevicePath.Uart.BaudRate == This->Mode->BaudRate && - mSerialDevicePath.Uart.DataBits == (UINT8) This->Mode->DataBits && - mSerialDevicePath.Uart.Parity == (UINT8) This->Mode->Parity && - mSerialDevicePath.Uart.StopBits == (UINT8) This->Mode->StopBits - ) { - gBS->RestoreTPL (Tpl); - return EFI_SUCCESS; - } - - // - // Update the device path + // Go set the current attributes // - mSerialDevicePath.Uart.BaudRate = This->Mode->BaudRate; - mSerialDevicePath.Uart.DataBits = (UINT8) This->Mode->DataBits; - mSerialDevicePath.Uart.Parity = (UINT8) This->Mode->Parity; - mSerialDevicePath.Uart.StopBits = (UINT8) This->Mode->StopBits; - - Status = gBS->ReinstallProtocolInterface ( - mSerialHandle, - &gEfiDevicePathProtocolGuid, - &mSerialDevicePath, - &mSerialDevicePath - ); - - gBS->RestoreTPL (Tpl); + Status = 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 + ); return Status; } @@ -513,11 +480,6 @@ SerialDxeInitialize ( { EFI_STATUS Status; - Status = SerialPortInitialize (); - if (EFI_ERROR (Status)) { - return Status; - } - mSerialIoMode.BaudRate = PcdGet64 (PcdUartDefaultBaudRate); mSerialIoMode.DataBits = (UINT32) PcdGet8 (PcdUartDefaultDataBits); mSerialIoMode.Parity = (UINT32) PcdGet8 (PcdUartDefaultParity); @@ -529,6 +491,14 @@ SerialDxeInitialize ( mSerialDevicePath.Uart.StopBits = PcdGet8 (PcdUartDefaultStopBits); // + // Issue a reset to initialize the COM port + // + Status = mSerialIoTemplate.Reset (&mSerialIoTemplate); + if (EFI_ERROR (Status)) { + return Status; + } + + // // Make a new handle with Serial IO protocol and its device path on it. // Status = gBS->InstallMultipleProtocolInterfaces ( -- 2.7.4