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