0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef __ASM_PPC_RHEAP_H__
0015 #define __ASM_PPC_RHEAP_H__
0016
0017 #include <linux/list.h>
0018
0019 typedef struct _rh_block {
0020 struct list_head list;
0021 unsigned long start;
0022 int size;
0023 const char *owner;
0024 } rh_block_t;
0025
0026 typedef struct _rh_info {
0027 unsigned int alignment;
0028 int max_blocks;
0029 int empty_slots;
0030 rh_block_t *block;
0031 struct list_head empty_list;
0032 struct list_head free_list;
0033 struct list_head taken_list;
0034 unsigned int flags;
0035 } rh_info_t;
0036
0037 #define RHIF_STATIC_INFO 0x1
0038 #define RHIF_STATIC_BLOCK 0x2
0039
0040 typedef struct _rh_stats {
0041 unsigned long start;
0042 int size;
0043 const char *owner;
0044 } rh_stats_t;
0045
0046 #define RHGS_FREE 0
0047 #define RHGS_TAKEN 1
0048
0049
0050 extern rh_info_t *rh_create(unsigned int alignment);
0051
0052
0053 extern void rh_destroy(rh_info_t * info);
0054
0055
0056 extern void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
0057 rh_block_t * block);
0058
0059
0060 extern int rh_attach_region(rh_info_t * info, unsigned long start, int size);
0061
0062
0063 extern unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size);
0064
0065
0066 extern unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment,
0067 const char *owner);
0068
0069
0070 extern unsigned long rh_alloc(rh_info_t * info, int size, const char *owner);
0071
0072
0073 extern unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size,
0074 const char *owner);
0075
0076
0077 extern int rh_free(rh_info_t * info, unsigned long start);
0078
0079
0080 extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
0081 rh_stats_t * stats);
0082
0083
0084 extern void rh_dump(rh_info_t * info);
0085
0086
0087 void rh_dump_blk(rh_info_t *info, rh_block_t *blk);
0088
0089
0090 extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner);
0091
0092 #endif