Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
/*
2
 *  linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions
3
 *
4
 *  Copyright (C) 1995--2000 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
 
14
#ifndef __ASSEMBLY__
15
 
16
    /*
17
     *  Each Zorro board has a 32-bit ID of the form
18
     *
19
     *      mmmmmmmmmmmmmmmmppppppppeeeeeeee
20
     *
21
     *  with
22
     *
23
     *      mmmmmmmmmmmmmmmm    16-bit Manufacturer ID (assigned by CBM (sigh))
24
     *      pppppppp            8-bit Product ID (assigned by manufacturer)
25
     *      eeeeeeee            8-bit Extended Product ID (currently only used
26
     *                          for some GVP boards)
27
     */
28
 
29
 
30
#define ZORRO_MANUF(id)         ((id) >> 16)
31
#define ZORRO_PROD(id)          (((id) >> 8) & 0xff)
32
#define ZORRO_EPC(id)           ((id) & 0xff)
33
 
34
#define ZORRO_ID(manuf, prod, epc) \
35
    ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc))
36
 
37
typedef __u32 zorro_id;
38
 
39
 
40
#define ZORRO_WILDCARD          (0xffffffff)    /* not official */
41
 
42
/* Include the ID list */
43
#include <linux/zorro_ids.h>
44
 
45
 
46
    /*
47
     *  GVP identifies most of its products through the 'extended product code'
48
     *  (epc). The epc has to be ANDed with the GVP_PRODMASK before the
49
     *  identification.
50
     */
51
 
52
#define GVP_PRODMASK                    (0xf8)
53
#define GVP_SCSICLKMASK                 (0x01)
54
 
55
enum GVP_flags {
56
    GVP_IO              = 0x01,
57
    GVP_ACCEL           = 0x02,
58
    GVP_SCSI            = 0x04,
59
    GVP_24BITDMA        = 0x08,
60
    GVP_25BITDMA        = 0x10,
61
    GVP_NOBANK          = 0x20,
62
    GVP_14MHZ           = 0x40,
63
};
64
 
65
 
66
struct Node {
67
    struct  Node *ln_Succ;      /* Pointer to next (successor) */
68
    struct  Node *ln_Pred;      /* Pointer to previous (predecessor) */
69
    __u8    ln_Type;
70
    __s8    ln_Pri;             /* Priority, for sorting */
71
    __s8    *ln_Name;           /* ID string, null terminated */
72
} __attribute__ ((packed));
73
 
74
struct ExpansionRom {
75
    /* -First 16 bytes of the expansion ROM */
76
    __u8  er_Type;              /* Board type, size and flags */
77
    __u8  er_Product;           /* Product number, assigned by manufacturer */
78
    __u8  er_Flags;             /* Flags */
79
    __u8  er_Reserved03;        /* Must be zero ($ff inverted) */
80
    __u16 er_Manufacturer;      /* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */
81
    __u32 er_SerialNumber;      /* Available for use by manufacturer */
82
    __u16 er_InitDiagVec;       /* Offset to optional "DiagArea" structure */
83
    __u8  er_Reserved0c;
84
    __u8  er_Reserved0d;
85
    __u8  er_Reserved0e;
86
    __u8  er_Reserved0f;
87
} __attribute__ ((packed));
88
 
89
/* er_Type board type bits */
90
#define ERT_TYPEMASK    0xc0
91
#define ERT_ZORROII     0xc0
92
#define ERT_ZORROIII    0x80
93
 
94
/* other bits defined in er_Type */
95
#define ERTB_MEMLIST    5               /* Link RAM into free memory list */
96
#define ERTF_MEMLIST    (1<<5)
97
 
98
struct ConfigDev {
99
    struct Node         cd_Node;
100
    __u8                cd_Flags;       /* (read/write) */
101
    __u8                cd_Pad;         /* reserved */
102
    struct ExpansionRom cd_Rom;         /* copy of board's expansion ROM */
103
    void                *cd_BoardAddr;  /* where in memory the board was placed */
104
    __u32               cd_BoardSize;   /* size of board in bytes */
105
    __u16               cd_SlotAddr;    /* which slot number (PRIVATE) */
106
    __u16               cd_SlotSize;    /* number of slots (PRIVATE) */
107
    void                *cd_Driver;     /* pointer to node of driver */
108
    struct ConfigDev    *cd_NextCD;     /* linked list of drivers to config */
109
    __u32               cd_Unused[4];   /* for whatever the driver wants */
110
} __attribute__ ((packed));
111
 
