diff options
author | Maxim Uvarov <muvarov@gmail.com> | 2010-03-03 14:05:53 +0300 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2010-03-08 11:47:40 +1100 |
commit | 6adc05c6e3fdbc8b9f5d915af78ca05d0a09cb17 (patch) | |
tree | e7f77201ba84a243898a5984f9426626912b8eca /kexec/arch/mips/kexec-mips.c | |
parent | 5996651eccbffb7c195c2911f37fda2f2258e48d (diff) |
some kexec MIPS improvements
- using simple mips* ) in configure.ac to make it compilable on mips2
and mips64
- remove kexec/arch/mips/mips-setup-simple.S which prepares cmdline for
new kernel, it is better to move this work to kernel code. BTW this code was
compilable only on o32 because of t4 is not defined on 64-64 or n32 MIPS ABIs.
- simple put cmdline as string, kernel code should catch cmdline like this
int board_kexec_prepare(struct kimage *image)
{
int i;
char *bootloader = "kexec";
board_boot_desc_ptr->argc = 0;
for(i=0;i<image->nr_segments;i++)
{
printk("segment %d
if (!strncmp(bootloader, (char*)image->segment[i].buf,
strlen(bootloader)))
{
/*
* convert command line string to array
* of parameters (as bootloader does).
*/
int argc = 0, offt;
char *str = (char *)image->segment[i].buf;
char *ptr = strchr(str, ' ');
while (ptr && (ARGV_MAX_ARGS > argc)) {
*ptr = '\0';
if (ptr[1] != ' ') {
offt = (int)(ptr - str + 1);
boot_desc_ptr->argv[argc] =
image->segment[i].mem + offt;
argc++;
}
ptr = strchr(ptr + 1, ' ');
}
boot_desc_ptr->argc = argc;
break;
}
}
Keep it as string make code simple and more readable.
- add crashdump support
- do not redefine syscalls numbers if they defined in system
remove fixups for /proc/iomem. If your board provides wrong /proc/iomem please
fix kernel, or at least you local version of kexec. No need to support it in
main line. At least add option --fake-iomem
- some minor fixes
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/mips/kexec-mips.c')
-rw-r--r-- | kexec/arch/mips/kexec-mips.c | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c index cb75a2d..bd12bb3 100644 --- a/kexec/arch/mips/kexec-mips.c +++ b/kexec/arch/mips/kexec-mips.c @@ -21,8 +21,6 @@ #include "kexec-mips.h" #include <arch/options.h> -#define MAX_MEMORY_RANGES 64 -#define MAX_LINE 160 static struct memory_range memory_range[MAX_MEMORY_RANGES]; /* Return a sorted list of memory ranges. */ @@ -31,16 +29,6 @@ int get_memory_ranges(struct memory_range **range, int *ranges, { int memory_ranges = 0; -#if 1 - /* this is valid for gemini2 platform based on tx4938 - * in our case, /proc/iomem doesn't report ram space - */ - memory_range[memory_ranges].start = 0x00000000; - memory_range[memory_ranges].end = 0x04000000; - memory_range[memory_ranges].type = RANGE_RAM; - memory_ranges++; -#else -#error Please, fix this for your platform const char iomem[] = "/proc/iomem"; char line[MAX_LINE]; FILE *fp; @@ -61,31 +49,19 @@ int get_memory_ranges(struct memory_range **range, int *ranges, continue; str = line + consumed; end = end + 1; -#if 0 - printf("%016Lx-%016Lx : %s\n", start, end, str); -#endif if (memcmp(str, "System RAM\n", 11) == 0) { type = RANGE_RAM; } else if (memcmp(str, "reserved\n", 9) == 0) { type = RANGE_RESERVED; - } else if (memcmp(str, "ACPI Tables\n", 12) == 0) { - type = RANGE_ACPI; - } else if (memcmp(str, "ACPI Non-volatile Storage\n", 26) == 0) { - type = RANGE_ACPI_NVS; } else { continue; } memory_range[memory_ranges].start = start; memory_range[memory_ranges].end = end; memory_range[memory_ranges].type = type; -#if 0 - printf("%016Lx-%016Lx : %x\n", start, end, type); -#endif memory_ranges++; } fclose(fp); -#endif - *range = memory_range; *ranges = memory_ranges; return 0; @@ -98,8 +74,18 @@ int file_types = sizeof(file_type) / sizeof(file_type[0]); void arch_usage(void) { +#ifdef __mips64 + fprintf(stderr, " --elf32-core-headers Prepare core headers in " + "ELF32 format\n"); +#endif } +#ifdef __mips64 +struct arch_options_t arch_options = { + .core_header_type = CORE_TYPE_ELF64 +}; +#endif + int arch_process_options(int argc, char **argv) { static const struct option options[] = { @@ -126,12 +112,14 @@ const struct arch_map_entry arches[] = { /* For compatibility with older patches * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_MIPS here. */ - { "mips", KEXEC_ARCH_DEFAULT }, + { "mips", KEXEC_ARCH_MIPS }, + { "mips64", KEXEC_ARCH_MIPS }, { NULL, 0 }, }; int arch_compat_trampoline(struct kexec_info *UNUSED(info)) { + return 0; } @@ -139,18 +127,9 @@ void arch_update_purgatory(struct kexec_info *UNUSED(info)) { } -/* - * Adding a dummy function, so that build on mips will not break. - * Need to implement the actual checking code - */ -int is_crashkernel_mem_reserved(void) -{ - return 1; -} - unsigned long virt_to_phys(unsigned long addr) { - return addr - 0x80000000; + return addr & 0x7fffffff; } /* @@ -159,7 +138,7 @@ unsigned long virt_to_phys(unsigned long addr) void add_segment(struct kexec_info *info, const void *buf, size_t bufsz, unsigned long base, size_t memsz) { - add_segment_phys_virt(info, buf, bufsz, base, memsz, 1); + add_segment_phys_virt(info, buf, bufsz, virt_to_phys(base), memsz, 1); } /* |