diff options
author | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
commit | 62bb1062226d3ce6a2350808256a25508978352d (patch) | |
tree | 22b131dceb13c3df96da594fbaadb693504797c7 /usr.sbin/pciconf | |
parent | 72ab90509b3a51ab361bf710338f2ef44a4e360d (diff) | |
parent | 04932445481c2cb89ff69a83b961bdef3d64757e (diff) | |
download | FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.zip FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.tar.gz |
Merge from head
Diffstat (limited to 'usr.sbin/pciconf')
-rw-r--r-- | usr.sbin/pciconf/cap.c | 70 |
1 files changed, 50 insertions, 20 deletions
diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c index 1c2ab4a..d7296a3 100644 --- a/usr.sbin/pciconf/cap.c +++ b/usr.sbin/pciconf/cap.c @@ -276,6 +276,18 @@ cap_ht(int fd, struct pci_conf *p, uint8_t ptr) case PCIM_HTCAP_X86_ENCODING: printf("X86 encoding"); break; + case PCIM_HTCAP_GEN3: + printf("Gen3"); + break; + case PCIM_HTCAP_FLE: + printf("function-level extension"); + break; + case PCIM_HTCAP_PM: + printf("power management"); + break; + case PCIM_HTCAP_HIGH_NODE_COUNT: + printf("high node count"); + break; default: printf("unknown %02x", command); break; @@ -379,11 +391,27 @@ link_speed_string(uint8_t speed) } } +static const char * +aspm_string(uint8_t aspm) +{ + + switch (aspm) { + case 1: + return ("L0s"); + case 2: + return ("L1"); + case 3: + return ("L0s/L1"); + default: + return ("disabled"); + } +} + static void cap_express(int fd, struct pci_conf *p, uint8_t ptr) { - uint32_t val; - uint16_t flags; + uint32_t cap; + uint16_t ctl, flags, sta; flags = read_config(fd, &p->pc_sel, ptr + PCIER_FLAGS, 2); printf("PCI-Express %d ", flags & PCIEM_FLAGS_VERSION); @@ -423,26 +451,28 @@ cap_express(int fd, struct pci_conf *p, uint8_t ptr) printf(" slot"); if (flags & PCIEM_FLAGS_IRQ) printf(" IRQ %d", (flags & PCIEM_FLAGS_IRQ) >> 9); - val = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CAP, 4); - flags = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CTL, 2); + cap = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CAP, 4); + ctl = read_config(fd, &p->pc_sel, ptr + PCIER_DEVICE_CTL, 2); 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) + MAX_PAYLOAD((ctl & PCIEM_CTL_MAX_PAYLOAD) >> 5), + MAX_PAYLOAD(cap & PCIEM_CAP_MAX_PAYLOAD)); + if ((cap & PCIEM_CAP_FLR) != 0) 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, - (val & PCIEM_LINK_CAP_MAX_WIDTH) >> 4); - /* - * Only print link speed info if the link's max width is - * greater than 0. - */ - if ((val & PCIEM_LINK_CAP_MAX_WIDTH) != 0) { - printf("\n speed"); - printf(" %s(%s)", (flags & PCIEM_LINK_STA_WIDTH) == 0 ? - "0.0" : link_speed_string(flags & PCIEM_LINK_STA_SPEED), - link_speed_string(val & PCIEM_LINK_CAP_MAX_SPEED)); + cap = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_CAP, 4); + sta = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_STA, 2); + printf(" link x%d(x%d)", (sta & PCIEM_LINK_STA_WIDTH) >> 4, + (cap & PCIEM_LINK_CAP_MAX_WIDTH) >> 4); + if ((cap & (PCIEM_LINK_CAP_MAX_WIDTH | PCIEM_LINK_CAP_ASPM)) != 0) + printf("\n "); + if ((cap & PCIEM_LINK_CAP_MAX_WIDTH) != 0) { + printf(" speed %s(%s)", (sta & PCIEM_LINK_STA_WIDTH) == 0 ? + "0.0" : link_speed_string(sta & PCIEM_LINK_STA_SPEED), + link_speed_string(cap & PCIEM_LINK_CAP_MAX_SPEED)); + } + if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { + ctl = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_CTL, 2); + printf(" ASPM %s(%s)", aspm_string(ctl & PCIEM_LINK_CTL_ASPMC), + aspm_string((cap & PCIEM_LINK_CAP_ASPM) >> 10)); } } |