svn commit: r279143 - head/sys/dev/sfxge/common

Andrew Rybchenko arybchik at FreeBSD.org
Sun Feb 22 07:14:13 UTC 2015


Author: arybchik
Date: Sun Feb 22 07:14:12 2015
New Revision: 279143
URL: https://svnweb.freebsd.org/changeset/base/279143

Log:
  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)

Modified:
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_mcdi.c	Sun Feb 22 07:11:55 2015	(r279142)
+++ head/sys/dev/sfxge/common/efx_mcdi.c	Sun Feb 22 07:14:12 2015	(r279143)
@@ -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);


More information about the svn-src-all mailing list