My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mem_mng.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * Simple Memory manager for secure world
25  */
26 
27 #ifndef __MEM_MNG_H__
28 #define __MEM_MNG_H__
29 
30 #include <sw_types.h>
31 #ifdef ARM_ARCH_ARMV7
32 #define PAGE_SHIFT 12
33 #define PAGE_SIZE 4096
34 #else
35 #include <mmap.h>
36 #endif
37 
43 struct mem_info {
44  /* Virtual Address Start */
46  /* Physical Address Start */
48 
49  /* Bit Map Info */
50  struct {
51  /* Bit map start */
52  va_t start;
53  /* Total memory space held by this bitmap */
54  u32 space;
55  /* Free pages */
57 
58  /* last filled index. pages before this are completely filled */
60  } bitmap;
61 };
62 
63 extern struct mem_info sw_mem_info;
64 
70 void sw_meminfo_init(struct mem_info *, struct mem_info *);
71 
79 va_t sw_page_alloc(u32 size, struct mem_info *);
80 
89 int sw_page_free(va_t vir_addr, u32 size, struct mem_info *);
90 
91 
92 
93 #endif
u32 free_pages
Definition: mem_mng.h:56
struct mem_info sw_mem_info
Definition: mem_mng.c:37
int sw_page_free(va_t vir_addr, u32 size, struct mem_info *)
Frees the pages.
Definition: mem_mng.c:187
u32 space
Definition: mem_mng.h:54
This structure has information about the memory regions in the secure world.
Definition: mem_mng.h:43
void sw_meminfo_init(struct mem_info *, struct mem_info *)
Initializes the address space in secure world by allocating and mapping the required pages...
Definition: mem_mng.c:51
va_t sw_page_alloc(u32 size, struct mem_info *)
Allocates physical pages for the required size.
Definition: mem_mng.c:125
pa_t phy_addr_start
Definition: mem_mng.h:47
u32 last_filled_index
Definition: mem_mng.h:59
va_t start
Definition: mem_mng.h:52
va_t vir_addr_start
Definition: mem_mng.h:45
struct mem_info::@3 bitmap