#ifdef CONFIG_STRAM_SWAP /* if max_swap_size is negative (i.e. no stram_swap= option given), * determine at run time whether to use ST-RAM swapping */ if (max_swap_size < 0) /* Use swapping if ST-RAM doesn't make up more than MAX_STRAM_FRACTION * of total memory. In that case, the max. size is set to 16 MB, * because ST-RAM can never be bigger than that. * Also, never use swapping on a Hades, there's no separate ST-RAM in * that machine. */ max_swap_size = (!MACH_IS_HADES && (N_PAGES(stram_end-stram_start)*MAX_STRAM_FRACTION_DENOM <= ((unsigned long)high_memory>>PAGE_SHIFT)*MAX_STRAM_FRACTION_NOM)) ? 16*1024*1024 : 0; DPRINTK( "atari_stram_reserve_pages: max_swap_size = %d\n", max_swap_size ); #endif  
void __init atari_stram_reserve_pages(void *start_mem){#ifdef CONFIG_STRAM_SWAP	/* if max_swap_size is negative (i.e. no stram_swap= option given),	 * determine at run time whether to use ST-RAM swapping */	if (max_swap_size < 0)		/* Use swapping if ST-RAM doesn't make up more than MAX_STRAM_FRACTION		 * of total memory. In that case, the max. size is set to 16 MB,		 * because ST-RAM can never be bigger than that.		 * Also, never use swapping on a Hades, there's no separate ST-RAM in		 * that machine. */		max_swap_size =			(!MACH_IS_HADES &&			 (N_PAGES(stram_end-stram_start)*MAX_STRAM_FRACTION_DENOM <=			  ((unsigned long)high_memory>>PAGE_SHIFT)*MAX_STRAM_FRACTION_NOM)) ? 16*1024*1024 : 0;	DPRINTK( "atari_stram_reserve_pages: max_swap_size = %d\n", max_swap_size );#endif	/* always reserve first page of ST-RAM, the first 2 kB are	 * supervisor-only! */	if (!kernel_in_stram)		reserve_bootmem (0, PAGE_SIZE);#ifdef CONFIG_STRAM_SWAP	{		void *swap_data;		start_mem = (void *) PAGE_ALIGN ((unsigned long) start_mem);		/* determine first page to use as swap: if the kernel is		   in TT-RAM, this is the first page of (usable) ST-RAM;		   otherwise just use the end of kernel data (= start_mem) */		swap_start = !kernel_in_stram ? stram_start + PAGE_SIZE : start_mem;		/* decrement by one page, rest of kernel assumes that first swap page		 * is always reserved and maybe doesn't handle swp_entry == 0		 * correctly */		swap_start -= PAGE_SIZE;		swap_end = stram_end;		if (swap_end-swap_start > max_swap_size)			swap_end =  swap_start + max_swap_size;		DPRINTK( "atari_stram_reserve_pages: swapping enabled; "				 "swap=%p-%p\n", swap_start, swap_end);		/* reserve some amount of memory for maintainance of		 * swapping itself: one page for each 2048 (PAGE_SIZE/2)		 * swap pages. (2 bytes for each page) */		swap_data = start_mem;		start_mem += ((SWAP_NR(swap_end) + PAGE_SIZE/2 - 1)			      >> (PAGE_SHIFT-1)) << PAGE_SHIFT;		/* correct swap_start if necessary */		if (swap_start + PAGE_SIZE == swap_data)			swap_start = start_mem - PAGE_SIZE;		if (!swap_init( start_mem, swap_data )) {			printk( KERN_ERR "ST-RAM swap space initialization failed\n" );			max_swap_size = 0;			return;		}		/* reserve region for swapping meta-data */		reserve_region(swap_data, start_mem);		/* reserve swapping area itself */		reserve_region(swap_start + PAGE_SIZE, swap_end);		/*		 * If the whole ST-RAM is used for swapping, there are no allocatable		 * dma pages left. But unfortunately, some shared parts of the kernel		 * (particularly the SCSI mid-level) call __get_dma_pages()		 * unconditionally :-( These calls then fail, and scsi.c even doesn't		 * check for NULL return values and just crashes. The quick fix for		 * this (instead of doing much clean up work in the SCSI code) is to		 * pretend all pages are DMA-able by setting mach_max_dma_address to		 * ULONG_MAX. This doesn't change any functionality so far, since		 * get_dma_pages() shouldn't be used on Atari anyway anymore (better		 * use atari_stram_alloc()), and the Atari SCSI drivers don't need DMA		 * memory. But unfortunately there's now no kind of warning (even not		 * a NULL return value) if you use get_dma_pages() nevertheless :-(		 * You just will get non-DMA-able memory...		 */		mach_max_dma_address = 0xffffffff;	}#endif}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/f9c98d0287de42221c624482fd4f8d485c98ab22/stram.c/buggy/arch/m68k/atari/stram.c