1
2
3
4
5
6
7
8
9
10
11#ifndef _LINUX_ZORRO_H
12#define _LINUX_ZORRO_H
13
14#include <linux/device.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31#define ZORRO_MANUF(id) ((id) >> 16)
32#define ZORRO_PROD(id) (((id) >> 8) & 0xff)
33#define ZORRO_EPC(id) ((id) & 0xff)
34
35#define ZORRO_ID(manuf, prod, epc) \
36 ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc))
37
38typedef __u32 zorro_id;
39
40
41#define ZORRO_WILDCARD (0xffffffff)
42
43
44#include <linux/zorro_ids.h>
45
46
47
48
49
50
51
52
53#define GVP_PRODMASK (0xf8)
54#define GVP_SCSICLKMASK (0x01)
55
56enum GVP_flags {
57 GVP_IO = 0x01,
58 GVP_ACCEL = 0x02,
59 GVP_SCSI = 0x04,
60 GVP_24BITDMA = 0x08,
61 GVP_25BITDMA = 0x10,
62 GVP_NOBANK = 0x20,
63 GVP_14MHZ = 0x40,
64};
65
66
67struct Node {
68 struct Node *ln_Succ;
69 struct Node *ln_Pred;
70 __u8 ln_Type;
71 __s8 ln_Pri;
72 __s8 *ln_Name;
73} __attribute__ ((packed));
74
75struct ExpansionRom {
76
77 __u8 er_Type;
78 __u8 er_Product;
79 __u8 er_Flags;
80 __u8 er_Reserved03;
81 __u16 er_Manufacturer;
82 __u32 er_SerialNumber;
83 __u16 er_InitDiagVec;
84 __u8 er_Reserved0c;
85 __u8 er_Reserved0d;
86 __u8 er_Reserved0e;
87 __u8 er_Reserved0f;
88} __attribute__ ((packed));
89
90
91#define ERT_TYPEMASK 0xc0
92#define ERT_ZORROII 0xc0
93#define ERT_ZORROIII 0x80
94
95
96#define ERTB_MEMLIST 5
97#define ERTF_MEMLIST (1<<5)
98
99struct ConfigDev {
100 struct Node cd_Node;
101 __u8 cd_Flags;
102 __u8 cd_Pad;
103 struct ExpansionRom cd_Rom;
104 void *cd_BoardAddr;
105 __u32 cd_BoardSize;
106 __u16 cd_SlotAddr;
107 __u16 cd_SlotSize;
108 void *cd_Driver;
109 struct ConfigDev *cd_NextCD;
110 __u32 cd_Unused[4];
111} __attribute__ ((packed));
112
113#define ZORRO_NUM_AUTO 16
114
115#ifdef __KERNEL__
116
117#include <linux/init.h>
118#include <linux/ioport.h>
119
120#include <asm/zorro.h>
121
122
123
124
125
126
127struct zorro_dev {
128 struct ExpansionRom rom;
129 zorro_id id;
130 struct zorro_driver *driver;
131 struct device dev;
132 u16 slotaddr;
133 u16 slotsize;
134 char name[64];
135 struct resource resource;
136};
137
138#define to_zorro_dev(n) container_of(n, struct zorro_dev, dev)
139
140
141
142
143
144
145struct zorro_bus {
146 struct list_head devices;
147 unsigned int num_resources;
148 struct resource resources[4];
149 struct device dev;
150 char name[10];
151};
152
153extern struct zorro_bus zorro_bus;
154extern struct bus_type zorro_bus_type;
155
156
157
158
159
160
161struct zorro_device_id {
162 zorro_id id;
163 unsigned long driver_data;
164};
165
166
167
168
169
170
171struct zorro_driver {
172 struct list_head node;
173 char *name;
174 const struct zorro_device_id *id_table;
175 int (*probe)(struct zorro_dev *z, const struct zorro_device_id *id);
176 void (*remove)(struct zorro_dev *z);
177 struct device_driver driver;
178};
179
180#define to_zorro_driver(drv) container_of(drv, struct zorro_driver, driver)
181
182
183#define zorro_for_each_dev(dev) \
184 for (dev = &zorro_autocon[0]; dev < zorro_autocon+zorro_num_autocon; dev++)
185
186
187
188extern int zorro_register_driver(struct zorro_driver *);
189extern void zorro_unregister_driver(struct zorro_driver *);
190extern const struct zorro_device_id *zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z);
191static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
192{
193 return z->driver;
194}
195
196
197extern unsigned int zorro_num_autocon;
198extern struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
199
200
201
202
203
204
205extern struct zorro_dev *zorro_find_device(zorro_id id,
206 struct zorro_dev *from);
207
208#define zorro_resource_start(z) ((z)->resource.start)
209#define zorro_resource_end(z) ((z)->resource.end)
210#define zorro_resource_len(z) ((z)->resource.end-(z)->resource.start+1)
211#define zorro_resource_flags(z) ((z)->resource.flags)
212
213#define zorro_request_device(z, name) \
214 request_mem_region(zorro_resource_start(z), zorro_resource_len(z), name)
215#define zorro_release_device(z) \
216 release_mem_region(zorro_resource_start(z), zorro_resource_len(z))
217
218
219
220
221
222static inline void *zorro_get_drvdata (struct zorro_dev *z)
223{
224 return dev_get_drvdata(&z->dev);
225}
226
227static inline void zorro_set_drvdata (struct zorro_dev *z, void *data)
228{
229 dev_set_drvdata(&z->dev, data);
230}
231
232
233
234
235
236
237
238
239
240
241
242extern DECLARE_BITMAP(zorro_unused_z2ram, 128);
243
244#define Z2RAM_START (0x00200000)
245#define Z2RAM_END (0x00a00000)
246#define Z2RAM_SIZE (0x00800000)
247#define Z2RAM_CHUNKSIZE (0x00010000)
248#define Z2RAM_CHUNKMASK (0x0000ffff)
249#define Z2RAM_CHUNKSHIFT (16)
250
251
252#endif
253
254#endif
255