[parisc-linux-cvs] 2.4.18-pa1, stifb ranges in /proc/iomem

Helge Deller deller@gmx.de
Wed, 27 Feb 2002 21:08:42 +0100


--------------Boundary-00=_IYJ7XFVC7VBH0NZG3RU5
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

On Wednesday 27 February 2002 21:11, Helge Deller wrote:
> CVSROOT:	/var/cvs
> Module name:	linux
> Changes by:	deller	02/02/27 13:11:49
>
> Modified files:
> 	.              : Makefile
> 	drivers/video/sti: stifb.c
>
> Log message:
> - 2.4.18-pa1
> - added stifb fb- and mmio ranges to /proc/iomem



--------------Boundary-00=_IYJ7XFVC7VBH0NZG3RU5
Content-Type: text/plain;
  charset="iso-8859-1";
  name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="diff"

Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.271
diff -u -p -r1.271 Makefile
--- Makefile	2002/02/26 00:44:35	1.271
+++ Makefile	2002/02/27 20:09:51
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 18
-EXTRAVERSION = -pa0
+EXTRAVERSION = -pa1
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
Index: drivers/video/sti/stifb.c
===================================================================
RCS file: /var/cvs/linux/drivers/video/sti/stifb.c,v
retrieving revision 1.27
diff -u -p -r1.27 stifb.c
--- drivers/video/sti/stifb.c	2002/01/04 22:47:39	1.27
+++ drivers/video/sti/stifb.c	2002/02/27 20:09:52
@@ -66,6 +66,8 @@
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/selection.h>
+#include <linux/ioport.h>
+#include <linux/pci.h>
 
 #include <video/fbcon.h>
 #include <video/fbcon-cfb8.h>
@@ -1209,7 +1211,7 @@ stifb_init_fb(struct sti_struct *sti, in
 
 	fb = kmalloc(sizeof(struct stifb_info), GFP_ATOMIC);
 	if (!fb) {
-		printk ("Could not allocate stifb structure\n");
+		printk(KERN_ERR "Could not allocate stifb structure\n");
 		return -ENODEV;
 	}
 	
@@ -1232,9 +1234,8 @@ stifb_init_fb(struct sti_struct *sti, in
 	    (fb->id != S9000_ID_HCRX) &&
 	    (fb->id != S9000_ID_TIMBER) &&
 	    (fb->id != S9000_ID_A1659A) &&
-	    (fb->id != CRT_ID_VISUALIZE_EG)) {
-		return -ENXIO;
-	}
+	    (fb->id != CRT_ID_VISUALIZE_EG))
+		goto out_err1;
 #endif
 	
 	/* default to 8 bpp on most graphic chips */
@@ -1246,6 +1247,7 @@ stifb_init_fb(struct sti_struct *sti, in
 
 	/* get (virtual) io region base addr */
 	fix->mmio_start = REGION_BASE(fb,2);
+	fix->mmio_len   = 0x400000;
 
        	/* Reject any device not in the NGLE family */
 	switch (fb->id) {
@@ -1308,7 +1310,7 @@ stifb_init_fb(struct sti_struct *sti, in
 			"stifb: Unsupported graphics card (id=0x%08x) "
 				"- skipping.\n",
 			fb->id);
-		return -ENXIO;
+		goto out_err1;
 #endif
 	}
 
@@ -1318,7 +1320,10 @@ stifb_init_fb(struct sti_struct *sti, in
 	fix->line_length = (PTR_STI(fb->sti->glob_cfg)->total_x * bpp) / 8;
 	if (!fix->line_length)
 		fix->line_length = 2048; /* default */
-	fix->smem_len = PTR_STI(fb->sti->glob_cfg)->total_y *
+	if (fb->sti->pd)
+		fix->smem_len = pci_resource_len(fb->sti->pd, 0);
+	else
+		fix->smem_len = PTR_STI(fb->sti->glob_cfg)->total_y *
 				fix->line_length;
 	fix->accel = FB_ACCEL_NONE;
 
@@ -1383,8 +1388,20 @@ stifb_init_fb(struct sti_struct *sti, in
 	
 	stifb_set_disp(fb);
 
+	if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb")) {
+		printk(KERN_ERR "cannot reserve fb region 0x%04lx-0x%04lx\n",
+				fix->smem_start, fix->smem_start+fix->smem_len);
+		goto out_err1;
+	}
+		
+	if (!request_mem_region(fix->mmio_start, fix->mmio_len, "stifb mmio")) {
+		printk(KERN_ERR "cannot reserve sti mmio region 0x%04lx-0x%04lx\n",
+				fix->mmio_start, fix->mmio_start+fix->mmio_len);
+		goto out_err2;
+	}
+
 	if (register_framebuffer(&fb->info) < 0)
-		return -EINVAL;
+		goto out_err3;
 
 	printk(KERN_INFO 
 	    "fb%d: %s %dx%d-%d frame buffer device, id: %04x, mmio: 0x%04lx\n",
@@ -1395,7 +1412,17 @@ stifb_init_fb(struct sti_struct *sti, in
 		disp->var.bits_per_pixel,
 		fb->id, 
 		fix->mmio_start);
+
 	return 0;
+
+
+out_err3:
+	release_mem_region(fix->mmio_start, fix->mmio_len);
+out_err2:
+	release_mem_region(fix->smem_start, fix->smem_len);
+out_err1:
+	kfree(fb);
+	return -ENXIO;
 }
 
 int __init

--------------Boundary-00=_IYJ7XFVC7VBH0NZG3RU5--