Skip to contentSkip to conversation

atyfb: Fix 64 bits resources on 32 bits archs

PATCH In review Benjamin Herrenschmidt 2 participants 3 messages Apr 22, 2008 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 atyfb: Fix 64 bits resources on 32 bits archs

This fixes atyfb to not truncate 64 bits resources on 32 bits platforms. Unfortunately, there are still issues with addresses returned to userspace via struct fb_fix_screeninfo. This will have to be dealt with separately.

---

 drivers/video/aty/atyfb_base.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/video/aty/atyfb_base.c +7 -7
@@ -2842,7 +2842,7 @@ static int atyfb_setcolreg(u_int regno, 
 #ifdef __sparc__
 
 static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
-			struct fb_info *info, unsigned long addr)
+			struct fb_info *info, resource_size_t addr)
 {
 	struct atyfb_par *par = info->par;
 	struct device_node *dp;
@@ -3334,11 +3334,11 @@ static int __devinit init_from_bios(stru
 }
 #endif /* __i386__ */
 
-static int __devinit atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info, unsigned long addr)
+static int __devinit atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info, resource_size_t addr)
 {
 	struct atyfb_par *par = info->par;
 	u16 tmp;
-	unsigned long raddr;
+	resource_size_t raddr;
 	struct resource *rrp;
 	int ret = 0;
 
@@ -3351,8 +3351,8 @@ static int __devinit atyfb_setup_generic
 		PRINTKI("using auxiliary register aperture\n");
 	}
 
-	info->fix.mmio_start = raddr;
-	par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000);
+	info->fix.mmio_start = (unsigned long)raddr;
+	par->ati_regbase = ioremap(raddr, 0x1000);
 	if (par->ati_regbase == 0)
 		return -ENOMEM;
 
@@ -3374,7 +3374,7 @@ static int __devinit atyfb_setup_generic
 #endif
 
 	/* Map in frame buffer */
-	info->fix.smem_start = addr;
+	info->fix.smem_start = (unsigned long)addr;
 	info->screen_base = ioremap(addr, 0x800000);
 	if (info->screen_base == NULL) {
 		ret = -ENOMEM;
@@ -3411,7 +3411,7 @@ atyfb_setup_generic_fail:
 
 static int __devinit atyfb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-	unsigned long addr, res_start, res_size;
+	resource_size_t addr, res_start, res_size;
 	struct fb_info *info;
 	struct resource *rp;
 	struct atyfb_par *par;
#1 lore raw
Quoted 6 lines · Benjamin Herrenschmidt

This fixes atyfb to not truncate 64 bits resources on 32 bits platforms. Unfortunately, there are still issues with addresses returned to userspace via struct fb_fix_screeninfo. This will have to be dealt with separately.

[...]

drivers/video/aty/atyfb_base.c static int atyfb_setcolreg(u_int regno, · line 2845

Quoted 8 lines
drivers/video/aty/atyfb_base.c +1 -1
@@ -2842,7 +2842,7 @@ static int atyfb_setcolreg(u_int regno, 
 #ifdef __sparc__
 
 static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
-			struct fb_info *info, unsigned long addr)
+			struct fb_info *info, resource_size_t addr)

Not sure what that change gives us -- this function mostly treats 'addr'
as unsigned long (casting it to char/void *), ot compares it to 'unsigned long' 'base' variable -- which should be made 'resource_size_t' in its turn being assigned resource's start value. So, this part of patch looks incomplete (and yet I'm not sure if SPARC really needs all that)...

WBR, Sergei

#2 lore raw
Quoted 5 lines · Sergei Shtylyov

Not sure what that change gives us -- this function mostly treats 'addr'
as unsigned long (casting it to char/void *), ot compares it to 'unsigned long' 'base' variable -- which should be made 'resource_size_t' in its turn being assigned resource's start value. So, this part of patch looks incomplete (and yet I'm not sure if SPARC really needs all that)...

I just wanted to make sure both setup functions has the same prototype.

I think sparc doesn't need fixing in there.

Ben.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone