[libvirt] [PATCH v2 1/2] virpci: Introduce virPCIDeviceIsPCIExpress and friends
Martin Kletzander
mkletzan at redhat.com
Mon Jun 16 13:44:50 UTC 2014
On Thu, Jun 12, 2014 at 05:27:34PM +0200, Michal Privoznik wrote:
>These functions will handle PCIe devices and their link capabilities
>to query some info about it.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/libvirt_private.syms | 3 ++
> src/util/virpci.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++-
> src/util/virpci.h | 8 ++++
> 3 files changed, 106 insertions(+), 1 deletion(-)
>
[...]
>diff --git a/src/util/virpci.c b/src/util/virpci.c
>index e0f2344..6f4f6af 100644
>--- a/src/util/virpci.c
>+++ b/src/util/virpci.c
>@@ -120,6 +120,7 @@ struct _virPCIDeviceList {
>
> /* PCI30 6.7 Capabilities List */
> #define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
>+#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
>
> /* PM12 3.2.1 Capability Identifier */
> #define PCI_CAP_ID_PM 0x01 /* Power Management */
>@@ -130,7 +131,13 @@ struct _virPCIDeviceList {
>
> /* PCIe20 7.8.3 Device Capabilities Register (Offset 04h) */
> #define PCI_EXP_DEVCAP 0x4 /* Device capabilities */
>-#define PCI_EXP_DEVCAP_FLR (1<<28) /* Function Level Reset */
>+#define PCI_EXP_DEVCAP_FLR (1<<28) /* Function Level Reset */
>+#define PCI_EXP_LNKCAP 0xc /* Link Capabilities */
>+#define PCI_EXP_LNKCAP_SPEED 0x0000f /* Maximum Link Speed */
>+#define PCI_EXP_LNKCAP_WIDTH 0x003f0 /* Maximum Link Width */
>+#define PCI_EXP_LNKSTA 0x12 /* Link Status */
>+#define PCI_EXP_LNKSTA_SPEED 0x000f /* Negotiated Link Speed */
>+#define PCI_EXP_LNKSTA_WIDTH 0x03f0 /* Negotiated Link Width */
>
I'm still not convinced that this isn't just obfuscating the code, but
as far as the usage goes, this work (and will work) as expected, I
just blabbed about the looks of it.
ACK,
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140616/557311fd/attachment-0001.sig>
More information about the libvir-list
mailing list