1328653Shselasky/*- 2328653Shselasky * Copyright (c) 2017 Mellanox Technologies, Ltd. 3328653Shselasky * All rights reserved. 4328653Shselasky * 5328653Shselasky * Redistribution and use in source and binary forms, with or without 6328653Shselasky * modification, are permitted provided that the following conditions 7328653Shselasky * are met: 8328653Shselasky * 1. Redistributions of source code must retain the above copyright 9328653Shselasky * notice unmodified, this list of conditions, and the following 10328653Shselasky * disclaimer. 11328653Shselasky * 2. Redistributions in binary form must reproduce the above copyright 12328653Shselasky * notice, this list of conditions and the following disclaimer in the 13328653Shselasky * documentation and/or other materials provided with the distribution. 14328653Shselasky * 15328653Shselasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16328653Shselasky * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17328653Shselasky * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18328653Shselasky * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19328653Shselasky * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20328653Shselasky * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21328653Shselasky * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22328653Shselasky * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23328653Shselasky * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24328653Shselasky * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25328653Shselasky * 26328653Shselasky * $FreeBSD: stable/11/sys/compat/linuxkpi/common/include/linux/pfn.h 328653 2018-02-01 13:01:44Z hselasky $ 27328653Shselasky */ 28328653Shselasky 29328653Shselasky#ifndef _LINUX_PFN_H_ 30328653Shselasky#define _LINUX_PFN_H_ 31328653Shselasky 32328653Shselasky#include <linux/types.h> 33328653Shselasky 34328653Shselaskytypedef struct { 35328653Shselasky u64 val; 36328653Shselasky} pfn_t; 37328653Shselasky 38328653Shselasky#define PFN_ALIGN(x) (((unsigned long)(x) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) 39328653Shselasky#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) 40328653Shselasky#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) 41328653Shselasky#define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) 42328653Shselasky#define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT)) 43328653Shselasky 44328653Shselasky#endif /* _LINUX_PFN_H_ */ 45