1*0af614b4Smpi /* $OpenBSD: ebusvar.h,v 1.8 2019/12/05 12:46:54 mpi Exp $ */ 2284584b0Sjason /* $NetBSD: ebusvar.h,v 1.5 2001/07/20 00:07:13 eeh Exp $ */ 3284584b0Sjason 4284584b0Sjason /* 5284584b0Sjason * Copyright (c) 1999, 2000 Matthew R. Green 6284584b0Sjason * All rights reserved. 7284584b0Sjason * 8284584b0Sjason * Redistribution and use in source and binary forms, with or without 9284584b0Sjason * modification, are permitted provided that the following conditions 10284584b0Sjason * are met: 11284584b0Sjason * 1. Redistributions of source code must retain the above copyright 12284584b0Sjason * notice, this list of conditions and the following disclaimer. 13284584b0Sjason * 2. Redistributions in binary form must reproduce the above copyright 14284584b0Sjason * notice, this list of conditions and the following disclaimer in the 15284584b0Sjason * documentation and/or other materials provided with the distribution. 16284584b0Sjason * 17284584b0Sjason * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18284584b0Sjason * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19284584b0Sjason * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20284584b0Sjason * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21284584b0Sjason * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22284584b0Sjason * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23284584b0Sjason * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24284584b0Sjason * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25284584b0Sjason * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26284584b0Sjason * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27284584b0Sjason * SUCH DAMAGE. 28284584b0Sjason */ 29284584b0Sjason 30284584b0Sjason #ifndef _SPARC64_DEV_EBUSVAR_H_ 31284584b0Sjason #define _SPARC64_DEV_EBUSVAR_H_ 32284584b0Sjason 33284584b0Sjason /* 34284584b0Sjason * ebus arguments; ebus attaches to a pci, and devices attach 35284584b0Sjason * to the ebus. 36284584b0Sjason */ 37284584b0Sjason 38284584b0Sjason struct ebus_attach_args { 39284584b0Sjason char *ea_name; /* PROM name */ 40284584b0Sjason int ea_node; /* PROM node */ 41284584b0Sjason 42eb79e960Shenric bus_space_tag_t ea_memtag; 43eb79e960Shenric bus_space_tag_t ea_iotag; 44284584b0Sjason bus_dma_tag_t ea_dmatag; 45284584b0Sjason 46284584b0Sjason struct ebus_regs *ea_regs; /* registers */ 47284584b0Sjason u_int32_t *ea_vaddrs; /* virtual addrs */ 48284584b0Sjason u_int32_t *ea_intrs; /* interrupts */ 49284584b0Sjason 50284584b0Sjason int ea_nregs; /* number of them */ 51284584b0Sjason int ea_nvaddrs; 52284584b0Sjason int ea_nintrs; 53284584b0Sjason }; 54284584b0Sjason 55284584b0Sjason struct ebus_softc { 56284584b0Sjason struct device sc_dev; 57284584b0Sjason 58284584b0Sjason int sc_node; 59284584b0Sjason 60284584b0Sjason bus_space_tag_t sc_memtag; /* from pci */ 61284584b0Sjason bus_space_tag_t sc_iotag; /* from pci */ 62284584b0Sjason bus_dma_tag_t sc_dmatag; /* XXX */ 63284584b0Sjason 6420945e8eSkettenis void *sc_range; 65284584b0Sjason struct ebus_interrupt_map *sc_intmap; 66284584b0Sjason struct ebus_interrupt_map_mask sc_intmapmask; 67284584b0Sjason 68284584b0Sjason int sc_nrange; /* counters */ 69284584b0Sjason int sc_nintmap; 70284584b0Sjason }; 71284584b0Sjason 7220945e8eSkettenis 7320945e8eSkettenis int ebus_setup_attach_args(struct ebus_softc *, int, 7420945e8eSkettenis struct ebus_attach_args *); 7520945e8eSkettenis void ebus_destroy_attach_args(struct ebus_attach_args *); 7620945e8eSkettenis int ebus_print(void *, const char *); 7720945e8eSkettenis 7820945e8eSkettenis 79c4071fd1Smillert bus_dma_tag_t ebus_alloc_dma_tag(struct ebus_softc *, bus_dma_tag_t); 80284584b0Sjason 81284584b0Sjason #define ebus_bus_map(t, bt, a, s, f, v, hp) \ 82eb79e960Shenric bus_space_map(t, a, s, f, hp) 83284584b0Sjason 84284584b0Sjason #endif /* _SPARC64_DEV_EBUSVAR_H_ */ 85