Home | History | Annotate | Line # | Download | only in dev
      1 /*	$NetBSD: obiovar.h,v 1.4 2011/07/01 19:12:53 dyoung Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  * NASA Ames Research Center.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in the
     18  *    documentation and/or other materials provided with the distribution.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30  * POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 /*
     34  * Copyright (c) 1995 Chris G. Demetriou
     35  * Copyright (c) 1992 Berkeley Software Design, Inc.
     36  * All rights reserved.
     37  *
     38  * Redistribution and use in source and binary forms, with or without
     39  * modification, are permitted provided that the following conditions
     40  * are met:
     41  * 1. Redistributions of source code must retain the above copyright
     42  *    notice, this list of conditions and the following disclaimer.
     43  * 2. Redistributions in binary form must reproduce the above copyright
     44  *    notice, this list of conditions and the following disclaimer in the
     45  *    documentation and/or other materials provided with the distribution.
     46  * 3. All advertising materials mentioning features or use of this software
     47  *    must display the following acknowledgement:
     48  *      This product includes software developed by Berkeley Software
     49  *      Design, Inc.
     50  * 4. The name of Berkeley Software Design must not be used to endorse
     51  *    or promote products derived from this software without specific
     52  *    prior written permission.
     53  *
     54  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
     55  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     56  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     57  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
     58  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     59  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     60  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     61  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     62  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     63  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     64  * SUCH DAMAGE.
     65  *
     66  *      BSDI Id: isavar.h,v 1.5 1992/12/01 18:06:00 karels Exp
     67  */
     68 
     69 #ifndef _LANDISK_OBIOVAR_H_
     70 #define _LANDISK_OBIOVAR_H_
     71 
     72 #include <sys/bus.h>
     73 
     74 /* obio tag */
     75 extern struct _bus_space obio_bus_io;
     76 extern struct _bus_space obio_bus_mem;
     77 
     78 /*
     79  * obio bus attach arguments
     80  */
     81 struct obiobus_attach_args {
     82 	const char *oba_busname;	/* XXX should be common */
     83 
     84 	bus_space_tag_t oba_iot;	/* obio i/o space tag */
     85 	bus_space_tag_t oba_memt;	/* obio mem space tag */
     86 };
     87 
     88 /*
     89  * obio bus resources.
     90  */
     91 
     92 struct obio_io {
     93 	int or_addr;
     94 	int or_size;
     95 };
     96 
     97 struct obio_iomem {
     98 	int or_addr;
     99 	int or_size;
    100 };
    101 
    102 struct obio_irq {
    103 	int or_irq;
    104 };
    105 
    106 /*
    107  * driver attach arguments
    108  */
    109 struct obio_attach_args {
    110 	bus_space_tag_t oa_iot;		/* i/o space tag */
    111 	bus_space_tag_t oa_memt;	/* memory space tag */
    112 
    113 	struct obio_io *oa_io;		/* I/O resources */
    114 	int oa_nio;
    115 
    116 	struct obio_iomem *oa_iomem;	/* memory resources */
    117 	int oa_niomem;
    118 
    119 	struct obio_irq *oa_irq;	/* IRQ resources */
    120 	int oa_nirq;
    121 
    122 	void	*oa_aux;		/* driver specific */
    123 };
    124 
    125 #include "locators.h"
    126 
    127 #define	IOBASEUNK	OBIOCF_PORT_DEFAULT	/* i/o address is unknown */
    128 #define	IRQUNK		OBIOCF_IRQ_DEFAULT	/* interrupt request line is unknown */
    129 #define	MADDRUNK	OBIOCF_IOMEM_DEFAULT	/* shared memory address is unknown */
    130 
    131 #define		cf_iobase		cf_loc[OBIOCF_PORT]
    132 #define		cf_iosize		cf_loc[OBIOCF_SIZE]
    133 #define		cf_maddr		cf_loc[OBIOCF_IOMEM]
    134 #define		cf_msize		cf_loc[OBIOCF_IOSIZ]
    135 #define		cf_irq			cf_loc[OBIOCF_IRQ]
    136 
    137 void *obio_intr_establish(int irq, int level, int (*func)(void *), void *arg);
    138 void obio_intr_disestablish(void *ih);
    139 
    140 #endif /* _LANDISK_OBIOVAR_H_ */
    141