From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0051.outbound.protection.outlook.com [104.47.32.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 1522120945BEE for ; Mon, 18 Sep 2017 00:38:10 -0700 (PDT) Received: from DM5PR03CA0039.namprd03.prod.outlook.com (10.174.189.156) by CO2PR03MB2360.namprd03.prod.outlook.com (10.166.93.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Mon, 18 Sep 2017 07:41:11 +0000 Received: from BN1AFFO11FD018.protection.gbl (2a01:111:f400:7c10::187) by DM5PR03CA0039.outlook.office365.com (2603:10b6:4:3b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.9 via Frontend Transport; Mon, 18 Sep 2017 07:41:11 +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 BN1AFFO11FD018.mail.protection.outlook.com (10.58.52.78) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.35.14 via Frontend Transport; Mon, 18 Sep 2017 07:41:11 +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 v8I7eZY7024141; Mon, 18 Sep 2017 00:41:09 -0700 From: Pankaj Bansal To: CC: Pankaj Bansal Date: Mon, 18 Sep 2017 13:12:45 +0530 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505720565-28495-1-git-send-email-pankaj.bansal@nxp.com> References: <1505720565-28495-1-git-send-email-pankaj.bansal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131501940716640462; (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)(376002)(39380400002)(39860400002)(346002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(53936002)(6916009)(2950100002)(498600001)(76176999)(50986999)(110136004)(50466002)(105606002)(81166006)(356003)(16586007)(48376002)(8656003)(4326008)(85426001)(305945005)(8936002)(50226002)(97736004)(36756003)(2906002)(106466001)(2351001)(5003940100001)(5660300001)(86362001)(81156014)(316002)(77096006)(104016004)(33646002)(118296001)(6666003)(47776003)(189998001)(68736007)(8676002)(44824005); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2360; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD018; 1:+Ot2p7aNbtnSJRFxtQR0jv0A1t7yBhmNWnA03SB8kaN2fdHVHfwNOxvnVgWwzaVjnhlTqwsockYsoTiydnoVdQgHWyWxJQTFhW5+wqvzi9VOMgq6MpMoR0xsBq1Ar9B5 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d08c10e-1d12-4959-376d-08d4fe68a225 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:CO2PR03MB2360; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2360; 3:bEWPUZCfU1w6ePyEy0N6uay5XSRP2BgjQuwaVUJBfX01LhXoQz+YtweZnjJZYoQcbpgeQG57tMHWpHHtGh9y/JVkptK/AzE7mY0pAuQ+fN8BethBr/h8chzmFujaNtjvAeZrjLqm5l4TuvLOHAuW5CAhoa3dXVvcK2DWpoeuqOrzJCHAdCvf6ILVJCnx/wAUdd18H9WsppKP3Ty45FweLcAmNuFWY99JeWePiyAsH+RMxC1SrFJKcUXpIuubN5R86i/3kQpocOtdL0pokZi9OqAz2ZdaXNz7lNwTsofMunXXLtLFFUNOfZnaWdEKRrHRAfgrlO4EeNfU7e45+LAK+eqV+7+xEKnIWX+xn1pDZAw=; 25:3VAVqNAUOvv5W282uWWfegKGpLhtCiLQGwOlB96VdDPGVig9WONT5juFs8LYIAPGSjtNFpNK96mTPpo/9SRVHt04Uz+EmHWG7D29iDg5h4vuehvdQmD+g9x8sBkyNIxfWKrfRVqPiz4Enn5GF1VOkzsK4wb29ntvurE1AHCeUR8KtZb6sa2PAxOtRi64265nSpjhBwWhSA0XNrmubXiXo2w403tJVN846kExm1MPV6uRv5ntoOieoqHP/hwmIK7Ew7urTVy+hiHD1bb6+J7b1ebgPh8An45B2txpM2iqOiPAB3luaC83U9mqrZT0RCFdfNoifIcei5UV5+mK31Knxw== X-MS-TrafficTypeDiagnostic: CO2PR03MB2360: X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2360; 31:KF3QmnQwR3XJ+b/658vwsEmigGGchVaBBqWxu6CQtdNvbf19HE1dNzudKJlT6RBTUSs3VqyjWcm43zT4XMvzQnHBH2EDaHiH+Ijr6mjCXUWVU6BIWz8UFuwL6DYSNrw1uxVLj+inAB5+zefbVvKEkHZPIVVz5jKChe5NMWM+OBjvmJb5OP9XdLmFas/1HcRqFlfrIIdN/Yly/LoehwaIRIoXLJf9Dqc5AxlL4Vypn4A=; 4:k9ag/jmirCRlUU8H/6B410csIpjFiTyiMbFAfFxv3ZFfJ+MQkD4pjYTvzwUSPW3G4uUwITt7xpRIL+PiJMow7D3xHVozyGwwNhBhDPU7AOkLUDakHSSTLOby91W/q8CjftfBNgBicW//CgFxJ91CwMCmc03CCYnHCbAVeXSI40UL9D5gYRdYC5Nn2xSZowr83em3q0kwscD5EA+yBQCGxeShVMZ6BQLtkPdDjk2idr1Vrx6myeFTER4CPQMGl+aEiSp00n3uBN3lLeLbCw/BJzIY2LuuG7A2+httzxh7KEo= 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)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6055026)(6096035)(20161123556025)(20161123559100)(20161123563025)(20161123565025)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO2PR03MB2360; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO2PR03MB2360; X-Forefront-PRVS: 04347F8039 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2360; 23:F5lpv4e3V7bMTv6qYEaFmEFBAqCDJuxJI156YK57f?= =?us-ascii?Q?npFqWJQyazIcpCsnTcT2DbruTH88JloQVNXX1xNMhPoPvTNJZsj16ipS8stI?= =?us-ascii?Q?7I6xqimsQ6R69QoPfvOEnTu/3XTgvW4zvN8cv7fYAQCoZ7Z0QuEU5kgVh1Gv?= =?us-ascii?Q?BAZRtHQLoglgE47ffEwM0IbY1Qi+tqr//F2LHe/pEvAl0qAhe/2ub79+Uwdp?= =?us-ascii?Q?h/nRh9Q1sg4ZWYS4N4YKmzOjE2mFH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q?clzm6G1fiTaRIAUmTQNw97DJTg4ZVeU8+bgYrYr+xpxKfwCulun/XJg0zwUp?= =?us-ascii?Q?5lCVYw8suBB6Y0aeBARJrhHc1HIog1uGjlE?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2360; 6:uVrmi0rb/dgyOVSwiooAekVcP3lQmACtIcqn8SArmTgto6YhPP03duwkJ9Vxcp96470W27lA0SnZyXl16uNmg38YeYD2BMgsdkqs0BK94FNOsL1iV5cTzccPaG+2KsseHiIyANlbDvwedQGgm/ZpITRGl+g1e5lIM/Zrd730nPE4TJDavIKe4dDJoFkJcWJe9NtjkPmI1MIGPj1l7zYfR0P10okS99clH3DoKlPafNYkbzONjT/6pXWrHi+gTa/JYEwc8qhjeUtHl3vtomPu8UA3PrGzHugIw4+T57u84uoOfm4wJL5V6AqgjAZshRx51NSJCXhD/pH3Vk5fcRz51g==; 5:p8spfeeZpuL/PKQ56cugCphi3D61fFcqXwsA5GOpQ8YNUeQWbL8uc9+azmBpEmUNhnyHeD/k7oZTj8Vi9EJObMTIA8lhPmhesuz/h9a7afqnsKvf7WtxS7/ww1mNeTAV8i4vZ3VP1X/iOL+mujXLlg==; 24:fz3cj9L1DIeJMXm1QVTiGF9exSjmkOmIcMm3wi+Uw4w/z1ipsdUNcZSGUgjMbjX/M5mw5VVSp70h3X8F0ojE3Wz+M2IoDtLfYOO0fAGZeUk=; 7:TRPVME5MyeGLmIpjDvCn18AgwYYd67mZ8Hiryh7n1xtprh4S04rsCq+mc4GsQS97ugsRKnSwIdOt4kv3rQCfhJL+Y9TVCa6mn6F5Nw83gh2+oNghQsPTCtQvjsv68jG4ctiJFmYQD8LHhwALgYYCTrKMtUe/FunMNZf4l4yBtmO4pmhYEgmxbVyZcNITFiN6uL/cU2bmqkw+hEhZs8KYRwaeDLUhqYPjTUURsdLanW0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 07:41:11.4924 (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: CO2PR03MB2360 Subject: [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 07:38:10 -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 --- 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/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