2 * linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions
4 * Copyright (C) 1995--2003 Geert Uytterhoeven
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
11 #ifndef _LINUX_ZORRO_H
12 #define _LINUX_ZORRO_H
15 #include <uapi/linux/zorro.h>
17 #include <linux/device.h>
18 #include <linux/init.h>
19 #include <linux/ioport.h>
20 #include <linux/mod_devicetable.h>
22 #include <asm/zorro.h>
30 struct ExpansionRom rom
;
32 struct zorro_driver
*driver
; /* which driver has allocated this device */
33 struct device dev
; /* Generic device interface */
37 struct resource resource
;
40 #define to_zorro_dev(n) container_of(n, struct zorro_dev, dev)
47 extern struct bus_type zorro_bus_type
;
51 * Zorro device drivers
55 struct list_head node
;
57 const struct zorro_device_id
*id_table
; /* NULL if wants all devices */
58 int (*probe
)(struct zorro_dev
*z
, const struct zorro_device_id
*id
); /* New device inserted */
59 void (*remove
)(struct zorro_dev
*z
); /* Device removed (NULL if not a hot-plug capable driver) */
60 struct device_driver driver
;
63 #define to_zorro_driver(drv) container_of(drv, struct zorro_driver, driver)
66 #define zorro_for_each_dev(dev) \
67 for (dev = &zorro_autocon[0]; dev < zorro_autocon+zorro_num_autocon; dev++)
70 /* New-style probing */
71 extern int zorro_register_driver(struct zorro_driver
*);
72 extern void zorro_unregister_driver(struct zorro_driver
*);
73 extern const struct zorro_device_id
*zorro_match_device(const struct zorro_device_id
*ids
, const struct zorro_dev
*z
);
74 static inline struct zorro_driver
*zorro_dev_driver(const struct zorro_dev
*z
)
80 extern unsigned int zorro_num_autocon
; /* # of autoconfig devices found */
81 extern struct zorro_dev
*zorro_autocon
;
85 * Minimal information about a Zorro device, passed from bootinfo
86 * Only available temporarily, i.e. until initmem has been freed!
89 struct zorro_dev_init
{
90 struct ExpansionRom rom
;
97 extern struct zorro_dev_init zorro_autocon_init
[ZORRO_NUM_AUTO
] __initdata
;
104 extern struct zorro_dev
*zorro_find_device(zorro_id id
,
105 struct zorro_dev
*from
);
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)
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))
117 /* Similar to the helpers above, these manipulate per-zorro_dev
118 * driver-specific data. They are really just a wrapper around
119 * the generic device structure functions of these calls.
121 static inline void *zorro_get_drvdata (struct zorro_dev
*z
)
123 return dev_get_drvdata(&z
->dev
);
126 static inline void zorro_set_drvdata (struct zorro_dev
*z
, void *data
)
128 dev_set_drvdata(&z
->dev
, data
);
133 * Bitmask indicating portions of available Zorro II RAM that are unused
134 * by the system. Every bit represents a 64K chunk, for a maximum of 8MB
135 * (128 chunks, physical 0x00200000-0x009fffff).
137 * If you want to use (= allocate) portions of this RAM, you should clear
138 * the corresponding bits.
141 extern DECLARE_BITMAP(zorro_unused_z2ram
, 128);
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)
151 #endif /* _LINUX_ZORRO_H */