svn commit: r339398 - stable/11/sys/dev/cxgbe/common

Navdeep Parhar np at FreeBSD.org
Wed Oct 17 01:05:53 UTC 2018


Author: np
Date: Wed Oct 17 01:05:52 2018
New Revision: 339398
URL: https://svnweb.freebsd.org/changeset/base/339398

Log:
  MFC r336042:
  
  cxgbe(4): Assume that any unknown flash on the card is 4MB and has 64KB
  sectors, instead of refusing to attach to the card.
  
  Submitted by:	Casey Leedom @ Chelsio
  Sponsored by:	Chelsio Communications

Modified:
  stable/11/sys/dev/cxgbe/common/t4_hw.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- stable/11/sys/dev/cxgbe/common/t4_hw.c	Wed Oct 17 00:57:28 2018	(r339397)
+++ stable/11/sys/dev/cxgbe/common/t4_hw.c	Wed Oct 17 01:05:52 2018	(r339398)
@@ -7844,7 +7844,7 @@ int t4_get_flash_params(struct adapter *adapter)
 	int ret;
 	u32 flashid = 0;
 	unsigned int part, manufacturer;
-	unsigned int density, size;
+	unsigned int density, size = 0;
 
 
 	/*
@@ -7883,7 +7883,7 @@ int t4_get_flash_params(struct adapter *adapter)
 	 */
 	manufacturer = flashid & 0xff;
 	switch (manufacturer) {
-	case 0x20: { /* Micron/Numonix */
+	case 0x20: /* Micron/Numonix */
 		/*
 		 * This Density -> Size decoding table is taken from Micron
 		 * Data Sheets.
@@ -7899,17 +7899,10 @@ int t4_get_flash_params(struct adapter *adapter)
 		case 0x20: size = 1 << 26; break; /*  64MB */
 		case 0x21: size = 1 << 27; break; /* 128MB */
 		case 0x22: size = 1 << 28; break; /* 256MB */
-
-		default:
-			CH_ERR(adapter, "Micron Flash Part has bad size, "
-			       "ID = %#x, Density code = %#x\n",
-			       flashid, density);
-			return -EINVAL;
 		}
 		break;
-	}
 
-	case 0x9d: { /* ISSI -- Integrated Silicon Solution, Inc. */
+	case 0x9d: /* ISSI -- Integrated Silicon Solution, Inc. */
 		/*
 		 * This Density -> Size decoding table is taken from ISSI
 		 * Data Sheets.
@@ -7918,17 +7911,10 @@ int t4_get_flash_params(struct adapter *adapter)
 		switch (density) {
 		case 0x16: size = 1 << 25; break; /*  32MB */
 		case 0x17: size = 1 << 26; break; /*  64MB */
-
-		default:
-			CH_ERR(adapter, "ISSI Flash Part has bad size, "
-			       "ID = %#x, Density code = %#x\n",
-			       flashid, density);
-			return -EINVAL;
 		}
 		break;
-	}
 
-	case 0xc2: { /* Macronix */
+	case 0xc2: /* Macronix */
 		/*
 		 * This Density -> Size decoding table is taken from Macronix
 		 * Data Sheets.
@@ -7937,17 +7923,10 @@ int t4_get_flash_params(struct adapter *adapter)
 		switch (density) {
 		case 0x17: size = 1 << 23; break; /*   8MB */
 		case 0x18: size = 1 << 24; break; /*  16MB */
-
-		default:
-			CH_ERR(adapter, "Macronix Flash Part has bad size, "
-			       "ID = %#x, Density code = %#x\n",
-			       flashid, density);
-			return -EINVAL;
 		}
 		break;
-	}
 
-	case 0xef: { /* Winbond */
+	case 0xef: /* Winbond */
 		/*
 		 * This Density -> Size decoding table is taken from Winbond
 		 * Data Sheets.
@@ -7956,19 +7935,19 @@ int t4_get_flash_params(struct adapter *adapter)
 		switch (density) {
 		case 0x17: size = 1 << 23; break; /*   8MB */
 		case 0x18: size = 1 << 24; break; /*  16MB */
-
-		default:
-			CH_ERR(adapter, "Winbond Flash Part has bad size, "
-			       "ID = %#x, Density code = %#x\n",
-			       flashid, density);
-			return -EINVAL;
 		}
 		break;
 	}
 
-	default:
-		CH_ERR(adapter, "Unsupported Flash Part, ID = %#x\n", flashid);
-		return -EINVAL;
+	/* If we didn't recognize the FLASH part, that's no real issue: the
+	 * Hardware/Software contract says that Hardware will _*ALWAYS*_
+	 * use a FLASH part which is at least 4MB in size and has 64KB
+	 * sectors.  The unrecognized FLASH part is likely to be much larger
+	 * than 4MB, but that's all we really need.
+	 */
+	if (size == 0) {
+		CH_WARN(adapter, "Unknown Flash Part, ID = %#x, assuming 4MB\n", flashid);
+		size = 1 << 22;
 	}
 
 	/*


More information about the svn-src-all mailing list