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