public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Heyi Guo <heyi.guo@linaro.org>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: star.zeng@intel.com, eric.dong@intel.com
Subject: Re: MdeModulePkg/SerialDxe: Inconsistent timeout processing in SerialRead
Date: Tue, 18 Jul 2017 16:13:28 +0800	[thread overview]
Message-ID: <2e9ddb6f-8014-0c59-a874-82844a185182@linaro.org> (raw)
In-Reply-To: <c5202325-c665-7951-f426-727a13d8b161@linaro.org>

+cc maintainers :)


在 7/17/2017 12:23 PM, Heyi Guo 写道:
> Hi Folks,
>
> In SerialRead function in MdeModulePkg/Universal/SerialDxe/SerialIo.c, 
> it seems the timeout processing in SerialRead is not consistent.
>
> Since SerialPortPoll only checks the status of serial port and returns 
> immediately, and SerialPortRead does not really implement a time out 
> mechanism and will always wait for enough input, it will cause below 
> results:
>
> 1. If there is no serial input at all, this interface will return 
> timeout immediately without any waiting;
>
> 2. If there is A characters in serial port FIFO, and caller requires 
> A+1 characters, it will wait until a new input is coming and timeout 
> will not really occur.
>
> As SerialPortLib is a simple library implementation, I think it is 
> better to improve SerialIoDxe driver instead of SerialPortLib.
>
> Please let me know your comments about this.
>
> Thanks and regards,
>
> Gary (Heyi Guo)
>
> EFI_STATUS
> EFIAPI
> SerialRead (
>   IN EFI_SERIAL_IO_PROTOCOL *This,
>   IN OUT UINTN              *BufferSize,
>   OUT VOID                  *Buffer
>   )
> {
>   UINTN Count;
>
>   Count = 0;
>
>   if (SerialPortPoll ()) {
>     Count = SerialPortRead (Buffer, *BufferSize);
>   }
>
>   if (Count != *BufferSize) {
>     *BufferSize = Count;
>     return EFI_TIMEOUT;
>   }
>
>   return EFI_SUCCESS;
> }
>



  reply	other threads:[~2017-07-18  8:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17  4:23 MdeModulePkg/SerialDxe: Inconsistent timeout processing in SerialRead Heyi Guo
2017-07-18  8:13 ` Heyi Guo [this message]
2017-07-18  8:39 ` Zeng, Star
2017-07-18  8:58   ` Ni, Ruiyu
2017-07-18 10:59   ` Heyi Guo
2017-08-04  8:02     ` Heyi Guo
2017-08-04  8:05       ` Zeng, Star
2017-08-04  8:08         ` Heyi Guo

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=2e9ddb6f-8014-0c59-a874-82844a185182@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