Re: New kernel/resource.c

Linus Torvalds (torvalds@transmeta.com)
Mon, 19 Jul 1999 15:34:37 -0700 (PDT)


On Tue, 20 Jul 1999, Martin Mares wrote:
>
> I've finally returned home and looked at your new resource code. I like
> the generalization you've done, but I think it still needs several
> improvements:
>
> (1) We need a way how to search for free region to assign to a new
> device (for example when a new card is inserted or when the BIOS
> forgets to assign an address to a PCI device).

Yes. Note that this is actually a fairly hard problem, exactly because we
don't know the requirements for the region, and a complete description of
the requirements for different things (not just PCI) is hard to do. You
may have only a subset of the regions being acceptable.

I have a version of resource.c that allows you to "walk" the holes, and
for each hole you encounter the caller itself can determine whether a part
of that hole would be acceptable. I'll make my pre-6 patch with this
functionality available..

> (2) For this address allocation we need to know not only which regions
> are allocated by drivers, but also which ones are in use by devices
> even if there is no driver handling them. This can be done by making
> generic bus code (which enumerates all devices on the bus) allocate
> all the regions automatically, but then we need to modify all the
> drivers not to request the regions and leave it only in ISA drivers.
> This requires changing almost every driver, but it's a clean way to go.

It shouldn't be too bad - it really only requires changing
"request_region()", and then we can slowly change PCI drivers to do a
resource search and update the flags to be in-use etc..

Yes, a noticeable amount of changes, but most of them should be doable
gradually. That makes it easier.

> (3) As we are in need of doing such major changes, it would be better to
> take this chance and generalize the things even a bit more: introduce
> a concept of `device' (represented by a structure having a generic
> header and bus-specific fields), automatically attach resource regions
> to devices during bus enumeration and then attach drivers to devices
> during driver init. [This has been described in detail in in the
> bus/device/hotplug proposal I've sent to linux-kernel a month ago.]

The way to go is just take the current "pci_dev_struct", change the name,
and possibly extend it as required. The old PCI functions would still
work..

Linus

-
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/