This commit was manufactured by cvs2svn to create branch
[linux-2.6.git] / include / asm-ppc64 / netdump.h
1 #ifndef _ASM_PPC64_NETDUMP_H_
2 #define _ASM_PPC64_NETDUMP_H_
3
4 /*
5  * linux/include/asm-ppc64/netdump.h
6  *
7  * Copyright (c) 2003, 2004 Red Hat, Inc. All rights reserved.
8  * Copyright (C) 2004 IBM Corp.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2, or (at your option)
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  */
25
26 #ifdef __KERNEL__
27
28 #include <asm/crashdump.h>
29
30 const static int platform_supports_netdump = 1;
31
32 #define platform_page_is_ram(x) (page_is_ram(x))
33 #define platform_machine_type() (EM_PPC64)
34
35 static inline unsigned char platform_effective_version(req_t *req)
36 {
37         if (req->from > 0)
38                 return min_t(unsigned char, req->from, NETDUMP_VERSION_MAX);
39         else
40                 return 0;
41 }
42
43 #define platform_max_pfn() (num_physpages)
44
45 static inline u32 platform_next_available(unsigned long pfn)
46 {
47         unsigned long pgnum = next_ram_page(pfn);
48
49         if (pgnum < platform_max_pfn()) {
50                 return (u32)pgnum;
51         }
52         return 0;
53 }
54
55 static inline void platform_jiffy_cycles(unsigned long long *jcp)
56 {
57        unsigned long long t0, t1;
58
59        platform_timestamp(t0);
60        netdump_mdelay(1);
61        platform_timestamp(t1);
62        if (t1 > t0)
63                *jcp = t1 - t0;
64 }
65
66 static inline unsigned int platform_get_regs(char *tmp, struct pt_regs *myregs)
67 {
68         elf_gregset_t elf_regs;
69         char *tmp2;
70
71         tmp2 = tmp + sprintf(tmp, "Sending register info.\n");
72         ELF_CORE_COPY_REGS(elf_regs, myregs);
73         memcpy(tmp2, &elf_regs, sizeof(elf_regs));
74
75         return(strlen(tmp) + sizeof(elf_regs));
76 }
77 #endif /* __KERNEL__ */
78
79 #endif /* _ASM_PPC64_NETDUMP_H_ */