Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Dec 2021 01:06:36 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: dd8d32c66972 - stable/13 - isp(4): Allow more than 2 ports to read WWNs from NVRAM.
Message-ID:  <202112210106.1BL16a33025078@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=dd8d32c669724b1e47107204afef2ef5e9e42d48

commit dd8d32c669724b1e47107204afef2ef5e9e42d48
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2021-12-14 18:20:14 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-12-21 01:06:32 +0000

    isp(4): Allow more than 2 ports to read WWNs from NVRAM.
    
    It appears at least on QLE2694L cards 3rd and 4th ports follow the
    same NVRAM addressing logic as the first two.  In lack of proper
    documentation this guess is as good as it can be.
    
    MFC after:      1 week
    Sponsored by:   iXsystems, Inc.
    
    (cherry picked from commit 483e464ed4325a0710485925ecfbe0e1c8d6bb02)
---
 sys/dev/isp/isp.c    | 7 +------
 sys/dev/isp/ispreg.h | 3 +--
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index 5d1c824deff4..c3470529657e 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -4333,12 +4333,7 @@ isp_read_nvram_2400(ispsoftc_t *isp)
 	uint32_t addr, csum, lwrds, *dptr;
 	uint8_t nvram_data[ISP2400_NVRAM_SIZE];
 
-	if (isp->isp_port) {
-		addr = ISP2400_NVRAM_PORT1_ADDR;
-	} else {
-		addr = ISP2400_NVRAM_PORT0_ADDR;
-	}
-
+	addr = ISP2400_NVRAM_PORT_ADDR(isp->isp_port);
 	dptr = (uint32_t *) nvram_data;
 	for (lwrds = 0; lwrds < ISP2400_NVRAM_SIZE >> 2; lwrds++) {
 		isp_rd_2400_nvram(isp, addr++, dptr++);
diff --git a/sys/dev/isp/ispreg.h b/sys/dev/isp/ispreg.h
index 5d04ad2b4400..98b9a6c0bf0d 100644
--- a/sys/dev/isp/ispreg.h
+++ b/sys/dev/isp/ispreg.h
@@ -213,8 +213,7 @@ typedef struct {
 /*
  * Qlogic 2400 NVRAM is an array of 512 bytes with a 32 bit checksum.
  */
-#define	ISP2400_NVRAM_PORT0_ADDR	0x80
-#define	ISP2400_NVRAM_PORT1_ADDR	0x180
+#define	ISP2400_NVRAM_PORT_ADDR(c)	(0x100 * (c) + 0x80)
 #define	ISP2400_NVRAM_SIZE		512
 
 #define	ISP2400_NVRAM_VERSION(c)		((c)[4] | ((c)[5] << 8))



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