aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/nfit/core.c27
-rw-r--r--include/acpi/nfit.h18
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index bbe48ad20886..4d6eeb1793e6 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -23,6 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/nd.h> 24#include <linux/nd.h>
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <acpi/nfit.h>
26#include "nfit.h" 27#include "nfit.h"
27 28
28/* 29/*
@@ -690,6 +691,32 @@ static bool add_memdev(struct acpi_nfit_desc *acpi_desc,
690 return true; 691 return true;
691} 692}
692 693
694int nfit_get_smbios_id(u32 device_handle, u16 *flags)
695{
696 struct acpi_nfit_memory_map *memdev;
697 struct acpi_nfit_desc *acpi_desc;
698 struct nfit_mem *nfit_mem;
699
700 mutex_lock(&acpi_desc_lock);
701 list_for_each_entry(acpi_desc, &acpi_descs, list) {
702 mutex_lock(&acpi_desc->init_mutex);
703 list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) {
704 memdev = __to_nfit_memdev(nfit_mem);
705 if (memdev->device_handle == device_handle) {
706 mutex_unlock(&acpi_desc->init_mutex);
707 mutex_unlock(&acpi_desc_lock);
708 *flags = memdev->flags;
709 return memdev->physical_id;
710 }
711 }
712 mutex_unlock(&acpi_desc->init_mutex);
713 }
714 mutex_unlock(&acpi_desc_lock);
715
716 return -ENODEV;
717}
718EXPORT_SYMBOL_GPL(nfit_get_smbios_id);
719
693/* 720/*
694 * An implementation may provide a truncated control region if no block windows 721 * An implementation may provide a truncated control region if no block windows
695 * are defined. 722 * are defined.
diff --git a/include/acpi/nfit.h b/include/acpi/nfit.h
new file mode 100644
index 000000000000..86ed07c1200d
--- /dev/null
+++ b/include/acpi/nfit.h
@@ -0,0 +1,18 @@
1/*
2 * SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2018 Intel Corporation
4 */
5
6#ifndef __ACPI_NFIT_H
7#define __ACPI_NFIT_H
8
9#if IS_ENABLED(CONFIG_ACPI_NFIT)
10int nfit_get_smbios_id(u32 device_handle, u16 *flags);
11#else
12static inline int nfit_get_smbios_id(u32 device_handle, u16 *flags)
13{
14 return -EOPNOTSUPP;
15}
16#endif
17
18#endif /* __ACPI_NFIT_H */