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