-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 41382 b: refs/heads/master c: 583bb86 h: refs/heads/master v: v3
- Loading branch information
Nicolas Schichan
authored and
Ralf Baechle
committed
Nov 30, 2006
1 parent
72266f3
commit 96b6992
Showing
11 changed files
with
223 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: c237923009da464881d89f4bc27c3b5b1a93d61b | ||
refs/heads/master: 583bb86fbb9e85287f020fe4eb5352a0ec3c66a3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* machine_kexec.c for kexec | ||
* Created by <nschichan@corp.free.fr> on Thu Oct 12 15:15:06 2006 | ||
* | ||
* 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/mm.h> | ||
#include <linux/delay.h> | ||
|
||
#include <asm/cacheflush.h> | ||
#include <asm/page.h> | ||
|
||
const extern unsigned char relocate_new_kernel[]; | ||
const extern unsigned int relocate_new_kernel_size; | ||
|
||
extern unsigned long kexec_start_address; | ||
extern unsigned long kexec_indirection_page; | ||
|
||
int | ||
machine_kexec_prepare(struct kimage *kimage) | ||
{ | ||
return 0; | ||
} | ||
|
||
void | ||
machine_kexec_cleanup(struct kimage *kimage) | ||
{ | ||
} | ||
|
||
void | ||
machine_shutdown(void) | ||
{ | ||
} | ||
|
||
void | ||
machine_crash_shutdown(struct pt_regs *regs) | ||
{ | ||
} | ||
|
||
void | ||
machine_kexec(struct kimage *image) | ||
{ | ||
unsigned long reboot_code_buffer; | ||
unsigned long entry; | ||
unsigned long *ptr; | ||
|
||
reboot_code_buffer = | ||
(unsigned long)page_address(image->control_code_page); | ||
|
||
kexec_start_address = image->start; | ||
kexec_indirection_page = phys_to_virt(image->head & PAGE_MASK); | ||
|
||
memcpy((void*)reboot_code_buffer, relocate_new_kernel, | ||
relocate_new_kernel_size); | ||
|
||
/* | ||
* The generic kexec code builds a page list with physical | ||
* addresses. they are directly accessible through KSEG0 (or | ||
* CKSEG0 or XPHYS if on 64bit system), hence the | ||
* pys_to_virt() call. | ||
*/ | ||
for (ptr = &image->head; (entry = *ptr) && !(entry &IND_DONE); | ||
ptr = (entry & IND_INDIRECTION) ? | ||
phys_to_virt(entry & PAGE_MASK) : ptr + 1) { | ||
if (*ptr & IND_SOURCE || *ptr & IND_INDIRECTION || | ||
*ptr & IND_DESTINATION) | ||
*ptr = phys_to_virt(*ptr); | ||
} | ||
|
||
/* | ||
* we do not want to be bothered. | ||
*/ | ||
local_irq_disable(); | ||
|
||
flush_icache_range(reboot_code_buffer, | ||
reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE); | ||
|
||
printk("Will call new kernel at %08x\n", image->start); | ||
printk("Bye ...\n"); | ||
flush_cache_all(); | ||
((void (*)(void))reboot_code_buffer)(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* relocate_kernel.S for kexec | ||
* Created by <nschichan@corp.free.fr> on Thu Oct 12 17:49:57 2006 | ||
* | ||
* This source code is licensed under the GNU General Public License, | ||
* Version 2. See the file COPYING for more details. | ||
*/ | ||
|
||
#include <asm/asm.h> | ||
#include <asm/asmmacro.h> | ||
#include <asm/regdef.h> | ||
#include <asm/page.h> | ||
#include <asm/mipsregs.h> | ||
#include <asm/stackframe.h> | ||
#include <asm/addrspace.h> | ||
|
||
.globl relocate_new_kernel | ||
relocate_new_kernel: | ||
|
||
PTR_L s0, kexec_indirection_page | ||
PTR_L s1, kexec_start_address | ||
|
||
process_entry: | ||
PTR_L s2, (s0) | ||
PTR_ADD s0, s0, SZREG | ||
|
||
/* destination page */ | ||
and s3, s2, 0x1 | ||
beq s3, zero, 1f | ||
and s4, s2, ~0x1 /* store destination addr in s4 */ | ||
move a0, s4 | ||
b process_entry | ||
|
||
1: | ||
/* indirection page, update s0 */ | ||
and s3, s2, 0x2 | ||
beq s3, zero, 1f | ||
and s0, s2, ~0x2 | ||
b process_entry | ||
|
||
1: | ||
/* done page */ | ||
and s3, s2, 0x4 | ||
beq s3, zero, 1f | ||
b done | ||
1: | ||
/* source page */ | ||
and s3, s2, 0x8 | ||
beq s3, zero, process_entry | ||
and s2, s2, ~0x8 | ||
li s6, (1 << PAGE_SHIFT) / SZREG | ||
|
||
copy_word: | ||
/* copy page word by word */ | ||
REG_L s5, (s2) | ||
REG_S s5, (s4) | ||
INT_ADD s4, s4, SZREG | ||
INT_ADD s2, s2, SZREG | ||
INT_SUB s6, s6, 1 | ||
beq s6, zero, process_entry | ||
b copy_word | ||
b process_entry | ||
|
||
done: | ||
/* jump to kexec_start_address */ | ||
j s1 | ||
|
||
.globl kexec_start_address | ||
kexec_start_address: | ||
.long 0x0 | ||
|
||
.globl kexec_indirection_page | ||
kexec_indirection_page: | ||
.long 0x0 | ||
|
||
relocate_new_kernel_end: | ||
|
||
.globl relocate_new_kernel_size | ||
relocate_new_kernel_size: | ||
.long relocate_new_kernel_end - relocate_new_kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* kexec.h for kexec | ||
* Created by <nschichan@corp.free.fr> on Thu Oct 12 14:59:34 2006 | ||
* | ||
* This source code is licensed under the GNU General Public License, | ||
* Version 2. See the file COPYING for more details. | ||
*/ | ||
|
||
#ifndef _MIPS_KEXEC | ||
# define _MIPS_KEXEC | ||
|
||
/* Maximum physical address we can use pages from */ | ||
#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000) | ||
/* Maximum address we can reach in physical address mode */ | ||
#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000) | ||
/* Maximum address we can use for the control code buffer */ | ||
#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000) | ||
|
||
#define KEXEC_CONTROL_CODE_SIZE 4096 | ||
|
||
/* The native architecture */ | ||
#define KEXEC_ARCH KEXEC_ARCH_MIPS | ||
|
||
#define MAX_NOTE_BYTES 1024 | ||
|
||
static inline void crash_setup_regs(struct pt_regs *newregs, | ||
struct pt_regs *oldregs) | ||
{ | ||
/* Dummy implementation for now */ | ||
} | ||
|
||
#endif /* !_MIPS_KEXEC */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters