1*9f31f4f7Sjason /* $OpenBSD: fhcvar.h,v 1.8 2004/10/01 18:18:49 jason Exp $ */ 2f63ee831Sjason 3f63ee831Sjason /* 4f63ee831Sjason * Copyright (c) 2004 Jason L. Wright (jason@thought.net). 5f63ee831Sjason * All rights reserved. 6f63ee831Sjason * 7f63ee831Sjason * Redistribution and use in source and binary forms, with or without 8f63ee831Sjason * modification, are permitted provided that the following conditions 9f63ee831Sjason * are met: 10f63ee831Sjason * 1. Redistributions of source code must retain the above copyright 11f63ee831Sjason * notice, this list of conditions and the following disclaimer. 12f63ee831Sjason * 2. Redistributions in binary form must reproduce the above copyright 13f63ee831Sjason * notice, this list of conditions and the following disclaimer in the 14f63ee831Sjason * documentation and/or other materials provided with the distribution. 15f63ee831Sjason * 16f63ee831Sjason * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17f63ee831Sjason * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18f63ee831Sjason * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19f63ee831Sjason * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20f63ee831Sjason * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21f63ee831Sjason * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22f63ee831Sjason * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23f63ee831Sjason * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24f63ee831Sjason * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 25f63ee831Sjason * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26f63ee831Sjason * POSSIBILITY OF SUCH DAMAGE. 27f63ee831Sjason */ 28f63ee831Sjason 29f63ee831Sjason struct fhc_reg { 30f63ee831Sjason u_int32_t fbr_slot; 31f63ee831Sjason u_int32_t fbr_offset; 32f63ee831Sjason u_int32_t fbr_size; 33f63ee831Sjason }; 34f63ee831Sjason 35f63ee831Sjason struct fhc_range { 36f63ee831Sjason u_int32_t cspace; /* Client space */ 37f63ee831Sjason u_int32_t coffset; /* Client offset */ 38f63ee831Sjason u_int32_t pspace; /* Parent space */ 39f63ee831Sjason u_int32_t poffset; /* Parent offset */ 40f63ee831Sjason u_int32_t size; /* Size in bytes of this range */ 41f63ee831Sjason }; 42f63ee831Sjason 43f63ee831Sjason struct fhc_softc { 44f63ee831Sjason struct device sc_dv; 45f63ee831Sjason int sc_node; 46c7a321c7Sjason int sc_is_central; /* parent is central */ 47d435f11cSjason int sc_board; 482af5f99fSjason u_int32_t sc_ign; 49f63ee831Sjason bus_space_tag_t sc_bt; 50f63ee831Sjason bus_space_tag_t sc_cbt; 51f63ee831Sjason int sc_nrange; 52f63ee831Sjason struct fhc_range *sc_range; 53f63ee831Sjason bus_space_handle_t sc_preg; /* internal regs */ 54f63ee831Sjason bus_space_handle_t sc_ireg; /* ign regs */ 55f63ee831Sjason bus_space_handle_t sc_freg; /* fanfail regs */ 56f63ee831Sjason bus_space_handle_t sc_sreg; /* system regs */ 57f63ee831Sjason bus_space_handle_t sc_ureg; /* uart regs */ 58f63ee831Sjason bus_space_handle_t sc_treg; /* tod regs */ 59*9f31f4f7Sjason struct blink_led sc_blink; 60f63ee831Sjason }; 61f63ee831Sjason 62f63ee831Sjason void fhc_attach(struct fhc_softc *); 63f63ee831Sjason int fhc_get_string(int, char *, char **); 64f63ee831Sjason 65f63ee831Sjason struct fhc_attach_args { 66b150d549Sjason bus_space_tag_t fa_bustag; 67f63ee831Sjason char *fa_name; 68b150d549Sjason int *fa_intr; 69b150d549Sjason struct fhc_reg *fa_reg; 70b150d549Sjason u_int32_t *fa_promvaddrs; 71f63ee831Sjason int fa_node; 72f63ee831Sjason int fa_nreg; 7309338432Sjason int fa_nintr; 74b150d549Sjason int fa_npromvaddrs; 75f63ee831Sjason }; 76f63ee831Sjason 77f63ee831Sjason #define fhc_bus_map(t, slot, offset, sz, flags, hp) \ 78f63ee831Sjason bus_space_map(t, BUS_ADDR(slot, offset), sz, flags, hp) 79