[PATCH 5/6] xfree86: fbdevhw: move PCI region fetching code to common pci file
Tiago Vignatti
tiago.vignatti at nokia.com
Thu Aug 26 08:37:33 PDT 2010
Now xf86PciGetSize and xf86PciGetBaseAddr are used to fetch PCI regions.
Note that there's no semantical changes (e.g. there's a warning complaining
about a different size casting, which remains there).
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
hw/xfree86/fbdevhw/fbdevhw.c | 13 +++++++------
hw/xfree86/os-support/bus/Pci.c | 12 ++++++++++++
hw/xfree86/os-support/bus/Pci.h | 2 ++
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index f2035f8..5a414e7 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -11,6 +11,7 @@
/* pci stuff */
#include "xf86PciInfo.h"
#include "xf86Pci.h"
+#include "Pci.h"
#include "xf86cmap.h"
@@ -329,15 +330,15 @@ fbdev_open_pci(struct pci_device * pPci)
continue;
}
for (j = 0; j < 6; j++) {
- const pciaddr_t res_start = pPci->regions[j].base_addr;
- const pciaddr_t res_end = res_start + pPci->regions[j].size;
+ const uint64_t res_start = xf86PciGetBaseAddr(pPci, j);
+ const uint64_t res_end = res_start + xf86PciGetSize(pPci, j);
if ((0 != fix.smem_len &&
- (pciaddr_t) fix.smem_start >= res_start &&
- (pciaddr_t) fix.smem_start < res_end) ||
+ (uint64_t) fix.smem_start >= res_start &&
+ (uint64_t) fix.smem_start < res_end) ||
(0 != fix.mmio_len &&
- (pciaddr_t) fix.mmio_start >= res_start &&
- (pciaddr_t) fix.mmio_start < res_end))
+ (uint64_t) fix.mmio_start >= res_start &&
+ (uint64_t) fix.mmio_start < res_end))
break;
}
if (j == 6) {
diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c
index a0a597d..6e88139 100644
--- a/hw/xfree86/os-support/bus/Pci.c
+++ b/hw/xfree86/os-support/bus/Pci.c
@@ -155,3 +155,15 @@ xf86scanpci(void)
return success;
}
+
+uint64_t
+xf86PciGetBaseAddr(struct pci_device *pci, int idx)
+{
+ return (uint64_t) pci->regions[idx].base_addr;
+}
+
+uint64_t
+xf86PciGetSize(struct pci_device *pci, int idx)
+{
+ return (uint64_t) pci->regions[idx].size;
+}
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index e001c30..56eb258 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -157,5 +157,7 @@
#endif
extern void ARCH_PCI_INIT(void);
+uint64_t xf86PciGetBaseAddr(struct pci_device *pci, int idx);
+uint64_t xf86PciGetSize(struct pci_device *pci, int idx);
#endif /* _PCI_H */
--
1.7.1.226.g770c5
More information about the xorg-devel
mailing list