18b1a6a38SFrançois Tigeot /*
2e2a4a6b1SFrançois Tigeot * Copyright (c) 2015-2020 François Tigeot <ftigeot@wolfpond.org>
38b1a6a38SFrançois Tigeot * All rights reserved.
48b1a6a38SFrançois Tigeot *
58b1a6a38SFrançois Tigeot * Redistribution and use in source and binary forms, with or without
68b1a6a38SFrançois Tigeot * modification, are permitted provided that the following conditions
78b1a6a38SFrançois Tigeot * are met:
88b1a6a38SFrançois Tigeot * 1. Redistributions of source code must retain the above copyright
98b1a6a38SFrançois Tigeot * notice unmodified, this list of conditions, and the following
108b1a6a38SFrançois Tigeot * disclaimer.
118b1a6a38SFrançois Tigeot * 2. Redistributions in binary form must reproduce the above copyright
128b1a6a38SFrançois Tigeot * notice, this list of conditions and the following disclaimer in the
138b1a6a38SFrançois Tigeot * documentation and/or other materials provided with the distribution.
148b1a6a38SFrançois Tigeot *
158b1a6a38SFrançois Tigeot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
168b1a6a38SFrançois Tigeot * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
178b1a6a38SFrançois Tigeot * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
188b1a6a38SFrançois Tigeot * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
198b1a6a38SFrançois Tigeot * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
208b1a6a38SFrançois Tigeot * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
218b1a6a38SFrançois Tigeot * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
228b1a6a38SFrançois Tigeot * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
238b1a6a38SFrançois Tigeot * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
248b1a6a38SFrançois Tigeot * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
258b1a6a38SFrançois Tigeot */
268b1a6a38SFrançois Tigeot
278b1a6a38SFrançois Tigeot #ifndef _ASM_PAGE_H_
288b1a6a38SFrançois Tigeot #define _ASM_PAGE_H_
298b1a6a38SFrançois Tigeot
30f0bba3d1SFrançois Tigeot struct page;
31f0bba3d1SFrançois Tigeot
3209f141c4SFrançois Tigeot #include <vm/vm_page.h>
3309f141c4SFrançois Tigeot
34f0bba3d1SFrançois Tigeot static inline vm_paddr_t
page_to_phys(struct page * page)35f0bba3d1SFrançois Tigeot page_to_phys(struct page *page)
36f0bba3d1SFrançois Tigeot {
37f0bba3d1SFrançois Tigeot struct vm_page *p = (struct vm_page *)page;
38f0bba3d1SFrançois Tigeot
39f0bba3d1SFrançois Tigeot return VM_PAGE_TO_PHYS(p);
40f0bba3d1SFrançois Tigeot }
418b1a6a38SFrançois Tigeot
42d653c727SFrançois Tigeot #define LINUX_PAGE_MASK (~PAGE_MASK)
43d653c727SFrançois Tigeot
44*2cecdd68SFrançois Tigeot static inline struct page *
virt_to_page(void * kaddr)45*2cecdd68SFrançois Tigeot virt_to_page(void *kaddr)
46*2cecdd68SFrançois Tigeot {
47*2cecdd68SFrançois Tigeot return (struct page *)PHYS_TO_VM_PAGE(vtophys(kaddr));
48*2cecdd68SFrançois Tigeot }
49*2cecdd68SFrançois Tigeot
50541aa16dSFrançois Tigeot #include <asm/memory_model.h>
51541aa16dSFrançois Tigeot
52b3816793SFrançois Tigeot typedef unsigned long pgprot_t;
53b3816793SFrançois Tigeot
54e2a4a6b1SFrançois Tigeot #define virt_to_page(kaddr) (struct page *)PHYS_TO_VM_PAGE(vtophys(kaddr))
55e2a4a6b1SFrançois Tigeot
568b1a6a38SFrançois Tigeot #endif /* _ASM_PAGE_H_ */
57