From a3af33bef215d11536bf5cb8e3e5fddee0f14cce Mon Sep 17 00:00:00 2001 From: arybchik Date: Wed, 25 Mar 2015 11:07:56 +0000 Subject: [PATCH] MFC: 279143 sfxge: use common definitions of MC shared memory offsets and PDU length Submitted by: Ben Hutchings Sponsored by: Solarflare Communications, Inc. Approved by: gnn (mentor) git-svn-id: svn://svn.freebsd.org/base/stable/10@280565 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/sfxge/common/efx_mcdi.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/sys/dev/sfxge/common/efx_mcdi.c b/sys/dev/sfxge/common/efx_mcdi.c index 36221654c..5826c8af8 100644 --- a/sys/dev/sfxge/common/efx_mcdi.c +++ b/sys/dev/sfxge/common/efx_mcdi.c @@ -35,15 +35,6 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_MCDI -/* Shared memory layout */ - -#define MCDI_P1_DBL_OFST 0x0 -#define MCDI_P2_DBL_OFST 0x1 -#define MCDI_P1_PDU_OFST 0x2 -#define MCDI_P2_PDU_OFST 0x42 -#define MCDI_P1_REBOOT_OFST 0x1fe -#define MCDI_P2_REBOOT_OFST 0x1ff - /* * A reboot/assertion causes the MCDI status word to be set after the * command word is set or a REBOOT event is sent. If we notice a reboot @@ -72,12 +63,12 @@ efx_mcdi_request_start( switch (emip->emi_port) { case 1: - pdur = MCDI_P1_PDU_OFST; - dbr = MCDI_P1_DBL_OFST; + pdur = MC_SMEM_P0_PDU_OFST >> 2; + dbr = MC_SMEM_P0_DOORBELL_OFST >> 2; break; case 2: - pdur = MCDI_P2_PDU_OFST; - dbr = MCDI_P2_DBL_OFST; + pdur = MC_SMEM_P1_PDU_OFST >> 2; + dbr = MC_SMEM_P1_DOORBELL_OFST >> 2; break; default: EFSYS_ASSERT(0); @@ -140,7 +131,9 @@ efx_mcdi_request_copyout( unsigned int pdur; efx_dword_t data; - pdur = (emip->emi_port == 1) ? MCDI_P1_PDU_OFST : MCDI_P2_PDU_OFST; + pdur = (emip->emi_port == 1) + ? MC_SMEM_P0_PDU_OFST >> 2 + : MC_SMEM_P1_PDU_OFST >> 2; /* Copy payload out if caller supplied buffer */ if (emrp->emr_out_buf != NULL) { @@ -227,8 +220,8 @@ efx_mcdi_poll_reboot( EFSYS_ASSERT(emip->emi_port == 1 || emip->emi_port == 2); rebootr = ((emip->emi_port == 1) - ? MCDI_P1_REBOOT_OFST - : MCDI_P2_REBOOT_OFST); + ? MC_SMEM_P0_STATUS_OFST >> 2 + : MC_SMEM_P1_STATUS_OFST >> 2); EFX_BAR_TBL_READD(enp, FR_CZ_MC_TREG_SMEM, rebootr, &dword, B_FALSE); value = EFX_DWORD_FIELD(dword, EFX_DWORD_0); @@ -281,7 +274,9 @@ efx_mcdi_request_poll( } EFSYS_ASSERT(emip->emi_port == 1 || emip->emi_port == 2); - pdur = (emip->emi_port == 1) ? MCDI_P1_PDU_OFST : MCDI_P2_PDU_OFST; + pdur = (emip->emi_port == 1) + ? MC_SMEM_P0_PDU_OFST >> 2 + : MC_SMEM_P1_PDU_OFST >> 2; /* Read the command header */ EFX_BAR_TBL_READD(enp, FR_CZ_MC_TREG_SMEM, pdur, &dword, B_FALSE); -- 2.45.0