aboutsummaryrefslogtreecommitdiff
path: root/include/apos/dmem.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-05-29 16:23:41 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-05-29 16:23:41 +0300
commitd7cb08134102b7a2410c48d2a1802193f9031e00 (patch)
tree711498836d6679ca2fc3b4ba9369b7fe53d7a3fa /include/apos/dmem.h
parente148f38dc937c34b222ba8df8612b3fa2b6bc349 (diff)
downloadkmi-d7cb08134102b7a2410c48d2a1802193f9031e00.tar.gz
kmi-d7cb08134102b7a2410c48d2a1802193f9031e00.zip
continue documentation efforts
Diffstat (limited to 'include/apos/dmem.h')
-rw-r--r--include/apos/dmem.h45
1 files changed, 39 insertions, 6 deletions
diff --git a/include/apos/dmem.h b/include/apos/dmem.h
index 38476ec..dace5f9 100644
--- a/include/apos/dmem.h
+++ b/include/apos/dmem.h
@@ -4,23 +4,56 @@
/**
* @file dmem.h
* Device memory handling, i.e. anything outside of RAM.
+ * @todo Make global parameters functions instead.
*/
#include <apos/types.h>
#include <apos/vmem.h>
+/** Provides access to the global parameter. \global */
extern pm_t __pre_base;
+
+/** Provides access to the global parameter. \global */
extern pm_t __pre_top;
+
+/** Provides access to the global parameter. \global */
extern pm_t __post_base;
+
+/** Provides access to the global parameter. \global */
extern pm_t __post_top;
+/**
+ * Initialize device memory.
+ * @note Currently I assume there is only one RAM region. This may not be the
+ * case with NUMA.
+ *
+ * @param ram_base Start of RAM.
+ * @param ram_top Top of RAM.
+ * @return stat_t \ref OK on success, nothing else at the moment.
+ */
stat_t init_devmem(pm_t ram_base, pm_t ram_top);
-vm_t alloc_devmem(struct tcb *t, pm_t dev_start, size_t bytes, vmflags_t flags);
-stat_t free_devmem(struct tcb *t, vm_t dev_start);
-stat_t dev_free_wrapper(struct vmem *b, pm_t *offset, vm_t vaddr,
- vmflags_t flags, enum mm_order t, void *);
-stat_t dev_alloc_wrapper(struct vmem *b, pm_t *offset, vm_t vaddr,
- vmflags_t flags, enum mm_order t, void *);
+/**
+ * Allocate direct device mapping.
+ * @note Returned address might not be the same as the requested address. The
+ * caller is responsible for passing the returned address to \ref free_devmem(), not
+ * the requested address.
+ *
+ * @param p Process to allocate device mapping to.
+ * @param dev_start Start of physical address where device is mapped to.
+ * @param bytes Minimum size of direct memory allocation.
+ * @param flags Access flags of allocation.
+ * @return Address to start of allocation if succesful, \c 0 otherwise.
+ */
+vm_t alloc_devmem(struct tcb *p, pm_t dev_start, size_t bytes, vmflags_t flags);
+
+/**
+ * Free direct device mapping.
+ *
+ * @param p Process to free mapping from.
+ * @param dev_start Start of allocation.
+ * @return \ref OK when succesful, \c ERR_NF when mapping not found.
+ */
+stat_t free_devmem(struct tcb *p, vm_t dev_start);
#endif /* APOS_DEV_H */