diff -urN 2.2.13aa6/arch/alpha/config.in 2.2.13aa6-bigmem-alpha/arch/alpha/config.in --- 2.2.13aa6/arch/alpha/config.in Sun Oct 31 23:31:21 1999 +++ 2.2.13aa6-bigmem-alpha/arch/alpha/config.in Mon Jan 3 15:38:33 2000 @@ -21,6 +21,7 @@ mainmenu_option next_comment comment 'General setup' +bool 'BIGMEM support' CONFIG_BIGMEM choice 'Alpha system type' \ "Generic CONFIG_ALPHA_GENERIC \ Alcor/Alpha-XLT CONFIG_ALPHA_ALCOR \ diff -urN 2.2.13aa6/arch/alpha/kernel/setup.c 2.2.13aa6-bigmem-alpha/arch/alpha/kernel/setup.c --- 2.2.13aa6/arch/alpha/kernel/setup.c Sun Oct 31 23:31:20 1999 +++ 2.2.13aa6-bigmem-alpha/arch/alpha/kernel/setup.c Mon Jan 3 15:38:33 2000 @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef CONFIG_RTC #include @@ -336,14 +337,40 @@ high = tmp; } - /* Round it up to an even number of pages. */ - high = (high + PAGE_SIZE) & (PAGE_MASK*2); +#ifndef CONFIG_BIGMEM +#define MAX_MEMORY 0x80000000UL +#else +#define LOW_MEMORY 0x80000000UL +#define MAX_MEMORY (VMALLOC_START-PAGE_OFFSET) +#endif /* Enforce maximum of 2GB even if there is more. Blah. */ - if (high > 0x80000000UL) { - printk("Cropping memory from %luMB to 2048MB\n", high); - high = 0x80000000UL; + if (high > MAX_MEMORY) { + printk("Cropping memory from %luMB to %luMB\n", + high>>20, MAX_MEMORY>>20); + high = MAX_MEMORY; + } + +#ifdef CONFIG_BIGMEM + bigmem_start = bigmem_end = high; + if (high > LOW_MEMORY) + { + high = bigmem_start = LOW_MEMORY; + printk(KERN_NOTICE "%luMB BIGMEM available\n", + (bigmem_end-bigmem_start)>>20); } +#ifdef BIGMEM_DEBUG + else + { + high -= high/4; + bigmem_start = high; + printk(KERN_NOTICE "emulating %luMB BIGMEM\n", + (bigmem_end-bigmem_start)>>20); + } +#endif + bigmem_start += PAGE_OFFSET; + bigmem_end += PAGE_OFFSET; +#endif return PAGE_OFFSET + high; } diff -urN 2.2.13aa6/arch/alpha/mm/init.c 2.2.13aa6-bigmem-alpha/arch/alpha/mm/init.c --- 2.2.13aa6/arch/alpha/mm/init.c Mon Jan 3 15:38:09 2000 +++ 2.2.13aa6-bigmem-alpha/arch/alpha/mm/init.c Mon Jan 3 18:16:41 2000 @@ -18,6 +18,7 @@ #ifdef CONFIG_BLK_DEV_INITRD #include #endif +#include #include #include @@ -30,6 +31,9 @@ extern void die_if_kernel(char *,struct pt_regs *,long); extern void show_net_buffers(void); +#ifdef CONFIG_BIGMEM +unsigned long bigmem_start, bigmem_end; +#endif struct thread_struct original_pcb; #ifndef __SMP__ @@ -196,7 +200,11 @@ struct thread_struct *original_pcb_ptr; /* initialize mem_map[] */ +#ifndef CONFIG_BIGMEM start_mem = free_area_init(start_mem, end_mem); +#else + start_mem = free_area_init(start_mem, bigmem_end); +#endif /* find free clusters, update mem_map[] accordingly */ memdesc = (struct memdesc_struct *) @@ -301,8 +309,18 @@ { unsigned long tmp; +#ifdef CONFIG_BIGMEM + bigmem_start = PAGE_ALIGN(bigmem_start); + bigmem_end &= PAGE_MASK; +#endif end_mem &= PAGE_MASK; +#ifndef CONFIG_BIGMEM max_mapnr = num_physpages = MAP_NR(end_mem); +#else + max_mapnr = num_physpages = MAP_NR(bigmem_end); + /* cache the bigmem_mapnr */ + bigmem_mapnr = MAP_NR(bigmem_start); +#endif high_memory = (void *) end_mem; start_mem = PAGE_ALIGN(start_mem); @@ -328,7 +346,17 @@ kill_page(tmp); free_page(tmp); } - tmp = nr_free_pages << PAGE_SHIFT; +#ifdef CONFIG_BIGMEM + for (tmp = bigmem_start; tmp < bigmem_end; tmp += PAGE_SIZE) + { + clear_bit(PG_reserved, &mem_map[MAP_NR(tmp)].flags); + set_bit(PG_BIGMEM, &mem_map[MAP_NR(tmp)].flags); + atomic_set(&mem_map[MAP_NR(tmp)].count, 1); + kill_page(tmp); + free_page(tmp); + } +#endif + tmp = (unsigned long) nr_free_pages << PAGE_SHIFT; printk("Memory: %luk available\n", tmp >> 10); return; } @@ -358,19 +386,22 @@ i = max_mapnr; val->totalram = 0; val->sharedram = 0; - val->freeram = nr_free_pages << PAGE_SHIFT; + val->freeram = (unsigned long) nr_free_pages << PAGE_SHIFT; val->bufferram = buffermem; + val->totalbig = 0; + val->freebig = (unsigned long) nr_free_bigpages << PAGE_SHIFT; while (i-- > 0) { if (PageReserved(mem_map+i)) continue; val->totalram++; + if (PageBIGMEM(mem_map+i)) + val->totalbig++; if (!atomic_read(&mem_map[i].count)) continue; val->sharedram += atomic_read(&mem_map[i].count) - 1; } val->totalram <<= PAGE_SHIFT; val->sharedram <<= PAGE_SHIFT; - val->totalbig = 0; - val->freebig = 0; + val->totalbig <<= PAGE_SHIFT; return; } diff -urN 2.2.13aa6/include/asm-alpha/bigmem.h 2.2.13aa6-bigmem-alpha/include/asm-alpha/bigmem.h --- 2.2.13aa6/include/asm-alpha/bigmem.h Thu Jan 1 01:00:00 1970 +++ 2.2.13aa6-bigmem-alpha/include/asm-alpha/bigmem.h Mon Jan 3 15:38:33 2000 @@ -0,0 +1,27 @@ +/* + * linux/include/asm-alpha/bigmem.h + * + * On alpha we can address all the VM with a flat mapping. We need + * to differentiate BIGMEM memory only because the default PCI DMA window + * is currently limited to 2g. Thus kmap/kunmap are noops here. + * + * With bigmem support the alpha now is capable of allocating up to + * 2048Giga of memory. + * + * Copyright (C) 2000 Andrea Arcangeli , SuSE GmbH + */ + +#ifndef _ASM_BIGMEM_H +#define _ASM_BIGMEM_H + +#include + +#undef BIGMEM_DEBUG /* undef for production */ + +/* declarations for bigmem.c */ +extern unsigned long bigmem_start, bigmem_end; + +#define kmap(kaddr, type) kaddr +#define kunmap(vaddr, type) do { } while (0) + +#endif /* _ASM_BIGMEM_H */