diff options
author | jhb <jhb@FreeBSD.org> | 2016-05-03 01:17:40 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-05-03 01:17:40 +0000 |
commit | c71e075efbd7e1177bbe1ebf5bda0d7ae584a598 (patch) | |
tree | 821b2b69afc5308c273180646eab69cb09ab3979 /sys/dev/acpica/acpi.c | |
parent | 593ac218e030fd7d69960e8f7fd21fb983b66be9 (diff) | |
download | FreeBSD-src-c71e075efbd7e1177bbe1ebf5bda0d7ae584a598.zip FreeBSD-src-c71e075efbd7e1177bbe1ebf5bda0d7ae584a598.tar.gz |
Revert bus_get_cpus() for now.
I really thought I had run this through the tinderbox before committing,
but many places need <sys/types.h> -> <sys/param.h> for <sys/bus.h> now.
Diffstat (limited to 'sys/dev/acpica/acpi.c')
-rw-r--r-- | sys/dev/acpica/acpi.c | 88 |
1 files changed, 30 insertions, 58 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 6f185c9..84468e5 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -211,7 +211,6 @@ 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_cpus, acpi_get_cpus), DEVMETHOD(bus_get_domain, acpi_get_domain), /* ACPI bus */ @@ -1078,79 +1077,52 @@ acpi_hint_device_unit(device_t acdev, device_t child, const char *name, } /* - * Fetch the NUMA domain for a device by mapping the value returned by - * _PXM to a NUMA domain. If the device does not have a _PXM method, - * -2 is returned. If any other error occurs, -1 is returned. + * Fetch the VM domain for the given device 'dev'. + * + * Return 1 + domain if there's a domain, 0 if not found; + * -1 upon an error. */ -static int -acpi_parse_pxm(device_t dev) +int +acpi_parse_pxm(device_t dev, int *domain) { #ifdef DEVICE_NUMA - ACPI_HANDLE handle; - ACPI_STATUS status; - int pxm; - - handle = acpi_get_handle(dev); - if (handle == NULL) - return (-2); - status = acpi_GetInteger(handle, "_PXM", &pxm); - if (ACPI_SUCCESS(status)) - return (acpi_map_pxm_to_vm_domainid(pxm)); - if (status == AE_NOT_FOUND) - return (-2); + ACPI_HANDLE h; + int d, pxm; + + 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 (-1); + *domain = d; + return (1); + } #endif - return (-1); -} - -int -acpi_get_cpus(device_t dev, device_t child, enum cpu_sets op, size_t setsize, - cpuset_t *cpuset) -{ - int d, error; - - d = acpi_parse_pxm(child); - if (d < 0) - return (bus_generic_get_cpus(dev, child, op, setsize, cpuset)); - switch (op) { - case LOCAL_CPUS: - if (setsize != sizeof(cpuset_t)) - return (EINVAL); - *cpuset = cpuset_domain[d]; - return (0); - case INTR_CPUS: - error = bus_generic_get_cpus(dev, child, op, setsize, cpuset); - if (error != 0) - return (error); - if (setsize != sizeof(cpuset_t)) - return (EINVAL); - CPU_AND(cpuset, &cpuset_domain[d]); - return (0); - default: - return (bus_generic_get_cpus(dev, child, op, setsize, cpuset)); - } + return (0); } /* - * Fetch the NUMA domain for the given device 'dev'. + * Fetch the NUMA domain for the given device. * * If a device has a _PXM method, map that to a NUMA domain. - * Otherwise, pass the request up to the parent. - * If there's no matching domain or the domain cannot be - * determined, return ENOENT. + * + * 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 d; + int ret; - d = acpi_parse_pxm(child); - if (d >= 0) { - *domain = d; - return (0); - } - if (d == -1) + 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)); |