On Tue, Dec 03, 2019 at 11:27:39AM +0100, Gerd Hoffmann wrote:
> > > > As a result, we can't use the hard coded IO port 0x3f8
> > > > in SeaBIOS for debugging. Instead, we need read the port base
> > > > address from the pci uart's BAR, either an IO BAR, or a 32bit
> > > > memory BAR.
> > > 
> > > Ok, but ...
> > > 
> > > > +     config DEBUG_SERIAL_PCI_BDF
> > > > +        depends on DEBUG_SERIAL_PCI_IO || DEBUG_SERIAL_PCI_MEM32
> > > > +        hex "Serial port PCI bus/device/function"
> > > 
> > > ... hardcoding the BDF instead isn't that great either.  Can't we just
> > > find the device while scanning for pci devices?
> > 
> > There might be multiple pci uart devices.
> 
> Which I doubt is actually the case.  My guess would be you have a
> virtual serial device emulated by ME or something similar for
> serial-over-lan console access.  And there is exactly one of these
> per machine.

In my case they are 3 physical PCI HS-UARTs directly from the SoC(but 
not inside the ME).

> 
> > So hardcoding the BDF seems to be
> > a only solution.
> 
> Why?  Just use the first device you find by default.  Offering the
> option to specify the preferred device in case multiple devices exist
> is fine, but I doubt this is needed.
> 
> > Actually this solution is similar to the port based uart(
> > hard coding the port) and mmio based uart(hard coding the mmio address). 
> > Here
> > we hard code the pci BDF.
> 
> Well, there is no way to reliable discover classic ioport uarts which
> are located behind a isa/lpc bridge, so we have to hardcode the port.
> There is no other option.
> 
> PCI devices are discoverable, so we can do better than hardcoding the
> bdf.  And given that seabios scans the pci bus anyway I think we should
> do that.  This also allows to specify the preferred device by other
> means than the bdf, you could use the PCI ID instead for example.

I'm ok to use Base-Class/Sub-Class = 0x07/0x00 to filter out the PCI serial
devices and choose the first one as the debug port. However, debug port needs
to be enabled early, before seabios scans PCI bus. I think we don't want
to scan the pci bus by ourself in src/hw/serialio.c, but it's too late to
wait for seabios to scan the bus for us. Please advice a feasible solution.

> 
> cheers,
>   Gerd
> 
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to