eisa_machdep.c revision 1.5
1/* $NetBSD: eisa_machdep.c,v 1.5 1996/10/21 23:12:56 thorpej 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#include <sys/extent.h> 44 45#include <i386/isa/icu.h> 46#include <dev/isa/isareg.h> 47#include <dev/isa/isavar.h> 48#include <dev/eisa/eisavar.h> 49 50void 51eisa_attach_hook(parent, self, eba) 52 struct device *parent, *self; 53 struct eisabus_attach_args *eba; 54{ 55 56 /* Nothing to do */ 57} 58 59int 60eisa_maxslots(ec) 61 eisa_chipset_tag_t ec; 62{ 63 64 /* 65 * Always try 16 slots. 66 */ 67 return (16); 68} 69 70int 71eisa_intr_map(ec, irq, ihp) 72 eisa_chipset_tag_t ec; 73 u_int irq; 74 eisa_intr_handle_t *ihp; 75{ 76 77 if (irq >= ICU_LEN) { 78 printf("eisa_intr_map: bad IRQ %d\n", irq); 79 *ihp = -1; 80 return 1; 81 } 82 if (irq == 2) { 83 printf("eisa_intr_map: changed IRQ 2 to IRQ 9\n"); 84 irq = 9; 85 } 86 87 *ihp = irq; 88 return 0; 89} 90 91const char * 92eisa_intr_string(ec, ih) 93 eisa_chipset_tag_t ec; 94 eisa_intr_handle_t ih; 95{ 96 static char irqstr[8]; /* 4 + 2 + NULL + sanity */ 97 98 if (ih == 0 || ih >= ICU_LEN || ih == 2) 99 panic("eisa_intr_string: bogus handle 0x%x\n", ih); 100 101 sprintf(irqstr, "irq %d", ih); 102 return (irqstr); 103 104} 105 106void * 107eisa_intr_establish(ec, ih, type, level, func, arg) 108 eisa_chipset_tag_t ec; 109 eisa_intr_handle_t ih; 110 int type, level, (*func) __P((void *)); 111 void *arg; 112{ 113 114 if (ih == 0 || ih >= ICU_LEN || ih == 2) 115 panic("eisa_intr_establish: bogus handle 0x%x\n", ih); 116 117 return isa_intr_establish(NULL, ih, type, level, func, arg); 118} 119 120void 121eisa_intr_disestablish(ec, cookie) 122 eisa_chipset_tag_t ec; 123 void *cookie; 124{ 125 126 return isa_intr_disestablish(NULL, cookie); 127} 128 129int 130eisa_mem_alloc(t, size, align, boundary, cacheable, addrp, bahp) 131 bus_space_tag_t t; 132 bus_size_t size, align; 133 bus_addr_t boundary; 134 int cacheable; 135 bus_addr_t *addrp; 136 bus_space_handle_t *bahp; 137{ 138 extern struct extent *iomem_ex; 139 140 /* 141 * Allocate physical address space after the ISA hole. 142 */ 143 return bus_space_alloc(t, IOM_END, iomem_ex->ex_end, size, align, 144 boundary, cacheable, addrp, bahp); 145} 146 147void 148eisa_mem_free(t, bah, size) 149 bus_space_tag_t t; 150 bus_space_handle_t bah; 151 bus_size_t size; 152{ 153 154 bus_space_free(t, bah, size); 155} 156