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


C++ AcpiGetHandle函数代码示例

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


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

示例1: AfInstallGpeBlock

static void
AfInstallGpeBlock (
    void)
{
    ACPI_STATUS                 Status;
    ACPI_HANDLE                 Handle;
    ACPI_HANDLE                 Handle2 = NULL;
    ACPI_HANDLE                 Handle3 = NULL;
    ACPI_GENERIC_ADDRESS        BlockAddress;
    ACPI_HANDLE                 GpeDevice;


    Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
    if (ACPI_FAILURE (Status))
    {
        return;
    }

    ACPI_MEMSET (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS));
    BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
    BlockAddress.Address = 0x76540000;

    Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2);
    if (ACPI_SUCCESS (Status))
    {
        Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8);
        AE_CHECK_OK (AcpiInstallGpeBlock, Status);

        Status = AcpiInstallGpeHandler (Handle2, 8,
            ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
        AE_CHECK_OK (AcpiInstallGpeHandler, Status);

        Status = AcpiEnableGpe (Handle2, 8);
        AE_CHECK_OK (AcpiEnableGpe, Status);

        Status = AcpiGetGpeDevice (0x30, &GpeDevice);
        AE_CHECK_OK (AcpiGetGpeDevice, Status);

        Status = AcpiGetGpeDevice (0x42, &GpeDevice);
        AE_CHECK_OK (AcpiGetGpeDevice, Status);

        Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
        AE_CHECK_OK (AcpiGetGpeDevice, Status);

        Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
        AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST);

        Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
        AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
    }

    Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
    if (ACPI_SUCCESS (Status))
    {
        Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
        AE_CHECK_OK (AcpiInstallGpeBlock, Status);
    }
}
开发者ID:Jyang772,项目名称:XEOS,代码行数:58,代码来源:aeexec.c

示例2: AcpiDbTestAllObjects

static void
AcpiDbTestAllObjects (
    void)
{
    ACPI_STATUS             Status;


    /* Install the debugger read-object control method if necessary */

    if (!ReadHandle)
    {
        Status = AcpiInstallMethod (ReadMethodCode);
        if (ACPI_FAILURE (Status))
        {
            AcpiOsPrintf ("%s, Could not install debugger read method\n",
                AcpiFormatException (Status));
            return;
        }

        Status = AcpiGetHandle (NULL, ACPI_DB_READ_METHOD, &ReadHandle);
        if (ACPI_FAILURE (Status))
        {
            AcpiOsPrintf ("Could not obtain handle for debug method %s\n",
                ACPI_DB_READ_METHOD);
            return;
        }
    }

    /* Install the debugger write-object control method if necessary */

    if (!WriteHandle)
    {
        Status = AcpiInstallMethod (WriteMethodCode);
        if (ACPI_FAILURE (Status))
        {
            AcpiOsPrintf ("%s, Could not install debugger write method\n",
                AcpiFormatException (Status));
            return;
        }

        Status = AcpiGetHandle (NULL, ACPI_DB_WRITE_METHOD, &WriteHandle);
        if (ACPI_FAILURE (Status))
        {
            AcpiOsPrintf ("Could not obtain handle for debug method %s\n",
                ACPI_DB_WRITE_METHOD);
            return;
        }
    }

    /* Walk the entire namespace, testing each supported named data object */

    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
        ACPI_UINT32_MAX, AcpiDbTestOneObject, NULL, NULL, NULL);
}
开发者ID:fjdoria76,项目名称:acpica,代码行数:54,代码来源:dbtest.c

示例3: pciehpc_acpi_hpc_init

/*
 * Intialize hot plug control for ACPI mode.
 */
