1*5f819ca3Schs /* $NetBSD: upcvar.h,v 1.6 2012/10/27 17:18:23 chs Exp $ */ 2d7eebd92Sbjh21 /*- 3336f2d20Sbjh21 * Copyright (c) 2000, 2003 Ben Harris 4d7eebd92Sbjh21 * All rights reserved. 5d7eebd92Sbjh21 * 6d7eebd92Sbjh21 * Redistribution and use in source and binary forms, with or without 7d7eebd92Sbjh21 * modification, are permitted provided that the following conditions 8d7eebd92Sbjh21 * are met: 9d7eebd92Sbjh21 * 1. Redistributions of source code must retain the above copyright 10d7eebd92Sbjh21 * notice, this list of conditions and the following disclaimer. 11d7eebd92Sbjh21 * 2. Redistributions in binary form must reproduce the above copyright 12d7eebd92Sbjh21 * notice, this list of conditions and the following disclaimer in the 13d7eebd92Sbjh21 * documentation and/or other materials provided with the distribution. 14d7eebd92Sbjh21 * 3. The name of the author may not be used to endorse or promote products 15d7eebd92Sbjh21 * derived from this software without specific prior written permission. 16d7eebd92Sbjh21 * 17d7eebd92Sbjh21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18d7eebd92Sbjh21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19d7eebd92Sbjh21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20d7eebd92Sbjh21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21d7eebd92Sbjh21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22d7eebd92Sbjh21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23d7eebd92Sbjh21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24d7eebd92Sbjh21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25d7eebd92Sbjh21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26d7eebd92Sbjh21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27d7eebd92Sbjh21 */ 28d7eebd92Sbjh21 29d7eebd92Sbjh21 #ifndef __UPCVAR_H 30d7eebd92Sbjh21 #define __UPCVAR_H 31d7eebd92Sbjh21 32a2a38285Sad #include <sys/bus.h> 33d7eebd92Sbjh21 34d7eebd92Sbjh21 struct upc_irqhandle { 35d7eebd92Sbjh21 int (*uih_func)(void *); 36d7eebd92Sbjh21 void *uih_arg; 37d7eebd92Sbjh21 int uih_level; 38d7eebd92Sbjh21 }; 39d7eebd92Sbjh21 40d7eebd92Sbjh21 struct upc_softc { 41*5f819ca3Schs device_t sc_dev; 42d7eebd92Sbjh21 /* These fields are filled in by the bus attachment. */ 43d7eebd92Sbjh21 bus_space_tag_t sc_iot; 44d7eebd92Sbjh21 bus_space_handle_t sc_ioh; 45d7eebd92Sbjh21 /* 46d7eebd92Sbjh21 * These fields are filled in by upc_attach(). The bus attachment 47d7eebd92Sbjh21 * for upc is expected to establish them according to the way the 48d7eebd92Sbjh21 * chip is wired. 49d7eebd92Sbjh21 */ 50d7eebd92Sbjh21 struct upc_irqhandle sc_irq3; 51d7eebd92Sbjh21 struct upc_irqhandle sc_irq4; 52d7eebd92Sbjh21 struct upc_irqhandle sc_pintr; 53d7eebd92Sbjh21 struct upc_irqhandle sc_fintr; 54d7eebd92Sbjh21 struct upc_irqhandle sc_wintr; 55d7eebd92Sbjh21 }; 56d7eebd92Sbjh21 57d7eebd92Sbjh21 extern void upc_attach(struct upc_softc *); 58336f2d20Sbjh21 extern int upc1_read_config(struct upc_softc *, int); 59336f2d20Sbjh21 extern void upc1_write_config(struct upc_softc *, int, int); 60336f2d20Sbjh21 extern int upc2_read_config(struct upc_softc *, int); 61336f2d20Sbjh21 extern void upc2_write_config(struct upc_softc *, int, int); 62d7eebd92Sbjh21 63d7eebd92Sbjh21 /* This is the structure passed to children of upc. */ 64d7eebd92Sbjh21 struct upc_attach_args { 65d7eebd92Sbjh21 char const *ua_devtype; 66d7eebd92Sbjh21 int ua_offset; 67d7eebd92Sbjh21 bus_space_tag_t ua_iot; 68d7eebd92Sbjh21 bus_space_handle_t ua_ioh; 69d7eebd92Sbjh21 bus_space_handle_t ua_ioh2; /* for wdc */ 70d7eebd92Sbjh21 struct upc_irqhandle *ua_irqhandle; 71d7eebd92Sbjh21 }; 72d7eebd92Sbjh21 73d7eebd92Sbjh21 extern void upc_intr_establish(struct upc_irqhandle *, int, int (*)(void *), 74d7eebd92Sbjh21 void *arg); 75d7eebd92Sbjh21 76d7eebd92Sbjh21 #endif 77