[BACK]Return to eisa_machdep.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / i386 / eisa

Annotation of src/sys/arch/i386/eisa/eisa_machdep.c, Revision 1.12.2.1

1.12.2.1! nathanw     1: /*     $NetBSD: eisa_machdep.c,v 1.12 2000/08/11 00:43:21 thorpej Exp $        */
1.6       thorpej     2:
                      3: /*-
1.7       thorpej     4:  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
1.6       thorpej     5:  * All rights reserved.
                      6:  *
                      7:  * This code is derived from software contributed to The NetBSD Foundation
                      8:  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
                      9:  * NASA Ames Research Center.
                     10:  *
                     11:  * Redistribution and use in source and binary forms, with or without
                     12:  * modification, are permitted provided that the following conditions
                     13:  * are met:
                     14:  * 1. Redistributions of source code must retain the above copyright
                     15:  *    notice, this list of conditions and the following disclaimer.
                     16:  * 2. Redistributions in binary form must reproduce the above copyright
                     17:  *    notice, this list of conditions and the following disclaimer in the
                     18:  *    documentation and/or other materials provided with the distribution.
                     19:  * 3. All advertising materials mentioning features or use of this software
                     20:  *    must display the following acknowledgement:
                     21:  *     This product includes software developed by the NetBSD
                     22:  *     Foundation, Inc. and its contributors.
                     23:  * 4. Neither the name of The NetBSD Foundation nor the names of its
                     24:  *    contributors may be used to endorse or promote products derived
                     25:  *    from this software without specific prior written permission.
                     26:  *
                     27:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     28:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     29:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     30:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     31:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     32:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     33:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     34:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     35:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     36:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     37:  * POSSIBILITY OF SUCH DAMAGE.
                     38:  */
1.1       cgd        39:
                     40: /*
                     41:  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
                     42:  *
                     43:  * Redistribution and use in source and binary forms, with or without
                     44:  * modification, are permitted provided that the following conditions
                     45:  * are met:
                     46:  * 1. Redistributions of source code must retain the above copyright
                     47:  *    notice, this list of conditions and the following disclaimer.
                     48:  * 2. Redistributions in binary form must reproduce the above copyright
                     49:  *    notice, this list of conditions and the following disclaimer in the
                     50:  *    documentation and/or other materials provided with the distribution.
                     51:  * 3. All advertising materials mentioning features or use of this software
                     52:  *    must display the following acknowledgement:
                     53:  *      This product includes software developed by Christopher G. Demetriou
                     54:  *     for the NetBSD Project.
                     55:  * 4. The name of the author may not be used to endorse or promote products
                     56:  *    derived from this software without specific prior written permission
                     57:  *
                     58:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     59:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     60:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     61:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     62:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     63:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     64:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     65:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     66:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     67:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     68:  */
                     69:
                     70: /*
                     71:  * Machine-specific functions for EISA autoconfiguration.
                     72:  */
                     73:
                     74: #include <sys/types.h>
                     75: #include <sys/param.h>
                     76: #include <sys/time.h>
                     77: #include <sys/systm.h>
                     78: #include <sys/errno.h>
                     79: #include <sys/device.h>
1.5       thorpej    80: #include <sys/extent.h>
1.1       cgd        81:
1.6       thorpej    82: #define _I386_BUS_DMA_PRIVATE
                     83: #include <machine/bus.h>
                     84:
1.1       cgd        85: #include <i386/isa/icu.h>
1.5       thorpej    86: #include <dev/isa/isareg.h>
1.1       cgd        87: #include <dev/isa/isavar.h>
                     88: #include <dev/eisa/eisavar.h>
                     89:
1.6       thorpej    90: /*
                     91:  * EISA doesn't have any special needs; just use the generic versions
                     92:  * of these funcions.
                     93:  */
                     94: struct i386_bus_dma_tag eisa_bus_dma_tag = {
1.10      thorpej    95:        0,                      /* _bounce_thresh */
1.6       thorpej    96:        _bus_dmamap_create,
                     97:        _bus_dmamap_destroy,
                     98:        _bus_dmamap_load,
                     99:        _bus_dmamap_load_mbuf,
                    100:        _bus_dmamap_load_uio,
                    101:        _bus_dmamap_load_raw,
                    102:        _bus_dmamap_unload,
                    103:        NULL,                   /* _dmamap_sync */
                    104:        _bus_dmamem_alloc,
                    105:        _bus_dmamem_free,
                    106:        _bus_dmamem_map,
                    107:        _bus_dmamem_unmap,
                    108:        _bus_dmamem_mmap,
                    109: };
                    110:
