summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-04-22 17:51:19 +0000
committerjhb <jhb@FreeBSD.org>2016-04-22 17:51:19 +0000
commitda15c11c3103598c772b1bbb4daf72d65af13e0c (patch)
treea09764e2f6940c58d517ee2603898467d5f69d64 /sys/dev/acpica/acpi.c
parent7b42937a43db7453fba7437832b129f02273f6c5 (diff)
downloadFreeBSD-src-da15c11c3103598c772b1bbb4daf72d65af13e0c.zip
FreeBSD-src-da15c11c3103598c772b1bbb4daf72d65af13e0c.tar.gz
Optionally return the output capabilities list from _OSC.
Both of the callers were expecting the input cap_set to be modified. This fixes them to request cap_set to be updated with the returned buffer. Reviewed by: jkim Differential Revision: https://reviews.freebsd.org/D6040
Diffstat (limited to 'sys/dev/acpica/acpi.c')
-rw-r--r--sys/dev/acpica/acpi.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 285d9bb..84468e5 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -2482,10 +2482,12 @@ acpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOURCE *res)
ACPI_STATUS
acpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid, int revision, int count,
- uint32_t *caps)
+ uint32_t *caps_in, uint32_t *caps_out, bool query)
{
- ACPI_OBJECT arg[4];
+ ACPI_OBJECT arg[4], *ret;
ACPI_OBJECT_LIST arglist;
+ ACPI_BUFFER buf;
+ ACPI_STATUS status;
arglist.Pointer = arg;
arglist.Count = 4;
@@ -2497,9 +2499,25 @@ acpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid, int revision, int count,
arg[2].Type = ACPI_TYPE_INTEGER;
arg[2].Integer.Value = count;
arg[3].Type = ACPI_TYPE_BUFFER;
- arg[3].Buffer.Length = count * sizeof(*caps);
- arg[3].Buffer.Pointer = (uint8_t *)caps;
- return (AcpiEvaluateObject(handle, "_OSC", &arglist, NULL));
+ arg[3].Buffer.Length = count * sizeof(*caps_in);
+ arg[3].Buffer.Pointer = (uint8_t *)caps_in;
+ caps_in[0] = query ? 1 : 0;
+ buf.Pointer = NULL;
+ buf.Length = ACPI_ALLOCATE_BUFFER;
+ status = AcpiEvaluateObjectTyped(handle, "_OSC", &arglist, &buf,
+ ACPI_TYPE_BUFFER);
+ if (ACPI_FAILURE(status))
+ return (status);
+ if (caps_out != NULL) {
+ ret = buf.Pointer;
+ if (ret->Buffer.Length != count * sizeof(*caps_out)) {
+ AcpiOsFree(buf.Pointer);
+ return (AE_BUFFER_OVERFLOW);
+ }
+ bcopy(ret->Buffer.Pointer, caps_out, ret->Buffer.Length);
+ }
+ AcpiOsFree(buf.Pointer);
+ return (status);
}
/*
OpenPOWER on IntegriCloud