X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-i386%2Fmmzone.h;fp=include%2Fasm-i386%2Fmmzone.h;h=74f595d80579c275e103d0ac326b969e69561ab5;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=22cb07cc8f32cc78f9d0ef23d442a6c13462ca21;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 22cb07cc8..74f595d80 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h @@ -14,7 +14,7 @@ extern struct pglist_data *node_data[]; #ifdef CONFIG_X86_NUMAQ #include -#elif defined(CONFIG_ACPI_SRAT)/* summit or generic arch */ +#else /* summit or generic arch */ #include #endif @@ -70,6 +70,8 @@ static inline int pfn_to_nid(unsigned long pfn) #endif } +#define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) + /* * Following are macros that each numa implmentation must define. */ @@ -84,6 +86,21 @@ static inline int pfn_to_nid(unsigned long pfn) /* XXX: FIXME -- wli */ #define kern_addr_valid(kaddr) (0) +#define pfn_to_page(pfn) \ +({ \ + unsigned long __pfn = pfn; \ + int __node = pfn_to_nid(__pfn); \ + &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \ +}) + +#define page_to_pfn(pg) \ +({ \ + struct page *__page = pg; \ + struct zone *__zone = page_zone(__page); \ + (unsigned long)(__page - __zone->zone_mem_map) \ + + __zone->zone_start_pfn; \ +}) + #ifdef CONFIG_X86_NUMAQ /* we have contiguous memory on NUMA-Q */ #define pfn_valid(pfn) ((pfn) < num_physpages) #else