svn commit: r298370 - head/sys/dev/acpica
John Baldwin
jhb at FreeBSD.org
Wed Apr 20 20:56:00 UTC 2016
Author: jhb
Date: Wed Apr 20 20:55:58 2016
New Revision: 298370
URL: https://svnweb.freebsd.org/changeset/base/298370
Log:
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
Modified:
head/sys/dev/acpica/acpi.c
head/sys/dev/acpica/acpi_cpu.c
head/sys/dev/acpica/acpivar.h
Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c Wed Apr 20 20:54:47 2016 (r298369)
+++ head/sys/dev/acpica/acpi.c Wed Apr 20 20:55:58 2016 (r298370)
@@ -2480,6 +2480,29 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
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.
*/
Modified: head/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- head/sys/dev/acpica/acpi_cpu.c Wed Apr 20 20:54:47 2016 (r298369)
+++ head/sys/dev/acpica/acpi_cpu.c Wed Apr 20 20:55:58 2016 (r298370)
@@ -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]);
Modified: head/sys/dev/acpica/acpivar.h
==============================================================================
--- head/sys/dev/acpica/acpivar.h Wed Apr 20 20:54:47 2016 (r298369)
+++ head/sys/dev/acpica/acpivar.h Wed Apr 20 20:55:58 2016 (r298370)
@@ -335,6 +335,8 @@ ACPI_STATUS acpi_FindIndexedResource(ACP
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);
More information about the svn-src-head
mailing list