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
This commit is contained in:
parent
499f728f92
commit
11a5d8cc21
@ -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.
|
||||
*/
|
||||
|
@ -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]);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user