当前位置: 首页>>代码示例>>C++>>正文


C++ AcpiEvaluateObject函数代码示例

本文整理汇总了C++中AcpiEvaluateObject函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiEvaluateObject函数的具体用法?C++ AcpiEvaluateObject怎么用?C++ AcpiEvaluateObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了AcpiEvaluateObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: acpi_evaluate_integer

ACPI_STATUS
acpi_evaluate_integer (
	ACPI_HANDLE		handle,
	ACPI_STRING		pathname,
	ACPI_OBJECT_LIST	*arguments,
	unsigned long long		*data)
{
	ACPI_STATUS             status = AE_OK;
	ACPI_OBJECT	element;
	ACPI_BUFFER	buffer = {sizeof(ACPI_OBJECT), &element};

	ACPI_FUNCTION_TRACE("acpi_evaluate_integer");

	if (!data)
		return_ACPI_STATUS(AE_BAD_PARAMETER);

	status = AcpiEvaluateObject(handle, pathname, arguments, &buffer);
	if (ACPI_FAILURE(status)) {
		acpi_util_eval_error(handle, pathname, status);
		return_ACPI_STATUS(status);
	}

	if (element.Type != ACPI_TYPE_INTEGER) {
		acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
		return_ACPI_STATUS(AE_BAD_DATA);
	}

	*data = element.Integer.Value;

	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data));

	return_ACPI_STATUS(AE_OK);
}
开发者ID:reactos,项目名称:reactos,代码行数:33,代码来源:utils.c

示例2: pciehpc_acpi_power_off_slot

/*
 * Run _EJ0 method to turn off power to the slot.
 */
static ACPI_STATUS
pciehpc_acpi_power_off_slot(pcie_hp_ctrl_t *ctrl_p)
{
	int status = AE_OK;
	pciehpc_acpi_t *acpi_p = ctrl_p->hc_misc_data;
	int dev_state = 0;
	pcie_hp_slot_t *slot_p = ctrl_p->hc_slots[0];

	PCIE_DBG("turn OFF power to the slot #%d\n", slot_p->hs_phy_slot_num);

	status = AcpiEvaluateObject(acpi_p->slot_dev_obj, "_EJ0", NULL, NULL);

	/* get the state of the device (from _STA method) */
	if (status == AE_OK) {
		if (pciehpc_acpi_get_dev_state(acpi_p->slot_dev_obj,
		    &dev_state) != AE_OK)
			cmn_err(CE_WARN, "failed to get device status "
			    "on slot #%d", slot_p->hs_phy_slot_num);
	}

	PCIE_DBG("(2)device state on slot #%d: 0x%x\n",
	    slot_p->hs_phy_slot_num, dev_state);

	pciehpc_get_slot_state(slot_p);

	if (slot_p->hs_info.cn_state >= DDI_HP_CN_STATE_POWERED) {
		cmn_err(CE_WARN, "failed to power OFF the slot #%d"
		    "(dev_state 0x%x, ACPI_STATUS 0x%x)",
		    slot_p->hs_phy_slot_num, dev_state, status);
		return (AE_ERROR);
	}

	return (status);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:37,代码来源:pciehpc_acpi.c

示例3: AcpiHwExecuteSleepMethod

void
AcpiHwExecuteSleepMethod (
    char                    *MethodPathname,
    UINT32                  IntegerArgument)
{
    ACPI_OBJECT_LIST        ArgList;
    ACPI_OBJECT             Arg;
    ACPI_STATUS             Status;


    ACPI_FUNCTION_TRACE (HwExecuteSleepMethod);


    /* One argument, IntegerArgument; No return value expected */

    ArgList.Count = 1;
    ArgList.Pointer = &Arg;
    Arg.Type = ACPI_TYPE_INTEGER;
    Arg.Integer.Value = (UINT64) IntegerArgument;

    Status = AcpiEvaluateObject (NULL, MethodPathname, &ArgList, NULL);
    if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
    {
        ACPI_EXCEPTION ((AE_INFO, Status, "While executing method %s",
            MethodPathname));
    }

    return_VOID;
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:29,代码来源:hwesleep.c

示例4: evaluate

uint64_t evaluate(ACPI_HANDLE handle) {
	acpi::ScopedBuffer buffer;
	ACPICA_CHECK(AcpiEvaluateObject(handle, nullptr, nullptr, buffer.get()));
	auto object = reinterpret_cast<ACPI_OBJECT *>(buffer.data());
	assert(object->Type == ACPI_TYPE_INTEGER);
	return object->Integer.Value;
}
开发者ID:avdgrinten,项目名称:managarm,代码行数:7,代码来源:madt.cpp

示例5: acpi_perf_identify

static void
acpi_perf_identify(driver_t *driver, device_t parent)
{
    ACPI_HANDLE handle;
    device_t dev;

    /* Make sure we're not being doubly invoked. */
    if (device_find_child(parent, "acpi_perf", -1) != NULL)
        return;

    /* Get the handle for the Processor object and check for perf states. */
    handle = acpi_get_handle(parent);
    if (handle == NULL)
        return;
    if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_PSS", NULL, NULL)))
        return;

    /*
     * Add a child to every CPU that has the right methods.  In future
     * versions of the ACPI spec, CPUs can have different settings.
     * We probe this child now so that other devices that depend
     * on it (i.e., for info about supported states) will see it.
     */
    if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf", -1)) != NULL)
        device_probe_and_attach(dev);
    else
        device_printf(parent, "add acpi_perf child failed\n");
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:28,代码来源:acpi_perf.c

示例6: AcpiDbExecuteMethod

static ACPI_STATUS
AcpiDbExecuteMethod (
    ACPI_DB_METHOD_INFO     *Info,
    ACPI_BUFFER             *ReturnObj)
{
    ACPI_STATUS             Status;
    ACPI_OBJECT_LIST        ParamObjects;
    ACPI_OBJECT             Params[ACPI_METHOD_NUM_ARGS];
    UINT32                  i;


    if (AcpiGbl_DbOutputToFile && !AcpiDbgLevel)
    {
        AcpiOsPrintf ("Warning: debug output is not enabled!\n");
    }

    /* Are there arguments to the method? */

    if (Info->Args && Info->Args[0])
    {
        for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++)
        {
            Params[i].Type          = ACPI_TYPE_INTEGER;
            Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16);
        }

        ParamObjects.Pointer = Params;
        ParamObjects.Count   = i;
    }
    else
    {
        /* Setup default parameters */

        Params[0].Type           = ACPI_TYPE_INTEGER;
        Params[0].Integer.Value  = 0x01020304;

        Params[1].Type           = ACPI_TYPE_STRING;
        Params[1].String.Length  = 12;
        Params[1].String.Pointer = "AML Debugger";

        ParamObjects.Pointer     = Params;
        ParamObjects.Count       = 2;
    }

    /* Prepare for a return object of arbitrary size */

    ReturnObj->Pointer = AcpiGbl_DbBuffer;
    ReturnObj->Length  = ACPI_DEBUG_BUFFER_SIZE;

    /* Do the actual method execution */

    AcpiGbl_MethodExecuting = TRUE;
    Status = AcpiEvaluateObject (NULL,
                Info->Pathname, &ParamObjects, ReturnObj);

    AcpiGbl_CmSingleStep = FALSE;
    AcpiGbl_MethodExecuting = FALSE;

    return (Status);
}
开发者ID:andreiw,项目名称:polaris,代码行数:60,代码来源:dbexec.c

示例7: asus_init

static void
asus_init(device_t self)
{
	asus_softc_t *sc = device_private(self);
	ACPI_STATUS rv;
	ACPI_OBJECT param;
	ACPI_OBJECT_LIST params;
	ACPI_BUFFER ret;

	ret.Pointer = NULL;
	ret.Length = ACPI_ALLOCATE_BUFFER;
	param.Type = ACPI_TYPE_INTEGER;
	param.Integer.Value = 0x40;	/* disable ASL display switching */
	params.Pointer = &param;
	params.Count = 1;

	rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "INIT",
	    &params, &ret);
	if (ACPI_FAILURE(rv))
		aprint_error_dev(self, "couldn't evaluate INIT: %s\n",
		    AcpiFormatException(rv));

	if (ret.Pointer)
		AcpiOsFree(ret.Pointer);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:25,代码来源:asus_acpi.c

示例8: AcpiDbWriteToObject

static ACPI_STATUS
AcpiDbWriteToObject (
    ACPI_NAMESPACE_NODE     *Node,
    ACPI_OBJECT             *Value)
{
    ACPI_OBJECT_LIST        ParamObjects;
    ACPI_OBJECT             Params[2];
    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);

    /* Copy the incoming user parameter */

    ACPI_MEMCPY (&Params[1], Value, sizeof (ACPI_OBJECT));

    ParamObjects.Count = 2;
    ParamObjects.Pointer = Params;

    AcpiGbl_MethodExecuting = TRUE;
    Status = AcpiEvaluateObject (WriteHandle, NULL, &ParamObjects, NULL);
    AcpiGbl_MethodExecuting = FALSE;

    if (ACPI_FAILURE (Status))
    {
        AcpiOsPrintf ("Could not write to object, %s",
            AcpiFormatException (Status));
    }

    return (Status);
}
开发者ID:99corps,项目名称:runtime,代码行数:33,代码来源:dbtest.c

示例9: free_acpi_objects

static PyObject *bits_acpi_eval(PyObject *self, PyObject *args)
{
    char *pathname;
    PyObject *acpi_args_tuple;
    ACPI_OBJECT_LIST acpi_args;
    ACPI_BUFFER results = { .Length = ACPI_ALLOCATE_BUFFER, .Pointer = NULL };
    PyObject *ret;

    if (!PyArg_ParseTuple(args, "sO", &pathname, &acpi_args_tuple))
        return NULL;

    if (!acpi_objects_from_python(acpi_args_tuple, &acpi_args.Pointer, &acpi_args.Count))
        return NULL;

    if (acpica_init() != GRUB_ERR_NONE) {
        free_acpi_objects(acpi_args.Pointer, acpi_args.Count);
        return PyErr_Format(PyExc_RuntimeError, "ACPICA module failed to initialize.");
    }

    if (ACPI_FAILURE(AcpiEvaluateObject(NULL, pathname, &acpi_args, &results))) {
        free_acpi_objects(acpi_args.Pointer, acpi_args.Count);
        return Py_BuildValue("");
    }

    free_acpi_objects(acpi_args.Pointer, acpi_args.Count);
    ret = acpi_object_to_python(results.Pointer);

    ACPI_FREE(results.Pointer);
    return Py_BuildValue("N", ret);
}
开发者ID:mfleming,项目名称:bits,代码行数:30,代码来源:acpimodule.c

示例10: ExecuteOSI

static ACPI_STATUS ExecuteOSI(int pic_mode)
{
    ACPI_STATUS             Status;
    ACPI_OBJECT_LIST        ArgList;
    ACPI_OBJECT             Arg[1];
    ACPI_BUFFER             ReturnValue;


    /* Setup input argument */

    ArgList.Count = 1;
    ArgList.Pointer = Arg;

    Arg[0].Type = ACPI_TYPE_INTEGER;
    Arg[0].Integer.Value = pic_mode;

    /* Ask ACPICA to allocate space for the return object */

    ReturnValue.Pointer = 0;
    ReturnValue.Length = ACPI_ALLOCATE_BUFFER;

    Status = AcpiEvaluateObject (NULL, "\\_PIC", &ArgList, &ReturnValue);
	FreeBuffer(&ReturnValue);
	if (Status == AE_NOT_FOUND)
	{
		return AE_OK;
	}
    if (ACPI_FAILURE (Status))
    {
        ACPI_EXCEPTION ((AE_INFO, Status, "While executing _PIC"));
        return Status;
    }

    return AE_OK;
}
开发者ID:olsner,项目名称:os,代码行数:35,代码来源:acpica.c

示例11: ExecuteOSI

