160727d8bSWarner Losh /*- 2*71e3c308SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 3*71e3c308SPedro F. Giffuni * 48860e8c6SPeter Grehan * Copyright 2002 by Peter Grehan. All rights reserved. 58860e8c6SPeter Grehan * 68860e8c6SPeter Grehan * Redistribution and use in source and binary forms, with or without 78860e8c6SPeter Grehan * modification, are permitted provided that the following conditions 88860e8c6SPeter Grehan * are met: 98860e8c6SPeter Grehan * 1. Redistributions of source code must retain the above copyright 108860e8c6SPeter Grehan * notice, this list of conditions and the following disclaimer. 118860e8c6SPeter Grehan * 2. Redistributions in binary form must reproduce the above copyright 128860e8c6SPeter Grehan * notice, this list of conditions and the following disclaimer in the 138860e8c6SPeter Grehan * documentation and/or other materials provided with the distribution. 148860e8c6SPeter Grehan * 3. The name of the author may not be used to endorse or promote products 158860e8c6SPeter Grehan * derived from this software without specific prior written permission. 168860e8c6SPeter Grehan * 178860e8c6SPeter Grehan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 188860e8c6SPeter Grehan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 198860e8c6SPeter Grehan * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 208860e8c6SPeter Grehan * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 218860e8c6SPeter Grehan * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 228860e8c6SPeter Grehan * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 238860e8c6SPeter Grehan * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 248860e8c6SPeter Grehan * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 258860e8c6SPeter Grehan * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 268860e8c6SPeter Grehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 278860e8c6SPeter Grehan * SUCH DAMAGE. 288860e8c6SPeter Grehan */ 298860e8c6SPeter Grehan 308860e8c6SPeter Grehan #ifndef _PSIM_IOBUSVAR_H_ 318860e8c6SPeter Grehan #define _PSIM_IOBUSVAR_H_ 328860e8c6SPeter Grehan 338860e8c6SPeter Grehan /* 348860e8c6SPeter Grehan * Accessors for iobus devices 358860e8c6SPeter Grehan */ 368860e8c6SPeter Grehan 378860e8c6SPeter Grehan enum iobus_ivars { 388860e8c6SPeter Grehan IOBUS_IVAR_NODE, 398860e8c6SPeter Grehan IOBUS_IVAR_NAME, 408860e8c6SPeter Grehan IOBUS_IVAR_NREGS, 418860e8c6SPeter Grehan IOBUS_IVAR_REGS, 428860e8c6SPeter Grehan }; 438860e8c6SPeter Grehan 448860e8c6SPeter Grehan #define IOBUS_ACCESSOR(var, ivar, type) \ 458860e8c6SPeter Grehan __BUS_ACCESSOR(iobus, var, IOBUS, ivar, type) 468860e8c6SPeter Grehan 478860e8c6SPeter Grehan IOBUS_ACCESSOR(node, NODE, phandle_t) 488860e8c6SPeter Grehan IOBUS_ACCESSOR(name, NAME, char *) 498860e8c6SPeter Grehan IOBUS_ACCESSOR(nregs, NREGS, u_int) 508860e8c6SPeter Grehan IOBUS_ACCESSOR(regs, REGS, u_int *) 518860e8c6SPeter Grehan 528860e8c6SPeter Grehan #undef IOBUS_ACCESSOR 538860e8c6SPeter Grehan 548860e8c6SPeter Grehan /* 558860e8c6SPeter Grehan * Per-device structure. 568860e8c6SPeter Grehan */ 578860e8c6SPeter Grehan struct iobus_devinfo { 588860e8c6SPeter Grehan phandle_t id_node; 598860e8c6SPeter Grehan char *id_name; 608860e8c6SPeter Grehan int id_interrupt; 618860e8c6SPeter Grehan u_int id_nregs; 628860e8c6SPeter Grehan u_int id_reg[24]; 638860e8c6SPeter Grehan struct resource_list id_resources; 648860e8c6SPeter Grehan }; 658860e8c6SPeter Grehan 668860e8c6SPeter Grehan #endif /* _PSIM_IOBUSVAR_H_ */ 67