Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jul 2018 19:33:58 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336042 - head/sys/dev/cxgbe/common
Message-ID:  <201807061933.w66JXwOn075673@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Fri Jul  6 19:33:58 2018
New Revision: 336042
URL: https://svnweb.freebsd.org/changeset/base/336042

Log:
  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
  MFC after:	3 days
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/common/t4_hw.c

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- head/sys/dev/cxgbe/common/t4_hw.c	Fri Jul  6 19:18:45 2018	(r336041)
+++ head/sys/dev/cxgbe/common/t4_hw.c	Fri Jul  6 19:33:58 2018	(r336042)
@@ -7910,7 +7910,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;
 
 
 	/*
@@ -7949,7 +7949,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.
@@ -7965,17 +7965,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.
@@ -7984,17 +7977,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.
@@ -8003,17 +7989,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.
@@ -8022,19 +8001,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;
 	}
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807061933.w66JXwOn075673>