112
#else /* __ASSEMBLY__ */
113
 
114
LN_Succ         = 0
115
LN_Pred         = LN_Succ+4
116
LN_Type         = LN_Pred+4
117
LN_Pri          = LN_Type+1
118
LN_Name         = LN_Pri+1
119
LN_sizeof       = LN_Name+4
120
 
121
ER_Type         = 0
122
ER_Product      = ER_Type+1
123
ER_Flags        = ER_Product+1
124
ER_Reserved03   = ER_Flags+1
125
ER_Manufacturer = ER_Reserved03+1
126
ER_SerialNumber = ER_Manufacturer+2
127
ER_InitDiagVec  = ER_SerialNumber+4
128
ER_Reserved0c   = ER_InitDiagVec+2
129
ER_Reserved0d   = ER_Reserved0c+1
130
ER_Reserved0e   = ER_Reserved0d+1
131
ER_Reserved0f   = ER_Reserved0e+1
132
ER_sizeof       = ER_Reserved0f+1
133
 
134
CD_Node         = 0
135
CD_Flags        = CD_Node+LN_sizeof
136
CD_Pad          = CD_Flags+1
137
CD_Rom          = CD_Pad+1
138
CD_BoardAddr    = CD_Rom+ER_sizeof
139
CD_BoardSize    = CD_BoardAddr+4
140
CD_SlotAddr     = CD_BoardSize+4
141
CD_SlotSize     = CD_SlotAddr+2
142
CD_Driver       = CD_SlotSize+2
143
CD_NextCD       = CD_Driver+4
144
CD_Unused       = CD_NextCD+4
145
CD_sizeof       = CD_Unused+(4*4)
146
 
147
#endif /* __ASSEMBLY__ */
148
 
149
#ifndef __ASSEMBLY__
150
 
151
#define ZORRO_NUM_AUTO          16
152
 
153
#ifdef __KERNEL__
154
 
155
#include <linux/init.h>
156
#include <linux/ioport.h>
157
 
158
#include <asm/zorro.h>
159
 
160
struct zorro_dev {
161
    struct ExpansionRom rom;
162
    zorro_id id;
163
    u16 slotaddr;
164
    u16 slotsize;
165
    char name[64];
166
    struct resource resource;
167
};
168
 
169
extern unsigned int zorro_num_autocon;  /* # of autoconfig devices found */
170
extern struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
171
 
172
 
173
    /*
174
     *  Zorro Functions
175
     */
176
 
177
extern void zorro_name_device(struct zorro_dev *dev);
178
 
179
extern struct zorro_dev *zorro_find_device(zorro_id id,
180
                                           struct zorro_dev *from);
181
 
182
#define zorro_request_device(z, name) \
183
    request_mem_region((z)->resource.start, \
184
                       (z)->resource.end-(z)->resource.start+1, (name))
185
#define zorro_release_device(z) \
186
    release_mem_region((z)->resource.start, \
187
                       (z)->resource.end-(z)->resource.start+1)
188
 
189
 
190
    /*
191
     *  Bitmask indicating portions of available Zorro II RAM that are unused
192
     *  by the system. Every bit represents a 64K chunk, for a maximum of 8MB
193
     *  (128 chunks, physical 0x00200000-0x009fffff).
194
     *
195
     *  If you want to use (= allocate) portions of this RAM, you should clear
196
     *  the corresponding bits.
197
     */
198
 
199
extern DECLARE_BITMAP(zorro_unused_z2ram, 128);
200
 
201
#define Z2RAM_START             (0x00200000)
202
#define Z2RAM_END               (0x00a00000)
203
#define Z2RAM_SIZE              (0x00800000)
204
#define Z2RAM_CHUNKSIZE         (0x00010000)
205
#define Z2RAM_CHUNKMASK         (0x0000ffff)
206
#define Z2RAM_CHUNKSHIFT        (16)
207
 
208
 
209
#endif /* !__ASSEMBLY__ */
210
#endif /* __KERNEL__ */
211
 
212
#endif /* _LINUX_ZORRO_H */