Home | History | Annotate | Line # | Download | only in eisa
eisa_machdep.c revision 1.3
      1 /*	$NetBSD: eisa_machdep.c,v 1.3 1996/10/11 00:26:33 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1996 Christopher G. Demetriou.  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  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *      This product includes software developed by Christopher G. Demetriou
     17  *	for the NetBSD Project.
     18  * 4. The name of the author may not be used to endorse or promote products
     19  *    derived from this software without specific prior written permission
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 /*
     34  * Machine-specific functions for EISA autoconfiguration.
     35  */
     36 
     37 #include <sys/types.h>
     38 #include <sys/param.h>
     39 #include <sys/time.h>
     40 #include <sys/systm.h>
     41 #include <sys/errno.h>
     42 #include <sys/device.h>
     43 
     44 #include <i386/isa/icu.h>
     45 #include <dev/isa/isavar.h>
     46 #include <dev/eisa/eisavar.h>
     47 
     48 void
     49 eisa_attach_hook(parent, self, eba)
     50 	struct device *parent, *self;
     51 	struct eisabus_attach_args *eba;
     52 {
     53 
     54 	/* Nothing to do */
     55 }
     56 
     57 int
     58 eisa_maxslots(ec)
     59 	eisa_chipset_tag_t ec;
     60 {
     61 
     62 	/*
     63 	 * Always try 16 slots.
     64 	 */
     65 	return (16);
     66 }
     67 
     68 int
     69 eisa_intr_map(ec, irq, ihp)
     70 	eisa_chipset_tag_t ec;
     71 	u_int irq;
     72 	eisa_intr_handle_t *ihp;
     73 {
     74 
     75 	if (irq >= ICU_LEN) {
     76 		kprintf("eisa_intr_map: bad IRQ %d\n", irq);
     77 		*ihp = -1;
     78 		return 1;
     79 	}
     80 	if (irq == 2) {
     81 		kprintf("eisa_intr_map: changed IRQ 2 to IRQ 9\n");
     82 		irq = 9;
     83 	}
     84 
     85 	*ihp = irq;
     86 	return 0;
     87 }
     88 
     89 const char *
     90 eisa_intr_string(ec, ih)
     91 	eisa_chipset_tag_t ec;
     92 	eisa_intr_handle_t ih;
     93 {
     94 	static char irqstr[8];		/* 4 + 2 + NULL + sanity */
     95 
     96 	if (ih == 0 || ih >= ICU_LEN || ih == 2)
     97 		panic("eisa_intr_string: bogus handle 0x%x\n", ih);
     98 
     99 	ksprintf(irqstr, "irq %d", ih);
    100 	return (irqstr);
    101 
    102 }
    103 
    104 void *
    105 eisa_intr_establish(ec, ih, type, level, func, arg)
    106 	eisa_chipset_tag_t ec;
    107 	eisa_intr_handle_t ih;
    108 	int type, level, (*func) __P((void *));
    109 	void *arg;
    110 {
    111 
    112 	if (ih == 0 || ih >= ICU_LEN || ih == 2)
    113 		panic("eisa_intr_establish: bogus handle 0x%x\n", ih);
    114 
    115 	return isa_intr_establish(NULL, ih, type, level, func, arg);
    116 }
    117 
    118 void
    119 eisa_intr_disestablish(ec, cookie)
    120 	eisa_chipset_tag_t ec;
    121 	void *cookie;
    122 {
    123 
    124 	return isa_intr_disestablish(NULL, cookie);
    125 }
    126