public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"nicholasbishop@gmail.com" <nicholasbishop@gmail.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] Bug report: serial timeout gets overwritten shortly after setting it
Date: Tue, 23 Nov 2021 03:54:21 +0000	[thread overview]
Message-ID: <CO1PR11MB4929E63E816B3843DFCC8D28D2609@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <K9Zs.1637517148982010459.MRDO@groups.io>

Hi Nicholas,

How did you open the Serial I/O Protocol?

If you open BY_DRIVER or EXCLUSIVE, then it should disconnect the Terminal
driver from the Serial I/O Protocol and allow you to change the timeout and
keep that timeout setting.  For your UEFI application test case, the open
mode of EXCLUSIVE would be the best choice.

You can also use DisconnectController() to disconnect the Terminal driver
from the Serial I/O Protocol you want to manage and change the timeout and
then open it to use it.  EXCLUSIVE does the disconnect for you.

In order to do an OpenProtcol() with the appropriate open type or
DisconnectController(), you will want to use LocateHandle() instead of
LocateProtocol() to get an EFI_HANDLE with he correct Serial I/O Protocol.
You may need to evaluate the Device Path Protocol instance to make sure
you have selected the correct Serial I/O Protocol instance if the 
platform has more than one.

The UEFI Driver Writer's Guide also has a description of these issues.
Please see section 5.1.3.4.

https://tianocore-docs.github.io/edk2-UefiDriverWritersGuide/draft/5_uefi_services/51_services_that_uefi_drivers_commonly_use/513_handle_database_and_protocol_services.html#513-handle-database-and-protocol-services

Thanks,

Mike

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of nicholasbishop@gmail.com
Sent: Sunday, November 21, 2021 9:52 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] Bug report: serial timeout gets overwritten shortly after setting it

Hi, I have a bug to report with the serial I/O protocol. Using the SetAttributes function to change the timeout initially works, but after a short amount of time the timeout gets reset to 173 microseconds.

I believe this is likely due to the implementation of the simple text input protocol, which alters the serial timeout:
https://github.com/tianocore/edk2/blob/e1e7306b54147e65cb7347b060e94f336d4a82d2/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c#L549

I've created a full example here:
https://github.com/nicholasbishop/edk2/commit/d6087f863a48f3c7812f47ea21d5d673adb8d754

The example sets the timeout to 1s which works correctly, then sleeps for 1s and reads the timeout value again. The timeout is now 173ms. 


  reply	other threads:[~2021-11-23  3:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-21 17:52 Bug report: serial timeout gets overwritten shortly after setting it nicholasbishop
2021-11-23  3:54 ` Michael D Kinney [this message]
2021-12-04  7:19   ` [edk2-devel] " nicholasbishop

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=CO1PR11MB4929E63E816B3843DFCC8D28D2609@CO1PR11MB4929.namprd11.prod.outlook.com \
    --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