linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Benjamin Herrenschmidt <bh40@calva.net>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linuxppc-dev@lists.linuxppc.org
Subject: Re: controlfb.c bug in VRAM bank2 check if bank1
Date: Sun, 12 Sep 1999 14:10:14 -0400	[thread overview]
Message-ID: <19990912141014.A17732@them.org> (raw)
In-Reply-To: <19990911112323.032168@smtp.calvacom.fr>; from Benjamin Herrenschmidt on Sat, Sep 11, 1999 at 11:23:23AM +0200

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

OK, this patch should d the trick.

On Sat, Sep 11, 1999 at 11:23:23AM +0200, Benjamin Herrenschmidt wrote:
> >I have a bunch of information on this lying around, and most of my
> >other kernel problems seem to be resolved now.  I'm in the process of
> >upgrading to current vger; if it succeeds, I'll try to merge all
> >pending controlfb stuff tomorrow.
> 
> I also have a pair of crazy 8500 who have 2Mb of VRAM but in bank2 (they
> don't work if the VRAM is moved to bank1, even under MacOS). The current
> controlfb appears to work well. Send me your merge results, I'll test on
> one of those weird machines Monday.
> 
> 
> -- 
>            E-Mail: <mailto:bh40@calva.net>
> BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>
> 
> 
> 
> 


Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         dan@debian.org         |  |       dmj+@andrew.cmu.edu      |
\--------------------------------/  \--------------------------------/

[-- Attachment #2: control.diff --]
[-- Type: text/plain, Size: 2778 bytes --]

Index: controlfb.c
===================================================================
RCS file: /cvs/linux/linux/drivers/video/controlfb.c,v
retrieving revision 1.20
diff -u -r1.20 controlfb.c
--- controlfb.c	1999/09/10 07:04:03	1.20
+++ controlfb.c	1999/09/12 18:03:57
@@ -702,26 +702,48 @@
 	p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000);
 
 	/* Work out which banks of VRAM we have installed. */
-	/* danj: I guess the card just ignores writes to nonexistant VRAM... */
+	/* According to Andrew Fyfe <bandr@best.com>, the VRAM behaves like so: */
+	/* afyfe: observations from an 8500:
+	 * - with 2M vram in bank 1, it appears at offsets 0, 2M and 4M
+	 * - with 2M vram in bank 2, it appears only at offset 6M
+	 * - with 4M vram, it appears only as a 4M block at offset 0.
+	 */
+
+	/* We know there is something at 2M if there is something at 0M. */
+	out_8(&p->frame_buffer[0x200000], 0xa5);
+	out_8(&p->frame_buffer[0x200001], 0x38);
+	asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x200000]) : "memory" );
+
 	out_8(&p->frame_buffer[0], 0x5a);
 	out_8(&p->frame_buffer[1], 0xc7);
 	asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0]) : "memory" );
-	bank1 = (in_8(&p->frame_buffer[0]) == 0x5a) && (in_8(&p->frame_buffer[1]) == 0xc7);
 
-	out_8(&p->frame_buffer[0x600000], 0xa5);
-	out_8(&p->frame_buffer[0x600001], 0x38);
-	asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x600000]) : "memory" );
-	bank2 = (in_8(&p->frame_buffer[0x600000]) == 0xa5)
-		&& (in_8(&p->frame_buffer[0x600001]) == 0x38);
-	
-	p->total_vram = (bank1 + bank2) * 0x200000;
-	/* If we don't have bank 1 installed, we hope we have bank 2 :-) */
-	p->control_use_bank2 = !bank1;
-	if (p->control_use_bank2) {
+	bank1 =  (in_8(&p->frame_buffer[0x000000]) == 0x5a)
+		&& (in_8(&p->frame_buffer[0x000001]) == 0xc7);
+	bank2 =  (in_8(&p->frame_buffer[0x200000]) == 0xa5)
+		&& (in_8(&p->frame_buffer[0x200001]) == 0x38);
+
+	if(bank2 && !bank1)
+		printk(KERN_INFO "controlfb: Found memory at 2MB but not at 0!  Please contact dan@debian.org\n");
+
+	if(!bank1) {
+		out_8(&p->frame_buffer[0x600000], 0xa5);
+		out_8(&p->frame_buffer[0x600001], 0x38);
+		asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x600000]) : "memory" );
+		bank2 = (in_8(&p->frame_buffer[0x600000]) == 0xa5)
+			&& (in_8(&p->frame_buffer[0x600001]) == 0x38);
+		/* If we don't have bank 1 installed, we hope we have bank 2 :-) */
+		p->control_use_bank2 = 1;
 		p->frame_buffer += 0x600000;
 		p->frame_buffer_phys += 0x600000;
 	}
 	
+	p->total_vram = (bank1 + bank2) * 0x200000;
+	
+	printk(KERN_INFO "controlfb: Memory bank 1 %s, bank 2 %s, total VRAM %dMB\n",
+		bank1 ? "present" : "absent", bank2 ? "present" : "absent",
+		2 * (bank1 + bank2));
+
 	init_control(p);
 }
 

  reply	other threads:[~1999-09-12 18:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-10 15:55 controlfb.c bug in VRAM bank2 check if bank1 Lou Langholtz
1999-09-10 17:08 ` Lou Langholtz
1999-09-10 18:33 ` Michel Lanners
1999-09-12 16:58   ` Lou Langholtz
1999-09-13 18:13     ` Michel Lanners
1999-09-15 15:14       ` Lou Langholtz
1999-10-12  7:07       ` Lou Langholtz
1999-10-12  7:23         ` Bizarre g++ problem Patrik Jonsson
1999-10-12  6:49   ` controlfb.c bug in VRAM bank2 check if bank1 Lou Langholtz
1999-10-12 14:50     ` Daniel Jacobowitz
1999-10-12 15:36       ` Lou Langholtz
1999-10-13  6:30         ` Geert Uytterhoeven
1999-09-11 10:51 ` Brad Boyer
1999-09-10 20:13   ` Daniel Jacobowitz
1999-09-11  9:23     ` Benjamin Herrenschmidt
1999-09-12 18:10       ` Daniel Jacobowitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-09-15 17:05 Kevin_Hendricks
1999-09-15 18:26 ` Kevin Puetz

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=19990912141014.A17732@them.org \
    --to=drow@false.org \
    --cc=bh40@calva.net \
    --cc=geert@linux-m68k.org \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /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).