static int
pciehpc_acpi_hpc_init(pcie_hp_ctrl_t *ctrl_p)
{
	ACPI_HANDLE pcibus_obj;
	int status = AE_ERROR;
	ACPI_HANDLE slot_dev_obj;
	ACPI_HANDLE hdl;
	pciehpc_acpi_t *acpi_p;
	uint16_t bus_methods = 0;
	uint16_t slot_methods = 0;

	/* get the ACPI object for the bus node */
	status = acpica_get_handle(ctrl_p->hc_dip, &pcibus_obj);
	if (status != AE_OK)
		return (DDI_FAILURE);

	/* get the ACPI object handle for the child node */
	status = AcpiGetNextObject(ACPI_TYPE_DEVICE, pcibus_obj,
	    NULL, &slot_dev_obj);
	if (status != AE_OK)
		return (DDI_FAILURE);

	/*
	 * gather the info about the ACPI methods present on the bus node
	 * and the child nodes.
	 */
	if (AcpiGetHandle(pcibus_obj, "_OSC", &hdl) == AE_OK)
		bus_methods |= PCIEHPC_ACPI_OSC_PRESENT;
	if (AcpiGetHandle(pcibus_obj, "_OSHP", &hdl) == AE_OK)
		bus_methods |= PCIEHPC_ACPI_OSHP_PRESENT;
	if (AcpiGetHandle(pcibus_obj, "_HPX", &hdl) == AE_OK)
		bus_methods |= PCIEHPC_ACPI_HPX_PRESENT;
	if (AcpiGetHandle(pcibus_obj, "_HPP", &hdl) == AE_OK)
		bus_methods |= PCIEHPC_ACPI_HPP_PRESENT;
	if (AcpiGetHandle(pcibus_obj, "_DSM", &hdl) == AE_OK)
		bus_methods |= PCIEHPC_ACPI_DSM_PRESENT;
	if (AcpiGetHandle(slot_dev_obj, "_SUN", &hdl) == AE_OK)
		slot_methods |= PCIEHPC_ACPI_SUN_PRESENT;
	if (AcpiGetHandle(slot_dev_obj, "_PS0", &hdl) == AE_OK)
		slot_methods |= PCIEHPC_ACPI_PS0_PRESENT;
	if (AcpiGetHandle(slot_dev_obj, "_EJ0", &hdl) == AE_OK)
		slot_methods |= PCIEHPC_ACPI_EJ0_PRESENT;
	if (AcpiGetHandle(slot_dev_obj, "_STA", &hdl) == AE_OK)
		slot_methods |= PCIEHPC_ACPI_STA_PRESENT;

	/* save ACPI object handles, etc. */
	acpi_p = kmem_zalloc(sizeof (pciehpc_acpi_t), KM_SLEEP);
	acpi_p->bus_obj = pcibus_obj;
	acpi_p->slot_dev_obj = slot_dev_obj;
	acpi_p->bus_methods = bus_methods;
	acpi_p->slot_methods = slot_methods;
	ctrl_p->hc_misc_data = acpi_p;

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

示例4: acpi_GetReference

ACPI_HANDLE
acpi_GetReference(ACPI_HANDLE scope, ACPI_OBJECT *obj)
{
    ACPI_HANDLE h;

    if (obj == NULL)
	return (NULL);

    switch (obj->Type) {
    case ACPI_TYPE_LOCAL_REFERENCE:
    case ACPI_TYPE_ANY:
	h = obj->Reference.Handle;
	break;
    case ACPI_TYPE_STRING:
	/*
	 * The String object usually contains a fully-qualified path, so
	 * scope can be NULL.
	 *
	 * XXX This may not always be the case.
	 */
	if (ACPI_FAILURE(AcpiGetHandle(scope, obj->String.Pointer, &h)))
	    h = NULL;
	break;
    default:
	h = NULL;
	break;
    }

    return (h);
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:30,代码来源:acpi_package.c

示例5: get_next_entry

status_t
get_next_entry(uint32 objectType, const char *base, char *result,
               size_t length, void **counter)
{
    ACPI_HANDLE parent, child, newChild;
    ACPI_BUFFER buffer;
    ACPI_STATUS status;

    TRACE("get_next_entry %ld, %s\n", objectType, base);

    if (base == NULL || !strcmp(base, "\\")) {
        parent = ACPI_ROOT_OBJECT;
    } else {
        status = AcpiGetHandle(NULL, (ACPI_STRING)base, &parent);
        if (status != AE_OK)
            return B_ENTRY_NOT_FOUND;
    }

    child = *counter;

    status = AcpiGetNextObject(objectType, parent, child, &newChild);
    if (status != AE_OK)
        return B_ENTRY_NOT_FOUND;

    *counter = newChild;
    buffer.Length = length;
    buffer.Pointer = result;

    status = AcpiGetName(newChild, ACPI_FULL_PATHNAME, &buffer);
    if (status != AE_OK)
        return B_NO_MEMORY; /* Corresponds to AE_BUFFER_OVERFLOW */

    return B_OK;
}
开发者ID:simonsouth,项目名称:haiku,代码行数:34,代码来源:BusManager.cpp

示例6: psm_node_has_prt

/*
 * Examines ACPI node for presence of _PRT object
 *
 * Returns:
 *	0 if no _PRT or error
 *	1 if _PRT is present
 */
static int
psm_node_has_prt(ACPI_HANDLE *ah)
{
	ACPI_HANDLE rh;

	return (AcpiGetHandle(ah, "_PRT", &rh) == AE_OK);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:14,代码来源:psm_common.c

示例7: AcpiNsDumpRootDevices

void
AcpiNsDumpRootDevices (
    void)
{
    ACPI_HANDLE             SysBusHandle;
    ACPI_STATUS             Status;


    ACPI_FUNCTION_NAME (NsDumpRootDevices);


    /* Only dump the table if tracing is enabled */

    if (!(ACPI_LV_TABLES & AcpiDbgLevel))
    {
        return;
    }

    Status = AcpiGetHandle (NULL, METHOD_NAME__SB_, &SysBusHandle);
    if (ACPI_FAILURE (Status))
    {
        return;
    }

    ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
                       "Display of all devices in the namespace:\n"));

    Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle,
                                  ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
                                  AcpiNsDumpOneDevice, NULL, NULL, NULL);
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:31,代码来源:nsdumpdv.c

示例8: acpi_device_init_driver

static status_t
acpi_device_init_driver(device_node *node, void **cookie)
{
	ACPI_HANDLE handle;
	const char *path = NULL;
	uint32 type;

	if (gDeviceManager->get_attr_uint32(node, ACPI_DEVICE_TYPE_ITEM, &type, false) != B_OK)
		return B_ERROR;
	gDeviceManager->get_attr_string(node, ACPI_DEVICE_PATH_ITEM, &path, false);

	acpi_device_cookie *device = (acpi_device_cookie*)malloc(sizeof(*device));
	if (device == NULL)
		return B_NO_MEMORY;

	memset(device, 0, sizeof(*device));

	if (path != NULL && AcpiGetHandle(NULL, (ACPI_STRING)path, &handle) != AE_OK) {
		free(device);
		return B_ENTRY_NOT_FOUND;
	}

	device->handle = handle;
	device->path = path != NULL ? strdup(path) : NULL;
	device->type = type;
	device->node = node;

	snprintf(device->name, sizeof(device->name), "acpi_device %s", path);
	*cookie = device;
	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:31,代码来源:Device.cpp

示例9: acpi_ec_ecdt_probe

/*
 * Look for an ECDT and if we find one, set up default GPE and
 * space handlers to catch attempts to access EC space before
 * we have a real driver instance in place.
 *
 * TODO: Some old Gateway laptops need us to fake up an ECDT or
 * otherwise attach early so that _REG methods can run.
 */
void
acpi_ec_ecdt_probe(device_t parent)
{
    ACPI_TABLE_ECDT *ecdt;
    ACPI_STATUS	     status;
    device_t	     child;
    ACPI_HANDLE	     h;
    struct acpi_ec_params *params;

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

    /* Find and validate the ECDT. */
    status = AcpiGetTable(ACPI_SIG_ECDT, 1, (ACPI_TABLE_HEADER **)&ecdt);
    if (ACPI_FAILURE(status) ||
	ecdt->Control.BitWidth != 8 ||
	ecdt->Data.BitWidth != 8) {
	return;
    }

    /* Create the child device with the given unit number. */
    child = BUS_ADD_CHILD(parent, parent, 0, "acpi_ec", ecdt->Uid);
    if (child == NULL) {
	kprintf("%s: can't add child\n", __func__);
	return;
    }

    /* Find and save the ACPI handle for this device. */
    status = AcpiGetHandle(NULL, ecdt->Id, &h);
    if (ACPI_FAILURE(status)) {
	device_delete_child(parent, child);
	kprintf("%s: can't get handle\n", __func__);
	return;
    }
    acpi_set_handle(child, h);

    /* Set the data and CSR register addresses. */
    bus_set_resource(child, SYS_RES_IOPORT, 0, ecdt->Data.Address,
	/*count*/1, -1);
    bus_set_resource(child, SYS_RES_IOPORT, 1, ecdt->Control.Address,
	/*count*/1, -1);

    /*
     * Store values for the probe/attach routines to use.  Store the
     * ECDT GPE bit and set the global lock flag according to _GLK.
     * Note that it is not perfectly correct to be evaluating a method
     * before initializing devices, but in practice this function
     * should be safe to call at this point.
     */
    params = kmalloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO);
    params->gpe_handle = NULL;
    params->gpe_bit = ecdt->Gpe;
    params->uid = ecdt->Uid;
    acpi_GetInteger(h, "_GLK", &params->glk);
    acpi_set_private(child, params);

    /* Finish the attach process. */
    if (device_probe_and_attach(child) != 0)
	device_delete_child(parent, child);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:67,代码来源:acpi_ec.c

示例10: acpi_pci_bind

static int acpi_pci_bind(struct acpi_device *device)
{
    ACPI_STATUS status;
    ACPI_HANDLE handle;
    struct pci_bus *bus;
    struct pci_dev *dev;

    dev = acpi_get_pci_dev(device->handle);
    if (!dev)
        return 0;

    device->pci_dev = dev;

    dev->acpi_dev = device;

    dbgprintf("bind ACPI %s PCI_%x_%x\n", device->pnp.bus_id,
               dev->vendor, dev->device);

//    pci_acpi_add_pm_notifier(device, dev);
//    if (device->wakeup.flags.run_wake)
//        device_set_run_wake(&dev->dev, true);

    /*
     * Install the 'bind' function to facilitate callbacks for
     * children of the P2P bridge.
     */
    if (dev->subordinate) {
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                  "Device %04x:%02x:%02x.%d is a PCI bridge\n",
                  pci_domain_nr(dev->bus), dev->bus->number,
                  PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)));
        device->ops.bind = acpi_pci_bind;
        device->ops.unbind = acpi_pci_unbind;
    }

    /*
     * Evaluate and parse _PRT, if exists.  This code allows parsing of
     * _PRT objects within the scope of non-bridge devices.  Note that
     * _PRTs within the scope of a PCI bridge assume the bridge's
     * subordinate bus number.
     *
     * TBD: Can _PRTs exist within the scope of non-bridge PCI devices?
     */
    status = AcpiGetHandle(device->handle, METHOD_NAME__PRT, &handle);
    if (ACPI_FAILURE(status))
        goto out;

    if (dev->subordinate)
        bus = dev->subordinate;
    else
        bus = dev->bus;

    acpi_pci_irq_add_prt(device->handle, bus);

