diff options
author | jhb <jhb@FreeBSD.org> | 2009-08-28 14:06:55 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-08-28 14:06:55 +0000 |
commit | 7b069e86c6dbd397d4d622acf8c924f2ade8127d (patch) | |
tree | 90a42d70408be865b0d3f244445d7106ff89a054 /sys/sys/conf.h | |
parent | b546d1fee4837a126b1e940e542b8d9ff2132bc6 (diff) | |
download | FreeBSD-src-7b069e86c6dbd397d4d622acf8c924f2ade8127d.zip FreeBSD-src-7b069e86c6dbd397d4d622acf8c924f2ade8127d.tar.gz |
Extend the device pager to support different memory attributes on different
pages in an object.
- Add a new variant of d_mmap() currently called d_mmap2() which accepts
an additional in/out parameter that is the memory attribute to use for
the requested page.
- A driver either uses d_mmap() or d_mmap2() for all requests but not both.
The current implementation uses a flag in the cdevsw (D_MMAP2) to indicate
that the driver provides a d_mmap2() handler instead of d_mmap(). This
is done to make the change ABI compatible with existing drivers and
MFC'able to 7 and 8.
Submitted by: alc
MFC after: 1 month
Diffstat (limited to 'sys/sys/conf.h')
-rw-r--r-- | sys/sys/conf.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/sys/conf.h b/sys/sys/conf.h index a41028b..3df4284 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -137,6 +137,8 @@ typedef int d_poll_t(struct cdev *dev, int events, struct thread *td); typedef int d_kqfilter_t(struct cdev *dev, struct knote *kn); typedef int d_mmap_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot); +typedef int d_mmap2_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr); typedef int d_mmap_single_t(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t size, struct vm_object **object, int nprot); typedef void d_purge_t(struct cdev *dev); @@ -170,6 +172,7 @@ typedef int dumper_t( #define D_PSEUDO 0x00200000 /* make_dev() can return NULL */ #define D_NEEDGIANT 0x00400000 /* driver want Giant */ #define D_NEEDMINOR 0x00800000 /* driver uses clone_create() */ +#define D_MMAP2 0x01000000 /* driver uses d_mmap2() */ /* * Version numbers. @@ -198,7 +201,10 @@ struct cdevsw { d_write_t *d_write; d_ioctl_t *d_ioctl; d_poll_t *d_poll; - d_mmap_t *d_mmap; + union { + d_mmap_t *old; + d_mmap2_t *new; + } __d_mmap; d_strategy_t *d_strategy; dumper_t *d_dump; d_kqfilter_t *d_kqfilter; @@ -218,6 +224,8 @@ struct cdevsw { SLIST_ENTRY(cdevsw) postfree_list; } __d_giant; }; +#define d_mmap __d_mmap.old +#define d_mmap2 __d_mmap.new #define d_gianttrick __d_giant.gianttrick #define d_postfree_list __d_giant.postfree_list |