From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5E78CA04E1; Tue, 22 Sep 2020 10:50:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CFEB21D8CE; Tue, 22 Sep 2020 10:50:27 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id D952E1D6FA for ; Tue, 22 Sep 2020 10:50:14 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.144]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 6795B2005D for ; Tue, 22 Sep 2020 08:50:14 +0000 (UTC) Received: from us4-mdac16-2.at1.mdlocal (unknown [10.110.49.148]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 67245800A9 for ; Tue, 22 Sep 2020 08:50:14 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.8]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id E4DB74006F for ; Tue, 22 Sep 2020 08:50:13 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id AE3A74C0059 for ; Tue, 22 Sep 2020 08:50:13 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Sep 2020 09:50:09 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 22 Sep 2020 09:50:09 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 08M8o9DW004599 for ; Tue, 22 Sep 2020 09:50:09 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 458111613A9 for ; Tue, 22 Sep 2020 09:50:09 +0100 (BST) From: Andrew Rybchenko To: Date: Tue, 22 Sep 2020 09:49:01 +0100 Message-ID: <1600764594-14752-8-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600764594-14752-1-git-send-email-arybchenko@solarflare.com> References: <1600764594-14752-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25674.003 X-TM-AS-Result: No-7.886700-8.000000-10 X-TMASE-MatchedRID: 9ZfeEmZY6RH/xPKSgLvkLbzgL/eLACDEaeMaKzvXUpljLp8Cm8vwF7KB pljvKsfOfGzuoVn0Vs6PQi9XuOWoOC4MnFER4ZGiIf0TE1VduNsSUsfu0Jv3SvmeJRfwluYGm35 0w8/mtjl9nXBYBc7+9RLUZu/IHKwxHvtWdNrtrGoUnHnr/GbaT1WiBZGwRpH+2YOMBqtP/AFLFl bCyJ/C+ecxpG+880GgUyPx0ZosLZ9UwnXZllYh+r5k9lVEXoZaVFeUPAjsd8Yed11F9IsKFIaic YvSM3syozoW+JKZpxKwK143TKjuAgTsy5Ctk/ajSHCU59h5KrEdLjiwtocA8nQWhLVqLFM1sx9U DlVfYMZnHQJ2jUDp74Ay6p60ZV62fJ5/bZ6npdiyO81X3yak81gQYXZLQLSd28j/as3Groc1ZtN BlUZ4dD1QIRh+j2bVN9QaJL5xdy1+3BndfXUhXQ== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--7.886700-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25674.003 X-MDID: 1600764614-fq49_LnnJPaI Subject: [dpdk-dev] [PATCH 07/60] common/sfc_efx/base: use EF10 MCDI methods for Riverhead X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" MCDI on Riverhead is very close to the EF10 and there is no point to duplicate the code. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/ef10_mcdi.c | 46 ++++++++++++++++++++----- drivers/common/sfc_efx/base/efx.h | 8 ++--- drivers/common/sfc_efx/base/efx_impl.h | 4 +-- drivers/common/sfc_efx/base/efx_mcdi.c | 21 +++++++++++ 4 files changed, 65 insertions(+), 14 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_mcdi.c b/drivers/common/sfc_efx/base/ef10_mcdi.c index 9e8a0c1f69..727f14826e 100644 --- a/drivers/common/sfc_efx/base/ef10_mcdi.c +++ b/drivers/common/sfc_efx/base/ef10_mcdi.c @@ -8,7 +8,7 @@ #include "efx_impl.h" -#if EFX_OPTS_EF10() +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() #if EFSYS_OPT_MCDI @@ -27,7 +27,7 @@ ef10_mcdi_init( efx_dword_t dword; efx_rc_t rc; - EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); + EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp)); EFSYS_ASSERT(enp->en_features & EFX_FEATURE_MCDI_DMA); /* @@ -53,7 +53,16 @@ ef10_mcdi_init( goto fail2; } EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, 1); - EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + switch (enp->en_family) { +#if EFSYS_OPT_RIVERHEAD + case EFX_FAMILY_RIVERHEAD: + EFX_BAR_WRITED(enp, ER_GZ_MC_DB_HWRD_REG, &dword, B_FALSE); + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: + EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + break; + } /* Save initial MC reboot status */ (void) ef10_mcdi_poll_reboot(enp); @@ -133,7 +142,7 @@ ef10_mcdi_send_request( efx_dword_t dword; unsigned int pos; - EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); + EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp)); /* Write the header */ for (pos = 0; pos < hdr_len; pos += sizeof (efx_dword_t)) { @@ -154,11 +163,29 @@ ef10_mcdi_send_request( /* Ring the doorbell to post the command DMA address to the MC */ EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, EFSYS_MEM_ADDR(esmp) >> 32); - EFX_BAR_WRITED(enp, ER_DZ_MC_DB_LWRD_REG, &dword, B_FALSE); + switch (enp->en_family) { +#if EFSYS_OPT_RIVERHEAD + case EFX_FAMILY_RIVERHEAD: + EFX_BAR_WRITED(enp, ER_GZ_MC_DB_LWRD_REG, &dword, B_FALSE); + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: + EFX_BAR_WRITED(enp, ER_DZ_MC_DB_LWRD_REG, &dword, B_FALSE); + break; + } EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, EFSYS_MEM_ADDR(esmp) & 0xffffffff); - EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + switch (enp->en_family) { +#if EFSYS_OPT_RIVERHEAD + case EFX_FAMILY_RIVERHEAD: + EFX_BAR_WRITED(enp, ER_GZ_MC_DB_HWRD_REG, &dword, B_FALSE); + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: + EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + break; + } } __checkReturn boolean_t @@ -210,6 +237,9 @@ ef10_mcdi_poll_reboot( old_status = emip->emi_mc_reboot_status; + EFX_STATIC_ASSERT(ER_DZ_BIU_MC_SFT_STATUS_REG_OFST == + ER_GZ_MC_SFT_STATUS_OFST); + /* Update MC reboot status word */ EFX_BAR_TBL_READD(enp, ER_DZ_BIU_MC_SFT_STATUS_REG, 0, &dword, B_FALSE); new_status = dword.ed_u32[0]; @@ -255,7 +285,7 @@ ef10_mcdi_feature_supported( uint32_t privilege_mask = encp->enc_privilege_mask; efx_rc_t rc; - EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); + EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp)); /* * Use privilege mask state at MCDI attach. @@ -316,4 +346,4 @@ ef10_mcdi_feature_supported( #endif /* EFSYS_OPT_MCDI */ -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 2082efe023..c7fe814ca0 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -243,8 +243,8 @@ efx_nic_check_pcie_link_speed( #if EFSYS_OPT_MCDI -#if EFX_OPTS_EF10() -/* EF10 architecture NICs require MCDIv2 commands */ +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() +/* EF10 architecture and Riverhead NICs require MCDIv2 commands */ #define WITH_MCDI_V2 1 #endif @@ -1438,11 +1438,11 @@ typedef struct efx_nic_cfg_s { #if EFSYS_OPT_BIST uint32_t enc_bist_mask; #endif /* EFSYS_OPT_BIST */ -#if EFX_OPTS_EF10() +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() uint32_t enc_pf; uint32_t enc_vf; uint32_t enc_privilege_mask; -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ boolean_t enc_bug26807_workaround; boolean_t enc_bug35388_workaround; boolean_t enc_bug41750_workaround; diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index f891172086..c7edeaa000 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -37,9 +37,9 @@ #include "medford2_impl.h" #endif /* EFSYS_OPT_MEDFORD2 */ -#if EFX_OPTS_EF10() +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() #include "ef10_impl.h" -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ #ifdef __cplusplus extern "C" { diff --git a/drivers/common/sfc_efx/base/efx_mcdi.c b/drivers/common/sfc_efx/base/efx_mcdi.c index 8cd651f529..dec3a170a7 100644 --- a/drivers/common/sfc_efx/base/efx_mcdi.c +++ b/drivers/common/sfc_efx/base/efx_mcdi.c @@ -60,6 +60,21 @@ static const efx_mcdi_ops_t __efx_mcdi_ef10_ops = { #endif /* EFX_OPTS_EF10() */ +#if EFSYS_OPT_RIVERHEAD + +static const efx_mcdi_ops_t __efx_mcdi_rhead_ops = { + ef10_mcdi_init, /* emco_init */ + ef10_mcdi_send_request, /* emco_send_request */ + ef10_mcdi_poll_reboot, /* emco_poll_reboot */ + ef10_mcdi_poll_response, /* emco_poll_response */ + ef10_mcdi_read_response, /* emco_read_response */ + ef10_mcdi_fini, /* emco_fini */ + ef10_mcdi_feature_supported, /* emco_feature_supported */ + ef10_mcdi_get_timeout, /* emco_get_timeout */ +}; + +#endif /* EFSYS_OPT_RIVERHEAD */ + __checkReturn efx_rc_t @@ -98,6 +113,12 @@ efx_mcdi_init( break; #endif /* EFSYS_OPT_MEDFORD2 */ +#if EFSYS_OPT_RIVERHEAD + case EFX_FAMILY_RIVERHEAD: + emcop = &__efx_mcdi_rhead_ops; + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; -- 2.17.1