Domanda

I'm iterating over iomem_resource children:

struct resource *p;
for (p = iomem_resource.child; p ; p = p->sibling)
    printk(KERN_NOTICE ":: %s %lx %lx-%lx", p->name, p->flags, p->start, p->end);

The output is as follows:

reserved 80000200 0-fff
System RAM 80000200 1000-9fbff
reserved 80000200 9fc00-9ffff
Video ROM 80002200 c0000-c7fff
Adapter ROM 80002200 e2000-eebff
reserved 80000200 f0000-fffff
System RAM 80000200 100000-3ffeffff
ACPI Tables 80000200 3fff0000-3fffffff
0000:00:02.0 21208 e0000000-e7ffffff
0000:00:03.0 20200 f0000000-f001ffff
0000:00:04.0 20200 f0400000-f07fffff
0000:00:04.0 21208 f0800000-f0803fff
0000:00:06.0 20200 f0804000-f0804fff
0000:00:0d.0 20200 f0806000-f0807fff
IOAPIC 0 80000200 fec00000-fec003ff
Local APIC 80000200 fee00000-fee00fff
reserved 200 fffc0000-ffffffff

I'd like to identify PCI regions (like 0000:00:02.0 etc). As far as I see, flags won't help much.

In kernel/resource.c they identify "System RAM" area just by name. What would be the appropriate approach for PCI regions?

È stato utile?

Soluzione

It seems that the right way to identify PCI address regions is to iterate pci resources directly, instead of traversing iomem_resource:

struct pci_dev *dev = 0;
struct resource *p;
for_each_pci_dev(dev)
{
    int i;
    for (i = 0; i < DEVICE_COUNT_RESOURCE; ++i)
        if ((p=dev->resource + i))
            printk(KERN_NOTICE "%lx-%lx %x", p->start, p->end, p->flags);
      // etc...
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top