Brice Goglin | 0da34b6 | 2006-05-23 06:10:15 -0400 | [diff] [blame] | 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 |
Jeff Garzik | 6ed1425 | 2006-05-24 00:28:37 -0400 | [diff] [blame] | 10 | * contains the location of the header. |
| 11 | * |
Brice Goglin | 0da34b6 | 2006-05-23 06:10:15 -0400 | [diff] [blame] | 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 |
Jeff Garzik | 6ed1425 | 2006-05-24 00:28:37 -0400 | [diff] [blame] | 18 | * |
Brice Goglin | 0da34b6 | 2006-05-23 06:10:15 -0400 | [diff] [blame] | 19 | * The source will have a definition like: |
Jeff Garzik | 6ed1425 | 2006-05-24 00:28:37 -0400 | [diff] [blame] | 20 | * |
Brice Goglin | 0da34b6 | 2006-05-23 06:10:15 -0400 | [diff] [blame] | 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: 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 | |
| 36 | struct mcp_gen_header { |
| 37 | /* the first 4 fields are filled at compile time */ |
| 38 | unsigned header_length; |
Al Viro | 40f6cff | 2006-11-20 13:48:32 -0500 | [diff] [blame] | 39 | __be32 mcp_type; |
Brice Goglin | 0da34b6 | 2006-05-23 06:10:15 -0400 | [diff] [blame] | 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. |
Jeff Garzik | 6ed1425 | 2006-05-24 00:28:37 -0400 | [diff] [blame] | 49 | * |
Brice Goglin | 0da34b6 | 2006-05-23 06:10:15 -0400 | [diff] [blame] | 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. |
Jeff Garzik | 6ed1425 | 2006-05-24 00:28:37 -0400 | [diff] [blame] | 53 | * |
Brice Goglin | 0da34b6 | 2006-05-23 06:10:15 -0400 | [diff] [blame] | 54 | * Never remove any field. Keep everything naturally align. |
| 55 | */ |
| 56 | }; |
| 57 | |
| 58 | #endif /* __MYRI10GE_MCP_GEN_HEADER_H__ */ |