From: Albert H. <he...@us...> - 2008-03-04 06:20:53
|
Update of /cvsroot/gc-linux/linux/arch/powerpc/kernel In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv7117/arch/powerpc/kernel Added Files: cputable.c head_32.S machine_kexec.c Log Message: Added powerpc arch. Tweaked some driver for wii compatibility. --- NEW FILE: machine_kexec.c --- /* * Code to handle transition of Linux booting another kernel. * * Copyright (C) 2002-2003 Eric Biederman <ebi...@xm...> * GameCube/ppc32 port Copyright (C) 2004 Albert Herranz * Copyright (C) 2005 IBM Corporation. * * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */ #include <linux/kexec.h> #include <linux/reboot.h> #include <linux/threads.h> #include <asm/machdep.h> #include <asm/lmb.h> void machine_crash_shutdown(struct pt_regs *regs) { if (ppc_md.machine_crash_shutdown) ppc_md.machine_crash_shutdown(regs); } /* * Do what every setup is needed on image and the * reboot code buffer to allow us to avoid allocations * later. */ int machine_kexec_prepare(struct kimage *image) { if (ppc_md.machine_kexec_prepare) return ppc_md.machine_kexec_prepare(image); /* * Fail if platform doesn't provide its own machine_kexec_prepare * implementation. */ return -ENOSYS; } void machine_kexec_cleanup(struct kimage *image) { if (ppc_md.machine_kexec_cleanup) ppc_md.machine_kexec_cleanup(image); } /* * Do not allocate memory (or fail in any way) in machine_kexec(). * We are past the point of no return, committed to rebooting now. */ NORET_TYPE void machine_kexec(struct kimage *image) { if (ppc_md.machine_kexec) ppc_md.machine_kexec(image); else { /* * Fall back to normal restart if platform doesn't provide * its own kexec function, and user insist to kexec... */ machine_restart(NULL); } for(;;); } void __init reserve_crashkernel(void) { #ifndef CONFIG_GAMECUBE unsigned long long crash_size, crash_base; int ret; /* this is necessary because of lmb_phys_mem_size() */ lmb_analyze(); /* use common parsing */ ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(), &crash_size, &crash_base); if (ret == 0 && crash_size > 0) { if (crash_base == 0) crash_base = KDUMP_KERNELBASE; crashk_res.start = crash_base; } else { /* handle the device tree */ crash_size = crashk_res.end - crashk_res.start + 1; } if (crash_size == 0) return; /* We might have got these values via the command line or the * device tree, either way sanitise them now. */ if (crashk_res.start != KDUMP_KERNELBASE) printk("Crash kernel location must be 0x%x\n", KDUMP_KERNELBASE); crashk_res.start = KDUMP_KERNELBASE; crash_size = PAGE_ALIGN(crash_size); crashk_res.end = crashk_res.start + crash_size - 1; /* Crash kernel trumps memory limit */ if (memory_limit && memory_limit <= crashk_res.end) { memory_limit = crashk_res.end + 1; printk("Adjusted memory limit for crashkernel, now 0x%lx\n", memory_limit); } printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " "for crashkernel (System RAM: %ldMB)\n", (unsigned long)(crash_size >> 20), (unsigned long)(crashk_res.start >> 20), (unsigned long)(lmb_phys_mem_size() >> 20)); lmb_reserve(crashk_res.start, crash_size); #endif } int overlaps_crashkernel(unsigned long start, unsigned long size) { return (start + size) > crashk_res.start && start <= crashk_res.end; } --- NEW FILE: cputable.c --- /* * Copyright (C) 2001 Ben. Herrenschmidt (be...@ke...) * * Modifications for ppc64: * Copyright (C) 2003 Dave Engebretsen <eng...@us...> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include <linux/string.h> #include <linux/sched.h> #include <linux/threads.h> #include <linux/init.h> #include <linux/module.h> #include <asm/oprofile_impl.h> [...1389 lines suppressed...] if ((value & fcur->mask) == fcur->value) continue; /* These PTRRELOCs will disappear once the new scheme for * modules and vdso is implemented */ pstart = ((unsigned int *)fcur) + (fcur->start_off / 4); pend = ((unsigned int *)fcur) + (fcur->end_off / 4); for (p = pstart; p < pend; p++) { *p = 0x60000000u; asm volatile ("dcbst 0, %0" : : "r" (p)); } asm volatile ("sync" : : : "memory"); for (p = pstart; p < pend; p++) asm volatile ("icbi 0,%0" : : "r" (p)); asm volatile ("sync; isync" : : : "memory"); } } --- NEW FILE: head_32.S --- /* * PowerPC version * Copyright (C) 1995-1996 Gary Thomas (gd...@li...) * * Rewritten by Cort Dougan (co...@cs...) for PReP * Copyright (C) 1996 Cort Dougan <co...@cs...> * Adapted for Power Macintosh by Paul Mackerras. * Low-level exception handlers and MMU support * rewritten by Paul Mackerras. * Copyright (C) 1996 Paul Mackerras. * MPC8xx modifications Copyright (C) 1997 Dan Malek (dm...@jl...). * * This file contains the low-level support and setup for the * PowerPC platform, including trap and interrupt dispatch. * (The PPC 8xx embedded CPUs use head_8xx.S instead.) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version [...1316 lines suppressed...] .space 4096 .globl swapper_pg_dir swapper_pg_dir: .space PGD_TABLE_SIZE .globl intercept_table intercept_table: .long 0, 0, i0x200, i0x300, i0x400, 0, i0x600, i0x700 .long i0x800, 0, 0, 0, 0, i0xd00, 0, 0 .long 0, 0, 0, i0x1300, 0, 0, 0, 0 .long 0, 0, 0, 0, 0, 0, 0, 0 .long 0, 0, 0, 0, 0, 0, 0, 0 .long 0, 0, 0, 0, 0, 0, 0, 0 /* Room for two PTE pointers, usually the kernel and current user pointers * to their respective root page table. */ abatron_pteptrs: .space 8 |