Beispiel #1
0
myQLoader::myQLoader()
{
  findModules();
  load_Icons();
  loadList();
  
  worker = new QProcess(this);
}
Beispiel #2
0
void pci::probe(void) {
    pci_scan_bus(_pacc);

    uint8_t buf[CONFIG_SPACE_SIZE] = {0};
    char classbuf[128] = {0}, vendorbuf[128] {0}, devbuf[128] = {0};

    for (struct pci_dev *dev = _pacc->devices; dev && _entries.size() < MAX_DEVICES; dev = dev->next) {
	_entries.push_back(pciEntry());
	pciEntry &e = _entries.back();
	memset(buf, 0, sizeof(buf));
	memset(classbuf, 0, sizeof(classbuf));
	memset(vendorbuf, 0, sizeof(vendorbuf));
	memset(devbuf, 0, sizeof(devbuf));

	pci_setup_cache(dev, buf, CONFIG_SPACE_SIZE);
	pci_read_block(dev, 0, buf, CONFIG_SPACE_SIZE);
	pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_CAPS);

	pci_lookup_name(_pacc, vendorbuf, sizeof(vendorbuf), PCI_LOOKUP_VENDOR, dev->vendor_id, dev->device_id);
	pci_lookup_name(_pacc, devbuf,    sizeof(devbuf),    PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id);
	e.text.append(vendorbuf).append("|").append(devbuf);
	e.class_type += classbuf;
	e.vendor =     dev->vendor_id;
	e.device =     dev->device_id;
	e.pci_domain = dev->domain;
	e.bus =        dev->bus;
	e.pciusb_device = dev->dev;
	e.pci_function = dev->func;

	e.class_id = dev->device_class;
	e.subvendor = pci_read_word(dev, PCI_SUBSYSTEM_VENDOR_ID);
	e.subdevice = pci_read_word(dev, PCI_SUBSYSTEM_ID);
	e.pci_revision = pci_read_byte(dev, PCI_REVISION_ID);

	if ((e.subvendor == 0 && e.subdevice == 0) ||
		(e.subvendor == e.vendor && e.subdevice == e.device)) {
	    e.subvendor = 0xffff;
	    e.subdevice = 0xffff;
	}

	if (pci_find_cap(dev,PCI_CAP_ID_EXP, PCI_CAP_NORMAL))
	    e.is_pciexpress = true;

	/* special case for realtek 8139 that has two drivers */
	if (e.vendor == 0x10ec && e.device == 0x8139) {
	    if (e.pci_revision < 0x20)
		e.module = "8139too";
	    else
		e.module = "8139cp";
	}
    }

    // fake two PCI controllers for xen
    struct stat sb;
    if (!stat("/sys/bus/xen", &sb)) {
	// FIXME: use C++ streams..
	FILE *f;
	if ((f = fopen("/sys/hypervisor/uuid", "r"))) {
	    char buf[38];
	    fgets(buf, sizeof(buf) - 1, f);
	    fclose(f);
	    if (strncmp(buf, "00000000-0000-0000-0000-000000000000", sizeof(buf))) {
		// We're now sure to be in a Xen guest:
		{
		    _entries.push_back(pciEntry());
		    pciEntry &e = _entries.back();
		    e.text.append("XenSource, Inc.|Block Frontend");
		    e.class_id = 0x0106; // STORAGE_SATA

		    e.vendor =  0x1a71; // XenSource
		    e.device =  0xfffa; // fake
		    e.subvendor = 0;
		    e.subdevice = 0;
		    e.class_id = 0x0106;
		    e.module = "xen_blkfront";
		}
		{
		    _entries.push_back(pciEntry());
		    pciEntry &e = _entries.back();
		    e.text.append("XenSource, Inc.|Network Frontend");
		    e.class_id = 0x0200; // NETWORK_ETHERNET

		    e.vendor =  0x1a71; // XenSource
		    e.device =  0xfffb; // fake
		    e.subvendor = 0;
		    e.subdevice = 0;
		    e.class_id = 0x0200;
		    e.module = "xen_netfront";
		}
	    }
	}
    }
    findModules("pcitable", false);
}