xref: /dflybsd-src/sys/dev/drm/include/linux/highmem.h (revision b86cbe23ee85c4498c25b31ee07b0b55b22b21b3)
19a90aa3dSFrançois Tigeot /*
29a90aa3dSFrançois Tigeot  * Copyright (c) 2014 François Tigeot
39a90aa3dSFrançois Tigeot  * All rights reserved.
49a90aa3dSFrançois Tigeot  *
59a90aa3dSFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
69a90aa3dSFrançois Tigeot  * modification, are permitted provided that the following conditions
79a90aa3dSFrançois Tigeot  * are met:
89a90aa3dSFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
99a90aa3dSFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
109a90aa3dSFrançois Tigeot  *    disclaimer.
119a90aa3dSFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
129a90aa3dSFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
139a90aa3dSFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
149a90aa3dSFrançois Tigeot  *
159a90aa3dSFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
169a90aa3dSFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
179a90aa3dSFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
189a90aa3dSFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
199a90aa3dSFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
209a90aa3dSFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
219a90aa3dSFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
229a90aa3dSFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
239a90aa3dSFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
249a90aa3dSFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
259a90aa3dSFrançois Tigeot  */
269a90aa3dSFrançois Tigeot 
279a90aa3dSFrançois Tigeot #ifndef _LINUX_HIGHMEM_H_
289a90aa3dSFrançois Tigeot #define _LINUX_HIGHMEM_H_
299a90aa3dSFrançois Tigeot 
309a90aa3dSFrançois Tigeot #include <machine/vmparam.h>
319a90aa3dSFrançois Tigeot 
3201b43122SFrançois Tigeot #include <linux/uaccess.h>
3301b43122SFrançois Tigeot 
34*b86cbe23SFrançois Tigeot #include <asm/cacheflush.h>
35*b86cbe23SFrançois Tigeot 
36e3440f96SFrançois Tigeot static inline void *kmap(struct vm_page *pg)
379a90aa3dSFrançois Tigeot {
389a90aa3dSFrançois Tigeot 	return (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pg));
399a90aa3dSFrançois Tigeot }
409a90aa3dSFrançois Tigeot 
41e3440f96SFrançois Tigeot static inline void kunmap(struct vm_page *pg)
42e3440f96SFrançois Tigeot {
43e3440f96SFrançois Tigeot 	/* Nothing to do on systems with a direct memory map */
44e3440f96SFrançois Tigeot }
45e3440f96SFrançois Tigeot 
46e3440f96SFrançois Tigeot static inline void *kmap_atomic(struct vm_page *pg)
47e3440f96SFrançois Tigeot {
48e3440f96SFrançois Tigeot 	return (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pg));
49e3440f96SFrançois Tigeot }
50e3440f96SFrançois Tigeot 
51e3440f96SFrançois Tigeot static inline void kunmap_atomic(void *vaddr)
529a90aa3dSFrançois Tigeot {
539a90aa3dSFrançois Tigeot 	/* Nothing to do on systems with a direct memory map */
549a90aa3dSFrançois Tigeot }
559a90aa3dSFrançois Tigeot 
569a90aa3dSFrançois Tigeot #endif	/* _LINUX_HIGHMEM_H_ */
57