2 * Broadcom NetXtreme-C/E network driver.
4 * Copyright (c) 2022 Broadcom, All Rights Reserved.
5 * The term Broadcom refers to Broadcom Limited and/or its subsidiaries
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26 * THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/types.h>
31 #include <sys/systm.h>
32 #include <sys/param.h>
33 #include <sys/module.h>
34 #include <sys/kernel.h>
37 #include <sys/malloc.h>
40 #define DRIVER_NAME "if_bnxt"
42 #define BNXT_MGMT_OPCODE_GET_DEV_INFO 0x80000000
43 #define BNXT_MGMT_OPCODE_PASSTHROUGH_HWRM 0x80000001
45 #define BNXT_MGMT_MAX_HWRM_REQ_LENGTH HWRM_MAX_REQ_LEN
46 #define BNXT_MGMT_MAX_HWRM_RESP_LENGTH (512)
48 struct bnxt_nic_info {
49 #define BNXT_MAX_STR 64
50 char dev_name[BNXT_MAX_STR];
51 char driver_version[BNXT_MAX_STR];
52 char driver_name[BNXT_MAX_STR];
53 char device_serial_number[64];
55 uint8_t mac[ETHER_ADDR_LEN];
56 uint32_t pci_link_speed;
57 uint32_t pci_link_width;
61 struct bnxt_pci_info {
68 uint16_t sub_system_vendor_id;
69 uint16_t sub_system_device_id;
75 struct bnxt_dev_info {
76 struct bnxt_nic_info nic_info;
77 struct bnxt_pci_info pci_info;
84 uint8_t read_or_write;
88 struct bnxt_mgmt_fw_msg {
94 uint32_t num_dma_indications;
95 struct dma_info dma[0];
98 struct bnxt_mgmt_generic_msg {
100 #define BNXT_LFC_KEY_DOMAIN_NO 1
105 enum bnxt_mgmt_req_type {
106 BNXT_MGMT_NVM_GET_VAR_REQ = 1,
107 BNXT_MGMT_NVM_SET_VAR_REQ,
108 BNXT_MGMT_NVM_FLUSH_REQ,
109 BNXT_MGMT_GENERIC_HWRM_REQ,
112 struct bnxt_mgmt_req_hdr {
117 enum bnxt_mgmt_req_type req_type;
120 struct bnxt_mgmt_req {
121 struct bnxt_mgmt_req_hdr hdr;