diff options
author | Khalid Aziz <khalid.aziz@hp.com> | 2006-07-27 11:21:01 -0600 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2006-07-27 11:21:01 -0600 |
commit | 2f646b5c4f31e8d0cd3e504dff4d691f06859bbc (patch) | |
tree | 0b5fbb6ebbbb6a20b97a57da3f071c6b18e864bb /purgatory | |
parent | 0a196ba1d11b449420b7817a84178a8bd2a1e9a5 (diff) | |
download | kexec-tools-2f646b5c4f31e8d0cd3e504dff4d691f06859bbc.tar.gz |
ia64 support
This patch adds support for kexec-tools on ia64. This patch applies on
top of -kdump7 patch from <http://lse.sourceforge.net/kdump/>.
Signed-off-by: Khalid Aziz <khalid.aziz@hp.com>
Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
Diffstat (limited to 'purgatory')
-rw-r--r-- | purgatory/arch/ia64/Makefile | 4 | ||||
-rw-r--r-- | purgatory/arch/ia64/entry.S | 85 | ||||
-rw-r--r-- | purgatory/arch/ia64/include/arch/io.h | 25 | ||||
-rw-r--r-- | purgatory/arch/ia64/purgatory-ia64.c | 106 |
4 files changed, 218 insertions, 2 deletions
diff --git a/purgatory/arch/ia64/Makefile b/purgatory/arch/ia64/Makefile index 8ba596e..6d6d2f5 100644 --- a/purgatory/arch/ia64/Makefile +++ b/purgatory/arch/ia64/Makefile @@ -1,8 +1,8 @@ # # Purgatory ia64 # - -PURGATORY_S_SRCS+= +PCFLAGS += -ffixed-r28 +PURGATORY_S_SRCS+= purgatory/arch/ia64/entry.S PURGATORY_C_SRCS+= purgatory/arch/ia64/purgatory-ia64.c PURGATORY_C_SRCS+= purgatory/arch/ia64/console-ia64.c PURGATORY_C_SRCS+= diff --git a/purgatory/arch/ia64/entry.S b/purgatory/arch/ia64/entry.S new file mode 100644 index 0000000..78169a6 --- /dev/null +++ b/purgatory/arch/ia64/entry.S @@ -0,0 +1,85 @@ +/* + * purgatory: setup code + * + * Copyright (C) 2005 Zou Nan hai (nanhai.zou@intel.com) + * + * 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 (version 2 of the License). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +.global __dummy_efi_function +.align 32 +.proc __dummy_efi_function +__dummy_efi_function: + mov r8=r0;; + br.ret.sptk.many rp;; +.global __dummy_efi_function_end +__dummy_efi_function_end: +.endp __dummy_efi_function + +.global purgatory_start +.align 32 +.proc purgatory_start +purgatory_start: + movl r2=__gp_value;; + ld8 gp=[r2];; + br.call.sptk.many b0=purgatory + ;; + alloc r2 = ar.pfs, 0, 0, 5, 0 + ;; + mov out0=r28 + + movl r2=__command_line;; + ld8 out1=[r2];; + movl r2=__command_line_len;; + ld8 out2=[r2];; + movl r2=__ramdisk_base;; + ld8 out3=[r2];; + movl r2=__ramdisk_size;; + ld8 out4=[r2];; + br.call.sptk.many b0=ia64_env_setup + movl r10=__kernel_entry;; + ld8 r14=[r10];; + mov b6=r14;; + mov ar.lc=r0 + mov ar.ec=r0 + cover;; + invala;; + br.call.sptk.many b0=b6 +.endp purgatory_start + +.align 32 +.global __kernel_entry +.size __kernel_entry, 8 +__kernel_entry: + data8 0x0 +.global __command_line +.size __command_line, 8 +__command_line: + data8 0x0 +.global __command_line_len +.size __command_line_len, 8 +__command_line_len: + data8 0x0 +.global __ramdisk_base +.size __ramdisk_base, 8 +__ramdisk_base: + data8 0x0 +.global __ramdisk_size +.size __ramdisk_size, 8 +__ramdisk_size: + data8 0x0 +.global __gp_value +.size __gp_value, 8 +__gp_value: + data8 0x0 diff --git a/purgatory/arch/ia64/include/arch/io.h b/purgatory/arch/ia64/include/arch/io.h new file mode 100644 index 0000000..7b313fc --- /dev/null +++ b/purgatory/arch/ia64/include/arch/io.h @@ -0,0 +1,25 @@ +#ifndef ARCH_IO_H +#define ARCH_IO_H + +#include <stdint.h> +/* Helper functions for directly doing I/O */ + +extern inline uint8_t inb(void *port) +{ + volatile unsigned char *addr = (unsigned char *)port; + uint8_t result; + + result = *addr; + asm volatile ("mf.a"::: "memory"); + return result; +} + +extern inline void outb (uint8_t value, void *port) +{ + volatile unsigned char *addr = (unsigned char *)port; + + *addr = value; + asm volatile ("mf.a"::: "memory"); +} + +#endif /* ARCH_IO_H */ diff --git a/purgatory/arch/ia64/purgatory-ia64.c b/purgatory/arch/ia64/purgatory-ia64.c index 369e175..8d2008c 100644 --- a/purgatory/arch/ia64/purgatory-ia64.c +++ b/purgatory/arch/ia64/purgatory-ia64.c @@ -1,10 +1,116 @@ #include <purgatory.h> +#include <stdint.h> +#include <string.h> #include "purgatory-ia64.h" +#define PAGE_OFFSET 0xe000000000000000 + +typedef struct { + uint64_t signature; + uint32_t revision; + uint32_t headersize; + uint32_t crc32; + uint32_t reserved; +} efi_table_hdr_t; + +typedef struct { + efi_table_hdr_t hdr; + unsigned long get_time; + unsigned long set_time; + unsigned long get_wakeup_time; + unsigned long set_wakeup_time; + unsigned long set_virtual_address_map; + unsigned long convert_pointer; + unsigned long get_variable; + unsigned long get_next_variable; + unsigned long set_variable; + unsigned long get_next_high_mono_count; + unsigned long reset_system; +} efi_runtime_services_t; + +typedef struct { + efi_table_hdr_t hdr; + unsigned long fw_vendor; /* physical addr of CHAR16 vendor string + */ + uint32_t fw_revision; + unsigned long con_in_handle; + unsigned long con_in; + unsigned long con_out_handle; + unsigned long con_out; + unsigned long stderr_handle; + unsigned long stderr; + unsigned long runtime; + unsigned long boottime; + unsigned long nr_tables; + unsigned long tables; +} efi_system_table_t; + +struct ia64_boot_param { + uint64_t command_line; /* physical address of command line arguments */ + uint64_t efi_systab; /* physical address of EFI system table */ + uint64_t efi_memmap; /* physical address of EFI memory map */ + uint64_t efi_memmap_size; /* size of EFI memory map */ + uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor */ + uint32_t efi_memdesc_version; /* memory descriptor version */ + struct { + uint16_t num_cols; /* number of columns on console output device */ + uint16_t num_rows; /* number of rows on console output device */ + uint16_t orig_x; /* cursor's x position */ + uint16_t orig_y; /* cursor's y position */ + } console_info; + uint64_t fpswa; /* physical address of the fpswa interface */ + uint64_t initrd_start; + uint64_t initrd_size; +}; + void setup_arch(void) { /* Nothing for now */ } +inline unsigned long PA(unsigned long addr) +{ + return addr - PAGE_OFFSET; +} + +void flush_icache_range(char *start, unsigned long len) +{ + unsigned long i; + for (i = 0;i < len; i += 32) + asm volatile("fc.i %0"::"r"(start+i):"memory"); + asm volatile (";;sync.i;;":::"memory"); + asm volatile ("srlz.i":::"memory"); +} + +extern char __dummy_efi_function[], __dummy_efi_function_end[]; + +void ia64_env_setup(struct ia64_boot_param *boot_param, + uint64_t command_line, uint64_t command_line_len, + uint64_t ramdisk_base, uint64_t ramdisk_size) +{ + unsigned long len; + efi_system_table_t *systab; + efi_runtime_services_t *runtime; + unsigned long *set_virtual_address_map; + + // patch efi_runtime->set_virtual_address_map to a + // dummy function + len = __dummy_efi_function_end - __dummy_efi_function; + memcpy((char *)command_line + command_line_len, __dummy_efi_function, + len); + systab = (efi_system_table_t *)boot_param->efi_systab; + runtime = (efi_runtime_services_t *)PA(systab->runtime); + set_virtual_address_map = + (unsigned long *)PA(runtime->set_virtual_address_map); + *(set_virtual_address_map)= + (unsigned long)((char *)command_line + command_line_len); + flush_icache_range((char *)command_line+command_line_len, len); + + boot_param->command_line = command_line; + boot_param->console_info.orig_x = 0; + boot_param->console_info.orig_y = 0; + boot_param->initrd_start = ramdisk_base; + boot_param->initrd_size = ramdisk_size; +} /* This function can be used to execute after the SHA256 verification. */ void post_verification_setup_arch(void) |