change function names
This commit is contained in:
@@ -14,7 +14,7 @@ void panic(const char *msg)
|
||||
|
||||
extern void arch_show_interrupt_context(const void*);
|
||||
|
||||
void aal_mc_debug_show_interrupt_context(const void *reg)
|
||||
void ihk_mc_debug_show_interrupt_context(const void *reg)
|
||||
{
|
||||
arch_show_interrupt_context(reg);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef AAL_CPU_H
|
||||
#define AAL_CPU_H
|
||||
#ifndef IHK_CPU_H
|
||||
#define IHK_CPU_H
|
||||
|
||||
#include <list.h>
|
||||
#include <ihk/context.h>
|
||||
@@ -14,68 +14,68 @@ void cpu_pause(void);
|
||||
|
||||
unsigned long cpu_disable_interrupt_save(void);
|
||||
|
||||
struct aal_mc_interrupt_handler {
|
||||
struct ihk_mc_interrupt_handler {
|
||||
struct list_head list;
|
||||
void (*func)(void *);
|
||||
void *priv;
|
||||
};
|
||||
int aal_mc_register_interrupt_handler(int vector,
|
||||
struct aal_mc_interrupt_handler *h);
|
||||
int aal_mc_unregister_interrupt_handler(int vector,
|
||||
struct aal_mc_interrupt_handler *h);
|
||||
int ihk_mc_register_interrupt_handler(int vector,
|
||||
struct ihk_mc_interrupt_handler *h);
|
||||
int ihk_mc_unregister_interrupt_handler(int vector,
|
||||
struct ihk_mc_interrupt_handler *h);
|
||||
|
||||
enum aal_mc_gv_type {
|
||||
AAL_GV_IKC = 1,
|
||||
enum ihk_mc_gv_type {
|
||||
IHK_GV_IKC = 1,
|
||||
};
|
||||
|
||||
int aal_mc_get_vector(enum aal_mc_gv_type type);
|
||||
int aal_mc_interrupt_host(int cpu, int vector);
|
||||
int ihk_mc_get_vector(enum ihk_mc_gv_type type);
|
||||
int ihk_mc_interrupt_host(int cpu, int vector);
|
||||
|
||||
struct aal_mc_cpu_info {
|
||||
struct ihk_mc_cpu_info {
|
||||
int ncpus;
|
||||
int *hw_ids;
|
||||
int *nodes;
|
||||
};
|
||||
|
||||
struct aal_mc_cpu_info *aal_mc_get_cpu_info(void);
|
||||
void aal_mc_boot_cpu(int cpuid, unsigned long pc);
|
||||
int aal_mc_get_processor_id(void);
|
||||
int aal_mc_get_hardware_processor_id(void);
|
||||
struct ihk_mc_cpu_info *ihk_mc_get_cpu_info(void);
|
||||
void ihk_mc_boot_cpu(int cpuid, unsigned long pc);
|
||||
int ihk_mc_get_processor_id(void);
|
||||
int ihk_mc_get_hardware_processor_id(void);
|
||||
|
||||
void aal_mc_delay_us(int us);
|
||||
void aal_mc_set_syscall_handler(long (*handler)(int, aal_mc_user_context_t *));
|
||||
void ihk_mc_delay_us(int us);
|
||||
void ihk_mc_set_syscall_handler(long (*handler)(int, ihk_mc_user_context_t *));
|
||||
|
||||
void aal_mc_init_ap(void);
|
||||
void ihk_mc_init_ap(void);
|
||||
|
||||
void aal_mc_init_context(aal_mc_kernel_context_t *new_ctx,
|
||||
void ihk_mc_init_context(ihk_mc_kernel_context_t *new_ctx,
|
||||
void *stack_pointer,
|
||||
void (*next_function)(void));
|
||||
void aal_mc_switch_context(aal_mc_kernel_context_t *old_ctx,
|
||||
aal_mc_kernel_context_t *new_ctx);
|
||||
int aal_mc_interrupt_cpu(int cpu, int vector);
|
||||
void ihk_mc_switch_context(ihk_mc_kernel_context_t *old_ctx,
|
||||
ihk_mc_kernel_context_t *new_ctx);
|
||||
int ihk_mc_interrupt_cpu(int cpu, int vector);
|
||||
|
||||
void aal_mc_init_user_process(aal_mc_kernel_context_t *ctx,
|
||||
aal_mc_user_context_t **puctx,
|
||||
void ihk_mc_init_user_process(ihk_mc_kernel_context_t *ctx,
|
||||
ihk_mc_user_context_t **puctx,
|
||||
void *stack_pointer, unsigned long user_pc,
|
||||
unsigned long user_sp);
|
||||
|
||||
enum aal_mc_user_context_regtype {
|
||||
AAL_UCR_STACK_POINTER = 1,
|
||||
AAL_UCR_PROGRAM_COUNTER = 2,
|
||||
enum ihk_mc_user_context_regtype {
|
||||
IHK_UCR_STACK_POINTER = 1,
|
||||
IHK_UCR_PROGRAM_COUNTER = 2,
|
||||
};
|
||||
|
||||
void aal_mc_modify_user_context(aal_mc_user_context_t *uctx,
|
||||
enum aal_mc_user_context_regtype reg,
|
||||
void ihk_mc_modify_user_context(ihk_mc_user_context_t *uctx,
|
||||
enum ihk_mc_user_context_regtype reg,
|
||||
unsigned long value);
|
||||
|
||||
void aal_mc_debug_show_interrupt_context(const void *reg);
|
||||
void ihk_mc_debug_show_interrupt_context(const void *reg);
|
||||
|
||||
enum aal_asr_type {
|
||||
AAL_ASR_X86_FS,
|
||||
AAL_ASR_X86_GS,
|
||||
enum ihk_asr_type {
|
||||
IHK_ASR_X86_FS,
|
||||
IHK_ASR_X86_GS,
|
||||
};
|
||||
|
||||
int aal_mc_arch_set_special_register(enum aal_asr_type, unsigned long value);
|
||||
int aal_mc_arch_get_special_register(enum aal_asr_type, unsigned long *value);
|
||||
int ihk_mc_arch_set_special_register(enum ihk_asr_type, unsigned long value);
|
||||
int ihk_mc_arch_get_special_register(enum ihk_asr_type, unsigned long *value);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef AAL_DEBUG_H
|
||||
#define AAL_DEBUG_H
|
||||
#ifndef IHK_DEBUG_H
|
||||
#define IHK_DEBUG_H
|
||||
|
||||
#include <ihk/memconst.h>
|
||||
|
||||
struct aal_kmsg_buf {
|
||||
struct ihk_kmsg_buf {
|
||||
int tail;
|
||||
int len;
|
||||
char str[AAL_KMSG_SIZE - sizeof(int) * 2];
|
||||
char str[IHK_KMSG_SIZE - sizeof(int) * 2];
|
||||
};
|
||||
|
||||
extern int kprintf(const char *format, ...);
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
|
||||
#include <ihk/ikc.h>
|
||||
|
||||
struct aal_dma_request {
|
||||
aal_os_t src_os;
|
||||
struct ihk_dma_request {
|
||||
ihk_os_t src_os;
|
||||
unsigned long src_phys;
|
||||
aal_os_t dest_os;
|
||||
ihk_os_t dest_os;
|
||||
unsigned long dest_phys;
|
||||
unsigned long size;
|
||||
|
||||
void (*callback)(void *);
|
||||
void *priv;
|
||||
aal_os_t notify_os;
|
||||
ihk_os_t notify_os;
|
||||
unsigned long *notify;
|
||||
};
|
||||
|
||||
int aal_mc_dma_request(int channel, struct aal_dma_request *req);
|
||||
int ihk_mc_dma_request(int channel, struct ihk_dma_request *req);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef __HEADER_GENERIC_AAL_LOCK
|
||||
#define __HEADER_GENERIC_AAL_LOCK
|
||||
#ifndef __HEADER_GENERIC_IHK_LOCK
|
||||
#define __HEADER_GENERIC_IHK_LOCK
|
||||
|
||||
#include <arch-lock.h>
|
||||
|
||||
#ifndef AAL_STATIC_SPINLOCK_FUNCS
|
||||
void aal_mc_spinlock_init(aal_spinlock_t *);
|
||||
void aal_mc_spinlock_lock(aal_spinlock_t *, unsigned long *);
|
||||
void aal_mc_spinlock_unlock(aal_spinlock_t *, unsigned long *);
|
||||
#ifndef IHK_STATIC_SPINLOCK_FUNCS
|
||||
void ihk_mc_spinlock_init(ihk_spinlock_t *);
|
||||
void ihk_mc_spinlock_lock(ihk_spinlock_t *, unsigned long *);
|
||||
void ihk_mc_spinlock_unlock(ihk_spinlock_t *, unsigned long *);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,99 +1,99 @@
|
||||
#ifndef __HEADER_GENERIC_AAL_MM_H
|
||||
#define __HEADER_GENERIC_AAL_MM_H
|
||||
#ifndef __HEADER_GENERIC_IHK_MM_H
|
||||
#define __HEADER_GENERIC_IHK_MM_H
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
enum aal_mc_gma_type {
|
||||
AAL_MC_GMA_MAP_START,
|
||||
AAL_MC_GMA_MAP_END,
|
||||
AAL_MC_GMA_AVAIL_START,
|
||||
AAL_MC_GMA_AVAIL_END,
|
||||
AAL_MC_GMA_HEAP_START,
|
||||
AAL_MC_NR_RESERVED_AREAS,
|
||||
AAL_MC_RESERVED_AREA_START,
|
||||
AAL_MC_RESERVED_AREA_END,
|
||||
enum ihk_mc_gma_type {
|
||||
IHK_MC_GMA_MAP_START,
|
||||
IHK_MC_GMA_MAP_END,
|
||||
IHK_MC_GMA_AVAIL_START,
|
||||
IHK_MC_GMA_AVAIL_END,
|
||||
IHK_MC_GMA_HEAP_START,
|
||||
IHK_MC_NR_RESERVED_AREAS,
|
||||
IHK_MC_RESERVED_AREA_START,
|
||||
IHK_MC_RESERVED_AREA_END,
|
||||
};
|
||||
|
||||
enum aal_mc_ma_type {
|
||||
AAL_MC_MA_AVAILABLE,
|
||||
AAL_MC_MA_RESERVED,
|
||||
AAL_MC_MA_SPECIAL,
|
||||
enum ihk_mc_ma_type {
|
||||
IHK_MC_MA_AVAILABLE,
|
||||
IHK_MC_MA_RESERVED,
|
||||
IHK_MC_MA_SPECIAL,
|
||||
};
|
||||
|
||||
enum aal_mc_ap_flag {
|
||||
AAL_MC_AP_FLAG,
|
||||
enum ihk_mc_ap_flag {
|
||||
IHK_MC_AP_FLAG,
|
||||
};
|
||||
|
||||
enum aal_mc_pt_prepare_flag {
|
||||
AAL_MC_PT_FIRST_LEVEL,
|
||||
AAL_MC_PT_LAST_LEVEL,
|
||||
enum ihk_mc_pt_prepare_flag {
|
||||
IHK_MC_PT_FIRST_LEVEL,
|
||||
IHK_MC_PT_LAST_LEVEL,
|
||||
};
|
||||
|
||||
struct aal_mc_memory_area {
|
||||
struct ihk_mc_memory_area {
|
||||
unsigned long start;
|
||||
unsigned long size;
|
||||
enum aal_mc_ma_type type;
|
||||
enum ihk_mc_ma_type type;
|
||||
};
|
||||
|
||||
struct aal_mc_memory_node {
|
||||
struct ihk_mc_memory_node {
|
||||
int node;
|
||||
int nareas;
|
||||
struct aal_mc_memory_area *areas;
|
||||
struct ihk_mc_memory_area *areas;
|
||||
};
|
||||
|
||||
unsigned long aal_mc_get_memory_address(enum aal_mc_gma_type, int);
|
||||
unsigned long ihk_mc_get_memory_address(enum ihk_mc_gma_type, int);
|
||||
|
||||
void aal_mc_reserve_arch_pages(unsigned long start, unsigned long end,
|
||||
void ihk_mc_reserve_arch_pages(unsigned long start, unsigned long end,
|
||||
void (*cb)(unsigned long, unsigned long, int));
|
||||
|
||||
struct aal_mc_pa_ops {
|
||||
void *(*alloc_page)(int, enum aal_mc_ap_flag);
|
||||
struct ihk_mc_pa_ops {
|
||||
void *(*alloc_page)(int, enum ihk_mc_ap_flag);
|
||||
void (*free_page)(void *, int);
|
||||
|
||||
void *(*alloc)(int, enum aal_mc_ap_flag);
|
||||
void *(*alloc)(int, enum ihk_mc_ap_flag);
|
||||
void (*free)(void *);
|
||||
};
|
||||
|
||||
void aal_mc_set_page_allocator(struct aal_mc_pa_ops *);
|
||||
void aal_mc_set_page_fault_handler(void (*h)(unsigned long, void *, unsigned long));
|
||||
void ihk_mc_set_page_allocator(struct ihk_mc_pa_ops *);
|
||||
void ihk_mc_set_page_fault_handler(void (*h)(unsigned long, void *, unsigned long));
|
||||
|
||||
unsigned long aal_mc_map_memory(void *os, unsigned long phys,
|
||||
unsigned long ihk_mc_map_memory(void *os, unsigned long phys,
|
||||
unsigned long size);
|
||||
void aal_mc_unmap_memory(void *os, unsigned long phys, unsigned long size);
|
||||
void ihk_mc_unmap_memory(void *os, unsigned long phys, unsigned long size);
|
||||
|
||||
void *aal_mc_map_virtual(unsigned long phys, int npages,
|
||||
enum aal_mc_pt_attribute attr);
|
||||
void aal_mc_unmap_virtual(void *va, int npages, int free_physical);
|
||||
void *ihk_mc_map_virtual(unsigned long phys, int npages,
|
||||
enum ihk_mc_pt_attribute attr);
|
||||
void ihk_mc_unmap_virtual(void *va, int npages, int free_physical);
|
||||
|
||||
extern void *sbox_base;
|
||||
extern unsigned int free_bitmap_micpa;
|
||||
void aal_mc_map_micpa(unsigned long host_pa, unsigned long* mic_pa);
|
||||
int aal_mc_free_micpa(unsigned long mic_pa);
|
||||
void aal_mc_clean_micpa(void);
|
||||
void ihk_mc_map_micpa(unsigned long host_pa, unsigned long* mic_pa);
|
||||
int ihk_mc_free_micpa(unsigned long mic_pa);
|
||||
void ihk_mc_clean_micpa(void);
|
||||
|
||||
void *aal_mc_alloc_pages(int npages, enum aal_mc_ap_flag flag);
|
||||
void aal_mc_free_pages(void *p, int npages);
|
||||
void *aal_mc_allocate(int size, enum aal_mc_ap_flag flag);
|
||||
void aal_mc_free(void *p);
|
||||
void *ihk_mc_alloc_pages(int npages, enum ihk_mc_ap_flag flag);
|
||||
void ihk_mc_free_pages(void *p, int npages);
|
||||
void *ihk_mc_allocate(int size, enum ihk_mc_ap_flag flag);
|
||||
void ihk_mc_free(void *p);
|
||||
|
||||
void *arch_alloc_page(enum aal_mc_ap_flag flag);
|
||||
void *arch_alloc_page(enum ihk_mc_ap_flag flag);
|
||||
void arch_free_page(void *ptr);
|
||||
|
||||
typedef void *page_table_t;
|
||||
|
||||
int aal_mc_pt_set_page(page_table_t pt, void *virt, unsigned long phys,
|
||||
enum aal_mc_pt_attribute attr);
|
||||
int aal_mc_pt_set_large_page(page_table_t pt, void *virt,
|
||||
unsigned long phys, enum aal_mc_pt_attribute attr);
|
||||
int aal_mc_pt_change_page(page_table_t pt, void *virt,
|
||||
enum aal_mc_pt_attribute);
|
||||
int aal_mc_pt_clear_page(page_table_t pt, void *virt);
|
||||
int aal_mc_pt_prepare_map(page_table_t pt, void *virt, unsigned long size,
|
||||
enum aal_mc_pt_prepare_flag);
|
||||
int ihk_mc_pt_set_page(page_table_t pt, void *virt, unsigned long phys,
|
||||
enum ihk_mc_pt_attribute attr);
|
||||
int ihk_mc_pt_set_large_page(page_table_t pt, void *virt,
|
||||
unsigned long phys, enum ihk_mc_pt_attribute attr);
|
||||
int ihk_mc_pt_change_page(page_table_t pt, void *virt,
|
||||
enum ihk_mc_pt_attribute);
|
||||
int ihk_mc_pt_clear_page(page_table_t pt, void *virt);
|
||||
int ihk_mc_pt_prepare_map(page_table_t pt, void *virt, unsigned long size,
|
||||
enum ihk_mc_pt_prepare_flag);
|
||||
|
||||
struct page_table *aal_mc_pt_create(void);
|
||||
void aal_mc_load_page_table(struct page_table *pt);
|
||||
int aal_mc_pt_virt_to_phys(struct page_table *pt,
|
||||
struct page_table *ihk_mc_pt_create(void);
|
||||
void ihk_mc_load_page_table(struct page_table *pt);
|
||||
int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
||||
void *virt, unsigned long *phys);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
#ifndef __HEADER_GENERIC_AAL_PAGE_ALLOC
|
||||
#define __HEADER_GENERIC_AAL_PAGE_ALLOC
|
||||
#ifndef __HEADER_GENERIC_IHK_PAGE_ALLOC
|
||||
#define __HEADER_GENERIC_IHK_PAGE_ALLOC
|
||||
|
||||
struct aal_page_allocator_desc {
|
||||
struct ihk_page_allocator_desc {
|
||||
unsigned long start;
|
||||
unsigned int last;
|
||||
unsigned int count;
|
||||
unsigned int flag;
|
||||
unsigned int shift;
|
||||
aal_spinlock_t lock;
|
||||
ihk_spinlock_t lock;
|
||||
unsigned int pad;
|
||||
|
||||
unsigned long map[0];
|
||||
};
|
||||
|
||||
unsigned long aal_pagealloc_count(void *__desc);
|
||||
void *__aal_pagealloc_init(unsigned long start, unsigned long size,
|
||||
unsigned long ihk_pagealloc_count(void *__desc);
|
||||
void *__ihk_pagealloc_init(unsigned long start, unsigned long size,
|
||||
unsigned long unit, void *initial,
|
||||
unsigned long *pdescsize);
|
||||
void *aal_pagealloc_init(unsigned long start, unsigned long size,
|
||||
void *ihk_pagealloc_init(unsigned long start, unsigned long size,
|
||||
unsigned long unit);
|
||||
void aal_pagealloc_destroy(void *__desc);
|
||||
unsigned long aal_pagealloc_alloc(void *__desc, int npages);
|
||||
void aal_pagealloc_reserve(void *desc, unsigned long start, unsigned long end);
|
||||
void aal_pagealloc_free(void *__desc, unsigned long address, int npages);
|
||||
unsigned long aal_pagealloc_count(void *__desc);
|
||||
void ihk_pagealloc_destroy(void *__desc);
|
||||
unsigned long ihk_pagealloc_alloc(void *__desc, int npages);
|
||||
void ihk_pagealloc_reserve(void *desc, unsigned long start, unsigned long end);
|
||||
void ihk_pagealloc_free(void *__desc, unsigned long address, int npages);
|
||||
unsigned long ihk_pagealloc_count(void *__desc);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef HEADER_GENERIC_AAL_PERFCTR_H
|
||||
#define HEADER_GENERIC_AAL_PERFCTR_H
|
||||
#ifndef HEADER_GENERIC_IHK_PERFCTR_H
|
||||
#define HEADER_GENERIC_IHK_PERFCTR_H
|
||||
|
||||
#define PERFCTR_USER_MODE 0x01
|
||||
#define PERFCTR_KERNEL_MODE 0x02
|
||||
|
||||
enum aal_perfctr_type {
|
||||
enum ihk_perfctr_type {
|
||||
APT_TYPE_DATA_PAGE_WALK,
|
||||
APT_TYPE_DATA_READ_MISS,
|
||||
APT_TYPE_DATA_WRITE_MISS,
|
||||
@@ -30,12 +30,12 @@ enum aal_perfctr_type {
|
||||
PERFCTR_MAX_TYPE,
|
||||
};
|
||||
|
||||
int aal_mc_perfctr_init(int counter, enum aal_perfctr_type type, int mode);
|
||||
int aal_mc_perfctr_start(unsigned long counter_mask);
|
||||
int aal_mc_perfctr_stop(unsigned long counter_mask);
|
||||
int aal_mc_perfctr_reset(int counter);
|
||||
int aal_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value);
|
||||
unsigned long aal_mc_perfctr_read(int counter);
|
||||
int ihk_mc_perfctr_init(int counter, enum ihk_perfctr_type type, int mode);
|
||||
int ihk_mc_perfctr_start(unsigned long counter_mask);
|
||||
int ihk_mc_perfctr_stop(unsigned long counter_mask);
|
||||
int ihk_mc_perfctr_reset(int counter);
|
||||
int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value);
|
||||
unsigned long ihk_mc_perfctr_read(int counter);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* AAL - Generic page allocator (manycore version)
|
||||
* IHK - Generic page allocator (manycore version)
|
||||
* (C) Copyright 2011 Taku Shimosawa.
|
||||
*/
|
||||
#include <types.h>
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <memory.h>
|
||||
#include <bitops.h>
|
||||
|
||||
void *allocate_pages(int npages, enum aal_mc_ap_flag flag);
|
||||
void *allocate_pages(int npages, enum ihk_mc_ap_flag flag);
|
||||
void free_pages(void *, int npages);
|
||||
|
||||
#define MAP_INDEX(n) ((n) >> 6)
|
||||
@@ -19,12 +19,12 @@ void free_pages(void *, int npages);
|
||||
#define ADDRESS(desc, index, bit) \
|
||||
((desc)->start + (((index) * 64 + (bit)) << ((desc)->shift)))
|
||||
|
||||
void *__aal_pagealloc_init(unsigned long start, unsigned long size,
|
||||
void *__ihk_pagealloc_init(unsigned long start, unsigned long size,
|
||||
unsigned long unit, void *initial,
|
||||
unsigned long *pdescsize)
|
||||
{
|
||||
/* Unit must be power of 2, and size and start must be unit-aligned */
|
||||
struct aal_page_allocator_desc *desc;
|
||||
struct ihk_page_allocator_desc *desc;
|
||||
int i, page_shift, descsize, mapsize, mapaligned;
|
||||
int flag = 0;
|
||||
|
||||
@@ -50,7 +50,7 @@ void *__aal_pagealloc_init(unsigned long start, unsigned long size,
|
||||
memset(desc, 0, descsize * PAGE_SIZE);
|
||||
|
||||
if (!desc) {
|
||||
kprintf("AAL: failed to allocate page-allocator-desc "\
|
||||
kprintf("IHK: failed to allocate page-allocator-desc "\
|
||||
"(%lx, %lx, %lx)\n", start, size, unit);
|
||||
return NULL;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ void *__aal_pagealloc_init(unsigned long start, unsigned long size,
|
||||
kprintf("Page allocator: %lx - %lx (%d)\n", start, start + size,
|
||||
page_shift);
|
||||
|
||||
aal_mc_spinlock_init(&desc->lock);
|
||||
ihk_mc_spinlock_init(&desc->lock);
|
||||
|
||||
/* Reserve align padding area */
|
||||
for (i = mapsize; i < mapaligned * 8; i++) {
|
||||
@@ -74,26 +74,26 @@ void *__aal_pagealloc_init(unsigned long start, unsigned long size,
|
||||
return desc;
|
||||
}
|
||||
|
||||
void *aal_pagealloc_init(unsigned long start, unsigned long size,
|
||||
void *ihk_pagealloc_init(unsigned long start, unsigned long size,
|
||||
unsigned long unit)
|
||||
{
|
||||
return __aal_pagealloc_init(start, size, unit, NULL, NULL);
|
||||
return __ihk_pagealloc_init(start, size, unit, NULL, NULL);
|
||||
}
|
||||
|
||||
void aal_pagealloc_destroy(void *__desc)
|
||||
void ihk_pagealloc_destroy(void *__desc)
|
||||
{
|
||||
struct aal_page_allocator_desc *desc = __desc;
|
||||
struct ihk_page_allocator_desc *desc = __desc;
|
||||
|
||||
free_pages(desc, desc->flag);
|
||||
}
|
||||
|
||||
static unsigned long __aal_pagealloc_large(struct aal_page_allocator_desc *desc,
|
||||
static unsigned long __ihk_pagealloc_large(struct ihk_page_allocator_desc *desc,
|
||||
int nblocks)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned int i, j, mi;
|
||||
|
||||
flags = aal_mc_spinlock_lock(&desc->lock);
|
||||
flags = ihk_mc_spinlock_lock(&desc->lock);
|
||||
for (i = 0, mi = desc->last; i < desc->count; i++, mi++) {
|
||||
if (mi >= desc->count) {
|
||||
mi = 0;
|
||||
@@ -110,18 +110,18 @@ static unsigned long __aal_pagealloc_large(struct aal_page_allocator_desc *desc,
|
||||
for (j = mi; j < mi + nblocks; j++) {
|
||||
desc->map[j] = (unsigned long)-1;
|
||||
}
|
||||
aal_mc_spinlock_unlock(&desc->lock, flags);
|
||||
ihk_mc_spinlock_unlock(&desc->lock, flags);
|
||||
return ADDRESS(desc, mi, 0);
|
||||
}
|
||||
}
|
||||
aal_mc_spinlock_unlock(&desc->lock, flags);
|
||||
ihk_mc_spinlock_unlock(&desc->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long aal_pagealloc_alloc(void *__desc, int npages)
|
||||
unsigned long ihk_pagealloc_alloc(void *__desc, int npages)
|
||||
{
|
||||
struct aal_page_allocator_desc *desc = __desc;
|
||||
struct ihk_page_allocator_desc *desc = __desc;
|
||||
unsigned int i, mi;
|
||||
int j;
|
||||
unsigned long v, mask, flags;
|
||||
@@ -129,12 +129,12 @@ unsigned long aal_pagealloc_alloc(void *__desc, int npages)
|
||||
/* If requested page is more than the half of the element,
|
||||
* we allocate the whole element (ulong) */
|
||||
if (npages >= 32) {
|
||||
return __aal_pagealloc_large(desc, (npages + 63) >> 6);
|
||||
return __ihk_pagealloc_large(desc, (npages + 63) >> 6);
|
||||
}
|
||||
|
||||
mask = (1UL << npages) - 1;
|
||||
|
||||
flags = aal_mc_spinlock_lock(&desc->lock);
|
||||
flags = ihk_mc_spinlock_lock(&desc->lock);
|
||||
for (i = 0, mi = desc->last; i < desc->count; i++, mi++) {
|
||||
if (mi >= desc->count) {
|
||||
mi = 0;
|
||||
@@ -148,21 +148,21 @@ unsigned long aal_pagealloc_alloc(void *__desc, int npages)
|
||||
if (!(v & (mask << j))) { /* free */
|
||||
desc->map[mi] |= (mask << j);
|
||||
|
||||
aal_mc_spinlock_unlock(&desc->lock, flags);
|
||||
ihk_mc_spinlock_unlock(&desc->lock, flags);
|
||||
return ADDRESS(desc, mi, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
aal_mc_spinlock_unlock(&desc->lock, flags);
|
||||
ihk_mc_spinlock_unlock(&desc->lock, flags);
|
||||
|
||||
/* We use null pointer for failure */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void aal_pagealloc_reserve(void *__desc, unsigned long start, unsigned long end)
|
||||
void ihk_pagealloc_reserve(void *__desc, unsigned long start, unsigned long end)
|
||||
{
|
||||
int i, n;
|
||||
struct aal_page_allocator_desc *desc = __desc;
|
||||
struct ihk_page_allocator_desc *desc = __desc;
|
||||
unsigned long flags;
|
||||
|
||||
n = (end + (1 << desc->shift) - 1 - desc->start) >> desc->shift;
|
||||
@@ -171,7 +171,7 @@ void aal_pagealloc_reserve(void *__desc, unsigned long start, unsigned long end)
|
||||
return;
|
||||
}
|
||||
|
||||
flags = aal_mc_spinlock_lock(&desc->lock);
|
||||
flags = ihk_mc_spinlock_lock(&desc->lock);
|
||||
for (; i < n; i++) {
|
||||
if (!(i & 63) && i + 63 < n) {
|
||||
desc->map[MAP_INDEX(i)] = (unsigned long)-1L;
|
||||
@@ -180,12 +180,12 @@ void aal_pagealloc_reserve(void *__desc, unsigned long start, unsigned long end)
|
||||
desc->map[MAP_INDEX(i)] |= (1UL << MAP_BIT(i));
|
||||
}
|
||||
}
|
||||
aal_mc_spinlock_unlock(&desc->lock, flags);
|
||||
ihk_mc_spinlock_unlock(&desc->lock, flags);
|
||||
}
|
||||
|
||||
void aal_pagealloc_free(void *__desc, unsigned long address, int npages)
|
||||
void ihk_pagealloc_free(void *__desc, unsigned long address, int npages)
|
||||
{
|
||||
struct aal_page_allocator_desc *desc = __desc;
|
||||
struct ihk_page_allocator_desc *desc = __desc;
|
||||
int i;
|
||||
unsigned mi;
|
||||
unsigned long flags;
|
||||
@@ -194,21 +194,21 @@ void aal_pagealloc_free(void *__desc, unsigned long address, int npages)
|
||||
if (npages >= 32) {
|
||||
npages = (npages + 63) & ~63;
|
||||
}
|
||||
flags = aal_mc_spinlock_lock(&desc->lock);
|
||||
flags = ihk_mc_spinlock_lock(&desc->lock);
|
||||
mi = (address - desc->start) >> desc->shift;
|
||||
for (i = 0; i < npages; i++, mi++) {
|
||||
desc->map[MAP_INDEX(mi)] &= ~(1UL << MAP_BIT(mi));
|
||||
}
|
||||
aal_mc_spinlock_unlock(&desc->lock, flags);
|
||||
ihk_mc_spinlock_unlock(&desc->lock, flags);
|
||||
}
|
||||
|
||||
unsigned long aal_pagealloc_count(void *__desc)
|
||||
unsigned long ihk_pagealloc_count(void *__desc)
|
||||
{
|
||||
struct aal_page_allocator_desc *desc = __desc;
|
||||
struct ihk_page_allocator_desc *desc = __desc;
|
||||
unsigned long i, j, n = 0;
|
||||
unsigned long flags;
|
||||
|
||||
flags = aal_mc_spinlock_lock(&desc->lock);
|
||||
flags = ihk_mc_spinlock_lock(&desc->lock);
|
||||
/* XXX: Very silly counting */
|
||||
for (i = 0; i < desc->count; i++) {
|
||||
for (j = 0; j < 64; j++) {
|
||||
@@ -217,21 +217,21 @@ unsigned long aal_pagealloc_count(void *__desc)
|
||||
}
|
||||
}
|
||||
}
|
||||
aal_mc_spinlock_unlock(&desc->lock, flags);
|
||||
ihk_mc_spinlock_unlock(&desc->lock, flags);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void __aal_pagealloc_zero_free_pages(void *__desc)
|
||||
void __ihk_pagealloc_zero_free_pages(void *__desc)
|
||||
{
|
||||
struct aal_page_allocator_desc *desc = __desc;
|
||||
struct ihk_page_allocator_desc *desc = __desc;
|
||||
unsigned int mi;
|
||||
int j;
|
||||
unsigned long v, flags;
|
||||
|
||||
kprintf("zeroing free memory... ");
|
||||
|
||||
flags = aal_mc_spinlock_lock(&desc->lock);
|
||||
flags = ihk_mc_spinlock_lock(&desc->lock);
|
||||
for (mi = 0; mi < desc->count; mi++) {
|
||||
|
||||
v = desc->map[mi];
|
||||
@@ -245,7 +245,7 @@ kprintf("zeroing free memory... ");
|
||||
}
|
||||
}
|
||||
}
|
||||
aal_mc_spinlock_unlock(&desc->lock, flags);
|
||||
ihk_mc_spinlock_unlock(&desc->lock, flags);
|
||||
|
||||
kprintf("\nzeroing done\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user