1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *  linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions
4  *
5  *  Copyright (C) 1995--2003 Geert Uytterhoeven
6  *
7  *  This file is subject to the terms and conditions of the GNU General Public
8  *  License.  See the file COPYING in the main directory of this archive
9  *  for more details.
10  */
11 
12 #ifndef _UAPI_LINUX_ZORRO_H
13 #define _UAPI_LINUX_ZORRO_H
14 
15 #include <linux/types.h>
16 
17 
18     /*
19      *  Each Zorro board has a 32-bit ID of the form
20      *
21      *      mmmmmmmmmmmmmmmmppppppppeeeeeeee
22      *
23      *  with
24      *
25      *      mmmmmmmmmmmmmmmm	16-bit Manufacturer ID (assigned by CBM (sigh))
26      *      pppppppp		8-bit Product ID (assigned by manufacturer)
27      *      eeeeeeee		8-bit Extended Product ID (currently only used
28      *				for some GVP boards)
29      */
30 
31 
32 #define ZORRO_MANUF(id)		((id) >> 16)
33 #define ZORRO_PROD(id)		(((id) >> 8) & 0xff)
34 #define ZORRO_EPC(id)		((id) & 0xff)
35 
36 #define ZORRO_ID(manuf, prod, epc) \
37 	((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc))
38 
39 typedef __u32 zorro_id;
40 
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 	__be32 ln_Succ;		/* Pointer to next (successor) */
68 	__be32 ln_Pred;		/* Pointer to previous (predecessor) */
69 	__u8   ln_Type;
70 	__s8   ln_Pri;		/* Priority, for sorting */
71 	__be32 ln_Name;		/* ID string, null terminated */
72 } __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 	__be16 er_Manufacturer;	/* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */
81 	__be32 er_SerialNumber;	/* Available for use by manufacturer */
82 	__be16 er_InitDiagVec;	/* Offset to optional "DiagArea" structure */
83 	__u8   er_Reserved0c;
84 	__u8   er_Reserved0d;
85 	__u8   er_Reserved0e;
86 	__u8   er_Reserved0f;
87 } __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 	__be32		cd_BoardAddr;	/* where in memory the board was placed */
104 	__be32		cd_BoardSize;	/* size of board in bytes */
105 	__be16		cd_SlotAddr;	/* which slot number (PRIVATE) */
106 	__be16		cd_SlotSize;	/* number of slots (PRIVATE) */
107 	__be32		cd_Driver;	/* pointer to node of driver */
108 	__be32		cd_NextCD;	/* linked list of drivers to config */
109 	__be32		cd_Unused[4];	/* for whatever the driver wants */
110 } __packed;
111 
112 #define ZORRO_NUM_AUTO		16
113 
114 #endif /* _UAPI_LINUX_ZORRO_H */
115