135b53f8cSChandrakanth patil /*- 235b53f8cSChandrakanth patil * Broadcom NetXtreme-C/E network driver. 335b53f8cSChandrakanth patil * 435b53f8cSChandrakanth patil * Copyright (c) 2016 Broadcom, All Rights Reserved. 535b53f8cSChandrakanth patil * The term Broadcom refers to Broadcom Limited and/or its subsidiaries 635b53f8cSChandrakanth patil * 735b53f8cSChandrakanth patil * Redistribution and use in source and binary forms, with or without 835b53f8cSChandrakanth patil * modification, are permitted provided that the following conditions 935b53f8cSChandrakanth patil * are met: 1035b53f8cSChandrakanth patil * 1. Redistributions of source code must retain the above copyright 1135b53f8cSChandrakanth patil * notice, this list of conditions and the following disclaimer. 1235b53f8cSChandrakanth patil * 2. Redistributions in binary form must reproduce the above copyright 1335b53f8cSChandrakanth patil * notice, this list of conditions and the following disclaimer in the 1435b53f8cSChandrakanth patil * documentation and/or other materials provided with the distribution. 1535b53f8cSChandrakanth patil * 1635b53f8cSChandrakanth patil * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' 1735b53f8cSChandrakanth patil * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1835b53f8cSChandrakanth patil * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1935b53f8cSChandrakanth patil * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 2035b53f8cSChandrakanth patil * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2135b53f8cSChandrakanth patil * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2235b53f8cSChandrakanth patil * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2335b53f8cSChandrakanth patil * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2435b53f8cSChandrakanth patil * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2535b53f8cSChandrakanth patil * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 2635b53f8cSChandrakanth patil * THE POSSIBILITY OF SUCH DAMAGE. 2735b53f8cSChandrakanth patil */ 2835b53f8cSChandrakanth patil 2935b53f8cSChandrakanth patil #include <sys/cdefs.h> 3035b53f8cSChandrakanth patil #ifndef _BNXT_HWRM_H 3135b53f8cSChandrakanth patil #define _BNXT_HWRM_H 3235b53f8cSChandrakanth patil 3335b53f8cSChandrakanth patil #define BNXT_PAUSE_TX (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX) 3435b53f8cSChandrakanth patil #define BNXT_PAUSE_RX (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) 3535b53f8cSChandrakanth patil #define BNXT_AUTO_PAUSE_AUTONEG_PAUSE \ 3635b53f8cSChandrakanth patil (HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_AUTONEG_PAUSE) 3735b53f8cSChandrakanth patil #define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) 3835b53f8cSChandrakanth patil #define BNXT_BACKING_STORE_CFG_LEGACY_LEN 256 39*c9965974SChandrakanth patil #define SHORT_HWRM_CMD_TIMEOUT 500 4035b53f8cSChandrakanth patil 4135b53f8cSChandrakanth patil /* HWRM Function Prototypes */ 42050d28e1SChandrakanth patil int 43050d28e1SChandrakanth patil hwrm_send_message(struct bnxt_softc *softc, void *msg, uint32_t msg_len); 4435b53f8cSChandrakanth patil int bnxt_alloc_hwrm_dma_mem(struct bnxt_softc *softc); 4535b53f8cSChandrakanth patil void bnxt_free_hwrm_dma_mem(struct bnxt_softc *softc); 4635b53f8cSChandrakanth patil int bnxt_hwrm_ring_alloc(struct bnxt_softc *softc, uint8_t type, 4735b53f8cSChandrakanth patil struct bnxt_ring *ring); 4835b53f8cSChandrakanth patil int bnxt_hwrm_ring_free(struct bnxt_softc *softc, uint32_t type, 4935b53f8cSChandrakanth patil struct bnxt_ring *ring, int cmpl_ring_id); 5035b53f8cSChandrakanth patil int bnxt_hwrm_ver_get(struct bnxt_softc *softc); 5135b53f8cSChandrakanth patil int bnxt_hwrm_queue_qportcfg(struct bnxt_softc *softc, uint32_t path_dir); 52*c9965974SChandrakanth patil int bnxt_hwrm_func_drv_rgtr(struct bnxt_softc *bp, unsigned long *bmap, int bmap_size, 53*c9965974SChandrakanth patil bool async_only); 5435b53f8cSChandrakanth patil int bnxt_hwrm_func_drv_unrgtr(struct bnxt_softc *softc, bool shutdown); 5535b53f8cSChandrakanth patil int bnxt_hwrm_func_qcaps(struct bnxt_softc *softc); 5635b53f8cSChandrakanth patil int bnxt_hwrm_func_qcfg(struct bnxt_softc *softc); 5735b53f8cSChandrakanth patil int bnxt_hwrm_func_reset(struct bnxt_softc *softc); 5835b53f8cSChandrakanth patil int bnxt_hwrm_set_link_setting(struct bnxt_softc *softc, bool set_pause, 5935b53f8cSChandrakanth patil bool set_eee, bool set_link); 6035b53f8cSChandrakanth patil int bnxt_hwrm_set_pause(struct bnxt_softc *softc); 6135b53f8cSChandrakanth patil int bnxt_hwrm_vnic_ctx_alloc(struct bnxt_softc *softc, uint16_t *ctx_id); 6235b53f8cSChandrakanth patil int bnxt_hwrm_vnic_ctx_free(struct bnxt_softc *softc, uint16_t ctx_id); 6335b53f8cSChandrakanth patil int bnxt_hwrm_vnic_set_hds(struct bnxt_softc *sc, struct bnxt_vnic_info *vnic); 6435b53f8cSChandrakanth patil int bnxt_hwrm_vnic_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); 6535b53f8cSChandrakanth patil int bnxt_hwrm_vnic_alloc(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); 6635b53f8cSChandrakanth patil int bnxt_hwrm_vnic_free(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); 6735b53f8cSChandrakanth patil int bnxt_hwrm_stat_ctx_alloc(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr, 6835b53f8cSChandrakanth patil uint64_t paddr); 6935b53f8cSChandrakanth patil int bnxt_hwrm_stat_ctx_free(struct bnxt_softc *softc, struct bnxt_cp_ring *cpr); 7035b53f8cSChandrakanth patil int bnxt_hwrm_port_qstats(struct bnxt_softc *softc); 71032899b5SChandrakanth patil int bnxt_hwrm_port_qstats_ext(struct bnxt_softc *softc); 7235b53f8cSChandrakanth patil int bnxt_hwrm_ring_grp_alloc(struct bnxt_softc *softc, 7335b53f8cSChandrakanth patil struct bnxt_grp_info *grp); 7435b53f8cSChandrakanth patil int bnxt_hwrm_ring_grp_free(struct bnxt_softc *softc, struct bnxt_grp_info *gr); 7535b53f8cSChandrakanth patil int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc, 7635b53f8cSChandrakanth patil struct bnxt_vnic_info *vnic); 7735b53f8cSChandrakanth patil int bnxt_hwrm_set_filter(struct bnxt_softc *softc); 7835b53f8cSChandrakanth patil int bnxt_hwrm_free_filter(struct bnxt_softc *softc); 7935b53f8cSChandrakanth patil int bnxt_hwrm_l2_filter_alloc(struct bnxt_softc *softc, uint16_t vlan_tag, 8035b53f8cSChandrakanth patil uint64_t *filter_id); 8135b53f8cSChandrakanth patil int bnxt_hwrm_l2_filter_free(struct bnxt_softc *softc, uint64_t filter_id); 8235b53f8cSChandrakanth patil int bnxt_hwrm_rss_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic, 8335b53f8cSChandrakanth patil uint32_t hash_type); 8435b53f8cSChandrakanth patil int bnxt_cfg_async_cr(struct bnxt_softc *softc); 8535b53f8cSChandrakanth patil int bnxt_hwrm_vnic_tpa_cfg(struct bnxt_softc *softc); 8635b53f8cSChandrakanth patil void bnxt_validate_hw_lro_settings(struct bnxt_softc *softc); 8735b53f8cSChandrakanth patil int bnxt_hwrm_nvm_find_dir_entry(struct bnxt_softc *softc, uint16_t type, 8835b53f8cSChandrakanth patil uint16_t *ordinal, uint16_t ext, uint16_t *index, bool use_index, 8935b53f8cSChandrakanth patil uint8_t search_opt, uint32_t *data_length, uint32_t *item_length, 9035b53f8cSChandrakanth patil uint32_t *fw_ver); 9135b53f8cSChandrakanth patil int bnxt_hwrm_nvm_read(struct bnxt_softc *softc, uint16_t index, 9235b53f8cSChandrakanth patil uint32_t offset, uint32_t length, struct iflib_dma_info *data); 9335b53f8cSChandrakanth patil int bnxt_hwrm_nvm_modify(struct bnxt_softc *softc, uint16_t index, 9435b53f8cSChandrakanth patil uint32_t offset, void *data, bool cpyin, uint32_t length); 9535b53f8cSChandrakanth patil int bnxt_hwrm_fw_reset(struct bnxt_softc *softc, uint8_t processor, 9635b53f8cSChandrakanth patil uint8_t *selfreset); 9735b53f8cSChandrakanth patil int bnxt_hwrm_fw_qstatus(struct bnxt_softc *softc, uint8_t type, 9835b53f8cSChandrakanth patil uint8_t *selfreset); 9935b53f8cSChandrakanth patil int bnxt_hwrm_nvm_write(struct bnxt_softc *softc, void *data, bool cpyin, 10035b53f8cSChandrakanth patil uint16_t type, uint16_t ordinal, uint16_t ext, uint16_t attr, 10135b53f8cSChandrakanth patil uint16_t option, uint32_t data_length, bool keep, uint32_t *item_length, 10235b53f8cSChandrakanth patil uint16_t *index); 10335b53f8cSChandrakanth patil int bnxt_hwrm_nvm_erase_dir_entry(struct bnxt_softc *softc, uint16_t index); 10435b53f8cSChandrakanth patil int bnxt_hwrm_nvm_get_dir_info(struct bnxt_softc *softc, uint32_t *entries, 10535b53f8cSChandrakanth patil uint32_t *entry_length); 10635b53f8cSChandrakanth patil int bnxt_hwrm_nvm_get_dir_entries(struct bnxt_softc *softc, 10735b53f8cSChandrakanth patil uint32_t *entries, uint32_t *entry_length, struct iflib_dma_info *dma_data); 10835b53f8cSChandrakanth patil int bnxt_hwrm_nvm_get_dev_info(struct bnxt_softc *softc, uint16_t *mfg_id, 10935b53f8cSChandrakanth patil uint16_t *device_id, uint32_t *sector_size, uint32_t *nvram_size, 11035b53f8cSChandrakanth patil uint32_t *reserved_size, uint32_t *available_size); 11135b53f8cSChandrakanth patil int bnxt_hwrm_nvm_install_update(struct bnxt_softc *softc, 11235b53f8cSChandrakanth patil uint32_t install_type, uint64_t *installed_items, uint8_t *result, 11335b53f8cSChandrakanth patil uint8_t *problem_item, uint8_t *reset_required); 11435b53f8cSChandrakanth patil int bnxt_hwrm_nvm_verify_update(struct bnxt_softc *softc, uint16_t type, 11535b53f8cSChandrakanth patil uint16_t ordinal, uint16_t ext); 11635b53f8cSChandrakanth patil int bnxt_hwrm_fw_get_time(struct bnxt_softc *softc, uint16_t *year, 11735b53f8cSChandrakanth patil uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *minute, 11835b53f8cSChandrakanth patil uint8_t *second, uint16_t *millisecond, uint16_t *zone); 11935b53f8cSChandrakanth patil int bnxt_hwrm_fw_set_time(struct bnxt_softc *softc, uint16_t year, 12035b53f8cSChandrakanth patil uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, 12135b53f8cSChandrakanth patil uint16_t millisecond, uint16_t zone); 12235b53f8cSChandrakanth patil int bnxt_hwrm_port_phy_qcfg(struct bnxt_softc *softc); 12335b53f8cSChandrakanth patil int bnxt_hwrm_phy_qcaps(struct bnxt_softc *softc); 12435b53f8cSChandrakanth patil uint16_t bnxt_hwrm_get_wol_fltrs(struct bnxt_softc *softc, uint16_t handle); 12535b53f8cSChandrakanth patil int bnxt_hwrm_alloc_wol_fltr(struct bnxt_softc *softc); 12635b53f8cSChandrakanth patil int bnxt_hwrm_free_wol_fltr(struct bnxt_softc *softc); 12735b53f8cSChandrakanth patil int bnxt_hwrm_set_coal(struct bnxt_softc *softc); 12835b53f8cSChandrakanth patil int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc, unsigned long *bmap, 12935b53f8cSChandrakanth patil int bmap_size); 13035b53f8cSChandrakanth patil int bnxt_hwrm_func_backing_store_qcaps(struct bnxt_softc *softc); 13135b53f8cSChandrakanth patil int bnxt_hwrm_func_backing_store_cfg(struct bnxt_softc *softc, uint32_t); 132050d28e1SChandrakanth patil int bnxt_hwrm_func_backing_store_cfg_v2(struct bnxt_softc *softc, 133050d28e1SChandrakanth patil struct bnxt_ctx_mem_type *ctxm, 134050d28e1SChandrakanth patil bool last); 13535b53f8cSChandrakanth patil int bnxt_hwrm_func_resc_qcaps(struct bnxt_softc *softc, bool all); 13635b53f8cSChandrakanth patil int bnxt_hwrm_reserve_pf_rings (struct bnxt_softc *softc); 13735b53f8cSChandrakanth patil void bnxt_hwrm_ring_info_get(struct bnxt_softc *softc, uint8_t ring_type, 13835b53f8cSChandrakanth patil uint32_t ring_id, uint32_t *prod, uint32_t *); 13935b53f8cSChandrakanth patil int bnxt_hwrm_passthrough(struct bnxt_softc *softc, void *req, uint32_t req_len, 14035b53f8cSChandrakanth patil void *resp, uint32_t resp_len, uint32_t timeout); 14135b53f8cSChandrakanth patil int _hwrm_send_message(struct bnxt_softc *, void *, uint32_t); 14235b53f8cSChandrakanth patil int hwrm_send_message(struct bnxt_softc *, void *, uint32_t); 14335b53f8cSChandrakanth patil void bnxt_hwrm_cmd_hdr_init(struct bnxt_softc *, void *, uint16_t); 14435b53f8cSChandrakanth patil #endif 145