int
isa_intr_alloc(
isa_chipset_tag_t ic
, int mask
, int type
, int *irq
)
const
struct
evcnt
*
isa_intr_evcnt(
isa_chipset_tag_t ic
, int irq
)
void
*
isa_intr_establish(
isa_chipset_tag_t ic
, int irq
, int type
, int level
, int (*handler)(void *)
, void *arg
)
void
isa_intr_disestablish(
isa_chipset_tag_t ic
, void *ih
)
int
isa_dmamap_create(
isa_chipset_tag_t ic
, int chan
, bus_size_t size
, int flags
)
void
isa_dmamap_destroy(
isa_chipset_tag_t ic
, int chan
)
int
isa_dmamem_alloc(
isa_chipset_tag_t ic
, int chan
, bus_size_t size
, bus_addr_t *addrp
, int flags
)
void
isa_dmamem_free(
isa_chipset_tag_t ic
, int chan
, bus_addr_t addr
, bus_size_t size
)
int
isa_dmamem_map(
isa_chipset_tag_t ic
, int chan
, bus_addr_t addr
, bus_size_t size
, void **kvap
, int flags
)
void
isa_dmamem_unmap(
isa_chipset_tag_t ic
, int chan
, void *kva
, size_t size
)
void
*
isa_malloc(
isa_chipset_tag_t ic
, int chan
, size_t size
, int pool
, int flags
)
void
isa_free(
void *addrp
, int pool
)
int
isa_dmastart(
isa_chipset_tag_t ic
, int chan
, bus_addr_t addr
, bus_size_t size
, struct lwp *lwp
, int flags
, int bf
)
void
isa_dmaabort(
isa_chipset_tag_t ic
, int chan
)
bus_size_t
isa_dmacount(
isa_chipset_tag_t ic
, int chan
)
void
isa_dmadone(
isa_chipset_tag_t ic
, int chan
)
bus_size_t
isa_dmamaxsize(
isa_chipset_tag_t ic
, int chan
)
int
isa_drq_alloc(
isa_chipset_tag_t ic
, int chan
)
int
isa_drq_free(
isa_chipset_tag_t ic
, int chan
)
int
isa_drq_isfree(
isa_chipset_tag_t ic
, int chan
)
int
isa_dmacascade(
isa_chipset_tag_t ic
, int chan
)
paddr_t
isa_mappage(
void *mem
, off_t offset
, int prot
)
The ISA bus was introduced on the IBM PC/AT. It is an extension to the original bus found on the original IBM PC. The ISA bus is essentially the host bus of the Intel 80286 processor, however the widespread acceptance of the bus as a de facto standard has seen it appear on systems without Intel processors.
The ISA bus has a 16-bit data bus, a 24-bit memory address bus, a 16-bit I/O address bus, and operates at 8MHz. It provides 15 interrupt lines and 8 DMA channels supporting DMA transfers of 64KB or 128KB transfers depending on the width of the channel being used. Historically, some devices only decoded the 10 lowest bits of the I/O address bus, preventing use of the full 16-bit address space.
On newer machines, the ISA bus is no longer connected directly to the host bus, and is usually connected via a PCI-ISA bridge. Either way, the bus looks the same to the device driver.
isa_chipset_tag_t
struct
isa_attach_args
bus_space_tag_t ia_iot; /* isa i/o space tag */
bus_space_tag_t ia_memt; /* isa mem space tag */
bus_dma_tag_t ia_dmat; /* DMA tag */
isa_chipset_tag_t ia_ic;
int ia_iobase; /* base i/o address */
int ia_iosize; /* span of ports used */
int ia_maddr; /* physical mem addr */
u_int ia_msize; /* size of memory */
int ia_irq; /* interrupt request */
int ia_drq; /* DMA request */
int ia_drq2; /* second DMA request */
void *ia_aux; /* driver specific */
ic
, mask
, type
, irq
)
ic
, irq
)
irq
.
ic
, irq
, type
, level
, handler
, arg
)
)
with the interrupt number
irq
,
type
type
,
and level
level
.
When the interrupt occurs the function
handler
is called with argument
arg
.
Valid values for
type
are:
)
returns an opaque handle to an event descriptor if it succeeds, and
returns NULL on failure.
ic
, ih
)
ih
.
The handle was returned from
isa_intr_establish(
).
ic
, chan
)
chan
for future use.
Normally, this call precedes an
isa_dmamap_create(
)
call.
It is an error to start DMA on a channel that has not been reserved with
isa_drq_alloc(
).
ic
, chan
)
chan
as available again.
ic
, chan
, size
, flags
)
chan
.
It is initialised to accept maximum DMA transfers of size
size
.
Valid values for the
flags
argument are the same as for
bus_dmamap_create(
)
(see
bus_dma(9)).
This function returns zero on success or an error value on failure.
ic
, chan
)
chan
.
ic
, chan
, size
, addrp
, flags
)
size
for channel
chan
.
Valid values for the
flags
argument are the same as for
bus_dmamem_alloc(
)
(see
bus_dma(9)).
The bus-address of the memory is returned in
addrp
.
This function returns zero on success or an error value on failure.
ic
, chan
, addr
, size
)
)
for channel
chan
.
The bus-address and size of the memory are specified by
addr
and
size
respectively.
ic
, chan
, addr
, size
, kvap
, flags
)
))
specified by bus-address
addr
and of size
size
into kernel virtual address space for DMA channel
chan
.
Valid values for the
flags
argument are the same as for
bus_dmamem_map(
)
(see
bus_dma(9)).
The kernel virtual address is returned in
kvap
.
This function returns zero on success or an error value on failure.
ic
, chan
, kva
, size
)
))
of size
size
for channel
chan
.
The kernel virtual address space used by the mapping is freed.
ic
, chan
, size
, pool
, flags
)
)
and
isa_dmamem_map(
).
The argument
pool
is a pool to record the memory allocation.
This function returns a pointer to the DMA-safe memory.
addrp
, pool
)
)
and
isa_dmamem_free(
).
The argument
addrp
is the pointer to the DMA-safe memory returned by
isa_malloc(
).
The argument
pool
is the same as the value passed to
isa_malloc(
).
ic
, chan
, addr
, size
, lwp
, flags
, bf
)
addr
of size
size
into the DMA controller at channel
chan
and set it in motion.
The argument
lwp
is used to indicate the address space in which the buffer is located.
If NULL, the buffer is assumed to be in kernel space.
Otherwise, the buffer is assumed to be in lwp
lwp
's
address space.
The argument
flags
describes the type of ISA DMA.
Valid values are:
bf
is the bus-space flags.
Valid values are the same as for
bus_dmamap_load(
)
(see
bus_dma(9)).
ic
, chan
)
chan
.
ic
, chan
)
chan
.
ic
, chan
)
chan
after a DMA transfer has completed.
ic
, chan
)
chan
.
ic
, chan
)
ia_drq
or
ia_drq2
members of
struct
isa_attach_args
are wildcarded, then the driver is expected to probe the hardware for
valid DMA channels.
In this case, the driver can check to see if the hardware-supported
DMA channel
chan
is available for use.
ic
, chan
)
chan
to accept external DMA control by the device hardware.
mem
, offset
, prot
)
struct
isa_attach_args
hinting at "locations" on the ISA bus where the device may be located.
They should use the
ia_iobase,
ia_iosize,
ia_maddr,
and
ia_msize
members.
Not all of these hints will be necessary; locators may be wildcarded
with IOBASEUNK and MADDRUNK for
ia_iobase
and
ia_maddr
respectively.
If a driver can probe the device for configuration information at default
locations, it may update the members of
struct
isa_attach_args
.
The IRQ and DMA locators can also be wildcarded with IRQUNK and DRQUNK
respectively.
During the driver attach step, the I/O and memory address spaces should be mapped (see bus_space(9)).
ia_drq
and
ia_drq2
members of
struct
isa_attach_args
.
Before allocating resources for DMA transfers on the ISA bus, a driver
should check the maximum allowable DMA transfer size for the DMA
channel using
isa_dmamaxsize().
A DMA map should be created first using
isa_dmamap_create().
A DMA map describes how DMA memory is loaded into the DMA controllers.
Only DMA-safe memory can be used for DMA transfers.
DMA-safe memory is allocated using
isa_dmamem_alloc(
).
The memory allocated by
isa_dmamem_alloc(
)
must now be mapped into kernel virtual address space by
isa_dmamem_map(
)
so that it can be accessed by the driver.
For a DMA transfer from the host to the device, the driver will fill
the DMA memory with the data to be transferred.
The DMA-transfer of the memory is started using
isa_dmastart()
with
flags
containing DMAMODE_WRITE.
When the DMA transfer is completed, a call to
isa_dmadone()
cleans up the DMA transfer by unloading the memory from the
controller.
For a DMA transfer from the device to the host, the DMA-transfer is
started using
isa_dmastart()
with
flags
containing DMAMODE_READ.
When the DMA transfer is completed, a call to
isa_dmadone()
cleans up the DMA transfer by unloading the memory from the
controller.
The memory can now be access by the driver.
When the DMA resources are no longer required they should be released
using
isa_dmamem_unmap(),
isa_dmamem_free(
)
and
isa_dmamap_destroy(
).
/usr/src
.
The ISA subsystem itself is implemented within the files
sys/dev/isa/isa.c
and
sys/dev/isa/isadma.c
.
)
was to invoke
panic(
)
on failure.
isa_intr_establish(
)
now returns NULL on failure.
Some old drivers written for the former behaviour discard the return value.