| ISA(9) | Kernel Developer's Manual | ISA(9) | 
ISA, isa_intr_alloc,
  isa_intr_establish,
  isa_intr_disestablish,
  isa_intr_evcnt,
  isa_dmamap_create,
  isa_dmamap_destroy,
  isa_dmamem_alloc,
  isa_dmamem_free,
  isa_dmamem_map,
  isa_dmamem_unmap, isa_malloc,
  isa_free, isa_dmastart,
  isa_dmaabort, isa_dmacount,
  isa_dmadone, isa_dmamaxsize,
  isa_drq_alloc, isa_drq_free,
  isa_drq_isfree,
  isa_dmacascade, isa_mappage
  —
#include <sys/bus.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
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);
#include
    <dev/isa/isadmareg.h>
  
  #include
  <dev/isa/isadmavar.h>
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);
ISA subsystem provides support
  for the ISA bus.
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 bus will make
  use of the following data types:
	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 */
    
    isa_intr_alloc(ic,
    mask, type,
    irq)isa_intr_evcnt(ic,
    irq)isa_intr_establish(ic,
    irq, type,
    level, handler,
    arg)isa_intr_establish() 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:
    isa_intr_establish() returns an opaque
        handle to an event descriptor if it succeeds, and returns NULL on
        failure.
isa_intr_disestablish(ic,
    ih)isa_intr_establish().isa_drq_alloc(ic,
    chan)isa_dmamap_create() call. It is an error to start
      DMA on a channel that has not been reserved with
      isa_drq_alloc().isa_drq_free(ic,
    chan)isa_dmamap_create(ic,
    chan, size,
    flags)bus_dmamap_create() (see
      bus_dma(9)). This function
      returns zero on success or an error value on failure.isa_dmamap_destroy(ic,
    chan)isa_dmamem_alloc(ic,
    chan, size,
    addrp, flags)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.isa_dmamem_free(ic,
    chan, addr,
    size)isa_dmamem_alloc() for channel
      chan. The bus-address and size of the memory are
      specified by addr and size
      respectively.isa_dmamem_map(ic,
    chan, addr,
    size, kvap,
    flags)isa_dmamem_alloc()) 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.isa_dmamem_unmap(ic,
    chan, kva,
    size)isa_dmamem_map()) of size
      size for channel chan. The
      kernel virtual address space used by the mapping is freed.isa_malloc(ic,
    chan, size,
    pool, flags)isa_dmamem_alloc() 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.isa_free(addrp,
    pool)isa_dmamem_unmap()
      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().isa_dmastart(ic,
    chan, addr,
    size, lwp,
    flags, bf)The argument bf is the bus-space flags.
        Valid values are the same as for
        bus_dmamap_load() (see
        bus_dma(9)).
isa_dmaabort(ic,
    chan)isa_dmacount(ic,
    chan)isa_dmadone(ic,
    chan)isa_dmamaxsize(ic,
    chan)isa_drq_isfree(ic,
    chan)isa_dmacascade(ic,
    chan)isa_mappage(mem,
    offset, prot)During the driver attach step, the I/O and memory address spaces should be mapped (see bus_space(9)).
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().
ISA subsystem appeared in
  NetBSD 1.2.
isa_intr_establish() 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.
| January 29, 2006 | NetBSD 9.3 |