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 * Copyright(c) 2009-2015 Broadcom Corporation, all rights reserved 38 * Proprietary and Confidential Information. 39 * 40 * This source file is the property of Broadcom Corporation, and 41 * may not be copied or distributed in any isomorphic form without 42 * the prior written consent of Broadcom Corporation. 43 * 44 * Name: bdn.h 45 * 46 * Description: BDN definitions 47 * 48 * Author: Yaniv Rosner 49 * 50 ****************************************************************************/ 51 52 #ifndef BDN_H 53 #define BDN_H 54 55 #if 0 56 typedef u32 bdn_cfg; 57 #define BDN_CFG_SIZE_MASK 0x0000ffff 58 #define BDN_CFG_SIZE_OFFSET 0 59 #define BDN_CFG_STATE_MASK 0x00ff0000 60 #define BDN_CFG_STATE_OFFSET 16 61 #define BDN_CFG_STATE_ACTIVE 0x00010000 62 #define BDN_CFG_STATE_PENDING 0x00020000 63 #define BDN_CFG_STATE_DEFAULT 0x00040000 64 65 #define SERVER_DESCRIPTION_MAX_LENGTH 64 66 struct server_descrip { 67 u8 len; 68 u8 str[SERVER_DESCRIPTION_MAX_LENGTH]; 69 }; 70 71 #define SERVER_UUID_LENGTH 36 72 struct server_uuid { 73 u8 len; 74 u8 str[SERVER_UUID_LENGTH]; 75 }; 76 77 #define GENERALIZED_TIME_MAX_SIZE 16 /* YYYYMMDDhhmmss.s */ 78 struct generalized_time { 79 u8 len; 80 u8 time_str[GENERALIZED_TIME_MAX_SIZE]; 81 }; 82 #define CONNECTION_ID_LENGTH 16 83 84 #define SLOT_TYPE_NUM_MAX_LENGTH 32 85 struct slot_type_num { 86 u8 len; 87 u8 str[SLOT_TYPE_NUM_MAX_LENGTH]; 88 }; 89 90 #define ILO_MGMT_MAX_NUM_OF_ADDR 3 91 #define ILO_MGMT_ADDR_MAX_LENGTH 16 92 struct iLO_mgmt_addr { 93 u8 num_of_add; 94 u8 len_of_add[ILO_MGMT_MAX_NUM_OF_ADDR]; 95 u8 str[ILO_MGMT_MAX_NUM_OF_ADDR][ILO_MGMT_ADDR_MAX_LENGTH]; 96 }; 97 98 #define ENCLOSURE_ID_LENGTH 36 99 struct enclosure_id { 100 u8 len; 101 u8 str[ENCLOSURE_ID_LENGTH]; 102 u8 res[3]; 103 }; 104 105 struct base_dev_next_os { 106 u8 reset_2_factory; 107 u8 res[3]; 108 }; 109 110 struct base_dev_now { 111 u8 one_view_config; 112 u8 res[3]; 113 }; 114 115 struct base_dev { 116 struct base_dev_now now; 117 struct base_dev_next_os next_os; 118 }; 119 120 struct server_info { 121 u8 optional_bitmap; 122 #define SERVER_INFO_ILO_MGMT_VLAN_PRESENT (1<<0) 123 #define SERVER_INFO_DATA_TIMESTAMP_PRESENT (1<<1) 124 #define SERVER_INFO_ENCLOSURE_ID_PRESENT (1<<2) 125 struct server_descrip server_descrip; 126 struct server_uuid server_uuid; 127 struct slot_type_num slot_type_num; 128 struct iLO_mgmt_addr iLO_mgmt_addr; 129 u16 iLO_mgmt_vlan; 130 struct generalized_time data_timestamp; 131 }; 132 133 struct Codec_Info { 134 u32 version; /* Version of Codec */ 135 136 enum codec_location { 137 e_None = 0, 138 e_Here = 1, 139 e_FRU_EEPROM = 2 140 } loc; /* DEFAULT e-None */ 141 u16 total_size; /* total size of Codec in bytes.Max size 32K (64K?)*/ 142 u16 num_msg_segments; /* number of segments = total size / max message payload size */ 143 }; 144 145 #define MAX_CODEC_SIZE 0x8000 146 #define CODEC_SEGMENT_SIZE 0x400 147 #define NUMBER_OF_SEGMENTS (MAX_CODEC_SIZE/CODEC_SEGMENT_SIZE) 148 struct codec_t { 149 u8 data[NUMBER_OF_SEGMENTS][CODEC_SEGMENT_SIZE]; 150 }; 151 152 struct bdn_netport_now { 153 bdn_cfg hdr; 154 u8 enable_port; 155 u8 enable_diag; 156 u8 num_pfs_min_bw; 157 u8 num_pfs_max_bw; 158 u8 min_bw[MCP_GLOB_FUNC_MAX]; 159 u8 max_bw[MCP_GLOB_FUNC_MAX]; 160 }; 161 162 struct bdn_netport_on_port_reset { 163 bdn_cfg hdr; 164 u32 link_config; 165 /* Same definitions as in PORT_HW_CFG_SPEED_CAPABILITY_D3_MASK */ 166 #define BDN_LINK_CONFIG_ADVERTISED_SPEED_MASK 0x0000ffff 167 #define BDN_LINK_CONFIG_ADVERTISED_SPEED_SHIFT 0 168 /* Same definitions as PORT_FEATURE_FLOW_CONTROL_MASK */ 169 #define BDN_LINK_CONFIG_FLOW_CONTROL_MASK 0x00070000 170 #define BDN_LINK_CONFIG_FLOW_CONTROL_SHIFT 16 171 172 #define BDN_LINK_CONFIG_PFC_ENABLED_MASK 0x00080000 173 #define BDN_LINK_CONFIG_PFC_ENABLED_SHIFT 19 174 175 #define BDN_LINK_CONFIG_EEE_ENABLED_MASK 0x00100000 176 #define BDN_LINK_CONFIG_EEE_ENABLED_SHIFT 20 177 }; 178 179 struct bdn_netport_next_os_boot { 180 bdn_cfg hdr; 181 u8 num_pfs; 182 u8 num_vf_per_pf[MCP_GLOB_FUNC_MAX]; 183 }; 184 185 struct bdn_netport_diag_ctrl { 186 bdn_cfg hdr; 187 u8 port_reset; 188 u8 local_loopback; 189 u8 remote_loopback; 190 u8 rsrv[1]; 191 }; 192 193 struct bdn_netport { 194 struct bdn_netport_now now; 195 struct bdn_netport_on_port_reset on_port_reset; /* On Port Reset */ 196 struct bdn_netport_next_os_boot next_os_boot; /* Next OS Boot */ 197 struct bdn_netport_diag_ctrl diag_ctrl; 198 }; 199 200 #define CONNECTION_ID_LEN 16 201 struct bdn_flexfunc_now { 202 bdn_cfg hdr; 203 u8 connection_id[CONNECTION_ID_LEN]; 204 u8 fnic_enabled; 205 u8 rsrv[3]; 206 }; 207 208 struct bdn_flexfunc_next_os_boot { 209 bdn_cfg hdr; 210 u32 optional_bitmap; 211 #define FLEXFUNC_CFG_NEXT_OS_C2S_PCP_MAP_PRESENT (1<<0) 212 #define FLEXFUNC_CFG_NEXT_OS_PORT_ASSIGNMENT_PRESENT (1<<1) 213 #define FLEXFUNC_CFG_NEXT_OS_EMB_LAG_PRESENT (1<<2) 214 u8 mac_addr[6]; 215 u8 func_type; 216 u8 boot_mode; 217 u8 c_2_s_pcp_map[9]; /* Maps O/S C-VLAN PCP value to S-VLAN PCP value for TX 218 * -- items 1-8 correspond to the O/S C-VLAN PCP values 0-7 219 * -- item 9 is the default if no C-VLAN present 220 * -- Values in these 9 bytes are the expected S-PCP values. 221 * -- If NetDev-Device-Module: EVB-Support.c-2-s-pcp-map = FALSE, then 222 * -- all values must be identical 223 * -- else, it supports C-PCP -> S-PCP mapping 224 */ 225 u16 mtu_size; 226 u8 rsrv[1]; 227 }; 228 229 struct bdn_flex_func_diag_ctrl { 230 bdn_cfg hdr; 231 u8 enable_wol; 232 u8 rsrv[3]; 233 }; 234 235 struct bdn_flex_func { 236 struct bdn_flexfunc_now now; 237 struct bdn_flexfunc_next_os_boot next_os_boot; /* Next OS Boot */ 238 struct bdn_flex_func_diag_ctrl diag_ctrl; 239 }; 240 241 #define FC_NPIV_WWPN_SIZE 8 242 #define FC_NPIV_WWNN_SIZE 8 243 struct bdn_npiv_settings { 244 u8 npiv_wwpn[FC_NPIV_WWPN_SIZE]; 245 u8 npiv_wwnn[FC_NPIV_WWNN_SIZE]; 246 }; 247 248 struct bdn_fc_npiv_cfg { 249 /* hdr used internally by the MFW */ 250 u32 hdr; 251 u32 num_of_npiv; 252 }; 253 254 #define MAX_NUMBER_NPIV 64 255 struct bdn_fc_npiv_tbl { 256 struct bdn_fc_npiv_cfg fc_npiv_cfg; 257 struct bdn_npiv_settings settings[MAX_NUMBER_NPIV]; 258 }; 259 260 261 struct bdn_fc_npiv { 262 struct bdn_fc_npiv_tbl now; /* Next device level reset */ 263 }; 264 265 struct bdn_iscsi_initiator_cfg { 266 u32 optional_bitmap; 267 #define ISCSI_INITIATOR_ROUTE_PRESENT (1<<0) 268 #define ISCSI_INITIATOR_PRIMARY_DNS_PRESENT (1<<1) 269 #define ISCSI_INITIATOR_SECONDARY_DNS_PRESENT (1<<2) 270 u8 name[232]; 271 u8 ip_add[16]; 272 u8 netmask[16]; 273 u8 route[16]; 274 u8 primary_dns[16]; 275 u8 secondary_dns[16]; 276 }; 277 278 struct bdn_iscsi_target_params { 279 u32 optional_bitmap; 280 #define ISCSI_TARGET_LLMNR_ENABLE_PRESENT (1<<0) 281 #define ISCSI_TARGET_ROUTE_ADV_ENABLE_PRESENT (1<<1) 282 #define ISCSI_TARGET_IPV2_PRESENT (1<<2) 283 u8 name[232]; 284 u32 lun; 285 u8 ip_addr[16]; 286 u32 tcp_port; 287 u8 ip_addr_2[16]; 288 u32 tcp_port_2; 289 u32 llmnr_en; 290 u32 route_adv_en; 291 }; 292 293 struct bdn_iscsi_authentication { 294 u32 optional_bitmap; 295 #define ISCSI_AUTH_CHAP_USERNAME_PRESENT (1<<0) 296 #define ISCSI_AUTH_CHAP_SECRET_PRESENT (1<<1) 297 #define ISCSI_AUTH_MUTUAL_USERNAME_PRESENT (1<<2) 298 #define ISCSI_AUTH_MUTUAL_SECRET_PRESENT (1<<3) 299 u32 auth_meth; 300 u8 username[232]; 301 u8 secret[16]; 302 u32 secret_len; 303 u8 mutual_username[232]; 304 u8 mutual_secret[16]; 305 u32 mutual_secret_len; 306 }; 307 308 struct bdn_iscsi_boot_cfg { 309 u32 optional_bitmap; 310 #define ISCSI_CFG_CVID_PRESENT (1<<0) 311 #define ISCSI_CFG_DNS_VIA_DHCP_PRESENT (1<<1) 312 #define ISCSI_CFG_TARGET_INFO_DHCP_PRESENT (1<<2) 313 #define ISCSI_CFG_INITIATOR_PRESENT (1<<3) 314 #define ISCSI_CFG_TARGET_PRESENT (1<<4) 315 #define ISCSI_CFG_DHCP_VENDOR_ID_PRESENT (1<<5) 316 #define ISCSI_CFG_AUTH_PRESENT (1<<6) 317 #define ISCSI_AUTH_HEADER_DIGEST_FLAG_PRESENT (1<<7) 318 #define ISCSI_AUTH_DATA_DIGEST_FLAG_PRESENT (1<<8) 319 bdn_cfg hdr; 320 u32 cvid; 321 u32 ip_add_type; 322 u32 dns_via_dhcp; 323 u32 target_via_dhcp; 324 u8 dhcp_vendor_id[32]; 325 u32 head_digest_flag_en; 326 u32 data_digest_flag_en; 327 }; 328 329 struct bdn_iscsi_boot_next_dlr { 330 struct bdn_iscsi_boot_cfg cfg; /* Next device level reset */ 331 struct bdn_iscsi_initiator_cfg initiator_cfg; 332 struct bdn_iscsi_target_params target_params; 333 struct bdn_iscsi_authentication authentication; 334 }; 335 336 struct bdn_iscsi_boot { 337 struct bdn_iscsi_boot_next_dlr next_dlr; /* Next device level reset */ 338 }; 339 340 #define FCOE_TARGETS_WWPN_SIZE 8 341 #define FCOE_TARGETS_LUN_SIZE 8 342 343 struct bdn_fcoe_targets { 344 u8 wwpn[FCOE_TARGETS_WWPN_SIZE]; 345 u8 lun_id[FCOE_TARGETS_LUN_SIZE]; 346 }; 347 348 struct bdn_fcoe_boot_cfg { 349 u32 optional_bitmap; 350 #define FCOE_CFG_CVID_PRESENT (1<<0) 351 #define FCOE_BASE_WWNN_PRESENT (1<<1) 352 #define FCOE_WWPN_PRESENT (1<<2) 353 bdn_cfg hdr; 354 u32 cvid; 355 u8 base_wwnn[FCOE_TARGETS_WWPN_SIZE]; /* Host World wide name*/ 356 u8 wwpn[FCOE_TARGETS_WWPN_SIZE]; /* base wwpn */ 357 u32 num_of_fcoe_targets; 358 }; 359 360 struct bdn_fcoe_boot_next_dlr { 361 struct bdn_fcoe_boot_cfg cfg; /* Next device level reset */ 362 struct bdn_fcoe_targets fcoe_targets[8]; 363 }; 364 365 struct bdn_fcoe_boot { 366 struct bdn_fcoe_boot_next_dlr next_dlr; /* Next device level reset */ 367 }; 368 #ifndef PF_NUM_MAX 369 #define PF_NUM_MAX 8 370 #endif 371 struct bdn_ncsi_next_dlr { 372 bdn_cfg hdr; 373 u32 ncsi_scid; 374 }; 375 376 struct bdn_ncsi { 377 struct bdn_ncsi_next_dlr bdn_ncsi_next_dlr; 378 }; 379 380 // Rapid-Response-Poll-Module definition 381 #define MAX_CCT_SIZE 64 382 #define VALID_RPP_SIGNATURE 0x69616853 383 struct rpp_sum_stc { 384 u32 hash; 385 u32 num; 386 }; 387 388 struct digest_stc { 389 u8 type; 390 u8 inst; 391 u16 digest; 392 }; 393 394 struct bdn_rapid_respon_stc { 395 u32 sig; 396 struct rpp_sum_stc rpp_sum; 397 u8 num_of_cct; 398 u8 res[3]; 399 struct digest_stc cct[MAX_CCT_SIZE]; 400 #ifdef CONFIG_SUPPORT_SCI 401 struct digest_stc sci[MAX_CCT_SIZE]; 402 #endif 403 }; 404 405 struct bdn { 406 u32 size; 407 struct base_dev base_dev; 408 struct server_info server_info; 409 struct bdn_netport netport[MCP_GLOB_PORT_MAX * MCP_GLOB_PATH_MAX]; 410 struct bdn_flex_func flexfunc[PF_NUM_MAX]; 411 struct bdn_fc_npiv fc_npiv[MCP_GLOB_PORT_MAX * MCP_GLOB_PATH_MAX]; 412 struct bdn_iscsi_boot iscsi_boot[MCP_GLOB_PORT_MAX * MCP_GLOB_PATH_MAX]; 413 struct bdn_fcoe_boot fcoe_boot[MCP_GLOB_PORT_MAX * MCP_GLOB_PATH_MAX]; 414 struct bdn_ncsi ncsi; 415 struct bdn_rapid_respon_stc rpp_stc; 416 struct enclosure_id serv_info_enc_id; 417 u32 crc; 418 }; 419 420 union bdn_image { 421 struct bdn bdn; 422 u8 rsrv[0x9000]; 423 }; 424 425 /* Expected BDN size is basically the offset of rsrv within the bdn structure */ 426 #define BDN_SIZE (sizeof(struct bdn)) 427 #define BDN_SERVER_INFO() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, server_info)) 428 #define BDN_BASE_DEV_NEXT_OS() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, base_dev.next_os)) 429 #define BDN_BASE_DEV_NOW() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, base_dev.now)) 430 /* #define BDN_CODEC_INFO() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, codec_info)) */ 431 /* #define BDN_CODEC_DATA() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, codec)) */ 432 #define BDN_NETPORT_NOW(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, netport[(papo.path << 1) + papo.port].now)) 433 #define BDN_NETPORT_ON_PORT_RESET(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, netport[(papo.path << 1) + papo.port].on_port_reset)) 434 #define BDN_NETPORT_NEXT_OS_BOOT(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, netport[(papo.path << 1) + papo.port].next_os_boot)) 435 #define BDN_NETPORT_DIAG_CTRL(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, netport[(papo.path << 1) + papo.port].diag_ctrl)) 436 #define BDN_FLEXFUNC_NOW(pf_num) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, flexfunc[pf_num].now)) 437 #define BDN_FLEXFUNC_NEXT_OS_BOOT(pf_num) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, flexfunc[pf_num].next_os_boot)) 438 #define BDN_FLEXFUNC_DIAG_CTRL(pf_num) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, flexfunc[pf_num].diag_ctrl)) 439 #define BDN_FC_NPIV_NOW(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, fc_npiv[(papo.path << 1) + papo.port].now)) 440 #define BDN_FC_NPIV_NOW_CFG(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, fc_npiv[(papo.path << 1) + papo.port].now.fc_npiv_cfg)) 441 #define BDN_FC_NPIV_NOW_SETTINGS(papo, idx) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, fc_npiv[(papo.path << 1) + papo.port].now.settings[idx])) 442 #define BDN_ISCSI_BOOT_NEXT_DLR_CFG(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, iscsi_boot[(papo.path << 1) + papo.port].next_dlr.cfg)) 443 #define BDN_ISCSI_BOOT_NEXT_DLR_INITIATOR(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, iscsi_boot[(papo.path << 1) + papo.port].next_dlr.initiator_cfg)) 444 #define BDN_ISCSI_BOOT_NEXT_DLR_TARGET(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, iscsi_boot[(papo.path << 1) + papo.port].next_dlr.target_params)) 445 #define BDN_ISCSI_BOOT_NEXT_DLR_AUTHENTICATION(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, iscsi_boot[(papo.path << 1) + papo.port].next_dlr.authentication)) 446 #define BDN_FCOE_BOOT_NEXT_DLR_CFG(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, fcoe_boot[(papo.path << 1) + papo.port].next_dlr.cfg)) 447 #define BDN_FCOE_BOOT_NEXT_DLR_TARGET(papo, idx) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, fcoe_boot[(papo.path << 1) + papo.port].next_dlr.fcoe_targets[idx])) 448 #define BDN_NCSI_NEXT_DLR() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, ncsi.bdn_ncsi_next_dlr)) 449 #define BDN_RAPID_RESPONSE (ASN1_P->bdn_addr + OFFSETOF(struct bdn, rpp_stc)) 450 #define BDN_SERV_INFO_ENC_ID() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, serv_info_enc_id)) 451 #define BDN_CRC() (ASN1_P->bdn_addr + sizeof(union bdn_image)) 452 #endif 453 454 #define BDN_SIZE_IMAGE_MAX (0x9000) 455 456 #define BDN_SIZE_OF_MAC (6) 457 #define BDN_SIZE_OF_WWN (8) 458 #define BDN_SIZE_OF_IPV4 (4) 459 #define BDN_SIZE_OF_IPV6 (16) 460 #define BDN_DIR_MAX (8) 461 #define BDN_SIZE_OF_PF_PER_PORT (16) 462 #define BDN_SIZE_OF_CONNECTION_ID (16) 463 #define BDN_SIZE_OF_C2SPCP_MAP (9) 464 #define BDN_SIZE_OF_ISCSI_NAME (236) 465 #define BDN_SIZE_OF_ISCSI_SEC (16) 466 #define BDN_SIZE_OF_FCOE_TARGETS (8) 467 #define BDN_SIZE_OF_FCOE_LUN_ID (8) 468 #define BDN_SIZE_OF_DHCP_VENDOR_ID (32) 469 #define BDN_SIZE_OF_SERV_DESC (64) 470 #define BDN_SIZE_OF_SERV_UUID (36) 471 #define BDN_SIZE_OF_SERV_SLOT (32) 472 #define BDN_NUM_OF_ILO_ADDR (3) 473 #define BDN_SIZE_OF_ILO_ADDR (16) 474 #define BDN_SIZE_OF_SERV_TIME (20) 475 #define BDN_SIZE_OF_ENCLOSURE_ID (36) 476 #define BDN_CCT_MAX_SIZE (64) 477 #define BDN_SCI_MAX_SIZE (64) 478 479 struct bdn_dir { 480 u16 offset; 481 u16 length; 482 }; 483 484 #define BDN_DIR_CFG_NOW (0) 485 #define BDN_DIR_CFG_NEXT_FLR (1) 486 #define BDN_DIR_CFG_PORT_RESET (2) 487 #define BDN_DIR_CFG_NEXT_DLR (3) 488 #define BDN_DIR_CFG_NEXT_OS_BOOT (4) 489 #define BDN_DIR_CFG_NEXT_PWR_CYC (5) 490 #define BDN_DIR_CFG_DIAG_CTRL (6) 491 492 typedef u32 bdn_cfg_state; 493 #define BDN_CFG_STATE_MASK 0x000000ff 494 #define BDN_CFG_STATE_OFFSET 0 495 #define BDN_CFG_STATE_NA 0x00000000 496 #define BDN_CFG_STATE_ACTIVE 0x00000001 497 #define BDN_CFG_STATE_PENDING 0x00000002 498 #define BDN_CFG_STATE_DEFAULT 0x00000004 499 500 #define BDN_CFG_STATE_IS(x, y) ((((x)->state & BDN_CFG_STATE_MASK) >> BDN_CFG_STATE_OFFSET) == BDN_CFG_STATE_##y) 501 #define BDN_OPTIONAL_SET(x, y) (x)->optional |= (1 << (y)) 502 #define BDN_OPTIONAL_CHECK(x, y) ((x)->optional & (1 << (y))) 503 504 /*.************************* Base-Device-Module************************* */ 505 struct bdn_base_now { 506 bdn_cfg_state state; 507 u32 optional; 508 509 u32 rsv:24, 510 dci_mgmt:8; 511 512 u32 rsrv; 513 }; 514 515 struct bdn_base_osb { 516 bdn_cfg_state state; 517 u32 optional; 518 519 u32 rsv:31, 520 reset_2_factory:1; 521 522 u32 rsrv; 523 }; 524 525 struct bdn_base { 526 struct bdn_dir dir[BDN_DIR_MAX]; 527 528 struct bdn_base_now now; 529 struct bdn_base_osb osb; /* Next os reboot */ 530 }; 531 532 /*.************************* Network-Device-Module********************** */ 533 struct bdn_nport_now { 534 bdn_cfg_state state; 535 u32 optional; 536 #define BDN_NETPORT_NOW_OPT_MIN_BW (0) 537 #define BDN_NETPORT_NOW_OPT_MAX_BW (1) 538 539 u32 rsv:14, 540 enable_port:1, 541 enable_diag:1, 542 num_pfs_min_bw:8, 543 num_pfs_max_bw:8; 544 545 u8 min_bw[BDN_SIZE_OF_PF_PER_PORT]; 546 u8 max_bw[BDN_SIZE_OF_PF_PER_PORT]; 547 548 u32 rsrv; 549 }; 550 551 struct bdn_nport_plr { 552 bdn_cfg_state state; 553 u32 optional; 554 #define BDN_NETPORT_RESET_OPT_ADV_SPEED (0) 555 #define BDN_NETPORT_RESET_OPT_FLOW_CTRL (1) 556 #define BDN_NETPORT_RESET_OPT_EEE_ENABLE (2) 557 558 u32 rsv:11, 559 eee_enable:1, 560 flow_ctrl:4, 561 adv_speed:16; 562 563 u32 rsrv; 564 }; 565 566 struct bdn_nport_osb { 567 bdn_cfg_state state; 568 u32 optional; 569 #define BDN_NETPORT_BOOT_OPT_NUM_VF (0) 570 #define BDN_NETPORT_BOOT_OPT_NPIV_ENABLE (1) 571 572 u32 rsv:23, 573 npiv_enable:1, 574 num_pfs:8; 575 u8 num_vfs[BDN_SIZE_OF_PF_PER_PORT]; 576 577 u32 rsrv; 578 }; 579 580 struct bdn_nport_dgn { 581 bdn_cfg_state state; 582 u32 optional; 583 584 u32 rsv:29, 585 port_reset:1, 586 local_loopback:1, 587 remote_loopback:1; 588 589 u32 rsrv; 590 }; 591 592 struct bdn_nport { 593 struct bdn_dir dir[BDN_DIR_MAX]; 594 595 struct bdn_nport_now now; 596 struct bdn_nport_plr plr; /* Next device level reset */ 597 struct bdn_nport_osb osb; /* Next os reboot */ 598 struct bdn_nport_dgn dgn; 599 }; 600 601 /* ************************* FlexFunc-Module************************* */ 602 struct bdn_flex_now { 603 bdn_cfg_state state; 604 u32 optional; 605 606 u8 connection_id[BDN_SIZE_OF_CONNECTION_ID]; 607 u32 rsv:31, 608 fnic_enabled:1; 609 610 u32 rsrv; 611 }; 612 613 struct bdn_flex_dlr { 614 bdn_cfg_state state; 615 u32 optional; 616 #define BDN_FLEXFUNC_DLR_OPT_FC_WWNN (0) 617 #define BDN_FLEXFUNC_DLR_OPT_FC_WWPN (1) 618 619 u8 fc_wwnn[BDN_SIZE_OF_WWN]; 620 u8 fc_wwpn[BDN_SIZE_OF_WWN]; 621 622 u32 rsrv[2]; 623 }; 624 625 struct bdn_flex_osb { 626 bdn_cfg_state state; 627 u32 optional; 628 #define BDN_FLEXFUNC_BOOT_OPT_C2SPCP_MAP (0) 629 #define BDN_FLEXFUNC_BOOT_OPT_PORT_ASSIGNMENT (1) 630 #define BDN_FLEXFUNC_BOOT_OPT_EMB_LAG (2) 631 #define BDN_FLEXFUNC_BOOT_OPT_MTU_SIZE (3) 632 #define BDN_FLEXFUNC_BOOT_OPT_OVER_MTU (4) 633 634 u8 mac_addr[BDN_SIZE_OF_MAC]; 635 u8 c_2_s_pcp_map[BDN_SIZE_OF_C2SPCP_MAP]; 636 /* Maps O/S C-VLAN PCP value to S-VLAN PCP value for TX 637 * -- items 1-8 correspond to the O/S C-VLAN PCP values 0-7 638 * -- item 9 is the default if no C-VLAN present 639 * -- Values in these 9 bytes are the expected S-PCP values. 640 * -- If NetDev-Device-Module: EVB-Support.c-2-s-pcp-map = FALSE, then 641 * -- all values must be identical 642 * -- else, it supports C-PCP -> S-PCP mapping 643 */ 644 u8 func_type; 645 u32 rsv:2, 646 valid_mac_addr:1, 647 override_mtu:1, 648 boot_mode:4, 649 port_assign:4, 650 emb_lag:4, 651 mtu_size:16; 652 653 u32 rsrv; 654 }; 655 656 struct bdn_flex_dgn { 657 bdn_cfg_state state; 658 u32 optional; 659 660 u32 rsv:31, 661 enable_wol:1; 662 663 u32 rsrv; 664 }; 665 666 struct bdn_flex { 667 struct bdn_dir dir[BDN_DIR_MAX]; 668 669 struct bdn_flex_now now; 670 struct bdn_flex_dlr dlr; /* Next device level reset */ 671 struct bdn_flex_osb osb; /* Next os reboot */ 672 struct bdn_flex_dgn dgn; 673 }; 674 675 /* ************************* FC-NPIV-Module************************* */ 676 struct bdn_npiv_dlr { 677 bdn_cfg_state state; 678 u32 optional; 679 680 struct dci_fc_npiv_tbl npiv_tbl; 681 }; 682 683 struct bdn_npiv { 684 struct bdn_dir dir[BDN_DIR_MAX]; 685 686 struct bdn_npiv_dlr dlr; /* Next device level reset */ 687 }; 688 689 /* ************************* iSCSI-Boot-Module************************* */ 690 struct bdn_iscsi_init { 691 u32 rsv:21, 692 opt_route:1, 693 opt_pri_dns:1, 694 opt_sec_dns:1, 695 name_size:8; 696 697 u8 ip_add[BDN_SIZE_OF_IPV6]; 698 u8 netmask[BDN_SIZE_OF_IPV6]; 699 u8 route[BDN_SIZE_OF_IPV6]; 700 u8 primary_dns[BDN_SIZE_OF_IPV6]; 701 u8 secondary_dns[BDN_SIZE_OF_IPV6]; 702 u8 name[BDN_SIZE_OF_ISCSI_NAME]; 703 }; 704 705 struct bdn_iscsi_trgt { 706 u32 optional; 707 #define BDN_ISCSI_TARGET_OPT_LLMNR_ENABLE (0) 708 #define BDN_ISCSI_TARGET_OPT_ROUTE_ADV_ENABLE (1) 709 710 u32 rsv:21, 711 opt_ip2:1, 712 llmnr_en:1, 713 route_adv_en:1, 714 name_size:8; 715 716 u32 lun; 717 u16 tcpport; 718 u16 tcpport2; 719 720 u8 ip[BDN_SIZE_OF_IPV6]; 721 u8 ip2[BDN_SIZE_OF_IPV6]; 722 u8 name[BDN_SIZE_OF_ISCSI_NAME]; 723 724 u32 rsrv; 725 }; 726 727 struct bdn_iscsi_auth { 728 u32 rsv:2, 729 c_sec_size:6, 730 auth_method:2, 731 m_sec_size:6, 732 c_name_size:8, 733 m_name_size:8; 734 735 u8 chap_username[BDN_SIZE_OF_ISCSI_NAME]; 736 u8 chap_secret[BDN_SIZE_OF_ISCSI_SEC]; 737 u8 mutual_username[BDN_SIZE_OF_ISCSI_NAME]; 738 u8 mutual_secret[BDN_SIZE_OF_ISCSI_SEC]; 739 740 u32 rsrv; 741 }; 742 743 struct bdn_iboot_dlr { 744 bdn_cfg_state state; 745 u32 optional; 746 #define BDN_ISCSI_BOOT_OPT_CVID (0) 747 #define BDN_ISCSI_BOOT_OPT_INITIATOR (1) 748 #define BDN_ISCSI_BOOT_OPT_TARGET (2) 749 #define BDN_ISCSI_BOOT_OPT_AUTH (3) 750 #define BDN_ISCSI_BOOT_OPT_HEAD_DIGEST_EN (4) 751 #define BDN_ISCSI_BOOT_OPT_DATA_DIGEST_EN (5) 752 753 u32 rsv:4, 754 initiator_dhcp:1, 755 target_dhcp:1, 756 head_digest_en:1, 757 data_digest_en:1, 758 dhcp_vendor_id_size:8, 759 ip_type:4, 760 cvid:12; 761 762 u8 dhcp_vendor_id[BDN_SIZE_OF_DHCP_VENDOR_ID]; 763 764 u32 rsrv; 765 766 struct bdn_iscsi_init init; 767 struct bdn_iscsi_trgt trgt; 768 struct bdn_iscsi_auth auth; 769 }; 770 771 struct bdn_iboot { 772 struct bdn_dir dir[BDN_DIR_MAX]; 773 774 struct bdn_iboot_dlr dlr; /* Next device level reset */ 775 }; 776 777 /* ************************* FCoE-Boot-Module************************* */ 778 struct bdn_fcoe_trgt { 779 u8 wwpn[BDN_SIZE_OF_WWN]; 780 u8 lunid[BDN_SIZE_OF_FCOE_LUN_ID]; 781 }; 782 783 struct bdn_fboot_dlr { 784 bdn_cfg_state state; 785 u32 optional; 786 787 u32 rsv:24, 788 num_of_targets:4; 789 790 struct bdn_fcoe_trgt trgt[BDN_SIZE_OF_FCOE_TARGETS]; 791 792 u32 rsrv; 793 }; 794 795 struct bdn_fboot { 796 struct bdn_dir dir[BDN_DIR_MAX]; 797 798 struct bdn_fboot_dlr dlr; /* Next device level reset */ 799 }; 800 801 /* ************************* NCSI-Module ************************* */ 802 struct bdn_ncsi_dlr { 803 bdn_cfg_state state; 804 u32 optional; 805 806 u32 ncsi_scid:12, 807 rsv:20; 808 u32 rsv2; 809 }; 810 811 struct bdn_ncsi { 812 struct bdn_dir dir[BDN_DIR_MAX]; 813 814 struct bdn_ncsi_dlr dlr; 815 }; 816 817 /* ************************* Server-Info-Module************************* */ 818 struct bdn_serv { 819 bdn_cfg_state state; 820 u32 optional; 821 #define BDN_SERV_INFO_OPT_ILO_VLAN (0) 822 #define BDN_SERV_INFO_OPT_TIMESTAMP (1) 823 #define BDN_SERV_INFO_OPT_ENCLOSURE (2) 824 825 u16 ilo_vlan; 826 u8 serv_desc_size; 827 u8 serv_uuid_size; 828 u8 slot_info_size; 829 u8 timestamp_size; 830 u8 enclosure_size; 831 u8 ilo_addr_num; 832 u8 ilo_addr_size[BDN_NUM_OF_ILO_ADDR]; 833 u8 crc8; /* the crc8 from last put command */ 834 835 u8 serv_desc[BDN_SIZE_OF_SERV_DESC]; 836 u8 serv_uuid[BDN_SIZE_OF_SERV_UUID]; 837 u8 slot_info[BDN_SIZE_OF_SERV_SLOT]; 838 u8 ilo_addr[BDN_NUM_OF_ILO_ADDR][BDN_SIZE_OF_ILO_ADDR]; 839 u8 timestamp[BDN_SIZE_OF_SERV_TIME]; 840 u8 enclosure[BDN_SIZE_OF_ENCLOSURE_ID]; 841 }; 842 843 /* ********************* Rapid-Response-Poll-Module ******************** */ 844 struct bdn_rrp_digest { 845 u8 object; 846 u8 index; /* the index from zero */ 847 u16 digest; 848 }; 849 850 struct bdn_rrp { 851 bdn_cfg_state state; 852 u32 optional; 853 #define BDN_RRP_OPT_CCT (0) 854 #define BDN_RRP_OPT_SCI (1) 855 856 u32 hash; 857 u32 num_cct:8, 858 num_sci:8, 859 rsv:16; 860 861 struct bdn_rrp_digest cct[BDN_CCT_MAX_SIZE]; 862 struct bdn_rrp_digest sci[BDN_SCI_MAX_SIZE]; 863 }; 864 865 /* 0x20 bytes */ 866 struct bdn_head { 867 u32 signature; 868 #define BDN_HEAD_SIGN_SHIFT (8) 869 #define BDN_HEAD_SIGN_MASK (0xffffff << BDN_HEAD_SIGN_SHIFT) 870 #define BDN_HEAD_SIGN_VALID (((u32)'B' << 16) | ((u32)'D' << 8) | 'N') 871 #define BDN_HEAD_SIGN_VER_SHIFT (0) 872 #define BDN_HEAD_SIGN_VER_MASK (0xff << BDN_HEAD_SIGN_VER_SHIFT) 873 #define BDN_HEAD_SIGN_VER_CURRENT (1) 874 #define BDN_HEAD_SIGN_CURRENT ((BDN_HEAD_SIGN_VALID << BDN_HEAD_SIGN_SHIFT) | (BDN_HEAD_SIGN_VER_CURRENT << BDN_HEAD_SIGN_VER_SHIFT)) 875 876 u32 num_port:8, 877 num_func:8, 878 rsrv_bit:16; 879 880 struct bdn_dir glob; 881 struct bdn_dir port; 882 struct bdn_dir func; 883 884 u32 rsrv[3]; 885 }; 886 887 struct bdn_glob { 888 #define BDN_DIR_GLOB_SERV_INFO 0 889 #define BDN_DIR_GLOB_BASE_DEV 1 890 #define BDN_DIR_GLOB_NCSI 2 891 #define BDN_DIR_GLOB_RRP 3 892 struct bdn_dir dir[BDN_DIR_MAX]; 893 894 struct bdn_serv serv; 895 struct bdn_base base; 896 struct bdn_ncsi ncsi; 897 struct bdn_rrp rrp; 898 899 u32 rsrv[8]; 900 }; 901 902 struct bdn_port { 903 #define BDN_DIR_PORT_NETPORT 0 904 #define BDN_DIR_PORT_FC_NPIV 1 905 #define BDN_DIR_PORT_ISCSI_BOOT 2 906 #define BDN_DIR_PORT_FCOE_BOOT 3 907 struct bdn_dir dir[BDN_DIR_MAX]; 908 909 struct bdn_nport port; 910 struct bdn_npiv npiv; 911 struct bdn_iboot iboot; 912 struct bdn_fboot fboot; 913 914 }; 915 916 struct bdn_func { 917 #define BDN_DIR_FUNC_FLEX_FUNC 0 918 struct bdn_dir dir[BDN_DIR_MAX]; 919 920 struct bdn_flex flex; 921 922 u32 rsrv[4]; 923 }; 924 925 struct bdn { 926 struct bdn_head head; 927 struct bdn_glob glob; 928 struct bdn_port port[MCP_GLOB_PORT_MAX]; 929 struct bdn_func func[MCP_GLOB_FUNC_MAX]; 930 }; 931 932 #define BDN_OFFSET_GLOB(x) (OFFSETOF(struct bdn, glob.x) & 0xffff) 933 #define BDN_OFFSET_BASE(x) (OFFSETOF(struct bdn, glob.base.x) & 0xffff) 934 #define BDN_OFFSET_NCSI(x) (OFFSETOF(struct bdn, glob.ncsi.x) & 0xffff) 935 #define BDN_OFFSET_PORT(x, y) (OFFSETOF(struct bdn, port[(x)].y) & 0xffff) 936 #define BDN_OFFSET_NPORT(x, y) (OFFSETOF(struct bdn, port[(x)].port.y) & 0xffff) 937 #define BDN_OFFSET_NPIV(x, y) (OFFSETOF(struct bdn, port[(x)].npiv.y) & 0xffff) 938 #define BDN_OFFSET_IBOOT(x, y) (OFFSETOF(struct bdn, port[(x)].iboot.y) & 0xffff) 939 #define BDN_OFFSET_FBOOT(x, y) (OFFSETOF(struct bdn, port[(x)].fboot.y) & 0xffff) 940 #define BDN_OFFSET_FUNC(x, y) (OFFSETOF(struct bdn, func[(x)].y) & 0xffff) 941 #define BDN_OFFSET_FLEX(x, y) (OFFSETOF(struct bdn, func[(x)].flex.y) & 0xffff) 942 #define BDN_OFFSET_CRC (BDN_SIZE_IMAGE_MAX - 4) 943 944 union bdn_image { 945 struct bdn bdn; 946 u8_t rsrv[BDN_SIZE_IMAGE_MAX]; 947 }; 948 949 #endif /* BDN_H */ 950