Re: New kernel/resource.c

David Howells (d.howells@nexor.co.uk)
Tue, 20 Jul 1999 08:30:15 +0100


On Mon, 19 Jul 1999, Linus Torvalds wrote:

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

My configuration manager supports this already... It has to... certain
configuration protocols (PCI, PnP, PnP-BIOS) specify what I/O and memory
ranges are possible for a device.

> > (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.

I've got support for this too...

> > (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..

And this as well...

>
> Linus

So, if you don't mind me asking, do you have any particular reasons for not
wanting to use my configuration manager? Or is there anything I can do to
improve it that would make it acceptable?

David Howells

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