public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* MdeModulePkg/SerialDxe: Inconsistent timeout processing in SerialRead
@ 2017-07-17  4:23 Heyi Guo
  2017-07-18  8:13 ` Heyi Guo
  2017-07-18  8:39 ` Zeng, Star
  0 siblings, 2 replies; 8+ messages in thread
From: Heyi Guo @ 2017-07-17  4:23 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

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;
}



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-08-04  8:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-17  4:23 MdeModulePkg/SerialDxe: Inconsistent timeout processing in SerialRead Heyi Guo
2017-07-18  8:13 ` Heyi Guo
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox