]> mj.ucw.cz Git - pciutils.git/blobdiff - lspci.c
More Windows stuff.
[pciutils.git] / lspci.c
diff --git a/lspci.c b/lspci.c
index dec904d4ccbdc5c840e5633197fae904c4cecb30..943c1cdc71066fb12bff247fd87db29b9b6560c0 100644 (file)
--- 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;
 {
   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("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));
         (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);
   lctr0 = get_conf_word(d, where + PCI_HT_PRI_LCTR0);
-  printf("\t\tLink Control 0: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x IsocEn%c LSEn%c ExtCTL%c 64b%c\n",
+  if (rid >= 0x23)
+    fmt = "\t\tLink Control 0: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x IsocEn%c LSEn%c ExtCTL%c 64b%c\n";
+  else
+    fmt = "\t\tLink Control 0: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x\n";
+  printf(fmt,
         FLAG(lctr0, PCI_HT_LCTR_CFLE),
         FLAG(lctr0, PCI_HT_LCTR_CST),
         FLAG(lctr0, PCI_HT_LCTR_CFE),
         FLAG(lctr0, PCI_HT_LCTR_CFLE),
         FLAG(lctr0, PCI_HT_LCTR_CST),
         FLAG(lctr0, PCI_HT_LCTR_CFE),
@@ -601,17 +614,25 @@ show_ht_pri(struct device *d, int where, int cmd)
         FLAG(lctr0, PCI_HT_LCTR_EXTCTL),
         FLAG(lctr0, PCI_HT_LCTR_64B));
   lcnf0 = get_conf_word(d, where + PCI_HT_PRI_LCNF0);
         FLAG(lctr0, PCI_HT_LCTR_EXTCTL),
         FLAG(lctr0, PCI_HT_LCTR_64B));
   lcnf0 = get_conf_word(d, where + PCI_HT_PRI_LCNF0);
-  printf("\t\tLink Config 0: MLWI=%s DwFcIn%c MLWO=%s DwFcOut%c LWI=%s DwFcInEn%c LWO=%s DwFcOutEn%c\n",
+  if (rid >= 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),
         ht_link_width(lcnf0 & PCI_HT_LCNF_MLWI),
-        FLAG(lcnf0, PCI_HT_LCNF_DFI),
         ht_link_width((lcnf0 & PCI_HT_LCNF_MLWO) >> 4),
         ht_link_width((lcnf0 & PCI_HT_LCNF_MLWO) >> 4),
-        FLAG(lcnf0, PCI_HT_LCNF_DFO),
         ht_link_width((lcnf0 & PCI_HT_LCNF_LWI) >> 8),
         ht_link_width((lcnf0 & PCI_HT_LCNF_LWI) >> 8),
-        FLAG(lcnf0, PCI_HT_LCNF_DFIE),
         ht_link_width((lcnf0 & PCI_HT_LCNF_LWO) >> 12),
         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);
         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 <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x IsocEn%c LSEn%c ExtCTL%c 64b%c\n",
+  if (rid >= 0x23)
+    fmt = "\t\tLink Control 1: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x IsocEn%c LSEn%c ExtCTL%c 64b%c\n";
+  else
+    fmt = "\t\tLink Control 1: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x\n";
+  printf(fmt,
         FLAG(lctr1, PCI_HT_LCTR_CFLE),
         FLAG(lctr1, PCI_HT_LCTR_CST),
         FLAG(lctr1, PCI_HT_LCTR_CFE),
         FLAG(lctr1, PCI_HT_LCTR_CFLE),
         FLAG(lctr1, PCI_HT_LCTR_CST),
         FLAG(lctr1, PCI_HT_LCTR_CFE),
@@ -625,18 +646,23 @@ show_ht_pri(struct device *d, int where, int cmd)
         FLAG(lctr1, PCI_HT_LCTR_EXTCTL),
         FLAG(lctr1, PCI_HT_LCTR_64B));
   lcnf1 = get_conf_word(d, where + PCI_HT_PRI_LCNF1);
         FLAG(lctr1, PCI_HT_LCTR_EXTCTL),
         FLAG(lctr1, PCI_HT_LCTR_64B));
   lcnf1 = get_conf_word(d, where + PCI_HT_PRI_LCNF1);
-  printf("\t\tLink Config 1: MLWI=%s DwFcIn%c MLWO=%s DwFcOut%c LWI=%s DwFcInEn%c LWO=%s DwFcOutEn%c\n",
+  if (rid >= 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),
         ht_link_width(lcnf1 & PCI_HT_LCNF_MLWI),
-        FLAG(lcnf1, PCI_HT_LCNF_DFI),
         ht_link_width((lcnf1 & PCI_HT_LCNF_MLWO) >> 4),
         ht_link_width((lcnf1 & PCI_HT_LCNF_MLWO) >> 4),
-        FLAG(lcnf1, PCI_HT_LCNF_DFO),
         ht_link_width((lcnf1 & PCI_HT_LCNF_LWI) >> 8),
         ht_link_width((lcnf1 & PCI_HT_LCNF_LWI) >> 8),
-        FLAG(lcnf1, PCI_HT_LCNF_DFIE),
         ht_link_width((lcnf1 & PCI_HT_LCNF_LWO) >> 12),
         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));
         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));
   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: <Prot%c <Ovfl%c <EOC%c CTLTm%c\n",
   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: <Prot%c <Ovfl%c <EOC%c CTLTm%c\n",
@@ -715,12 +741,23 @@ show_ht_sec(struct device *d, int where, int cmd)
 {
   u16 lctr, lcnf, ftr, eh;
   u8 rid, lfrer, lfcap, mbu, mlu;
 {
   u16 lctr, lcnf, ftr, eh;
   u8 rid, lfrer, lfcap, mbu, mlu;
+  char *fmt;
 
   printf("HyperTransport: Host or Secondary Interface\n");
   if (verbose < 2)
     return;
 
 
   printf("HyperTransport: Host or Secondary Interface\n");
   if (verbose < 2)
     return;
 
-  printf("\t\tCommand: WarmRst%c DblEnd%c DevNum=%u ChainSide%c HostHide%c Slave%c <EOCErr%c DUL%c\n",
+  if (!config_fetch(d, where + PCI_HT_SEC_LCTR, PCI_HT_SEC_SIZEOF - PCI_HT_SEC_LCTR))
+    return;
+  rid = get_conf_byte(d, where + PCI_HT_SEC_RID);
+  if (rid < 0x23 && rid > 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 <EOCErr%c DUL%c\n";
+  else
+    fmt = "\t\tCommand: WarmRst%c DblEnd%c\n";
+  printf(fmt,
         FLAG(cmd, PCI_HT_SEC_CMD_WR),
         FLAG(cmd, PCI_HT_SEC_CMD_DE),
         (cmd & PCI_HT_SEC_CMD_DN) >> 2,
         FLAG(cmd, PCI_HT_SEC_CMD_WR),
         FLAG(cmd, PCI_HT_SEC_CMD_DE),
         (cmd & PCI_HT_SEC_CMD_DN) >> 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));
         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);
   lctr = get_conf_word(d, where + PCI_HT_SEC_LCTR);
-  printf("\t\tLink Control: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x IsocEn%c LSEn%c ExtCTL%c 64b%c\n",
+  if (rid >= 0x23)
+    fmt = "\t\tLink Control: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x IsocEn%c LSEn%c ExtCTL%c 64b%c\n";
+  else
+    fmt = "\t\tLink Control: CFlE%c CST%c CFE%c <LkFail%c Init%c EOC%c TXO%c <CRCErr=%x\n";
+  printf(fmt,
         FLAG(lctr, PCI_HT_LCTR_CFLE),
         FLAG(lctr, PCI_HT_LCTR_CST),
         FLAG(lctr, PCI_HT_LCTR_CFE),
         FLAG(lctr, PCI_HT_LCTR_CFLE),
         FLAG(lctr, PCI_HT_LCTR_CST),
         FLAG(lctr, PCI_HT_LCTR_CFE),
@@ -746,18 +785,23 @@ show_ht_sec(struct device *d, int where, int cmd)
         FLAG(lctr, PCI_HT_LCTR_EXTCTL),
         FLAG(lctr, PCI_HT_LCTR_64B));
   lcnf = get_conf_word(d, where + PCI_HT_SEC_LCNF);
         FLAG(lctr, PCI_HT_LCTR_EXTCTL),
         FLAG(lctr, PCI_HT_LCTR_64B));
   lcnf = get_conf_word(d, where + PCI_HT_SEC_LCNF);
-  printf("\t\tLink Config: MLWI=%s DwFcIn%c MLWO=%s DwFcOut%c LWI=%s DwFcInEn%c LWO=%s DwFcOutEn%c\n",
+  if (rid >= 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),
         ht_link_width(lcnf & PCI_HT_LCNF_MLWI),
-        FLAG(lcnf, PCI_HT_LCNF_DFI),
         ht_link_width((lcnf & PCI_HT_LCNF_MLWO) >> 4),
         ht_link_width((lcnf & PCI_HT_LCNF_MLWO) >> 4),
-        FLAG(lcnf, PCI_HT_LCNF_DFO),
         ht_link_width((lcnf & PCI_HT_LCNF_LWI) >> 8),
         ht_link_width((lcnf & PCI_HT_LCNF_LWI) >> 8),
-        FLAG(lcnf, PCI_HT_LCNF_DFIE),
         ht_link_width((lcnf & PCI_HT_LCNF_LWO) >> 12),
         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));
         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));
   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: <Prot%c <Ovfl%c <EOC%c CTLTm%c\n",
   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: <Prot%c <Ovfl%c <EOC%c CTLTm%c\n",
