From owner-svn-src-stable@FreeBSD.ORG Wed Feb 27 19:38:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 37B05140; Wed, 27 Feb 2013 19:38:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 19E489FA; Wed, 27 Feb 2013 19:38:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RJcPtG076767; Wed, 27 Feb 2013 19:38:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RJcPCh076765; Wed, 27 Feb 2013 19:38:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201302271938.r1RJcPCh076765@svn.freebsd.org> From: John Baldwin Date: Wed, 27 Feb 2013 19:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247408 - stable/9/usr.sbin/pciconf X-SVN-Group: stable-9 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.14 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, 27 Feb 2013 19:38:26 -0000 Author: jhb Date: Wed Feb 27 19:38:25 2013 New Revision: 247408 URL: http://svnweb.freebsd.org/changeset/base/247408 Log: MFC 240474: - Denote PCI-e endpoints that support FLR. - Make parsing of PCI-e extended capabilities assume that future version numbers are backwards compatible. - Add new AER error descriptions. - Add descriptions for more PCI-e extended capabilities. Modified: stable/9/usr.sbin/pciconf/cap.c stable/9/usr.sbin/pciconf/err.c Directory Properties: stable/9/usr.sbin/pciconf/ (props changed) Modified: stable/9/usr.sbin/pciconf/cap.c ============================================================================== --- stable/9/usr.sbin/pciconf/cap.c Wed Feb 27 19:22:27 2013 (r247407) +++ stable/9/usr.sbin/pciconf/cap.c Wed Feb 27 19:38:25 2013 (r247408) @@ -428,6 +428,8 @@ cap_express(int fd, struct pci_conf *p, printf(" max data %d(%d)", MAX_PAYLOAD((flags & PCIEM_CTL_MAX_PAYLOAD) >> 5), MAX_PAYLOAD(val & PCIEM_CAP_MAX_PAYLOAD)); + if (val & PCIEM_CAP_FLR) + printf(" FLR"); val = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_CAP, 4); flags = read_config(fd, &p->pc_sel, ptr+ PCIER_LINK_STA, 2); printf(" link x%d(x%d)", (flags & PCIEM_LINK_STA_WIDTH) >> 4, @@ -587,7 +589,7 @@ ecap_aer(int fd, struct pci_conf *p, uin uint32_t sta, mask; printf("AER %d", ver); - if (ver != 1) + if (ver < 1) 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); @@ -603,7 +605,7 @@ ecap_vc(int fd, struct pci_conf *p, uint uint32_t cap1; printf("VC %d", ver); - if (ver != 1) + if (ver < 1) return; cap1 = read_config(fd, &p->pc_sel, ptr + PCIR_VC_CAP1, 4); printf(" max VC%d", cap1 & PCIM_VC_CAP1_EXT_COUNT); @@ -618,7 +620,7 @@ ecap_sernum(int fd, struct pci_conf *p, uint32_t high, low; printf("Serial %d", ver); - if (ver != 1) + if (ver < 1) 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); @@ -626,10 +628,58 @@ ecap_sernum(int fd, struct pci_conf *p, } static void +ecap_vendor(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t val; + + printf("Vendor %d", ver); + if (ver < 1) + return; + val = read_config(fd, &p->pc_sel, ptr + 4, 4); + printf(" ID %d", val & 0xffff); +} + +static void +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) + return; + val = read_config(fd, &p->pc_sel, ptr + 8, 4); + printf(" lane errors %#x", val); +} + +struct { + uint16_t id; + const char *name; +} ecap_names[] = { + { PCIZ_PWRBDGT, "Power Budgeting" }, + { PCIZ_RCLINK_DCL, "Root Complex Link Declaration" }, + { PCIZ_RCLINK_CTL, "Root Complex Internal Link Control" }, + { PCIZ_RCEC_ASSOC, "Root Complex Event Collector ASsociation" }, + { PCIZ_MFVC, "MFVC" }, + { PCIZ_RCRB, "RCRB" }, + { PCIZ_ACS, "ACS" }, + { PCIZ_ARI, "ARI" }, + { PCIZ_ATS, "ATS" }, + { PCIZ_SRIOV, "SRIOV" }, + { PCIZ_MULTICAST, "Multicast" }, + { PCIZ_RESIZE_BAR, "Resizable BAR" }, + { PCIZ_DPA, "DPA" }, + { PCIZ_TPH_REQ, "TPH Requester" }, + { PCIZ_LTR, "LTR" }, + { 0, NULL } +}; + +static void list_ecaps(int fd, struct pci_conf *p) { + const char *name; uint32_t ecap; uint16_t ptr; + int i; ptr = PCIR_EXTCAP; ecap = read_config(fd, &p->pc_sel, ptr, 4); @@ -647,8 +697,20 @@ list_ecaps(int fd, struct pci_conf *p) case PCIZ_SERNUM: ecap_sernum(fd, p, ptr, PCI_EXTCAP_VER(ecap)); break; + case PCIZ_VENDOR: + ecap_vendor(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_SEC_PCIE: + ecap_sec_pcie(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; default: - printf("unknown %d", PCI_EXTCAP_VER(ecap)); + name = "unknown"; + for (i = 0; ecap_names[i].name != NULL; i++) + if (ecap_names[i].id == PCI_EXTCAP_ID(ecap)) { + name = ecap_names[i].name; + break; + } + printf("%s %d", name, PCI_EXTCAP_VER(ecap)); break; } printf("\n"); Modified: stable/9/usr.sbin/pciconf/err.c ============================================================================== --- stable/9/usr.sbin/pciconf/err.c Wed Feb 27 19:22:27 2013 (r247407) +++ stable/9/usr.sbin/pciconf/err.c Wed Feb 27 19:38:25 2013 (r247408) @@ -91,6 +91,10 @@ static struct bit_table aer_uc[] = { { PCIM_AER_UC_ECRC_ERROR, "ECRC Error" }, { PCIM_AER_UC_UNSUPPORTED_REQUEST, "Unsupported Request" }, { PCIM_AER_UC_ACS_VIOLATION, "ACS Violation" }, + { PCIM_AER_UC_INTERNAL_ERROR, "Uncorrectable Internal Error" }, + { PCIM_AER_UC_MC_BLOCKED_TLP, "MC Blocked TLP" }, + { PCIM_AER_UC_ATOMIC_EGRESS_BLK, "AtomicOp Egress Blocked" }, + { PCIM_AER_UC_TLP_PREFIX_BLOCKED, "TLP Prefix Blocked Error" }, { 0, NULL }, }; @@ -102,6 +106,8 @@ static struct bit_table aer_cor[] = { { PCIM_AER_COR_REPLAY_ROLLOVER, "REPLAY_NUM Rollover" }, { PCIM_AER_COR_REPLAY_TIMEOUT, "Replay Timer Timeout" }, { PCIM_AER_COR_ADVISORY_NF_ERROR, "Advisory Non-Fatal Error" }, + { PCIM_AER_COR_INTERNAL_ERROR, "Corrected Internal Error" }, + { PCIM_AER_COR_HEADER_LOG_OVFLOW, "Header Log Overflow" }, { 0, NULL }, };