From: Julien Grall <julien.grall@linaro.org>
To: Laszlo Ersek <lersek@redhat.com>,
star.zeng@intel.com, eric.dong@intel.com, pankaj.bansal@nxp.com,
leif.lindholm@linaro.org
Cc: edk2-devel@lists.01.org
Subject: Re: [PATCH] MdeModulePkg/SerialDxe: Do not fail reset when SetAttributes is not supported
Date: Mon, 23 Oct 2017 18:27:49 +0100 [thread overview]
Message-ID: <7040ecd7-22c0-6e15-b089-1c294bfc4cfe@linaro.org> (raw)
In-Reply-To: <1f489f32-e185-d430-a4fb-29906ddf2c32@redhat.com>
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 <julien.grall@linaro.org>
>> ---
>> 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
prev parent reply other threads:[~2017-10-23 17:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-18 10:19 [PATCH] MdeModulePkg/SerialDxe: Do not fail reset when SetAttributes is not supported Julien Grall
2017-10-18 12:11 ` Laszlo Ersek
2017-10-19 3:03 ` Ni, Ruiyu
2017-10-24 5:43 ` Zeng, Star
2017-10-23 17:27 ` Julien Grall [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7040ecd7-22c0-6e15-b089-1c294bfc4cfe@linaro.org \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox