summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2015-04-19 17:15:55 +0000
committeradrian <adrian@FreeBSD.org>2015-04-19 17:15:55 +0000
commita189b7bcb9c05b4bbb8dccdd56be333b64af829a (patch)
tree7bc619a4c252229f2646ef2e248a11eeab2ef703 /sys/dev
parentfcf33fcbb316167fae9449270a574fa383b825f2 (diff)
downloadFreeBSD-src-a189b7bcb9c05b4bbb8dccdd56be333b64af829a.zip
FreeBSD-src-a189b7bcb9c05b4bbb8dccdd56be333b64af829a.tar.gz
Refactor out the _PXM -> VM domain lookup done in ACPI, in preparation for
its use in upcoming code. This is inspired by something in jhb's NUMA IRQ allocation patchset. However, the tricky bit here is that the PXM lookup for a node may fail, requiring a lookup on the parent node. So if it doesn't exist, don't fail - just go up to the parent. Only error out of the lookup is the ACPI lookup returns an error. Sponsored by: Norse Corp, Inc.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi.c41
-rw-r--r--sys/dev/acpica/acpivar.h2
2 files changed, 33 insertions, 10 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index a597b6d..47bc791 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1071,30 +1071,53 @@ acpi_hint_device_unit(device_t acdev, device_t child, const char *name,
}
/*
- * Fetch the NUMA domain for the given device.
- *
- * If a device has a _PXM method, map that to a NUMA domain.
+ * Fetch the VM domain for the given device 'dev'.
*
- * If none is found, then it'll call the parent method.
- * If there's no domain, return ENOENT.
+ * Return 1 + domain if there's a domain, 0 if not found;
+ * -1 upon an error.
*/
int
-acpi_get_domain(device_t dev, device_t child, int *domain)
+acpi_parse_pxm(device_t dev, int *domain)
{
#if MAXMEMDOM > 1
ACPI_HANDLE h;
int d, pxm;
- h = acpi_get_handle(child);
+ h = acpi_get_handle(dev);
if ((h != NULL) &&
ACPI_SUCCESS(acpi_GetInteger(h, "_PXM", &pxm))) {
d = acpi_map_pxm_to_vm_domainid(pxm);
if (d < 0)
- return (ENOENT);
+ return (-1);
*domain = d;
- return (0);
+ return (1);
}
#endif
+
+ return (0);
+}
+
+/*
+ * Fetch the NUMA domain for the given device.
+ *
+ * If a device has a _PXM method, map that to a NUMA domain.
+ *
+ * If none is found, then it'll call the parent method.
+ * If there's no domain, return ENOENT.
+ */
+int
+acpi_get_domain(device_t dev, device_t child, int *domain)
+{
+ int ret;
+
+ ret = acpi_parse_pxm(child, domain);
+ /* Error */
+ if (ret == -1)
+ return (ENOENT);
+ /* Found */
+ if (ret == 1)
+ return (0);
+
/* No _PXM node; go up a level */
return (bus_generic_get_domain(dev, child, domain));
}
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 81b8a61..2e2b96d 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -500,8 +500,8 @@ SYSCTL_DECL(_debug_acpi);
#if MAXMEMDOM > 1
extern int acpi_map_pxm_to_vm_domainid(int pxm);
#endif
-
extern int acpi_get_domain(device_t dev, device_t child, int *domain);
+extern int acpi_parse_pxm(device_t dev, int *domain);
#endif /* _KERNEL */
#endif /* !_ACPIVAR_H_ */
OpenPOWER on IntegriCloud