mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-06 02:24:14 +08:00
2025cf9e19
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms and conditions of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 263 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32 lines
716 B
C
32 lines
716 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2016, Intel Corporation.
|
|
*/
|
|
#include "test/nfit_test.h"
|
|
#include <linux/mm.h>
|
|
#include "../../../drivers/dax/dax-private.h"
|
|
|
|
phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff,
|
|
unsigned long size)
|
|
{
|
|
struct resource *res = &dev_dax->region->res;
|
|
phys_addr_t addr;
|
|
|
|
addr = pgoff * PAGE_SIZE + res->start;
|
|
if (addr >= res->start && addr <= res->end) {
|
|
if (addr + size - 1 <= res->end) {
|
|
if (get_nfit_res(addr)) {
|
|
struct page *page;
|
|
|
|
if (dev_dax->region->align > PAGE_SIZE)
|
|
return -1;
|
|
|
|
page = vmalloc_to_page((void *)addr);
|
|
return PFN_PHYS(page_to_pfn(page));
|
|
} else
|
|
return addr;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|