From: Andy P. <at...@us...> - 2002-04-10 18:38:43
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/dec/prom In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/dec/prom Modified Files: Makefile cmdline.c identify.c init.c memory.c Log Message: synch 2.4.15 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/dec/prom/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: cmdline.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/dec/prom/cmdline.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cmdline.c 14 Jan 2001 19:29:00 -0000 1.1.1.1 +++ cmdline.c 10 Apr 2002 14:38:05 -0000 1.2 @@ -2,8 +2,6 @@ * cmdline.c: read the command line passed to us by the PROM. * * Copyright (C) 1998 Harald Koerfgen - * - * $Id$ */ #include <linux/init.h> #include <linux/kernel.h> @@ -19,7 +17,7 @@ extern int (*prom_printf)(char *, ...); #endif -char arcs_cmdline[CL_SIZE]; +char arcs_cmdline[COMMAND_LINE_SIZE]; void __init prom_init_cmdline(int argc, char **argv, unsigned long magic) { Index: identify.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/dec/prom/identify.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/dec/prom/init.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- init.c 14 Jan 2001 19:29:01 -0000 1.1.1.1 +++ init.c 10 Apr 2002 14:38:05 -0000 1.2 @@ -2,12 +2,11 @@ * init.c: PROM library initialisation code. * * Copyright (C) 1998 Harald Koerfgen - * - * $Id$ */ #include <linux/init.h> #include <linux/config.h> #include <asm/bootinfo.h> +#include <asm/cpu.h> #include "prom.h" /* @@ -93,15 +92,17 @@ /* Were we compiled with the right CPU option? */ #if defined(CONFIG_CPU_R3000) - if ((mips_cputype == CPU_R4000SC) || (mips_cputype == CPU_R4400SC)) { + if ((mips_cpu.cputype == CPU_R4000SC) || + (mips_cpu.cputype == CPU_R4400SC)) { prom_printf("Sorry, this kernel is compiled for the wrong CPU type!\n"); prom_printf("Please recompile with \"CONFIG_CPU_R4x00 = y\"\n"); dec_machine_halt(); } #endif -#if defined(CONFIG_CPU_R4x00) - if ((mips_cputype == CPU_R3000) || (mips_cputype == CPU_R3000A)) { +#if defined(CONFIG_CPU_R4X00) + if ((mips_cpu.cputype == CPU_R3000) || + (mips_cpu.cputype == CPU_R3000A)) { prom_printf("Sorry, this kernel is compiled for the wrong CPU type!\n"); prom_printf("Please recompile with \"CONFIG_CPU_R3000 = y\"\n"); dec_machine_halt(); @@ -114,3 +115,4 @@ return 0; } + Index: memory.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/dec/prom/memory.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- memory.c 14 Jan 2001 19:29:01 -0000 1.1.1.1 +++ memory.c 10 Apr 2002 14:38:05 -0000 1.2 @@ -2,6 +2,7 @@ * memory.c: memory initialisation code. * * Copyright (C) 1998 Harald Koerfgen, Frieder Streffer and Paul M. Antoine + * Copyright (C) 2000 Maciej W. Rozycki * * $Id$ */ @@ -14,6 +15,8 @@ #include <asm/addrspace.h> #include <asm/page.h> +#include <asm/bootinfo.h> + #include <asm/dec/machtype.h> #include "prom.h" @@ -31,12 +34,7 @@ extern int (*prom_printf)(char *, ...); #endif -volatile unsigned long mem_err = 0; /* So we know an error occured */ - -extern char _end; - -#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) -#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) +volatile unsigned long mem_err = 0; /* So we know an error occurred */ /* * Probe memory in 4MB chunks, waiting for an error to tell us we've fallen @@ -45,7 +43,7 @@ #define CHUNK_SIZE 0x400000 -unsigned long __init pmax_get_memory_size(void) +static void __init pmax_setup_memory_region(void) { volatile unsigned char *memory_page, dummy; char old_handler[0x80]; @@ -66,17 +64,19 @@ dummy = *memory_page; } memcpy((void *)(KSEG0 + 0x80), &old_handler, 0x80); - return (unsigned long)memory_page - KSEG1 - CHUNK_SIZE; + + add_memory_region(0, (unsigned long)memory_page - KSEG1 - CHUNK_SIZE, + BOOT_MEM_RAM); } /* * Use the REX prom calls to get hold of the memory bitmap, and thence * determine memory size. */ -unsigned long __init rex_get_memory_size(void) +static void __init rex_setup_memory_region(void) { int i, bitmap_size; - unsigned long mem_size = 0; + unsigned long mem_start = 0, mem_size = 0; memmap *bm; /* some free 64k */ @@ -88,46 +88,30 @@ /* FIXME: very simplistically only add full sets of pages */ if (bm->bitmap[i] == 0xff) mem_size += (8 * bm->pagesize); + else if (!mem_size) + mem_start += (8 * bm->pagesize); + else { + add_memory_region(mem_start, mem_size, BOOT_MEM_RAM); + mem_start += mem_size + (8 * bm->pagesize); + mem_size = 0; + } } - - return (mem_size); + if (mem_size) + add_memory_region(mem_start, mem_size, BOOT_MEM_RAM); } void __init prom_meminit(unsigned int magic) { - unsigned long free_start, free_end, start_pfn, bootmap_size; - unsigned long mem_size = 0; - if (magic != REX_PROM_MAGIC) - mem_size = pmax_get_memory_size(); + pmax_setup_memory_region(); else - mem_size = rex_get_memory_size(); - - free_start = PHYSADDR(PFN_ALIGN(&_end)); - free_end = mem_size; - start_pfn = PFN_UP((unsigned long)&_end); - -#ifdef PROM_DEBUG - prom_printf("free_start: 0x%08x\n", free_start); - prom_printf("free_end: 0x%08x\n", free_end); - prom_printf("start_pfn: 0x%08x\n", start_pfn); -#endif - - /* Register all the contiguous memory with the bootmem allocator - and free it. Be careful about the bootmem freemap. */ - bootmap_size = init_bootmem(start_pfn, mem_size >> PAGE_SHIFT); - free_bootmem(free_start + bootmap_size, free_end - free_start - bootmap_size); -} - -int __init page_is_ram(unsigned long pagenr) -{ - return 1; + rex_setup_memory_region(); } -void prom_free_prom_memory (void) +void __init prom_free_prom_memory (void) { unsigned long addr, end; - extern char _ftext; + extern char _ftext; /* * Free everything below the kernel itself but leave @@ -142,16 +126,16 @@ * XXX: save this address for use in dec_lance.c? */ if (IOASIC) - end = PHYSADDR(&_ftext) - 0x00020000; + end = __pa(&_ftext) - 0x00020000; else #endif - end = PHYSADDR(&_ftext); + end = __pa(&_ftext); addr = PAGE_SIZE; while (addr < end) { - ClearPageReserved(virt_to_page(addr)); - set_page_count(virt_to_page(addr), 1); - free_page(addr); + ClearPageReserved(virt_to_page(__va(addr))); + set_page_count(virt_to_page(__va(addr)), 1); + free_page((unsigned long)__va(addr)); addr += PAGE_SIZE; } |