From: Itsuro O. <od...@us...> - 2006-02-14 05:30:34
|
Update of /cvsroot/mkdump/mkexec/3.0/2.6/include/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12378/3.0/2.6/include/linux Added Files: mkexec.h cpus.h minik_param.h mkexec_ex.h Log Message: register for 3.0: based on 2.1 mkexec-2_0-linux-2_6-2_r --- NEW FILE: cpus.h --- /* * include/linux/cpus.h * * $Id: cpus.h,v 1.1 2006/02/14 05:30:26 odaodab Exp $ * Written by Fernando Luis Vazquez Cao * * Portions Copyright (C) 2004-2005 NTT DATA CORPORATION. * Portions Copyright (C) 2004-2005 VA Linux Systems Japan K.K. * * This file is part of Mkdump. * * Mkdump 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). * * Mkdump 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 Mkdump; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _CPUS_H #define _CPUS_H #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) #define get_processor_id() (0) #define convert_apicid_to_cpu(apic_id) (0xff) void stop_this_cpu(void *); #define stop_this_cpu_safe(a) stop_this_cpu(a) #else /* kernel 2.6 */ #ifndef CONFIG_SMP #define get_processor_id() (0) #define convert_apicid_to_cpu(apic_id) (0xff) #else /* !CONFIG_SMP */ #include <linux/smp.h> #if defined(CONFIG_IA64) || defined(CONFIG_X86_64) || defined(CONFIG_X86) #ifdef CONFIG_IA64 #define arch_cpu_to_apicid ia64_cpu_to_sapicid #define ARCH_BAD_APICID (0xffff) #error "FIXME: convert_apicid_to_cpu() u8 type broken for ia64" #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) #define arch_cpu_to_apicid x86_cpu_to_apicid #define ARCH_BAD_APICID (0xff) #endif #if defined(CONFIG_IA64) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)) static inline u8 convert_apicid_to_cpu(u16 apic_id) { int i; for (i = 0; i < NR_CPUS; i++) { if (arch_cpu_to_apicid[i] == apic_id) return i; } return -1; } /* Replacement for smp_processor_id() as on i386 * its 'current_thread_info()->cpu' gets corrupted during a stack overflow. */ static inline u8 get_processor_id(void) { u16 apic_id; /* apic_id = hard_smp_processor_id(); */ apic_id = GET_APIC_ID(apic_read(APIC_ID)); if (apic_id == ARCH_BAD_APICID) return -1; return convert_apicid_to_cpu(apic_id); } #else /* before 2.6.9 */ #define get_processor_id() smp_processor_id() #define convert_apicid_to_cpu(apic_id) (0xff) #endif static inline void stop_this_cpu_safe (void *dummy) { int cpuid = get_processor_id(); cpu_clear(cpuid, cpu_online_map); local_irq_disable(); #if defined(CONFIG_X86_LOCAL_APIC) lapic_mkexec_restore_once(); #endif #if defined(CONFIG_X86) && !defined(CONFIG_X86_64) if (cpu_data[cpuid].hlt_works_ok) #endif for(;;) __asm__("hlt"); for (;;); } #else /* defined(CONFIG_IA64)||defined(CONFIG_X86_64)||defined(CONFIG_X86) */ #define get_processor_id() smp_processor_id() #define convert_apicid_to_cpu(apic_id) (0xff) #endif /* defined(CONFIG_IA64)||defined(CONFIG_X86_64)||defined(CONFIG_X86) */ #endif /* !CONFIG_SMP */ #endif /* kernel 2.6 */ #endif /* _CPUS_H */ --- NEW FILE: mkexec_ex.h --- /* * include/linux/mkexec_ex.h * * $Id: mkexec_ex.h,v 1.1 2006/02/14 05:30:26 odaodab Exp $ * * Portions Copyright (C) 2004-2005 NTT DATA CORPORATION. * Portions Copyright (C) 2004-2005 VA Linux Systems Japan K.K. * * This file is part of Mkdump. * * Mkdump 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). * * Mkdump 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 Mkdump; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef LINUX_MKEXEC_EX_H #define LINUX_MKEXEC_EX_H #ifndef CONFIG_DUMP_MKEXEC #define MKEXEC_NO_PATCH /* indicates the kernel not apply mkexec-patch */ struct crashmem { unsigned long base_pa; unsigned long size_bytes; }; extern struct crashmem *crashmem_get(int); #endif /* for 2.4 kernel */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) #define BACKPORT_24 #define __user #define global_flush_tlb() flush_tlb_all() #ifdef CONFIG_SMP #if NR_CPUS > 32 #error "to many cpus" #endif #include <linux/bitops.h> #define cpu_isset(cpu, map) test_bit(cpu, &(map)) #define num_online_cpus() hweight32(cpu_online_map) #endif static inline dev_t convert_old_dev(int dev) { dev_t old_dev; old_dev = MKDEV(dev >> 20, dev & 0xfffff); return old_dev; } /* for pgdat_list member imcompatibility: 2.4 version */ #define next_pgdat(p) (p->node_next) #define size_pgdat(p) (p->node_size) #define pfn_pgdat(p) (p->node_start_paddr >> PAGE_SHIFT) #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) */ /* for pgdat_list member imcompatibility: 2.6 version */ #define next_pgdat(p) (p->pgdat_next) #define size_pgdat(p) (p->node_spanned_pages) #define pfn_pgdat(p) (p->node_start_pfn) #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) */ #endif /* LINUX_MKEXEC_EX_H */ --- NEW FILE: minik_param.h --- /* * include/linux/minik_param.h * * $Id: minik_param.h,v 1.1 2006/02/14 05:30:26 odaodab Exp $ * * Portions Copyright (C) 2004-2005 NTT DATA CORPORATION. * Portions Copyright (C) 2004-2005 VA Linux Systems Japan K.K. * * This file is part of Mkdump. * * Mkdump 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). * * Mkdump 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 Mkdump; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * dump_header must be defined for every arch each. * the first member must be dump_version. */ #define DUMP_MAGIC_LEN 10 struct dump_version { char dv_magic[DUMP_MAGIC_LEN]; u8 dv_version; u8 dv_arch; u32 dv_unique; }; #define DUMP_MAGIC "MINIK_DUMP" #define DUMP_VERSION 1 #define DUMP_ARCH_I386 1 #define DUMP_ARCH_X8664 2 #define DUMP_ARCH_IA64 3 #ifdef __KERNEL__ extern void init_dump_header(struct kimage *image); extern void lapic_mkexec_restore_once(void); extern void start_dump(char *, struct pt_regs *, int); extern void do_minik_dump(char *panic_str, struct pt_regs *regs); #endif --- NEW FILE: mkexec.h --- /* * include/linux/mkexec.h * * $Id: mkexec.h,v 1.1 2006/02/14 05:30:26 odaodab Exp $ * * Portions Copyright (C) 2004-2005 NTT DATA CORPORATION. * Portions Copyright (C) 2004-2005 VA Linux Systems Japan K.K. * * This file is part of Mkdump. * * Mkdump 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). * * Mkdump 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 Mkdump; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef LINUX_MKEXEC_H #define LINUX_MKEXEC_H #include <linux/types.h> #include <linux/version.h> #define MKEXEC_SEGMENT_MAX 3 struct mkexec_segment { void *buf; size_t bufsz; void *mem; size_t memsz; }; #define MAX_MINIK_MEM_SEG 32 #define MINIK_SEG_SIZE 0x400000 /* 4MB */ #define MINIK_SEG_SHIFT 22 #define MINIK_SEG_MASK 0x3fffff struct mkexec_reserve_mem { unsigned long base_pa; unsigned long size_bytes; struct page *pages; int order; }; #define MINIK_V1 0 #define MINIK_V2 1 #define MKEXEC_CONTROL_PAGES_MAX 32 struct kimage { unsigned long new_kernel_paddr; unsigned long start; unsigned long reboot_code_addr; unsigned long nr_segments; /* ODA: remove --> enum */ struct mkexec_segment segment[MKEXEC_SEGMENT_MAX]; int minik_type; struct mkexec_reserve_mem reserve_mem_dma; struct mkexec_reserve_mem reserve_mem[MAX_MINIK_MEM_SEG]; int num_minik_mem; int num_control_page; struct page *control_code_page; struct page *control_page[MKEXEC_CONTROL_PAGES_MAX]; struct page *dump_header_pages; }; /* mkexec interface functions */ extern void machine_mkexec(struct kimage *image); extern struct kimage *mkexec_image; const extern unsigned char start_new_kernel[]; extern void start_new_kernel_end(void); const extern unsigned int start_new_kernel_size; /* * /proc/mkexec */ #define MKEXEC_MOD_MAXLEN 256 #define MKEXEC_MOD_MAXDEVLEN 16 typedef struct { int stats; char path[MKEXEC_MOD_MAXLEN]; char parm[MKEXEC_MOD_MAXLEN]; char ddev[MKEXEC_MOD_MAXDEVLEN]; char memstr[MKEXEC_MOD_MAXDEVLEN]; int mem; atomic_t sem; int writ_cnt; } mkexec_mod_t; extern mkexec_mod_t mkexec_inf; #define MAX_MEM_SEG 62 /* struct mem_seg <= 4KB (1 page) */ struct mem_seg_list { u64 seg_start_pfn; u64 seg_size_pfn; }; struct mem_seg { u32 page_size; u32 seg_num; struct mem_seg_list seg_list[MAX_MEM_SEG]; }; #include <linux/mkexec_ex.h> #ifndef MKEXEC_NO_PATCH #include <linux/mkexec_dump.h> #include <asm/mkexec_export.h> #endif #endif /* LINUX_MKEXEC_H */ |