From be697708d805c44a03d47279a23bbe08939f6d4f Mon Sep 17 00:00:00 2001 From: Yu Zhao Date: Mon, 10 Nov 2008 12:24:55 +0100 Subject: [PATCH] Added dumping of the Address Translation Services capability. --- lib/header.h | 8 ++++++++ lspci.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/lib/header.h b/lib/header.h index aa163a0..4e84f07 100644 --- a/lib/header.h +++ b/lib/header.h @@ -220,6 +220,7 @@ #define PCI_EXT_CAP_ID_VNDR 0x0b /* Vendor specific */ #define PCI_EXT_CAP_ID_ACS 0x0d /* Access Controls */ #define PCI_EXT_CAP_ID_ARI 0x0e /* Alternative Routing-ID Interpretation */ +#define PCI_EXT_CAP_ID_ATS 0x0f /* Address Translation Service */ #define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */ /* Power Management Registers */ @@ -953,6 +954,13 @@ #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ +/* Address Translation Service */ +#define PCI_ATS_CAP 0x04 /* ATS Capability Register */ +#define PCI_ATS_CAP_IQD(x) ((x) & 0x1f) /* Invalidate Queue Depth */ +#define PCI_ATS_CTRL 0x06 /* ATS Control Register */ +#define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ +#define PCI_ATS_CTRL_ENABLE 0x80 /* ATS Enable */ + /* Single Root I/O Virtualization */ #define PCI_IOV_CAP 0x04 /* SR-IOV Capability Register */ #define PCI_IOV_CAP_VFM 0x00000001 /* VF Migration Capable */ diff --git a/lspci.c b/lspci.c index ddedb42..6413451 100644 --- a/lspci.c +++ b/lspci.c @@ -1590,6 +1590,22 @@ cap_ari(struct device *d, int where) PCI_ARI_CTRL_FG(w)); } +static void +cap_ats(struct device *d, int where) +{ + u16 w; + + printf("Address Translation Service (ATS)\n"); + if (!config_fetch(d, where + PCI_ATS_CAP, 4)) + return; + + w = get_conf_word(d, where + PCI_ATS_CAP); + printf("\t\tATSCap:\tInvalidate Queue Depth: %02x\n", PCI_ATS_CAP_IQD(w)); + w = get_conf_word(d, where + PCI_ATS_CTRL); + printf("\t\tATSCtl:\tEnable%c, Smallest Translation Unit: %02x\n", + FLAG(w, PCI_ATS_CTRL_ENABLE), PCI_ATS_CTRL_STU(w)); +} + static void cap_sriov(struct device *d, int where) { @@ -1694,6 +1710,9 @@ show_ext_caps(struct device *d) case PCI_EXT_CAP_ID_ARI: cap_ari(d, where); break; + case PCI_EXT_CAP_ID_ATS: + cap_ats(d, where); + break; case PCI_EXT_CAP_ID_SRIOV: cap_sriov(d, where); break; -- 2.39.2