Resent-Date: Fri, 23 Oct 1998 16:25:53 +0200 (MET DST)
X-Priority: 3 (Normal)
In-Reply-To: <199810201524.RAA10122@faui22c.informatik.uni-erlangen.de>
Date: Fri, 23 Oct 1998 16:25:39 +0200 (MEST)
Reply-To: itschere@TechFak.Uni-Bielefeld.DE
Organization: Universitaet Bielefeld,
 Technische Fakultaet, AG Technische Informatik
From: Torsten Scherer <itschere@ti.uni-bielefeld.de>
To: linux-m68k@lists.linux-m68k.org
Subject: patch to fix atari_stram_alloc / __get_free_pages problem
Resent-From: linux-m68k@phil.uni-sb.de

 hi,

 below is a patch to make atari_stram_alloc() work for those who do not use
ST-RAM swapping, allthough this should be highly recommended. the patch itself
lets up to 256k of video memory be allocated by get_free_pages, but is
likely to waste a lot of memory, so it's just to get things going. it's
relative to andreas' patches.

 with these patches I can get 2.1.124 to work in any ST/TT resolution. For
monochrome modes the free part of the screen right from the logo still seems to
be filled with underlines spaces, but the main text output is ok. once having
switched vtys this vanishes.

 a funny question: it seems to me like someone has changed PTY behaviour inside
the kernel. the normal ttys worked perfectly well, but no pty worked. A look at
/dev showed me that my pty had major 4 where devices.txt says 2. I cannot
remember to have changed the pty major in the last 4 years, but it worked with
4, so the kernel must have changed. this is not a problem to fix, just funny to
notice. is there anything else I've missed? :-)

ciao,
TeSche

diff -u mm/page_alloc.c.orig mm/page_alloc.c
--- mm/page_alloc.c.orig        Fri Oct 23 14:01:56 1998
+++ mm/page_alloc.c     Fri Oct 23 14:02:42 1998
@@ -41,6 +41,9 @@
 /* the AP+ needs to allocate 8MB contiguous, aligned chunks of ram
    for the ring buffers */
 #define NR_MEM_LISTS 12
+#elif defined(CONFIG_ATARI) && !defined(CONFIG_STRAM_SWAP)
+/* the Atari-TT may need to allocate up to 256k contiguous video memory */
+#define NR_MEM_LISTS 7
 #else
 #define NR_MEM_LISTS 6
 #endif
diff -u arch/m68k/atari/stram.c.andreas arch/m68k/atari/stram.c
--- arch/m68k/atari/stram.c.andreas     Fri Oct 23 13:58:25 1998
+++ arch/m68k/atari/stram.c     Fri Oct 23 14:01:30 1998
@@ -1272,14 +1272,14 @@
 /* return log2 of #pages for size */
 static int get_gfp_order( unsigned long size )
 {
-       int order;
+       int order = 0;
+       unsigned long allocSize = PAGE_SIZE;
 
-       size = N_PAGES( size + PAGE_SIZE -1 );
-       order = -1;
-       do {
-               size >>= 1;
+       while (allocSize < size)
+         {
                order++;
-       } while (size);
+               allocSize <<= 1;
+         }
 
        return( order );
 }

