@@ -3,10 +3,23 @@
#ifndef __ASM_STATIC_MEMORY_H_
#define __ASM_STATIC_MEMORY_H_
+#include <xen/pfn.h>
#include <asm/kernel.h>
#ifdef CONFIG_STATIC_MEMORY
+static inline void init_staticmem_bank(const struct membank *bank)
+{
+ mfn_t bank_start = _mfn(PFN_UP(bank->start));
+ unsigned long bank_pages = PFN_DOWN(bank->size);
+ mfn_t bank_end = mfn_add(bank_start, bank_pages);
+
+ if ( mfn_x(bank_end) <= mfn_x(bank_start) )
+ return;
+
+ unprepare_staticmem_pages(mfn_to_page(bank_start), bank_pages, false);
+}
+
void allocate_static_memory(struct domain *d, struct kernel_info *kinfo,
const struct dt_device_node *node);
void assign_static_memory_11(struct domain *d, struct kernel_info *kinfo,
@@ -265,17 +265,7 @@ void __init init_staticmem_pages(void)
for ( bank = 0 ; bank < reserved_mem->nr_banks; bank++ )
{
if ( reserved_mem->bank[bank].type == MEMBANK_STATIC_DOMAIN )
- {
- mfn_t bank_start = _mfn(PFN_UP(reserved_mem->bank[bank].start));
- unsigned long bank_pages = PFN_DOWN(reserved_mem->bank[bank].size);
- mfn_t bank_end = mfn_add(bank_start, bank_pages);
-
- if ( mfn_x(bank_end) <= mfn_x(bank_start) )
- return;
-
- unprepare_staticmem_pages(mfn_to_page(bank_start),
- bank_pages, false);
- }
+ init_staticmem_bank(&reserved_mem->bank[bank]);
}
}