On Aug 8, 2014, at 4:50 PM, Jordan Justen <[email protected]> wrote:

> On Thu, Aug 7, 2014 at 3:49 PM, Laszlo Ersek <[email protected]> wrote:
>> On 08/07/14 18:03, Andrew Fish wrote:
>>> OVFM maintainers,
>>> 
>>> This is an example of using the BaseSerialPortLibIoPort. It enables the
>>> CpuExceptionHandlerLib serial prints.
>>> 
>>> The BaseSerialPortLibIoPort can also be used to enable
>>> the MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf and
>>> obsolete the need
>>> for OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
>>> 
>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>> Signed-off-by: Andrew Fish <[email protected] <mailto:[email protected]>>
>>> 
>>> Thanks,
>>> 
>>> Andrew Fish
>> 
>> As far as I can see, pre-patch we have:
>> 
>> DEBUG_ON_SERIAL_PORT (non-default):
>> - DebugLib resolves to MdePkg/Library/BaseDebugLibSerialPort
>> 
>> Otherwise (default):
>> - DebugLib resolves to OvmfPkg/Library/PlatformDebugLibIoPort
>> 
>> Post patch, we always resolve DebugLib to
>> MdePkg/Library/BaseDebugLibSerialPort, and (apparently) we move the
>> choice to one level deeper, choosing
>> - between PcAtChipsetPkg/Library/SerialIoLib
>> - and OvmfPkg/Library/BaseSerialPortLibIoPort
>> for SerialPortLib.
>> 
>> Presumably, this latter library instance implements SerialPortWrite() by
>> writing to the QEMU debug port. I assume the benefit is that now all
>> code that goes through SerialPortLib will reach the QEMU debug port, not
>> just the code that goes through DebugLib.
>> 
>> Two points:
>> - Did you add the "OvmfPkg/Library/BaseSerialPortLibIoPort" directory to
>> the index with "git add" (ie. did you "stage it") before calling "git
>> commit"? Because it's not in the patch. It's present in your working
>> tree only I believe.
>> 
>> - Will this redirection break the terminal driver, for example? OVMF
>> does make use of the serial port even when DEBUG() goes to the QEMU
>> debug port. For example, thanks to ConSplitterDxe, the setup screens
>> (Boot manager, Boot maintenance manager etc) are fully usable on the
>> virtual serial port. I don't immediately see how that stack is built,
>> but it should not be disturbed. (I don't know if this patch disturbs it,
>> I'm asking.)
> 
> It looks like it should work, because we use
> IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf for to
> produce the SerialIo protocol, that I think TerminalDxe uses.
> 
> If we made a driver that produces the SerialIo protocol based on
> SerialPortLib, then we might need to override the SerialPortLib to the
> real serial port for that driver.
> 
> If we used DEBUG output in that driver, then the messages would appear
> on the serial port.
> 
> Does this sound right Andrew?
> 

Yes.

I also noticed that the SourceLevelDebugPkg can produce a SerialIo protocol in 
DXE. It looks like this redirects the console to the debugger. So that may be 
an option, and probably why there is not support for a 2nd serial port. 
https://svn.code.sf.net/p/edk2/code/trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/SerialIo.c

You could have the UEFI console on the debugger and send the DEBUG prints to 
the DebugLibIoPort. Seems like this would happen if you removed ISA Serial 
driver, and made sure UEFI console was pointing at mSerialIoDevicePath.

Thanks,

Andrew Fish



> -Jordan

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to