summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-18 15:06:22 -0400
committerIan Moffett <ian@osmora.org>2024-04-18 15:06:22 -0400
commit0e24592cb32f61bb59caad30ea9acc524974c6dd (patch)
treef229e71727d51d0a21bf9da0e7111c2376f745a7 /sys/include
parent691302ee1f22a5458c4dab3d5f85cc3de9332bb5 (diff)
kernel: vm: Add device pager
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/sys/device.h2
-rw-r--r--sys/include/vm/pager.h4
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/include/sys/device.h b/sys/include/sys/device.h
index 7b2f297..8695ab6 100644
--- a/sys/include/sys/device.h
+++ b/sys/include/sys/device.h
@@ -32,6 +32,7 @@
#include <sys/sio.h>
#include <sys/queue.h>
+#include <sys/types.h>
#include <vm/dynalloc.h>
#define DEVICE_ALLOC() dynalloc(sizeof(struct device))
@@ -41,6 +42,7 @@ struct device {
size_t blocksize;
int(*write)(struct device *dev, struct sio_txn *sio);
int(*read)(struct device *dev, struct sio_txn *sio);
+ paddr_t(*mmap)(struct device *dev, off_t off, vm_prot_t prot);
TAILQ_ENTRY(device) link;
};
diff --git a/sys/include/vm/pager.h b/sys/include/vm/pager.h
index 5f36bfc..e57afe1 100644
--- a/sys/include/vm/pager.h
+++ b/sys/include/vm/pager.h
@@ -38,10 +38,14 @@ struct vm_object;
struct vm_pagerops {
int(*get)(struct vm_object *obj, off_t off, size_t len, struct vm_page *pg);
int(*store)(struct vm_object *obj, off_t off, size_t len, struct vm_page *pg);
+ /* TODO: Remove this and add demand paging */
+ int(*get_paddr)(struct vm_object *obj, paddr_t *paddr, vm_prot_t prot);
};
extern struct vm_pagerops g_vnode_pagerops;
+extern struct vm_pagerops g_dev_pagerops;
int vm_pager_get(struct vm_object *obj, off_t off, size_t len, struct vm_page *pg);
+int vm_pager_paddr(struct vm_object *obj, paddr_t *paddr, vm_prot_t prot);
#endif /* !_VM_PAGER_H_ */