1541aa16dSFrançois Tigeot /* 2d6aa1cc5SFrançois Tigeot * Copyright (c) 2016-2018 François Tigeot <ftigeot@wolfpond.org> 3541aa16dSFrançois Tigeot * All rights reserved. 4541aa16dSFrançois Tigeot * 5541aa16dSFrançois Tigeot * Redistribution and use in source and binary forms, with or without 6541aa16dSFrançois Tigeot * modification, are permitted provided that the following conditions 7541aa16dSFrançois Tigeot * are met: 8541aa16dSFrançois Tigeot * 1. Redistributions of source code must retain the above copyright 9541aa16dSFrançois Tigeot * notice unmodified, this list of conditions, and the following 10541aa16dSFrançois Tigeot * disclaimer. 11541aa16dSFrançois Tigeot * 2. Redistributions in binary form must reproduce the above copyright 12541aa16dSFrançois Tigeot * notice, this list of conditions and the following disclaimer in the 13541aa16dSFrançois Tigeot * documentation and/or other materials provided with the distribution. 14541aa16dSFrançois Tigeot * 15541aa16dSFrançois Tigeot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16541aa16dSFrançois Tigeot * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17541aa16dSFrançois Tigeot * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18541aa16dSFrançois Tigeot * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19541aa16dSFrançois Tigeot * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20541aa16dSFrançois Tigeot * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21541aa16dSFrançois Tigeot * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22541aa16dSFrançois Tigeot * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23541aa16dSFrançois Tigeot * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24541aa16dSFrançois Tigeot * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25541aa16dSFrançois Tigeot */ 26541aa16dSFrançois Tigeot 27541aa16dSFrançois Tigeot #ifndef _ASM_MEMORY_MODEL_H_ 28541aa16dSFrançois Tigeot #define _ASM_MEMORY_MODEL_H_ 29541aa16dSFrançois Tigeot 30*f0bba3d1SFrançois Tigeot #include <vm/vm_object.h> 31*f0bba3d1SFrançois Tigeot 32*f0bba3d1SFrançois Tigeot static inline unsigned long 33*f0bba3d1SFrançois Tigeot page_to_pfn(struct page *page) 34*f0bba3d1SFrançois Tigeot { 35*f0bba3d1SFrançois Tigeot struct vm_page *p = (struct vm_page *)page; 36*f0bba3d1SFrançois Tigeot 37*f0bba3d1SFrançois Tigeot return OFF_TO_IDX(VM_PAGE_TO_PHYS(p)); 38*f0bba3d1SFrançois Tigeot } 39*f0bba3d1SFrançois Tigeot 40d6aa1cc5SFrançois Tigeot #define pfn_to_page(pfn) (PHYS_TO_VM_PAGE((pfn) << PAGE_SHIFT)) 41541aa16dSFrançois Tigeot 42541aa16dSFrançois Tigeot #endif /* _ASM_MEMORY_MODEL_H_ */ 43