From patchwork Wed Nov 29 17:28:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 120034 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3332030qgn; Wed, 29 Nov 2017 09:28:39 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ/Ozj4UDfLh/kRF27HMz9NzhjFmek82nCvgN01MxUya5M8mjozxrp+WLZ+jTTB2rE/faq5 X-Received: by 10.99.123.24 with SMTP id w24mr3440695pgc.438.1511976519731; Wed, 29 Nov 2017 09:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511976519; cv=none; d=google.com; s=arc-20160816; b=GfdlUdohnfEsAZGU0A0M15IWsQvfq1qMDjFaiMaK7kNGue7BLXgiwfkZvNLtrIozFZ +T+++tcLd+6hL9JgHXMd5nrkYNR8gdbwD0g5sgUIXRlVmNz7Tttc6hsJ5zp6nBeITDUY BwJTWnA3uBDf+sJHoYq5hRLhX+lubz9FhqbVRZ/RxajI0EmXMST1ZFDh/vRDyl9FFidR aY/HV3hxfuVCADSoX4e/KQdOc5237pF5ZrquqsB0k5HqaqbESAbFStaPRqL/E3O8wUQ8 2g7k+VL7jikfhF9gOX4OIa+GfsqDgRU0z7W0jWSbV/1G5RzU5rF/fLdEuD77PDOHNs6s cSkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=kqqqOyMe3vAvUP0lDGbpILI/uUHZgxNZpX5pTCzZbDU=; b=OVp38HwXWCUV5oFwDkpAfi0gRWy9riT/5nWv70CRiNkedeDefln4/IDQCLDGBl2flA +c+vFqMKVMQXFN1Hn5jFnl4UON9ljMZ9RBSrYxlICW68loUuq1XS1g4+NUSvx6g4o+/l OdB93FL7SkD7tqRMRCUlhMpPOL0RxkVvyW9hMAwDu4Sb7OWa2G4fg+RYPp0BbMbBacRH ej8dkmqDxdqnBbmoGug6UOi3QYUfKpJKfyoSCMEz6MxmLMvnor2UsY1AtCgbEqwSX65o vo83+eRZx96zpcV+DMwYtBdguBou2uf5GRLBZnHiKDrfNZ9BS5H/Uy4vZAmHrhFiWpll BeYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=P19Ud4Ek; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id t84si1664787pfg.252.2017.11.29.09.28.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Nov 2017 09:28:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=P19Ud4Ek; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9D7DA20359EAB; Wed, 29 Nov 2017 09:24:11 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=julien.grall@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4CB3920359EA2 for ; Wed, 29 Nov 2017 09:24:08 -0800 (PST) Received: by mail-wm0-x242.google.com with SMTP id f140so7483795wmd.2 for ; Wed, 29 Nov 2017 09:28:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zOOqy7fmyf8Ak/X59Z+au9wySb8Jh0uqj+hHY8lDEVE=; b=P19Ud4Ek7JowysYFF/FKatrdkqOEOyPTu4/mjXzvMba6+PlUPl6JuvAhQkmT8ziSI1 wPmARKb3/zV2D6b5kwspO1e8tpQBc+8xiAbew+wXegXxPmqQehYu6ArakjJQ8xoIAiLn ZDBP7JDlcDukFrYv8GdYM/5biDEWgNmT99kIE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zOOqy7fmyf8Ak/X59Z+au9wySb8Jh0uqj+hHY8lDEVE=; b=nUUPKidZKSxulHIHTcQ3vg8efYE3iuU9bB55z1cvDUo7NsO6bclK9mN8SVkbduEalZ iAkxCo9TT9x9Io/w8WTrBJ9VXnBOaUCoSmyYI985nDshx4U3XVNDyA1WabtuQCnbKG9u iPJsxtdnGNnaiCnmz/Jb3M+jGAW8gD66C8FM98Q8tOih1eHRJqnmReNZMQPhrof6QsMc Dw5Z6yt+tJD36TA8HLFUtIWz65t2bHeCpyXsDPU0jd6aXhK2OgezNFxZ7JXLdW8wOfPO eqAPirS0QQk08EEQO7C2HmzJ//eo5sl65Y5lVPoDp1Rtv5U8cIUbEKXFXbCK+D+MTFkV ksvQ== X-Gm-Message-State: AJaThX4Tu7r5T36dShzl2BiWOTtc/1Mhpm3F02ZWWuHsCTyJCnSGMnuJ Zk5/BIjPFvT2bKvgLtBxMs0+cw== X-Received: by 10.28.97.194 with SMTP id v185mr2966881wmb.21.1511976511361; Wed, 29 Nov 2017 09:28:31 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id o80sm1782687wmg.6.2017.11.29.09.28.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Nov 2017 09:28:30 -0800 (PST) From: Julien Grall To: star.zeng@intel.com, eric.dong@intel.com, pankaj.bansal@nxp.com, lersek@redhat.com, leif.lindholm@linaro.org Date: Wed, 29 Nov 2017 17:28:23 +0000 Message-Id: <20171129172823.2906-4-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171129172823.2906-1-julien.grall@linaro.org> References: <20171129172823.2906-1-julien.grall@linaro.org> Subject: [edk2] [PATCH v3 3/3] MdeModulePkg/SerialDxe: Do not fail reset when SetAttributes is not supported 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: , Cc: edk2-devel@lists.01.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" After commit 91cc526b15 "MdeModulePkg/SerialDxe: Fix not able to change serial attributes", serial is initialized using the reset method that will call SetAttributes. However, SetAttributes may return EFI_INVALID_PARAMETER when a driver does not support some parameters. This will be propagated by the reset function and lead to UEFI failing to get the console setup. For instance, this is the case when using the Xen console driver. Fix it by introspecting the result and return EFI_SUCCESS when the SetAttributes report an invalid parameter (i.e EFI_INVALID_PARAMETER). Contributed-under: Tianocore Contribution Agreement 1.1 Signed-off-by: Julien Grall Reviewed-by: Star Zeng --- Changes in v3: - Add Star reviewed-by - Fix typoes in the commit message --- MdeModulePkg/Universal/SerialDxe/SerialIo.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Universal/SerialDxe/SerialIo.c b/MdeModulePkg/Universal/SerialDxe/SerialIo.c index ee10ec7e05..e18cc7ed51 100644 --- a/MdeModulePkg/Universal/SerialDxe/SerialIo.c +++ b/MdeModulePkg/Universal/SerialDxe/SerialIo.c @@ -240,6 +240,15 @@ SerialReset ( (EFI_STOP_BITS_TYPE) This->Mode->StopBits ); + // + // The serial device may not support some of the attributes. To prevent + // later failure, always return EFI_SUCCESS when SetAttributes is returning + // EFI_INVALID_PARAMETER. + // + if (Status == EFI_INVALID_PARAMETER) { + return EFI_SUCCESS; + } + return Status; }