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

Andrew Rybchenko arybchik at FreeBSD.org
Tue Jan 12 06:32:58 UTC 2016


Author: arybchik
Date: Tue Jan 12 06:32:56 2016
New Revision: 293731
URL: https://svnweb.freebsd.org/changeset/base/293731

Log:
  sfxge: add Medford PCI IDs to common code
  
  Submitted by:   Mark Spender <mspender at solarflare.com>
  Reviewed by:    gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      2 days
  Differential Revision: https://reviews.freebsd.org/D4856

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_nic.c

Modified: head/sys/dev/sfxge/common/efx.h
==============================================================================
--- head/sys/dev/sfxge/common/efx.h	Tue Jan 12 06:29:17 2016	(r293730)
+++ head/sys/dev/sfxge/common/efx.h	Tue Jan 12 06:32:56 2016	(r293731)
@@ -61,6 +61,7 @@ typedef enum efx_family_e {
 	EFX_FAMILY_FALCON,
 	EFX_FAMILY_SIENA,
 	EFX_FAMILY_HUNTINGTON,
+	EFX_FAMILY_MEDFORD,
 	EFX_FAMILY_NTYPES
 } efx_family_t;
 
@@ -90,6 +91,9 @@ efx_infer_family(
 #define	EFX_PCI_DEVID_FARMINGDALE_VF		0x1903	/* SFC9120 VF */
 #define	EFX_PCI_DEVID_GREENPORT_VF		0x1923	/* SFC9140 VF */
 
+#define	EFX_PCI_DEVID_MEDFORD_PF_UNINIT		0x0913
+#define	EFX_PCI_DEVID_MEDFORD			0x0A03	/* SFC9240 PF */
+#define	EFX_PCI_DEVID_MEDFORD_VF		0x1A03	/* SFC9240 VF */
 
 #define	EFX_MEM_BAR	2
 
@@ -1153,11 +1157,11 @@ typedef struct efx_nic_cfg_s {
 #if EFSYS_OPT_BIST
 	uint32_t		enc_bist_mask;
 #endif	/* EFSYS_OPT_BIST */
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
 	uint32_t		enc_pf;
 	uint32_t		enc_vf;
 	uint32_t		enc_privilege_mask;
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
 	boolean_t		enc_bug26807_workaround;
 	boolean_t		enc_bug35388_workaround;
 	boolean_t		enc_bug41750_workaround;

Modified: head/sys/dev/sfxge/common/efx_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/efx_impl.h	Tue Jan 12 06:29:17 2016	(r293730)
+++ head/sys/dev/sfxge/common/efx_impl.h	Tue Jan 12 06:32:56 2016	(r293731)
@@ -797,6 +797,10 @@ struct efx_txq_s {
 			rev = 'D';					\
 			break;						\
 									\
+		case EFX_FAMILY_MEDFORD:				\
+			rev = 'E';					\
+			break;						\
+									\
 		default:						\
 			rev = '?';					\
 			break;						\

Modified: head/sys/dev/sfxge/common/efx_nic.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_nic.c	Tue Jan 12 06:29:17 2016	(r293730)
+++ head/sys/dev/sfxge/common/efx_nic.c	Tue Jan 12 06:32:56 2016	(r293731)
@@ -49,7 +49,8 @@ efx_family(
 		case EFX_PCI_DEVID_FALCON:
 			*efp = EFX_FAMILY_FALCON;
 			return (0);
-#endif
+#endif /* EFSYS_OPT_FALCON */
+
 #if EFSYS_OPT_SIENA
 		case EFX_PCI_DEVID_SIENA_F1_UNINIT:
 			/*
@@ -63,7 +64,7 @@ efx_family(
 		case EFX_PCI_DEVID_SIENA:
 			*efp = EFX_FAMILY_SIENA;
 			return (0);
-#endif
+#endif /* EFSYS_OPT_SIENA */
 
 #if EFSYS_OPT_HUNTINGTON
 		case EFX_PCI_DEVID_HUNTINGTON_PF_UNINIT:
@@ -83,7 +84,26 @@ efx_family(
 		case EFX_PCI_DEVID_GREENPORT_VF:
 			*efp = EFX_FAMILY_HUNTINGTON;
 			return (0);
-#endif
+#endif /* EFSYS_OPT_HUNTINGTON */
+
+#if EFSYS_OPT_MEDFORD
+		case EFX_PCI_DEVID_MEDFORD_PF_UNINIT:
+			/*
+			 * Hardware default for PF0 of uninitialised Medford.
+			 * manftest must be able to cope with this device id.
+			 */
+			*efp = EFX_FAMILY_MEDFORD;
+			return (0);
+
+		case EFX_PCI_DEVID_MEDFORD:
+			*efp = EFX_FAMILY_MEDFORD;
+			return (0);
+
+		case EFX_PCI_DEVID_MEDFORD_VF:
+			*efp = EFX_FAMILY_MEDFORD;
+			return (0);
+#endif /* EFSYS_OPT_MEDFORD */
+
 		default:
 			break;
 		}
@@ -110,8 +130,12 @@ efx_infer_family(
 
 	EFSYS_BAR_READO(esbp, FR_AZ_CS_DEBUG_REG_OFST, &oword, B_TRUE);
 	portnum = EFX_OWORD_FIELD(oword, FRF_CZ_CS_PORT_NUM);
-	switch (portnum) {
-	case 0: {
+	if ((portnum == 1) || (portnum == 2)) {
+#if EFSYS_OPT_SIENA
+		family = EFX_FAMILY_SIENA;
+		goto out;
+#endif
+	} else if (portnum == 0) {
 		efx_dword_t dword;
 		uint32_t hw_rev;
 
@@ -119,31 +143,25 @@ efx_infer_family(
 		    B_TRUE);
 		hw_rev = EFX_DWORD_FIELD(dword, ERF_DZ_HW_REV_ID);
 		if (hw_rev == ER_DZ_BIU_HW_REV_ID_REG_RESET) {
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
+			/*
+			 * BIU_HW_REV_ID is the same for Huntington and Medford.
+			 * Assume Huntington, as Medford is very similar.
+			 */
 			family = EFX_FAMILY_HUNTINGTON;
-			break;
+			goto out;
 #endif
 		} else {
 #if EFSYS_OPT_FALCON
 			family = EFX_FAMILY_FALCON;
-			break;
+			goto out;
 #endif
 		}
-		rc = ENOTSUP;
-		goto fail1;
-	}
-
-#if EFSYS_OPT_SIENA
-	case 1:
-	case 2:
-		family = EFX_FAMILY_SIENA;
-		break;
-#endif
-	default:
-		rc = ENOTSUP;
-		goto fail1;
 	}
+	rc = ENOTSUP;
+	goto fail1;
 
+out:
 	if (efp != NULL)
 		*efp = family;
 	return (0);


More information about the svn-src-all mailing list