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