diff options
author | Michał Winiarski <michal.winiarski@intel.com> | 2019-03-12 13:48:13 +0100 |
---|---|---|
committer | Michał Winiarski <michal.winiarski@intel.com> | 2019-03-20 10:36:36 +0100 |
commit | 8ae86621d6fff60b6e20c6b0f9b336785c935b0f (patch) | |
tree | 12d83d267f5dafb16bcef5edec173ff57cf4dfbd /lib/intel_chipset.c | |
parent | 1bbe0b11a40cbb8433a3863745b7023e54c36ae3 (diff) |
lib/igt_device: Move intel_get_pci_device under igt_device
It allows us to make things a little bit more generic. Also, we now
require fd rather than doing guesswork when it comes to pci address.
v2: Use readlinkat rather than string concat, move stuff around, provide
a version that does not assert. (Chris)
v3: Print addr on failure, avoid assignment in conditionals. (Chris)
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/intel_chipset.c')
-rw-r--r-- | lib/intel_chipset.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/lib/intel_chipset.c b/lib/intel_chipset.c index 4748a3fb..0577f77a 100644 --- a/lib/intel_chipset.c +++ b/lib/intel_chipset.c @@ -62,57 +62,6 @@ enum pch_type intel_pch; /** - * intel_get_pci_device: - * - * Looks up the main graphics pci device using libpciaccess. - * - * Returns: - * The pci_device, exits the program on any failures. - */ -struct pci_device * -intel_get_pci_device(void) -{ - struct pci_device *pci_dev; - int error; - - error = pci_system_init(); - igt_fail_on_f(error != 0, - "Couldn't initialize PCI system\n"); - - /* Grab the graphics card. Try the canonical slot first, then - * walk the entire PCI bus for a matching device. */ - pci_dev = pci_device_find_by_slot(0, 0, 2, 0); - if (pci_dev == NULL || pci_dev->vendor_id != 0x8086) { - struct pci_device_iterator *iter; - struct pci_id_match match; - - match.vendor_id = 0x8086; /* Intel */ - match.device_id = PCI_MATCH_ANY; - match.subvendor_id = PCI_MATCH_ANY; - match.subdevice_id = PCI_MATCH_ANY; - - match.device_class = 0x3 << 16; - match.device_class_mask = 0xff << 16; - - match.match_data = 0; - - iter = pci_id_match_iterator_create(&match); - pci_dev = pci_device_next(iter); - pci_iterator_destroy(iter); - } - igt_require_f(pci_dev, "Couldn't find Intel graphics card\n"); - - error = pci_device_probe(pci_dev); - igt_fail_on_f(error != 0, - "Couldn't probe graphics card\n"); - - if (pci_dev->vendor_id != 0x8086) - errx(1, "Graphics card is non-intel"); - - return pci_dev; -} - -/** * intel_get_drm_devid: * @fd: open i915 drm file descriptor * |