diff options
-rw-r--r-- | sys/dev/acpica/acpi.c | 41 | ||||
-rw-r--r-- | sys/dev/acpica/acpivar.h | 2 |
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_ */ |