Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  *  linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions
0003  *
0004  *  Copyright (C) 1995--2003 Geert Uytterhoeven
0005  *
0006  *  This file is subject to the terms and conditions of the GNU General Public
0007  *  License.  See the file COPYING in the main directory of this archive
0008  *  for more details.
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      *  Zorro devices
0027      */
0028 
0029 struct zorro_dev {
0030     struct ExpansionRom rom;
0031     zorro_id id;
0032     struct device dev;          /* Generic device interface */
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      *  Zorro device drivers
0044      */
0045 
0046 struct zorro_driver {
0047     struct list_head node;
0048     char *name;
0049     const struct zorro_device_id *id_table; /* NULL if wants all devices */
0050     int (*probe)(struct zorro_dev *z, const struct zorro_device_id *id);    /* New device inserted */
0051     void (*remove)(struct zorro_dev *z);    /* Device removed (NULL if not a hot-plug capable driver) */
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 /* New-style probing */
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;  /* # of autoconfig devices found */
0068 extern struct zorro_dev *zorro_autocon;
0069 
0070 
0071     /*
0072      * Minimal information about a Zorro device, passed from bootinfo
0073      * Only available temporarily, i.e. until initmem has been freed!
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      *  Zorro Functions
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 /* Similar to the helpers above, these manipulate per-zorro_dev
0105  * driver-specific data.  They are really just a wrapper around
0106  * the generic device structure functions of these calls.
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      *  Bitmask indicating portions of available Zorro II RAM that are unused
0121      *  by the system. Every bit represents a 64K chunk, for a maximum of 8MB
0122      *  (128 chunks, physical 0x00200000-0x009fffff).
0123      *
0124      *  If you want to use (= allocate) portions of this RAM, you should clear
0125      *  the corresponding bits.
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 /* _LINUX_ZORRO_H */