@@ -872,21 +916,33 @@ show_ht(struct device *d, int where, int cmd)
 }
 
 static void
 }
 
 static void
-show_rom(struct device *d)
+show_rom(struct device *d, int reg)
 {
   struct pci_dev *p = d->dev;
   pciaddr_t rom = p->rom_base_addr;
   pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->rom_size : 0;
 {
   struct pci_dev *p = d->dev;
   pciaddr_t rom = p->rom_base_addr;
   pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->rom_size : 0;
+  u32 flg = get_conf_long(d, reg);
+  word cmd = get_conf_word(d, PCI_COMMAND);
 
 
-  if (!rom && !len)
+  if (!rom && !flg && !len)
     return;
     return;
-  printf("\tExpansion ROM at ");
+  putchar('\t');
+  if ((rom & PCI_ROM_ADDRESS_MASK) && !(flg & PCI_ROM_ADDRESS_MASK))
+    {
+      printf("[virtual] ");
+      flg = rom;
+    }
+  printf("Expansion ROM at ");
   if (rom & PCI_ROM_ADDRESS_MASK)
     printf(PCIADDR_T_FMT, rom & PCI_ROM_ADDRESS_MASK);
   if (rom & PCI_ROM_ADDRESS_MASK)
     printf(PCIADDR_T_FMT, rom & PCI_ROM_ADDRESS_MASK);
+  else if (flg & PCI_ROM_ADDRESS_MASK)
+    printf("<ignored>");
   else
     printf("<unassigned>");
   else
     printf("<unassigned>");
-  if (!(rom & PCI_ROM_ADDRESS_ENABLE))
+  if (!(flg & PCI_ROM_ADDRESS_ENABLE))
     printf(" [disabled]");
     printf(" [disabled]");
+  else if (!(cmd & PCI_COMMAND_MEMORY))
+    printf(" [disabled by cmd]");
   show_size(len);
   putchar('\n');
 }
   show_size(len);
   putchar('\n');
 }
@@ -1319,7 +1375,7 @@ static void
 show_htype0(struct device *d)
 {
   show_bases(d, 6);
 show_htype0(struct device *d)
 {
   show_bases(d, 6);
-  show_rom(d);
+  show_rom(d, PCI_ROM_ADDRESS);
   show_caps(d);
 }
 
   show_caps(d);
 }
 
@@ -1407,7 +1463,7 @@ show_htype1(struct device *d)
             FLAG(sec_stat, PCI_STATUS_SIG_SYSTEM_ERROR),
             FLAG(sec_stat, PCI_STATUS_DETECTED_PARITY));
 
             FLAG(sec_stat, PCI_STATUS_SIG_SYSTEM_ERROR),
             FLAG(sec_stat, PCI_STATUS_DETECTED_PARITY));
 
-  show_rom(d);
+  show_rom(d, PCI_ROM_ADDRESS1);
 
   if (verbose > 1)
     printf("\tBridgeCtl: Parity%c SERR%c NoISA%c VGA%c MAbort%c >Reset%c FastB2B%c\n",
 
   if (verbose > 1)
     printf("\tBridgeCtl: Parity%c SERR%c NoISA%c VGA%c MAbort%c >Reset%c FastB2B%c\n",