static ACPI_STATUS
ExecuteOSI (
    char                    *OsiString,
    UINT32                  ExpectedResult)
{
    ACPI_STATUS             Status;
    ACPI_OBJECT_LIST        ArgList;
    ACPI_OBJECT             Arg[1];
    ACPI_BUFFER             ReturnValue;
    ACPI_OBJECT             *Obj;


    /* Setup input argument */

    ArgList.Count = 1;
    ArgList.Pointer = Arg;

    Arg[0].Type = ACPI_TYPE_STRING;
    Arg[0].String.Pointer = OsiString;
    Arg[0].String.Length = strlen (Arg[0].String.Pointer);

    /* Ask ACPICA to allocate space for the return object */

    ReturnValue.Length = ACPI_ALLOCATE_BUFFER;

    Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue);

    if (ACPI_FAILURE (Status))
    {
        AcpiOsPrintf ("Could not execute _OSI method, %s\n",
            AcpiFormatException (Status));
        return (Status);
    }

    if (ReturnValue.Length < sizeof (ACPI_OBJECT))
    {
        AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n",
            ReturnValue.Length);
        return (AE_ERROR);
    }

    Obj = ReturnValue.Pointer;
    if (Obj->Type != ACPI_TYPE_INTEGER)
    {
        AcpiOsPrintf ("Invalid return type from _OSI method, %.2X\n", Obj->Type);
        return (AE_ERROR);
    }

    if (Obj->Integer.Value != ExpectedResult)
    {
        AcpiOsPrintf ("Invalid return value from _OSI, expected %.8X found %.8X\n",
            ExpectedResult, (UINT32) Obj->Integer.Value);
        return (AE_ERROR);
    }

    /* Reset the OSI data */

    AcpiGbl_OsiData = 0;
    return (AE_OK);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:60,代码来源:aeexec.c

示例12: acpi_dock_is_ejd_device

/* Find dependent devices.  When their parent is removed, so are they. */
static int
acpi_dock_is_ejd_device(ACPI_HANDLE dock_handle, ACPI_HANDLE handle)
{
	int		ret;
	ACPI_STATUS	ret_status;
	ACPI_BUFFER	ejd_buffer;
	ACPI_OBJECT	*obj;

	ret = 0;

	ejd_buffer.Pointer = NULL;
	ejd_buffer.Length = ACPI_ALLOCATE_BUFFER;
	ret_status = AcpiEvaluateObject(handle, "_EJD", NULL, &ejd_buffer);
	if (ACPI_FAILURE(ret_status))
		goto out;

	obj = (ACPI_OBJECT *)ejd_buffer.Pointer;
	if (dock_handle == acpi_GetReference(NULL, obj))
		ret = 1;

out:
	if (ejd_buffer.Pointer != NULL)
		AcpiOsFree(ejd_buffer.Pointer);

	return (ret);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:27,代码来源:acpi_dock.c

示例13: acpi_dock_execute_dck

static int
acpi_dock_execute_dck(device_t dev, int dock)
{
	ACPI_HANDLE	h;
	ACPI_OBJECT	argobj;
	ACPI_OBJECT_LIST args;
	ACPI_BUFFER	buf;
	ACPI_OBJECT	retobj;
	ACPI_STATUS	status;

	h = acpi_get_handle(dev);

	argobj.Type = ACPI_TYPE_INTEGER;
	argobj.Integer.Value = dock;
	args.Count = 1;
	args.Pointer = &argobj;
	buf.Pointer = &retobj;
	buf.Length = sizeof(retobj);
	status = AcpiEvaluateObject(h, "_DCK", &args, &buf);

	/*
	 * When _DCK is called with 0, OSPM will ignore the return value.
	 */
	if (dock == ACPI_DOCK_ISOLATE)
		return (0);

	/* If _DCK returned 1, the request succeeded. */
	if (ACPI_SUCCESS(status) && retobj.Type == ACPI_TYPE_INTEGER &&
	    retobj.Integer.Value == 1)
		return (0);

	return (-1);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:33,代码来源:acpi_dock.c

示例14: ExecuteOSI

static void
ExecuteOSI (void)
{
    ACPI_STATUS             Status;
    ACPI_OBJECT_LIST        ArgList;
    ACPI_OBJECT             Arg[1];
    ACPI_BUFFER             ReturnValue;
    ACPI_OBJECT             *Object;


    ACPI_INFO ((AE_INFO, "Executing _OSI reserved method"));

    /* Setup input argument */

    ArgList.Count = 1;
    ArgList.Pointer = Arg;

    Arg[0].Type = ACPI_TYPE_STRING;
    Arg[0].String.Pointer = "Windows 2001";
    Arg[0].String.Length = strlen (Arg[0].String.Pointer);

    /* Ask ACPICA to allocate space for the return object */

    ReturnValue.Length = ACPI_ALLOCATE_BUFFER;

    Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue);
    if (ACPI_FAILURE (Status))
    {
        ACPI_EXCEPTION ((AE_INFO, Status, "While executing _OSI"));
        return;
    }

    /* Ensure that the return object is large enough */

    if (ReturnValue.Length < sizeof (ACPI_OBJECT))
    {
        AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n",
            ReturnValue.Length);
        goto ErrorExit;
    }

    /* Expect an integer return value from execution of _OSI */

    Object = ReturnValue.Pointer;
    if (Object->Type != ACPI_TYPE_INTEGER)
    {
        AcpiOsPrintf ("Invalid return type from _OSI, %.2X\n", Object->Type);
    }

    ACPI_INFO ((AE_INFO, "_OSI returned 0x%8.8X",
        (UINT32) Object->Integer.Value));


ErrorExit:

    /* Free a buffer created via ACPI_ALLOCATE_BUFFER */

    AcpiOsFree (ReturnValue.Pointer);
}
开发者ID:zetalog,项目名称:acpica,代码行数:59,代码来源:examples.c

