1d933e97fSStephen Hurd /*- 2d933e97fSStephen Hurd * Broadcom NetXtreme-C/E network driver. 3d933e97fSStephen Hurd * 4d933e97fSStephen Hurd * Copyright (c) 2016 Broadcom, All Rights Reserved. 5d933e97fSStephen Hurd * The term Broadcom refers to Broadcom Limited and/or its subsidiaries 6d933e97fSStephen Hurd * 7d933e97fSStephen Hurd * Redistribution and use in source and binary forms, with or without 8d933e97fSStephen Hurd * modification, are permitted provided that the following conditions 9d933e97fSStephen Hurd * are met: 10d933e97fSStephen Hurd * 1. Redistributions of source code must retain the above copyright 11d933e97fSStephen Hurd * notice, this list of conditions and the following disclaimer. 12d933e97fSStephen Hurd * 2. Redistributions in binary form must reproduce the above copyright 13d933e97fSStephen Hurd * notice, this list of conditions and the following disclaimer in the 14d933e97fSStephen Hurd * documentation and/or other materials provided with the distribution. 15d933e97fSStephen Hurd * 16d933e97fSStephen Hurd * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' 17d933e97fSStephen Hurd * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18d933e97fSStephen Hurd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19d933e97fSStephen Hurd * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20d933e97fSStephen Hurd * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21d933e97fSStephen Hurd * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22d933e97fSStephen Hurd * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23d933e97fSStephen Hurd * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24d933e97fSStephen Hurd * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25d933e97fSStephen Hurd * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26d933e97fSStephen Hurd * THE POSSIBILITY OF SUCH DAMAGE. 27d933e97fSStephen Hurd */ 28d933e97fSStephen Hurd 29d933e97fSStephen Hurd #include <sys/cdefs.h> 30d933e97fSStephen Hurd #ifndef _BNXT_HWRM_H 31d933e97fSStephen Hurd #define _BNXT_HWRM_H 32d933e97fSStephen Hurd 337b79d6d6SStephen Hurd #define BNXT_PAUSE_TX (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX) 347b79d6d6SStephen Hurd #define BNXT_PAUSE_RX (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) 357b79d6d6SStephen Hurd #define BNXT_AUTO_PAUSE_AUTONEG_PAUSE \ 367b79d6d6SStephen Hurd (HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_AUTONEG_PAUSE) 37980da9f2SStephen Hurd #define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) 382ed061f0SSumit Saxena #define BNXT_BACKING_STORE_CFG_LEGACY_LEN 256 397b79d6d6SStephen Hurd 40d933e97fSStephen Hurd /* HWRM Function Prototypes */ 41d933e97fSStephen Hurd int bnxt_alloc_hwrm_dma_mem(struct bnxt_softc *softc); 42d933e97fSStephen Hurd void bnxt_free_hwrm_dma_mem(struct bnxt_softc *softc); 43d933e97fSStephen Hurd int bnxt_hwrm_ring_alloc(struct bnxt_softc *softc, uint8_t type, 448945584fSSumit Saxena struct bnxt_ring *ring); 45055196a7SSumit Saxena int bnxt_hwrm_ring_free(struct bnxt_softc *softc, uint32_t type, 46055196a7SSumit Saxena struct bnxt_ring *ring, int cmpl_ring_id); 47d933e97fSStephen Hurd int bnxt_hwrm_ver_get(struct bnxt_softc *softc); 48d933e97fSStephen Hurd int bnxt_hwrm_queue_qportcfg(struct bnxt_softc *softc); 49d933e97fSStephen Hurd int bnxt_hwrm_func_drv_rgtr(struct bnxt_softc *softc); 50d933e97fSStephen Hurd int bnxt_hwrm_func_drv_unrgtr(struct bnxt_softc *softc, bool shutdown); 51d933e97fSStephen Hurd int bnxt_hwrm_func_qcaps(struct bnxt_softc *softc); 5296b2e63fSStephen Hurd int bnxt_hwrm_func_qcfg(struct bnxt_softc *softc); 53d933e97fSStephen Hurd int bnxt_hwrm_func_reset(struct bnxt_softc *softc); 547b79d6d6SStephen Hurd int bnxt_hwrm_set_link_setting(struct bnxt_softc *softc, bool set_pause, 557b79d6d6SStephen Hurd bool set_eee, bool set_link); 56d933e97fSStephen Hurd int bnxt_hwrm_set_pause(struct bnxt_softc *softc); 57d933e97fSStephen Hurd int bnxt_hwrm_vnic_ctx_alloc(struct bnxt_softc *softc, uint16_t *ctx_id); 58055196a7SSumit Saxena int bnxt_hwrm_vnic_ctx_free(struct bnxt_softc *softc, uint16_t ctx_id); 59055196a7SSumit Saxena int bnxt_hwrm_vnic_set_hds(struct bnxt_softc *sc, struct bnxt_vnic_info *vnic); 60d933e97fSStephen Hurd int bnxt_hwrm_vnic_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); 61055196a7SSumit Saxena int bnxt_hwrm_vnic_alloc(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); 62055196a7SSumit Saxena int bnxt_hwrm_vnic_free(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); 63d933e97fSStephen Hurd int bnxt_hwrm_stat_ctx_alloc(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr, 64d933e97fSStephen Hurd uint64_t paddr); 65055196a7SSumit Saxena int bnxt_hwrm_stat_ctx_free(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr); 6647516844SStephen Hurd int bnxt_hwrm_port_qstats(struct bnxt_softc *softc); 67d36b3662SChandrakanth Patil void bnxt_hwrm_port_qstats_ext(struct bnxt_softc *softc); 68d933e97fSStephen Hurd int bnxt_hwrm_ring_grp_alloc(struct bnxt_softc *softc, 69d933e97fSStephen Hurd struct bnxt_grp_info *grp); 70055196a7SSumit Saxena int bnxt_hwrm_ring_grp_free(struct bnxt_softc *softc, struct bnxt_grp_info *gr); 71d933e97fSStephen Hurd int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc, 72d933e97fSStephen Hurd struct bnxt_vnic_info *vnic); 7391fcacc3SSumit Saxena int bnxt_hwrm_set_filter(struct bnxt_softc *softc); 7491fcacc3SSumit Saxena int bnxt_hwrm_free_filter(struct bnxt_softc *softc); 7591fcacc3SSumit Saxena int bnxt_hwrm_l2_filter_alloc(struct bnxt_softc *softc, uint16_t vlan_tag, 7691fcacc3SSumit Saxena uint64_t *filter_id); 7791fcacc3SSumit Saxena int bnxt_hwrm_l2_filter_free(struct bnxt_softc *softc, uint64_t filter_id); 78d933e97fSStephen Hurd int bnxt_hwrm_rss_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic, 79d933e97fSStephen Hurd uint32_t hash_type); 8023e90483SStephen Hurd int bnxt_cfg_async_cr(struct bnxt_softc *softc); 8159059cdaSStephen Hurd int bnxt_hwrm_vnic_tpa_cfg(struct bnxt_softc *softc); 8259059cdaSStephen Hurd void bnxt_validate_hw_lro_settings(struct bnxt_softc *softc); 83d933e97fSStephen Hurd int bnxt_hwrm_nvm_find_dir_entry(struct bnxt_softc *softc, uint16_t type, 84d933e97fSStephen Hurd uint16_t *ordinal, uint16_t ext, uint16_t *index, bool use_index, 85d933e97fSStephen Hurd uint8_t search_opt, uint32_t *data_length, uint32_t *item_length, 86d933e97fSStephen Hurd uint32_t *fw_ver); 87d933e97fSStephen Hurd int bnxt_hwrm_nvm_read(struct bnxt_softc *softc, uint16_t index, 88d933e97fSStephen Hurd uint32_t offset, uint32_t length, struct iflib_dma_info *data); 89d933e97fSStephen Hurd int bnxt_hwrm_nvm_modify(struct bnxt_softc *softc, uint16_t index, 90d933e97fSStephen Hurd uint32_t offset, void *data, bool cpyin, uint32_t length); 91d933e97fSStephen Hurd int bnxt_hwrm_fw_reset(struct bnxt_softc *softc, uint8_t processor, 92d933e97fSStephen Hurd uint8_t *selfreset); 93d933e97fSStephen Hurd int bnxt_hwrm_fw_qstatus(struct bnxt_softc *softc, uint8_t type, 94d933e97fSStephen Hurd uint8_t *selfreset); 95d933e97fSStephen Hurd int bnxt_hwrm_nvm_write(struct bnxt_softc *softc, void *data, bool cpyin, 96d933e97fSStephen Hurd uint16_t type, uint16_t ordinal, uint16_t ext, uint16_t attr, 97d933e97fSStephen Hurd uint16_t option, uint32_t data_length, bool keep, uint32_t *item_length, 98d933e97fSStephen Hurd uint16_t *index); 99d933e97fSStephen Hurd int bnxt_hwrm_nvm_erase_dir_entry(struct bnxt_softc *softc, uint16_t index); 100d933e97fSStephen Hurd int bnxt_hwrm_nvm_get_dir_info(struct bnxt_softc *softc, uint32_t *entries, 101d933e97fSStephen Hurd uint32_t *entry_length); 102d933e97fSStephen Hurd int bnxt_hwrm_nvm_get_dir_entries(struct bnxt_softc *softc, 103d933e97fSStephen Hurd uint32_t *entries, uint32_t *entry_length, struct iflib_dma_info *dma_data); 104d933e97fSStephen Hurd int bnxt_hwrm_nvm_get_dev_info(struct bnxt_softc *softc, uint16_t *mfg_id, 105d933e97fSStephen Hurd uint16_t *device_id, uint32_t *sector_size, uint32_t *nvram_size, 106d933e97fSStephen Hurd uint32_t *reserved_size, uint32_t *available_size); 107d933e97fSStephen Hurd int bnxt_hwrm_nvm_install_update(struct bnxt_softc *softc, 108d933e97fSStephen Hurd uint32_t install_type, uint64_t *installed_items, uint8_t *result, 109d933e97fSStephen Hurd uint8_t *problem_item, uint8_t *reset_required); 110d933e97fSStephen Hurd int bnxt_hwrm_nvm_verify_update(struct bnxt_softc *softc, uint16_t type, 111d933e97fSStephen Hurd uint16_t ordinal, uint16_t ext); 112d933e97fSStephen Hurd int bnxt_hwrm_fw_get_time(struct bnxt_softc *softc, uint16_t *year, 113d933e97fSStephen Hurd uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *minute, 114d933e97fSStephen Hurd uint8_t *second, uint16_t *millisecond, uint16_t *zone); 115d933e97fSStephen Hurd int bnxt_hwrm_fw_set_time(struct bnxt_softc *softc, uint16_t year, 116d933e97fSStephen Hurd uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, 117d933e97fSStephen Hurd uint16_t millisecond, uint16_t zone); 118d933e97fSStephen Hurd int bnxt_hwrm_port_phy_qcfg(struct bnxt_softc *softc); 119c63d67e1SChandrakanth Patil int bnxt_hwrm_phy_qcaps(struct bnxt_softc *softc); 12064c9d60dSSean Bruno uint16_t bnxt_hwrm_get_wol_fltrs(struct bnxt_softc *softc, uint16_t handle); 12164c9d60dSSean Bruno int bnxt_hwrm_alloc_wol_fltr(struct bnxt_softc *softc); 12264c9d60dSSean Bruno int bnxt_hwrm_free_wol_fltr(struct bnxt_softc *softc); 1235a1813ecSSean Bruno int bnxt_hwrm_set_coal(struct bnxt_softc *softc); 1245a1813ecSSean Bruno int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc, unsigned long *bmap, 1255a1813ecSSean Bruno int bmap_size); 1268945584fSSumit Saxena int bnxt_hwrm_func_backing_store_qcaps(struct bnxt_softc *softc); 1278945584fSSumit Saxena int bnxt_hwrm_func_backing_store_cfg(struct bnxt_softc *softc, uint32_t); 1288945584fSSumit Saxena int bnxt_hwrm_func_resc_qcaps(struct bnxt_softc *softc, bool all); 1298945584fSSumit Saxena int bnxt_hwrm_reserve_pf_rings (struct bnxt_softc *softc); 1308945584fSSumit Saxena void bnxt_hwrm_ring_info_get(struct bnxt_softc *softc, uint8_t ring_type, 1318945584fSSumit Saxena uint32_t ring_id, uint32_t *prod, uint32_t *); 13258d84ef8SSumit Saxena int bnxt_hwrm_passthrough(struct bnxt_softc *softc, void *req, uint32_t req_len, 13358d84ef8SSumit Saxena void *resp, uint32_t resp_len, uint32_t timeout); 134d933e97fSStephen Hurd #endif 135