1 /* $NetBSD: pnpbiosvar.h,v 1.2 1999/11/14 02:15:51 thorpej Exp $ */ 2 /* 3 * Copyright (c) 1999 4 * Matthias Drochner. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions, and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28 struct pnpbios_attach_args { 29 char *paa_busname; 30 isa_chipset_tag_t paa_ic; 31 }; 32 33 int pnpbios_probe __P((void)); 34 35 struct pnp_compatid { 36 char idstr[8]; 37 struct pnp_compatid *next; 38 }; 39 40 struct pnp_mem { 41 SIMPLEQ_ENTRY(pnp_mem) next; 42 u_int32_t minbase, maxbase, align, len; 43 int flags; 44 }; 45 struct pnp_io { 46 SIMPLEQ_ENTRY(pnp_io) next; 47 u_int16_t minbase, maxbase, align, len; 48 int flags; 49 }; 50 struct pnp_irq { 51 SIMPLEQ_ENTRY(pnp_irq) next; 52 u_int16_t mask; 53 int flags; 54 }; 55 struct pnp_dma { 56 SIMPLEQ_ENTRY(pnp_dma) next; 57 u_int8_t mask; 58 int flags; 59 }; 60 61 #define PNP_MAXMEM 4 62 #define PNP_MAXIOPORT 8 63 #define PNP_MAXIRQ 2 64 #define PNP_MAXDMA 2 65 66 struct pnpresources { 67 int nummem, numio, numirq, numdma; 68 SIMPLEQ_HEAD(, pnp_mem) mem; 69 SIMPLEQ_HEAD(, pnp_io) io; 70 SIMPLEQ_HEAD(, pnp_irq) irq; 71 SIMPLEQ_HEAD(, pnp_dma) dma; 72 struct pnpresources *dependant_link; 73 struct pnp_compatid *compatids; 74 char *longname; 75 }; 76 77 typedef void *pnpbios_tag_t; /* driver private */ 78 79 struct pnpbiosdev_attach_args { 80 pnpbios_tag_t pbt; 81 isa_chipset_tag_t ic; 82 int idx; 83 struct pnpresources *resc; 84 char *idstr; 85 char *primid; 86 }; 87 88 int pnpbios_io_map __P((pnpbios_tag_t, struct pnpresources *, int, 89 bus_space_tag_t *, bus_space_handle_t *)); 90 void *pnpbios_intr_establish __P((pnpbios_tag_t, struct pnpresources *, int, 91 int, int (*)(void *), void *)); 92 93 int pnpbios_getiobase __P((pnpbios_tag_t, struct pnpresources *, int, 94 bus_space_tag_t *, int *)); 95 int pnpbios_getirqnum __P((pnpbios_tag_t, struct pnpresources *, int, int *)); 96 int pnpbios_getdmachan __P((pnpbios_tag_t, struct pnpresources *, int, int *)); 97 void pnpbios_print_devres __P((struct device *, 98 struct pnpbiosdev_attach_args *)); 99