• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AcpiEvaluateObject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: acpi_cmbat_get_bst

static void
acpi_cmbat_get_bst(void *arg)
{
    struct acpi_cmbat_softc *sc;
    ACPI_STATUS	as;
    ACPI_OBJECT	*res;
    ACPI_HANDLE	h;
    ACPI_BUFFER	bst_buffer;
    device_t dev;

    ACPI_SERIAL_ASSERT(cmbat);

    dev = arg;
    sc = device_get_softc(dev);
    h = acpi_get_handle(dev);
    bst_buffer.Pointer = NULL;
    bst_buffer.Length = ACPI_ALLOCATE_BUFFER;

    if (!acpi_cmbat_info_expired(&sc->bst_lastupdated))
	goto end;

    as = AcpiEvaluateObject(h, "_BST", NULL, &bst_buffer);
    if (ACPI_FAILURE(as)) {
	ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
		    "error fetching current battery status -- %s\n",
		    AcpiFormatException(as));
	goto end;
    }

    res = (ACPI_OBJECT *)bst_buffer.Pointer;
    if (!ACPI_PKG_VALID(res, 4)) {
	ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
		    "battery status corrupted\n");
	goto end;
    }

    if (acpi_PkgInt32(res, 0, &sc->bst.state) != 0)
	goto end;
    if (acpi_PkgInt32(res, 1, &sc->bst.rate) != 0)
	goto end;
    if (acpi_PkgInt32(res, 2, &sc->bst.cap) != 0)
	goto end;
    if (acpi_PkgInt32(res, 3, &sc->bst.volt) != 0)
	goto end;
    acpi_cmbat_info_updated(&sc->bst_lastupdated);

    /* XXX If all batteries are critical, perhaps we should suspend. */
    if (sc->bst.state & ACPI_BATT_STAT_CRITICAL) {
    	if ((sc->flags & ACPI_BATT_STAT_CRITICAL) == 0) {
	    sc->flags |= ACPI_BATT_STAT_CRITICAL;
	    device_printf(dev, "critically low charge!\n");
	}
    } else
	sc->flags &= ~ACPI_BATT_STAT_CRITICAL;

end:
    if (bst_buffer.Pointer != NULL)
	AcpiOsFree(bst_buffer.Pointer);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:59,代码来源:acpi_cmbat.c


示例17: acpi_cpu_probe

static int
acpi_cpu_probe(device_t dev)
{
    int			   acpi_id, cpu_id;
    ACPI_BUFFER		   buf;
    ACPI_HANDLE		   handle;
    ACPI_OBJECT		   *obj;
    ACPI_STATUS		   status;

    if (acpi_disabled("cpu") || acpi_get_type(dev) != ACPI_TYPE_PROCESSOR ||
	    acpi_cpu_disabled)
	return (ENXIO);

    handle = acpi_get_handle(dev);
    if (cpu_softc == NULL)
	cpu_softc = malloc(sizeof(struct acpi_cpu_softc *) *
	    (mp_maxid + 1), M_TEMP /* XXX */, M_WAITOK | M_ZERO);

    /* Get our Processor object. */
    buf.Pointer = NULL;
    buf.Length = ACPI_ALLOCATE_BUFFER;
    status = AcpiEvaluateObject(handle, NULL, NULL, &buf);
    if (ACPI_FAILURE(status)) {
	device_printf(dev, "probe failed to get Processor obj - %s\n",
		      AcpiFormatException(status));
	return (ENXIO);
    }
    obj = (ACPI_OBJECT *)buf.Pointer;
    if (obj->Type != ACPI_TYPE_PROCESSOR) {
	device_printf(dev, "Processor object has bad type %d\n", obj->Type);
	AcpiOsFree(obj);
	return (ENXIO);
    }

    /*
     * Find the processor associated with our unit.  We could use the
     * ProcId as a key, however, some boxes do not have the same values
     * in their Processor object as the ProcId values in the MADT.
     */
    acpi_id = obj->Processor.ProcId;
    AcpiOsFree(obj);
    if (acpi_pcpu_get_id(dev, &acpi_id, &cpu_id) != 0)
	return (ENXIO);

    /*
     * Check if we already probed this processor.  We scan the bus twice
     * so it's possible we've already seen this one.
     */
    if (cpu_softc[cpu_id] != NULL)
	return (ENXIO);

    /* Mark this processor as in-use and save our derived id for attach. */
    cpu_softc[cpu_id] = (void *)1;
    acpi_set_private(dev, (void*)(intptr_t)cpu_id);
    device_set_desc(dev, "ACPI CPU");

    return (0);
}
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:58,代码来源:acpi_cpu.c


示例18: acpi_cst_attach

