mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
acpi, nfit: Add function to look up nvdimm device and provide SMBIOS handle
EDAC driver needs to look up attributes of NVDIMMs provided in SMBIOS. Provide a function that looks up an acpi_nfit_memory_map from a device handle (node/socket/mc/channel/dimm) and returns the SMBIOS handle. Also pass back the "flags" so we can see if the NVDIMM is OK. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Aristeu Rozanski <aris@redhat.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Erik Schmauss <erik.schmauss@intel.com> Cc: Jean Delvare <jdelvare@suse.com> Cc: Len Brown <lenb@kernel.org> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Cc: Robert Moore <robert.moore@intel.com> Cc: devel@acpica.org Cc: linux-acpi@vger.kernel.org Cc: linux-nvdimm@lists.01.org Link: http://lkml.kernel.org/r/20180312182430.10335-4-tony.luck@intel.com Signed-off-by: Borislav Petkov <bp@suse.de>
This commit is contained in:
parent
001f86137d
commit
23222f8f8d
@ -23,6 +23,7 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/nd.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <acpi/nfit.h>
|
||||
#include "nfit.h"
|
||||
|
||||
/*
|
||||
@ -690,6 +691,32 @@ static bool add_memdev(struct acpi_nfit_desc *acpi_desc,
|
||||
return true;
|
||||
}
|
||||
|
||||
int nfit_get_smbios_id(u32 device_handle, u16 *flags)
|
||||
{
|
||||
struct acpi_nfit_memory_map *memdev;
|
||||
struct acpi_nfit_desc *acpi_desc;
|
||||
struct nfit_mem *nfit_mem;
|
||||
|
||||
mutex_lock(&acpi_desc_lock);
|
||||
list_for_each_entry(acpi_desc, &acpi_descs, list) {
|
||||
mutex_lock(&acpi_desc->init_mutex);
|
||||
list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) {
|
||||
memdev = __to_nfit_memdev(nfit_mem);
|
||||
if (memdev->device_handle == device_handle) {
|
||||
mutex_unlock(&acpi_desc->init_mutex);
|
||||
mutex_unlock(&acpi_desc_lock);
|
||||
*flags = memdev->flags;
|
||||
return memdev->physical_id;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&acpi_desc->init_mutex);
|
||||
}
|
||||
mutex_unlock(&acpi_desc_lock);
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nfit_get_smbios_id);
|
||||
|
||||
/*
|
||||
* An implementation may provide a truncated control region if no block windows
|
||||
* are defined.
|
||||
|
18
include/acpi/nfit.h
Normal file
18
include/acpi/nfit.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*/
|
||||
|
||||
#ifndef __ACPI_NFIT_H
|
||||
#define __ACPI_NFIT_H
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI_NFIT)
|
||||
int nfit_get_smbios_id(u32 device_handle, u16 *flags);
|
||||
#else
|
||||
static inline int nfit_get_smbios_id(u32 device_handle, u16 *flags)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ACPI_NFIT_H */
|
Loading…
Reference in New Issue
Block a user