11590Srgrimes/* Broadcom NetXtreme-C/E network driver. 21590Srgrimes * 31590Srgrimes * Copyright (c) 2017 Broadcom Limited 41590Srgrimes * 51590Srgrimes * This program is free software; you can redistribute it and/or modify 61590Srgrimes * it under the terms of the GNU General Public License as published by 71590Srgrimes * the Free Software Foundation. 81590Srgrimes */ 91590Srgrimes 101590Srgrimes#ifndef BNXT_DEVLINK_H 111590Srgrimes#define BNXT_DEVLINK_H 121590Srgrimes 131590Srgrimes/* Struct to hold housekeeping info needed by devlink interface */ 141590Srgrimesstruct bnxt_dl { 151590Srgrimes struct bnxt *bp; /* back ptr to the controlling dev */ 161590Srgrimes bool remote_reset; 171590Srgrimes}; 181590Srgrimes 191590Srgrimesstatic inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl) 201590Srgrimes{ 211590Srgrimes return ((struct bnxt_dl *)devlink_priv(dl))->bp; 221590Srgrimes} 231590Srgrimes 241590Srgrimesstatic inline void bnxt_dl_remote_reload(struct bnxt *bp) 251590Srgrimes{ 261590Srgrimes devlink_remote_reload_actions_performed(bp->dl, 0, 271590Srgrimes BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | 281590Srgrimes BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE)); 291590Srgrimes} 301590Srgrimes 311590Srgrimesstatic inline bool bnxt_dl_get_remote_reset(struct devlink *dl) 321590Srgrimes{ 331590Srgrimes return ((struct bnxt_dl *)devlink_priv(dl))->remote_reset; 3428794Scharnier} 351590Srgrimes 361590Srgrimesstatic inline void bnxt_dl_set_remote_reset(struct devlink *dl, bool value) 3787682Smarkm{ 381590Srgrimes ((struct bnxt_dl *)devlink_priv(dl))->remote_reset = value; 3991378Sdwmalone} 401590Srgrimes 4191378Sdwmalone#define NVM_OFF_MSIX_VEC_PER_PF_MAX 108 4228794Scharnier#define NVM_OFF_MSIX_VEC_PER_PF_MIN 114 4391378Sdwmalone#define NVM_OFF_IGNORE_ARI 164 441590Srgrimes#define NVM_OFF_DIS_GRE_VER_CHECK 171 4591378Sdwmalone#define NVM_OFF_ENABLE_SRIOV 401 4691378Sdwmalone#define NVM_OFF_NVM_CFG_VER 602 4791378Sdwmalone 481590Srgrimes#define BNXT_NVM_CFG_VER_BITS 8 491590Srgrimes#define BNXT_NVM_CFG_VER_BYTES 1 501590Srgrimes 511590Srgrimes#define BNXT_MSIX_VEC_MAX 512 521590Srgrimes#define BNXT_MSIX_VEC_MIN_MAX 128 531590Srgrimes 5428794Scharnierenum bnxt_nvm_dir_type { 5529430Sache BNXT_NVM_SHARED_CFG = 40, 5619190Salex BNXT_NVM_PORT_CFG, 571590Srgrimes BNXT_NVM_FUNC_CFG, 581590Srgrimes}; 5991378Sdwmalone 601590Srgrimesstruct bnxt_dl_nvm_param { 6128794Scharnier u16 id; 62202200Sed u16 offset; 63231586Sglebius u16 dir_type; 64231586Sglebius u16 nvm_num_bits; 651590Srgrimes u8 dl_num_bytes; 6692922Simp}; 6792922Simp 6892922Simpenum bnxt_dl_version_type { 6992922Simp BNXT_VERSION_FIXED, 70231586Sglebius BNXT_VERSION_RUNNING, 7192922Simp BNXT_VERSION_STORED, 7292922Simp}; 731590Srgrimes 7428794Scharniervoid bnxt_devlink_health_fw_report(struct bnxt *bp); 75102944Sdwmalonevoid bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy); 761590Srgrimesvoid bnxt_dl_health_fw_recovery_done(struct bnxt *bp); 771590Srgrimesvoid bnxt_dl_fw_reporters_create(struct bnxt *bp); 781590Srgrimesvoid bnxt_dl_fw_reporters_destroy(struct bnxt *bp); 791590Srgrimesint bnxt_dl_register(struct bnxt *bp); 8028794Scharniervoid bnxt_dl_unregister(struct bnxt *bp); 811590Srgrimes 8229430Sache#endif /* BNXT_DEVLINK_H */ 8329430Sache