linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Subject: [PATCH] radeonfb: Only request resources we need
Date: Wed, 31 Aug 2005 15:01:57 +1000	[thread overview]
Message-ID: <1125464517.5382.10.camel@gaston> (raw)

from: Daniel Burcaw <dburcaw@terrasoftsolutions.com>

This patch changes radeon to request only resources 0 and 2 instead of
all 3. This works around problems with some setups where BAR 1 (IO BAR)
has not been assigned by the firmware since it's not used on the machine
and the kernel fails to assign something to it due to the card being
between a P2P bridge that was configured without an IO range at all.

This typically fixes radeonfb on some Apple Xserve G5 machines

Signed-off-by: Daniel Burcaw <dburcaw@terrasoftsolutions.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Index: linux-work/drivers/video/aty/radeon_base.c
===================================================================
--- linux-work.orig/drivers/video/aty/radeon_base.c	2005-08-01 22:03:46.000000000 +1000
+++ linux-work/drivers/video/aty/radeon_base.c	2005-08-31 14:59:50.000000000 +1000
@@ -2312,19 +2312,27 @@
 	rinfo->mmio_base_phys = pci_resource_start (pdev, 2);
 
 	/* request the mem regions */
-	ret = pci_request_regions(pdev, "radeonfb");
+	ret = pci_request_region(pdev, 0, "radeonfb framebuffer");
 	if (ret < 0) {
-		printk( KERN_ERR "radeonfb (%s): cannot reserve PCI regions."
-			"  Someone already got them?\n", pci_name(rinfo->pdev));
+		printk( KERN_ERR "radeonfb (%s): cannot request region 0.\n",
+			pci_name(rinfo->pdev));
 		goto err_release_fb;
 	}
 
+	ret = pci_request_region(pdev, 2, "radeonfb mmio");
+	if (ret < 0) {
+		printk( KERN_ERR "radeonfb (%s): cannot request region 2.\n",
+			pci_name(rinfo->pdev));
+		goto err_release_pci0;
+	}
+
 	/* map the regions */
 	rinfo->mmio_base = ioremap(rinfo->mmio_base_phys, RADEON_REGSIZE);
 	if (!rinfo->mmio_base) {
-		printk(KERN_ERR "radeonfb (%s): cannot map MMIO\n", pci_name(rinfo->pdev));
+		printk(KERN_ERR "radeonfb (%s): cannot map MMIO\n",
+		       pci_name(rinfo->pdev));
 		ret = -EIO;
-		goto err_release_pci;
+		goto err_release_pci2;
 	}
 
 	rinfo->fb_local_base = INREG(MC_FB_LOCATION) << 16;
@@ -2499,10 +2507,12 @@
 	if (rinfo->bios_seg)
 		radeon_unmap_ROM(rinfo, pdev);
 	iounmap(rinfo->mmio_base);
-err_release_pci:
-	pci_release_regions(pdev);
+err_release_pci2:
+	pci_release_region(pdev, 2);
+err_release_pci0:
+	pci_release_region(pdev, 0);
 err_release_fb:
-	framebuffer_release(info);
+        framebuffer_release(info);
 err_disable:
 	pci_disable_device(pdev);
 err_out:
@@ -2548,7 +2558,8 @@
         iounmap(rinfo->mmio_base);
         iounmap(rinfo->fb_base);
  
- 	pci_release_regions(pdev);
+	pci_release_region(pdev, 2);
+	pci_release_region(pdev, 0);
 
 	kfree(rinfo->mon1_EDID);
 	kfree(rinfo->mon2_EDID);




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

                 reply	other threads:[~2005-08-31  5:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1125464517.5382.10.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).