1 /* $NetBSD: eisa_machdep.c,v 1.1 2006/02/23 19:44:02 garbled Exp $ */
4 * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
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.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
34 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by Christopher G. Demetriou
47 * for the NetBSD Project.
48 * 4. The name of the author may not be used to endorse or promote products
49 * derived from this software without specific prior written permission
51 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
52 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
55 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 * Machine-specific functions for EISA autoconfiguration.
67 #include <sys/cdefs.h>
68 __KERNEL_RCSID(0, "$NetBSD: eisa_machdep.c,v 1.1 2006/02/23 19:44:02 garbled Exp $");
70 #include <sys/types.h>
71 #include <sys/param.h>
73 #include <sys/systm.h>
74 #include <sys/errno.h>
75 #include <sys/device.h>
76 #include <sys/extent.h>
78 #define _POWERPC_BUS_DMA_PRIVATE
79 #include <machine/bus.h>
80 #include <machine/pio.h>
81 #include <machine/intr.h>
83 #include <dev/isa/isareg.h>
84 #include <dev/isa/isavar.h>
85 #include <dev/eisa/eisavar.h>
88 * EISA doesn't have any special needs; just use the generic versions
91 struct powerpc_bus_dma_tag eisa_bus_dma_tag
= {
92 0, /* _bounce_thresh */
96 _bus_dmamap_load_mbuf
,
100 NULL
, /* _dmamap_sync */
109 eisa_attach_hook(struct device
*parent
, struct device
*self
,
110 struct eisabus_attach_args
*eba
)
116 eisa_maxslots(eisa_chipset_tag_t ec
)
120 * Always try 16 slots.
126 eisa_intr_map(eisa_chipset_tag_t ec
, u_int irq
, eisa_intr_handle_t
*ihp
)
128 if (irq
>= I8259_INTR_NUM
) {
129 printf("eisa_intr_map: bad IRQ %d\n", irq
);
134 printf("eisa_intr_map: changed IRQ 2 to IRQ 9\n");
143 eisa_intr_string(eisa_chipset_tag_t ec
, eisa_intr_handle_t ih
)
145 static char irqstr
[8]; /* 4 + 2 + NULL + sanity */
147 if (ih
== 0 || (ih
& 0xff) >= I8259_INTR_NUM
|| ih
== 2)
148 panic("eisa_intr_string: bogus handle 0x%x", ih
);
150 snprintf(irqstr
, sizeof(irqstr
), "irq %d", ih
);
156 eisa_intr_evcnt(eisa_chipset_tag_t ec
, eisa_intr_handle_t ih
)
159 /* XXX for now, no evcnt parent reported */
164 eisa_intr_establish(eisa_chipset_tag_t ec
, eisa_intr_handle_t ih
,
165 int type
, int level
, int (*func
)(void *), void *arg
)
170 return (void *)intr_establish(irq
, type
, level
, func
, arg
);
174 eisa_intr_disestablish(eisa_chipset_tag_t ec
, void *cookie
)
177 intr_disestablish(cookie
);
181 eisa_conf_read_mem(eisa_chipset_tag_t ec
, int slot
, int func
, int entry
,
182 struct eisa_cfg_mem
*ecm
)
190 eisa_conf_read_irq(eisa_chipset_tag_t ec
, int slot
, int func
, int entry
,
191 struct eisa_cfg_irq
*eci
)
199 eisa_conf_read_dma(eisa_chipset_tag_t ec
, int slot
, int func
, int entry
,
200 struct eisa_cfg_dma
*ecd
)
208 eisa_conf_read_io(eisa_chipset_tag_t ec
, int slot
, int func
, int entry
,
209 struct eisa_cfg_io
*ecio
)