Subject: Proposed extension to bus.h interface
To: None <tech-kern@NetBSD.ORG>
From: Jason Thorpe <firstname.lastname@example.org>
Date: 08/14/1996 10:51:52
I would like to propose the addition of the following 4 functions to the
int bus_mem_alloc(t, size, alignment, cacheable, bpap, mhp)
bus_mem_size_t size, alignment;
Allocate bus physical address space of size `size' with alignment
`alignment'. If no alignment is required, the caller will pass
the placeholder BUS_MEM_NOALIGN for the `alignment' argument.
Place the resulting bus physical address in `*bpap'. The
bus physical address will be mapped, and the resulting mapping
placed in `*mhp'. If the `cacheable' argument is zero, the
mapping will be cache-inhibited. Returns zero on success,
non-zero on error.
void bus_mem_free(t, memh, size)
Unmap the bus physical address mapped by `memh' and free
the bus physical address space as previously allocated by
bus_mem_alloc(). If `memh' was not mapped by bus_mem_alloc(),
behavior of this function is undefined.
int bus_io_alloc(t, size, alignment, iohp)
bus_io_size_t size, alignment;
Allocate bus i/o space of size `size' with alignment `alignment'.
If no alignment is required, the caller will pass the placeholder
BUS_IO_NOALIGN for the `alignment' argument. Place the resulting
bus i/o address in `*portp'. Map bus i/o space will be mapped,
and the resulting mapping placed in `*iohp'. Returns zero
on success, non-zero on error.
void bus_io_free(u, ioh, size)
Unmap the bus i/o space mapped by `ioh' and free the bus
i/o space as previously allocated by bus_io_alloc(). If
`ioh' was not mapped by bus_io_alloc(), behavior of this
function is undefined.
The reason I propose this is that I have a current need for the
bus_mem_alloc()/bus_mem_free() functions (an EISA ATM card driver).
This particular card requires the host operating system to allocate
bus physical address space, and program an address decoder in order
to map the 1MB of shared memory on the card into host memory.
I don't currently have a need for the bus_io_alloc()/bus_io_free()
functions, but the obvious use for them is the implementation of
Plug N Play support.
I have implemented these functions for the i386 port.
Feedback is appreciated. If there are no objections, I'll go ahead and
commit the necessary changes to the i386 port late next week.
-- save the ancient forests - http://www.bayarea.net/~thorpej/forest/ --
Jason R. Thorpe email@example.com
NASA Ames Research Center Home: 408.866.1912
NAS: M/S 258-6 Work: 415.604.0935
Moffett Field, CA 94035 Pager: 415.428.6939