Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / asm-ia64 / crash.h
1 #ifndef _ASM_IA64_CRASH_H
2 #define _ASM_IA64_CRASH_H
3
4 /*
5  * linux/include/asm-ia64/crash.h
6  *
7  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  */
24
25 #ifdef __KERNEL__
26
27 #include <linux/efi.h>
28 #include <linux/mm.h>
29 #include <asm/mmzone.h>
30
31 static inline void *
32 map_virtual(u64 offset, struct page **pp)
33 {
34         struct page *page;
35         unsigned long pfn;
36         u32 type;
37
38         if (REGION_NUMBER(offset) == 5) {
39                 char byte;
40
41                 if (__get_user(byte, (char *)offset) == 0)
42                         return (void *)offset;
43                 else
44                         return NULL;
45         }
46
47         switch (type = efi_mem_type(offset)) 
48         {
49         case EFI_LOADER_CODE:
50         case EFI_LOADER_DATA:
51         case EFI_BOOT_SERVICES_CODE:
52         case EFI_BOOT_SERVICES_DATA:
53         case EFI_CONVENTIONAL_MEMORY:
54                 break;
55
56         default:
57                 printk(KERN_INFO
58                     "crash memory driver: invalid memory type for %lx: %d\n", 
59                         offset, type);
60                 return NULL;
61         }
62
63         pfn = offset >> PAGE_SHIFT;
64
65         if (!pfn_valid(pfn)) {
66                 printk(KERN_INFO
67                         "crash memory driver: invalid pfn: %lx )\n", pfn);
68                 return NULL;
69         }
70
71         page = pfn_to_page(pfn);
72
73         if (!page->virtual) {
74                 printk(KERN_INFO
75                     "crash memory driver: offset: %lx page: %lx page->virtual: NULL\n", 
76                         offset, (unsigned long)page);
77                 return NULL;
78         }
79
80         return (page->virtual + (offset & (PAGE_SIZE-1)));
81 }
82
83 static inline void unmap_virtual(struct page *page) 
84
85         return;
86 }
87
88 #endif /* __KERNEL__ */
89
90 #endif /* _ASM_IA64_CRASH_H */