Home | History | Annotate | Line # | Download | only in isa
isavar.h revision 1.13
      1  1.13  mycroft /*	$NetBSD: isavar.h,v 1.13 1995/01/02 20:06:33 mycroft Exp $	*/
      2  1.11      cgd 
      3   1.8  mycroft /*
      4   1.8  mycroft  * Copyright (c) 1992 Berkeley Software Design, Inc.
      5   1.8  mycroft  * All rights reserved.
      6   1.7  mycroft  *
      7   1.8  mycroft  * Redistribution and use in source and binary forms, with or without
      8   1.8  mycroft  * modification, are permitted provided that the following conditions
      9   1.8  mycroft  * are met:
     10   1.8  mycroft  * 1. Redistributions of source code must retain the above copyright
     11   1.8  mycroft  *    notice, this list of conditions and the following disclaimer.
     12   1.8  mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.8  mycroft  *    notice, this list of conditions and the following disclaimer in the
     14   1.8  mycroft  *    documentation and/or other materials provided with the distribution.
     15   1.8  mycroft  * 3. All advertising materials mentioning features or use of this software
     16   1.8  mycroft  *    must display the following acknowledgement:
     17   1.8  mycroft  *	This product includes software developed by Berkeley Software
     18   1.8  mycroft  *	Design, Inc.
     19   1.8  mycroft  * 4. The name of Berkeley Software Design must not be used to endorse
     20   1.8  mycroft  *    or promote products derived from this software without specific
     21   1.8  mycroft  *    prior written permission.
     22   1.8  mycroft  *
     23   1.8  mycroft  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
     24   1.8  mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25   1.8  mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26   1.8  mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
     27   1.8  mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28   1.8  mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29   1.8  mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30   1.8  mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31   1.8  mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32   1.8  mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33   1.8  mycroft  * SUCH DAMAGE.
     34   1.8  mycroft  *
     35  1.11      cgd  *	BSDI Id: isavar.h,v 1.5 1992/12/01 18:06:00 karels Exp
     36   1.7  mycroft  */
     37   1.7  mycroft 
     38   1.7  mycroft /*
     39   1.7  mycroft  * ISA driver attach arguments
     40   1.7  mycroft  */
     41   1.7  mycroft struct isa_attach_args {
     42  1.12  mycroft 	int	ia_iobase;		/* base i/o address */
     43  1.12  mycroft 	int	ia_iosize;		/* span of ports used */
     44  1.12  mycroft 	int	ia_irq;			/* interrupt request */
     45  1.12  mycroft 	int	ia_drq;			/* DMA request */
     46  1.13  mycroft 	int	ia_maddr;		/* physical i/o mem addr */
     47   1.7  mycroft 	u_int	ia_msize;		/* size of i/o memory */
     48   1.7  mycroft 	void	*ia_aux;		/* driver specific */
     49   1.7  mycroft };
     50   1.7  mycroft 
     51  1.12  mycroft #define	IOBASEUNK	-1		/* i/o address is unknown */
     52  1.12  mycroft #define	IRQUNK		-1		/* interrupt request line is unknown */
     53  1.12  mycroft #define	DRQUNK		-1		/* DMA request line is unknown */
     54  1.13  mycroft #define	MADDRUNK	-1		/* shared memory address is unknown */
     55   1.7  mycroft 
     56   1.7  mycroft /*
     57   1.7  mycroft  * per-device ISA variables
     58   1.7  mycroft  */
     59   1.7  mycroft struct isadev {
     60   1.7  mycroft 	struct  device *id_dev;		/* back pointer to generic */
     61   1.7  mycroft 	struct	isadev *id_bchain;	/* forward link in bus chain */
     62   1.7  mycroft };
     63   1.7  mycroft 
     64   1.7  mycroft /*
     65   1.7  mycroft  * ISA masterbus
     66   1.7  mycroft  */
     67   1.7  mycroft struct isa_softc {
     68   1.7  mycroft 	struct	device sc_dev;		/* base device */
     69   1.7  mycroft 	struct	isadev *sc_isadev;	/* list of all children */
     70   1.7  mycroft };
     71   1.7  mycroft 
     72   1.7  mycroft #define		cf_iobase		cf_loc[0]
     73   1.7  mycroft #define		cf_iosize		cf_loc[1]
     74   1.7  mycroft #define		cf_maddr		cf_loc[2]
     75   1.7  mycroft #define		cf_msize		cf_loc[3]
     76   1.7  mycroft #define		cf_irq			cf_loc[4]
     77   1.7  mycroft #define		cf_drq			cf_loc[5]
     78   1.7  mycroft 
     79   1.7  mycroft /*
     80   1.7  mycroft  * Interrupt handler chains.  Interrupt handlers should return 0 for
     81   1.7  mycroft  * `not I', 1 (`I took care of it'), or -1 (`I guess it was mine, but
     82   1.7  mycroft  * I wasn't expecting it').  intr_establish() inserts a handler into
     83   1.7  mycroft  * the list.  The handler is called with its (single) argument.
     84   1.7  mycroft  */
     85   1.7  mycroft struct intrhand {
     86   1.7  mycroft 	int	(*ih_fun)();
     87   1.7  mycroft 	void	*ih_arg;
     88   1.7  mycroft 	u_long	ih_count;
     89   1.7  mycroft 	struct	intrhand *ih_next;
     90   1.9  mycroft 	int	ih_level;
     91   1.9  mycroft };
     92   1.7  mycroft 
     93   1.9  mycroft void intr_establish __P((int intr, struct intrhand *));
     94   1.9  mycroft void intr_disestablish __P((int intr, struct intrhand *));
     95   1.7  mycroft void isa_establish __P((struct isadev *, struct device *));
     96   1.7  mycroft 
     97   1.7  mycroft /*
     98   1.7  mycroft  * software conventions
     99   1.7  mycroft  */
    100   1.7  mycroft typedef enum { BUS_ISA, BUS_EISA, BUS_MCA } isa_type;
    101   1.7  mycroft 
    102   1.7  mycroft extern int atdevbase;		/* kernel virtual address of "hole" */
    103   1.7  mycroft extern isa_type isa_bustype;	/* type of bus */
    104   1.7  mycroft 
    105   1.7  mycroft /*
    106   1.7  mycroft  * Given a kernel virtual address for some location
    107   1.7  mycroft  * in the "hole" I/O space, return a physical address.
    108   1.7  mycroft  */
    109   1.7  mycroft #define	ISA_PHYSADDR(v)	((caddr_t) ((u_long)(v) - atdevbase + IOM_BEGIN))
    110   1.7  mycroft /*
    111   1.7  mycroft  * Given a physical address in the "hole",
    112   1.7  mycroft  * return a kernel virtual address.
    113   1.7  mycroft  */
    114   1.7  mycroft #define	ISA_HOLE_VADDR(p)  ((caddr_t) ((u_long)(p) - IOM_BEGIN + atdevbase))
    115