[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/kernel/devel linux-2.6-offb-find-fb.patch, NONE, 1.1 kernel-2.6.spec, 1.2110, 1.2111



Author: dwmw2

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv10165

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-offb-find-fb.patch 
Log Message:
offb fix

linux-2.6-offb-find-fb.patch:
 offb.c |  105 +++++++++++++++++++++++++++++------------------------------------
 1 files changed, 47 insertions(+), 58 deletions(-)

--- NEW FILE linux-2.6-offb-find-fb.patch ---
>From benh kernel crashing org Fri Mar 31 22:27:35 2006
Return-path: <benh kernel crashing org>
Envelope-to: dwmw2 baythorne infradead org
Delivery-date: Fri, 31 Mar 2006 22:27:35 +0100
Received: from [2002:d592:9a28::1] (helo=pentafluge.infradead.org) by
	baythorne.infradead.org with esmtps (Exim 4.54 #1 (Red Hat Linux)) id
	1FPR9b-00074r-6a for dwmw2 baythorne infradead org; Fri, 31 Mar 2006
	22:27:35 +0100
Received: from [2002:3fe4:139::1] (helo=gate.crashing.org) by
	pentafluge.infradead.org with esmtps (Exim 4.60 #1 (Red Hat Linux)) id
	1FPR9X-0004DG-1Y for dwmw2 infradead org; Fri, 31 Mar 2006 22:27:34 +0100
Received: from localhost.localdomain (localhost [127.0.0.1]) by
	gate.crashing.org (8.12.8/8.12.8) with ESMTP id k2VLNnWP031196 for
	<dwmw2 infradead org>; Fri, 31 Mar 2006 15:23:50 -0600
Subject: offb crap
From: Benjamin Herrenschmidt <benh kernel crashing org>
To: David Woodhouse <dwmw2 infradead org>
Content-Type: text/plain
Date: Sat, 01 Apr 2006 08:24:51 +1100
Message-Id: <1143840291 24876 16 camel localhost localdomain>
Mime-Version: 1.0
X-Mailer: Evolution 2.6.0 
X-Spam-Score: -2.8 (--)
X-Spam-Report: SpamAssassin version 3.0.4 on pentafluge.infradead.org
	summary: Content analysis details:   (-2.8 points, 5.0 required) pts rule
	name              description ---- ----------------------
	-------------------------------------------------- -2.8 ALL_TRUSTED        
	   Did not pass through any untrusted hosts
X-Evolution-Source: imap://dwmw2 pentafluge infradead org/
Content-Transfer-Encoding: 8bit

Index: linux-work/drivers/video/offb.c
===================================================================
--- linux-work.orig/drivers/video/offb.c	2006-01-11 13:30:27.000000000 +1100
+++ linux-work/drivers/video/offb.c	2006-01-11 14:11:01.000000000 +1100
@@ -321,8 +321,9 @@
 	int *pp, i;
 	unsigned int len;
 	int width = 640, height = 480, depth = 8, pitch;
-	unsigned int flags, rsize, *up;
-	u64 address = OF_BAD_ADDR;
+	unsigned  flags, rsize, *up, addr_prop = 0;
+	unsigned long max_size = 0;
+	u64 rstart, address = OF_BAD_ADDR;
 	u32 *addrp;
 	u64 asize;
 
@@ -343,69 +344,57 @@
 	} else
 		pitch = width;
 
-       rsize = (unsigned long)pitch * (unsigned long)height *
-               (unsigned long)(depth / 8);
+	rsize = (unsigned long)pitch * (unsigned long)height *
+		(unsigned long)(depth / 8);
 
-       /* Try to match device to a PCI device in order to get a properly
-	* translated address rather then trying to decode the open firmware
-	* stuff in various incorrect ways
-	*/
-#ifdef CONFIG_PCI
-       /* First try to locate the PCI device if any */
-       {
-               struct pci_dev *pdev = NULL;
-
-	       for_each_pci_dev(pdev) {
-                       if (dp == pci_device_to_OF_node(pdev))
-                               break;
-	       }
-               if (pdev) {
-                       for (i = 0; i < 6 && address == OF_BAD_ADDR; i++) {
-                               if ((pci_resource_flags(pdev, i) &
-				    IORESOURCE_MEM) &&
-				   (pci_resource_len(pdev, i) >= rsize))
-                                       address = pci_resource_start(pdev, i);
-                       }
-		       pci_dev_put(pdev);
-               }
-        }
-#endif /* CONFIG_PCI */
-
-       /* This one is dodgy, we may drop it ... */
-       if (address == OF_BAD_ADDR &&
-	   (up = (unsigned *) get_property(dp, "address", &len)) != NULL &&
-	   len == sizeof(unsigned int))
-	       address = (u64) * up;
-
-       if (address == OF_BAD_ADDR) {
-	       for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags))
-			    != NULL; i++) {
-		       if (!(flags & IORESOURCE_MEM))
-			       continue;
-		       if (asize >= pitch * height * depth / 8)
-			       break;
-	       }
-		if (addrp == NULL) {
-			printk(KERN_ERR
-			       "no framebuffer address found for %s\n",
-			       dp->full_name);
-			return;
+	/* Ok, now we try to figure out the address of the framebuffer.
+	 *
+	 * Unfortunately, Open Firmware doesn't provide a standard way to do
+	 * so. All we can do is a dodgy heuristic that happens to work in
+	 * practice. On most machines, the "address" property contains what
+	 * we need, though not on Matrox cards found in IBM machines. What I've
+	 * found that appears to give good results is to go through the PCI
+	 * ranges and pick one that is both big enough and if possible encloses
+	 * the "address" property. If none match, we pick the biggest
+	 */
+	up = (unsigned int *) get_property(dp, "address", &len);
+	if (up && len == sizeof(unsigned int))
+		addr_prop = *up;
+
+	for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags))
+		     != NULL; i++) {
+		int match_addrp = 0;
+
+		if (!(flags & IORESOURCE_MEM))
+			continue;
+		if (asize < rsize)
+			continue;
+		rstart = of_translate_address(dp, addrp);
+		if (rstart == OF_BAD_ADDR)
+			continue;
+		if (addr_prop && (rstart <= addr_prop) &&
+		    ((rstart + rsize) > addr_prop))
+			match_addrp = 1;
+		if (match_addrp) {
+			address = addr_prop;
+			break;
 		}
-		address = of_translate_address(dp, addrp);
-		if (address == OF_BAD_ADDR) {
-			printk(KERN_ERR
-			       "can't translate framebuffer address for %s\n",
-			       dp->full_name);
-			return;
+		if (rsize > max_size) {
+			max_size = rsize;
+			address = OF_BAD_ADDR;
 		}
-
+		if (address == OF_BAD_ADDR)
+			address = rstart;
+	}
+	if (address == OF_BAD_ADDR && addr_prop)
+		address = (u_long)addr_prop;
+	if (address != OF_BAD_ADDR) {
 		/* kludge for valkyrie */
 		if (strcmp(dp->name, "valkyrie") == 0)
 			address += 0x1000;
+		offb_init_fb(dp->name, dp->full_name, width, height, depth,
+			     pitch, address, dp);
 	}
-	offb_init_fb(dp->name, dp->full_name, width, height, depth,
-		     pitch, address, dp);
-
 }
 
 static void __init offb_init_fb(const char *name, const char *full_name,




Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2110
retrieving revision 1.2111
diff -u -r1.2110 -r1.2111
--- kernel-2.6.spec	31 Mar 2006 20:48:15 -0000	1.2110
+++ kernel-2.6.spec	31 Mar 2006 21:47:50 -0000	1.2111
@@ -236,6 +236,7 @@
 
 # 300 - 399   ppc(64)
 Patch301: linux-2.6-cell-numa-init.patch
+Patch302: linux-2.6-offb-find-fb.patch
 Patch305: linux-2.6-cell-mambo-drivers.patch
 Patch306: linux-2.6-hvc-console.patch
 Patch314: linux-2.6-ppc-rtas-check.patch
@@ -741,6 +742,8 @@
 #
 # Arnd says don't call cell_spumem_init() till he fixes it.
 %patch301 -p1
+# Find OF framebuffer more reliably
+%patch302 -p1
 # Support the IBM Mambo simulator; core as well as disk and network drivers.
 %patch305 -p1
 # Make HVC console generic; support simulator console device using it.
@@ -1615,6 +1618,7 @@
 %changelog
 * Fri Mar 31 2006 David Woodhouse <dwmw2 redhat com>
 - Send standard WEXT events on softmac assoc/disassociation.
+- OFFB udpate
 
 * Thu Mar 30 2006 Dave Jones <davej redhat com>
 - 2.6.16-git18


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]