Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jun 2019 20:12:04 +0000 (UTC)
From:      D Scott Phillips <scottph@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348757 - head/sys/dev/nvdimm
Message-ID:  <201906062012.x56KC4oh097339@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scottph
Date: Thu Jun  6 20:12:04 2019
New Revision: 348757
URL: https://svnweb.freebsd.org/changeset/base/348757

Log:
  nvdimm: Provide nvdimm location information
  
  Provide the acpi handle path as the location string for the nvdimm
  children of the nvdimm_root device.
  
  Reviewed by:	kib
  Approved by:	jhb (mentor)
  MFC after:	1 week
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D20528

Modified:
  head/sys/dev/nvdimm/nvdimm.c

Modified: head/sys/dev/nvdimm/nvdimm.c
==============================================================================
--- head/sys/dev/nvdimm/nvdimm.c	Thu Jun  6 20:03:55 2019	(r348756)
+++ head/sys/dev/nvdimm/nvdimm.c	Thu Jun  6 20:12:04 2019	(r348757)
@@ -560,6 +560,24 @@ nvdimm_root_write_ivar(device_t dev, device_t child, i
 	return (0);
 }
 
+static int
+nvdimm_root_child_location_str(device_t dev, device_t child, char *buf,
+    size_t buflen)
+{
+	ACPI_HANDLE handle;
+	int res;
+
+	handle = nvdimm_root_get_acpi_handle(child);
+	if (handle != NULL)
+		res = snprintf(buf, buflen, "handle=%s", acpi_name(handle));
+	else
+		res = snprintf(buf, buflen, "unknown");
+
+	if (res >= buflen)
+		return (EOVERFLOW);
+	return (0);
+}
+
 static device_method_t nvdimm_methods[] = {
 	DEVMETHOD(device_probe, nvdimm_probe),
 	DEVMETHOD(device_attach, nvdimm_attach),
@@ -582,6 +600,7 @@ static device_method_t nvdimm_root_methods[] = {
 	DEVMETHOD(bus_add_child, bus_generic_add_child),
 	DEVMETHOD(bus_read_ivar, nvdimm_root_read_ivar),
 	DEVMETHOD(bus_write_ivar, nvdimm_root_write_ivar),
+	DEVMETHOD(bus_child_location_str, nvdimm_root_child_location_str),
 	DEVMETHOD_END
 };
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906062012.x56KC4oh097339>