static struct pci_device* ati_device_get_from_busid(int bus, int dev, int func) { return pci_device_find_by_slot(PCI_DOM_FROM_BUS(bus), PCI_BUS_NO_DOMAIN(bus), dev, func); }
void xf86PciIsolateDevice(char *argument) { int bus, device, func; if (sscanf(argument, "PCI:%d:%d:%d", &bus, &device, &func) == 3) { xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus); xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus); xf86IsolateDevice.dev = device; xf86IsolateDevice.func = func; } else FatalError("Invalid isolated device specification\n"); }
static int linuxOpenLegacy(PCITAG Tag, char *name) { #define PREFIX "/sys/class/pci_bus/%04x:%02x/%s" char *path; int domain, bus; pciBusInfo_t *pBusInfo; pciConfigPtr bridge = NULL; int fd; path = xalloc(strlen(PREFIX) + strlen(name)); if (!path) return -1; for (;;) { domain = xf86GetPciDomain(Tag); bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag)); /* Domain 0 is reserved -- see xf86GetPciDomain() */ if ((domain <= 0) || (domain >= MAX_DOMAINS)) FatalError("linuxOpenLegacy(): domain out of range\n"); sprintf(path, PREFIX, domain - 1, bus, name); fd = open(path, O_RDWR); if (fd >= 0) { xfree(path); return fd; } pBusInfo = pciBusInfo[bus]; if (!pBusInfo || (bridge == pBusInfo->bridge) || !(bridge = pBusInfo->bridge)) { xfree(path); return -1; } Tag = bridge->tag; } xfree(path); return fd; }