out:
//    pci_dev_put(dev);
    return 0;
}
开发者ID:Misha-Mainenko,项目名称:kolibrios-llvm,代码行数:58,代码来源:pci_bind.c

示例11: AeDoOneOverride

static void
AeDoOneOverride (
    char                    *Pathname,
    char                    *ValueString,
    ACPI_OPERAND_OBJECT     *ObjDesc,
    ACPI_WALK_STATE         *WalkState)
{
    ACPI_HANDLE             Handle;
    ACPI_STATUS             Status;
    UINT64                  Value;


    AcpiOsPrintf ("Value Override: %s, ", Pathname);

    /*
     * Get the namespace node associated with the override
     * pathname from the init file.
     */
    Status = AcpiGetHandle (NULL, Pathname, &Handle);
    if (ACPI_FAILURE (Status))
    {
        AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
        return;
    }

    /* Extract the 64-bit integer */

    Status = AcpiUtStrtoul64 (ValueString,
        (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &Value);
    if (ACPI_FAILURE (Status))
    {
        AcpiOsPrintf ("%s %s\n", ValueString,
            AcpiFormatException (Status));
        return;
    }

    ObjDesc->Integer.Value = Value;

    /*
     * At the point this function is called, the namespace is fully
     * built and initialized. We can simply store the new object to
     * the target node.
     */
    AcpiExEnterInterpreter ();
    Status = AcpiExStore (ObjDesc, Handle, WalkState);
    AcpiExExitInterpreter ();

    if (ACPI_FAILURE (Status))
    {
        AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
        return;
    }

    AcpiOsPrintf ("New value: 0x%8.8X%8.8X\n",
        ACPI_FORMAT_UINT64 (Value));
}
开发者ID:ColinIanKing,项目名称:acpica,代码行数:56,代码来源:aeinitfile.c

示例12: GetLnkInfo

void
GetLnkInfo (char *lnkname, pci_irq_t *irq)
{
  ACPI_HANDLE Handle;
  ACPI_STATUS Status;

  Status = AcpiGetHandle (NULL, lnkname, &Handle);
  if (ACPI_SUCCESS (Status)) {
    AcpiWalkResources (Handle, "_CRS", GetLnkIrq, (void *) irq);
  }
}
开发者ID:missimer,项目名称:quest-edison,代码行数:11,代码来源:acpi.c

示例13: AcpiDbCreateExecutionThread

void
AcpiDbCreateExecutionThread (
    char                    *MethodNameArg,
    char                    **Arguments,
    ACPI_OBJECT_TYPE        *Types)
{
    ACPI_STATUS             Status;
    UINT32                  i;


    memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
    AcpiGbl_DbMethodInfo.Name = MethodNameArg;
    AcpiGbl_DbMethodInfo.InitArgs = 1;
    AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments;
    AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes;

    /* Setup method arguments, up to 7 (0-6) */

    for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *Arguments; i++)
    {
        AcpiGbl_DbMethodInfo.Arguments[i] = *Arguments;
        Arguments++;

        AcpiGbl_DbMethodInfo.ArgTypes[i] = *Types;
        Types++;
    }

    Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
    if (ACPI_FAILURE (Status))
    {
        return;
    }

    /* Get the NS node, determines existence also */

    Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
        &AcpiGbl_DbMethodInfo.Method);
    if (ACPI_FAILURE (Status))
    {
        AcpiOsPrintf ("%s Could not get handle for %s\n",
            AcpiFormatException (Status), AcpiGbl_DbMethodInfo.Pathname);
        return;
    }

    Status = AcpiOsExecute (OSL_DEBUGGER_EXEC_THREAD,
        AcpiDbSingleExecutionThread, &AcpiGbl_DbMethodInfo);
    if (ACPI_FAILURE (Status))
    {
        return;
    }

    AcpiOsPrintf ("\nBackground thread started\n");
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:53,代码来源:dbexec.c

示例14: get_object_type

uint32
get_object_type(const char* path)
{
    ACPI_HANDLE handle;
    ACPI_OBJECT_TYPE type;

    if (AcpiGetHandle(NULL, (ACPI_STRING)path, &handle) != AE_OK)
        return B_ENTRY_NOT_FOUND;

    AcpiGetType(handle, &type);
    return type;
}
开发者ID:simonsouth,项目名称:haiku,代码行数:12,代码来源:BusManager.cpp

示例15: acpi_dock_eject_children

static void
acpi_dock_eject_children(device_t dev)
{
	ACPI_HANDLE	sb_handle;
	ACPI_STATUS	status;

	status = AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle);
	if (ACPI_SUCCESS(status)) {
		AcpiWalkNamespace(ACPI_TYPE_DEVICE, sb_handle,
		    100, acpi_dock_eject_child, &dev, NULL);
	}
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:12,代码来源:acpi_dock.c


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