Module Name: src Committed By: msaitoh Date: Tue Dec 28 09:16:05 UTC 2021
Modified Files: src/sys/dev/pci: pci_subr.c pcireg.h Log Message: Decode link control2's Compliance Preset/De-emphasis more. Fix typo. To generate a diff of this commit: cvs rdiff -u -r1.233 -r1.234 src/sys/dev/pci/pci_subr.c cvs rdiff -u -r1.161 -r1.162 src/sys/dev/pci/pcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/pci_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.233 src/sys/dev/pci/pci_subr.c:1.234 --- src/sys/dev/pci/pci_subr.c:1.233 Fri Dec 3 13:27:38 2021 +++ src/sys/dev/pci/pci_subr.c Tue Dec 28 09:16:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_subr.c,v 1.233 2021/12/03 13:27:38 andvar Exp $ */ +/* $NetBSD: pci_subr.c,v 1.234 2021/12/28 09:16:05 msaitoh Exp $ */ /* * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.233 2021/12/03 13:27:38 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.234 2021/12/28 09:16:05 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -1833,6 +1833,41 @@ pci_print_pcie_link_deemphasis(pcireg_t } } +static const struct _pcie_link_compliance_preset_deemphasis { + const char *preshoot; + const char *deemphasis; +} pcie_link_compliance_preset_deemphasis[] = { + { "0.0", "-6.0+-1.5" }, /* P0 */ + { "0.0", "-3.5+-1" }, /* P1 */ + { "0.0", "-4.4+-1.5" }, /* P2 */ + { "0.0", "-2.5+-1" }, /* P3 */ + { "0.0", "0.0" }, /* P4 */ + { "1.9+-1", "0.0" }, /* P5 */ + { "2.5+-1", "0.0" }, /* P6 */ + { "3.5+-1", "-6.0+-1.5" }, /* P7 */ + { "3.5+-1", "-3.5+-1" }, /* P8 */ + { "3.5+-1", "0.0" }, /* P9 */ + { "0.0", NULL } /* P10 */ +}; + +static void +pci_print_pcie_link_compliance_preset_deemphasis(pcireg_t val) +{ + const char *deemphasis; + + if (val >= __arraycount(pcie_link_compliance_preset_deemphasis)) { + printf("unknown value (0x%hhx)", val); + return; + } + + printf("Preshoot %sdB", + pcie_link_compliance_preset_deemphasis[val].preshoot); + deemphasis = pcie_link_compliance_preset_deemphasis[val].deemphasis; + + if (deemphasis != NULL) + printf(", De-emphasis %sdB", deemphasis); +} + static void pci_conf_print_pcie_cap(const pcireg_t *regs, int capoff) { @@ -2366,8 +2401,8 @@ pci_conf_print_pcie_cap(const pcireg_t * PCIREG_SHIFTOUT(reg, PCIE_LCSR2_TX_MARGIN)); onoff("Enter Modified Compliance", reg, PCIE_LCSR2_EN_MCOMP); onoff("Compliance SOS", reg, PCIE_LCSR2_COMP_SOS); - printf(" Compliance Present/De-emphasis: "); - pci_print_pcie_link_deemphasis( + printf(" Compliance Preset/De-emphasis: "); + pci_print_pcie_link_compliance_preset_deemphasis( PCIREG_SHIFTOUT(reg, PCIE_LCSR2_COMP_DEEMP)); printf("\n"); Index: src/sys/dev/pci/pcireg.h diff -u src/sys/dev/pci/pcireg.h:1.161 src/sys/dev/pci/pcireg.h:1.162 --- src/sys/dev/pci/pcireg.h:1.161 Sun Oct 10 23:28:36 2021 +++ src/sys/dev/pci/pcireg.h Tue Dec 28 09:16:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pcireg.h,v 1.161 2021/10/10 23:28:36 msaitoh Exp $ */ +/* $NetBSD: pcireg.h,v 1.162 2021/12/28 09:16:05 msaitoh Exp $ */ /* * Copyright (c) 1995, 1996, 1999, 2000 @@ -1174,7 +1174,7 @@ typedef u_int8_t pci_revision_t; #define PCIE_LCSR2_TX_MARGIN __BITS(9, 7) /* Transmit Margin */ #define PCIE_LCSR2_EN_MCOMP __BIT(10) /* Enter Modified Compliance */ #define PCIE_LCSR2_COMP_SOS __BIT(11) /* Compliance SOS */ -#define PCIE_LCSR2_COMP_DEEMP __BITS(15, 12) /* Compliance Present/De-emph */ +#define PCIE_LCSR2_COMP_DEEMP __BITS(15, 12) /* Compliance Preset/De-emph */ #define PCIE_LCSR2_DEEMP_LVL __BIT(0 + 16) /* Current De-emphasis Level */ #define PCIE_LCSR2_EQ_COMPL __BIT(1 + 16) /* Equalization Complete */ #define PCIE_LCSR2_EQP1_SUC __BIT(2 + 16) /* Equaliz Phase 1 Successful */