示例15: acpi_cmbat_get_bif

static void
acpi_cmbat_get_bif(void *context)
{
	device_t	dev;
	struct acpi_cmbat_softc *sc;
	ACPI_STATUS	as;
	ACPI_OBJECT	*res, *tmp;
	ACPI_HANDLE	h;
	ACPI_BUFFER	bif_buffer;

	dev = context;
	sc = device_get_softc(dev);
	h = acpi_get_handle(dev);
	bif_buffer.Pointer = NULL;

	if (!acpi_cmbat_info_expired(&sc->bif_lastupdated)) {
		return;
	}

	if (sc->bif_updating) {
		return;
	}
	sc->bif_updating = 1;

	bif_buffer.Length = ACPI_ALLOCATE_BUFFER;
	if (ACPI_FAILURE(as = AcpiEvaluateObject(h, "_BIF", NULL, &bif_buffer))) {
		ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
		    "error fetching current battery info -- %s\n",
		    AcpiFormatException(as));
		goto end;
	}

	res = (ACPI_OBJECT *)bif_buffer.Pointer;

	if ((res == NULL) || (res->Type != ACPI_TYPE_PACKAGE) || (res->Package.Count != 13)) {
		ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
		    "battery info corrupted\n");
		goto end;
	}

	PKG_GETINT(res, tmp,  0, sc->bif.unit, end);
	PKG_GETINT(res, tmp,  1, sc->bif.dcap, end);
	PKG_GETINT(res, tmp,  2, sc->bif.lfcap, end);
	PKG_GETINT(res, tmp,  3, sc->bif.btech, end);
	PKG_GETINT(res, tmp,  4, sc->bif.dvol, end);
	PKG_GETINT(res, tmp,  5, sc->bif.wcap, end);
	PKG_GETINT(res, tmp,  6, sc->bif.lcap, end);
	PKG_GETINT(res, tmp,  7, sc->bif.gra1, end);
	PKG_GETINT(res, tmp,  8, sc->bif.gra2, end);
	PKG_GETSTR(res, tmp,  9, sc->bif.model, ACPI_CMBAT_MAXSTRLEN, end);
	PKG_GETSTR(res, tmp, 10, sc->bif.serial, ACPI_CMBAT_MAXSTRLEN, end);
	PKG_GETSTR(res, tmp, 11, sc->bif.type, ACPI_CMBAT_MAXSTRLEN, end);
	PKG_GETSTR(res, tmp, 12, sc->bif.oeminfo, ACPI_CMBAT_MAXSTRLEN, end);
	acpi_cmbat_info_updated(&sc->bif_lastupdated);
end:
	if (bif_buffer.Pointer != NULL)
		AcpiOsFree(bif_buffer.Pointer);
	sc->bif_updating = 0;
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:59,代码来源:acpi_cmbat.c


注:本文中的AcpiEvaluateObject函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。