Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / acorn32 / include / podulebus_machdep.h
blob1a9240c9f0cfeec2f1df3d396c16383022ffc877
1 /* $NetBSD: podulebus_machdep.h,v 1.1 2001/10/05 22:27:52 reinoud Exp $ */
3 /*
4 * Copyright (c) 1995 Mark Brinicombe.
5 * Copyright (c) 1995 Brini.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Brini.
19 * 4. The name of the company nor the name of the author may be used to
20 * endorse or promote products derived from this software without specific
21 * prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
35 * RiscBSD kernel project
37 * podulebus.h
39 * Podule bus header file
41 * Created : 26/04/95
44 #include <sys/param.h>
45 #include <machine/bus.h>
46 #include <machine/io.h>
48 /* Define the structure used to describe a podule */
50 #define PODULE_DESCRIPTION_LENGTH 63
52 typedef struct {
53 /* The podule header, read from the on board ROM */
55 u_char flags0;
56 u_char flags1;
57 u_char reserved;
58 u_short product;
59 u_short manufacturer;
60 u_char country;
61 u_int irq_addr;
62 u_int irq_mask;
63 u_int fiq_addr;
64 u_int fiq_mask;
66 /* The base addresses for this podule */
68 u_int fast_base;
69 u_int medium_base;
70 u_int slow_base;
71 u_int sync_base;
72 u_int mod_base;
73 u_int easi_base;
75 /* Flags */
77 int podulenum;
78 int slottype;
79 int attached;
81 /* Other info */
83 char description[PODULE_DESCRIPTION_LENGTH + 1];
84 u_int (*read_rom)(u_int, int);
86 /* podule specific information provided by podulebus */
88 int interrupt;
90 int dma_channel;
91 int dma_interrupt;
92 } podule_t;
94 #define PODULE_FLAGS_CD 0x01
95 #define PODULE_FLAGS_IS 0x02
97 #define SLOT_NONE 0x00
98 #define SLOT_POD 0x01
99 #define SLOT_NET 0x02
101 typedef int podulebus_intr_handle_t;
103 #define podulebus_attach_args podule_attach_args
105 struct podule_attach_args {
106 podule_t *pa_podule; /* podule descriptor */
107 int pa_podule_number; /* podule number */
108 int pa_slottype; /* podule slot type */
109 bus_space_tag_t pa_iot; /* bus space tag */
111 #define pa_easi_t pa_iot
112 #define pa_mod_t pa_iot
113 #define pa_fast_t pa_iot
114 #define pa_medium_t pa_iot
115 #define pa_slow_t pa_iot
116 #define pa_sync_t pa_iot
118 #define pa_easi_base pa_podule->easi_base
119 #define pa_mod_base pa_podule->mod_base
120 #define pa_fast_base pa_podule->fast_base
121 #define pa_medium_base pa_podule->medium_base
122 #define pa_slow_base pa_podule->slow_base
123 #define pa_sync_base pa_podule->sync_base
125 podulebus_intr_handle_t pa_ih; /* interrupt handle */
127 #define pa_manufacturer pa_podule->manufacturer
128 #define pa_product pa_podule->product
129 #define pa_descr pa_podule->description
132 /* Useful macros */
134 /* EASI space cycle control */
137 #define IS_PODULE(pa, man, prod) \
138 (pa->pa_manufacturer == man && pa->pa_product == prod)
142 #define EASI_CYCLE_TYPE_A 0x00
143 #define EASI_CYCLE_TYPE_C 0x01
144 #define set_easi_cycle_type(podule, type) \
145 IOMD_WRITE_BYTE(IOMD_ECTCR, (IOMD_READ_BYTE(IOMD_ECTCR) & ~(1 << podule)) | (1 << type))
147 #ifdef _KERNEL
149 /* Array of podule structures, one per possible podule */
151 extern podule_t podules[MAX_PODULES + MAX_NETSLOTS];
153 int matchpodule(struct podule_attach_args *pa,
154 int manufacturer, int product, int required_slot);
156 void netslot_ea(u_int8_t *buffer);
158 extern void *podulebus_irq_establish(podulebus_intr_handle_t, int,
159 int (*)(void *), void *, struct evcnt *);
160 extern void podulebus_shift_tag(bus_space_tag_t, u_int,
161 bus_space_tag_t *);
163 /* Used internally by the podulebus code */
164 extern void netslotscan(struct device *);
165 extern void poduleexamine(podule_t *, struct device *, int);
167 #endif
169 /* End of podulebus.h */