/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* All rights reserved
* www.brocade.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef __BFA_DEFS_H__
#define __BFA_DEFS_H__
#include "bfa_fc.h"
#include "bfad_drv.h"
#define BFA_MFG_SERIALNUM_SIZE 11
#define STRSZ(_n) (((_n) + 4) & ~3)
/*
* Manufacturing card type
*/
enum {
BFA_MFG_TYPE_CB_MAX = 825, /* Crossbow card type max */
BFA_MFG_TYPE_FC8P2 = 825, /* 8G 2port FC card */
BFA_MFG_TYPE_FC8P1 = 815, /* 8G 1port FC card */
BFA_MFG_TYPE_FC4P2 = 425, /* 4G 2port FC card */
BFA_MFG_TYPE_FC4P1 = 415, /* 4G 1port FC card */
BFA_MFG_TYPE_CNA10P2 = 1020, /* 10G 2port CNA card */
BFA_MFG_TYPE_CNA10P1 = 1010, /* 10G 1port CNA card */
BFA_MFG_TYPE_JAYHAWK = 804, /* Jayhawk mezz card */
BFA_MFG_TYPE_WANCHESE = 1007, /* Wanchese mezz card */
BFA_MFG_TYPE_ASTRA = 807, /* Astra mezz card */
BFA_MFG_TYPE_LIGHTNING_P0 = 902, /* Lightning mezz card - old */
BFA_MFG_TYPE_LIGHTNING = 1741, /* Lightning mezz card */
BFA_MFG_TYPE_PROWLER_F = 1560, /* Prowler FC only cards */
BFA_MFG_TYPE_PROWLER_N = 1410, /* Prowler NIC only cards */
BFA_MFG_TYPE_PROWLER_C = 1710, /* Prowler CNA only cards */
BFA_MFG_TYPE_PROWLER_D = 1860, /* Prowler Dual cards */
BFA_MFG_TYPE_CHINOOK = 1867, /* Chinook cards */
BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */
};
#pragma pack(1)
/*
* Check if Mezz card
*/
#define bfa_mfg_is_mezz(type) (( \
(type) == BFA_MFG_TYPE_JAYHAWK || \
(type) == BFA_MFG_TYPE_WANCHESE || \
(type) == BFA_MFG_TYPE_ASTRA || \
(type) == BFA_MFG_TYPE_LIGHTNING_P0 || \
(type) == BFA_MFG_TYPE_LIGHTNING || \
(type) == BFA_MFG_TYPE_CHINOOK))
/*
* Check if the card having old wwn/mac handling
*/
#define bfa_mfg_is_old_wwn_mac_model(type) (( \
(type) == BFA_MFG_TYPE_FC8P2 || \
(type) == BFA_MFG_TYPE_FC8P1 || \
(type) == BFA_MFG_TYPE_FC4P2 || \
(type) == BFA_MFG_TYPE_FC4P1 || \
(type) == BFA_MFG_TYPE_CNA10P2 || \
(type) == BFA_MFG_TYPE_CNA10P1 || \
(type) == BFA_MFG_TYPE_JAYHAWK || \
(type) == BFA_MFG_TYPE_WANCHESE))
#define bfa_mfg_increment_wwn_mac(m, i) \
do { \
u32 t = ((u32)(m)[0] << 16) | ((u32)(m)[1] << 8) | \
(u32)(m)[2]; \
t += (i); \
(m)[0] = (t >> 16) & 0xFF; \
(m)[1] = (t >> 8) & 0xFF; \
(m)[2] = t & 0xFF; \
} while (0)
/*
* VPD data length
*/
#define BFA_MFG_VPD_LEN 512
/*
* VPD vendor tag
*/
enum {
BFA_MFG_VPD_UNKNOWN = 0, /* vendor unknown */
BFA_MFG_VPD_IBM = 1, /* vendor IBM */
BFA_MFG_VPD_HP = 2, /* vendor HP */
BFA_MFG_VPD_DELL = 3, /* vendor DELL */
BFA_MFG_VPD_PCI_IBM = 0x08, /* PCI VPD IBM */
BFA_MFG_VPD_PCI_HP = 0x10, /* PCI VPD HP */
BFA_MFG_VPD_PCI_DELL = 0x20, /* PCI VPD DELL */
BFA_MFG_VPD_PCI_BRCD = 0xf8, /* PCI VPD Brocade */
};
/*
* All numerical fields are in big-endian format.
*/
struct bfa_mfg_vpd_s {
u8 version; /* vpd data version */
u8 vpd_sig[3]; /* characters 'V', 'P', 'D' */
u8 chksum; /* u8 checksum */
u8 vendor; /* vendor */
u8 len; /* vpd data length excluding header */
u8 rsv;
u8 data[BFA_MFG_VPD_LEN]; /* vpd data */
};
#pragma pack()
/*
* Status return values
*/
enum bfa_status {
BFA_STATUS_OK = 0, /* Success */
BFA_STATUS_FAILED = 1, /* Operation failed */
BFA_STATUS_EINVAL = 2, /* Invalid params Check input
* parameters */
BFA_STATUS_ENOMEM = 3, /* Out of resources */
BFA_STATUS_ETIMER = 5, /* Timer expired - Retry, if persists,
* contact support */
BFA_STATUS_EPROTOCOL = 6, /* Protocol error */
BFA_STATUS_SFP_UNSUPP = 10, /* Unsupported SFP - Replace SFP */
BFA_STATUS_UNKNOWN_VFID = 11, /* VF_ID not found */
BFA_STATUS_DATACORRUPTED = 12, /* Diag returned data corrupted */
BFA_STATUS_DEVBUSY = 13, /* Device busy - Retry operation */
BFA_STATUS_HDMA_FAILED = 16, /* Host dma failed contact support */
BFA_STATUS_FLASH_BAD_LEN = 17, /* Flash bad length */
BFA_STATUS_UNKNOWN_LWWN = 18, /* LPORT PWWN not found */
BFA_STATUS_UNKNOWN_RWWN = 19, /* RPORT PWWN not found */
BFA_STATUS_VPORT_EXISTS = 21, /* VPORT already exists */
BFA_STATUS_VPORT_MAX =