From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AGs4zMYC9vQfwZti3R8o4Fe+NiXOc2D0EEpBiKGPFZB7i5ooT+DsW1VX1XDVsM29WpvKJ18VCq25Qg== 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 Cc: edk2-devel@lists.01.org, Julien Grall 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: [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: , X-List-Received-Date: Wed, 29 Nov 2017 17:24:08 -0000 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(+) 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; } -- 2.11.0