4 #include <linux/types.h>
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 #define CHAM_HEADER_SIZE 0x200
12 enum chameleon_descriptor_type
{
13 CHAMELEON_DTYPE_GENERAL
= 0x0,
14 CHAMELEON_DTYPE_BRIDGE
= 0x1,
15 CHAMELEON_DTYPE_CPU
= 0x2,
16 CHAMELEON_DTYPE_BAR
= 0x3,
17 CHAMELEON_DTYPE_END
= 0xf,
20 enum chameleon_bus_type
{
21 CHAMELEON_BUS_WISHBONE
,
28 * struct chameleon_fpga_header
30 * @revision: Revison of Chameleon table in FPGA
31 * @model: Chameleon table model ASCII char
32 * @minor: Revision minor
33 * @bus_type: Bus type (usually %CHAMELEON_BUS_WISHBONE)
34 * @magic: Chameleon header magic number (0xabce for version 2)
36 * @filename: Filename of FPGA bitstream
38 struct chameleon_fpga_header
{
45 /* This one has no '\0' at the end!!! */
46 char filename
[CHAMELEON_FILENAME_LEN
];
48 #define HEADER_MAGIC_OFFSET 0x4
51 * struct chameleon_gdd - Chameleon General Device Descriptor
53 * @irq: the position in the FPGA's IRQ controller vector
54 * @rev: the revision of the variant's implementation
55 * @var: the variant of the IP core
56 * @dev: the device the IP core is
57 * @dtype: device descriptor type
58 * @bar: BAR offset that must be added to module offset
59 * @inst: the instance number of the device, 0 is first instance
60 * @group: the group the device belongs to (0 = no group)
62 * @offset: beginning of the address window of desired module
63 * @size: size of the module's address window
65 struct chameleon_gdd
{
73 /* GDD Register 1 fields */
74 #define GDD_IRQ(x) ((x) & 0x1f)
75 #define GDD_REV(x) (((x) >> 5) & 0x3f)
76 #define GDD_VAR(x) (((x) >> 11) & 0x3f)
77 #define GDD_DEV(x) (((x) >> 18) & 0x3ff)
78 #define GDD_DTY(x) (((x) >> 28) & 0xf)
80 /* GDD Register 2 fields */
81 #define GDD_BAR(x) ((x) & 0x7)
82 #define GDD_INS(x) (((x) >> 3) & 0x3f)
83 #define GDD_GRP(x) (((x) >> 9) & 0x3f)
86 * struct chameleon_bdd - Chameleon Bridge Device Descriptor
88 * @irq: the position in the FPGA's IRQ controller vector
89 * @rev: the revision of the variant's implementation
90 * @var: the variant of the IP core
91 * @dev: the device the IP core is
92 * @dtype: device descriptor type
93 * @bar: BAR offset that must be added to module offset
94 * @inst: the instance number of the device, 0 is first instance
95 * @dbar: destination bar from the bus _behind_ the bridge
96 * @chamoff: offset within the BAR of the source bus
100 struct chameleon_bdd
{
105 unsigned int dtype
:4;
109 unsigned int group
:6;
110 unsigned int reserved
:14;
116 int chameleon_parse_cells(struct mcb_bus
*bus
, phys_addr_t mapbase
,