1/*	$NetBSD: isa_machdep.h,v 1.18 2016/10/18 22:04:33 jdolecek Exp $	*/
2
3/*-
4 * Copyright (c) 1998 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) 1997 Leo Weppelman.  All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 *    notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 *    notice, this list of conditions and the following disclaimer in the
43 *    documentation and/or other materials provided with the distribution.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
46 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
47 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
48 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
49 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */
56
57#ifndef _ATARI_ISA_MACHDEP_H_
58#define _ATARI_ISA_MACHDEP_H_
59
60#include <sys/bus.h>
61#include <machine/intr.h>
62#include <dev/isa/isadmavar.h>
63
64struct atari_isa_chipset {
65	struct isa_dma_state ic_dmastate;
66};
67
68typedef struct atari_isa_chipset *isa_chipset_tag_t;
69
70typedef struct	{
71	int		slot;	/* 1/2, determines interrupt line	*/
72	int		ipl;	/* ipl requested			*/
73	int		(*ifunc)(void *);	/* function to call	*/
74	void		*iarg;	/* argument for 'ifunc'			*/
75	struct intrhand	*ihand;	/* save this for disestablishing	*/
76} isa_intr_info_t;
77
78/*
79 * Functions provided to machine-independent ISA code.
80 */
81void	isa_attach_hook(device_t, device_t,
82	    struct isabus_attach_args *);
83void	isa_detach_hook(isa_chipset_tag_t, device_t);
84int	isa_intr_alloc(isa_chipset_tag_t, int, int, int *);
85const struct evcnt *isa_intr_evcnt(isa_chipset_tag_t ic, int irq);
86void	*isa_intr_establish(isa_chipset_tag_t ic, int irq, int type,
87	    int level, int (*)(void *), void *ih_arg);
88void	*isa_intr_establish_xname(isa_chipset_tag_t ic, int irq, int type,
89	    int level, int (*ih_fun)(void *), void *ih_arg, const char *xname);
90void	isa_intr_disestablish(isa_chipset_tag_t ic, void *handler);
91
92#define	isa_dmainit(ic, bst, dmat, d)					\
93	_isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
94#define	isa_dmadestroy(ic)						\
95	_isa_dmadestroy(&(ic)->ic_dmastate)
96#define	isa_dmacascade(ic, c)						\
97	_isa_dmacascade(&(ic)->ic_dmastate, (c))
98#define	isa_dmamaxsize(ic, c)						\
99	_isa_dmamaxsize(&(ic)->ic_dmastate, (c))
100#define	isa_dmamap_create(ic, c, s, f)					\
101	_isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
102#define	isa_dmamap_destroy(ic, c)					\
103	_isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
104#define	isa_dmastart(ic, c, a, n, p, f, bf)				\
105	_isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
106#define	isa_dmaabort(ic, c)						\
107	_isa_dmaabort(&(ic)->ic_dmastate, (c))
108#define	isa_dmacount(ic, c)						\
109	_isa_dmacount(&(ic)->ic_dmastate, (c))
110#define	isa_dmafinished(ic, c)						\
111	_isa_dmafinished(&(ic)->ic_dmastate, (c))
112#define	isa_dmadone(ic, c)						\
113	_isa_dmadone(&(ic)->ic_dmastate, (c))
114#define	isa_dmafreeze(ic)						\
115	_isa_dmafreeze(&(ic)->ic_dmastate)
116#define	isa_dmathaw(ic)							\
117	_isa_dmathaw(&(ic)->ic_dmastate)
118#define	isa_dmamem_alloc(ic, c, s, ap, f)				\
119	_isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
120#define	isa_dmamem_free(ic, c, a, s)					\
121	_isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
122#define	isa_dmamem_map(ic, c, a, s, kp, f)				\
123	_isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
124#define	isa_dmamem_unmap(ic, c, k, s)					\
125	_isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
126#define	isa_dmamem_mmap(ic, c, a, s, o, p, f)				\
127	_isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
128#define isa_drq_alloc(ic, c)						\
129	_isa_drq_alloc(&(ic)->ic_dmastate, c)
130#define isa_drq_free(ic, c)						\
131	_isa_drq_free(&(ic)->ic_dmastate, c)
132#define	isa_drq_isfree(ic, c)						\
133	_isa_drq_isfree(&(ic)->ic_dmastate, (c))
134#define	isa_malloc(ic, c, s, p, f)					\
135	_isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
136#define	isa_free(a, p)							\
137	_isa_free((a), (p))
138#define	isa_mappage(m, o, p)						\
139	_isa_mappage((m), (o), (p))
140
141#endif /* _ATARI_ISA_MACHDEP_H_ */
142