1#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
10 * contains the location of the header.
11 *
12 * 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
18 *
19 * The source will have a definition like:
20 *
21 * 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: myri10ge_mcp_gen_header.h,v 1.1.1.1 2007/08/03 18:52:48 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;
39	__be32 mcp_type;
40	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.
49	 *
50	 * 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.
53	 *
54	 * Never remove any field.  Keep everything naturally align.
55	 */
56};
57
58#endif				/* __MYRI10GE_MCP_GEN_HEADER_H__ */
59