1#ifndef __MCB_INTERNAL
2#define __MCB_INTERNAL
3
4#include <linux/types.h>
5
6#define PCI_VENDOR_ID_MEN 0x1a88
7#define PCI_DEVICE_ID_MEN_CHAMELEON 0x4d45
8#define CHAMELEON_FILENAME_LEN 12
9#define CHAMELEONV2_MAGIC 0xabce
10
11enum chameleon_descriptor_type {
12 CHAMELEON_DTYPE_GENERAL = 0x0,
13 CHAMELEON_DTYPE_BRIDGE = 0x1,
14 CHAMELEON_DTYPE_CPU = 0x2,
15 CHAMELEON_DTYPE_BAR = 0x3,
16 CHAMELEON_DTYPE_END = 0xf,
17};
18
19enum chameleon_bus_type {
20 CHAMELEON_BUS_WISHBONE,
21 CHAMELEON_BUS_AVALON,
22 CHAMELEON_BUS_LPC,
23 CHAMELEON_BUS_ISA,
24};
25
26
27
28
29
30
31
32
33
34
35
36
37struct chameleon_fpga_header {
38 u8 revision;
39 char model;
40 u8 minor;
41 u8 bus_type;
42 u16 magic;
43 u16 reserved;
44
45 char filename[CHAMELEON_FILENAME_LEN];
46} __packed;
47#define HEADER_MAGIC_OFFSET 0x4
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64struct chameleon_gdd {
65 __le32 reg1;
66 __le32 reg2;
67 __le32 offset;
68 __le32 size;
69
70} __packed;
71
72
73#define GDD_IRQ(x) ((x) & 0x1f)
74#define GDD_REV(x) (((x) >> 5) & 0x3f)
75#define GDD_VAR(x) (((x) >> 11) & 0x3f)
76#define GDD_DEV(x) (((x) >> 18) & 0x3ff)
77#define GDD_DTY(x) (((x) >> 28) & 0xf)
78
79
80#define GDD_BAR(x) ((x) & 0x7)
81#define GDD_INS(x) (((x) >> 3) & 0x3f)
82#define GDD_GRP(x) (((x) >> 9) & 0x3f)
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99struct chameleon_bdd {
100 unsigned int irq:6;
101 unsigned int rev:6;
102 unsigned int var:6;
103 unsigned int dev:10;
104 unsigned int dtype:4;
105 unsigned int bar:3;
106 unsigned int inst:6;
107 unsigned int dbar:3;
108 unsigned int group:6;
109 unsigned int reserved:14;
110 u32 chamoff;
111 u32 offset;
112 u32 size;
113} __packed;
114
115int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
116 void __iomem *base);
117
118#endif
119