thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
0a122b
From 35510628e459d51b1ef6048bb307462a75ecf2d2 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <35510628e459d51b1ef6048bb307462a75ecf2d2.1387298827.git.minovotn@redhat.com>
0a122b
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 15:18:04 +0100
0a122b
Subject: [PATCH 29/56] pcie_host: expose address format
0a122b
0a122b
RH-Author: Michael S. Tsirkin <mst@redhat.com>
0a122b
Message-id: <1387293161-4085-30-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 56335
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 29/57] pcie_host: expose address format
0a122b
Bugzilla: 1034876
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
Callers pass in the address so it's helpful for
0a122b
them to be able to decode it.
0a122b
0a122b
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
0a122b
Tested-by: Igor Mammedov <imammedo@redhat.com>
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
(cherry picked from commit 6f6d282330a3c85ecbeb54dec5b57282bd177b44)
0a122b
---
0a122b
 include/hw/pci/pcie_host.h | 21 +++++++++++++++++++++
0a122b
 hw/pci/pcie_host.c         | 21 ---------------------
0a122b
 2 files changed, 21 insertions(+), 21 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 hw/pci/pcie_host.c         | 21 ---------------------
0a122b
 include/hw/pci/pcie_host.h | 21 +++++++++++++++++++++
0a122b
 2 files changed, 21 insertions(+), 21 deletions(-)
0a122b
0a122b
diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c
0a122b
index 0a78a8f..a6db258 100644
0a122b
--- a/hw/pci/pcie_host.c
0a122b
+++ b/hw/pci/pcie_host.c
0a122b
@@ -24,27 +24,6 @@
0a122b
 #include "hw/pci/pcie_host.h"
0a122b
 #include "exec/address-spaces.h"
0a122b
 
0a122b
-/*
0a122b
- * PCI express mmcfig address
0a122b
- * bit 20 - 28: bus number
0a122b
- * bit 15 - 19: device number
0a122b
- * bit 12 - 14: function number
0a122b
- * bit  0 - 11: offset in configuration space of a given device
0a122b
- */
0a122b
-#define PCIE_MMCFG_SIZE_MAX             (1ULL << 28)
0a122b
-#define PCIE_MMCFG_SIZE_MIN             (1ULL << 20)
0a122b
-#define PCIE_MMCFG_BUS_BIT              20
0a122b
-#define PCIE_MMCFG_BUS_MASK             0x1ff
0a122b
-#define PCIE_MMCFG_DEVFN_BIT            12
0a122b
-#define PCIE_MMCFG_DEVFN_MASK           0xff
0a122b
-#define PCIE_MMCFG_CONFOFFSET_MASK      0xfff
0a122b
-#define PCIE_MMCFG_BUS(addr)            (((addr) >> PCIE_MMCFG_BUS_BIT) & \
0a122b
-                                         PCIE_MMCFG_BUS_MASK)
0a122b
-#define PCIE_MMCFG_DEVFN(addr)          (((addr) >> PCIE_MMCFG_DEVFN_BIT) & \
0a122b
-                                         PCIE_MMCFG_DEVFN_MASK)
0a122b
-#define PCIE_MMCFG_CONFOFFSET(addr)     ((addr) & PCIE_MMCFG_CONFOFFSET_MASK)
0a122b
-
0a122b
-
0a122b
 /* a helper function to get a PCIDevice for a given mmconfig address */
0a122b
 static inline PCIDevice *pcie_dev_find_by_mmcfg_addr(PCIBus *s,
0a122b
                                                      uint32_t mmcfg_addr)
0a122b
diff --git a/include/hw/pci/pcie_host.h b/include/hw/pci/pcie_host.h
0a122b
index bac3c67..da0f275 100644
0a122b
--- a/include/hw/pci/pcie_host.h
0a122b
+++ b/include/hw/pci/pcie_host.h
0a122b
@@ -54,4 +54,25 @@ void pcie_host_mmcfg_update(PCIExpressHost *e,
0a122b
                             hwaddr addr,
0a122b
                             uint32_t size);
0a122b
 
0a122b
+/*
0a122b
+ * PCI express ECAM (Enhanced Configuration Address Mapping) format.
0a122b
+ * AKA mmcfg address
0a122b
+ * bit 20 - 28: bus number
0a122b
+ * bit 15 - 19: device number
0a122b
+ * bit 12 - 14: function number
0a122b
+ * bit  0 - 11: offset in configuration space of a given device
0a122b
+ */
0a122b
+#define PCIE_MMCFG_SIZE_MAX             (1ULL << 28)
0a122b
+#define PCIE_MMCFG_SIZE_MIN             (1ULL << 20)
0a122b
+#define PCIE_MMCFG_BUS_BIT              20
0a122b
+#define PCIE_MMCFG_BUS_MASK             0x1ff
0a122b
+#define PCIE_MMCFG_DEVFN_BIT            12
0a122b
+#define PCIE_MMCFG_DEVFN_MASK           0xff
0a122b
+#define PCIE_MMCFG_CONFOFFSET_MASK      0xfff
0a122b
+#define PCIE_MMCFG_BUS(addr)            (((addr) >> PCIE_MMCFG_BUS_BIT) & \
0a122b
+                                         PCIE_MMCFG_BUS_MASK)
0a122b
+#define PCIE_MMCFG_DEVFN(addr)          (((addr) >> PCIE_MMCFG_DEVFN_BIT) & \
0a122b
+                                         PCIE_MMCFG_DEVFN_MASK)
0a122b
+#define PCIE_MMCFG_CONFOFFSET(addr)     ((addr) & PCIE_MMCFG_CONFOFFSET_MASK)
0a122b
+
0a122b
 #endif /* PCIE_HOST_H */
0a122b
-- 
0a122b
1.7.11.7
0a122b