1.1       cgd       111: void
                    112: eisa_attach_hook(parent, self, eba)
                    113:        struct device *parent, *self;
                    114:        struct eisabus_attach_args *eba;
                    115: {
1.7       thorpej   116:        extern int eisa_has_been_seen;
1.1       cgd       117:
1.7       thorpej   118:        /*
1.8       thorpej   119:         * Notify others that might need to know that the EISA bus
1.7       thorpej   120:         * has now been attached.
                    121:         */
                    122:        if (eisa_has_been_seen)
                    123:                panic("eisaattach: EISA bus already seen!");
                    124:        eisa_has_been_seen = 1;
1.1       cgd       125: }
                    126:
                    127: int
                    128: eisa_maxslots(ec)
                    129:        eisa_chipset_tag_t ec;
                    130: {
                    131:
                    132:        /*
                    133:         * Always try 16 slots.
                    134:         */
                    135:        return (16);
                    136: }
                    137:
                    138: int
                    139: eisa_intr_map(ec, irq, ihp)
                    140:        eisa_chipset_tag_t ec;
                    141:        u_int irq;
                    142:        eisa_intr_handle_t *ihp;
                    143: {
                    144:
                    145:        if (irq >= ICU_LEN) {
1.4       christos  146:                printf("eisa_intr_map: bad IRQ %d\n", irq);
1.1       cgd       147:                *ihp = -1;
                    148:                return 1;
                    149:        }
                    150:        if (irq == 2) {
1.4       christos  151:                printf("eisa_intr_map: changed IRQ 2 to IRQ 9\n");
1.1       cgd       152:                irq = 9;
                    153:        }
                    154:
                    155:        *ihp = irq;
                    156:        return 0;
                    157: }
                    158:
                    159: const char *
                    160: eisa_intr_string(ec, ih)
                    161:        eisa_chipset_tag_t ec;
                    162:        eisa_intr_handle_t ih;
                    163: {
                    164:        static char irqstr[8];          /* 4 + 2 + NULL + sanity */
                    165:
                    166:        if (ih == 0 || ih >= ICU_LEN || ih == 2)
                    167:                panic("eisa_intr_string: bogus handle 0x%x\n", ih);
                    168:
1.4       christos  169:        sprintf(irqstr, "irq %d", ih);
1.1       cgd       170:        return (irqstr);
                    171:
1.11      cgd       172: }
                    173:
                    174: const struct evcnt *
                    175: eisa_intr_evcnt(eisa_chipset_tag_t ec, eisa_intr_handle_t ih)
                    176: {
                    177:
                    178:        /* XXX for now, no evcnt parent reported */
                    179:        return NULL;
1.1       cgd       180: }
                    181:
                    182: void *
                    183: eisa_intr_establish(ec, ih, type, level, func, arg)
                    184:        eisa_chipset_tag_t ec;
                    185:        eisa_intr_handle_t ih;
                    186:        int type, level, (*func) __P((void *));
                    187:        void *arg;
                    188: {
                    189:
                    190:        if (ih == 0 || ih >= ICU_LEN || ih == 2)
                    191:                panic("eisa_intr_establish: bogus handle 0x%x\n", ih);
                    192:
1.2       cgd       193:        return isa_intr_establish(NULL, ih, type, level, func, arg);
1.1       cgd       194: }
                    195:
                    196: void
                    197: eisa_intr_disestablish(ec, cookie)
                    198:        eisa_chipset_tag_t ec;
                    199:        void *cookie;
                    200: {
                    201:
1.12.2.1! nathanw   202:        isa_intr_disestablish(NULL, cookie);
1.5       thorpej   203: }
                    204:
                    205: int
                    206: eisa_mem_alloc(t, size, align, boundary, cacheable, addrp, bahp)
                    207:        bus_space_tag_t t;
                    208:        bus_size_t size, align;
                    209:        bus_addr_t boundary;
                    210:        int cacheable;
                    211:        bus_addr_t *addrp;
                    212:        bus_space_handle_t *bahp;
                    213: {
                    214:        extern struct extent *iomem_ex;
                    215:
                    216:        /*
                    217:         * Allocate physical address space after the ISA hole.
                    218:         */
                    219:        return bus_space_alloc(t, IOM_END, iomem_ex->ex_end, size, align,
                    220:            boundary, cacheable, addrp, bahp);
                    221: }
                    222:
                    223: void
                    224: eisa_mem_free(t, bah, size)
                    225:        bus_space_tag_t t;
                    226:        bus_space_handle_t bah;
                    227:        bus_size_t size;
                    228: {
                    229:
                    230:        bus_space_free(t, bah, size);
1.12      thorpej   231: }
                    232:
                    233: int
                    234: eisa_conf_read_mem(ec, slot, func, entry, ecm)
                    235:        eisa_chipset_tag_t ec;
                    236:        int slot, func, entry;
                    237:        struct eisa_cfg_mem *ecm;
                    238: {
                    239:
                    240:        /* XXX XXX XXX */
                    241:        return (ENOENT);
                    242: }
                    243:
                    244: int
                    245: eisa_conf_read_irq(ec, slot, func, entry, eci)
                    246:        eisa_chipset_tag_t ec;
                    247:        int slot, func, entry;
                    248:        struct eisa_cfg_irq *eci;
                    249: {
                    250:
                    251:        /* XXX XXX XXX */
                    252:        return (ENOENT);
                    253: }
                    254:
                    255: int
                    256: eisa_conf_read_dma(ec, slot, func, entry, ecd)
                    257:        eisa_chipset_tag_t ec;
                    258:        int slot, func, entry;
                    259:        struct eisa_cfg_dma *ecd;
                    260: {
                    261:
                    262:        /* XXX XXX XXX */
                    263:        return (ENOENT);
                    264: }
                    265:
                    266: int
                    267: eisa_conf_read_io(ec, slot, func, entry, ecio)
                    268:        eisa_chipset_tag_t ec;
                    269:        int slot, func, entry;
                    270:        struct eisa_cfg_io *ecio;
                    271: {
                    272:
                    273:        /* XXX XXX XXX */
                    274:        return (ENOENT);
1.1       cgd       275: }

CVSweb <webmaster@jp.NetBSD.org>