diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-06-01 22:34:31 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-06-01 22:34:31 +0300 |
| commit | b5e6a74635eba8e6c5fe0a614c6f578380fb1196 (patch) | |
| tree | 994be097e18720c0062014db255ad8c06538641a /include/apos/pmem.h | |
| parent | 6295648f04d1d5d7e8b99d3fdaa8d497406eadf9 (diff) | |
| download | kmi-b5e6a74635eba8e6c5fe0a614c6f578380fb1196.tar.gz kmi-b5e6a74635eba8e6c5fe0a614c6f578380fb1196.zip | |
continue documentation
Diffstat (limited to 'include/apos/pmem.h')
| -rw-r--r-- | include/apos/pmem.h | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/include/apos/pmem.h b/include/apos/pmem.h index 0b11555..03f4f87 100644 --- a/include/apos/pmem.h +++ b/include/apos/pmem.h @@ -10,14 +10,61 @@ #include <apos/types.h> #include <arch/pmem.h> -void update_pmap(pm_t offset); +/** + * Free physical page. + * + * @param order Order of page to free. + * @param paddr Physical address of page. + */ void free_page(enum mm_order order, pm_t paddr); + +/** + * Mark page used. + * + * @param order Order of page to mark. + * @param paddr Physical address of page. + */ void mark_used(enum mm_order order, pm_t paddr); + +/** + * Allocate physical page. + * Allows the user to specify a hint as to which address to start looking for. + * Useful for allocating many pages for one virtual allocation, for example, and + * allows us to skip already checked pages when allocating a second page. + * + * @param order Order of page to allocate. + * @param offset Hint as to which address to start looking from. + * @return pm_t Physical address of page when succesful, else \c NULL. + */ pm_t alloc_page(enum mm_order order, pm_t offset); +/** + * Populate physical RAM usage map. + * In theory we could easily implement NUMA nodes by just using different orders + * of usage maps, but for now we assume all RAM is contiguous. + * + * @param ram_base Base physical address of RAM. + * @param ram_size Size of phsyical RAM. + * @param cont Physical address where to place the map. + * @return Size of physical map. Check that is matches with \ref probe_pmap(). + */ pm_t populate_pmap(pm_t ram_base, size_t ram_size, pm_t cont); + +/** + * Probe size of RAM usage map. + * + * @param ram_base Base physical address of RAM. + * @param ram_size Size of physical RAM. + * @return Size of physical map. Check that it matches with \ref + * populate_pmap(). + */ pm_t probe_pmap(pm_t ram_base, size_t ram_size); +/** + * Initialize physical memory subsystem. + * + * @param fdt Global FDT pointer. + */ void init_pmem(void *fdt); #endif /* APOS_PMEM_H */ |
