Resource management patch

Martin Mares (mj@ucw.cz)
Tue, 6 Jul 1999 14:56:03 +0200


Hello,

I've tried to solve all known problems with the resource management stuff
and make my PCI code use it.

The result is available at ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/alpha/l-rsrc1.gz.

Testing, bug reports and suggestions are as usually welcome.

Resource manager changes:

o Resource records are now allocated dynamically, the few ones that
are needed before MM starts up (console driver and so on) are taken
from a small static pool.
o Occupation and requesting of regions are orthogonal, you can also
request a part of a occupied region and so on.
o Removed unneeded cli().
o request/release pair doesn't leave any traces (except for splitting
a region which is harmless since we are able to request multiple
regions at once), but it's now ifdef'd out until we fix the drivers.
o Better /proc interface -- lists not only requestors, but also device
names corresponding to occuped regions (if available).
o Introduced 'struct dev' which is used as a device descriptor. For now
it contains only a pointer to device name used by the resource management
stuff, but in the future it will hold more data (this is the first
step on the way to generic device handling I've suggested some weeks
ago).
o Introduced physaddr_t and made all resource mgmt stuff use it for
physical addresses instead of unsigned long (it behaves still the same
way since it's defined as unsigned long now, but it makes the code
cleaner and also makes possible to support architectures with physical
space larger than virtual space [see recent discussions on l-k list
for rationale and some examples]).
o `struct dev' and generic resource mgmt now resides in <linux/device.h>
and <linux/ioport.h> contains only specific instances for I/O and memory.
o Changed semantics of occupy_region(): returns INVALID_PHYSADDR in case
of error (0 is a correct physical address which can be assigned if it's
free), accepts struct dev* instead of region name and doesn't mark the
occupied region as requested (you need to call request_region separately
if you want).
o request_xxx functions now return error code, so it's no longer needed
to call check_xxx before unless you want to do autoprobing.

PCI changes:

o We now scan region sizes, remember them in struct pci_dev and ask
the resource manager to occupy all the regions.
o Added struct dev to struct pci_dev and remember device name string
there, so that we don't have to construct it every time we want
to print an error message.
o Publish region sizes via /proc/bus/pci/devices, so that lspci
can benefit from them as well (an experimental version of pciutils
supporting this feature is already available in my alpha directory).
o Changed GFP_ATOMIC to GFP_KERNEL in all pci structure allocations.
o PC: when BIOS forgets to assign an I/O region, use real resource
management instead of the ugly heuristics we've used before. This
should finally avoid resource collisions.
o Added fixup for i448BX chipset to get the AGP memory windows
allocated correctly.

Other changes:

o Removed a bogus comment in arch/i386/kernel/setup.c
o Fixed occupy_region() calls in sparc code to reflect my changes.

Have a nice fortnight

-- 
Martin `MJ' Mares   <mj@ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"How an engineer writes a program: Start by debugging an empty file..."

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