1 /* $NetBSD: pcctwovar.h,v 1.6 2024/01/19 03:59:47 thorpej Exp $ */ 2 3 /*- 4 * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Steve C. Woodford 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 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. 18 * 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. 30 */ 31 32 #ifndef _MVME_PCCTWOVAR_H 33 #define _MVME_PCCTWOVAR_H 34 35 #include "opt_mvmeconf.h" 36 37 /* 38 * Structure used to attach PCC devices. 39 */ 40 struct pcctwo_attach_args { 41 const char *pa_name; /* name of device */ 42 int pa_ipl; /* interrupt level */ 43 bus_dma_tag_t pa_dmat; /* DMA tag */ 44 bus_space_tag_t pa_bust; /* Bus tag */ 45 bus_addr_t pa_offset; /* Offset with 'Bus tag' bus space */ 46 47 bus_addr_t _pa_base; 48 }; 49 50 /* 51 * Structure used to describe a device for autoconfiguration purposes. 52 */ 53 struct pcctwo_device { 54 const char *pcc_name; /* name of device (e.g. "clock") */ 55 bus_addr_t pcc_offset; /* offset from PCC2 base */ 56 }; 57 58 /* 59 * Macroes to make life easy when converting vector offset to interrupt 60 * control register, and how to initialise the ICSR. 61 */ 62 #define VEC2ICSR(r,v) ((r) | (((v) | PCCTWO_ICR_IEN) << 8)) 63 #define VEC2ICSR_REG(x) ((x) & 0xff) 64 #define VEC2ICSR_INIT(x) ((x) >> 8) 65 66 /* Shorthand for locators. */ 67 #include "locators.h" 68 #define pcctwocf_ipl cf_loc[PCCTWOCF_IPL] 69 70 /* 71 * PCCChip2 driver's soft state structure 72 */ 73 struct pcctwo_softc { 74 device_t sc_dev; 75 bus_space_tag_t sc_bust; /* PCCChip2's register tag */ 76 bus_space_handle_t sc_bush; /* PCCChip2's register handle */ 77 bus_dma_tag_t sc_dmat; /* PCCChip2's dma tag (unused)*/ 78 int *sc_vec2icsr; /* Translate vector to ICSR */ 79 int sc_vecbase; 80 void *sc_isrcookie; 81 void (*sc_isrlink)(void *, int (*)(void *), void *, 82 int, int, struct evcnt *); 83 void (*sc_isrunlink)(void *, int); 84 struct evcnt * (*sc_isrevcnt)(void *, int); 85 #if defined(MVME162) || defined(MVME172) 86 struct evcnt sc_evcnt; 87 #endif 88 }; 89 90 extern struct pcctwo_softc *sys_pcctwo; 91 92 extern void pcctwo_init(struct pcctwo_softc *, 93 const struct pcctwo_device *, int); 94 extern struct evcnt *pcctwointr_evcnt(int); 95 extern void pcctwointr_establish(int, int (*)(void *), int, void *, 96 struct evcnt *); 97 extern void pcctwointr_disestablish(int); 98 99 #endif /* _MVME_PCCTWOVAR_H */ 100