* controlfb: please test!
@ 2000-03-18 9:03 Michel Lanners
2000-03-18 19:32 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Michel Lanners @ 2000-03-18 9:03 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: TEXT/plain, Size: 1302 bytes --]
Hi list,
You may remeber my problems (and the many other problems reported over
the years ;-) with controlfb's detection of the amount of VRAM
installed.
Well, it seems control has some bugs, which makes detection less easy,
and until now, only one of two possible schemes for the memory layout
was correctly detected.
Well, I think it's time to clean this mess up, so I want _all_
developers with any machine that has the control hardware
(PowerMacs 7300, 7500, 7600, 8500, 8600, clones?) to try the following
patch on a 2.3 kernel, and report the results to me.
Mine look like this, with 2 MB in bank2:
....
control: mem at 0x000000: no
control: mem at 0x200000: no
control: mem at 0x400000: no
control: mem at 0x600000: yes
controlfb: Memory bank 1 absent, bank 2 present, total VRAM 2MB
....
Please include yur VRAM configuration, and if you have the time, please
try all possible combinations (2MB in either bank1 or bank2, and 4MB).
Thanks
Michel
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art.
23, Rue Paul Henkes | Ask Questions. Make Mistakes.
L-1710 Luxembourg |
email mlan@cpu.lu |
http://www.cpu.lu/~mlan | Learn Always. "
[-- Attachment #2: memtest.patch --]
[-- Type: TEXT/plain, Size: 1825 bytes --]
--- linux-2.3.paul/drivers/video/controlfb.c Fri Feb 11 00:20:08 2000
+++ linux-2.3.paul-work/drivers/video/controlfb.c Sat Mar 18 09:48:38 2000
@@ -715,6 +715,39 @@
* - with 4M vram, it appears only as a 4M block at offset 0.
*/
+ /* Let's do the mem test... */
+ 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[0x000000]) == 0x5a)
+ && (in_8(&p->frame_buffer[0x000001]) == 0xc7);
+ bank2 = (in_8(&p->frame_buffer[0x200000]) == 0xa5)
+ && (in_8(&p->frame_buffer[0x200001]) == 0x38);
+
+ printk(KERN_INFO "control: mem at 0x000000: %s\n", bank1 ? "yes" : "no");
+ printk(KERN_INFO "control: mem at 0x200000: %s\n", bank2 ? "yes" : "no");
+
+ out_8(&p->frame_buffer[0x400000], 0xc1);
+ out_8(&p->frame_buffer[0x400001], 0x02);
+ asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x400000]) : "memory" );
+
+ out_8(&p->frame_buffer[0x600000], 0xb3);
+ out_8(&p->frame_buffer[0x600001], 0x71);
+ asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x600000]) : "memory" );
+
+ bank1 = (in_8(&p->frame_buffer[0x400000]) == 0xc1)
+ && (in_8(&p->frame_buffer[0x400001]) == 0x02);
+ bank2 = (in_8(&p->frame_buffer[0x600000]) == 0xb3)
+ && (in_8(&p->frame_buffer[0x600001]) == 0x71);
+
+ printk(KERN_INFO "control: mem at 0x400000: %s\n", bank1 ? "yes" : "no");
+ printk(KERN_INFO "control: mem at 0x600000: %s\n", bank2 ? "yes" : "no");
+
/* 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);
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: controlfb: please test! 2000-03-18 9:03 controlfb: please test! Michel Lanners @ 2000-03-18 19:32 ` Daniel Jacobowitz 2000-03-19 8:30 ` Michel Lanners 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2000-03-18 19:32 UTC (permalink / raw) To: Michel Lanners; +Cc: linuxppc-dev Well, first of all, there are two different 'current' controlfb's. One of them is in the PPC 2.2 tree and the other in the 2.3 tree (both bitkeeper), I believe. Did you try both of those? I'm pretty sure I fixed this quite thoroughly in one or the other. I admit (ashamedly) to not remembering which. Actually, on closer look, I thought that the 2.3 code was correct. Could you compare to Andrew's observations in the comment above the code? Is he wrong? I certainly can't see how his comment would be unless there is a memory scheme he was not detecting, and I do not think there is. I have a bunch of other patches to merge for controlfb anyway, so now is a good time to straighten this out... with luck and speed we can get a fix into 2.3.99preX. On Sat, Mar 18, 2000 at 10:03:05AM +0100, Michel Lanners wrote: > Hi list, > > You may remeber my problems (and the many other problems reported over > the years ;-) with controlfb's detection of the amount of VRAM > installed. > > Well, it seems control has some bugs, which makes detection less easy, > and until now, only one of two possible schemes for the memory layout > was correctly detected. > > Well, I think it's time to clean this mess up, so I want _all_ > developers with any machine that has the control hardware > (PowerMacs 7300, 7500, 7600, 8500, 8600, clones?) to try the following > patch on a 2.3 kernel, and report the results to me. > > Mine look like this, with 2 MB in bank2: > .... > control: mem at 0x000000: no > control: mem at 0x200000: no > control: mem at 0x400000: no > control: mem at 0x600000: yes > controlfb: Memory bank 1 absent, bank 2 present, total VRAM 2MB > .... > > Please include yur VRAM configuration, and if you have the time, please > try all possible combinations (2MB in either bank1 or bank2, and 4MB). Dan /--------------------------------\ /--------------------------------\ | Daniel Jacobowitz |__| SCS Class of 2002 | | Debian GNU/Linux Developer __ Carnegie Mellon University | | dan@debian.org | | dmj+@andrew.cmu.edu | \--------------------------------/ \--------------------------------/ ** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: controlfb: please test! 2000-03-18 19:32 ` Daniel Jacobowitz @ 2000-03-19 8:30 ` Michel Lanners 2000-03-19 8:46 ` Daniel Jacobowitz 0 siblings, 1 reply; 7+ messages in thread From: Michel Lanners @ 2000-03-19 8:30 UTC (permalink / raw) To: drow; +Cc: linuxppc-dev Hi Dan, On 18 Mar, this message from Daniel Jacobowitz echoed through cyberspace: > Well, first of all, there are two different 'current' controlfb's. One > of them is in the PPC 2.2 tree and the other in the 2.3 tree (both > bitkeeper), I believe. Did you try both of those? I'm pretty sure I > fixed this quite thoroughly in one or the other. 2.2 works well for me, but doesn't seem to work for Andrew Fyfe, according to the comments in 2.3. 2.2 detects my 4M, 2.3 doesn't. > Actually, on closer look, I thought that the 2.3 code was correct. > Could you compare to Andrew's observations in the comment above the > code? Is he wrong? I certainly can't see how his comment would be > unless there is a memory scheme he was not detecting, and I do not > think there is. At least his code and comments are not _entirely_ correct for my machine. Here's what I've found so far: - control manages mem in chunks of 2M (a pair of DIMMs), within a region of 8M in size. - 2M in bank 1, and 4M, are accessed at offset 0x0. - 2M in bank 2 are accessed at offset 6M. - the 2.3 code doesn't detect the mem at 2M in my case. It seems writing to 0x0 garbles the memory contents at 2M: write to 2M, write to 0x0-garbling 2M, detect 0x0, detect 2M-garbled, so nothing detected. > I have a bunch of other patches to merge for controlfb anyway, so now > is a good time to straighten this out... with luck and speed we can get > a fix into 2.3.99preX. I'll speed up then ;-) The next step is to compile a better detection check, that can detect mirrored memory regions, so that I can find out what's wrong between 0x0 and 2M..... It's actually very strange, as my 4M do work when accessed in one block starting at 0x0... so 2M would have to be different from 0x0 ??? By the way, somewhere I have an alternate OF driver for control, that IIRC came out of darwin, and it ver accesses VRAM only at 0x0 or 6M.... Unfortunately, it's too big to fit into nvramrc ;-)) Cheers Michel ------------------------------------------------------------------------- Michel Lanners | " Read Philosophy. Study Art. 23, Rue Paul Henkes | Ask Questions. Make Mistakes. L-1710 Luxembourg | email mlan@cpu.lu | http://www.cpu.lu/~mlan | Learn Always. " ** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: controlfb: please test! 2000-03-19 8:30 ` Michel Lanners @ 2000-03-19 8:46 ` Daniel Jacobowitz 2000-03-19 11:41 ` Michel Lanners 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2000-03-19 8:46 UTC (permalink / raw) To: Michel Lanners; +Cc: linuxppc-dev On Sun, Mar 19, 2000 at 09:30:55AM +0100, Michel Lanners wrote: > Hi Dan, > > On 18 Mar, this message from Daniel Jacobowitz echoed through cyberspace: > > Well, first of all, there are two different 'current' controlfb's. One > > of them is in the PPC 2.2 tree and the other in the 2.3 tree (both > > bitkeeper), I believe. Did you try both of those? I'm pretty sure I > > fixed this quite thoroughly in one or the other. > > 2.2 works well for me, but doesn't seem to work for Andrew Fyfe, > according to the comments in 2.3. 2.2 detects my 4M, 2.3 doesn't. > > > Actually, on closer look, I thought that the 2.3 code was correct. > > Could you compare to Andrew's observations in the comment above the > > code? Is he wrong? I certainly can't see how his comment would be > > unless there is a memory scheme he was not detecting, and I do not > > think there is. > > At least his code and comments are not _entirely_ correct for my > machine. Here's what I've found so far: > > - control manages mem in chunks of 2M (a pair of DIMMs), within a > region of 8M in size. > - 2M in bank 1, and 4M, are accessed at offset 0x0. > - 2M in bank 2 are accessed at offset 6M. > - the 2.3 code doesn't detect the mem at 2M in my case. It seems > writing to 0x0 garbles the memory contents at 2M: write to > 2M, write to 0x0-garbling 2M, detect 0x0, detect 2M-garbled, so nothing > detected. Aha! This signifies a much bigger problem. If the write to 0M garbles the read from 2M, than the two are actually the same memory location! It's my understanding that if only 2M is present it can be accessed at 0M and 2M (and possibly other offsets). Does that seem to be wrong for you? Perhaps it can only be accessed when in a mode that requires it? > I'll speed up then ;-) > > The next step is to compile a better detection check, that can detect > mirrored memory regions, so that I can find out what's wrong between > 0x0 and 2M..... It's actually very strange, as my 4M do work when > accessed in one block starting at 0x0... so 2M would have to be > different from 0x0 ??? Try running the check after switching to a vmode which requires more than 2M, please. > By the way, somewhere I have an alternate OF driver for control, that > IIRC came out of darwin, and it ver accesses VRAM only at 0x0 or 6M.... > Unfortunately, it's too big to fit into nvramrc ;-)) Hmmm....... Dan /--------------------------------\ /--------------------------------\ | Daniel Jacobowitz |__| SCS Class of 2002 | | Debian GNU/Linux Developer __ Carnegie Mellon University | | dan@debian.org | | dmj+@andrew.cmu.edu | \--------------------------------/ \--------------------------------/ ** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: controlfb: please test! 2000-03-19 8:46 ` Daniel Jacobowitz @ 2000-03-19 11:41 ` Michel Lanners 2000-03-19 18:24 ` Michel Lanners 0 siblings, 1 reply; 7+ messages in thread From: Michel Lanners @ 2000-03-19 11:41 UTC (permalink / raw) To: drow; +Cc: linuxppc-dev [-- Attachment #1: Type: TEXT/plain, Size: 2559 bytes --] Hi list, Here's another test patch for the detection problem on controlfb. Again, this doesn't fix any problem, it's just to get a better understanding of what happens in control.. I've also set up a little web page about the issue: http://piglet.grunz.lu/~mlan/linux/dev/control.html Please boot a kernel with this patch included ASAP and report your results back to me! Thanks. For the interested, there's more below... On 19 Mar, this message from Daniel Jacobowitz echoed through cyberspace: >> Here's what I've found so far: >> >> - control manages mem in chunks of 2M (a pair of DIMMs), within a >> region of 8M in size. >> - 2M in bank 1, and 4M, are accessed at offset 0x0. >> - 2M in bank 2 are accessed at offset 6M. >> - the 2.3 code doesn't detect the mem at 2M in my case. It seems >> writing to 0x0 garbles the memory contents at 2M: write to >> 2M, write to 0x0-garbling 2M, detect 0x0, detect 2M-garbled, so nothing >> detected. > > Aha! This signifies a much bigger problem. If the write to 0M garbles > the read from 2M, than the two are actually the same memory location! > It's my understanding that if only 2M is present it can be accessed at > 0M and 2M (and possibly other offsets). Does that seem to be wrong for > you? Perhaps it can only be accessed when in a mode that requires it? The detection code seems to indicate garbling; however, practical experience seems to contradict that: >> The next step is to compile a better detection check, that can detect >> mirrored memory regions, so that I can find out what's wrong between >> 0x0 and 2M..... It's actually very strange, as my 4M do work when >> accessed in one block starting at 0x0... so 2M would have to be >> different from 0x0 ??? > > Try running the check after switching to a vmode which requires more > than 2M, please. That's precisely what I run: 1152x870 at 32 bpp. Except when controlfb only detects 2MB and sets me back to 16 bpp... So, yes, under 2.2 kernels, I do use all my 4MB of VRAM, and they are accessed as a single block starting at 0x0! Which indicates the mem at 2MB is _not_ the same as at 0x0..... Anyway, below is yet another test patch which also checks for mirrored locations. Have fun! ------------------------------------------------------------------------- Michel Lanners | " Read Philosophy. Study Art. 23, Rue Paul Henkes | Ask Questions. Make Mistakes. L-1710 Luxembourg | email mlan@cpu.lu | http://www.cpu.lu/~mlan | Learn Always. " [-- Attachment #2: memtest.patch --] [-- Type: TEXT/plain, Size: 3714 bytes --] --- linux-2.3.paul/drivers/video/controlfb.c Fri Feb 11 00:20:08 2000 +++ linux-2.3.paul-work/drivers/video/controlfb.c Sun Mar 19 12:36:30 2000 @@ -678,7 +678,7 @@ { struct fb_info_control *p; unsigned long addr, size; - int i, bank1, bank2; + int i, bank1, bank2, m[7]; if(dp->n_addrs != 2) { printk(KERN_ERR "expecting 2 address for control (got %d)", dp->n_addrs); @@ -714,7 +714,70 @@ * - 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. */ +#if (1) + /* Let's do the mem test... */ + for (i=0; i<7; i++) m[i]=0; + 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" ); + m[0] = (in_8(&p->frame_buffer[0x000000]) == 0x5a) + && (in_8(&p->frame_buffer[0x000001]) == 0xc7); + m[2] = (in_8(&p->frame_buffer[0x200000]) == 0x5a) + && (in_8(&p->frame_buffer[0x200001]) == 0xc7); + m[4] = (in_8(&p->frame_buffer[0x400000]) == 0x5a) + && (in_8(&p->frame_buffer[0x400001]) == 0xc7); + m[6] = (in_8(&p->frame_buffer[0x600000]) == 0x5a) + && (in_8(&p->frame_buffer[0x600001]) == 0xc7); + + printk(KERN_INFO "control: mem at 0x000000: %s", m[0] ? "yes" : "no"); + printk(", mirrored at:%s%s%s\n", m[2]?" 2M":"", m[4]?" 4M":"", m[6]?" 6M":""); + + 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" ); + m[0] = (in_8(&p->frame_buffer[0x000000]) == 0xa5) + && (in_8(&p->frame_buffer[0x000001]) == 0x38); + m[2] = (in_8(&p->frame_buffer[0x200000]) == 0xa5) + && (in_8(&p->frame_buffer[0x200001]) == 0x38); + m[4] = (in_8(&p->frame_buffer[0x400000]) == 0xa5) + && (in_8(&p->frame_buffer[0x400001]) == 0x38); + m[6] = (in_8(&p->frame_buffer[0x600000]) == 0xa5) + && (in_8(&p->frame_buffer[0x600001]) == 0x38); + + printk(KERN_INFO "control: mem at 0x200000: %s", m[2] ? "yes" : "no"); + printk(", mirrored at:%s%s%s\n", m[0]?" 0M":"", m[4]?" 4M":"", m[6]?" 6M":""); + + out_8(&p->frame_buffer[0x400000], 0xc1); + out_8(&p->frame_buffer[0x400001], 0x02); + asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x400000]) : "memory" ); + m[0] = (in_8(&p->frame_buffer[0x000000]) == 0xc1) + && (in_8(&p->frame_buffer[0x000001]) == 0x02); + m[2] = (in_8(&p->frame_buffer[0x200000]) == 0xc1) + && (in_8(&p->frame_buffer[0x200001]) == 0x02); + m[4] = (in_8(&p->frame_buffer[0x400000]) == 0xc1) + && (in_8(&p->frame_buffer[0x400001]) == 0x02); + m[6] = (in_8(&p->frame_buffer[0x600000]) == 0xc1) + && (in_8(&p->frame_buffer[0x600001]) == 0x02); + + printk(KERN_INFO "control: mem at 0x400000: %s", m[4] ? "yes" : "no"); + printk(", mirrored at:%s%s%s\n", m[0]?" 0M":"", m[2]?" 2M":"", m[6]?" 6M":""); + + out_8(&p->frame_buffer[0x600000], 0xb3); + out_8(&p->frame_buffer[0x600001], 0x71); + asm volatile("eieio; dcbi 0,%0" : : "r" (&p->frame_buffer[0x600000]) : "memory" ); + m[0] = (in_8(&p->frame_buffer[0x000000]) == 0xb3) + && (in_8(&p->frame_buffer[0x000001]) == 0x71); + m[2] = (in_8(&p->frame_buffer[0x200000]) == 0xb3) + && (in_8(&p->frame_buffer[0x200001]) == 0x71); + m[4] = (in_8(&p->frame_buffer[0x400000]) == 0xb3) + && (in_8(&p->frame_buffer[0x400001]) == 0x71); + m[6] = (in_8(&p->frame_buffer[0x600000]) == 0xb3) + && (in_8(&p->frame_buffer[0x600001]) == 0x71); + + printk(KERN_INFO "control: mem at 0x600000: %s", m[6] ? "yes" : "no"); + printk(", mirrored at:%s%s%s\n", m[0]?" 0M":"", m[2]?" 2M":"", m[4]?" 4M":""); +#endif /* 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); ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: controlfb: please test! 2000-03-19 11:41 ` Michel Lanners @ 2000-03-19 18:24 ` Michel Lanners 2000-03-19 21:53 ` Michael R. Zucca 0 siblings, 1 reply; 7+ messages in thread From: Michel Lanners @ 2000-03-19 18:24 UTC (permalink / raw) To: drow; +Cc: linuxppc-dev Stupidity struck... On 19 Mar, this message from <stupid> was heard: > I've also set up a little web page about the issue: > Ooopss... that was my home machine, as seen in my internal DNS. Here's the right URL: http://www.cpu.lu/~mlan/linux/dev/control.html Have fun, and test lots! Michel ------------------------------------------------------------------------- Michel Lanners | " Read Philosophy. Study Art. 23, Rue Paul Henkes | Ask Questions. Make Mistakes. L-1710 Luxembourg | email mlan@cpu.lu | http://www.cpu.lu/~mlan | Learn Always. " ** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: controlfb: please test! 2000-03-19 18:24 ` Michel Lanners @ 2000-03-19 21:53 ` Michael R. Zucca 0 siblings, 0 replies; 7+ messages in thread From: Michael R. Zucca @ 2000-03-19 21:53 UTC (permalink / raw) To: mlan; +Cc: drow, linuxppc-dev At 1:24 PM -0500 3/19/00, Michel Lanners wrote: >Stupidity struck... > >On 19 Mar, this message from <stupid> was heard: >> I've also set up a little web page about the issue: >> > >Ooopss... that was my home machine, as seen in my internal DNS. > >Here's the right URL: > >http://www.cpu.lu/~mlan/linux/dev/control.html The phenomenon you're describing is called aliasing. It happens all over the place on 68k Macs. To check for this you divide the RAM into blocks that you think are aliased (like 1Meg blocks in the case of the Control VRAM). Usually, blocks in low memory are aliased into high memory. So what you do is write a unique value into each block from high memory to low memory. Then you go back and read the values and the answers become obvious: So if you write 4 3 2 1 into each block and get back 2 1 2 1 then it is easy to see that banks 4 and 3 are aliases of banks 2 and 1 respectively. This can be done with a couple of for loops which should tighten up your code a little. You may also wish to reverse engineer some of the ROM routines or the Apple drivers. These usually contain code which sizes the VRAM. Rather than probing for RAM like, this you might be able to just read a few bits out of a memory controller chip somewhere. At least on the Quadras the memory controller was capable of telling you what kind of VRAM was in use but you had to size it by hand using the technique above. Good luck! ____________________________________________________________________ Michael Zucca - mrz5149@acm.org - http://www.mdc.net/~mrz5149/ "I will choose a path that's clear. I will choose Freewill. " --Rush, Freewill ____________________________________________________________________ ** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/ ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2000-03-19 21:53 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2000-03-18 9:03 controlfb: please test! Michel Lanners 2000-03-18 19:32 ` Daniel Jacobowitz 2000-03-19 8:30 ` Michel Lanners 2000-03-19 8:46 ` Daniel Jacobowitz 2000-03-19 11:41 ` Michel Lanners 2000-03-19 18:24 ` Michel Lanners 2000-03-19 21:53 ` Michael R. Zucca
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).