[PATCH 1/2] PCIUtiles: support PCI Advanced Features capability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The capability is defined by
http://www.pcisig.com/specifications/conventional/pci_30/ECN_Conventional_Adv_Caps_27Jul06.pdf

Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>
---
 lib/header.h |    9 +++++++++
 ls-caps.c    |   22 ++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/lib/header.h b/lib/header.h
index ec34f44..8911c17 100644
--- a/lib/header.h
+++ b/lib/header.h
@@ -871,6 +871,15 @@
 #define PCI_SSVID_VENDOR	4
 #define PCI_SSVID_DEVICE	6
 
+/* PCI Advanced Features */
+#define PCI_AF_CAP		3
+#define  PCI_AF_CAP_TP		0x01
+#define  PCI_AF_CAP_FLR		0x02
+#define PCI_AF_CTRL		4
+#define  PCI_AF_CTRL_FLR	0x01
+#define PCI_AF_STATUS		5
+#define  PCI_AF_STATUS_TP	0x01
+
 /* 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 */
diff --git a/ls-caps.c b/ls-caps.c
index 3e01f2c..fb20ac0 100644
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -1146,6 +1146,24 @@ cap_debug_port(int cap)
   printf("Debug port: BAR=%d offset=%04x\n", bar, pos);
 }
 
+static void
+cap_af(struct device *d, int where)
+{
+  u8 reg;
+
+  printf("PCI Advanced Features\n");
+  if (verbose < 2 || !config_fetch(d, where + PCI_AF_CAP, 3))
+    return;
+
+  reg = get_conf_byte(d, where + PCI_AF_CAP);
+  printf("\t\tAFCap: TP%c FLR%c\n", FLAG(reg, PCI_AF_CAP_TP),
+	 FLAG(reg, PCI_AF_CAP_FLR));
+  reg = get_conf_byte(d, where + PCI_AF_CTRL);
+  printf("\t\tAFCtrl: FLR%c\n", FLAG(reg, PCI_AF_CTRL_FLR));
+  reg = get_conf_byte(d, where + PCI_AF_STATUS);
+  printf("\t\tAFStatus: TP%c\n", FLAG(reg, PCI_AF_STATUS_TP));
+}
+
 void
 show_caps(struct device *d)
 {
@@ -1207,7 +1225,7 @@ show_caps(struct device *d)
 	      cap_ht(d, where, cap);
 	      break;
 	    case PCI_CAP_ID_VNDR:
-	      printf("Vendor Specific Information <?>\n");
+	      printf("Vendor Specific Information\n");
 	      break;
 	    case PCI_CAP_ID_DBG:
 	      cap_debug_port(cap);
@@ -1238,7 +1256,7 @@ show_caps(struct device *d)
 	      printf("SATA HBA <?>\n");
 	      break;
 	    case PCI_CAP_ID_AF:
-	      printf("PCIe advanced features <?>\n");
+	      cap_af(d, where);
 	      break;
 	    default:
 	      printf("#%02x [%04x]\n", id, cap);
-- 
1.6.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux