xref: /netbsd-src/sys/arch/powerpc/include/isa_machdep.h (revision cbab9cadce21ae72fac13910001079fff214cc29)
1*cbab9cadSchs /*	$NetBSD: isa_machdep.h,v 1.9 2012/10/27 17:18:07 chs Exp $	*/
2ba34947fSmatt 
3ba34947fSmatt /*-
4ba34947fSmatt  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
5ba34947fSmatt  * All rights reserved.
6ba34947fSmatt  *
7ba34947fSmatt  * This code is derived from software contributed to The NetBSD Foundation
8ba34947fSmatt  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9ba34947fSmatt  * NASA Ames Research Center.
10ba34947fSmatt  *
11ba34947fSmatt  * Redistribution and use in source and binary forms, with or without
12ba34947fSmatt  * modification, are permitted provided that the following conditions
13ba34947fSmatt  * are met:
14ba34947fSmatt  * 1. Redistributions of source code must retain the above copyright
15ba34947fSmatt  *    notice, this list of conditions and the following disclaimer.
16ba34947fSmatt  * 2. Redistributions in binary form must reproduce the above copyright
17ba34947fSmatt  *    notice, this list of conditions and the following disclaimer in the
18ba34947fSmatt  *    documentation and/or other materials provided with the distribution.
19ba34947fSmatt  *
20ba34947fSmatt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21ba34947fSmatt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22ba34947fSmatt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23ba34947fSmatt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24ba34947fSmatt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25ba34947fSmatt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26ba34947fSmatt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27ba34947fSmatt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28ba34947fSmatt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29ba34947fSmatt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30ba34947fSmatt  * POSSIBILITY OF SUCH DAMAGE.
31ba34947fSmatt  */
32ba34947fSmatt 
33ba34947fSmatt /*-
34ba34947fSmatt  * Copyright (c) 1990 The Regents of the University of California.
35ba34947fSmatt  * All rights reserved.
36ba34947fSmatt  *
37ba34947fSmatt  * This code is derived from software contributed to Berkeley by
38ba34947fSmatt  * William Jolitz.
39ba34947fSmatt  *
40ba34947fSmatt  * Redistribution and use in source and binary forms, with or without
41ba34947fSmatt  * modification, are permitted provided that the following conditions
42ba34947fSmatt  * are met:
43ba34947fSmatt  * 1. Redistributions of source code must retain the above copyright
44ba34947fSmatt  *    notice, this list of conditions and the following disclaimer.
45ba34947fSmatt  * 2. Redistributions in binary form must reproduce the above copyright
46ba34947fSmatt  *    notice, this list of conditions and the following disclaimer in the
47ba34947fSmatt  *    documentation and/or other materials provided with the distribution.
48ba34947fSmatt  * 3. Neither the name of the University nor the names of its contributors
49ba34947fSmatt  *    may be used to endorse or promote products derived from this software
50ba34947fSmatt  *    without specific prior written permission.
51ba34947fSmatt  *
52ba34947fSmatt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53ba34947fSmatt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54ba34947fSmatt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55ba34947fSmatt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56ba34947fSmatt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57ba34947fSmatt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58ba34947fSmatt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59ba34947fSmatt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60ba34947fSmatt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61ba34947fSmatt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62ba34947fSmatt  * SUCH DAMAGE.
63ba34947fSmatt  *
64ba34947fSmatt  *	@(#)isa.h	5.7 (Berkeley) 5/9/91
65ba34947fSmatt  */
66ba34947fSmatt 
67ba34947fSmatt /*
68ba34947fSmatt  * Various pieces of the sandpoint port want to include this file without
69ba34947fSmatt  * or in spite of using isavar.h, and should be fixed.
70ba34947fSmatt  */
71ba34947fSmatt 
72ba34947fSmatt #ifndef _POWERPC_ISA_MACHDEP_H_
73ba34947fSmatt #define _POWERPC_ISA_MACHDEP_H_
74ba34947fSmatt 
759aff02ebSdyoung #include <sys/bus.h>
76ba34947fSmatt #include <dev/isa/isadmavar.h>
77ba34947fSmatt 
78ba34947fSmatt /*
79ba34947fSmatt  * XXX THIS FILE IS A MESS.  copyright: berkeley's probably.
80ba34947fSmatt  * contents from isavar.h and isareg.h, mostly the latter.
81ba34947fSmatt  * perhaps charles's?
82ba34947fSmatt  *
83ba34947fSmatt  * copyright from berkeley's isa.h which is now dev/isa/isareg.h.
84ba34947fSmatt  */
85ba34947fSmatt 
86ba34947fSmatt /*
87ba34947fSmatt  * Types provided to machine-independent ISA code.
88ba34947fSmatt  */
89ba34947fSmatt struct powerpc_isa_chipset {
90ba34947fSmatt 	struct isa_dma_state ic_dmastate;
91ba34947fSmatt };
92ba34947fSmatt 
93ba34947fSmatt typedef struct powerpc_isa_chipset *isa_chipset_tag_t;
94ba34947fSmatt 
95ba34947fSmatt struct isabus_attach_args;	/* XXX */
96d974db0aSgarbled struct pic_ops;			/* XXX */
97ba34947fSmatt 
98ba34947fSmatt /*
99ba34947fSmatt  * Functions provided to machine-independent ISA code.
100ba34947fSmatt  */
101036ca983Smatt void	genppc_isa_attach_hook(device_t, device_t, struct isabus_attach_args *);
102dadc0881Sdyoung void	genppc_isa_detach_hook(isa_chipset_tag_t, device_t);
103d974db0aSgarbled const struct evcnt *genppc_isa_intr_evcnt(isa_chipset_tag_t, int);
104d974db0aSgarbled void	*genppc_isa_intr_establish(isa_chipset_tag_t, int /*irq*/, int /*type*/,
105036ca983Smatt 	    int /*level*/, int (* /*ih_fun*/)(void *), void *);
106d974db0aSgarbled void	genppc_isa_intr_disestablish(isa_chipset_tag_t, void *);
107d974db0aSgarbled int	genppc_isa_intr_alloc(isa_chipset_tag_t, struct pic_ops *, int,
108d974db0aSgarbled 	    int, int *);
109ba34947fSmatt 
110ba34947fSmatt #define	isa_dmainit(ic, bst, dmat, d)					\
111ba34947fSmatt 	_isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
11265d8a872Sdyoung #define	isa_dmadestroy(ic)						\
11365d8a872Sdyoung 	_isa_dmadestroy(&(ic)->ic_dmastate)
114ba34947fSmatt #define	isa_dmacascade(ic, c)						\
115ba34947fSmatt 	_isa_dmacascade(&(ic)->ic_dmastate, (c))
116ba34947fSmatt #define	isa_dmamaxsize(ic, c)						\
117ba34947fSmatt 	_isa_dmamaxsize(&(ic)->ic_dmastate, (c))
118ba34947fSmatt #define	isa_dmamap_create(ic, c, s, f)					\
119ba34947fSmatt 	_isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
120ba34947fSmatt #define	isa_dmamap_destroy(ic, c)					\
121ba34947fSmatt 	_isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
122ba34947fSmatt #define	isa_dmastart(ic, c, a, n, p, f, bf)				\
123ba34947fSmatt 	_isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
124ba34947fSmatt #define	isa_dmaabort(ic, c)						\
125ba34947fSmatt 	_isa_dmaabort(&(ic)->ic_dmastate, (c))
126ba34947fSmatt #define	isa_dmacount(ic, c)						\
127ba34947fSmatt 	_isa_dmacount(&(ic)->ic_dmastate, (c))
128ba34947fSmatt #define	isa_dmafinished(ic, c)						\
129ba34947fSmatt 	_isa_dmafinished(&(ic)->ic_dmastate, (c))
130ba34947fSmatt #define	isa_dmadone(ic, c)						\
131ba34947fSmatt 	_isa_dmadone(&(ic)->ic_dmastate, (c))
132ba34947fSmatt #define	isa_dmafreeze(ic)						\
133ba34947fSmatt 	_isa_dmafreeze(&(ic)->ic_dmastate)
134ba34947fSmatt #define	isa_dmathaw(ic)							\
135ba34947fSmatt 	_isa_dmathaw(&(ic)->ic_dmastate)
136ba34947fSmatt #define	isa_dmamem_alloc(ic, c, s, ap, f)				\
137ba34947fSmatt 	_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
138ba34947fSmatt #define	isa_dmamem_free(ic, c, a, s)					\
139ba34947fSmatt 	_isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
140ba34947fSmatt #define	isa_dmamem_map(ic, c, a, s, kp, f)				\
141ba34947fSmatt 	_isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
142ba34947fSmatt #define	isa_dmamem_unmap(ic, c, k, s)					\
143ba34947fSmatt 	_isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
144ba34947fSmatt #define	isa_dmamem_mmap(ic, c, a, s, o, p, f)				\
145ba34947fSmatt 	_isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
146ba34947fSmatt #define isa_drq_alloc(ic, c)						\
147ba34947fSmatt 	_isa_drq_alloc(&(ic)->ic_dmastate, c)
148ba34947fSmatt #define isa_drq_free(ic, c)						\
149ba34947fSmatt 	_isa_drq_free(&(ic)->ic_dmastate, c)
150ba34947fSmatt #define	isa_drq_isfree(ic, c)						\
151ba34947fSmatt 	_isa_drq_isfree(&(ic)->ic_dmastate, (c))
152ba34947fSmatt #define	isa_malloc(ic, c, s, p, f)					\
153ba34947fSmatt 	_isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
154ba34947fSmatt #define	isa_free(a, p)							\
155ba34947fSmatt 	_isa_free((a), (p))
156ba34947fSmatt #define	isa_mappage(m, o, p)						\
157ba34947fSmatt 	_isa_mappage((m), (o), (p))
158ba34947fSmatt 
159ba34947fSmatt #endif /* _POWERPC_ISA_MACHDEP_H_ */
160