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  * Copyright 2014 QLogic Corporation
22  * The contents of this file are subject to the terms of the
23  * QLogic End User License (the "License").
24  * You may not use this file except in compliance with the License.
25  *
26  * You can obtain a copy of the License at
27  * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/
28  * QLogic_End_User_Software_License.txt
29  * See the License for the specific language governing permissions
30  * and limitations under the License.
31  *
32  *
33  * Name:        license.h
34  *
35  * Description: Definition of license key.
36  *
37  * Created:     07/21/2004 skeung
38  *
39  ****************************************************************************/
40 
41 #ifndef _LICENSE_H
42 #define _LICENSE_H
43 
44 #include "bcmtype.h"
45 
46 #if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
47     #error "Missing either LITTLE_ENDIAN or BIG_ENDIAN definition."
48 #endif
49 
50 
51 #define HASH_VALUE_SIZE                          12
52 /*
53  * license_key_b definition
54  */
55 
56 typedef struct _license_key_b
57 {
58     u8_t digest[HASH_VALUE_SIZE];
59         /* KEY_VALID_PATTERN is used when no actual digest is needed */
60         #define KEY_VALID_PATTERN_BYTE           0x5a
61         #define KEY_VALID_PATTERN_DWORD          0x5a5a5a5a
62 
63     u8_t key_type;
64         #define KEY_TYPE_ENUM_BCM5706            0x0
65         #define KEY_TYPE_ENUM_BCM5710            0x2 /* Special modification for Everest */
66     u8_t version;
67         #define VERSION_CURRENT                  0x0
68     u8_t dword_length;                           /* Not including the digest */
69     u8_t oem_id;
70         #define OEM_ID_BRCM                      0
71         #define OEM_ID_HPQ                       0x3c
72 
73     u16_t capability;
74         #define CAP_RESERVED                     0x0001 /* Xinan/Teton Only */
75         #define CAP_USER_RDMA                    0x0002 /* Xinan/Teton Only */
76         #define CAP_TOE                          0x0004 /* Xinan/Teton Only */
77         #define CAP_ISCSI_INIT                   0x0008 /* Xinan/Teton Only */
78         #define CAP_ISCSI_TRGT                   0x0010 /* Xinan/Teton Only */
79         #define CAP_ISER_INIT                    0x0020 /* Xinan/Teton Only */
80         #define CAP_ISER_TRGT                    0x0040 /* Xinan/Teton Only */
81         #define CAP_ISCSI_BOOT                   0x0080 /* Xinan/Teton Only, not used */
82         #define CAP_ISCSI_FULL_ACCL              0x0100 /* Xinan/Teton Only, not used */
83         #define CAP_ISCSI_HDR_DGST               0x0200 /* Xinan/Teton Only, not used */
84         #define CAP_ISCSI_BODY_DGST              0x0400 /* Xinan/Teton Only, not used */
85         #define CAP_SERDES_2_5G                  0x0800 /* Xinan/Teton Only */
86         #define CAP_EVRST_RSVD                   0x0800 /* Everest Only */
87         #define CAP_FCOE_INIT                    0x1000 /* E2 and onward Only */
88         #define CAP_FCOE_TRGT                    0x2000 /* E2 and onward Only */
89     u16_t max_toe_conn;
90         #define CONN_UNLIMITED                   0xffff
91 
92     u16_t reserved;
93     u16_t max_um_rdma_conn;
94 
95     u16_t max_iscsi_init_conn;
96     u16_t max_iscsi_trgt_conn;
97 
98     u16_t max_iser_init_conn;
99     u16_t max_iser_trgt_conn;
100 
101     u16_t max_fcoe_init_conn;
102     u16_t max_fcoe_trgt_conn;
103 
104     u32_t reserved_a[2];
105 
106     u32_t sn;
107 
108     u16_t reserved_b;
109     u16_t expiration;
110         #define EXPIRATION_NEVER                 0xffff
111 
112 } license_key_b_t;
113 
114 /*
115  * license_key_l definition
116  */
117 
118 typedef struct _license_key_l
119 {
120     u8_t digest[HASH_VALUE_SIZE];
121         /* KEY_VALID_PATTERN is used when no actual digest is needed */
122         #define KEY_VALID_PATTERN_BYTE           0x5a
123         #define KEY_VALID_PATTERN_DWORD          0x5a5a5a5a
124 
125     u8_t oem_id;
126         #define OEM_ID_BRCM                      0
127         #define OEM_ID_HPQ                       0x3c
128     u8_t dword_length;                           /* Not including the digest */
129     u8_t version;
130         #define VERSION_CURRENT                  0x0
131     u8_t key_type;
132         #define KEY_TYPE_ENUM_BCM5706            0x0
133         #define KEY_TYPE_ENUM_BCM5710            0x2 /* Special modification for Everest */
134 
135     u16_t max_toe_conn;
136         #define CONN_UNLIMITED                   0xffff
137     u16_t capability;
138         #define CAP_RESERVED                     0x0001 /* Xinan/Teton Only */
139         #define CAP_USER_RDMA                    0x0002 /* Xinan/Teton Only */
140         #define CAP_TOE                          0x0004 /* Xinan/Teton Only */
141         #define CAP_ISCSI_INIT                   0x0008 /* Xinan/Teton Only */
142         #define CAP_ISCSI_TRGT                   0x0010 /* Xinan/Teton Only */
143         #define CAP_ISER_INIT                    0x0020 /* Xinan/Teton Only */
144         #define CAP_ISER_TRGT                    0x0040 /* Xinan/Teton Only */
145         #define CAP_ISCSI_BOOT                   0x0080 /* Xinan/Teton Only, not used */
146         #define CAP_ISCSI_FULL_ACCL              0x0100 /* Xinan/Teton Only, not used */
147         #define CAP_ISCSI_HDR_DGST               0x0200 /* Xinan/Teton Only, not used */
148         #define CAP_ISCSI_BODY_DGST              0x0400 /* Xinan/Teton Only, not used */
149         #define CAP_SERDES_2_5G                  0x0800 /* Xinan/Teton Only */
150         #define CAP_EVRST_RSVD                   0x0800 /* Everest Only */
151         #define CAP_FCOE_INIT                    0x1000 /* E2 and onward Only */
152         #define CAP_FCOE_TRGT                    0x2000 /* E2 and onward Only */
153 
154     u16_t max_um_rdma_conn;
155     u16_t reserved;
156 
157     u16_t max_iscsi_trgt_conn;
158     u16_t max_iscsi_init_conn;
159 
160     u16_t max_iser_trgt_conn;
161     u16_t max_iser_init_conn;
162 
163     u16_t max_fcoe_trgt_conn;
164     u16_t max_fcoe_init_conn;
165 
166     u32_t reserved_a[2];
167 
168     u32_t sn;
169 
170     u16_t expiration;
171         #define EXPIRATION_NEVER                 0xffff
172     u16_t reserved_b;
173 
174 } license_key_l_t;
175 
176 
177 #define FW_ENCODE_32BIT_PATTERN                  0x1e1e1e1e
178 #define FW_ENCODE_16BIT_PATTERN                  0x1e1e
179 #define FW_ENCODE_8BIT_PATTERN                   0x1e
180 
181 
182 #if defined(BIG_ENDIAN)
183     typedef license_key_b_t license_key_t;
184 #elif defined(LITTLE_ENDIAN)
185     typedef license_key_l_t license_key_t;
186 #endif
187 
188 #endif /* _LICENSE_H */
189