Home | History | Annotate | Line # | Download | only in isa
isavar.h revision 1.2
      1  1.1  mycroft /*-
      2  1.1  mycroft  * Copyright (c) 1992 Berkeley Software Design, Inc. All rights reserved.
      3  1.1  mycroft  * The Berkeley Software Design Inc. software License Agreement specifies
      4  1.1  mycroft  * the terms and conditions for redistribution.
      5  1.1  mycroft  *
      6  1.2  mycroft  *	BSDI $Id: isavar.h,v 1.2 1993/10/06 12:09:25 mycroft Exp $
      7  1.1  mycroft  */
      8  1.1  mycroft 
      9  1.1  mycroft /*
     10  1.1  mycroft  * ISA driver attach arguments
     11  1.1  mycroft  */
     12  1.1  mycroft struct isa_attach_args {
     13  1.1  mycroft 	u_short	ia_iobase;		/* base i/o address */
     14  1.1  mycroft 	u_short	ia_iosize;		/* span of ports used */
     15  1.1  mycroft 	u_short	ia_irq;			/* interrupt request */
     16  1.1  mycroft 	u_short	ia_drq;			/* DMA request */
     17  1.1  mycroft 	caddr_t ia_maddr;		/* physical i/o mem addr */
     18  1.1  mycroft 	u_int	ia_msize;		/* size of i/o memory */
     19  1.1  mycroft 	void	*ia_aux;		/* driver specific */
     20  1.1  mycroft };
     21  1.2  mycroft 
     22  1.2  mycroft #define	IOBASEUNK	0xffff		/* i/o address is unknown */
     23  1.2  mycroft #define	DRQUNK		0xffff		/* DMA request line is unknown */
     24  1.1  mycroft 
     25  1.1  mycroft /*
     26  1.1  mycroft  * per-device ISA variables
     27  1.1  mycroft  */
     28  1.1  mycroft struct isadev {
     29  1.1  mycroft 	struct  device *id_dev;		/* back pointer to generic */
     30  1.1  mycroft 	struct	isadev *id_bchain;	/* forward link in bus chain */
     31  1.1  mycroft };
     32  1.1  mycroft 
     33  1.1  mycroft /*
     34  1.1  mycroft  * ISA masterbus
     35  1.1  mycroft  */
     36  1.1  mycroft struct isa_softc {
     37  1.1  mycroft 	struct	device sc_dev;		/* base device */
     38  1.1  mycroft 	struct	isadev *sc_isadev;	/* list of all children */
     39  1.1  mycroft };
     40  1.1  mycroft 
     41  1.1  mycroft #define		cf_iobase		cf_loc[0]
     42  1.1  mycroft #define		cf_iosize		cf_loc[1]
     43  1.1  mycroft #define		cf_maddr		cf_loc[2]
     44  1.1  mycroft #define		cf_msize		cf_loc[3]
     45  1.1  mycroft #define		cf_irq			cf_loc[4]
     46  1.1  mycroft #define		cf_drq			cf_loc[5]
     47  1.1  mycroft 
     48  1.1  mycroft /*
     49  1.1  mycroft  * Interrupt handler chains.  Interrupt handlers should return 0 for
     50  1.1  mycroft  * `not I', 1 (`I took care of it'), or -1 (`I guess it was mine, but
     51  1.1  mycroft  * I wasn't expecting it').  intr_establish() inserts a handler into
     52  1.1  mycroft  * the list.  The handler is called with its (single) argument.
     53  1.1  mycroft  */
     54  1.1  mycroft struct intrhand {
     55  1.1  mycroft 	int	(*ih_fun)();
     56  1.1  mycroft 	void	*ih_arg;
     57  1.1  mycroft 	u_long	ih_count;
     58  1.1  mycroft 	struct	intrhand *ih_next;
     59  1.1  mycroft } *intrhand[16];
     60  1.1  mycroft 
     61  1.1  mycroft void intr_establish __P((int intr, struct intrhand *, enum devclass));
     62  1.1  mycroft 
     63  1.1  mycroft /*
     64  1.1  mycroft  * software conventions
     65  1.1  mycroft  */
     66  1.1  mycroft typedef enum { BUS_ISA, BUS_EISA, BUS_MCA } isa_type;
     67  1.1  mycroft 
     68  1.1  mycroft extern caddr_t atdevbase;	/* kernel virtual address of "hole" */
     69  1.1  mycroft extern isa_type isa_bustype;	/* type of bus */
     70  1.1  mycroft 
     71  1.1  mycroft /*
     72  1.1  mycroft  * Given a kernel virtual address for some location
     73  1.1  mycroft  * in the "hole" I/O space, return a physical address.
     74  1.1  mycroft  */
     75  1.1  mycroft #define	ISA_PHYSADDR(v)	((caddr_t) ((u_long)(v) - atdevbase + IOM_BEGIN))
     76  1.1  mycroft /*
     77  1.1  mycroft  * Given a physical address in the "hole",
     78  1.1  mycroft  * return a kernel virtual address.
     79  1.1  mycroft  */
     80  1.1  mycroft #define	ISA_HOLE_VADDR(p)  ((caddr_t) ((u_long)(p) - IOM_BEGIN + atdevbase))
     81