static int
acpi_cst_attach(device_t dev)
{
    ACPI_BUFFER		   buf;
    ACPI_OBJECT		   *obj;
    struct acpi_cst_softc *sc;
    ACPI_STATUS		   status;

    ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);

    sc = device_get_softc(dev);
    sc->cst_dev = dev;
    sc->cst_parent = device_get_softc(device_get_parent(dev));
    sc->cst_handle = acpi_get_handle(dev);
    sc->cst_cpuid = acpi_get_magic(dev);
    acpi_cst_softc[sc->cst_cpuid] = sc;
    acpi_cst_smi_cmd = AcpiGbl_FADT.SmiCommand;
    acpi_cst_ctrl = AcpiGbl_FADT.CstControl;

    buf.Pointer = NULL;
    buf.Length = ACPI_ALLOCATE_BUFFER;
    status = AcpiEvaluateObject(sc->cst_handle, NULL, NULL, &buf);
    if (ACPI_FAILURE(status)) {
	device_printf(dev, "attach failed to get Processor obj - %s\n",
		      AcpiFormatException(status));
	acpi_cst_softc[sc->cst_cpuid] = NULL;
	return (ENXIO);
    }
    obj = (ACPI_OBJECT *)buf.Pointer;
    sc->cst_p_blk = obj->Processor.PblkAddress;
    sc->cst_p_blk_len = obj->Processor.PblkLength;
    AcpiOsFree(obj);
    ACPI_DEBUG_PRINT((ACPI_DB_INFO, "cpu_cst%d: P_BLK at %#x/%d\n",
		     device_get_unit(dev), sc->cst_p_blk, sc->cst_p_blk_len));

    /*
     * If this is the first cpu we attach, create and initialize the generic
     * resources that will be used by all acpi cpu devices.
     */
    if (device_get_unit(dev) == 0) {
	/* Assume we won't be using FADT for Cx states by default */
	acpi_cst_use_fadt = FALSE;

	/* Queue post cpu-probing task handler */
	AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_cst_postattach, NULL);
    }

    /* Probe for Cx state support. */
    acpi_cst_cx_probe(sc);

    sc->cst_flags |= ACPI_CST_FLAG_ATTACHED;

    return (0);
}
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:54,代码来源:acpi_cpu_cstate.c


示例19: fujitsu_hk_eval_nary_integer

/*
 * fujitsu_hk_eval_nary_integer:
 *
 *	Evaluate an object that takes as input an arbitrary (possible null)
 *	number of integer parameters.  If res is not NULL, then *res is filled
 *	with the result of the evaluation, and AE_NULL_OBJECT is returned if
 *	the evaluation produced no result.
 */
static ACPI_STATUS
fujitsu_hk_eval_nary_integer(ACPI_HANDLE handle, const char *path, const
                             ACPI_INTEGER *args, uint8_t count, ACPI_INTEGER *res)
{
    ACPI_OBJECT_LIST paramlist;
    ACPI_OBJECT retobj, objpool[4], *argobjs;
    ACPI_BUFFER buf;
    ACPI_STATUS rv;
    uint8_t i;

    /* Require that (args == NULL) if and only if (count == 0). */
    KASSERT((args != NULL || count == 0) && (args == NULL || count != 0));

    /* The object pool should be large enough for our callers. */
    KASSERT(count <= __arraycount(objpool));

    if (handle == NULL)
        handle = ACPI_ROOT_OBJECT;

    /* Convert the given array args into an array of ACPI objects. */
    argobjs = objpool;
    for (i = 0; i < count; i++) {
        argobjs[i].Type = ACPI_TYPE_INTEGER;
        argobjs[i].Integer.Value = args[i];
    }

    paramlist.Count = count;
    paramlist.Pointer = argobjs;

    (void)memset(&retobj, 0, sizeof(retobj));
    buf.Pointer = &retobj;
    buf.Length = sizeof(retobj);

    rv = AcpiEvaluateObject(handle, path, &paramlist, &buf);

    if (ACPI_FAILURE(rv))
        return rv;

    /*
     * If a return value is expected and desired (i.e. res != NULL),
     * then copy the result into *res.
     */
    if (res != NULL) {
        if (buf.Length == 0)
            return AE_NULL_OBJECT;

        if (retobj.Type != ACPI_TYPE_INTEGER)
            return AE_TYPE;

        *res = retobj.Integer.Value;
    }

    return AE_OK;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:62,代码来源:fujhk_acpi.c


示例20: evaluateWith1

void evaluateWith1(ACPI_HANDLE handle) {
	ACPI_OBJECT args[1];
	args[0].Integer.Type = ACPI_TYPE_INTEGER;
	args[0].Integer.Value = 1;

	ACPI_OBJECT_LIST list;
	list.Count = 1;
	list.Pointer = args;

	ACPICA_CHECK(AcpiEvaluateObject(handle, nullptr, &list, nullptr));
}
开发者ID:avdgrinten,项目名称:managarm,代码行数:11,代码来源:madt.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AcpiExEnterInterpreter函数代码示例发布时间:2022-05-30
下一篇:
C++ AcpiEvGetGpeEventInfo函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap