From nobody Fri Jan 19 16:53:33 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TGm0F3jqSz56v0n; Fri, 19 Jan 2024 16:53:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TGm0F2B66z4BNn; Fri, 19 Jan 2024 16:53:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705683213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j7DQGrQczt0grEVz+018K37OQz2K/aVIDUZSLiopXw8=; b=QmZhlnC/QMXJimPi1NrdTsUUP7LapS/EG/Rqs/3ZkoHaqZSgNb/W36G9hIoBdcAGF/alTh cM8WAYnuzwgbCstscmHvajUr2tjJu6T0dxs7NNvtdHtkoDrm6Cv/f1DNOXJLeUbYX6LOHm wQSlTV1oZf8cXAWdnCysgWV+eYqTjOCqfmQghZ5tygl7IAlcOvBMrTlFOTfJaICKDUPwji 3mKADpmodViNE0s01U9uo7BFoiTtzr3CWZm2Q+ZPfo51E9+rHbojbP6y3ipv8sgBxM0/BM W55hNeT+DINk3/U0SyapVgrVsroZJXTc48gkUQDM6uqTZ+p+jUeEKZxhZgWoLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705683213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j7DQGrQczt0grEVz+018K37OQz2K/aVIDUZSLiopXw8=; b=ZZ49LMQuVXfCaxQOM54Tw5xInCklyvkZQg0wu4dwRHNegWdaeJJXHHqO1NwxgQTh/bPg71 TtJ0qGjofqgX4YrCWFAxPVUbZR8rFNEjbM7zLTz2mkEuIamABVj4XjbaLhCNXGkudOUc7O XpscVLWe3x55X4ZSkVA+ajzRQkwgTD2JfGmXiSBgtbQOnydbc380hUzXD+PccIdt5co+oS Adt2prE9ofmRwU+rhPmm183/1ecOvJcDwolalmWjUxtgTFRXyHYyA+iZBcPCZS10IbVlkv WsimuJ0DvcKJ7jrpZE89BFELLyWS8BUWGwQLORZXZCNOtDAxvVpWzYMfvaczvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705683213; a=rsa-sha256; cv=none; b=oY/ELxeE4b2Cl61c47pfX82K2jNG1u83N+4tqLd0EapLtLViWaQT/fX+lh+IOwHfXugWO+ v5zDVythSLLd2ttM7SYG+dmTUAnE+ke5dt5uoFUH+oZt7VW27Ss/PHjcVIY+v6xmSQJOoU 7BmWXB+ycjhwzBVNd0DWBKT68a4QceAfFel26jl9p1MLTCT3uv17SdHTmeRv9xRmkxUb+W 9iNHps8FldpWgRmzVTaQ65i8Zmp93B1Ke1SWddmYQxK+s1atghACbkfyrujbXIqJQqsUYO YwC/SxiGM3fMHN3kAZB2ueXJlXSfy2v8472g+fSGY8nc2zyPvbNwr02cF2dBsg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TGm0F1Hl6z10MT; Fri, 19 Jan 2024 16:53:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40JGrXrH060121; Fri, 19 Jan 2024 16:53:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40JGrXvQ060118; Fri, 19 Jan 2024 16:53:33 GMT (envelope-from git) Date: Fri, 19 Jan 2024 16:53:33 GMT Message-Id: <202401191653.40JGrXvQ060118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 0a38059e24d4 - stable/13 - isp(4): Remove redundant functions for reading data from FLT and flash List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a38059e24d44c2cb573df97b26dc10a2a9053c3 Auto-Submitted: auto-generated The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=0a38059e24d44c2cb573df97b26dc10a2a9053c3 commit 0a38059e24d44c2cb573df97b26dc10a2a9053c3 Author: Joerg Pulz AuthorDate: 2023-07-07 21:43:34 +0000 Commit: Alexander Motin CommitDate: 2024-01-19 16:51:46 +0000 isp(4): Remove redundant functions for reading data from FLT and flash Rename isp_rd_2400_nvram to isp_rd_2xxx_flash. Cleanup some leftovers. Hide all output regarding FLT parsing behind ISP_LOGDEBUG0. Thanks to imp@ and mav@ for reviewing and commenting. PR: 271062 Reviewed by: imp, mav Sponsored by: Technical University of Munich Pull Request: https://github.com/freebsd/freebsd-src/pull/726 (cherry picked from commit 295fd9c1caeb42a4c93005080320d011bf01e4c0) --- sys/dev/isp/isp.c | 115 +++++++++++++++--------------------------------------- 1 file changed, 31 insertions(+), 84 deletions(-) diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index 5a00a29531ea..241aad838cee 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -118,14 +118,12 @@ static void isp_mboxcmd(ispsoftc_t *, mbreg_t *); static void isp_setdfltfcparm(ispsoftc_t *, int); static int isp_read_nvram(ispsoftc_t *, int); +static void isp_rd_2xxx_flash(ispsoftc_t *, uint32_t, uint32_t *); static int isp_read_flthdr_2xxx(ispsoftc_t *); -static void isp_rd_2xxx_flthdr(ispsoftc_t *, uint32_t, uint32_t *); static void isp_parse_flthdr_2xxx(ispsoftc_t *, uint8_t *); static int isp_read_flt_2xxx(ispsoftc_t *); -static void isp_rd_2xxx_flt(ispsoftc_t *, uint32_t, uint32_t *); static int isp_parse_flt_2xxx(ispsoftc_t *, uint8_t *); static int isp_read_nvram_2400(ispsoftc_t *); -static void isp_rd_2400_nvram(ispsoftc_t *, uint32_t, uint32_t *); static void isp_parse_nvram_2400(ispsoftc_t *, uint8_t *); static void @@ -4382,6 +4380,30 @@ isp_read_nvram(ispsoftc_t *isp, int bus) return (isp_read_nvram_2400(isp)); } +static void +isp_rd_2xxx_flash(ispsoftc_t *isp, uint32_t addr, uint32_t *rp) +{ + fcparam *fcp = FCPARAM(isp, 0); + int loops = 0; + uint32_t base = fcp->flash_data_addr; + uint32_t tmp = 0; + + ISP_WRITE(isp, BIU2400_FLASH_ADDR, base + addr); + for (loops = 0; loops < 5000; loops++) { + ISP_DELAY(10); + tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); + if ((tmp & (1U << 31)) != 0) { + break; + } + } + if (tmp & (1U << 31)) { + *rp = ISP_READ(isp, BIU2400_FLASH_DATA); + ISP_SWIZZLE_NVRAM_LONG(isp, rp); + } else { + *rp = 0xffffffff; + } +} + static int isp_read_flthdr_2xxx(ispsoftc_t *isp) { @@ -4397,7 +4419,7 @@ isp_read_flthdr_2xxx(ispsoftc_t *isp) isp_prt(isp, ISP_LOGDEBUG0, "FLTL[DEF]: 0x%x", addr); for (lwrds = 0; lwrds < FLT_HEADER_SIZE >> 2; lwrds++) { - isp_rd_2xxx_flthdr(isp, addr++, dptr++); + isp_rd_2xxx_flash(isp, addr++, dptr++); } dptr = (uint32_t *) flthdr_data; for (csum = 0, lwrds = 0; lwrds < FLT_HEADER_SIZE >> 4; lwrds++) { @@ -4414,30 +4436,6 @@ out: return (retval); } -static void -isp_rd_2xxx_flthdr(ispsoftc_t *isp, uint32_t addr, uint32_t *rp) -{ - fcparam *fcp = FCPARAM(isp, 0); - int loops = 0; - uint32_t base = fcp->flash_data_addr; - uint32_t tmp = 0; - - ISP_WRITE(isp, BIU2400_FLASH_ADDR, base | addr); - for (loops = 0; loops < 5000; loops++) { - ISP_DELAY(10); - tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); - if ((tmp & (1U << 31)) != 0) { - break; - } - } - if (tmp & (1U << 31)) { - *rp = ISP_READ(isp, BIU2400_FLASH_DATA); - ISP_SWIZZLE_NVRAM_LONG(isp, rp); - } else { - *rp = 0xffffffff; - } -} - static void isp_parse_flthdr_2xxx(ispsoftc_t *isp, uint8_t *flthdr_data) { @@ -4454,7 +4452,7 @@ isp_parse_flthdr_2xxx(ispsoftc_t *isp, uint8_t *flthdr_data) "FLT[DEF]: Invalid length=0x%x(%d)", fcp->flt_length, fcp->flt_length); } - isp_prt(isp, ISP_LOGCONFIG, + isp_prt(isp, ISP_LOGDEBUG0, "FLT[DEF]: version=0x%x length=0x%x(%d) checksum=0x%x", ver, fcp->flt_length, fcp->flt_length, csum); } @@ -4471,39 +4469,15 @@ isp_read_flt_2xxx(ispsoftc_t *isp) addr = fcp->flt_region_flt + (FLT_HEADER_SIZE >> 2); dptr = (uint32_t *) flt_data; - isp_prt(isp, ISP_LOGCONFIG, "FLT[DEF]: regions=%d", + isp_prt(isp, ISP_LOGDEBUG0, "FLT[DEF]: regions=%d", fcp->flt_region_entries); for (lwrds = 0; lwrds < len >> 2; lwrds++) { - isp_rd_2xxx_flt(isp, addr++, dptr++); + isp_rd_2xxx_flash(isp, addr++, dptr++); } retval = isp_parse_flt_2xxx(isp, flt_data); return (retval); } -static void -isp_rd_2xxx_flt(ispsoftc_t *isp, uint32_t addr, uint32_t *rp) -{ - fcparam *fcp = FCPARAM(isp, 0); - int loops = 0; - uint32_t base = fcp->flash_data_addr; - uint32_t tmp = 0; - - ISP_WRITE(isp, BIU2400_FLASH_ADDR, base | addr); - for (loops = 0; loops < 5000; loops++) { - ISP_DELAY(10); - tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); - if ((tmp & (1U << 31)) != 0) { - break; - } - } - if (tmp & (1U << 31)) { - *rp = ISP_READ(isp, BIU2400_FLASH_DATA); - ISP_SWIZZLE_NVRAM_LONG(isp, rp); - } else { - *rp = 0xffffffff; - } -} - static int isp_parse_flt_2xxx(ispsoftc_t *isp, uint8_t *flt_data) { @@ -4675,7 +4649,7 @@ isp_parse_flt_2xxx(ispsoftc_t *isp, uint8_t *flt_data) break; } } - isp_prt(isp, ISP_LOGCONFIG, + isp_prt(isp, ISP_LOGDEBUG0, "FLT[FLT]: boot=0x%x fw=0x%x vpd_nvram=0x%x vpd=0x%x nvram 0x%x " "fdt=0x%x flt=0x%x npiv=0x%x fcp_prif_cfg=0x%x", fcp->flt_region_boot, fcp->flt_region_fw, fcp->flt_region_vpd_nvram, @@ -4697,7 +4671,7 @@ isp_read_nvram_2400(ispsoftc_t *isp) addr = fcp->flt_region_nvram; dptr = (uint32_t *) nvram_data; for (lwrds = 0; lwrds < ISP2400_NVRAM_SIZE >> 2; lwrds++) { - isp_rd_2400_nvram(isp, addr++, dptr++); + isp_rd_2xxx_flash(isp, addr++, dptr++); } if (nvram_data[0] != 'I' || nvram_data[1] != 'S' || nvram_data[2] != 'P') { @@ -4722,33 +4696,6 @@ out: return (retval); } -static void -isp_rd_2400_nvram(ispsoftc_t *isp, uint32_t addr, uint32_t *rp) -{ - fcparam *fcp = FCPARAM(isp, 0); - int loops = 0; - uint32_t base; // = 0x7ffe0000; - uint32_t tmp = 0; - - base = fcp->flash_data_addr + addr; - addr = 0; - - ISP_WRITE(isp, BIU2400_FLASH_ADDR, base | addr); - for (loops = 0; loops < 5000; loops++) { - ISP_DELAY(10); - tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); - if ((tmp & (1U << 31)) != 0) { - break; - } - } - if (tmp & (1U << 31)) { - *rp = ISP_READ(isp, BIU2400_FLASH_DATA); - ISP_SWIZZLE_NVRAM_LONG(isp, rp); - } else { - *rp = 0xffffffff; - } -} - static void isp_parse_nvram_2400(ispsoftc_t *isp, uint8_t *nvram_data) {