diff options
author | jhb <jhb@FreeBSD.org> | 2016-04-20 20:55:58 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-04-20 20:55:58 +0000 |
commit | 11a5d8cc2127f8b70265561192e9e9691bf2f6ca (patch) | |
tree | 1935298b1cf4577c1f63960b13d9e14294411ba8 | |
parent | 499f728f9200eaa479527b7af379aabb3d5bf86d (diff) | |
download | FreeBSD-src-11a5d8cc2127f8b70265561192e9e9691bf2f6ca.zip FreeBSD-src-11a5d8cc2127f8b70265561192e9e9691bf2f6ca.tar.gz |
Add a wrapper for evaluating _OSC methods.
This wrapper does not translate errors in the first word to ACPI
error status returns. Use this wrapper in the acpi_cpu(4) driver in
place of the existing _OSC code. While here, fix a bug where the wrong
count of words was passed when invoking _OSC.
Reviewed by: jkim
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6022
-rw-r--r-- | sys/dev/acpica/acpi.c | 23 | ||||
-rw-r--r-- | sys/dev/acpica/acpi_cpu.c | 18 | ||||
-rw-r--r-- | sys/dev/acpica/acpivar.h | 2 |
3 files changed, 28 insertions, 15 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 32a07dd..8539f2f 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -2480,6 +2480,29 @@ acpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOURCE *res) return (AE_OK); } +ACPI_STATUS +acpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid, int revision, int count, + uint32_t *caps, bool query) +{ + ACPI_OBJECT arg[4]; + ACPI_OBJECT_LIST arglist; + + arglist.Pointer = arg; + arglist.Count = 4; + arg[0].Type = ACPI_TYPE_BUFFER; + arg[0].Buffer.Length = ACPI_UUID_LENGTH; + arg[0].Buffer.Pointer = uuid; + arg[1].Type = ACPI_TYPE_INTEGER; + arg[1].Integer.Value = revision; + arg[2].Type = ACPI_TYPE_INTEGER; + arg[2].Integer.Value = count; + arg[3].Type = ACPI_TYPE_BUFFER; + arg[3].Buffer.Length = count * sizeof(uint32_t); + arg[3].Buffer.Pointer = (uint8_t *)caps; + caps[0] = query ? 1 : 0; + return (AcpiEvaluateObject(handle, "_OSC", &arglist, NULL)); +} + /* * Set interrupt model. */ diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index e3269db..fda40e2 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -296,7 +296,7 @@ static int acpi_cpu_attach(device_t dev) { ACPI_BUFFER buf; - ACPI_OBJECT arg[4], *obj; + ACPI_OBJECT arg[1], *obj; ACPI_OBJECT_LIST arglist; struct pcpu *pcpu_data; struct acpi_cpu_softc *sc; @@ -391,21 +391,9 @@ acpi_cpu_attach(device_t dev) * Intel Processor Vendor-Specific ACPI Interface Specification. */ if (sc->cpu_features) { - arglist.Pointer = arg; - arglist.Count = 4; - arg[0].Type = ACPI_TYPE_BUFFER; - arg[0].Buffer.Length = sizeof(cpu_oscuuid); - arg[0].Buffer.Pointer = cpu_oscuuid; /* UUID */ - arg[1].Type = ACPI_TYPE_INTEGER; - arg[1].Integer.Value = 1; /* revision */ - arg[2].Type = ACPI_TYPE_INTEGER; - arg[2].Integer.Value = 1; /* count */ - arg[3].Type = ACPI_TYPE_BUFFER; - arg[3].Buffer.Length = sizeof(cap_set); /* Capabilities buffer */ - arg[3].Buffer.Pointer = (uint8_t *)cap_set; - cap_set[0] = 0; /* status */ cap_set[1] = sc->cpu_features; - status = AcpiEvaluateObject(sc->cpu_handle, "_OSC", &arglist, NULL); + status = acpi_EvaluateOSC(sc->cpu_handle, cpu_oscuuid, 1, 2, cap_set, + false); if (ACPI_SUCCESS(status)) { if (cap_set[0] != 0) device_printf(dev, "_OSC returned status %#x\n", cap_set[0]); diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 3ee7ab3..034f6df 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -335,6 +335,8 @@ ACPI_STATUS acpi_FindIndexedResource(ACPI_BUFFER *buf, int index, ACPI_RESOURCE **resp); ACPI_STATUS 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, bool query); ACPI_STATUS acpi_OverrideInterruptLevel(UINT32 InterruptNumber); ACPI_STATUS acpi_SetIntrModel(int model); int acpi_ReqSleepState(struct acpi_softc *sc, int state); |