[PATCH 161] Atari ST-RAM setup

From: Geert Uytterhoeven
Date: Sat Oct 02 2004 - 12:16:05 EST


Atari ST-RAM updates (from Petr Stehlik):
- Re-add lost early setup parameter `stram_swap'.
- Disable the broken ST-RAM swap by default, but allow anyone to enable it
with the `stram_swap' option.

Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

--- linux-2.4.28-pre3/arch/m68k/atari/stram.c 13 Mar 2003 06:45:40 -0000 1.2.2.2
+++ linux-m68k-2.4.28-pre3/arch/m68k/atari/stram.c 7 Aug 2004 08:28:21 -0000
@@ -190,7 +190,7 @@
* -1 = do swapping (to whole ST-RAM) if it's less than MAX_STRAM_FRACTION of
* total memory
*/
-static int max_swap_size = -1;
+static int max_swap_size = 0;

/* start and end of swapping area */
static void *swap_start, *swap_end;
@@ -306,7 +306,7 @@
reserve_bootmem (0, PAGE_SIZE);

#ifdef CONFIG_STRAM_SWAP
- {
+ if (max_swap_size) {
void *swap_data;

start_mem = (void *) PAGE_ALIGN ((unsigned long) start_mem);
@@ -961,14 +961,33 @@
return( max_start );
}

+#ifdef CONFIG_STRAM_SWAP

/* setup parameters from command line */
-void __init stram_swap_setup(char *str, int *ints)
+void __init stram_swap_setup(char *str)
{
- if (ints[0] >= 1)
- max_swap_size = ((ints[1] < 0 ? 0 : ints[1]) * 1024) & PAGE_MASK;
+ int ints[3];
+ get_options(str, ARRAY_SIZE(ints), ints);
+ if (ints[0] >= 1) {
+ if (ints[1] == 1) {
+ /* always use ST-RAM as swap */
+ max_swap_size = -1;
+ if (ints[0] == 2) {
+ max_swap_size = ((ints[2] < 0 ? 0 : ints[2]) * 1024) & PAGE_MASK;
+ }
+ }
+ else if (ints[1] == 0) {
+ /* never use ST-RAM as swap */
+ max_swap_size = 0;
+ }
+ else {
+ printk( KERN_WARNING "stram_swap=%d - invalid value\n", ints[1] );
+ }
+ }
}

+#endif /* CONFIG_STRAM_SWAP */
+

/* ------------------------------------------------------------------------ */
/* ST-RAM device */
--- linux-2.4.28-pre3/arch/m68k/kernel/setup.c 5 Jul 2004 16:39:16 -0000 1.4.2.11
+++ linux-m68k-2.4.28-pre3/arch/m68k/kernel/setup.c 7 Aug 2004 08:28:22 -0000
@@ -295,13 +295,20 @@
i = 1;
}
#ifdef CONFIG_ATARI
- /* This option must be parsed very early */
+ /* These options must be parsed very early */
if (!strncmp( p, "switches=", 9 )) {
extern void atari_switches_setup( const char *, int );
atari_switches_setup( p+9, (q = strchr( p+9, ' ' )) ?
(q - (p+9)) : strlen(p+9) );
i = 1;
}
+#ifdef CONFIG_STRAM_SWAP
+ if (!strncmp( p, "stram_swap=", 11 )) {
+ extern void stram_swap_setup( char * );
+ stram_swap_setup( p+11 );
+ i = 1;
+ }
+#endif /* CONFIG_STRAM_SWAP */
#endif

if (i) {

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/