1 /* $NetBSD: pcctwovar.h,v 1.3 2005/12/11 12:22:48 christos Exp $ */
4 * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _MVME_PCCTWOVAR_H
33 #define _MVME_PCCTWOVAR_H
36 * Structure used to attach PCC devices.
38 struct pcctwo_attach_args
{
39 const char *pa_name
; /* name of device */
40 int pa_ipl
; /* interrupt level */
41 bus_dma_tag_t pa_dmat
; /* DMA tag */
42 bus_space_tag_t pa_bust
; /* Bus tag */
43 bus_addr_t pa_offset
; /* Offset with 'Bus tag' bus space */
49 * Structure used to describe a device for autoconfiguration purposes.
51 struct pcctwo_device
{
52 const char *pcc_name
; /* name of device (e.g. "clock") */
53 bus_addr_t pcc_offset
; /* offset from PCC2 base */
57 * Macroes to make life easy when converting vector offset to interrupt
58 * control register, and how to initialise the ICSR.
60 #define VEC2ICSR(r,v) ((r) | (((v) | PCCTWO_ICR_IEN) << 8))
61 #define VEC2ICSR_REG(x) ((x) & 0xff)
62 #define VEC2ICSR_INIT(x) ((x) >> 8)
64 /* Shorthand for locators. */
66 #define pcctwocf_ipl cf_loc[PCCTWOCF_IPL]
69 * PCCChip2 driver's soft state structure
73 bus_space_tag_t sc_bust
; /* PCCChip2's register tag */
74 bus_space_handle_t sc_bush
; /* PCCChip2's register handle */
75 bus_dma_tag_t sc_dmat
; /* PCCChip2's dma tag (unused)*/
76 int *sc_vec2icsr
; /* Translate vector to ICSR */
79 void (*sc_isrlink
)(void *, int (*)(void *), void *,
80 int, int, struct evcnt
*);
81 void (*sc_isrunlink
)(void *, int);
82 struct evcnt
* (*sc_isrevcnt
)(void *, int);
83 #if defined(MVME162) || defined(MVME172)
84 struct evcnt sc_evcnt
;
88 extern struct pcctwo_softc
*sys_pcctwo
;
90 extern void pcctwo_init(struct pcctwo_softc
*,
91 const struct pcctwo_device
*, int);
92 extern struct evcnt
*pcctwointr_evcnt(int);
93 extern void pcctwointr_establish(int, int (*)(void *), int, void *,
95 extern void pcctwointr_disestablish(int);
97 #endif /* _MVME_PCCTWOVAR_H */