Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99 |
| 3 | * Rewritten for Linux 2.6 by Christoph Hellwig (hch@lst.de) Jan 2004 |
| 4 | */ |
| 5 | #ifndef _ASM_MMZONE_H_ |
| 6 | #define _ASM_MMZONE_H_ |
| 7 | |
Ralf Baechle | beb3ca8 | 2005-10-29 19:32:40 +0100 | [diff] [blame] | 8 | #include <linux/config.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <asm/page.h> |
| 10 | #include <mmzone.h> |
| 11 | |
Yoichi Yuasa | b4819b5 | 2005-06-25 14:54:31 -0700 | [diff] [blame] | 12 | #ifdef CONFIG_DISCONTIGMEM |
| 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #define kvaddr_to_nid(kvaddr) pa_to_nid(__pa(kvaddr)) |
| 15 | #define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT) |
| 16 | |
| 17 | #define pfn_valid(pfn) \ |
| 18 | ({ \ |
| 19 | unsigned long __pfn = (pfn); \ |
| 20 | int __n = pfn_to_nid(__pfn); \ |
| 21 | ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \ |
| 22 | NODE_DATA(__n)->node_spanned_pages) : 0);\ |
| 23 | }) |
| 24 | |
| 25 | #define pfn_to_page(pfn) \ |
| 26 | ({ \ |
| 27 | unsigned long __pfn = (pfn); \ |
| 28 | pg_data_t *__pg = NODE_DATA(pfn_to_nid(__pfn)); \ |
| 29 | __pg->node_mem_map + (__pfn - __pg->node_start_pfn); \ |
| 30 | }) |
| 31 | |
| 32 | #define page_to_pfn(p) \ |
| 33 | ({ \ |
| 34 | struct page *__p = (p); \ |
| 35 | struct zone *__z = page_zone(__p); \ |
| 36 | ((__p - __z->zone_mem_map) + __z->zone_start_pfn); \ |
| 37 | }) |
| 38 | |
| 39 | /* XXX: FIXME -- wli */ |
| 40 | #define kern_addr_valid(addr) (0) |
| 41 | |
Yoichi Yuasa | b4819b5 | 2005-06-25 14:54:31 -0700 | [diff] [blame] | 42 | #endif /* CONFIG_DISCONTIGMEM */ |
| 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #endif /* _ASM_MMZONE_H_ */ |