aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-02-02 00:55:45 -0500
committerDave Airlie <airlied@redhat.com>2009-03-13 00:23:56 -0400
commitd883f7f1b75c8dcafa891f7b9e69c5a2f0ff6d66 (patch)
tree765a9bf6d3322ecfa42819622981baea2480ba41
parent041b62374c7fedc11a8a1eeda2868612d3d1436c (diff)
drm: Use resource_size_t for drm_get_resource_{start, len}
The DRM uses its own wrappers to obtain resources from PCI devices, which currently convert the resource_size_t into an unsigned long. This is broken on 32-bit platforms with >32-bit physical address space. This fixes them, along with a few occurences of unsigned long used to store such a resource in drivers. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
-rw-r--r--drivers/gpu/drm/drm_bufs.c4
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c2
-rw-r--r--drivers/gpu/drm/mga/mga_drv.h4
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.h2
-rw-r--r--drivers/gpu/drm/savage/savage_bci.c8
-rw-r--r--include/drm/drmP.h6
-rw-r--r--include/drm/drm_crtc.h2
7 files changed, 14 insertions, 14 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 12715d3c078d..fab899eec051 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -36,13 +36,13 @@
36#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
37#include "drmP.h" 37#include "drmP.h"
38 38
39unsigned long drm_get_resource_start(struct drm_device *dev, unsigned int resource) 39resource_size_t drm_get_resource_start(struct drm_device *dev, unsigned int resource)
40{ 40{
41 return pci_resource_start(dev->pdev, resource); 41 return pci_resource_start(dev->pdev, resource);
42} 42}
43EXPORT_SYMBOL(drm_get_resource_start); 43EXPORT_SYMBOL(drm_get_resource_start);
44 44
45unsigned long drm_get_resource_len(struct drm_device *dev, unsigned int resource) 45resource_size_t drm_get_resource_len(struct drm_device *dev, unsigned int resource)
46{ 46{
47 return pci_resource_len(dev->pdev, resource); 47 return pci_resource_len(dev->pdev, resource);
48} 48}
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 6d21b9e48b89..4d9f5c6818ca 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1057,7 +1057,7 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master)
1057int i915_driver_load(struct drm_device *dev, unsigned long flags) 1057int i915_driver_load(struct drm_device *dev, unsigned long flags)
1058{ 1058{
1059 struct drm_i915_private *dev_priv = dev->dev_private; 1059 struct drm_i915_private *dev_priv = dev->dev_private;
1060 unsigned long base, size; 1060 resource_size_t base, size;
1061 int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; 1061 int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1;
1062 1062
1063 /* i915 has 4 more counters */ 1063 /* i915 has 4 more counters */
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index 88257c276eb9..6bf4de990325 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -113,8 +113,8 @@ typedef struct drm_mga_private {
113 * \sa drm_mga_private_t::mmio 113 * \sa drm_mga_private_t::mmio
114 */ 114 */
115 /*@{ */ 115 /*@{ */
116 u32 mmio_base; /**< Bus address of base of MMIO. */ 116 resource_size_t mmio_base; /**< Bus address of base of MMIO. */
117 u32 mmio_size; /**< Size of the MMIO region. */ 117 resource_size_t mmio_size; /**< Size of the MMIO region. */
118 /*@} */ 118 /*@} */
119 119
120 u32 clear_cmd; 120 u32 clear_cmd;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h
index 490bc7ceef60..c608e22f73f9 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.h
+++ b/drivers/gpu/drm/radeon/radeon_drv.h
@@ -316,7 +316,7 @@ typedef struct drm_radeon_private {
316 316
317 /* starting from here on, data is preserved accross an open */ 317 /* starting from here on, data is preserved accross an open */
318 uint32_t flags; /* see radeon_chip_flags */ 318 uint32_t flags; /* see radeon_chip_flags */
319 unsigned long fb_aper_offset; 319 resource_size_t fb_aper_offset;
320 320
321 int num_gb_pipes; 321 int num_gb_pipes;
322 int track_flush; 322 int track_flush;
diff --git a/drivers/gpu/drm/savage/savage_bci.c b/drivers/gpu/drm/savage/savage_bci.c
index d465b2f9c1cd..456cd040f31a 100644
--- a/drivers/gpu/drm/savage/savage_bci.c
+++ b/drivers/gpu/drm/savage/savage_bci.c
@@ -599,8 +599,8 @@ int savage_driver_firstopen(struct drm_device *dev)
599 drm_mtrr_add(dev_priv->mtrr[2].base, 599 drm_mtrr_add(dev_priv->mtrr[2].base,
600 dev_priv->mtrr[2].size, DRM_MTRR_WC); 600 dev_priv->mtrr[2].size, DRM_MTRR_WC);
601 } else { 601 } else {
602 DRM_ERROR("strange pci_resource_len %08lx\n", 602 DRM_ERROR("strange pci_resource_len %08llx\n",
603 drm_get_resource_len(dev, 0)); 603 (unsigned long long)drm_get_resource_len(dev, 0));
604 } 604 }
605 } else if (dev_priv->chipset != S3_SUPERSAVAGE && 605 } else if (dev_priv->chipset != S3_SUPERSAVAGE &&
606 dev_priv->chipset != S3_SAVAGE2000) { 606 dev_priv->chipset != S3_SAVAGE2000) {
@@ -620,8 +620,8 @@ int savage_driver_firstopen(struct drm_device *dev)
620 drm_mtrr_add(dev_priv->mtrr[0].base, 620 drm_mtrr_add(dev_priv->mtrr[0].base,
621 dev_priv->mtrr[0].size, DRM_MTRR_WC); 621 dev_priv->mtrr[0].size, DRM_MTRR_WC);
622 } else { 622 } else {
623 DRM_ERROR("strange pci_resource_len %08lx\n", 623 DRM_ERROR("strange pci_resource_len %08llx\n",
624 drm_get_resource_len(dev, 1)); 624 (unsigned long long)drm_get_resource_len(dev, 1));
625 } 625 }
626 } else { 626 } else {
627 mmio_base = drm_get_resource_start(dev, 0); 627 mmio_base = drm_get_resource_start(dev, 0);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e5f4ae989abf..34e1676b53d1 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1173,10 +1173,10 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1173extern int drm_mapbufs(struct drm_device *dev, void *data, 1173extern int drm_mapbufs(struct drm_device *dev, void *data,
1174 struct drm_file *file_priv); 1174 struct drm_file *file_priv);
1175extern int drm_order(unsigned long size); 1175extern int drm_order(unsigned long size);
1176extern unsigned long drm_get_resource_start(struct drm_device *dev, 1176extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1177 unsigned int resource);
1178extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1177 unsigned int resource); 1179 unsigned int resource);
1178extern unsigned long drm_get_resource_len(struct drm_device *dev,
1179 unsigned int resource);
1180 1180
1181 /* DMA support (drm_dma.h) */ 1181 /* DMA support (drm_dma.h) */
1182extern int drm_dma_setup(struct drm_device *dev); 1182extern int drm_dma_setup(struct drm_device *dev);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5ded1acfb543..33ae98ced80e 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -550,7 +550,7 @@ struct drm_mode_config {
550 int min_width, min_height; 550 int min_width, min_height;
551 int max_width, max_height; 551 int max_width, max_height;
552 struct drm_mode_config_funcs *funcs; 552 struct drm_mode_config_funcs *funcs;
553 unsigned long fb_base; 553 resource_size_t fb_base;
554 554
555 /* pointers to standard properties */ 555 /* pointers to standard properties */
556 struct list_head property_blob_list; 556 struct list_head property_blob_list;