From owner-svn-src-head@freebsd.org Fri Jul 6 19:33:59 2018 Return-Path: Delivered-To: svn-src-head@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 0F366102329D; Fri, 6 Jul 2018 19:33:59 +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 B517C92DC4; Fri, 6 Jul 2018 19:33:58 +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 964825205; Fri, 6 Jul 2018 19:33:58 +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 w66JXwl4075674; Fri, 6 Jul 2018 19:33:58 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w66JXwOn075673; Fri, 6 Jul 2018 19:33:58 GMT (envelope-from np@FreeBSD.org) Message-Id: <201807061933.w66JXwOn075673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 6 Jul 2018 19:33:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336042 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 336042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2018 19:33:59 -0000 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; } /*