Blame view

include/linux/zorro.h 3.94 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
  /*
   *  linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions
   *
   *  Copyright (C) 1995--2003 Geert Uytterhoeven
   *
   *  This file is subject to the terms and conditions of the GNU General Public
   *  License.  See the file COPYING in the main directory of this archive
   *  for more details.
   */
  
  #ifndef _LINUX_ZORRO_H
  #define _LINUX_ZORRO_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13

986ea58df   Geert Uytterhoeven   zorro/UAPI: Disin...
14
  #include <uapi/linux/zorro.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15

986ea58df   Geert Uytterhoeven   zorro/UAPI: Disin...
16
  #include <linux/device.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
  #include <linux/init.h>
  #include <linux/ioport.h>
bf54a2b3c   Geert Uytterhoeven   m68k: amiga - Zor...
19
  #include <linux/mod_devicetable.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  
  #include <asm/zorro.h>
  
  
      /*
       *  Zorro devices
       */
  
  struct zorro_dev {
      struct ExpansionRom rom;
      zorro_id id;
      struct zorro_driver *driver;	/* which driver has allocated this device */
      struct device dev;			/* Generic device interface */
      u16 slotaddr;
      u16 slotsize;
      char name[64];
      struct resource resource;
  };
  
  #define	to_zorro_dev(n)	container_of(n, struct zorro_dev, dev)
  
  
      /*
       *  Zorro bus
       */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
46
47
48
  extern struct bus_type zorro_bus_type;
  
  
      /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
       *  Zorro device drivers
       */
  
  struct zorro_driver {
      struct list_head node;
      char *name;
      const struct zorro_device_id *id_table;	/* NULL if wants all devices */
      int (*probe)(struct zorro_dev *z, const struct zorro_device_id *id);	/* New device inserted */
      void (*remove)(struct zorro_dev *z);	/* Device removed (NULL if not a hot-plug capable driver) */
      struct device_driver driver;
  };
  
  #define	to_zorro_driver(drv)	container_of(drv, struct zorro_driver, driver)
  
  
  #define zorro_for_each_dev(dev)	\
  	for (dev = &zorro_autocon[0]; dev < zorro_autocon+zorro_num_autocon; dev++)
  
  
  /* New-style probing */
  extern int zorro_register_driver(struct zorro_driver *);
  extern void zorro_unregister_driver(struct zorro_driver *);
  extern const struct zorro_device_id *zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z);
  static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
  {
      return z->driver;
  }
  
  
  extern unsigned int zorro_num_autocon;	/* # of autoconfig devices found */
c293738e6   Geert Uytterhoeven   zorro: Do not all...
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  extern struct zorro_dev *zorro_autocon;
  
  
      /*
       * Minimal information about a Zorro device, passed from bootinfo
       * Only available temporarily, i.e. until initmem has been freed!
       */
  
  struct zorro_dev_init {
  	struct ExpansionRom rom;
  	u16 slotaddr;
  	u16 slotsize;
  	u32 boardaddr;
  	u32 boardsize;
  };
  
  extern struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
96
97
98
99
100
101
102
103
104
105
106
  
  
      /*
       *  Zorro Functions
       */
  
  extern struct zorro_dev *zorro_find_device(zorro_id id,
  					   struct zorro_dev *from);
  
  #define zorro_resource_start(z)	((z)->resource.start)
  #define zorro_resource_end(z)	((z)->resource.end)
28f65c11f   Joe Perches   treewide: Convert...
107
  #define zorro_resource_len(z)	(resource_size(&(z)->resource))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
  #define zorro_resource_flags(z)	((z)->resource.flags)
  
  #define zorro_request_device(z, name) \
      request_mem_region(zorro_resource_start(z), zorro_resource_len(z), name)
  #define zorro_release_device(z) \
      release_mem_region(zorro_resource_start(z), zorro_resource_len(z))
  
  /* Similar to the helpers above, these manipulate per-zorro_dev
   * driver-specific data.  They are really just a wrapper around
   * the generic device structure functions of these calls.
   */
  static inline void *zorro_get_drvdata (struct zorro_dev *z)
  {
  	return dev_get_drvdata(&z->dev);
  }
  
  static inline void zorro_set_drvdata (struct zorro_dev *z, void *data)
  {
  	dev_set_drvdata(&z->dev, data);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
      /*
       *  Bitmask indicating portions of available Zorro II RAM that are unused
       *  by the system. Every bit represents a 64K chunk, for a maximum of 8MB
       *  (128 chunks, physical 0x00200000-0x009fffff).
       *
       *  If you want to use (= allocate) portions of this RAM, you should clear
       *  the corresponding bits.
       */
  
  extern DECLARE_BITMAP(zorro_unused_z2ram, 128);
  
  #define Z2RAM_START		(0x00200000)
  #define Z2RAM_END		(0x00a00000)
  #define Z2RAM_SIZE		(0x00800000)
  #define Z2RAM_CHUNKSIZE		(0x00010000)
  #define Z2RAM_CHUNKMASK		(0x0000ffff)
  #define Z2RAM_CHUNKSHIFT	(16)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
145
  #endif /* _LINUX_ZORRO_H */