Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / prep / eisa / eisa_machdep.c
blob2b2a375ce2c580394097953fd3e20b45a381c33a
1 /* $NetBSD: eisa_machdep.c,v 1.1 2006/02/23 19:44:02 garbled Exp $ */
3 /*-
4 * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
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
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.
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
38 * are met:
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>
72 #include <sys/time.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
89 * of these funcions.
91 struct powerpc_bus_dma_tag eisa_bus_dma_tag = {
92 0, /* _bounce_thresh */
93 _bus_dmamap_create,
94 _bus_dmamap_destroy,
95 _bus_dmamap_load,
96 _bus_dmamap_load_mbuf,
97 _bus_dmamap_load_uio,
98 _bus_dmamap_load_raw,
99 _bus_dmamap_unload,
100 NULL, /* _dmamap_sync */
101 _bus_dmamem_alloc,
102 _bus_dmamem_free,
103 _bus_dmamem_map,
104 _bus_dmamem_unmap,
105 _bus_dmamem_mmap,
108 void
109 eisa_attach_hook(struct device *parent, struct device *self,
110 struct eisabus_attach_args *eba)
112 /* Nothing to do. */
116 eisa_maxslots(eisa_chipset_tag_t ec)
120 * Always try 16 slots.
122 return (16);
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);
130 *ihp = -1;
131 return 1;
133 if (irq == 2) {
134 printf("eisa_intr_map: changed IRQ 2 to IRQ 9\n");
135 irq = 9;
138 *ihp = irq;
139 return 0;
142 const char *
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);
151 return (irqstr);
155 const struct evcnt *
156 eisa_intr_evcnt(eisa_chipset_tag_t ec, eisa_intr_handle_t ih)
159 /* XXX for now, no evcnt parent reported */
160 return NULL;
163 void *
164 eisa_intr_establish(eisa_chipset_tag_t ec, eisa_intr_handle_t ih,
165 int type, int level, int (*func)(void *), void *arg)
167 int irq;
169 irq = ih;
170 return (void *)intr_establish(irq, type, level, func, arg);
173 void
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)
185 /* XXX XXX XXX */
186 return (ENOENT);
190 eisa_conf_read_irq(eisa_chipset_tag_t ec, int slot, int func, int entry,
191 struct eisa_cfg_irq *eci)
194 /* XXX XXX XXX */
195 return (ENOENT);
199 eisa_conf_read_dma(eisa_chipset_tag_t ec, int slot, int func, int entry,
200 struct eisa_cfg_dma *ecd)
203 /* XXX XXX XXX */
204 return (ENOENT);
208 eisa_conf_read_io(eisa_chipset_tag_t ec, int slot, int func, int entry,
209 struct eisa_cfg_io *ecio)
212 /* XXX XXX XXX */
213 return (ENOENT);