Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Jun 2021 15:56:06 GMT
From:      David Bright <dab@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2f176a2b2010 - main - pciconf: Fix up pciconf -lc output
Message-ID:  <202106011556.151Fu6ZE084734@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dab:

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

commit 2f176a2b20107f7a9132242223e9eef657400514
Author:     David Bright <dab@FreeBSD.org>
AuthorDate: 2021-05-24 19:02:43 +0000
Commit:     David Bright <dab@FreeBSD.org>
CommitDate: 2021-06-01 15:55:44 +0000

    pciconf: Fix up pciconf -lc output
    
    The pciconf command fails to emit newlines when particular ecap field
    values are seen. Fix them up. This has been seen on several systems at
    $JOB. The documentation for PCI capabilities says that capability
    type 0 should not be used once the spec for PCI capabilities was
    published, but that seems more wishful-thinking than reality. pciconf
    also chooses not to print fields related to field values that are
    zero, but it seems several of these fields are zero on actual
    hardware.
    
    Reviewed by:    vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com)
    Sponsored by:   Dell EMC Isilon
    Submitted by:   Robert Herndon (Robert.Herndon@dell.com)
    Differential Revision: https://reviews.freebsd.org/D30441
---
 usr.sbin/pciconf/cap.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c
index bd7315beb047..eae53acbd250 100644
--- a/usr.sbin/pciconf/cap.c
+++ b/usr.sbin/pciconf/cap.c
@@ -861,8 +861,10 @@ ecap_aer(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver)
 	uint32_t sta, mask;
 
 	printf("AER %d", ver);
-	if (ver < 1)
+	if (ver < 1) {
+		printf("\n");
 		return;
+	}
 	sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_STATUS, 4);
 	mask = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_SEVERITY, 4);
 	printf(" %d fatal", bitcount32(sta & mask));
@@ -877,8 +879,10 @@ ecap_vc(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver)
 	uint32_t cap1;
 
 	printf("VC %d", ver);
-	if (ver < 1)
+	if (ver < 1) {
+		printf("\n");
 		return;
+	}
 	cap1 = read_config(fd, &p->pc_sel, ptr + PCIR_VC_CAP1, 4);
 	printf(" max VC%d", cap1 & PCIM_VC_CAP1_EXT_COUNT);
 	if ((cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) != 0)
@@ -893,8 +897,10 @@ ecap_sernum(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver)
 	uint32_t high, low;
 
 	printf("Serial %d", ver);
-	if (ver < 1)
+	if (ver < 1) {
+		printf("\n");
 		return;
+	}
 	low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4);
 	high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4);
 	printf(" %08x%08x\n", high, low);
@@ -940,8 +946,10 @@ ecap_sec_pcie(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver)
 	uint32_t val;
 
 	printf("PCIe Sec %d", ver);
-	if (ver < 1)
+	if (ver < 1) {
+		printf("\n");
 		return;
+	}
 	val = read_config(fd, &p->pc_sel, ptr + 8, 4);
 	printf(" lane errors %#x\n", val);
 }



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