1/*
2 * Copyright 2014-2017 Cavium, Inc.
3 * The contents of this file are subject to the terms of the Common Development
4 * and Distribution License, v.1,  (the "License").
5 *
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the License at available
9 * at http://opensource.org/licenses/CDDL-1.0
10 *
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14
15#ifndef _LICENSE_H
16#define _LICENSE_H
17
18#include "bcmtype.h"
19
20#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
21    #error "Missing either LITTLE_ENDIAN or BIG_ENDIAN definition."
22#endif
23
24
25#define HASH_VALUE_SIZE                          12
26/*
27 * license_key_b definition
28 */
29
30typedef struct _license_key_b
31{
32    u8_t digest[HASH_VALUE_SIZE];
33        /* KEY_VALID_PATTERN is used when no actual digest is needed */
34        #define KEY_VALID_PATTERN_BYTE           0x5a
35        #define KEY_VALID_PATTERN_DWORD          0x5a5a5a5a
36
37    u8_t key_type;
38        #define KEY_TYPE_ENUM_BCM5706            0x0
39        #define KEY_TYPE_ENUM_BCM5710            0x2 /* Special modification for Everest */
40    u8_t version;
41        #define VERSION_CURRENT                  0x0
42    u8_t dword_length;                           /* Not including the digest */
43    u8_t oem_id;
44        #define OEM_ID_BRCM                      0
45        #define OEM_ID_HPQ                       0x3c
46
47    u16_t capability;
48        #define CAP_RESERVED                     0x0001 /* Xinan/Teton Only */
49        #define CAP_USER_RDMA                    0x0002 /* Xinan/Teton Only */
50        #define CAP_TOE                          0x0004 /* Xinan/Teton Only */
51        #define CAP_ISCSI_INIT                   0x0008 /* Xinan/Teton Only */
52        #define CAP_ISCSI_TRGT                   0x0010 /* Xinan/Teton Only */
53        #define CAP_ISER_INIT                    0x0020 /* Xinan/Teton Only */
54        #define CAP_ISER_TRGT                    0x0040 /* Xinan/Teton Only */
55        #define CAP_ISCSI_BOOT                   0x0080 /* Xinan/Teton Only */
56        #define CAP_ISCSI_FULL_ACCL              0x0100 /* Xinan/Teton Only */
57        #define CAP_ISCSI_HDR_DGST               0x0200 /* Xinan/Teton Only */
58        #define CAP_ISCSI_BODY_DGST              0x0400 /* Xinan/Teton Only */
59        #define CAP_SERDES_2_5G                  0x0800 /* Xinan/Teton Only */
60        #define CAP_SPEED_12G                    0x0800 /* Everest Only */
61        #define CAP_SPEED_12_5G                  0x1000
62        #define CAP_SPEED_13G                    0x2000
63        #define CAP_SPEED_15G                    0x4000
64        #define CAP_SPEED_16G                    0x8000
65    u16_t max_toe_conn;
66        #define CONN_UNLIMITED                   0xffff
67
68    u16_t reserved;
69    u16_t max_um_rdma_conn;
70
71    u16_t max_iscsi_init_conn;
72    u16_t max_iscsi_trgt_conn;
73
74    u16_t max_iser_init_conn;
75    u16_t max_iser_trgt_conn;
76
77    u32_t reserved_a[3];
78
79    u32_t sn;
80
81    u16_t reserved_b;
82    u16_t expiration;
83        #define EXPIRATION_NEVER                 0xffff
84
85} license_key_b_t;
86
87/*
88 * license_key_l definition
89 */
90
91#define KEY_VALID_PATTERN_BYTE           0x5a
92#define KEY_VALID_PATTERN_DWORD          0x5a5a5a5a
93typedef struct _license_key_l
94{
95    u8_t digest[HASH_VALUE_SIZE];
96        /* KEY_VALID_PATTERN is used when no actual digest is needed */
97
98    u8_t oem_id;
99            #define OEM_ID_BRCM                      0
100            #define OEM_ID_HPQ                       0x3c
101    u8_t dword_length;                           /* Not including the digest */
102    u8_t version;
103            #define VERSION_CURRENT                  0x0
104    u8_t key_type;
105            #define KEY_TYPE_ENUM_BCM5706            0x0
106            #define KEY_TYPE_ENUM_BCM5710            0x2 /* Special modification for Everest */
107
108    u16_t max_toe_conn;
109            #define CONN_UNLIMITED                   0xffff
110    u16_t capability;
111        #define CAP_RESERVED                     0x0001 /* Xinan/Teton Only */
112        #define CAP_USER_RDMA                    0x0002 /* Xinan/Teton Only */
113        #define CAP_TOE                          0x0004 /* Xinan/Teton Only */
114        #define CAP_ISCSI_INIT                   0x0008 /* Xinan/Teton Only */
115        #define CAP_ISCSI_TRGT                   0x0010 /* Xinan/Teton Only */
116        #define CAP_ISER_INIT                    0x0020 /* Xinan/Teton Only */
117        #define CAP_ISER_TRGT                    0x0040 /* Xinan/Teton Only */
118        #define CAP_ISCSI_BOOT                   0x0080 /* Xinan/Teton Only */
119        #define CAP_ISCSI_FULL_ACCL              0x0100 /* Xinan/Teton Only */
120        #define CAP_ISCSI_HDR_DGST               0x0200 /* Xinan/Teton Only */
121        #define CAP_ISCSI_BODY_DGST              0x0400 /* Xinan/Teton Only */
122        #define CAP_SERDES_2_5G                  0x0800 /* Xinan/Teton Only */
123        #define CAP_SPEED_12G                    0x0800 /* Everest Only */
124        #define CAP_SPEED_12_5G                  0x1000
125        #define CAP_SPEED_13G                    0x2000
126        #define CAP_SPEED_15G                    0x4000
127        #define CAP_SPEED_16G                    0x8000
128
129    u16_t max_um_rdma_conn;
130    u16_t reserved;
131
132    u16_t max_iscsi_trgt_conn;
133    u16_t max_iscsi_init_conn;
134
135    u16_t max_iser_trgt_conn;
136    u16_t max_iser_init_conn;
137
138    u32_t reserved_a[3];
139
140    u32_t sn;
141
142    u16_t expiration;
143            #define EXPIRATION_NEVER                 0xffff
144    u16_t reserved_b;
145
146} license_key_l_t;
147
148
149#define FW_ENCODE_32BIT_PATTERN                  0x1e1e1e1e
150#define FW_ENCODE_16BIT_PATTERN                  0x1e1e
151#define FW_ENCODE_8BIT_PATTERN                   0x1e
152
153
154#if defined(BIG_ENDIAN)
155    typedef license_key_b_t license_key_t;
156#elif defined(LITTLE_ENDIAN)
157    typedef license_key_l_t license_key_t;
158#endif
159
160#endif /* _LICENSE_H */
161