diff options
author | Jerome Glisse <jglisse@redhat.com> | 2011-09-30 10:24:48 -0400 |
---|---|---|
committer | Jerome Glisse <jglisse@redhat.com> | 2011-09-30 10:24:48 -0400 |
commit | 80799c0fa8e82822b223f0cd82cc554752d75add (patch) | |
tree | d386399a30ca5e205df1ede13e447f46ceff7e2c /radeon_pci.c | |
parent | 49b32533f8008816b63c18226ac433b0bb26e1d1 (diff) |
bunch of new tools and update to previous one
Diffstat (limited to 'radeon_pci.c')
-rw-r--r-- | radeon_pci.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/radeon_pci.c b/radeon_pci.c index 7a1edef..f348472 100644 --- a/radeon_pci.c +++ b/radeon_pci.c @@ -36,6 +36,7 @@ int radeon_pci_init(struct radeon_pci *pradeon) struct pci_device *device; int r = 0; + pradeon->dev = NULL; if (pci_system_init()) { fprintf(stderr, "Failed to initialize libpciaccess\n"); return -1; @@ -48,6 +49,11 @@ int radeon_pci_init(struct radeon_pci *pradeon) iter = pci_slot_match_iterator_create(&match); while ((device = pci_device_next(iter))) { pci_device_probe(device); + + if ((device->device_class & 0x00FF0000) != 0x30000) { + continue; + } + /* ATI vendor id 0x1002 and we are looking for a video * card class 0x03 with subclass 0x00 (VGA) */ @@ -55,6 +61,10 @@ int radeon_pci_init(struct radeon_pci *pradeon) pradeon->mmio_base = device->regions[2].base_addr; pradeon->mmio_size = device->regions[2].size; pradeon->dev = device; + fprintf(stderr, "probed %02d:%02d.%d 0x%08X (0x%08X %d|0x%08X)\n", + device->bus, device->dev, device->func, device->device_class, + (unsigned)pradeon->mmio_base, (unsigned)pradeon->mmio_size, + (unsigned)pradeon->mmio_size); break; } } @@ -63,9 +73,10 @@ int radeon_pci_init(struct radeon_pci *pradeon) fprintf(stderr, "Cannot find radeon device\n"); return -1; } - if (pci_device_map_range(pradeon->dev, pradeon->mmio_base, pradeon->mmio_size, + r = pci_device_map_range(pradeon->dev, pradeon->mmio_base, pradeon->mmio_size, PCI_DEV_MAP_FLAG_WRITABLE, - (void**)&pradeon->mmio)) { + (void**)&pradeon->mmio); + if (r) { fprintf(stderr, "Mapping mmio failed (are you root ?)\n"); return -1; } |