1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2007-2009 Myricom, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef _mcp_gen_header_h
28#define _mcp_gen_header_h
29
30/**
31   @file
32   This file define a standard header used as a first entry point to
33   exchange information between firmware/driver and driver.
34
35   The header structure can be anywhere in the mcp. It will usually be in
36   the .data section, because some fields needs to be initialized at
37   compile time.
38
39   The 32bit word at offset MX_HEADER_PTR_OFFSET in the mcp must
40   contains the location of the header.
41
42   Typically a MCP will start with the following:
43   @code
44   .text
45     .space 52    ! to help catch MEMORY_INT errors
46     bt start     ! jump to real code
47     nop
48     .long _gen_mcp_header
49    @endcode
50
51   The source will have a definition like:
52   @code
53   mcp_gen_header_t gen_mcp_header = {
54      .header_length = sizeof(mcp_gen_header_t),
55      .mcp_type = MCP_TYPE_XXX,
56      .version = "something $Id: mcp_gen_header.h,v 1.9 2009-02-27 16:29:36 loic Exp $",
57      .mcp_globals = (unsigned)&Globals
58   };
59   @endcode
60   In most case using the convenience MCP_GEN_HEADER_DECL() macro is simpler than
61   doing a full manual declaration.
62
63*/
64
65
66#define MCP_HEADER_PTR_OFFSET  0x3c
67
68#define MCP_TYPE_MX 0x4d582020 /* "MX  " */
69#define MCP_TYPE_PCIE 0x70636965 /* "PCIE" pcie-only MCP */
70#define MCP_TYPE_ETH 0x45544820 /* "ETH " */
71#define MCP_TYPE_MCP0 0x4d435030 /* "MCP0" */
72#define MCP_TYPE_DFLT 0x20202020 /* "    " */
73#define MCP_TYPE_ETHZ 0x4554485a /* "ETHZ" */
74
75struct mcp_gen_header {
76  /* the first 4 fields are filled at compile time */
77  unsigned header_length;
78  unsigned mcp_type;
79  char version[128];
80  unsigned mcp_private; /* pointer to mcp-type specific structure */
81
82  /* filled by the MCP at run-time */
83  unsigned sram_size;
84  unsigned string_specs;  /* either the original STRING_SPECS or a superset */
85  unsigned string_specs_len;
86
87  /* Fields above this comment are guaranteed to be present.
88
89     Fields below this comment are extensions added in later versions
90     of this struct, drivers should compare the header_length against
91     offsetof(field) to check wether a given MCP implements them.
92
93     Never remove any field.  Keep everything naturally align.
94  */
95
96  /* Specifies if the running mcp is mcp0, 1, or 2. */
97  unsigned char mcp_index;
98  unsigned char disable_rabbit;
99  unsigned char unaligned_tlp;
100  unsigned char pcie_link_algo;
101  unsigned counters_addr;
102  unsigned copy_block_info; /* for small mcps loaded with "lload -d" */
103  unsigned short handoff_id_major; /* must be equal */
104  unsigned short handoff_id_caps; /* bitfield: new mcp must have superset */
105  unsigned msix_table_addr; /* start address of msix table in firmware */
106  unsigned bss_addr; /* start of bss */
107  unsigned features;
108  unsigned ee_hdr_addr;
109  /* 8 */
110};
111typedef struct mcp_gen_header mcp_gen_header_t;
112
113struct zmcp_info {
114  unsigned info_len;
115  unsigned zmcp_addr;
116  unsigned zmcp_len;
117  unsigned mcp_edata;
118};
119
120
121#endif /* _mcp_gen_header_h */
122