Hi! On Saturday, April 2, 2016, John Baldwin <j...@freebsd.org> wrote:
> Author: jhb > Date: Sat Apr 2 01:59:53 2016 > New Revision: 297501 > URL: https://svnweb.freebsd.org/changeset/base/297501 > > Log: > Output information about PCI-e devices with slots. > > In particular this includes additional information on HotPlug capable > slots. > > Modified: > head/usr.sbin/pciconf/cap.c > > Modified: head/usr.sbin/pciconf/cap.c > > ============================================================================== > --- head/usr.sbin/pciconf/cap.c Sat Apr 2 01:55:43 2016 (r297500) > +++ head/usr.sbin/pciconf/cap.c Sat Apr 2 01:59:53 2016 (r297501) > @@ -410,6 +410,28 @@ aspm_string(uint8_t aspm) > } > } > > +static int > +slot_power(uint32_t cap) > +{ > + int mwatts; > + > + mwatts = (cap & PCIEM_SLOT_CAP_SPLV) >> 7; > + switch (cap & PCIEM_SLOT_CAP_SPLS) { > + case 0x0: > + mwatts *= 1000; > + break; > + case 0x1: > + mwatts *= 100; > + break; > + case 0x2: > + mwatts *= 10; > + break; > + default: > + break; > + } > + return (mwatts); > +} > + > static void > cap_express(int fd, struct pci_conf *p, uint8_t ptr) > { > @@ -452,8 +474,6 @@ cap_express(int fd, struct pci_conf *p, > printf("type %d", (flags & PCIEM_FLAGS_TYPE) >> 4); > break; > } > - if (flags & PCIEM_FLAGS_SLOT) > - printf(" slot"); > if (flags & PCIEM_FLAGS_IRQ) > printf(" MSI %d", (flags & PCIEM_FLAGS_IRQ) >> 9); > cap = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CAP, 4); > @@ -493,6 +513,26 @@ cap_express(int fd, struct pci_conf *p, > printf(" ASPM %s(%s)", aspm_string(ctl & > PCIEM_LINK_CTL_ASPMC), > aspm_string((cap & PCIEM_LINK_CAP_ASPM) >> 10)); > } > + if (!(flags & PCIEM_FLAGS_SLOT)) > + return; > + cap = read_config(fd, &p->pc_sel, ptr + PCIER_SLOT_CAP, 4); > + sta = read_config(fd, &p->pc_sel, ptr + PCIER_SLOT_STA, 2); > + ctl = read_config(fd, &p->pc_sel, ptr + PCIER_SLOT_CTL, 2); > + printf("\n "); > + printf(" slot %d", (cap & PCIEM_SLOT_CAP_PSN) >> 19); > + printf(" power limit %d mW", slot_power(cap)); > + if (cap & PCIEM_SLOT_CAP_HPC) > + printf(" HotPlug(%s)", sta & PCIEM_SLOT_STA_PDS ? > "present" : > + "empty"); > + if (cap & PCIEM_SLOT_CAP_HPS) > + printf(" surprise"); What is this surprise string or state? Or is this a forgotten debug string? > + if (cap & PCIEM_SLOT_CAP_APB) > + printf(" Attn Button"); > + if (cap & PCIEM_SLOT_CAP_PCP) > + printf(" PC(%s)", ctl & PCIEM_SLOT_CTL_PCC ? "on" : "off"); > + if (cap & PCIEM_SLOT_CAP_MRLSP) > + printf(" MRL(%s)", sta & PCIEM_SLOT_STA_MRLSS ? "open" : > + "closed"); > } > > static void > _______________________________________________ > svn-src-h...@freebsd.org <javascript:;> mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org > <javascript:;>" > _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"