]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Decoding of the SATA HBA capability
authorMartin Mares <mj@ucw.cz>
Sat, 23 Jan 2010 21:39:53 +0000 (22:39 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 23 Jan 2010 21:39:53 +0000 (22:39 +0100)
lib/header.h
ls-caps.c

index 92d7d1ee932a90ea067470d7544f3b0192086b1c..63e975b2088d16df113037a71cd3b2ca1be31539 100644 (file)
 #define PCI_EXT_CAP_ID_ATS     0x0f    /* Address Translation Service */
 #define PCI_EXT_CAP_ID_SRIOV   0x10    /* Single Root I/O Virtualization */
 
+/*** Definitions of capabilities ***/
+
 /* Power Management Registers */
 
 #define  PCI_PM_CAP_VER_MASK   0x0007  /* Version (2=PM1.1) */
 #define PCI_AF_STATUS          5
 #define  PCI_AF_STATUS_TP      0x01
 
+/* SATA Host Bus Adapter */
+#define PCI_SATA_HBA_BARS      4
+#define PCI_SATA_HBA_REG0      8
+
+/*** Definitions of extended capabilities ***/
+
 /* Advanced Error Reporting */
 #define PCI_ERR_UNCOR_STATUS   4       /* Uncorrectable Error Status */
 #define  PCI_ERR_UNC_TRAIN     0x00000001      /* Undefined in PCIe rev1.1 & 2.0 spec */
index 5ca2cd43f384bf348da7167f8143b16350c7e947..cc478730e71fe0cf160dafb69a659a8d7c5111d4 100644 (file)
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -1164,6 +1164,29 @@ cap_af(struct device *d, int where)
   printf("\t\tAFStatus: TP%c\n", FLAG(reg, PCI_AF_STATUS_TP));
 }
 
+static void
+cap_sata_hba(struct device *d, int where, int cap)
+{
+  u32 bars;
+  int bar;
+
+  printf("SATA HBA v%d.%d", BITS(cap, 4, 4), BITS(cap, 0, 4));
+  if (verbose < 2 || !config_fetch(d, where + PCI_SATA_HBA_BARS, 4))
+    {
+      printf("\n");
+      return;
+    }
+
+  bars = get_conf_long(d, where + PCI_SATA_HBA_BARS);
+  bar = BITS(bars, 0, 4);
+  if (bar >= 4 && bar <= 9)
+    printf(" BAR%d Offset=%08x\n", bar - 4, BITS(bars, 4, 20));
+  else if (bar == 15)
+    printf(" InCfgSpace\n");
+  else
+    printf(" BAR??%d\n", bar);
+}
+
 void
 show_caps(struct device *d)
 {
@@ -1253,7 +1276,7 @@ show_caps(struct device *d)
              cap_msix(d, where, cap);
              break;
            case PCI_CAP_ID_SATA:
-             printf("SATA HBA <?>\n");
+             cap_sata_hba(d, where, cap);
              break;
            case PCI_CAP_ID_AF:
              cap_af(d, where);