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:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=julien.grall@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::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 6D693220F3C43 for ; Fri, 24 Nov 2017 08:16:20 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id s41so15381438wrc.7 for ; Fri, 24 Nov 2017 08:20:39 -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=12vqC89W4GPyhGrp1c7xCGSKpv+UI711veQLbgWGXgg=; b=LhKn8unMDt/PnPmi/1vl1trbtpijS+gMpAHPiWTHmEuOB7sXHpr8OYT9asnlpvayoR IFsNTaEIggNx3rYfVQwYXj7qCLuFLer1Owb/001+qBEqB0eQR9jxBB3X050dVlCQ75Oi +R2L1B7WbVvcPXNslqb/Ln+ybeGMYFwxrHh24= 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=12vqC89W4GPyhGrp1c7xCGSKpv+UI711veQLbgWGXgg=; b=Q6r/AGp5HIIK8AKfvh48wjQI1p/vmTLgI9iPg0DtQ3DUaxHXFOVG7pDwwFE1do19wY Opuyff5hcNk08ZtM84lSa5lwIE4JSVOQ+8Ru3j61+ZsW/aanwSWMv5BlFMJjML1oJ/A4 Y8iYfQnytN5GdGn38Vs899wj+2TSrXAsuxzAXb59/XQefc06X3Atwsz0JhpxMN/vDeOi MHjOI1ebVAB5piYWeMsQzWAfoGXkCddkdfwRhD3s4tzTddnNZFNjq1BdM6XvMYNcHo8s 48Gzne39BDxnhwYbNg77fYBsLFBgGllzOVcN+lVnkvChc1hWwRGE75kxx2ZBrvHil+Gx wEqQ== X-Gm-Message-State: AJaThX7QboituaH30R43g5N6XL6hNpqu0PIqHXB4T2/2zdcCar2aSwcb ZJgUv1VpwfMQAs3qU3dmOeyzgA== X-Google-Smtp-Source: AGs4zMZUQMQDD72r7+a080tjJPto1cIss62+3OZvnXygj2LUxwlVPMK5nj/WglEP/HA1mxIRfttJkw== X-Received: by 10.223.195.203 with SMTP id d11mr27663173wrg.39.1511540437907; Fri, 24 Nov 2017 08:20:37 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id k30sm38803840wrf.63.2017.11.24.08.20.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Nov 2017 08:20:37 -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: Fri, 24 Nov 2017 16:20:30 +0000 Message-Id: <20171124162030.31156-4-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171124162030.31156-1-julien.grall@linaro.org> References: <20171124162030.31156-1-julien.grall@linaro.org> Subject: [PATCH v2 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: Fri, 24 Nov 2017 16:16:20 -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 propated 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 instropecting 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 --- 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 08b95a4a33..53d2785fed 100644 --- a/MdeModulePkg/Universal/SerialDxe/SerialIo.c +++ b/MdeModulePkg/Universal/SerialDxe/SerialIo.c @@ -239,6 +239,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