void
AcpiDbAddToHistory (
char *CommandLine)
{
UINT16 CmdLen;
UINT16 BufferLen;
/* Put command into the next available slot */
CmdLen = (UINT16) strlen (CommandLine);
if (!CmdLen)
{
return;
}
if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL)
{
BufferLen = (UINT16) strlen (
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command);
if (CmdLen > BufferLen)
{
AcpiOsFree (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].
Command);
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =
AcpiOsAllocate (CmdLen + 1);
}
}
else
{
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =
AcpiOsAllocate (CmdLen + 1);
}
strcpy (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command,
CommandLine);
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum =
AcpiGbl_NextCmdNum;
/* Adjust indexes */
if ((AcpiGbl_NumHistory == HISTORY_SIZE) &&
(AcpiGbl_NextHistoryIndex == AcpiGbl_LoHistory))
{
AcpiGbl_LoHistory++;
if (AcpiGbl_LoHistory >= HISTORY_SIZE)
{
AcpiGbl_LoHistory = 0;
}
}
AcpiGbl_NextHistoryIndex++;
if (AcpiGbl_NextHistoryIndex >= HISTORY_SIZE)
{
AcpiGbl_NextHistoryIndex = 0;
}
AcpiGbl_NextCmdNum++;
if (AcpiGbl_NumHistory < HISTORY_SIZE)
{
AcpiGbl_NumHistory++;
}
}
开发者ID:2asoft,项目名称:freebsd,代码行数:64,代码来源:dbhistry.c
示例6: AeMiscellaneousTests
//.........这里部分代码省略.........
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 1);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 2,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 2);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 3,
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 4,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 5,
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 5);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 6);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 9);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiInstallGpeHandler (NULL, 0x19,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0x19);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
/* GPE block 1 */
Status = AcpiInstallGpeHandler (NULL, 101,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 101);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiDisableGpe (NULL, 101);
ACPI_CHECK_OK (AcpiDisableGpe, Status);
AfInstallGpeBlock ();
/* Here is where the GPEs are actually "enabled" */
Status = AcpiUpdateAllGpes ();
ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
Status = AcpiGetHandle (NULL, "RSRC", &Handle);
if (ACPI_SUCCESS (Status))
{
ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
if (ACPI_SUCCESS (Status))
{
AcpiOsFree (ReturnBuf.Pointer);
}
}
/* Test global lock */
Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle1);
ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle2);
ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
#endif /* !ACPI_REDUCED_HARDWARE */
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:101,代码来源:aeexec.c
示例7: acpi_ec_probe
//.........这里部分代码省略.........
struct acpi_ec_params *params;
static char *ec_ids[] = { "PNP0C09", NULL };
/* Check that this is a device and that EC is not disabled. */
if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec"))
return (ENXIO);
/*
* If probed via ECDT, set description and continue. Otherwise,
* we can access the namespace and make sure this is not a
* duplicate probe.
*/
ret = ENXIO;
ecdt = 0;
buf.Pointer = NULL;
buf.Length = ACPI_ALLOCATE_BUFFER;
params = acpi_get_private(dev);
if (params != NULL) {
ecdt = 1;
ret = 0;
} else if (ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids)) {
params = kmalloc(sizeof(struct acpi_ec_params), M_TEMP,
M_WAITOK | M_ZERO);
h = acpi_get_handle(dev);
/*
* Read the unit ID to check for duplicate attach and the
* global lock value to see if we should acquire it when
* accessing the EC.
*/
status = acpi_GetInteger(h, "_UID", ¶ms->uid);
if (ACPI_FAILURE(status))
params->uid = 0;
status = acpi_GetInteger(h, "_GLK", ¶ms->glk);
if (ACPI_FAILURE(status))
params->glk = 0;
/*
* Evaluate the _GPE method to find the GPE bit used by the EC to
* signal status (SCI). If it's a package, it contains a reference
* and GPE bit, similar to _PRW.
*/
status = AcpiEvaluateObject(h, "_GPE", NULL, &buf);
if (ACPI_FAILURE(status)) {
device_printf(dev, "can't evaluate _GPE - %s\n",
AcpiFormatException(status));
goto out;
}
obj = (ACPI_OBJECT *)buf.Pointer;
if (obj == NULL)
goto out;
switch (obj->Type) {
case ACPI_TYPE_INTEGER:
params->gpe_handle = NULL;
params->gpe_bit = obj->Integer.Value;
break;
case ACPI_TYPE_PACKAGE:
if (!ACPI_PKG_VALID(obj, 2))
goto out;
params->gpe_handle =
acpi_GetReference(NULL, &obj->Package.Elements[0]);
if (params->gpe_handle == NULL ||
acpi_PkgInt32(obj, 1, ¶ms->gpe_bit) != 0)
goto out;
break;
default:
device_printf(dev, "_GPE has invalid type %d\n", obj->Type);
goto out;
}
/* Store the values we got from the namespace for attach. */
acpi_set_private(dev, params);
/*
* Check for a duplicate probe. This can happen when a probe
* via ECDT succeeded already. If this is a duplicate, disable
* this device.
*/
peer = devclass_get_device(acpi_ec_devclass, params->uid);
if (peer == NULL || !device_is_alive(peer))
ret = 0;
else
device_disable(dev);
}
out:
if (ret == 0) {
ksnprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s%s",
params->gpe_bit, (params->glk) ? ", GLK" : "",
ecdt ? ", ECDT" : "");
device_set_desc_copy(dev, desc);
}
if (ret > 0 && params)
kfree(params, M_TEMP);
if (buf.Pointer)
AcpiOsFree(buf.Pointer);
return (ret);
}
static int
aibs_sysctl(SYSCTL_HANDLER_ARGS)
{
struct aibs_softc *sc = arg1;
enum aibs_type st = arg2;
int i = oidp->oid_number;
ACPI_STATUS rs;
ACPI_OBJECT p, *bp;
ACPI_OBJECT_LIST mp;
ACPI_BUFFER b;
char *name;
struct aibs_sensor *as;
ACPI_INTEGER v, l, h;
int so[3];
switch (st) {
case AIBS_VOLT:
name = "RVLT";
as = sc->sc_asens_volt;
break;
case AIBS_TEMP:
name = "RTMP";
as = sc->sc_asens_temp;
break;
case AIBS_FAN:
name = "RFAN";
as = sc->sc_asens_fan;
break;
default:
return ENOENT;
}
if (as == NULL)
return ENOENT;
l = as[i].l;
h = as[i].h;
p.Type = ACPI_TYPE_INTEGER;
p.Integer.Value = as[i].i;
mp.Count = 1;
mp.Pointer = &p;
b.Length = ACPI_ALLOCATE_BUFFER;
ACPI_SERIAL_BEGIN(aibs);
rs = AcpiEvaluateObjectTyped(sc->sc_ah, name, &mp, &b,
ACPI_TYPE_INTEGER);
if (ACPI_FAILURE(rs)) {
ddevice_printf(sc->sc_dev,
"%s: %i: evaluation failed\n",
name, i);
ACPI_SERIAL_END(aibs);
return EIO;
}
bp = b.Pointer;
v = bp->Integer.Value;
AcpiOsFree(b.Pointer);
ACPI_SERIAL_END(aibs);
switch (st) {
case AIBS_VOLT:
break;
case AIBS_TEMP:
v += 2731;
l += 2731;
h += 2731;
break;
case AIBS_FAN:
break;
}
so[0] = v;
so[1] = l;
so[2] = h;
return sysctl_handle_opaque(oidp, &so, sizeof(so), req);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:71,代码来源:atk0110.c
示例9: AcpiDbReadFromObject
static ACPI_STATUS
AcpiDbReadFromObject (
ACPI_NAMESPACE_NODE *Node,
ACPI_OBJECT_TYPE ExpectedType,
ACPI_OBJECT **Value)
{
ACPI_OBJECT *RetValue;
ACPI_OBJECT_LIST ParamObjects;
ACPI_OBJECT Params[2];
ACPI_BUFFER ReturnObj;
ACPI_STATUS Status;
Params[0].Type = ACPI_TYPE_LOCAL_REFERENCE;
Params[0].Reference.ActualType = Node->Type;
Params[0].Reference.Handle = ACPI_CAST_PTR (ACPI_HANDLE, Node);
ParamObjects.Count = 1;
ParamObjects.Pointer = Params;
ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
AcpiGbl_MethodExecuting = TRUE;
Status = AcpiEvaluateObject (ReadHandle, NULL,
&ParamObjects, &ReturnObj);
AcpiGbl_MethodExecuting = FALSE;
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not read from object, %s",
AcpiFormatException (Status));
return (Status);
}
RetValue = (ACPI_OBJECT *) ReturnObj.Pointer;
switch (RetValue->Type)
{
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING:
/*
* Did we receive the type we wanted? Most important for the
* Integer/Buffer case (when a field is larger than an Integer,
* it should return a Buffer).
*/
if (RetValue->Type != ExpectedType)
{
AcpiOsPrintf (" Type mismatch: Expected %s, Received %s",
AcpiUtGetTypeName (ExpectedType),
AcpiUtGetTypeName (RetValue->Type));
return (AE_TYPE);
}
*Value = RetValue;
break;
default:
AcpiOsPrintf (" Unsupported return object type, %s",
AcpiUtGetTypeName (RetValue->Type));
AcpiOsFree (ReturnObj.Pointer);
return (AE_TYPE);
}
return (Status);
}
开发者ID:fjdoria76,项目名称:acpica,代码行数:69,代码来源:dbtest.c
示例10: AcpiDbTestStringType
static ACPI_STATUS
AcpiDbTestStringType (
ACPI_NAMESPACE_NODE *Node,
UINT32 ByteLength)
{
ACPI_OBJECT *Temp1 = NULL;
ACPI_OBJECT *Temp2 = NULL;
ACPI_OBJECT *Temp3 = NULL;
char *ValueToWrite = "Test String from AML Debugger";
ACPI_OBJECT WriteValue;
ACPI_STATUS Status;
/* Read the original value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp1);
if (ACPI_FAILURE (Status))
{
return (Status);
}
AcpiOsPrintf (" (%4.4X/%3.3X) \"%s\"", (Temp1->String.Length * 8),
Temp1->String.Length, Temp1->String.Pointer);
/* Write a new value */
WriteValue.Type = ACPI_TYPE_STRING;
WriteValue.String.Length = strlen (ValueToWrite);
WriteValue.String.Pointer = ValueToWrite;
Status = AcpiDbWriteToObject (Node, &WriteValue);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Ensure that we can read back the new value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp2);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
if (strcmp (Temp2->String.Pointer, ValueToWrite))
{
AcpiOsPrintf (" MISMATCH 2: %s, expecting %s",
Temp2->String.Pointer, ValueToWrite);
}
/* Write back the original value */
WriteValue.String.Length = strlen (Temp1->String.Pointer);
WriteValue.String.Pointer = Temp1->String.Pointer;
Status = AcpiDbWriteToObject (Node, &WriteValue);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Ensure that we can read back the original value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp3);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
if (strcmp (Temp1->String.Pointer, Temp3->String.Pointer))
{
AcpiOsPrintf (" MISMATCH 3: %s, expecting %s",
Temp3->String.Pointer, Temp1->String.Pointer);
}
Exit:
if (Temp1) {AcpiOsFree (Temp1);}
if (Temp2) {AcpiOsFree (Temp2);}
if (Temp3) {AcpiOsFree (Temp3);}
return (Status);
}
开发者ID:fjdoria76,项目名称:acpica,代码行数:81,代码来源:dbtest.c
示例11: AcpiDbTestBufferType
//.........这里部分代码省略.........
{
AcpiOsPrintf (" Ignoring zero length buffer");
return (AE_OK);
}
/* Allocate a local buffer */
Buffer = ACPI_ALLOCATE_ZEROED (ByteLength);
if (!Buffer)
{
return (AE_NO_MEMORY);
}
/* Read the original value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp1);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Emit a few bytes of the buffer */
AcpiOsPrintf (" (%4.4X/%3.3X)", BitLength, Temp1->Buffer.Length);
for (i = 0; ((i < 4) && (i < ByteLength)); i++)
{
AcpiOsPrintf (" %2.2X", Temp1->Buffer.Pointer[i]);
}
AcpiOsPrintf ("... ");
/*
* Write a new value.
*
* Handle possible extra bits at the end of the buffer. Can
* happen for FieldUnits larger than an integer, but the bit
* count is not an integral number of bytes. Zero out the
* unused bits.
*/
memset (Buffer, BUFFER_FILL_VALUE, ByteLength);
ExtraBits = BitLength % 8;
if (ExtraBits)
{
Buffer [ByteLength - 1] = ACPI_MASK_BITS_ABOVE (ExtraBits);
}
WriteValue.Type = ACPI_TYPE_BUFFER;
WriteValue.Buffer.Length = ByteLength;
WriteValue.Buffer.Pointer = Buffer;
Status = AcpiDbWriteToObject (Node, &WriteValue);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Ensure that we can read back the new value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp2);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
if (memcmp (Temp2->Buffer.Pointer, Buffer, ByteLength))
{
AcpiOsPrintf (" MISMATCH 2: New buffer value");
}
/* Write back the original value */
WriteValue.Buffer.Length = ByteLength;
WriteValue.Buffer.Pointer = Temp1->Buffer.Pointer;
Status = AcpiDbWriteToObject (Node, &WriteValue);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Ensure that we can read back the original value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_BUFFER, &Temp3);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
if (memcmp (Temp1->Buffer.Pointer,
Temp3->Buffer.Pointer, ByteLength))
{
AcpiOsPrintf (" MISMATCH 3: While restoring original buffer");
}
Exit:
ACPI_FREE (Buffer);
if (Temp1) {AcpiOsFree (Temp1);}
if (Temp2) {AcpiOsFree (Temp2);}
if (Temp3) {AcpiOsFree (Temp3);}
return (Status);
}
static ACPI_STATUS
AcpiDbTestIntegerType (
ACPI_NAMESPACE_NODE *Node,
UINT32 BitLength)
{
ACPI_OBJECT *Temp1 = NULL;
ACPI_OBJECT *Temp2 = NULL;
ACPI_OBJECT *Temp3 = NULL;
ACPI_OBJECT WriteValue;
UINT64 ValueToWrite;
ACPI_STATUS Status;
if (BitLength > 64)
{
AcpiOsPrintf (" Invalid length for an Integer: %u", BitLength);
return (AE_OK);
}
/* Read the original value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp1);
if (ACPI_FAILURE (Status))
{
return (Status);
}
AcpiOsPrintf (" (%4.4X/%3.3X) %8.8X%8.8X",
BitLength, ACPI_ROUND_BITS_UP_TO_BYTES (BitLength),
ACPI_FORMAT_UINT64 (Temp1->Integer.Value));
ValueToWrite = ACPI_UINT64_MAX >> (64 - BitLength);
if (Temp1->Integer.Value == ValueToWrite)
{
ValueToWrite = 0;
}
/* Write a new value */
WriteValue.Type = ACPI_TYPE_INTEGER;
WriteValue.Integer.Value = ValueToWrite;
Status = AcpiDbWriteToObject (Node, &WriteValue);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Ensure that we can read back the new value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp2);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
if (Temp2->Integer.Value != ValueToWrite)
{
AcpiOsPrintf (" MISMATCH 2: %8.8X%8.8X, expecting %8.8X%8.8X",
ACPI_FORMAT_UINT64 (Temp2->Integer.Value),
ACPI_FORMAT_UINT64 (ValueToWrite));
}
/* Write back the original value */
WriteValue.Integer.Value = Temp1->Integer.Value;
Status = AcpiDbWriteToObject (Node, &WriteValue);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Ensure that we can read back the original value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_INTEGER, &Temp3);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
if (Temp3->Integer.Value != Temp1->Integer.Value)
{
AcpiOsPrintf (" MISMATCH 3: %8.8X%8.8X, expecting %8.8X%8.8X",
ACPI_FORMAT_UINT64 (Temp3->Integer.Value),
ACPI_FORMAT_UINT64 (Temp1->Integer.Value));
}
Exit:
if (Temp1) {AcpiOsFree (Temp1);}
if (Temp2) {AcpiOsFree (Temp2);}
if (Temp3) {AcpiOsFree (Temp3);}
return (AE_OK);
}
开发者ID:fjdoria76,项目名称:acpica,代码行数:92,代码来源:dbtest.c
示例13: acpi_tz_establish
/*
* Parse the current state of this thermal zone and set up to use it.
*
* Note that we may have previous state, which will have to be discarded.
*/
static int
acpi_tz_establish(struct acpi_tz_softc *sc)
{
ACPI_OBJECT *obj;
int i;
char nbuf[8];
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
/* Erase any existing state. */
for (i = 0; i < TZ_NUMLEVELS; i++)
if (sc->tz_zone.al[i].Pointer != NULL)
AcpiOsFree(sc->tz_zone.al[i].Pointer);
if (sc->tz_zone.psl.Pointer != NULL)
AcpiOsFree(sc->tz_zone.psl.Pointer);
/*
* XXX: We initialize only ACPI_BUFFER to avoid race condition
* with passive cooling thread which refers psv, tc1, tc2 and tsp.
*/
bzero(sc->tz_zone.ac, sizeof(sc->tz_zone.ac));
bzero(sc->tz_zone.al, sizeof(sc->tz_zone.al));
bzero(&sc->tz_zone.psl, sizeof(sc->tz_zone.psl));
/* Evaluate thermal zone parameters. */
for (i = 0; i < TZ_NUMLEVELS; i++) {
sprintf(nbuf, "_AC%d", i);
acpi_tz_getparam(sc, nbuf, &sc->tz_zone.ac[i]);
sprintf(nbuf, "_AL%d", i);
sc->tz_zone.al[i].Length = ACPI_ALLOCATE_BUFFER;
sc->tz_zone.al[i].Pointer = NULL;
AcpiEvaluateObject(sc->tz_handle, nbuf, NULL, &sc->tz_zone.al[i]);
obj = (ACPI_OBJECT *)sc->tz_zone.al[i].Pointer;
if (obj != NULL) {
/* Should be a package containing a list of power objects */
if (obj->Type != ACPI_TYPE_PACKAGE) {
device_printf(sc->tz_dev, "%s has unknown type %d, rejecting\n",
nbuf, obj->Type);
return_VALUE (ENXIO);
}
}
}
acpi_tz_getparam(sc, "_CRT", &sc->tz_zone.crt);
acpi_tz_getparam(sc, "_HOT", &sc->tz_zone.hot);
sc->tz_zone.psl.Length = ACPI_ALLOCATE_BUFFER;
sc->tz_zone.psl.Pointer = NULL;
AcpiEvaluateObject(sc->tz_handle, "_PSL", NULL, &sc->tz_zone.psl);
acpi_tz_getparam(sc, "_PSV", &sc->tz_zone.psv);
acpi_tz_getparam(sc, "_TC1", &sc->tz_zone.tc1);
acpi_tz_getparam(sc, "_TC2", &sc->tz_zone.tc2);
acpi_tz_getparam(sc, "_TSP", &sc->tz_zone.tsp);
acpi_tz_getparam(sc, "_TZP", &sc->tz_zone.tzp);
/*
* Sanity-check the values we've been given.
*
* XXX what do we do about systems that give us the same value for
* more than one of these setpoints?
*/
acpi_tz_sanity(sc, &sc->tz_zone.crt, "_CRT");
acpi_tz_sanity(sc, &sc->tz_zone.hot, "_HOT");
acpi_tz_sanity(sc, &sc->tz_zone.psv, "_PSV");
for (i = 0; i < TZ_NUMLEVELS; i++)
acpi_tz_sanity(sc, &sc->tz_zone.ac[i], "_ACx");
return_VALUE (0);
}
//.........这里部分代码省略.........
*/
Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
AE_CHECK_OK (AcpiSetGpe, Status);
Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
AE_CHECK_OK (AcpiSetGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 1);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 2);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0x19);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0x62);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiDisableGpe (NULL, 0x62);
AE_CHECK_OK (AcpiDisableGpe, Status);
AfInstallGpeBlock ();
Status = AcpiGetHandle (NULL, "RSRC", &Handle);
if (ACPI_SUCCESS (Status))
{
ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
if (ACPI_SUCCESS (Status))
{
AcpiOsFree (ReturnBuf.Pointer);
}
}
/* Test global lock */
Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle1);
AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle2);
AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
/* Get Devices */
Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
AE_CHECK_OK (AcpiGetDevices, Status);
Status = AcpiGetStatistics (&Stats);
AE_CHECK_OK (AcpiGetStatistics, Status);
}
开发者ID:CoryXie,项目名称:CellOS,代码行数:101,代码来源:aeexec.c
示例15: OsGetTable
//.........这里部分代码省略.........
/*
* Somewhere along the way, MS changed the registry entry for
* the FADT from
* HARDWARE/ACPI/FACP to
* HARDWARE/ACPI/FADT.
*
* This code allows for both.
*/
if (ACPI_COMPARE_NAME (Signature, "FACP"))
{
Signature = "FADT";
}
else
{
AcpiOsPrintf ("Could not find %s in registry at %s\n",
Signature, KeyBuffer);
return (NULL);
}
}
else
{
break;
}
}
/* Actual data for table is down a couple levels */
for (i = 0; ;)
{
Status = RegEnumKey (Handle, i, KeyBuffer, sizeof (KeyBuffer));
i += 1;
if (Status == ERROR_NO_MORE_ITEMS)
{
break;
}
Status = RegOpenKey (Handle, KeyBuffer, &SubKey);
if (Status != ERROR_SUCCESS)
{
AcpiOsPrintf ("Could not open %s entry\n", Signature);
return (NULL);
}
RegCloseKey (Handle);
Handle = SubKey;
i = 0;
}
/* Find the (binary) table entry */
for (i = 0; ;)
{
NameSize = sizeof (KeyBuffer);
Status = RegEnumValue (Handle, i, KeyBuffer, &NameSize,
NULL, &Type, NULL, 0);
if (Status != ERROR_SUCCESS)
{
AcpiOsPrintf ("Could not get %s registry entry\n", Signature);
return (NULL);
}
if (Type == REG_BINARY)
{
break;
}
i += 1;
}
/* Get the size of the table */
Status = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL, NULL, &DataSize);
if (Status != ERROR_SUCCESS)
{
AcpiOsPrintf ("Could not read the %s table size\n", Signature);
return (NULL);
}
/* Allocate a new buffer for the table */
ReturnTable = AcpiOsAllocate (DataSize);
if (!ReturnTable)
{
goto Cleanup;
}
/* Get the actual table from the registry */
Status = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL,
(UCHAR *) ReturnTable, &DataSize);
if (Status != ERROR_SUCCESS)
{
AcpiOsPrintf ("Could not read %s data\n", Signature);
AcpiOsFree (ReturnTable);
return (NULL);
}
Cleanup:
RegCloseKey (Handle);
return (ReturnTable);
}
请发表评论