From owner-svn-src-stable@freebsd.org Wed Oct 17 01:05:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5534110E6CDD; Wed, 17 Oct 2018 01:05:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B66789624; Wed, 17 Oct 2018 01:05:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05BCB2462E; Wed, 17 Oct 2018 01:05:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H15qcw065225; Wed, 17 Oct 2018 01:05:52 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H15q2M065224; Wed, 17 Oct 2018 01:05:52 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170105.w9H15q2M065224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 01:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339398 - stable/11/sys/dev/cxgbe/common X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe/common X-SVN-Commit-Revision: 339398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 01:05:53 -0000 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; } /*