Date: Thu, 18 Jul 2013 20:59:58 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253455 - head/usr.sbin/pciconf Message-ID: <201307182059.r6IKxw5T067397@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Thu Jul 18 20:59:58 2013 New Revision: 253455 URL: http://svnweb.freebsd.org/changeset/base/253455 Log: Decode PCIe ASPM capability and status. Modified: head/usr.sbin/pciconf/cap.c Modified: head/usr.sbin/pciconf/cap.c ============================================================================== --- head/usr.sbin/pciconf/cap.c Thu Jul 18 20:36:21 2013 (r253454) +++ head/usr.sbin/pciconf/cap.c Thu Jul 18 20:59:58 2013 (r253455) @@ -391,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); @@ -435,26 +451,28 @@ cap_express(int fd, struct pci_conf *p, 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)); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307182059.r6IKxw5T067397>