diff --git a/sys/arch/alpha/eisa/eisa_machdep.c b/sys/arch/alpha/eisa/eisa_machdep.c index 23d2983d1a87..bbee0a0033da 100644 --- a/sys/arch/alpha/eisa/eisa_machdep.c +++ b/sys/arch/alpha/eisa/eisa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: eisa_machdep.c,v 1.2 2000/08/10 23:30:08 thorpej Exp $ */ +/* $NetBSD: eisa_machdep.c,v 1.3 2000/08/11 00:43:20 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.2 2000/08/10 23:30:08 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.3 2000/08/11 00:43:20 thorpej Exp $"); #include #include @@ -526,3 +526,126 @@ eisa_init() free(cdata, M_TEMP); free(data, M_TEMP); } + +static struct ecu_data * +eisa_lookup_data(int slot) +{ + struct ecu_data *ecud; + + for (ecud = SIMPLEQ_FIRST(&ecu_data_list); ecud != NULL; + ecud = SIMPLEQ_NEXT(ecud, ecud_list)) { + if (ecud->ecud_slot == slot) + return (ecud); + } + return (NULL); +} + +static struct ecu_func * +eisa_lookup_func(int slot, int func) +{ + struct ecu_data *ecud; + struct ecu_func *ecuf; + + ecud = eisa_lookup_data(slot); + if (ecud == NULL) + return (NULL); + + for (ecuf = SIMPLEQ_FIRST(&ecud->ecud_funcs); ecuf != NULL; + ecuf = SIMPLEQ_NEXT(ecuf, ecuf_list)) { + if (ecuf->ecuf_funcno == func) + return (ecuf); + } + return (NULL); +} + +int +eisa_conf_read_mem(eisa_chipset_tag_t ec, int slot, int func, int entry, + struct eisa_cfg_mem *dp) +{ + struct ecu_func *ecuf; + struct ecu_mem *ecum; + + ecuf = eisa_lookup_func(slot, func); + if (ecuf == NULL) + return (ENOENT); + + for (ecum = SIMPLEQ_FIRST(&ecuf->ecuf_mem); ecum != NULL; + ecum = SIMPLEQ_NEXT(ecum, ecum_list)) { + if (entry-- == 0) + break; + } + if (ecum == NULL) + return (ENOENT); + + *dp = ecum->ecum_mem; + return (0); +} + +int +eisa_conf_read_irq(eisa_chipset_tag_t ec, int slot, int func, int entry, + struct eisa_cfg_irq *dp) +{ + struct ecu_func *ecuf; + struct ecu_irq *ecui; + + ecuf = eisa_lookup_func(slot, func); + if (ecuf == NULL) + return (ENOENT); + + for (ecui = SIMPLEQ_FIRST(&ecuf->ecuf_irq); ecui != NULL; + ecui = SIMPLEQ_NEXT(ecui, ecui_list)) { + if (entry-- == 0) + break; + } + if (ecui == NULL) + return (ENOENT); + + *dp = ecui->ecui_irq; + return (0); +} + +int +eisa_conf_read_dma(eisa_chipset_tag_t ec, int slot, int func, int entry, + struct eisa_cfg_dma *dp) +{ + struct ecu_func *ecuf; + struct ecu_dma *ecud; + + ecuf = eisa_lookup_func(slot, func); + if (ecuf == NULL) + return (ENOENT); + + for (ecud = SIMPLEQ_FIRST(&ecuf->ecuf_dma); ecud != NULL; + ecud = SIMPLEQ_NEXT(ecud, ecud_list)) { + if (entry-- == 0) + break; + } + if (ecud == NULL) + return (ENOENT); + + *dp = ecud->ecud_dma; + return (0); +} + +int +eisa_conf_read_io(eisa_chipset_tag_t ec, int slot, int func, int entry, + struct eisa_cfg_io *dp) +{ + struct ecu_func *ecuf; + struct ecu_io *ecuio; + + ecuf = eisa_lookup_func(slot, func); + if (ecuf == NULL) + return (ENOENT); + + for (ecuio = SIMPLEQ_FIRST(&ecuf->ecuf_io); ecuio != NULL; + ecuio = SIMPLEQ_NEXT(ecuio, ecuio_list)) { + if (entry-- == 0) + break; + } + if (ecuio == NULL) + return (ENOENT); + + *dp = ecuio->ecuio_io; + return (0); +} diff --git a/sys/arch/alpha/include/eisa_machdep.h b/sys/arch/alpha/include/eisa_machdep.h index b8d9496248e6..1f33603f22af 100644 --- a/sys/arch/alpha/include/eisa_machdep.h +++ b/sys/arch/alpha/include/eisa_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: eisa_machdep.h,v 1.6 2000/07/29 23:18:47 thorpej Exp $ */ +/* $NetBSD: eisa_machdep.h,v 1.7 2000/08/11 00:43:20 thorpej Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -65,6 +65,15 @@ struct alpha_eisa_chipset { #define eisa_intr_disestablish(c, h) \ (*(c)->ec_intr_disestablish)((c)->ec_v, (h)) +int eisa_conf_read_mem(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_mem *); +int eisa_conf_read_irq(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_irq *); +int eisa_conf_read_dma(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_dma *); +int eisa_conf_read_io(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_io *); + /* * Internal functions, NOT TO BE USED BY MACHINE-INDEPENDENT CODE! */ diff --git a/sys/arch/i386/eisa/eisa_machdep.c b/sys/arch/i386/eisa/eisa_machdep.c index 81ae118429ef..4ea1e8bdeef6 100644 --- a/sys/arch/i386/eisa/eisa_machdep.c +++ b/sys/arch/i386/eisa/eisa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: eisa_machdep.c,v 1.11 2000/06/04 19:14:43 cgd Exp $ */ +/* $NetBSD: eisa_machdep.c,v 1.12 2000/08/11 00:43:21 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -229,3 +229,47 @@ eisa_mem_free(t, bah, size) bus_space_free(t, bah, size); } + +int +eisa_conf_read_mem(ec, slot, func, entry, ecm) + eisa_chipset_tag_t ec; + int slot, func, entry; + struct eisa_cfg_mem *ecm; +{ + + /* XXX XXX XXX */ + return (ENOENT); +} + +int +eisa_conf_read_irq(ec, slot, func, entry, eci) + eisa_chipset_tag_t ec; + int slot, func, entry; + struct eisa_cfg_irq *eci; +{ + + /* XXX XXX XXX */ + return (ENOENT); +} + +int +eisa_conf_read_dma(ec, slot, func, entry, ecd) + eisa_chipset_tag_t ec; + int slot, func, entry; + struct eisa_cfg_dma *ecd; +{ + + /* XXX XXX XXX */ + return (ENOENT); +} + +int +eisa_conf_read_io(ec, slot, func, entry, ecio) + eisa_chipset_tag_t ec; + int slot, func, entry; + struct eisa_cfg_io *ecio; +{ + + /* XXX XXX XXX */ + return (ENOENT); +} diff --git a/sys/arch/i386/include/eisa_machdep.h b/sys/arch/i386/include/eisa_machdep.h index 2cf41bae7743..116b7c7f4797 100644 --- a/sys/arch/i386/include/eisa_machdep.h +++ b/sys/arch/i386/include/eisa_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: eisa_machdep.h,v 1.7 2000/06/04 19:14:44 cgd Exp $ */ +/* $NetBSD: eisa_machdep.h,v 1.8 2000/08/11 00:43:21 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -67,3 +67,12 @@ int eisa_mem_alloc(bus_space_tag_t, bus_size_t, bus_size_t, bus_addr_t, int, bus_addr_t *, bus_space_handle_t *); void eisa_mem_free(bus_space_tag_t, bus_space_handle_t, bus_size_t); + +int eisa_conf_read_mem(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_mem *); +int eisa_conf_read_irq(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_irq *); +int eisa_conf_read_dma(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_dma *); +int eisa_conf_read_io(eisa_chipset_tag_t, int, int, int, + struct eisa_cfg_io *); diff --git a/sys/dev/eisa/eisareg.h b/sys/dev/eisa/eisareg.h index 8eaa222836ee..d6204ffb6f3f 100644 --- a/sys/dev/eisa/eisareg.h +++ b/sys/dev/eisa/eisareg.h @@ -1,4 +1,40 @@ -/* $NetBSD: eisareg.h,v 1.3 1996/04/09 22:46:13 cgd Exp $ */ +/* $NetBSD: eisareg.h,v 1.4 2000/08/11 00:43:18 thorpej Exp $ */ + +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -36,7 +72,7 @@ /* * Register (etc.) descriptions for the EISA bus. - + * * Mostly culled from EISA chipset descriptions in: * Intel Peripheral Components Databook (1992) */ diff --git a/sys/dev/eisa/eisavar.h b/sys/dev/eisa/eisavar.h index 84d53c4e48ba..02c09739645e 100644 --- a/sys/dev/eisa/eisavar.h +++ b/sys/dev/eisa/eisavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: eisavar.h,v 1.15 2000/08/10 23:30:08 thorpej Exp $ */ +/* $NetBSD: eisavar.h,v 1.16 2000/08/11 00:43:19 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -42,6 +42,11 @@ * separated into eisa_machdep.h. */ +struct eisa_cfg_mem; +struct eisa_cfg_irq; +struct eisa_cfg_dma; +struct eisa_cfg_io; + #include #include /* For ID register & string info. */