Re: New resources - pls, explain :-(

Petr Vandrovec Ing. VTEI (VANDROVE@vc.cvut.cz)
Fri, 6 Aug 1999 20:10:25 MET-1


On 6 Aug 99 at 10:38, Linus Torvalds wrote:
> > > Think of PCI super-IO devices, for example.
> >
> > BTW have you ever seen such a chip? I never had...
> Oh, they are there. They just don't announce their PCI IO ranges, exactly
> because they implement legacy stuff that doesn't expect them to be
> announced.
...
> Your "let's mark the PCI device busy" approach does not take those very
> reasonable concerns into account. In short, it's not a very good approach.
> Face it, Martin.
Hi Linus,
maybe there is a little misunderstaniding. I thought that acquire_pci_dev
should do (sorry for exact names of locking functions):

lock_wrlock(&ioresource_lock)
failed = 0;
for (i = 0; i < 6; i++) {
pci->resource_allocated[i] = NULL;
if (pci->resource[i].end) {
if (pci->resource[i].flags & IORESOURCE_IOPORT)
pci->resource_allocated[i] = __request_region(&ioport_resource, pci->resource[i].start,
pci->resource[i].end-pci->resource[i].start+1);
else
pci->resource_allocated[i] = __request_region ....
if (!pci->resource_allocated[i]) {
failed = 1;
break;
}
}
}
if (failed) { for ( ; i >= 0; i--) {
if (pci->resource_allocated[i]) release_resource(dummy[i]);
pci->resource_allocated[i] = NULL;
} }
lock_unlock(&ioresource_lock);
return failed ? -ENXIO : 0;

It is common case that you need allocate whole device, preferrably
as atomic operation.
Petr Vandrovec
vandrove@vc.cvut.cz

P.S.: And if we are talking about PIIX4 IDE - should not we add its ioports
into resource[] during pci fixups? Other (promise) do have these resources
listed in config space (I see no reason why we must have mapping resource <->
pci base_address region 1:1, if drivers know about it)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/