Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * include/asm-ppc/rheap.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Header file for the implementation of a remote heap.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Author: Pantelis Antoniou <panto@intracom.gr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * 2004 (c) INTRACOM S.A. Greece. This file is licensed under
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * the terms of the GNU General Public License version 2. This program
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  * is licensed "as is" without any warranty of any kind, whether express
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  * or implied.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #ifndef __ASM_PPC_RHEAP_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define __ASM_PPC_RHEAP_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) typedef struct _rh_block {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	unsigned long start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	const char *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) } rh_block_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) typedef struct _rh_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	unsigned int alignment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	int max_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	int empty_slots;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	rh_block_t *block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	struct list_head empty_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	struct list_head free_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	struct list_head taken_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	unsigned int flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) } rh_info_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define RHIF_STATIC_INFO	0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define RHIF_STATIC_BLOCK	0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) typedef struct _rh_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	unsigned long start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	const char *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) } rh_stats_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define RHGS_FREE	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define RHGS_TAKEN	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* Create a remote heap dynamically */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) extern rh_info_t *rh_create(unsigned int alignment);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* Destroy a remote heap, created by rh_create() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) extern void rh_destroy(rh_info_t * info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* Initialize in place a remote info block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) extern void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		    rh_block_t * block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) /* Attach a free region to manage */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern int rh_attach_region(rh_info_t * info, unsigned long start, int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /* Detach a free region */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) extern unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) /* Allocate the given size from the remote heap (with alignment) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) extern unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 		const char *owner);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /* Allocate the given size from the remote heap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) extern unsigned long rh_alloc(rh_info_t * info, int size, const char *owner);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /* Allocate the given size from the given address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) extern unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 			    const char *owner);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* Free the allocated area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) extern int rh_free(rh_info_t * info, unsigned long start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* Get stats for debugging purposes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 			rh_stats_t * stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* Simple dump of remote heap info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) extern void rh_dump(rh_info_t * info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* Simple dump of remote info block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) void rh_dump_blk(rh_info_t *info, rh_block_t *blk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) /* Set owner of taken block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #endif				/* __ASM_PPC_RHEAP_H__ */