summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi.c
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2014-10-09 05:33:25 +0000
committeradrian <adrian@FreeBSD.org>2014-10-09 05:33:25 +0000
commitb0c040ce1809e237325c92cba14987d352f8ddbc (patch)
treeca93e6e4f9d2b5f8feafadeea80a3dd18ad3c56c /sys/dev/acpica/acpi.c
parent5dee4f91b50b08745e65149ff2d116be63b5bd50 (diff)
downloadFreeBSD-src-b0c040ce1809e237325c92cba14987d352f8ddbc.zip
FreeBSD-src-b0c040ce1809e237325c92cba14987d352f8ddbc.tar.gz
Add a bus method to fetch the VM domain for the given device/bus.
* Add a bus_if.m method - get_domain() - returning the VM domain or ENOENT if the device isn't in a VM domain; * Add bus methods to print out the domain of the device if appropriate; * Add code in srat.c to save the PXM -> VM domain mapping that's done and expose a function to translate VM domain -> PXM; * Add ACPI and ACPI PCI methods to check if the bus has a _PXM attribute and if so map it to the VM domain; * (.. yes, this works recursively.) * Have the pci bus glue print out the device VM domain if present. Note: this is just the plumbing to start enumerating information - it doesn't at all modify behaviour. Differential Revision: D906 Reviewed by: jhb Sponsored by: Norse Corp
Diffstat (limited to 'sys/dev/acpica/acpi.c')
-rw-r--r--sys/dev/acpica/acpi.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 37c79a5..abbc9b5 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -208,6 +208,7 @@ static device_method_t acpi_methods[] = {
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD(bus_hint_device_unit, acpi_hint_device_unit),
+ DEVMETHOD(bus_get_domain, acpi_get_domain),
/* ACPI bus */
DEVMETHOD(acpi_id_probe, acpi_device_id_probe),
@@ -794,6 +795,7 @@ acpi_print_child(device_t bus, device_t child)
retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%ld");
if (device_get_flags(child))
retval += printf(" flags %#x", device_get_flags(child));
+ retval += bus_print_child_domain(bus, child);
retval += bus_print_child_footer(bus, child);
return (retval);
@@ -1067,6 +1069,35 @@ acpi_hint_device_unit(device_t acdev, device_t child, const char *name,
}
/*
+ * Fech 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)
+{
+#if MAXMEMDOM > 1
+ ACPI_HANDLE h;
+ int d, pxm;
+
+ h = acpi_get_handle(child);
+ if ((h != NULL) &&
+ ACPI_SUCCESS(acpi_GetInteger(h, "_PXM", &pxm))) {
+ d = acpi_map_pxm_to_vm_domainid(pxm);
+ if (d < 0)
+ return (ENOENT);
+ *domain = d;
+ return (0);
+ }
+#endif
+ /* No _PXM node; go up a level */
+ return (bus_generic_get_domain(dev, child, domain));
+}
+
+/*
* Pre-allocate/manage all memory and IO resources. Since rman can't handle
* duplicates, we merge any in the sysresource attach routine.
*/
OpenPOWER on IntegriCloud