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