Home | History | Annotate | Line # | Download | only in isa
isavar.h revision 1.37
      1  1.37       cgd /*	$NetBSD: isavar.h,v 1.37 1999/03/19 05:13:18 cgd Exp $	*/
      2  1.26   thorpej 
      3  1.26   thorpej /*-
      4  1.26   thorpej  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  1.26   thorpej  * All rights reserved.
      6  1.26   thorpej  *
      7  1.26   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.26   thorpej  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  1.26   thorpej  * NASA Ames Research Center.
     10  1.26   thorpej  *
     11  1.26   thorpej  * Redistribution and use in source and binary forms, with or without
     12  1.26   thorpej  * modification, are permitted provided that the following conditions
     13  1.26   thorpej  * are met:
     14  1.26   thorpej  * 1. Redistributions of source code must retain the above copyright
     15  1.26   thorpej  *    notice, this list of conditions and the following disclaimer.
     16  1.26   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.26   thorpej  *    notice, this list of conditions and the following disclaimer in the
     18  1.26   thorpej  *    documentation and/or other materials provided with the distribution.
     19  1.26   thorpej  * 3. All advertising materials mentioning features or use of this software
     20  1.26   thorpej  *    must display the following acknowledgement:
     21  1.26   thorpej  *	This product includes software developed by the NetBSD
     22  1.26   thorpej  *	Foundation, Inc. and its contributors.
     23  1.26   thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.26   thorpej  *    contributors may be used to endorse or promote products derived
     25  1.26   thorpej  *    from this software without specific prior written permission.
     26  1.26   thorpej  *
     27  1.26   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.26   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.26   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.26   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.26   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.26   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.26   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.26   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.26   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.26   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.26   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     38  1.26   thorpej  */
     39  1.11       cgd 
     40   1.8   mycroft /*
     41  1.15       cgd  * Copyright (c) 1995 Chris G. Demetriou
     42   1.8   mycroft  * Copyright (c) 1992 Berkeley Software Design, Inc.
     43   1.8   mycroft  * All rights reserved.
     44   1.7   mycroft  *
     45   1.8   mycroft  * Redistribution and use in source and binary forms, with or without
     46   1.8   mycroft  * modification, are permitted provided that the following conditions
     47   1.8   mycroft  * are met:
     48   1.8   mycroft  * 1. Redistributions of source code must retain the above copyright
     49   1.8   mycroft  *    notice, this list of conditions and the following disclaimer.
     50   1.8   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     51   1.8   mycroft  *    notice, this list of conditions and the following disclaimer in the
     52   1.8   mycroft  *    documentation and/or other materials provided with the distribution.
     53   1.8   mycroft  * 3. All advertising materials mentioning features or use of this software
     54   1.8   mycroft  *    must display the following acknowledgement:
     55   1.8   mycroft  *	This product includes software developed by Berkeley Software
     56   1.8   mycroft  *	Design, Inc.
     57   1.8   mycroft  * 4. The name of Berkeley Software Design must not be used to endorse
     58   1.8   mycroft  *    or promote products derived from this software without specific
     59   1.8   mycroft  *    prior written permission.
     60   1.8   mycroft  *
     61   1.8   mycroft  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
     62   1.8   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     63   1.8   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     64   1.8   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
     65   1.8   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     66   1.8   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     67   1.8   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     68   1.8   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     69   1.8   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     70   1.8   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     71   1.8   mycroft  * SUCH DAMAGE.
     72   1.8   mycroft  *
     73  1.11       cgd  *	BSDI Id: isavar.h,v 1.5 1992/12/01 18:06:00 karels Exp
     74   1.7   mycroft  */
     75   1.7   mycroft 
     76  1.19       cgd #ifndef _DEV_ISA_ISAVAR_H_
     77  1.19       cgd #define	_DEV_ISA_ISAVAR_H_
     78  1.19       cgd 
     79   1.7   mycroft /*
     80  1.15       cgd  * Definitions for ISA autoconfiguration.
     81  1.15       cgd  */
     82  1.15       cgd 
     83  1.15       cgd #include <sys/queue.h>
     84  1.19       cgd #include <machine/bus.h>
     85  1.18       cgd 
     86  1.21       cgd /*
     87  1.21       cgd  * Structures and definitions needed by the machine-dependent header.
     88  1.21       cgd  */
     89  1.21       cgd struct isabus_attach_args;
     90  1.21       cgd 
     91  1.37       cgd #include <machine/isa_machdep.h>
     92  1.21       cgd 
     93  1.18       cgd /*
     94  1.18       cgd  * ISA bus attach arguments
     95  1.18       cgd  */
     96  1.18       cgd struct isabus_attach_args {
     97  1.24   thorpej 	char	*iba_busname;		/* XXX should be common */
     98  1.24   thorpej 	bus_space_tag_t iba_iot;	/* isa i/o space tag */
     99  1.24   thorpej 	bus_space_tag_t iba_memt;	/* isa mem space tag */
    100  1.26   thorpej 	bus_dma_tag_t iba_dmat;		/* isa DMA tag */
    101  1.21       cgd 	isa_chipset_tag_t iba_ic;
    102  1.18       cgd };
    103  1.15       cgd 
    104  1.15       cgd /*
    105   1.7   mycroft  * ISA driver attach arguments
    106   1.7   mycroft  */
    107   1.7   mycroft struct isa_attach_args {
    108  1.24   thorpej 	bus_space_tag_t ia_iot;		/* isa i/o space tag */
    109  1.24   thorpej 	bus_space_tag_t ia_memt;	/* isa mem space tag */
    110  1.26   thorpej 	bus_dma_tag_t ia_dmat;		/* DMA tag */
    111  1.24   thorpej 
    112  1.21       cgd 	isa_chipset_tag_t ia_ic;
    113  1.19       cgd 
    114  1.12   mycroft 	int	ia_iobase;		/* base i/o address */
    115  1.12   mycroft 	int	ia_iosize;		/* span of ports used */
    116  1.12   mycroft 	int	ia_irq;			/* interrupt request */
    117  1.12   mycroft 	int	ia_drq;			/* DMA request */
    118  1.29  augustss 	int	ia_drq2;		/* second DMA request */
    119  1.13   mycroft 	int	ia_maddr;		/* physical i/o mem addr */
    120   1.7   mycroft 	u_int	ia_msize;		/* size of i/o memory */
    121   1.7   mycroft 	void	*ia_aux;		/* driver specific */
    122   1.7   mycroft };
    123   1.7   mycroft 
    124  1.28       jtk #include "locators.h"
    125  1.28       jtk 
    126  1.28       jtk #define	IOBASEUNK	ISACF_PORT_DEFAULT	/* i/o address is unknown */
    127  1.28       jtk #define	IRQUNK		ISACF_IRQ_DEFAULT	/* interrupt request line is unknown */
    128  1.28       jtk #define	DRQUNK		ISACF_DRQ_DEFAULT	/* DMA request line is unknown */
    129  1.28       jtk #define	MADDRUNK	ISACF_IOMEM_DEFAULT	/* shared memory address is unknown */
    130   1.7   mycroft 
    131   1.7   mycroft /*
    132  1.15       cgd  * ISA master bus
    133   1.7   mycroft  */
    134   1.7   mycroft struct isa_softc {
    135   1.7   mycroft 	struct	device sc_dev;		/* base device */
    136  1.19       cgd 
    137  1.24   thorpej 	bus_space_tag_t sc_iot;		/* isa io space tag */
    138  1.24   thorpej 	bus_space_tag_t sc_memt;	/* isa mem space tag */
    139  1.26   thorpej 	bus_dma_tag_t sc_dmat;		/* isa DMA tag */
    140  1.24   thorpej 
    141  1.21       cgd 	isa_chipset_tag_t sc_ic;
    142   1.7   mycroft };
    143  1.26   thorpej 
    144  1.28       jtk #define		cf_iobase		cf_loc[ISACF_PORT]
    145  1.28       jtk #define		cf_iosize		cf_loc[ISACF_SIZE]
    146  1.28       jtk #define		cf_maddr		cf_loc[ISACF_IOMEM]
    147  1.28       jtk #define		cf_msize		cf_loc[ISACF_IOSIZ]
    148  1.28       jtk #define		cf_irq			cf_loc[ISACF_IRQ]
    149  1.28       jtk #define		cf_drq			cf_loc[ISACF_DRQ]
    150  1.29  augustss #define		cf_drq2			cf_loc[ISACF_DRQ2]
    151   1.7   mycroft 
    152   1.7   mycroft /*
    153  1.15       cgd  * ISA interrupt handler manipulation.
    154  1.15       cgd  *
    155  1.15       cgd  * To establish an ISA interrupt handler, a driver calls isa_intr_establish()
    156  1.15       cgd  * with the interrupt number, type, level, function, and function argument of
    157  1.15       cgd  * the interrupt it wants to handle.  Isa_intr_establish() returns an opaque
    158  1.35       leo  * handle to an event descriptor if it succeeds, and returns NULL on failure.
    159  1.35       leo  * (XXX: some drivers can't handle this, since the former behaviour was to
    160  1.35       leo  * invoke panic() on failure). When the system does not accept any of the
    161  1.35       leo  * interrupt types supported by the driver, the driver should fail the attach.
    162  1.35       leo  * Interrupt handlers should return 0 for "interrupt not for me", 1  for
    163  1.35       leo  * "I took care of it", or -1 for "I guess it was mine, but I wasn't
    164  1.35       leo  * expecting it."
    165  1.15       cgd  *
    166  1.15       cgd  * To remove an interrupt handler, the driver calls isa_intr_disestablish()
    167  1.15       cgd  * with the handle returned by isa_intr_establish() for that handler.
    168  1.15       cgd  */
    169  1.15       cgd 
    170  1.15       cgd /* ISA interrupt sharing types */
    171  1.17   mycroft char	*isa_intr_typename __P((int type));
    172  1.26   thorpej 
    173  1.26   thorpej /*
    174  1.26   thorpej  * Some ISA devices (e.g. on a VLB) can perform 32-bit DMA.  This
    175  1.26   thorpej  * flag is passed to bus_dmamap_create() to indicate that fact.
    176  1.26   thorpej  */
    177  1.26   thorpej #define	ISABUS_DMA_32BIT	BUS_DMA_BUS1
    178  1.19       cgd 
    179  1.19       cgd #endif /* _DEV_ISA_ISAVAR_H_ */
    180