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