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, v.1,  (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://opensource.org/licenses/CDDL-1.0.
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 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1,  (the "License").
26 
27 * You may not use this file except in compliance with the License.
28 
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
31 
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
34 */
35 
36 /****************************************************************************
37  *
38  * Name:        nvm_fcoe_cfg.h
39  *
40  * Description: NVM config file for FCoE configurations
41  *
42  * Created:     04/11/2016
43  *
44  * Version:     0.3
45  *
46  ****************************************************************************/
47 
48 #ifndef NVM_FCOE_CFG_H
49 #define NVM_FCOE_CFG_H
50 
51 #define NUM_OF_FCOE_TARGET_PER_PF 8
52 #define NUM_OF_FCOE_PF_SUPPORTED  4   // One PF per Port
53 
54 union nvm_fc_world_wide_address
55 {
56   u8  byte[8];
57   u32 value[2];
58 };
59 
60 union nvm_fc_lun
61 {
62   u8  byte[8];
63   u32 value[2];
64 };
65 
66 
67 
68 struct nvm_fcoe_generic
69 {
70   u32 ctrl_flags;                                                             /* 0x0 */
71   #define NVM_FCOE_CFG_GEN_WORLD_LOGIN                  0x00000001
72   #define NVM_FCOE_CFG_GEN_SELECTIVE_LOGIN              0x00000002
73   #define NVM_FCOE_CFG_GEN_FIP_VLAN_DISCOVERY           0x00000004
74 
75   u32 retry_count;                                                                /* 0x4 */
76   #define NVM_FCOE_CFG_GEN_FABRIC_LOGIN_RETRY_MASK        0x000000FF
77   #define NVM_FCOE_CFG_GEN_FABRIC_LOGIN_RETRY_OFFSET      0
78   #define NVM_FCOE_CFG_GEN_TARGET_LOGIN_RETRY_MASK        0x0000FF00
79   #define NVM_FCOE_CFG_GEN_TARGET_LOGIN_RETRY_OFFSET      8
80 
81   u32 rsvd[30];                                                               /* 0x8 */
82 };
83 
84 struct nvm_fcoe_initiator
85 {
86   u32 fip_vlan;                                                               /* 0x0 */
87   #define NVM_FCOE_CFG_INITIATOR_FIP_DEFAULT_VLAN_MASK        0x00000FFF
88   #define NVM_FCOE_CFG_INITIATOR_FIP_DEFAULT_VLAN_OFFSET      0
89 
90   union nvm_fc_world_wide_address node_name;                                 /* 0x4 */
91   union nvm_fc_world_wide_address port_name;                                 /* 0xC */
92 
93   u32 rsvd[27];                                                               /* 0x14 */
94 };
95 
96 struct nvm_fcoe_target
97 {
98   u32 ctrl_flags;                                                             /* 0x0 */
99   #define NVM_FCOE_CFG_TARGET_ENABLED   0x00000001
100 
101   union nvm_fc_world_wide_address port_name;                                 /* 0x4 */
102   union nvm_fc_lun lun;                                                      /* 0xC */
103 
104   u32 rsvd[27];                                                               /* 0x14 */
105 };
106 
107 struct nvm_fcoe_block
108 {
109   u32 id;                                                                     /* 0x0 */
110   #define NVM_FCOE_CFG_BLK_MAPPED_PF_ID_MASK         0x0000000F
111   #define NVM_FCOE_CFG_BLK_MAPPED_PF_ID_OFFSET       0
112   #define NVM_FCOE_CFG_BLK_CTRL_FLAG_MASK            0x00000FF0
113   #define NVM_FCOE_CFG_BLK_CTRL_FLAG_OFFSET          4
114   #define NVM_FCOE_CFG_BLK_CTRL_FLAG_IS_NOT_EMPTY    (1 << 0)
115   #define NVM_FCOE_CFG_BLK_CTRL_FLAG_PF_MAPPED       (1 << 1)
116 
117   u32 rsvd_1[8];                                                              /* 0x4 */
118 
119   struct nvm_fcoe_generic     generic;                                        /* 0x24 */
120   struct nvm_fcoe_initiator   initiator;                                      /* 0xA4 */
121   struct nvm_fcoe_target      target[NUM_OF_FCOE_TARGET_PER_PF];              /* 0x124 */
122 
123   u32 rsvd[183];                                                              /* 0x524 */
124   /* total size - 0x800 - 2048 bytes - 2K blocks */
125 };
126 
127 struct nvm_fcoe_cfg
128 {
129   u32 id;                                                                     /* 0x0 */
130   #define NVM_FCOE_CFG_BLK_VERSION_MINOR_MASK     0x000000FF
131   #define NVM_FCOE_CFG_BLK_VERSION_MAJOR_MASK     0x0000FF00
132   #define NVM_FCOE_CFG_BLK_SIGNATURE_MASK         0xFFFF0000
133   #define NVM_FCOE_CFG_BLK_SIGNATURE              0x46430000    // FC - FCoE Config
134 
135   #define NVM_FCOE_CFG_BLK_VERSION_MAJOR          0
136   #define NVM_FCOE_CFG_BLK_VERSION_MINOR          6
137   #define NVM_FCOE_CFG_BLK_VERSION                (NVM_FCOE_CFG_BLK_VERSION_MAJOR << 8) | NVM_FCOE_CFG_BLK_VERSION_MINOR;
138 
139   struct nvm_fcoe_block    block[NUM_OF_FCOE_PF_SUPPORTED];                   /* 0x4 */
140 
141 };
142 
143 #endif
144 
145