Hi Olivier,
It looks like there is a bug in this commit (13773). The SerialPortGetControl 
(OUT *Control) function must return something in its Control argument. As is, 
the function just returns SUCCESS and Control has garbage, which causes ConIn 
to intermittently fail.

I think the SerialPortExtLib routines should be cloned from 
TemplateSerialPortLib, so that SerialPortPoll() would actually be used:

RETURN_STATUS
EFIAPI
SerialPortGetControl (
  OUT UINT32                  *Control
  )
{
  if (SerialPortPoll ()) {
    // If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY.
    *Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
  } else {
    *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
  }
  return RETURN_SUCCESS;
}

Also, I think SerialPortSetControl () should return UNSUPPORTED:
RETURN_STATUS
EFIAPI
SerialPortSetControl (
  IN UINT32                   Control
  )
{
  return RETURN_UNSUPPORTED;
}

Regards,
Eugene Khoruzhenko
Principal Software Architect
Phoenix Technologies Ltd.
(425) 443-3883

From: Hutcheson, Alex M. [mailto:alex.m.hutche...@saic.com]
Sent: Friday, August 10, 2012 9:47 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Serial Protocol Implementation in BeagleBoardPkg

Olivier,

Thanks, didn't realize a fix was already in the works. Will the new code also 
add support for UART2 and UART3 on the BeagleBoard?

Thanks,
Alex

From: 
edk2-devel-boun...@lists.sourceforge.net<mailto:edk2-devel-boun...@lists.sourceforge.net>
 [mailto:edk2-devel-boun...@lists.sourceforge.net] On Behalf Of Olivier Martin
Sent: Friday, August 10, 2012 11:56 AM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: Re: [edk2] Serial Protocol Implementation in BeagleBoardPkg

Hello Alex,
I am planning to push some code (probably next week) to add support for 
SerialSetAttributes()/SerialSetControl()/SerialGetControl() in 
EmbeddedPkg/SerialDxe through a new library (probably 'SerialPortExtLib'). I 
have this change in our internal repository for a while, I just need to port it 
to the BeagleBoard and push it.

Otherwise as temporary workaround you could change the 
Omap35xxPkg/Library/SerialPortLib to set your needed baud rate in the function 
SerialPortInitialize().

Thanks,
Olivier

From: Hutcheson, Alex M. 
[mailto:alex.m.hutche...@saic.com]<mailto:[mailto:alex.m.hutche...@saic.com]>
Sent: 08 August 2012 19:55
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: [edk2] Serial Protocol Implementation in BeagleBoardPkg

Hello,

I am running the UEFI build from the BeagleBoardPkg on my BeagleBoard, and I am 
trying to use the EFI_SERIAL_IO_PROTOCOL to communicate via the RS-232 
connection on the board. I am connecting to a device with a lower baud rate 
than the 115200 baud default, so I am calling the 
SERIAL_IO_PROTOCOL->SetAttributes function to alter the baud rate.

However, this function fails with the EFI_UNSUPPORTED error code, which I 
assume means it is not implemented.

Currently, I am making due with some low-level hacking (setting the UART 
register bits from within my application), but I would be interested in using 
my solution to implement SetAttributes so other people can benefit. However, I 
am not that familiar with the overall architecture of TianoCore, and I can't 
figure out how I would go about doing this.

What files would I need to edit in order to allow the UART devices to support 
this function from the SERIAL_IO_PROTOCOL?

Thanks,
Alex

Alex Hutcheson | SAIC
------------------------------------------------------------------------------
The Windows 8 Center 
In partnership with Sourceforge
Your idea - your app - 30 days. Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to