X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ls-ecaps.c;h=ed10f72be2628512c44bff961da71b41c9f562a1;hb=refs%2Ftags%2Fv3.1.7;hp=d5f8c3cfef0e8a68d9bea844a8ec490360174d92;hpb=5a9a932c8055e079545053797ccd80d4085faedf;p=pciutils.git diff --git a/ls-ecaps.c b/ls-ecaps.c index d5f8c3c..ed10f72 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -1,7 +1,7 @@ /* * The PCI Utilities -- Show Extended Capabilities * - * Copyright (c) 1997--2008 Martin Mares + * Copyright (c) 1997--2010 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -221,9 +221,10 @@ cap_vc(struct device *d, int where) int evc_cnt; int arb_table_pos; int i, j; - static const char ref_clocks[4][6] = { "100ns", "?1", "?2", "?3" }; - static const char arb_selects[8][7] = { "Fixed", "WRR32", "WRR64", "WRR128", "?4", "?5", "?6", "?7" }; - static const char vc_arb_selects[8][8] = { "Fixed", "WRR32", "WRR64", "WRR128", "TWRR128", "WRR256", "?6", "?7" }; + static const char ref_clocks[][6] = { "100ns" }; + static const char arb_selects[8][7] = { "Fixed", "WRR32", "WRR64", "WRR128", "??4", "??5", "??6", "??7" }; + static const char vc_arb_selects[8][8] = { "Fixed", "WRR32", "WRR64", "WRR128", "TWRR128", "WRR256", "??6", "??7" }; + char buf[8]; printf("Virtual Channel\n"); if (verbose < 2) @@ -237,24 +238,26 @@ cap_vc(struct device *d, int where) ctrl = get_conf_word(d, where + PCI_VC_PORT_CTRL); status = get_conf_word(d, where + PCI_VC_PORT_STATUS); - evc_cnt = cr1 & 7; - printf("\t\tCaps:\tLPEVC=%d RefClk=%s PATEntrySize=%d\n", - (cr1 >> 4) & 7, - ref_clocks[(cr1 >> 8) & 3], - (cr1 >> 10) & 3); + evc_cnt = BITS(cr1, 0, 3); + printf("\t\tCaps:\tLPEVC=%d RefClk=%s PATEntryBits=%d\n", + BITS(cr1, 4, 3), + TABLE(ref_clocks, BITS(cr1, 8, 2), buf), + 1 << BITS(cr1, 10, 2)); - printf("\t\tArb:\t"); + printf("\t\tArb:"); for (i=0; i<8; i++) if (arb_selects[i][0] != '?' || cr2 & (1 << i)) - printf("%s%c ", arb_selects[i], FLAG(cr2, 1 << i)); - arb_table_pos = (cr2 >> 24) & 0xff; - printf("TableOffset=%x\n", arb_table_pos); + printf("%c%s%c", (i ? ' ' : '\t'), arb_selects[i], FLAG(cr2, 1 << i)); + arb_table_pos = BITS(cr2, 24, 8); - printf("\t\tCtrl:\tArbSelect=%s\n", arb_selects[(ctrl >> 1) & 7]); + printf("\n\t\tCtrl:\tArbSelect=%s\n", TABLE(arb_selects, BITS(ctrl, 1, 3), buf)); printf("\t\tStatus:\tInProgress%c\n", FLAG(status, 1)); if (arb_table_pos) - printf("\t\tPort Arbitration Table \n"); + { + arb_table_pos = where + 16*arb_table_pos; + printf("\t\tPort Arbitration Table [%x] \n", arb_table_pos); + } for (i=0; i<=evc_cnt; i++) { @@ -273,10 +276,10 @@ cap_vc(struct device *d, int where) rctrl = get_conf_long(d, pos+4); rstatus = get_conf_word(d, pos+8); - pat_pos = (rcap >> 24) & 0xff; + pat_pos = BITS(rcap, 24, 8); printf("Caps:\tPATOffset=%02x MaxTimeSlots=%d RejSnoopTrans%c\n", pat_pos, - ((rcap >> 16) & 0x3f) + 1, + BITS(rcap, 16, 6) + 1, FLAG(rcap, 1 << 15)); printf("\t\t\tArb:"); @@ -286,9 +289,9 @@ cap_vc(struct device *d, int where) printf("\n\t\t\tCtrl:\tEnable%c ID=%d ArbSelect=%s TC/VC=%02x\n", FLAG(rctrl, 1 << 31), - (rctrl >> 24) & 7, - vc_arb_selects[(rctrl >> 17) & 7], - rctrl & 0xff); + BITS(rctrl, 24, 3), + TABLE(vc_arb_selects, BITS(rctrl, 17, 3), buf), + BITS(rctrl, 0, 8)); printf("\t\t\tStatus:\tNegoPending%c InProgress%c\n", FLAG(rstatus, 2), @@ -361,6 +364,25 @@ cap_rclink(struct device *d, int where) } } +static void +cap_evendor(struct device *d, int where) +{ + u32 hdr; + + printf("Vendor Specific Information: "); + if (!config_fetch(d, where + PCI_EVNDR_HEADER, 4)) + { + printf("\n"); + return; + } + + hdr = get_conf_long(d, where + PCI_EVNDR_HEADER); + printf("ID=%04x Rev=%d Len=%03x \n", + BITS(hdr, 0, 16), + BITS(hdr, 16, 4), + BITS(hdr, 20, 12)); +} + void show_ext_caps(struct device *d) { @@ -419,7 +441,7 @@ show_ext_caps(struct device *d) printf("Root Bridge Control Block \n"); break; case PCI_EXT_CAP_ID_VNDR: - printf("Vendor Specific Information \n"); + cap_evendor(d, where); break; case PCI_EXT_CAP_ID_ACS: cap_acs(d, where);