xref: /dflybsd-src/sys/dev/drm/include/linux/highmem.h (revision e3440f963d168fa3ccb25daabd2beebd240133f5)
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 
32*e3440f96SFrançois Tigeot static inline void *kmap(struct vm_page *pg)
339a90aa3dSFrançois Tigeot {
349a90aa3dSFrançois Tigeot 	return (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pg));
359a90aa3dSFrançois Tigeot }
369a90aa3dSFrançois Tigeot 
37*e3440f96SFrançois Tigeot static inline void kunmap(struct vm_page *pg)
38*e3440f96SFrançois Tigeot {
39*e3440f96SFrançois Tigeot 	/* Nothing to do on systems with a direct memory map */
40*e3440f96SFrançois Tigeot }
41*e3440f96SFrançois Tigeot 
42*e3440f96SFrançois Tigeot static inline void *kmap_atomic(struct vm_page *pg)
43*e3440f96SFrançois Tigeot {
44*e3440f96SFrançois Tigeot 	return (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pg));
45*e3440f96SFrançois Tigeot }
46*e3440f96SFrançois Tigeot 
47*e3440f96SFrançois Tigeot static inline void kunmap_atomic(void *vaddr)
489a90aa3dSFrançois Tigeot {
499a90aa3dSFrançois Tigeot 	/* Nothing to do on systems with a direct memory map */
509a90aa3dSFrançois Tigeot }
519a90aa3dSFrançois Tigeot 
529a90aa3dSFrançois Tigeot #endif	/* _LINUX_HIGHMEM_H_ */
53