From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400d:c09::22f; helo=mail-qk0-x22f.google.com; envelope-from=julien.grall@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-qk0-x22f.google.com (mail-qk0-x22f.google.com [IPv6:2607:f8b0:400d:c09::22f]) (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 BFEF22034CF9C for ; Mon, 23 Oct 2017 10:24:11 -0700 (PDT) Received: by mail-qk0-x22f.google.com with SMTP id o187so22943029qke.7 for ; Mon, 23 Oct 2017 10:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=t3kw/AoiI9bT97ZM/chkFLCGGNOlLZQBXO7fJqMHVs4=; b=f5Zc8UFHF1t+Izu3NjndFZq5IgKRb/3Tth7msqc/gdd59+3DGsrwHTK3dGNz7x1yBX bAaDLYbIasrILiQQ9rUAMciMzsYg7glIE9xdYh83cY3d32aVXZ/ulf5scY+xMGRSWZUx FQBLOdiBwzgzwpgOEZqQZ7KRoAqM7+HpLmnPc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=t3kw/AoiI9bT97ZM/chkFLCGGNOlLZQBXO7fJqMHVs4=; b=KL0tYCQKfh3SV0khK8T+gRTDzm1oZSIzALmyBdw7SDMHQqllMfyyK/yw7v9ZMA0wGi m0nEWcesfPwbBe2TJi5/SoVOjGQC07jnpJlwXVoXkEudqnXbFPSN8ikIFE9+r67qSMM1 LAwjI7Vool+8Bob2i9o6Zhz3jxapuZ/RDhoJWQRQdHjSgztT5ZENlkyRpS7s9/ELHXL+ jjWQZ3fTPka4Vt69zrUIJBvGhK38QLyMlnLg//7tqQ95qhMeC3UmT+/Oz/07dT5jmUBh RQH3iZDSdPYHvQLQi1lyWp42x3PTvY5oYGuiYWFhfhEGX5kAG7BUNJuj6TKb1dAEVoBj 92xw== X-Gm-Message-State: AMCzsaV4u0BEaT6o6NFJ3SFvZcagQ5ImF7cD4Qey7SKrZsKCryE7Biah rWA6wxzOJHZCdfsHtlPNDvZibnYWobo= X-Google-Smtp-Source: ABhQp+RBXZPU+EVJp0HI4wTq5FayvpHBt8t+sDcSyvDq2LNUfi+Zd7EKGcul5prYV7SGgp2a9vnWgg== X-Received: by 10.55.159.4 with SMTP id i4mr19799842qke.339.1508779673330; Mon, 23 Oct 2017 10:27:53 -0700 (PDT) Received: from ?IPv6:::1? ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id s6sm5228047qtg.34.2017.10.23.10.27.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:27:52 -0700 (PDT) To: Laszlo Ersek , star.zeng@intel.com, eric.dong@intel.com, pankaj.bansal@nxp.com, leif.lindholm@linaro.org Cc: edk2-devel@lists.01.org References: <20171018101951.1890-1-julien.grall@linaro.org> <1f489f32-e185-d430-a4fb-29906ddf2c32@redhat.com> From: Julien Grall Message-ID: <7040ecd7-22c0-6e15-b089-1c294bfc4cfe@linaro.org> Date: Mon, 23 Oct 2017 18:27:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1f489f32-e185-d430-a4fb-29906ddf2c32@redhat.com> Subject: Re: [PATCH] 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: Mon, 23 Oct 2017 17:24:12 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Laszlo, On 18/10/17 13:11, Laszlo Ersek wrote: > On 10/18/17 12:19, Julien Grall wrote: >> 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 not be supported by the driver and will >> return an error (i.e RETURN_UNSUPPORTED) that will be propagate 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 RETURN_SUCCESS when the >> driver report it is not supported (i.e RETURN_UNSUPPORTED). >> >> Contributed-under: Tianocore Contribution Agreement 1.1 >> Signed-off-by: Julien Grall >> --- >> MdeModulePkg/Universal/SerialDxe/SerialIo.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/MdeModulePkg/Universal/SerialDxe/SerialIo.c b/MdeModulePkg/Universal/SerialDxe/SerialIo.c >> index ebcd927263..4253e0b8ea 100644 >> --- a/MdeModulePkg/Universal/SerialDxe/SerialIo.c >> +++ b/MdeModulePkg/Universal/SerialDxe/SerialIo.c >> @@ -238,6 +238,12 @@ SerialReset ( >> (UINT8) This->Mode->DataBits, >> (EFI_STOP_BITS_TYPE) This->Mode->StopBits >> ); >> + // >> + // The serial device may not support SetAttributes. >> + // Set the status to RETURN_SUCCESS to prevent later failure. >> + // >> + if ( Status == RETURN_UNSUPPORTED ) > > The extra spaces within the parens are Xen coding style, not edk2 coding > style; please remove them. Sorry for that, I will fix the coding style in the next version. [...] > I suggest waiting for feedback from Star & Eric. Dependent on their > response, your patch could be good enough (once you fix up the coding > style issues). Or else, they could agree with me that the return value > mapping of SerialSetAttributes() should be corrected first (2), and then > your patch should be please adapted as well (3). Thank you for the detailed explanation. I will wait a couple of days more for feedbacks and then send a new version. > > Bonus comment: > > (4) The propagation of the SerialPortInitialize() retval in > SerialReset() looks correct, thankfully. (Both callee and caller are > expected to return one of *_SUCCESS and *_DEVICE_ERROR.) Cheers, -- Julien Grall