xref: /netbsd-src/sys/arch/arc/jazz/jazzisabr.c (revision cf10107d5d3746e98e37d403b996f1965f67f255)
1*cf10107dSdyoung /*	$NetBSD: jazzisabr.c,v 1.13 2011/07/01 19:25:42 dyoung Exp $	*/
2ba6a3c6dSsoda /*	$OpenBSD: isabus.c,v 1.15 1998/03/16 09:38:46 pefo Exp $	*/
3ba6a3c6dSsoda /*	NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp 	*/
4ba6a3c6dSsoda 
5ba6a3c6dSsoda /*-
6ba6a3c6dSsoda  * Copyright (c) 1990 The Regents of the University of California.
7ba6a3c6dSsoda  * All rights reserved.
8ba6a3c6dSsoda  *
9ba6a3c6dSsoda  * This code is derived from software contributed to Berkeley by
10ba6a3c6dSsoda  * William Jolitz and Don Ahn.
11ba6a3c6dSsoda  *
12ba6a3c6dSsoda  * Redistribution and use in source and binary forms, with or without
13ba6a3c6dSsoda  * modification, are permitted provided that the following conditions
14ba6a3c6dSsoda  * are met:
15ba6a3c6dSsoda  * 1. Redistributions of source code must retain the above copyright
16ba6a3c6dSsoda  *    notice, this list of conditions and the following disclaimer.
17ba6a3c6dSsoda  * 2. Redistributions in binary form must reproduce the above copyright
18ba6a3c6dSsoda  *    notice, this list of conditions and the following disclaimer in the
19ba6a3c6dSsoda  *    documentation and/or other materials provided with the distribution.
20aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
21aad01611Sagc  *    may be used to endorse or promote products derived from this software
22aad01611Sagc  *    without specific prior written permission.
23aad01611Sagc  *
24aad01611Sagc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25aad01611Sagc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26aad01611Sagc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27aad01611Sagc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28aad01611Sagc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29aad01611Sagc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30aad01611Sagc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31aad01611Sagc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32aad01611Sagc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33aad01611Sagc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34aad01611Sagc  * SUCH DAMAGE.
35aad01611Sagc  *
36aad01611Sagc  *	@(#)isa.c	7.2 (Berkeley) 5/12/91
37aad01611Sagc  */
38aad01611Sagc 
39aad01611Sagc /*-
40aad01611Sagc  * Copyright (c) 1995 Per Fogelstrom
41aad01611Sagc  * Copyright (c) 1993, 1994 Charles M. Hannum.
42aad01611Sagc  *
43aad01611Sagc  * This code is derived from software contributed to Berkeley by
44aad01611Sagc  * William Jolitz and Don Ahn.
45aad01611Sagc  *
46aad01611Sagc  * Redistribution and use in source and binary forms, with or without
47aad01611Sagc  * modification, are permitted provided that the following conditions
48aad01611Sagc  * are met:
49aad01611Sagc  * 1. Redistributions of source code must retain the above copyright
50aad01611Sagc  *    notice, this list of conditions and the following disclaimer.
51aad01611Sagc  * 2. Redistributions in binary form must reproduce the above copyright
52aad01611Sagc  *    notice, this list of conditions and the following disclaimer in the
53aad01611Sagc  *    documentation and/or other materials provided with the distribution.
54ba6a3c6dSsoda  * 3. All advertising materials mentioning features or use of this software
55ba6a3c6dSsoda  *    must display the following acknowledgement:
56ba6a3c6dSsoda  *	This product includes software developed by the University of
57ba6a3c6dSsoda  *	California, Berkeley and its contributors.
58ba6a3c6dSsoda  * 4. Neither the name of the University nor the names of its contributors
59ba6a3c6dSsoda  *    may be used to endorse or promote products derived from this software
60ba6a3c6dSsoda  *    without specific prior written permission.
61ba6a3c6dSsoda  *
62ba6a3c6dSsoda  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63ba6a3c6dSsoda  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64ba6a3c6dSsoda  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65ba6a3c6dSsoda  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66ba6a3c6dSsoda  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67ba6a3c6dSsoda  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68ba6a3c6dSsoda  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69ba6a3c6dSsoda  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70ba6a3c6dSsoda  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71ba6a3c6dSsoda  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72ba6a3c6dSsoda  * SUCH DAMAGE.
73ba6a3c6dSsoda  *
74ba6a3c6dSsoda  *	@(#)isa.c	7.2 (Berkeley) 5/12/91
75ba6a3c6dSsoda  */
76ba6a3c6dSsoda 
77a4183603Slukem #include <sys/cdefs.h>
78*cf10107dSdyoung __KERNEL_RCSID(0, "$NetBSD: jazzisabr.c,v 1.13 2011/07/01 19:25:42 dyoung Exp $");
79a4183603Slukem 
80ba6a3c6dSsoda #include <sys/param.h>
81ba6a3c6dSsoda #include <sys/systm.h>
82ba6a3c6dSsoda #include <sys/device.h>
83ba6a3c6dSsoda 
84ba6a3c6dSsoda #include <machine/autoconf.h>
85*cf10107dSdyoung #include <sys/bus.h>
86ba6a3c6dSsoda #include <machine/platform.h>
87ba6a3c6dSsoda 
88ba6a3c6dSsoda #include <dev/isa/isavar.h>
89ba6a3c6dSsoda 
90ba6a3c6dSsoda #include <arc/isa/isabrvar.h>
91ba6a3c6dSsoda 
92c234c43aStsutsui #include "ioconf.h"
93c234c43aStsutsui 
94ba6a3c6dSsoda /* Definition of the driver for autoconfig. */
950f31d9deStsutsui static int	jazzisabrmatch(device_t,  cfdata_t, void *);
960f31d9deStsutsui static void	jazzisabrattach(device_t , device_t, void *);
97ba6a3c6dSsoda 
980f31d9deStsutsui CFATTACH_DECL_NEW(jazzisabr, sizeof(struct isabr_softc),
99c5e91d44Sthorpej     jazzisabrmatch, jazzisabrattach, NULL, NULL);
100ba6a3c6dSsoda 
101ba6a3c6dSsoda int
jazzisabrmatch(device_t parent,cfdata_t cf,void * aux)1020f31d9deStsutsui jazzisabrmatch(device_t parent, cfdata_t cf, void *aux)
103ba6a3c6dSsoda {
104ba6a3c6dSsoda 	struct confargs *ca = aux;
105ba6a3c6dSsoda 
106ba6a3c6dSsoda 	/* Make sure that we're looking for a JAZZISABR. */
107ba6a3c6dSsoda 	if (strcmp(ca->ca_name, jazzisabr_cd.cd_name) != 0)
1087fe2a5a0Stsutsui 		return 0;
109ba6a3c6dSsoda 
1107fe2a5a0Stsutsui 	return 1;
111ba6a3c6dSsoda }
112ba6a3c6dSsoda 
113ba6a3c6dSsoda void
jazzisabrattach(device_t parent,device_t self,void * aux)1140f31d9deStsutsui jazzisabrattach(device_t parent, device_t self, void *aux)
115ba6a3c6dSsoda {
1160f31d9deStsutsui 	struct isabr_softc *sc = device_private(self);
1170f31d9deStsutsui 
1180f31d9deStsutsui 	sc->sc_dev = self;
119ba6a3c6dSsoda 
120ba6a3c6dSsoda 	jazz_bus_dma_tag_init(&sc->sc_dmat);
1212a8a21a0Stsutsui 	(*platform->set_intr)(MIPS_INT_MASK_2, isabr_iointr, ARC_INTPRI_PCIISA);
122ba6a3c6dSsoda 
123ba6a3c6dSsoda 	isabrattach(sc);
124ba6a3c6dSsoda }
125