0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef _LINUX_ZORRO_H
0012 #define _LINUX_ZORRO_H
0013
0014
0015 #include <uapi/linux/zorro.h>
0016
0017 #include <linux/device.h>
0018 #include <linux/init.h>
0019 #include <linux/ioport.h>
0020 #include <linux/mod_devicetable.h>
0021
0022 #include <asm/zorro.h>
0023
0024
0025
0026
0027
0028
0029 struct zorro_dev {
0030 struct ExpansionRom rom;
0031 zorro_id id;
0032 struct device dev;
0033 u16 slotaddr;
0034 u16 slotsize;
0035 char name[64];
0036 struct resource resource;
0037 };
0038
0039 #define to_zorro_dev(n) container_of(n, struct zorro_dev, dev)
0040
0041
0042
0043
0044
0045
0046 struct zorro_driver {
0047 struct list_head node;
0048 char *name;
0049 const struct zorro_device_id *id_table;
0050 int (*probe)(struct zorro_dev *z, const struct zorro_device_id *id);
0051 void (*remove)(struct zorro_dev *z);
0052 struct device_driver driver;
0053 };
0054
0055 #define to_zorro_driver(drv) container_of(drv, struct zorro_driver, driver)
0056
0057
0058 #define zorro_for_each_dev(dev) \
0059 for (dev = &zorro_autocon[0]; dev < zorro_autocon+zorro_num_autocon; dev++)
0060
0061
0062
0063 extern int zorro_register_driver(struct zorro_driver *);
0064 extern void zorro_unregister_driver(struct zorro_driver *);
0065
0066
0067 extern unsigned int zorro_num_autocon;
0068 extern struct zorro_dev *zorro_autocon;
0069
0070
0071
0072
0073
0074
0075
0076 struct zorro_dev_init {
0077 struct ExpansionRom rom;
0078 u16 slotaddr;
0079 u16 slotsize;
0080 u32 boardaddr;
0081 u32 boardsize;
0082 };
0083
0084 extern struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
0085
0086
0087
0088
0089
0090
0091 extern struct zorro_dev *zorro_find_device(zorro_id id,
0092 struct zorro_dev *from);
0093
0094 #define zorro_resource_start(z) ((z)->resource.start)
0095 #define zorro_resource_end(z) ((z)->resource.end)
0096 #define zorro_resource_len(z) (resource_size(&(z)->resource))
0097 #define zorro_resource_flags(z) ((z)->resource.flags)
0098
0099 #define zorro_request_device(z, name) \
0100 request_mem_region(zorro_resource_start(z), zorro_resource_len(z), name)
0101 #define zorro_release_device(z) \
0102 release_mem_region(zorro_resource_start(z), zorro_resource_len(z))
0103
0104
0105
0106
0107
0108 static inline void *zorro_get_drvdata (struct zorro_dev *z)
0109 {
0110 return dev_get_drvdata(&z->dev);
0111 }
0112
0113 static inline void zorro_set_drvdata (struct zorro_dev *z, void *data)
0114 {
0115 dev_set_drvdata(&z->dev, data);
0116 }
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 extern DECLARE_BITMAP(zorro_unused_z2ram, 128);
0129
0130 #define Z2RAM_START (0x00200000)
0131 #define Z2RAM_END (0x00a00000)
0132 #define Z2RAM_SIZE (0x00800000)
0133 #define Z2RAM_CHUNKSIZE (0x00010000)
0134 #define Z2RAM_CHUNKMASK (0x0000ffff)
0135 #define Z2RAM_CHUNKSHIFT (16)
0136
0137
0138 #endif