blob: 16a810dd6d515d4ed7a6f61ceb7b443131c34b9e [file] [log] [blame]
Brice Goglin0da34b62006-05-23 06:10:15 -04001#ifndef __MYRI10GE_MCP_GEN_HEADER_H__
2#define __MYRI10GE_MCP_GEN_HEADER_H__
3
4/* this file define a standard header used as a first entry point to
5 * exchange information between firmware/driver and driver. The
6 * header structure can be anywhere in the mcp. It will usually be in
7 * the .data section, because some fields needs to be initialized at
8 * compile time.
9 * The 32bit word at offset MX_HEADER_PTR_OFFSET in the mcp must
Jeff Garzik6ed14252006-05-24 00:28:37 -040010 * contains the location of the header.
11 *
Brice Goglin0da34b62006-05-23 06:10:15 -040012 * Typically a MCP will start with the following:
13 * .text
14 * .space 52 ! to help catch MEMORY_INT errors
15 * bt start ! jump to real code
16 * nop
17 * .long _gen_mcp_header
Jeff Garzik6ed14252006-05-24 00:28:37 -040018 *
Brice Goglin0da34b62006-05-23 06:10:15 -040019 * The source will have a definition like:
Jeff Garzik6ed14252006-05-24 00:28:37 -040020 *
Brice Goglin0da34b62006-05-23 06:10:15 -040021 * mcp_gen_header_t gen_mcp_header = {
22 * .header_length = sizeof(mcp_gen_header_t),
23 * .mcp_type = MCP_TYPE_XXX,
24 * .version = "something $Id: mcp_gen_header.h,v 1.2 2006/05/13 10:04:35 bgoglin Exp $",
25 * .mcp_globals = (unsigned)&Globals
26 * };
27 */
28
29#define MCP_HEADER_PTR_OFFSET 0x3c
30
31#define MCP_TYPE_MX 0x4d582020 /* "MX " */
32#define MCP_TYPE_PCIE 0x70636965 /* "PCIE" pcie-only MCP */
33#define MCP_TYPE_ETH 0x45544820 /* "ETH " */
34#define MCP_TYPE_MCP0 0x4d435030 /* "MCP0" */
35
36struct mcp_gen_header {
37 /* the first 4 fields are filled at compile time */
38 unsigned header_length;
Al Viro40f6cff2006-11-20 13:48:32 -050039 __be32 mcp_type;
Brice Goglin0da34b62006-05-23 06:10:15 -040040 char version[128];
41 unsigned mcp_globals; /* pointer to mcp-type specific structure */
42
43 /* filled by the MCP at run-time */
44 unsigned sram_size;
45 unsigned string_specs; /* either the original STRING_SPECS or a superset */
46 unsigned string_specs_len;
47
48 /* Fields above this comment are guaranteed to be present.
Jeff Garzik6ed14252006-05-24 00:28:37 -040049 *
Brice Goglin0da34b62006-05-23 06:10:15 -040050 * Fields below this comment are extensions added in later versions
51 * of this struct, drivers should compare the header_length against
52 * offsetof(field) to check wether a given MCP implements them.
Jeff Garzik6ed14252006-05-24 00:28:37 -040053 *
Brice Goglin0da34b62006-05-23 06:10:15 -040054 * Never remove any field. Keep everything naturally align.
55 */
56};
57
58#endif /* __MYRI10GE_MCP_GEN_HEADER_H__ */