linux/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h
<<
>>
Prefs
   1/*
   2 * Linux network driver for Brocade Converged Network Adapter.
   3 *
   4 * This program is free software; you can redistribute it and/or modify it
   5 * under the terms of the GNU General Public License (GPL) Version 2 as
   6 * published by the Free Software Foundation
   7 *
   8 * This program is distributed in the hope that it will be useful, but
   9 * WITHOUT ANY WARRANTY; without even the implied warranty of
  10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11 * General Public License for more details.
  12 */
  13/*
  14 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  15 * All rights reserved
  16 * www.brocade.com
  17 */
  18#ifndef __BFA_DEFS_MFG_COMM_H__
  19#define __BFA_DEFS_MFG_COMM_H__
  20
  21#include "bfa_defs.h"
  22
  23/* Manufacturing block version */
  24#define BFA_MFG_VERSION                         3
  25#define BFA_MFG_VERSION_UNINIT                  0xFF
  26
  27/* Manufacturing block encrypted version */
  28#define BFA_MFG_ENC_VER                         2
  29
  30/* Manufacturing block version 1 length */
  31#define BFA_MFG_VER1_LEN                        128
  32
  33/* Manufacturing block header length */
  34#define BFA_MFG_HDR_LEN                         4
  35
  36#define BFA_MFG_SERIALNUM_SIZE                  11
  37#define STRSZ(_n)                               (((_n) + 4) & ~3)
  38
  39/* Manufacturing card type */
  40enum {
  41        BFA_MFG_TYPE_CB_MAX  = 825,      /*!< Crossbow card type max    */
  42        BFA_MFG_TYPE_FC8P2   = 825,      /*!< 8G 2port FC card          */
  43        BFA_MFG_TYPE_FC8P1   = 815,      /*!< 8G 1port FC card          */
  44        BFA_MFG_TYPE_FC4P2   = 425,      /*!< 4G 2port FC card          */
  45        BFA_MFG_TYPE_FC4P1   = 415,      /*!< 4G 1port FC card          */
  46        BFA_MFG_TYPE_CNA10P2 = 1020,     /*!< 10G 2port CNA card        */
  47        BFA_MFG_TYPE_CNA10P1 = 1010,     /*!< 10G 1port CNA card        */
  48        BFA_MFG_TYPE_JAYHAWK = 804,      /*!< Jayhawk mezz card         */
  49        BFA_MFG_TYPE_WANCHESE = 1007,    /*!< Wanchese mezz card        */
  50        BFA_MFG_TYPE_ASTRA    = 807,     /*!< Astra mezz card           */
  51        BFA_MFG_TYPE_LIGHTNING_P0 = 902, /*!< Lightning mezz card - old */
  52        BFA_MFG_TYPE_LIGHTNING = 1741,   /*!< Lightning mezz card       */
  53        BFA_MFG_TYPE_PROWLER_F = 1560,   /*!< Prowler FC only cards     */
  54        BFA_MFG_TYPE_PROWLER_N = 1410,   /*!< Prowler NIC only cards    */
  55        BFA_MFG_TYPE_PROWLER_C = 1710,   /*!< Prowler CNA only cards    */
  56        BFA_MFG_TYPE_PROWLER_D = 1860,   /*!< Prowler Dual cards        */
  57        BFA_MFG_TYPE_CHINOOK   = 1867,   /*!< Chinook cards             */
  58        BFA_MFG_TYPE_INVALID = 0,        /*!< Invalid card type         */
  59};
  60
  61#pragma pack(1)
  62
  63/* Check if Mezz card */
  64#define bfa_mfg_is_mezz(type) (( \
  65        (type) == BFA_MFG_TYPE_JAYHAWK || \
  66        (type) == BFA_MFG_TYPE_WANCHESE || \
  67        (type) == BFA_MFG_TYPE_ASTRA || \
  68        (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \
  69        (type) == BFA_MFG_TYPE_LIGHTNING || \
  70        (type) == BFA_MFG_TYPE_CHINOOK))
  71
  72enum {
  73        CB_GPIO_TTV     = (1),          /*!< TTV debug capable cards    */
  74        CB_GPIO_FC8P2   = (2),          /*!< 8G 2port FC card           */
  75        CB_GPIO_FC8P1   = (3),          /*!< 8G 1port FC card           */
  76        CB_GPIO_FC4P2   = (4),          /*!< 4G 2port FC card           */
  77        CB_GPIO_FC4P1   = (5),          /*!< 4G 1port FC card           */
  78        CB_GPIO_DFLY    = (6),          /*!< 8G 2port FC mezzanine card */
  79        CB_GPIO_PROTO   = (1 << 7)      /*!< 8G 2port FC prototypes     */
  80};
  81
  82#define bfa_mfg_adapter_prop_init_gpio(gpio, card_type, prop)   \
  83do {                                                            \
  84        if ((gpio) & CB_GPIO_PROTO) {                           \
  85                (prop) |= BFI_ADAPTER_PROTO;                    \
  86                (gpio) &= ~CB_GPIO_PROTO;                       \
  87        }                                                       \
  88        switch ((gpio)) {                                       \
  89        case CB_GPIO_TTV:                                       \
  90                (prop) |= BFI_ADAPTER_TTV;                      \
  91        case CB_GPIO_DFLY:                                      \
  92        case CB_GPIO_FC8P2:                                     \
  93                (prop) |= BFI_ADAPTER_SETP(NPORTS, 2);          \
  94                (prop) |= BFI_ADAPTER_SETP(SPEED, 8);           \
  95                (card_type) = BFA_MFG_TYPE_FC8P2;               \
  96                break;                                          \
  97        case CB_GPIO_FC8P1:                                     \
  98                (prop) |= BFI_ADAPTER_SETP(NPORTS, 1);          \
  99                (prop) |= BFI_ADAPTER_SETP(SPEED, 8);           \
 100                (card_type) = BFA_MFG_TYPE_FC8P1;               \
 101                break;                                          \
 102        case CB_GPIO_FC4P2:                                     \
 103                (prop) |= BFI_ADAPTER_SETP(NPORTS, 2);          \
 104                (prop) |= BFI_ADAPTER_SETP(SPEED, 4);           \
 105                (card_type) = BFA_MFG_TYPE_FC4P2;               \
 106                break;                                          \
 107        case CB_GPIO_FC4P1:                                     \
 108                (prop) |= BFI_ADAPTER_SETP(NPORTS, 1);          \
 109                (prop) |= BFI_ADAPTER_SETP(SPEED, 4);           \
 110                (card_type) = BFA_MFG_TYPE_FC4P1;               \
 111                break;                                          \
 112        default:                                                \
 113                (prop) |= BFI_ADAPTER_UNSUPP;                   \
 114                (card_type) = BFA_MFG_TYPE_INVALID;             \
 115        }                                                       \
 116} while (0)
 117
 118/* VPD data length */
 119#define BFA_MFG_VPD_LEN                 512
 120#define BFA_MFG_VPD_LEN_INVALID         0
 121
 122#define BFA_MFG_VPD_PCI_HDR_OFF         137
 123#define BFA_MFG_VPD_PCI_VER_MASK        0x07    /*!< version mask 3 bits */
 124#define BFA_MFG_VPD_PCI_VDR_MASK        0xf8    /*!< vendor mask 5 bits */
 125
 126/* VPD vendor tag */
 127enum {
 128        BFA_MFG_VPD_UNKNOWN     = 0,     /*!< vendor unknown            */
 129        BFA_MFG_VPD_IBM         = 1,     /*!< vendor IBM                */
 130        BFA_MFG_VPD_HP          = 2,     /*!< vendor HP                 */
 131        BFA_MFG_VPD_DELL        = 3,     /*!< vendor DELL               */
 132        BFA_MFG_VPD_PCI_IBM     = 0x08,  /*!< PCI VPD IBM               */
 133        BFA_MFG_VPD_PCI_HP      = 0x10,  /*!< PCI VPD HP                */
 134        BFA_MFG_VPD_PCI_DELL    = 0x20,  /*!< PCI VPD DELL              */
 135        BFA_MFG_VPD_PCI_BRCD    = 0xf8,  /*!< PCI VPD Brocade           */
 136};
 137
 138/* BFA adapter flash vpd data definition.
 139 *
 140 * All numerical fields are in big-endian format.
 141 */
 142struct bfa_mfg_vpd {
 143        u8              version;        /*!< vpd data version */
 144        u8              vpd_sig[3];     /*!< characters 'V', 'P', 'D' */
 145        u8              chksum;         /*!< u8 checksum */
 146        u8              vendor;         /*!< vendor */
 147        u8      len;            /*!< vpd data length excluding header */
 148        u8      rsv;
 149        u8              data[BFA_MFG_VPD_LEN];  /*!< vpd data */
 150};
 151
 152#pragma pack()
 153
 154#endif /* __BFA_DEFS_MFG_H__ */
 155