Am 14.08.2013 18:17, schrieb Egbert Eich: > Primary PCI devices are identified by checking for an 'PCIINFOCLASSES' > device which is VGA and has access to the memory bars enabled. > If there should be more than one device for which this is true > redo the check and also check if IO resoures are also enabled, > if this still doesn't turn up a unique result also check for > the presence of a BIOS rom. > > Signed-off-by: Egbert Eich <[email protected]> > --- > hw/xfree86/common/xf86pciBus.c | 47 > +++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 44 insertions(+), 3 deletions(-) > > diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c > index 258988a..2303f90 100644 > --- a/hw/xfree86/common/xf86pciBus.c > +++ b/hw/xfree86/common/xf86pciBus.c > @@ -134,9 +134,50 @@ xf86PciProbe(void) > primaryBus.id.pci = info; > } > else { > - xf86Msg(X_NOTICE, > - "More than one possible primary device found\n"); > - primaryBus.type ^= (BusType) (-1); > + /* > + * Ok, we found more than one possible primary device > + * with this heuristic. Now also check if IO is enabled. > + */ > + int j; > + > + primaryBus.type = BUS_NONE; > + for (j = 0; j < num; j++) { > + info = xf86PciVideoInfo[j]; > + pci_device_cfg_read_u16(info, & command, 4); > + > + if ((command & PCI_CMD_MEM_ENABLE) > + && (command & PCI_CMD_IO_ENABLE) > + && (IS_VGA(info->device_class))) { > + if (primaryBus.type == BUS_NONE) { > + primaryBus.type = BUS_PCI; > + primaryBus.id.pci = info; > + } else { > + primaryBus.type = BUS_NONE; > + for (j = 0; j < num; j++) { > + info = xf86PciVideoInfo[j]; > + pci_device_cfg_read_u16(info, &command, > 4); > + > + if ((command & PCI_CMD_MEM_ENABLE) > + && (command & PCI_CMD_IO_ENABLE) > + && (IS_VGA(info->device_class)) > + && info->rom_size) { > + if (primaryBus.type == BUS_NONE) { > + primaryBus.type = BUS_PCI; > + primaryBus.id.pci = info; > + } else { > + xf86Msg(X_NOTICE, > + "More than one possible " > + "primary device > found\n"); > + primaryBus.type ^= (BusType)(-1); > + break; > + } > + } > + } > + break; > + } > + } > + } > + break; > } > } > }
Is it possible to but that into a function and save a few indentlevel this way ? re, wh _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
