1
2
3
4
5
6
7
8
9
10
11#ifndef _LINUX_ZORRO_H
12#define _LINUX_ZORRO_H
13
14
15#include <uapi/linux/zorro.h>
16
17#include <linux/device.h>
18#include <linux/init.h>
19#include <linux/ioport.h>
20#include <linux/mod_devicetable.h>
21
22#include <asm/zorro.h>
23
24
25
26
27
28
29struct zorro_dev {
30 struct ExpansionRom rom;
31 zorro_id id;
32 struct zorro_driver *driver;
33 struct device dev;
34 u16 slotaddr;
35 u16 slotsize;
36 char name[64];
37 struct resource resource;
38};
39
40#define to_zorro_dev(n) container_of(n, struct zorro_dev, dev)
41
42
43
44
45
46
47extern struct bus_type zorro_bus_type;
48
49
50
51
52
53
54struct zorro_driver {
55 struct list_head node;
56 char *name;
57 const struct zorro_device_id *id_table;
58 int (*probe)(struct zorro_dev *z, const struct zorro_device_id *id);
59 void (*remove)(struct zorro_dev *z);
60 struct device_driver driver;
61};
62
63#define to_zorro_driver(drv) container_of(drv, struct zorro_driver, driver)
64
65
66#define zorro_for_each_dev(dev) \
67 for (dev = &zorro_autocon[0]; dev < zorro_autocon+zorro_num_autocon; dev++)
68
69
70
71extern int zorro_register_driver(struct zorro_driver *);
72extern void zorro_unregister_driver(struct zorro_driver *);
73extern const struct zorro_device_id *zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z);
74static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
75{
76 return z->driver;
77}
78
79
80extern unsigned int zorro_num_autocon;
81extern struct zorro_dev *zorro_autocon;
82
83
84
85
86
87
88
89struct zorro_dev_init {
90 struct ExpansionRom rom;
91 u16 slotaddr;
92 u16 slotsize;
93 u32 boardaddr;
94 u32 boardsize;
95};
96
97extern struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
98
99
100
101
102
103
104extern struct zorro_dev *zorro_find_device(zorro_id id,
105 struct zorro_dev *from);
106
107#define zorro_resource_start(z) ((z)->resource.start)
108#define zorro_resource_end(z) ((z)->resource.end)
109#define zorro_resource_len(z) (resource_size(&(z)->resource))
110#define zorro_resource_flags(z) ((z)->resource.flags)
111
112#define zorro_request_device(z, name) \
113 request_mem_region(zorro_resource_start(z), zorro_resource_len(z), name)
114#define zorro_release_device(z) \
115 release_mem_region(zorro_resource_start(z), zorro_resource_len(z))
116
117
118
119
120
121static inline void *zorro_get_drvdata (struct zorro_dev *z)
122{
123 return dev_get_drvdata(&z->dev);
124}
125
126static inline void zorro_set_drvdata (struct zorro_dev *z, void *data)
127{
128 dev_set_drvdata(&z->dev, data);
129}
130
131
132
133
134
135
136
137
138
139
140
141extern DECLARE_BITMAP(zorro_unused_z2ram, 128);
142
143#define Z2RAM_START (0x00200000)
144#define Z2RAM_END (0x00a00000)
145#define Z2RAM_SIZE (0x00800000)
146#define Z2RAM_CHUNKSIZE (0x00010000)
147#define Z2RAM_CHUNKMASK (0x0000ffff)
148#define Z2RAM_CHUNKSHIFT (16)
149
150
151#endif
152