On Tue, Oct 28, 2014 at 08:30:29AM +0100, Gerd Hoffmann wrote:
> > +  // FIXME: This should be accomplished programmatically by enumerating
> > +  //        all PCI devices present in the system and computing
> > +  //        PCI_INTERRUPT_LINE from PCI_INTERRUPT_PIN, the slot/position
> > +  //        of the device, and the available host IRQs (for an example,
> > +  //        see SeaBIOS pci_bios_init_devices() in src/fw/pciinit.c)
> 
> > +  switch (HostBridgeDevId) {
> > +    case INTEL_82441_DEVICE_ID:
> > +      PciWrite8 (PCI_LIB_ADDRESS (0,    1, 2, 0x3c), 0x0b);
> > +      PciWrite8 (PCI_LIB_ADDRESS (0,    1, 3, 0x3c), 0x0a);
> 
> 00:01.* is part of the northbridge and always present.  This can be done
> unconditionally and doesn't need to go into the "fixme" section.

The device might always be present, but if we ever figure out how to
either re-enumerate the PCI bus, or have the already existing
enumeration logic populate some data structure we can later traverse,
we can get rid of *all* explicit PCI_LIB_ADDRESS calls and write a
generic function (like SeaBIOS' pci_bios_init_devices()) to handle
"whatever devices are currently present", whether they're
unconditionally always there or not.

That's why I put everything under "fixme", and I'd vote to keep it there.

But if you still want me to separate "unconditionally present" devices
from the "maybe" ones, let me know and I'll do it :)

> > +      PciWrite8 (PCI_LIB_ADDRESS (0,    3, 0, 0x3c), 0x0b);
> > +      PciWrite8 (PCI_LIB_ADDRESS (0,    4, 0, 0x3c), 0x0b);
> > +      PciWrite8 (PCI_LIB_ADDRESS (0,    5, 0, 0x3c), 0x0a);
> 
> That assumes device uses INTA and isn't multifunction.  True for most
> devices, ok as temporary stopgap.  Maybe have a few more slots handled
> that way.
> 
> > +      break;
> > +    case INTEL_Q35_MCH_DEVICE_ID:
> > +      PciWrite8 (PCI_LIB_ADDRESS (0,    2, 0, 0x3c), 0x0b);
> 
> We likewise might want to handle a few more slots here.

I basically added a debug print line to SeaBIOS and fired up QEMU with
my "standard" set of devices. Do you have a command line to start e.g.
F20-live-x86_64 which would populate all the slots you're thinking of ?
I know I could actually *calculate* the values, but... :)
 
> > +      PciWrite8 (PCI_LIB_ADDRESS (0, 0x1d, 0, 0x3c), 0x0a);
> > +      PciWrite8 (PCI_LIB_ADDRESS (0, 0x1d, 1, 0x3c), 0x0a);
> > +      PciWrite8 (PCI_LIB_ADDRESS (0, 0x1d, 2, 0x3c), 0x0b);
> > +      PciWrite8 (PCI_LIB_ADDRESS (0, 0x1d, 7, 0x3c), 0x0b);
> 
> Default usb devices (qemu -M q35 -usb).  ok.  Might want to add a
> comment saying so.

OK, will do for the next iteration.

> > +      PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 2, 0x3c), 0x0a);
> > +      PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 3, 0x3c), 0x0a);
> 
> This again is part of the northbridge and always present, so we can do
> that unconditionally.

See above...

Thanks much,
--Gabriel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to