From 80e6c636fb1c5381f4ce95963ace48dc477c7599 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 30 Jul 2004 19:00:35 +0000 Subject: [PATCH] HT improvements from Maciej git-archimport-id: mj@ucw.cz--public/pciutils--main--2.2--patch-57 --- ChangeLog | 4 +++ lib/header.h | 2 +- lspci.c | 90 ++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 72 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5821b5a..86f8d91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-07-30 Martin Mares + + * lspci.c: HyperTransport improvements from Maciej. + 2004-07-11 Martin Mares * lib/sysfs.c (sysfs_get_resources): Arguments now correspond diff --git a/lib/header.h b/lib/header.h index 54b845d..f1e62c5 100644 --- a/lib/header.h +++ b/lib/header.h @@ -330,7 +330,7 @@ #define PCI_PCIX_BRIDGE_STR_COMMITMENT_LIMIT 0xffff0000 #define PCI_PCIX_BRIDGE_SIZEOF 12 -/* HyperTransport */ +/* HyperTransport (as of spec rev. 2.00) */ #define PCI_HT_CMD 2 /* Command Register */ #define PCI_HT_CMD_TYP_HI 0xe000 /* Capability Type high part */ #define PCI_HT_CMD_TYP_HI_PRI 0x0000 /* Slave or Primary Interface */ diff --git a/lspci.c b/lspci.c index dec904d..aa6b37a 100644 --- a/lspci.c +++ b/lspci.c @@ -573,21 +573,34 @@ show_ht_pri(struct device *d, int where, int cmd) { u16 lctr0, lcnf0, lctr1, lcnf1, eh; u8 rid, lfrer0, lfcap0, ftr, lfrer1, lfcap1, mbu, mlu, bn; + char *fmt; printf("HyperTransport: Slave or Primary Interface\n"); if (verbose < 2) return; - printf("\t\tCommand: BaseUnitID=%u UnitCnt=%u MastHost%c DefDir%c DUL%c\n", + if (!config_fetch(d, where + PCI_HT_PRI_LCTR0, PCI_HT_PRI_SIZEOF - PCI_HT_PRI_LCTR0)) + return; + rid = get_conf_byte(d, where + PCI_HT_PRI_RID); + if (rid < 0x23 && rid > 0x11) + printf("\t!!! Possibly incomplete decoding\n"); + + if (rid >= 0x23) + fmt = "\t\tCommand: BaseUnitID=%u UnitCnt=%u MastHost%c DefDir%c DUL%c\n"; + else + fmt = "\t\tCommand: BaseUnitID=%u UnitCnt=%u MastHost%c DefDir%c\n"; + printf(fmt, (cmd & PCI_HT_PRI_CMD_BUID), (cmd & PCI_HT_PRI_CMD_UC) >> 5, FLAG(cmd, PCI_HT_PRI_CMD_MH), FLAG(cmd, PCI_HT_PRI_CMD_DD), FLAG(cmd, PCI_HT_PRI_CMD_DUL)); - if (!config_fetch(d, where + PCI_HT_PRI_LCTR0, PCI_HT_PRI_SIZEOF - PCI_HT_PRI_LCTR0)) - return; lctr0 = get_conf_word(d, where + PCI_HT_PRI_LCTR0); - printf("\t\tLink Control 0: CFlE%c CST%c CFE%c = 0x23) + fmt = "\t\tLink Control 0: CFlE%c CST%c CFE%c = 0x23) + fmt = "\t\tLink Config 0: MLWI=%1$s DwFcIn%5$c MLWO=%2$s DwFcOut%6$c LWI=%3$s DwFcInEn%7$c LWO=%4$s DwFcOutEn%8$c\n"; + else + fmt = "\t\tLink Config 0: MLWI=%s MLWO=%s LWI=%s LWO=%s\n"; + printf(fmt, ht_link_width(lcnf0 & PCI_HT_LCNF_MLWI), - FLAG(lcnf0, PCI_HT_LCNF_DFI), ht_link_width((lcnf0 & PCI_HT_LCNF_MLWO) >> 4), - FLAG(lcnf0, PCI_HT_LCNF_DFO), ht_link_width((lcnf0 & PCI_HT_LCNF_LWI) >> 8), - FLAG(lcnf0, PCI_HT_LCNF_DFIE), ht_link_width((lcnf0 & PCI_HT_LCNF_LWO) >> 12), + FLAG(lcnf0, PCI_HT_LCNF_DFI), + FLAG(lcnf0, PCI_HT_LCNF_DFO), + FLAG(lcnf0, PCI_HT_LCNF_DFIE), FLAG(lcnf0, PCI_HT_LCNF_DFOE)); lctr1 = get_conf_word(d, where + PCI_HT_PRI_LCTR1); - printf("\t\tLink Control 1: CFlE%c CST%c CFE%c = 0x23) + fmt = "\t\tLink Control 1: CFlE%c CST%c CFE%c = 0x23) + fmt = "\t\tLink Config 1: MLWI=%1$s DwFcIn%5$c MLWO=%2$s DwFcOut%6$c LWI=%3$s DwFcInEn%7$c LWO=%4$s DwFcOutEn%8$c\n"; + else + fmt = "\t\tLink Config 1: MLWI=%s MLWO=%s LWI=%s LWO=%s\n"; + printf(fmt, ht_link_width(lcnf1 & PCI_HT_LCNF_MLWI), - FLAG(lcnf1, PCI_HT_LCNF_DFI), ht_link_width((lcnf1 & PCI_HT_LCNF_MLWO) >> 4), - FLAG(lcnf1, PCI_HT_LCNF_DFO), ht_link_width((lcnf1 & PCI_HT_LCNF_LWI) >> 8), - FLAG(lcnf1, PCI_HT_LCNF_DFIE), ht_link_width((lcnf1 & PCI_HT_LCNF_LWO) >> 12), + FLAG(lcnf1, PCI_HT_LCNF_DFI), + FLAG(lcnf1, PCI_HT_LCNF_DFO), + FLAG(lcnf1, PCI_HT_LCNF_DFIE), FLAG(lcnf1, PCI_HT_LCNF_DFOE)); - rid = get_conf_byte(d, where + PCI_HT_PRI_RID); printf("\t\tRevision ID: %u.%02u\n", (rid & PCI_HT_RID_MAJ) >> 5, (rid & PCI_HT_RID_MIN)); + if (rid < 0x23) + return; lfrer0 = get_conf_byte(d, where + PCI_HT_PRI_LFRER0); printf("\t\tLink Frequency 0: %s\n", ht_link_freq(lfrer0 & PCI_HT_LFRER_FREQ)); printf("\t\tLink Error 0: 0x11) + printf("\t!!! Possibly incomplete decoding\n"); + + if (rid >= 0x23) + fmt = "\t\tCommand: WarmRst%c DblEnd%c DevNum=%u ChainSide%c HostHide%c Slave%c > 2, @@ -729,10 +766,12 @@ show_ht_sec(struct device *d, int where, int cmd) FLAG(cmd, PCI_HT_SEC_CMD_AS), FLAG(cmd, PCI_HT_SEC_CMD_HIECE), FLAG(cmd, PCI_HT_SEC_CMD_DUL)); - if (!config_fetch(d, where + PCI_HT_SEC_LCTR, PCI_HT_SEC_SIZEOF - PCI_HT_SEC_LCTR)) - return; lctr = get_conf_word(d, where + PCI_HT_SEC_LCTR); - printf("\t\tLink Control: CFlE%c CST%c CFE%c = 0x23) + fmt = "\t\tLink Control: CFlE%c CST%c CFE%c = 0x23) + fmt = "\t\tLink Config: MLWI=%1$s DwFcIn%5$c MLWO=%2$s DwFcOut%6$c LWI=%3$s DwFcInEn%7$c LWO=%4$s DwFcOutEn%8$c\n"; + else + fmt = "\t\tLink Config: MLWI=%s MLWO=%s LWI=%s LWO=%s\n"; + printf(fmt, ht_link_width(lcnf & PCI_HT_LCNF_MLWI), - FLAG(lcnf, PCI_HT_LCNF_DFI), ht_link_width((lcnf & PCI_HT_LCNF_MLWO) >> 4), - FLAG(lcnf, PCI_HT_LCNF_DFO), ht_link_width((lcnf & PCI_HT_LCNF_LWI) >> 8), - FLAG(lcnf, PCI_HT_LCNF_DFIE), ht_link_width((lcnf & PCI_HT_LCNF_LWO) >> 12), + FLAG(lcnf, PCI_HT_LCNF_DFI), + FLAG(lcnf, PCI_HT_LCNF_DFO), + FLAG(lcnf, PCI_HT_LCNF_DFIE), FLAG(lcnf, PCI_HT_LCNF_DFOE)); - rid = get_conf_byte(d, where + PCI_HT_SEC_RID); printf("\t\tRevision ID: %u.%02u\n", (rid & PCI_HT_RID_MAJ) >> 5, (rid & PCI_HT_RID_MIN)); + if (rid < 0x23) + return; lfrer = get_conf_byte(d, where + PCI_HT_SEC_LFRER); printf("\t\tLink Frequency: %s\n", ht_link_freq(lfrer & PCI_HT_LFRER_FREQ)); printf("\t\tLink Error: