From owner-svn-src-all@freebsd.org Fri May 13 12:41:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 868E1B39ECA; Fri, 13 May 2016 12:41:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48E261EE1; Fri, 13 May 2016 12:41:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4DCfLvs042646; Fri, 13 May 2016 12:41:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4DCfLF9042644; Fri, 13 May 2016 12:41:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605131241.u4DCfLF9042644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 13 May 2016 12:41:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299673 - in head/sys/compat/linuxkpi/common/include: asm linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2016 12:41:22 -0000 Author: hselasky Date: Fri May 13 12:41:21 2016 New Revision: 299673 URL: https://svnweb.freebsd.org/changeset/base/299673 Log: Add more PAGE related defines to the LinuxKPI. Move the definition of "pgprot_t" to "linux/page.h" similar to what Linux does. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/asm/pgtable.h head/sys/compat/linuxkpi/common/include/linux/page.h Modified: head/sys/compat/linuxkpi/common/include/asm/pgtable.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/asm/pgtable.h Fri May 13 12:24:39 2016 (r299672) +++ head/sys/compat/linuxkpi/common/include/asm/pgtable.h Fri May 13 12:41:21 2016 (r299673) @@ -31,6 +31,6 @@ #ifndef _ASM_PGTABLE_H_ #define _ASM_PGTABLE_H_ -typedef int pgprot_t; +#include #endif /* _ASM_PGTABLE_H_ */ Modified: head/sys/compat/linuxkpi/common/include/linux/page.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/page.h Fri May 13 12:24:39 2016 (r299672) +++ head/sys/compat/linuxkpi/common/include/linux/page.h Fri May 13 12:41:21 2016 (r299673) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,16 +38,33 @@ #include #include #include +#include + +typedef unsigned long pgprot_t; #define page vm_page -#define virt_to_page(x) PHYS_TO_VM_PAGE(vtophys((x))) +#define virt_to_page(x) PHYS_TO_VM_PAGE(vtophys((x))) +#define page_to_pfn(pp) (VM_PAGE_TO_PHYS((pp)) >> PAGE_SHIFT) +#define pfn_to_page(pfn) (PHYS_TO_VM_PAGE((pfn) << PAGE_SHIFT)) +#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) #define clear_page(page) memset((page), 0, PAGE_SIZE) -#define pgprot_noncached(prot) VM_MEMATTR_UNCACHEABLE -#define pgprot_writecombine(prot) VM_MEMATTR_WRITE_COMBINING +#define pgprot_noncached(prot) ((pgprot_t)VM_MEMATTR_UNCACHEABLE) +#define pgprot_writecombine(prot) ((pgprot_t)VM_MEMATTR_WRITE_COMBINING) #undef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE-1)) +/* + * Modifying PAGE_MASK in the above way breaks trunc_page, round_page, + * and btoc macros. Therefore, redefine them in a way that makes sense + * so the LinuxKPI consumers don't get totally broken behavior. + */ +#undef btoc +#define btoc(x) (((vm_offset_t)(x) + PAGE_SIZE - 1) >> PAGE_SHIFT) +#undef round_page +#define round_page(x) ((((uintptr_t)(x)) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) +#undef trunc_page +#define trunc_page(x) ((uintptr_t)(x) & ~(PAGE_SIZE - 1)) #endif /* _LINUX_PAGE_H_ */