[edk2-devel] Bug report: serial timeout gets overwritten shortly after setting it

Michael D Kinney michael.d.kinney at intel.com
Tue Nov 23 03:54:21 UTC 2021


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 at edk2.groups.io <devel at edk2.groups.io> On Behalf Of nicholasbishop at gmail.com
Sent: Sunday, November 21, 2021 9:52 AM
To: devel at 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. 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83921): https://edk2.groups.io/g/devel/message/83921
Mute This Topic: https://groups.io/mt/87252060/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list