]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions | |
3 | * | |
4 | * Copyright (C) 1995--2003 Geert Uytterhoeven | |
5 | * | |
6 | * This file is subject to the terms and conditions of the GNU General Public | |
7 | * License. See the file COPYING in the main directory of this archive | |
8 | * for more details. | |
9 | */ | |
10 | ||
11 | #ifndef _LINUX_ZORRO_H | |
12 | #define _LINUX_ZORRO_H | |
13 | ||
1da177e4 | 14 | |
986ea58d | 15 | #include <uapi/linux/zorro.h> |
1da177e4 | 16 | |
986ea58d | 17 | #include <linux/device.h> |
1da177e4 LT |
18 | #include <linux/init.h> |
19 | #include <linux/ioport.h> | |
bf54a2b3 | 20 | #include <linux/mod_devicetable.h> |
1da177e4 LT |
21 | |
22 | #include <asm/zorro.h> | |
23 | ||
24 | ||
25 | /* | |
26 | * Zorro devices | |
27 | */ | |
28 | ||
29 | struct zorro_dev { | |
30 | struct ExpansionRom rom; | |
31 | zorro_id id; | |
32 | struct zorro_driver *driver; /* which driver has allocated this device */ | |
33 | struct device dev; /* Generic device interface */ | |
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 | ||
1da177e4 LT |
43 | /* |
44 | * Zorro device drivers | |
45 | */ | |
46 | ||
47 | struct zorro_driver { | |
48 | struct list_head node; | |
49 | char *name; | |
50 | const struct zorro_device_id *id_table; /* NULL if wants all devices */ | |
51 | int (*probe)(struct zorro_dev *z, const struct zorro_device_id *id); /* New device inserted */ | |
52 | void (*remove)(struct zorro_dev *z); /* Device removed (NULL if not a hot-plug capable driver) */ | |
53 | struct device_driver driver; | |
54 | }; | |
55 | ||
56 | #define to_zorro_driver(drv) container_of(drv, struct zorro_driver, driver) | |
57 | ||
58 | ||
59 | #define zorro_for_each_dev(dev) \ | |
60 | for (dev = &zorro_autocon[0]; dev < zorro_autocon+zorro_num_autocon; dev++) | |
61 | ||
62 | ||
63 | /* New-style probing */ | |
64 | extern int zorro_register_driver(struct zorro_driver *); | |
65 | extern void zorro_unregister_driver(struct zorro_driver *); | |
1da177e4 LT |
66 | |
67 | ||
68 | extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */ | |
c293738e GU |
69 | extern struct zorro_dev *zorro_autocon; |
70 | ||
71 | ||
72 | /* | |
73 | * Minimal information about a Zorro device, passed from bootinfo | |
74 | * Only available temporarily, i.e. until initmem has been freed! | |
75 | */ | |
76 | ||
77 | struct zorro_dev_init { | |
78 | struct ExpansionRom rom; | |
79 | u16 slotaddr; | |
80 | u16 slotsize; | |
81 | u32 boardaddr; | |
82 | u32 boardsize; | |
83 | }; | |
84 | ||
85 | extern struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata; | |
1da177e4 LT |
86 | |
87 | ||
88 | /* | |
89 | * Zorro Functions | |
90 | */ | |
91 | ||
92 | extern struct zorro_dev *zorro_find_device(zorro_id id, | |
93 | struct zorro_dev *from); | |
94 | ||
95 | #define zorro_resource_start(z) ((z)->resource.start) | |
96 | #define zorro_resource_end(z) ((z)->resource.end) | |
28f65c11 | 97 | #define zorro_resource_len(z) (resource_size(&(z)->resource)) |
1da177e4 LT |
98 | #define zorro_resource_flags(z) ((z)->resource.flags) |
99 | ||
100 | #define zorro_request_device(z, name) \ | |
101 | request_mem_region(zorro_resource_start(z), zorro_resource_len(z), name) | |
102 | #define zorro_release_device(z) \ | |
103 | release_mem_region(zorro_resource_start(z), zorro_resource_len(z)) | |
104 | ||
105 | /* Similar to the helpers above, these manipulate per-zorro_dev | |
106 | * driver-specific data. They are really just a wrapper around | |
107 | * the generic device structure functions of these calls. | |
108 | */ | |
109 | static inline void *zorro_get_drvdata (struct zorro_dev *z) | |
110 | { | |
111 | return dev_get_drvdata(&z->dev); | |
112 | } | |
113 | ||
114 | static inline void zorro_set_drvdata (struct zorro_dev *z, void *data) | |
115 | { | |
116 | dev_set_drvdata(&z->dev, data); | |
117 | } | |
118 | ||
119 | ||
1da177e4 LT |
120 | /* |
121 | * Bitmask indicating portions of available Zorro II RAM that are unused | |
122 | * by the system. Every bit represents a 64K chunk, for a maximum of 8MB | |
123 | * (128 chunks, physical 0x00200000-0x009fffff). | |
124 | * | |
125 | * If you want to use (= allocate) portions of this RAM, you should clear | |
126 | * the corresponding bits. | |
127 | */ | |
128 | ||
129 | extern DECLARE_BITMAP(zorro_unused_z2ram, 128); | |
130 | ||
131 | #define Z2RAM_START (0x00200000) | |
132 | #define Z2RAM_END (0x00a00000) | |
133 | #define Z2RAM_SIZE (0x00800000) | |
134 | #define Z2RAM_CHUNKSIZE (0x00010000) | |
135 | #define Z2RAM_CHUNKMASK (0x0000ffff) | |
136 | #define Z2RAM_CHUNKSHIFT (16) | |
137 | ||
138 | ||
1da177e4 | 139 | #endif /* _LINUX_ZORRO_H */ |