这篇教程C++ AcpiUtGetRegionName函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AcpiUtGetRegionName函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiUtGetRegionName函数的具体用法?C++ AcpiUtGetRegionName怎么用?C++ AcpiUtGetRegionName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AcpiUtGetRegionName函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: AcpiDbDisplayNonRootHandlersstatic ACPI_STATUSAcpiDbDisplayNonRootHandlers ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue){ ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; char *Pathname; ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { return (AE_OK); } Pathname = AcpiNsGetNormalizedPathname (Node, TRUE); if (!Pathname) { return (AE_OK); } /* Display all handlers associated with this device */ HandlerObj = ObjDesc->Device.Handler; while (HandlerObj) { AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetRegionName ((UINT8) HandlerObj->AddressSpace.SpaceId), HandlerObj->AddressSpace.SpaceId); AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING2, (HandlerObj->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", HandlerObj->AddressSpace.Handler); AcpiOsPrintf (" Device Name: %s (%p)/n", Pathname, Node); HandlerObj = HandlerObj->AddressSpace.Next; } ACPI_FREE (Pathname); return (AE_OK);}
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:47,
示例2: AcpiHwWriteACPI_STATUSAcpiHwWrite ( UINT32 Value, ACPI_GENERIC_ADDRESS *Reg){ UINT64 Address; ACPI_STATUS Status; ACPI_FUNCTION_NAME (HwWrite); /* Validate contents of the GAS register */ Status = AcpiHwValidateRegister (Reg, 32, &Address); if (ACPI_FAILURE (Status)) { return (Status); } /* * Two address spaces supported: Memory or IO. PCI_Config is * not supported here because the GAS structure is insufficient */ if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) Address, (UINT64) Value, Reg->BitWidth); } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address, Value, Reg->BitWidth); } ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)/n", Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status);}
开发者ID:victoredwardocallaghan,项目名称:DragonFlyBSD,代码行数:42,
示例3: AcpiDbTestOneObject//.........这里部分代码省略......... */ BitLength = ObjDesc->CommonField.BitLength; ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength); if (BitLength > AcpiGbl_IntegerBitWidth) { LocalType = ACPI_TYPE_BUFFER; } } break; default: /* Ignore all other types */ return (AE_OK); } /* Emit the common prefix: Type:Name */ AcpiOsPrintf ("%14s: %4.4s", AcpiUtGetTypeName (Node->Type), Node->Name.Ascii); if (!ObjDesc) { AcpiOsPrintf (" Ignoring, no attached object/n"); return (AE_OK); } /* * Check for unsupported region types. Note: AcpiExec simulates * access to SystemMemory, SystemIO, PCI_Config, and EC. */ switch (Node->Type) { case ACPI_TYPE_LOCAL_REGION_FIELD: RegionObj = ObjDesc->Field.RegionObj; switch (RegionObj->Region.SpaceId) { case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_PCI_CONFIG: case ACPI_ADR_SPACE_EC: break; default: AcpiOsPrintf (" %s space is not supported [%4.4s]/n", AcpiUtGetRegionName (RegionObj->Region.SpaceId), RegionObj->Region.Node->Name.Ascii); return (AE_OK); } break; default: break; } /* At this point, we have resolved the object to one of the major types */ switch (LocalType) { case ACPI_TYPE_INTEGER: Status = AcpiDbTestIntegerType (Node, BitLength); break; case ACPI_TYPE_STRING: Status = AcpiDbTestStringType (Node, ByteLength); break; case ACPI_TYPE_BUFFER: Status = AcpiDbTestBufferType (Node, BitLength); break; default: AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)", LocalType); break; } switch (Node->Type) { case ACPI_TYPE_LOCAL_REGION_FIELD: RegionObj = ObjDesc->Field.RegionObj; AcpiOsPrintf (" (%s)", AcpiUtGetRegionName (RegionObj->Region.SpaceId)); break; default: break; } AcpiOsPrintf ("/n"); return (Status);}
开发者ID:fjdoria76,项目名称:acpica,代码行数:101,
示例4: AcpiEvAddressSpaceDispatchACPI_STATUSAcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *RegionObj, UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, UINT64 *Value){ ACPI_STATUS Status; ACPI_ADR_SPACE_HANDLER Handler; ACPI_ADR_SPACE_SETUP RegionSetup; ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *RegionObj2; void *RegionContext = NULL; ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch); RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { return_ACPI_STATUS (AE_NOT_EXIST); } /* Ensure that there is a handler associated with this region */ HandlerDesc = RegionObj->Region.Handler; if (!HandlerDesc) { ACPI_ERROR ((AE_INFO, "No handler for Region [%4.4s] (%p) [%s]", AcpiUtGetNodeName (RegionObj->Region.Node), RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_NOT_EXIST); } /* * It may be the case that the region has never been initialized. * Some types of regions require special init code */ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { /* This region has not been initialized yet, do it */ RegionSetup = HandlerDesc->AddressSpace.Setup; if (!RegionSetup) { /* No initialization routine, exit with error */ ACPI_ERROR ((AE_INFO, "No init routine for region(%p) [%s]", RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_NOT_EXIST); } /* * We must exit the interpreter because the region setup will * potentially execute control methods (for example, the _REG method * for this region) */ AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, HandlerDesc->AddressSpace.Context, &RegionContext); /* Re-enter the interpreter */ AcpiExEnterInterpreter (); /* Check for failure of the Region Setup */ if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During region initialization: [%s]", AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (Status); } /* Region initialization may have been completed by RegionSetup */ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; if (RegionObj2->Extra.RegionContext) { /* The handler for this region was already installed */ ACPI_FREE (RegionContext); } else { /* * Save the returned context for use in all accesses to * this particular region */ RegionObj2->Extra.RegionContext = RegionContext;//.........这里部分代码省略.........
开发者ID:animotron,项目名称:animos,代码行数:101,
示例5: AcpiHwWriteACPI_STATUSAcpiHwWrite ( UINT64 Value, ACPI_GENERIC_ADDRESS *Reg){ UINT64 Address; UINT8 AccessWidth; UINT32 BitWidth; UINT8 BitOffset; UINT64 Value64; UINT8 Index; ACPI_STATUS Status; ACPI_FUNCTION_NAME (HwWrite); /* Validate contents of the GAS register */ Status = AcpiHwValidateRegister (Reg, 64, &Address); if (ACPI_FAILURE (Status)) { return (Status); } /* Convert AccessWidth into number of bits based */ AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 64); BitWidth = Reg->BitOffset + Reg->BitWidth; BitOffset = Reg->BitOffset; /* * Two address spaces supported: Memory or IO. PCI_Config is * not supported here because the GAS structure is insufficient */ Index = 0; while (BitWidth) { /* * Use offset style bit reads because "Index * AccessWidth" is * ensured to be less than 64-bits by AcpiHwValidateRegister(). */ Value64 = ACPI_GET_BITS (&Value, Index * AccessWidth, ACPI_MASK_BITS_ABOVE_64 (AccessWidth)); if (BitOffset >= AccessWidth) { BitOffset -= AccessWidth; } else { if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), Value64, AccessWidth); } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), (UINT32) Value64, AccessWidth); } } /* * Index * AccessWidth is ensured to be less than 32-bits by * AcpiHwValidateRegister(). */ BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth; Index++; } ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)/n", ACPI_FORMAT_UINT64 (Value), AccessWidth, ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status);}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:80,
示例6: AcpiExAccessRegionACPI_STATUSAcpiExAccessRegion ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, UINT64 *Value, UINT32 Function){ ACPI_STATUS Status; ACPI_OPERAND_OBJECT *RgnDesc; UINT32 RegionOffset; ACPI_FUNCTION_TRACE (ExAccessRegion); /* * Ensure that the region operands are fully evaluated and verify * the validity of the request */ Status = AcpiExSetupRegion (ObjDesc, FieldDatumByteOffset); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* * The physical address of this field datum is: * * 1) The base of the region, plus * 2) The base offset of the field, plus * 3) The current offset into the field */ RgnDesc = ObjDesc->CommonField.RegionObj; RegionOffset = ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset; if ((Function & ACPI_IO_MASK) == ACPI_READ) { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); } else { ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD, " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X/n", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId, ObjDesc->CommonField.AccessByteWidth, ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, ACPI_FORMAT_UINT64 (RgnDesc->Region.Address + RegionOffset))); /* Invoke the appropriate AddressSpace/OpRegion handler */ Status = AcpiEvAddressSpaceDispatch (RgnDesc, ObjDesc, Function, RegionOffset, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_IMPLEMENTED) { ACPI_ERROR ((AE_INFO, "Region %s (ID=%u) not implemented", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } else if (Status == AE_NOT_EXIST) { ACPI_ERROR ((AE_INFO, "Region %s (ID=%u) has no handler", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } } return_ACPI_STATUS (Status);}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:81,
示例7: AcpiEvAddressSpaceDispatchACPI_STATUSAcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *RegionObj, ACPI_OPERAND_OBJECT *FieldObj, UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, UINT64 *Value){ ACPI_STATUS Status; ACPI_ADR_SPACE_HANDLER Handler; ACPI_ADR_SPACE_SETUP RegionSetup; ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *RegionObj2; void *RegionContext = NULL; ACPI_CONNECTION_INFO *Context; ACPI_PHYSICAL_ADDRESS Address; ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch); RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { return_ACPI_STATUS (AE_NOT_EXIST); } /* Ensure that there is a handler associated with this region */ HandlerDesc = RegionObj->Region.Handler; if (!HandlerDesc) { ACPI_ERROR ((AE_INFO, "No handler for Region [%4.4s] (%p) [%s]", AcpiUtGetNodeName (RegionObj->Region.Node), RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_NOT_EXIST); } Context = HandlerDesc->AddressSpace.Context; /* * It may be the case that the region has never been initialized. * Some types of regions require special init code */ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { /* This region has not been initialized yet, do it */ RegionSetup = HandlerDesc->AddressSpace.Setup; if (!RegionSetup) { /* No initialization routine, exit with error */ ACPI_ERROR ((AE_INFO, "No init routine for region(%p) [%s]", RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_NOT_EXIST); } /* * We must exit the interpreter because the region setup will * potentially execute control methods (for example, the _REG method * for this region) */ AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, Context, &RegionContext); /* Re-enter the interpreter */ AcpiExEnterInterpreter (); /* Check for failure of the Region Setup */ if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During region initialization: [%s]", AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (Status); } /* Region initialization may have been completed by RegionSetup */ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; /* * Save the returned context for use in all accesses to * the handler for this particular region */ if (!(RegionObj2->Extra.RegionContext)) { RegionObj2->Extra.RegionContext = RegionContext; }//.........这里部分代码省略.........
开发者ID:JasonFord53,项目名称:freebsd,代码行数:101,
示例8: AcpiInstallAddressSpaceHandler//.........这里部分代码省略......... /* * Move through the linked list of handlers */ HandlerObj = HandlerObj->AddrHandler.Next; } } else { ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Creating object on Device %p while installing handler/n", Node)); /* ObjDesc does not exist, create one */ if (Node->Type == ACPI_TYPE_ANY) { Type = ACPI_TYPE_DEVICE; } else { Type = Node->Type; } ObjDesc = AcpiUtCreateInternalObject (Type); if (!ObjDesc) { Status = AE_NO_MEMORY; goto UnlockAndExit; } /* Init new descriptor */ ObjDesc->Common.Type = (UINT8) Type; /* Attach the new object to the Node */ Status = AcpiNsAttachObject (Node, ObjDesc, Type); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); goto UnlockAndExit; } } ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Installing address handler for region %s(%X) on Device %4.4s %p(%p)/n", AcpiUtGetRegionName (SpaceId), SpaceId, Node->Name.Ascii, Node, ObjDesc)); /* * Now we can install the handler * * At this point we know that there is no existing handler. * So, we just allocate the object for the handler and link it * into the list. */ HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER); if (!HandlerObj) { Status = AE_NO_MEMORY; goto UnlockAndExit; } HandlerObj->AddrHandler.SpaceId = (UINT8) SpaceId; HandlerObj->AddrHandler.Hflags = Flags; HandlerObj->AddrHandler.Next = ObjDesc->Device.AddrHandler; HandlerObj->AddrHandler.RegionList = NULL; HandlerObj->AddrHandler.Node = Node; HandlerObj->AddrHandler.Handler = Handler; HandlerObj->AddrHandler.Context = Context; HandlerObj->AddrHandler.Setup = Setup; /* * Now walk the namespace finding all of the regions this * handler will manage. * * We start at the device and search the branch toward * the leaf nodes until either the leaf is encountered or * a device is detected that has an address handler of the * same type. * * In either case we back up and search down the remainder * of the branch */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Device, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvAddrHandlerHelper, HandlerObj, NULL); /* * Place this handler 1st on the list */ HandlerObj->Common.ReferenceCount = (UINT16) (HandlerObj->Common.ReferenceCount + ObjDesc->Common.ReferenceCount - 1); ObjDesc->Device.AddrHandler = HandlerObj;UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:101,
示例9: AcpiEvInstallHandlerstatic ACPI_STATUSAcpiEvInstallHandler ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue){ ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *NextHandlerObj; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_FUNCTION_NAME (EvInstallHandler); HandlerObj = (ACPI_OPERAND_OBJECT *) Context; /* Parameter validation */ if (!HandlerObj) { return (AE_OK); } /* Convert and validate the device handle */ Node = AcpiNsValidateHandle (ObjHandle); if (!Node) { return (AE_BAD_PARAMETER); } /* * We only care about regions and objects that are allowed to have * address space handlers */ if ((Node->Type != ACPI_TYPE_DEVICE) && (Node->Type != ACPI_TYPE_REGION) && (Node != AcpiGbl_RootNode)) { return (AE_OK); } /* Check for an existing internal object */ ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { /* No object, just exit */ return (AE_OK); } /* Devices are handled different than regions */ if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE) { /* Check if this Device already has a handler for this address space */ NextHandlerObj = AcpiEvFindRegionHandler ( HandlerObj->AddressSpace.SpaceId, ObjDesc->CommonNotify.Handler); if (NextHandlerObj) { /* Found a handler, is it for the same address space? */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Found handler for region [%s] in device %p(%p) handler %p/n", AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId), ObjDesc, NextHandlerObj, HandlerObj)); /* * Since the object we found it on was a device, then it means * that someone has already installed a handler for the branch * of the namespace from this device on. Just bail out telling * the walk routine to not traverse this branch. This preserves * the scoping rule for handlers. */ return (AE_CTRL_DEPTH); } /* * As long as the device didn't have a handler for this space we * don't care about it. We just ignore it and proceed. */ return (AE_OK); } /* Object is a Region */ if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId) { /* This region is for a different address space, just ignore it */ return (AE_OK); } /* * Now we have a region and it is for the handler's address space type.//.........这里部分代码省略.........
开发者ID:tomtor,项目名称:freebsd,代码行数:101,
示例10: AcpiHwReadACPI_STATUSAcpiHwRead ( UINT32 *Value, ACPI_GENERIC_ADDRESS *Reg){ UINT64 Address; UINT8 AccessWidth; UINT32 BitWidth; UINT8 BitOffset; UINT64 Value64; UINT32 Value32; UINT8 Index; ACPI_STATUS Status; ACPI_FUNCTION_NAME (HwRead); /* Validate contents of the GAS register */ Status = AcpiHwValidateRegister (Reg, 32, &Address); if (ACPI_FAILURE (Status)) { return (Status); } /* * Initialize entire 32-bit return value to zero, convert AccessWidth * into number of bits based */ *Value = 0; AccessWidth = Reg->AccessWidth ? Reg->AccessWidth : 1; AccessWidth = 1 << (AccessWidth + 2); BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth); BitOffset = Reg->BitOffset; /* * Two address spaces supported: Memory or IO. PCI_Config is * not supported here because the GAS structure is insufficient */ Index = 0; while (BitWidth) { if (BitOffset > AccessWidth) { Value32 = 0; BitOffset -= AccessWidth; } else { if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), &Value64, AccessWidth); Value32 = (UINT32) Value64; } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), &Value32, AccessWidth); } if (BitOffset) { Value32 &= ACPI_MASK_BITS_BELOW (BitOffset); BitOffset = 0; } if (BitWidth < AccessWidth) { Value32 &= ACPI_MASK_BITS_ABOVE (BitWidth); } } ACPI_SET_BITS (Value, Index * AccessWidth, ((1 << AccessWidth) - 1), Value32); BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth; Index++; } ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)/n", *Value, AccessWidth, ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status);}
开发者ID:alex1818,项目名称:fwts,代码行数:89,
示例11: AcpiHwWrite//.........这里部分代码省略......... * Two address spaces supported: Memory or IO. PCI_Config is * not supported here because the GAS structure is insufficient */ Index = 0; while (BitWidth) { NewValue32 = ACPI_GET_BITS (&Value, (Index * AccessWidth), ((1 << AccessWidth) - 1)); if (BitOffset > AccessWidth) { BitOffset -= AccessWidth; } else { if (BitOffset) { NewValue32 &= ACPI_MASK_BITS_BELOW (BitOffset); } if (BitWidth < AccessWidth) { NewValue32 &= ACPI_MASK_BITS_ABOVE (BitWidth); } if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { if (BitOffset || BitWidth < AccessWidth) { /* * Read old values in order not to modify the bits that * are beyond the register BitWidth/BitOffset setting. */ Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), &Value64, AccessWidth); OldValue32 = (UINT32) Value64; if (BitOffset) { OldValue32 &= ACPI_MASK_BITS_ABOVE (BitOffset + 1); BitOffset = 0; } if (BitWidth < AccessWidth) { OldValue32 &= ACPI_MASK_BITS_BELOW (BitWidth - 1); } NewValue32 |= OldValue32; } Value64 = (UINT64) NewValue32; Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), Value64, AccessWidth); } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { if (BitOffset || BitWidth < AccessWidth) { /* * Read old values in order not to modify the bits that * are beyond the register BitWidth/BitOffset setting. */ Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), &OldValue32, AccessWidth); if (BitOffset) { OldValue32 &= ACPI_MASK_BITS_ABOVE (BitOffset + 1); BitOffset = 0; } if (BitWidth < AccessWidth) { OldValue32 &= ACPI_MASK_BITS_BELOW (BitWidth - 1); } NewValue32 |= OldValue32; } Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), NewValue32, AccessWidth); } } BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth; Index++; } ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)/n", Value, AccessWidth, ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status);}
开发者ID:alex1818,项目名称:fwts,代码行数:101,
示例12: AcpiEvAddrHandlerHelperACPI_STATUSAcpiEvAddrHandlerHelper ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue){ ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *TmpObj; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_FUNCTION_NAME ("EvAddrHandlerHelper"); HandlerObj = (ACPI_OPERAND_OBJECT *) Context; /* Parameter validation */ if (!HandlerObj) { return (AE_OK); } /* Convert and validate the device handle */ Node = AcpiNsMapHandleToNode (ObjHandle); if (!Node) { return (AE_BAD_PARAMETER); } /* * We only care about regions.and objects * that can have address handlers */ if ((Node->Type != ACPI_TYPE_DEVICE) && (Node->Type != ACPI_TYPE_REGION) && (Node != AcpiGbl_RootNode)) { return (AE_OK); } /* Check for an existing internal object */ ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { /* * The object DNE, we don't care about it */ return (AE_OK); } /* * Devices are handled different than regions */ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_DEVICE) { /* * See if this guy has any handlers */ TmpObj = ObjDesc->Device.AddrHandler; while (TmpObj) { /* * Now let's see if it's for the same address space. */ if (TmpObj->AddrHandler.SpaceId == HandlerObj->AddrHandler.SpaceId) { /* * It's for the same address space */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Found handler for region [%s] in device %p(%p) handler %p/n", AcpiUtGetRegionName (HandlerObj->AddrHandler.SpaceId), ObjDesc, TmpObj, HandlerObj)); /* * Since the object we found it on was a device, then it * means that someone has already installed a handler for * the branch of the namespace from this device on. Just * bail out telling the walk routine to not traverse this * branch. This preserves the scoping rule for handlers. */ return (AE_CTRL_DEPTH); } /* * Move through the linked list of handlers */ TmpObj = TmpObj->AddrHandler.Next; } /* * As long as the device didn't have a handler for this * space we don't care about it. We just ignore it and * proceed.//.........这里部分代码省略.........
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:101,
示例13: AcpiEvDetachRegionvoidAcpiEvDetachRegion( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked){ ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_ADR_SPACE_SETUP RegionSetup; void *RegionContext; ACPI_OPERAND_OBJECT *RegionObj2; ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("EvDetachRegion"); RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { return_VOID; } RegionContext = RegionObj2->Extra.RegionContext; /* * Get the address handler from the region object */ HandlerObj = RegionObj->Region.AddrHandler; if (!HandlerObj) { /* * This region has no handler, all done */ return_VOID; } /* * Find this region in the handler's list */ ObjDesc = HandlerObj->AddrHandler.RegionList; LastObjPtr = &HandlerObj->AddrHandler.RegionList; while (ObjDesc) { /* * See if this is the one */ if (ObjDesc == RegionObj) { ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Removing Region %p from address handler %p/n", RegionObj, HandlerObj)); /* * This is it, remove it from the handler's list */ *LastObjPtr = ObjDesc->Region.Next; ObjDesc->Region.Next = NULL; /* Must clear field */ if (AcpiNsIsLocked) { Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_VOID; } } /* * Now stop region accesses by executing the _REG method */ Status = AcpiEvExecuteRegMethod (RegionObj, 0); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]/n", AcpiFormatException (Status), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); } if (AcpiNsIsLocked) { Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_VOID; } } /* * Call the setup handler with the deactivate notification */ RegionSetup = HandlerObj->AddrHandler.Setup; Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE, HandlerObj->AddrHandler.Context, &RegionContext); /* * Init routine may fail, Just ignore errors */ if (ACPI_FAILURE (Status)) {//.........这里部分代码省略.........
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:101,
示例14: AcpiEvAddressSpaceDispatchACPI_STATUSAcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *RegionObj, UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, void *Value){ ACPI_STATUS Status; ACPI_STATUS Status2; ACPI_ADR_SPACE_HANDLER Handler; ACPI_ADR_SPACE_SETUP RegionSetup; ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *RegionObj2; void *RegionContext = NULL; ACPI_FUNCTION_TRACE ("EvAddressSpaceDispatch"); RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { return_ACPI_STATUS (AE_NOT_EXIST); } /* * Ensure that there is a handler associated with this region */ HandlerDesc = RegionObj->Region.AddrHandler; if (!HandlerDesc) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "no handler for region(%p) [%s]/n", RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_NOT_EXIST); } /* * It may be the case that the region has never been initialized * Some types of regions require special init code */ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { /* * This region has not been initialized yet, do it */ RegionSetup = HandlerDesc->AddrHandler.Setup; if (!RegionSetup) { /* * Bad news, no init routine and not init'd */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]/n", RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_UNKNOWN_STATUS); } /* * We must exit the interpreter because the region setup will potentially * execute control methods */ AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, HandlerDesc->AddrHandler.Context, &RegionContext); /* Re-enter the interpreter */ Status2 = AcpiExEnterInterpreter (); if (ACPI_FAILURE (Status2)) { return_ACPI_STATUS (Status2); } /* * Init routine may fail */ if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]/n", AcpiFormatException (Status), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (Status); } RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; /* * Save the returned context for use in all accesses to * this particular region. */ RegionObj2->Extra.RegionContext = RegionContext; } /* * We have everything we need, begin the process */ Handler = HandlerDesc->AddrHandler.Handler;//.........这里部分代码省略.........
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:101,
示例15: AcpiEvInitializeRegion//.........这里部分代码省略......... RegionObj2->Extra.Method_REG = MethodNode; } /* * The following loop depends upon the root Node having no parent * ie: AcpiGbl_RootNode->ParentEntry being set to NULL */ while (Node) { /* Check to see if a handler exists */ HandlerObj = NULL; ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) { /* Can only be a handler if the object exists */ switch (Node->Type) { case ACPI_TYPE_DEVICE: HandlerObj = ObjDesc->Device.Handler; break; case ACPI_TYPE_PROCESSOR: HandlerObj = ObjDesc->Processor.Handler; break; case ACPI_TYPE_THERMAL: HandlerObj = ObjDesc->ThermalZone.Handler; break; default: /* Ignore other objects */ break; } while (HandlerObj) { /* Is this handler of the correct type? */ if (HandlerObj->AddressSpace.SpaceId == SpaceId) { /* Found correct handler */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Found handler %p for region %p in obj %p/n", HandlerObj, RegionObj, ObjDesc)); Status = AcpiEvAttachRegion (HandlerObj, RegionObj, AcpiNsLocked); /* * Tell all users that this region is usable by * running the _REG method */ if (AcpiNsLocked) { Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } Status = AcpiEvExecuteRegMethod (RegionObj, 1); if (AcpiNsLocked) { Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } return_ACPI_STATUS (AE_OK); } /* Try next handler in the list */ HandlerObj = HandlerObj->AddressSpace.Next; } } /* This node does not have the handler we need; Pop up one level */ Node = AcpiNsGetParentNode (Node); } /* If we get here, there is no handler for this region */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "No handler for RegionType %s(%X) (RegionObj %p)/n", AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj)); return_ACPI_STATUS (AE_NOT_EXIST);}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:101,
示例16: AcpiRemoveAddressSpaceHandlerACPI_STATUSAcpiRemoveAddressSpaceHandler ( ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler){ ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *RegionObj; ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("AcpiRemoveAddressSpaceHandler"); /* Parameter validation */ if (!Device) { return_ACPI_STATUS (AE_BAD_PARAMETER); } Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Convert and validate the device handle */ Node = AcpiNsMapHandleToNode (Device); if (!Node) { Status = AE_BAD_PARAMETER; goto UnlockAndExit; } /* Make sure the internal object exists */ ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { Status = AE_NOT_EXIST; goto UnlockAndExit; } /* * find the address handler the user requested */ HandlerObj = ObjDesc->Device.AddrHandler; LastObjPtr = &ObjDesc->Device.AddrHandler; while (HandlerObj) { /* * We have a handler, see if user requested this one */ if (HandlerObj->AddrHandler.SpaceId == SpaceId) { /* * Got it, first dereference this in the Regions */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Removing address handler %p(%p) for region %s on Device %p(%p)/n", HandlerObj, Handler, AcpiUtGetRegionName (SpaceId), Node, ObjDesc)); RegionObj = HandlerObj->AddrHandler.RegionList; /* Walk the handler's region list */ while (RegionObj) { /* * First disassociate the handler from the region. * * NOTE: this doesn't mean that the region goes away * The region is just inaccessible as indicated to * the _REG method */ AcpiEvDetachRegion (RegionObj, TRUE); /* * Walk the list, since we took the first region and it * was removed from the list by the dissassociate call * we just get the first item on the list again */ RegionObj = HandlerObj->AddrHandler.RegionList; } /* * Remove this Handler object from the list */ *LastObjPtr = HandlerObj->AddrHandler.Next; /* * Now we can delete the handler object *///.........这里部分代码省略.........
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:101,
示例17: AcpiNsDumpOneObject//.........这里部分代码省略......... if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf ("Len %.2X", ObjDesc->Buffer.Length); /* Dump some of the buffer */ if (ObjDesc->Buffer.Length > 0) { AcpiOsPrintf (" ="); for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) { AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]); } } AcpiOsPrintf ("/n"); } else { AcpiOsPrintf ("[Length not yet evaluated]/n"); } break; case ACPI_TYPE_STRING: AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); AcpiUtPrintString (ObjDesc->String.Pointer, 80); AcpiOsPrintf ("/n"); break; case ACPI_TYPE_REGION: AcpiOsPrintf ("[%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X/n", ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length); } else { AcpiOsPrintf (" [Address/Length not yet evaluated]/n"); } break; case ACPI_TYPE_LOCAL_REFERENCE: AcpiOsPrintf ("[%s]/n", AcpiUtGetReferenceName (ObjDesc)); break; case ACPI_TYPE_BUFFER_FIELD: if (ObjDesc->BufferField.BufferObj && ObjDesc->BufferField.BufferObj->Buffer.Node) { AcpiOsPrintf ("Buf [%4.4s]", AcpiUtGetNodeName ( ObjDesc->BufferField.BufferObj->Buffer.Node)); } break; case ACPI_TYPE_LOCAL_REGION_FIELD: AcpiOsPrintf ("Rgn [%4.4s]", AcpiUtGetNodeName (
开发者ID:RehabMan,项目名称:Intel-iasl,代码行数:67,
示例18: AeInstallHandlersACPI_STATUSAeInstallHandlers (void){ ACPI_STATUS Status; UINT32 i; ACPI_HANDLE Handle; ACPI_FUNCTION_ENTRY (); Status = AcpiInstallTableHandler (AeTableHandler, NULL); if (ACPI_FAILURE (Status)) { printf ("Could not install table handler, %s/n", AcpiFormatException (Status)); } Status = AcpiInstallExceptionHandler (AeExceptionHandler); if (ACPI_FAILURE (Status)) { printf ("Could not install exception handler, %s/n", AcpiFormatException (Status)); } /* Install global notify handler */ Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, AeNotifyHandler, NULL); if (ACPI_FAILURE (Status)) { printf ("Could not install a global notify handler, %s/n", AcpiFormatException (Status)); } Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_DEVICE_NOTIFY, AeDeviceNotifyHandler, NULL); if (ACPI_FAILURE (Status)) { printf ("Could not install a global notify handler, %s/n", AcpiFormatException (Status)); } Status = AcpiGetHandle (NULL, "//_SB", &Handle); if (ACPI_SUCCESS (Status)) { Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, AeNotifyHandler, NULL); if (ACPI_FAILURE (Status)) { printf ("Could not install a notify handler, %s/n", AcpiFormatException (Status)); } Status = AcpiRemoveNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, AeNotifyHandler); if (ACPI_FAILURE (Status)) { printf ("Could not remove a notify handler, %s/n", AcpiFormatException (Status)); } Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler, NULL); Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler); Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, AeNotifyHandler, NULL); if (ACPI_FAILURE (Status)) { printf ("Could not install a notify handler, %s/n", AcpiFormatException (Status)); } Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); Status = AcpiDetachData (Handle, AeAttachedDataHandler); Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); } else { printf ("No _SB_ found, %s/n", AcpiFormatException (Status)); } /* Set a handler for all supported operation regions */ for (i = 0; i < AEXEC_NUM_REGIONS; i++) { Status = AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode, SpaceId[i], AeRegionHandler); /* Install handler at the root object. * TBD: all default handlers should be installed here! */ Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, SpaceId[i], AeRegionHandler, AeRegionInit, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not install an OpRegion handler for %s space(%u)", AcpiUtGetRegionName((UINT8) SpaceId[i]), SpaceId[i]));//.........这里部分代码省略.........
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:101,
示例19: AcpiEvInstallSpaceHandler//.........这里部分代码省略......... } } else { ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Creating object on Device %p while installing handler/n", Node)); /* ObjDesc does not exist, create one */ if (Node->Type == ACPI_TYPE_ANY) { Type = ACPI_TYPE_DEVICE; } else { Type = Node->Type; } ObjDesc = AcpiUtCreateInternalObject (Type); if (!ObjDesc) { Status = AE_NO_MEMORY; goto UnlockAndExit; } /* Init new descriptor */ ObjDesc->Common.Type = (UINT8) Type; /* Attach the new object to the Node */ Status = AcpiNsAttachObject (Node, ObjDesc, Type); /* Remove local reference to the object */ AcpiUtRemoveReference (ObjDesc); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } } ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Installing address handler for region %s(%X) " "on Device %4.4s %p(%p)/n", AcpiUtGetRegionName (SpaceId), SpaceId, AcpiUtGetNodeName (Node), Node, ObjDesc)); /* * Install the handler * * At this point there is no existing handler. Just allocate the object * for the handler and link it into the list. */ HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER); if (!HandlerObj) { Status = AE_NO_MEMORY; goto UnlockAndExit; } /* Init handler obj */ HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId; HandlerObj->AddressSpace.HandlerFlags = Flags; HandlerObj->AddressSpace.RegionList = NULL; HandlerObj->AddressSpace.Node = Node; HandlerObj->AddressSpace.Handler = Handler; HandlerObj->AddressSpace.Context = Context; HandlerObj->AddressSpace.Setup = Setup; /* Install at head of Device.AddressSpace list */ HandlerObj->AddressSpace.Next = ObjDesc->CommonNotify.Handler; /* * The Device object is the first reference on the HandlerObj. * Each region that uses the handler adds a reference. */ ObjDesc->CommonNotify.Handler = HandlerObj; /* * Walk the namespace finding all of the regions this handler will * manage. * * Start at the device and search the branch toward the leaf nodes * until either the leaf is encountered or a device is detected that * has an address handler of the same type. * * In either case, back up and search down the remainder of the branch */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler, NULL, HandlerObj, NULL);UnlockAndExit: return_ACPI_STATUS (Status);}
开发者ID:tomtor,项目名称:freebsd,代码行数:101,
示例20: AeRegionHandlerACPI_STATUSAeRegionHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, UINT64 *Value, void *HandlerContext, void *RegionContext){ ACPI_OPERAND_OBJECT *RegionObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, RegionContext); UINT8 *Buffer = ACPI_CAST_PTR (UINT8, Value); ACPI_PHYSICAL_ADDRESS BaseAddress; ACPI_SIZE Length; BOOLEAN BufferExists; AE_REGION *RegionElement; void *BufferValue; ACPI_STATUS Status; UINT32 ByteWidth; UINT32 i; UINT8 SpaceId; ACPI_FUNCTION_NAME (AeRegionHandler); /* * If the object is not a region, simply return */ if (RegionObject->Region.Type != ACPI_TYPE_REGION) { return AE_OK; } /* * Region support can be disabled with the -r option. * We use this to support dynamically loaded tables where we pass a valid * address to the AML. */ if (AcpiGbl_DbOpt_NoRegionSupport) { BufferValue = ACPI_TO_POINTER (Address); ByteWidth = (BitWidth / 8); if (BitWidth % 8) { ByteWidth += 1; } goto DoFunction; } /* * Find the region's address space and length before searching * the linked list. */ BaseAddress = RegionObject->Region.Address; Length = (ACPI_SIZE) RegionObject->Region.Length; SpaceId = RegionObject->Region.SpaceId; ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Operation Region request on %s at 0x%X/n", AcpiUtGetRegionName (RegionObject->Region.SpaceId), (UINT32) Address)); switch (SpaceId) { case ACPI_ADR_SPACE_SYSTEM_IO: /* * For I/O space, exercise the port validation */ switch (Function & ACPI_IO_MASK) { case ACPI_READ: Status = AcpiHwReadPort (Address, (UINT32 *) Value, BitWidth); break; case ACPI_WRITE: Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth); break; default: Status = AE_BAD_PARAMETER; break; } if (ACPI_FAILURE (Status)) { return (Status); } /* Now go ahead and simulate the hardware */ break; case ACPI_ADR_SPACE_SMBUS: Length = 0; switch (Function & ACPI_IO_MASK) { case ACPI_READ: switch (Function >> 16)//.........这里部分代码省略.........
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:101,
示例21: AcpiEvInitializeRegion//.........这里部分代码省略......... Node = RegionObj->Region.Node->Parent; SpaceId = RegionObj->Region.SpaceId; /* * The following loop depends upon the root Node having no parent * ie: AcpiGbl_RootNode->Parent being set to NULL */ while (Node) { /* Check to see if a handler exists */ HandlerObj = NULL; ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) { /* Can only be a handler if the object exists */ switch (Node->Type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_THERMAL: HandlerObj = ObjDesc->CommonNotify.Handler; break; case ACPI_TYPE_METHOD: /* * If we are executing module level code, the original * Node's object was replaced by this Method object and we * saved the handler in the method object. * * See AcpiNsExecModuleCode */ if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) { HandlerObj = ObjDesc->Method.Dispatch.Handler; } break; default: /* Ignore other objects */ break; } HandlerObj = AcpiEvFindRegionHandler (SpaceId, HandlerObj); if (HandlerObj) { /* Found correct handler */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Found handler %p for region %p in obj %p/n", HandlerObj, RegionObj, ObjDesc)); Status = AcpiEvAttachRegion (HandlerObj, RegionObj, AcpiNsLocked); /* * Tell all users that this region is usable by * running the _REG method */ if (AcpiNsLocked) { Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT); if (AcpiNsLocked) { Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } return_ACPI_STATUS (AE_OK); } } /* This node does not have the handler we need; Pop up one level */ Node = Node->Parent; } /* If we get here, there is no handler for this region */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "No handler for RegionType %s(%X) (RegionObj %p)/n", AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj)); return_ACPI_STATUS (AE_NOT_EXIST);}
开发者ID:2asoft,项目名称:freebsd,代码行数:101,
示例22: AcpiDbDisplayHandlersvoidAcpiDbDisplayHandlers ( void){ ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_ADR_SPACE_TYPE SpaceId; UINT32 i; /* Operation region handlers */ AcpiOsPrintf ("/nOperation Region Handlers:/n"); ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); if (ObjDesc) { for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) { SpaceId = AcpiGbl_SpaceIdList[i]; HandlerObj = ObjDesc->Device.Handler; AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); while (HandlerObj) { if (i == HandlerObj->AddressSpace.SpaceId) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", HandlerObj->AddressSpace.Handler); goto FoundHandler; } HandlerObj = HandlerObj->AddressSpace.Next; } /* There is no handler for this SpaceId */ AcpiOsPrintf ("None/n"); FoundHandler:; } } /* Fixed event handlers */ AcpiOsPrintf ("/nFixed Event Handlers:/n"); for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); if (AcpiGbl_FixedEventHandlers[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", AcpiGbl_FixedEventHandlers[i].Handler); } else { AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } /* Miscellaneous global handlers */ AcpiOsPrintf ("/nMiscellaneous Global Handlers:/n"); for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) { AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); if (AcpiGbl_HandlerList[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", AcpiGbl_HandlerList[i].Handler); } else { AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } }}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:83,
示例23: AcpiEvDetachRegionvoidAcpiEvDetachRegion( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked){ ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *StartDesc; ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_ADR_SPACE_SETUP RegionSetup; void **RegionContext; ACPI_OPERAND_OBJECT *RegionObj2; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (EvDetachRegion); RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { return_VOID; } RegionContext = &RegionObj2->Extra.RegionContext; /* Get the address handler from the region object */ HandlerObj = RegionObj->Region.Handler; if (!HandlerObj) { /* This region has no handler, all done */ return_VOID; } /* Find this region in the handler's list */ ObjDesc = HandlerObj->AddressSpace.RegionList; StartDesc = ObjDesc; LastObjPtr = &HandlerObj->AddressSpace.RegionList; while (ObjDesc) { /* Is this the correct Region? */ if (ObjDesc == RegionObj) { ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Removing Region %p from address handler %p/n", RegionObj, HandlerObj)); /* This is it, remove it from the handler's list */ *LastObjPtr = ObjDesc->Region.Next; ObjDesc->Region.Next = NULL; /* Must clear field */ if (AcpiNsIsLocked) { Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_VOID; } } /* Now stop region accesses by executing the _REG method */ Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]", AcpiUtGetRegionName (RegionObj->Region.SpaceId))); } if (AcpiNsIsLocked) { Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_VOID; } } /* * If the region has been activated, call the setup handler with * the deactivate notification */ if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE) { RegionSetup = HandlerObj->AddressSpace.Setup; Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE, HandlerObj->AddressSpace.Context, RegionContext); /* * RegionContext should have been released by the deactivate * operation. We don't need access to it anymore here. */ if (RegionContext) { *RegionContext = NULL;//.........这里部分代码省略.........
开发者ID:JasonFord53,项目名称:freebsd,代码行数:101,
示例24: AcpiUtCheckAddressRangeUINT32AcpiUtCheckAddressRange ( ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, UINT32 Length, BOOLEAN Warn){ ACPI_ADDRESS_RANGE *RangeInfo; ACPI_PHYSICAL_ADDRESS EndAddress; char *Pathname; UINT32 OverlapCount = 0; ACPI_FUNCTION_TRACE (UtCheckAddressRange); if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) && (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO)) { return_UINT32 (0); } RangeInfo = AcpiGbl_AddressRangeList[SpaceId]; EndAddress = Address + Length - 1; /* Check entire list for all possible conflicts */ while (RangeInfo) { /* * Check if the requested address/length overlaps this * address range. There are four cases to consider: * * 1) Input address/length is contained completely in the * address range * 2) Input address/length overlaps range at the range start * 3) Input address/length overlaps range at the range end * 4) Input address/length completely encompasses the range */ if ((Address <= RangeInfo->EndAddress) && (EndAddress >= RangeInfo->StartAddress)) { /* Found an address range overlap */ OverlapCount++; if (Warn) /* Optional warning message */ { Pathname = AcpiNsGetNormalizedPathname (RangeInfo->RegionNode, TRUE); ACPI_WARNING ((AE_INFO, "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)", AcpiUtGetRegionName (SpaceId), ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (EndAddress), ACPI_FORMAT_UINT64 (RangeInfo->StartAddress), ACPI_FORMAT_UINT64 (RangeInfo->EndAddress), Pathname)); ACPI_FREE (Pathname); } } RangeInfo = RangeInfo->Next; } return_UINT32 (OverlapCount);}
开发者ID:ryo,项目名称:netbsd-src,代码行数:66,
示例25: AcpiDbDisplayHandlersvoidAcpiDbDisplayHandlers ( void){ ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_ADR_SPACE_TYPE SpaceId; UINT32 i; /* Operation region handlers */ AcpiOsPrintf ("/nOperation Region Handlers at the namespace root:/n"); ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); if (ObjDesc) { for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) { SpaceId = AcpiGbl_SpaceIdList[i]; HandlerObj = ObjDesc->Device.Handler; AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); while (HandlerObj) { if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", HandlerObj->AddressSpace.Handler); goto FoundHandler; } HandlerObj = HandlerObj->AddressSpace.Next; } /* There is no handler for this SpaceId */ AcpiOsPrintf ("None/n"); FoundHandler:; } /* Find all handlers for user-defined SpaceIDs */ HandlerObj = ObjDesc->Device.Handler; while (HandlerObj) { if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) { AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, "User-defined ID", HandlerObj->AddressSpace.SpaceId); AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", HandlerObj->AddressSpace.Handler); } HandlerObj = HandlerObj->AddressSpace.Next; } }#if (!ACPI_REDUCED_HARDWARE) /* Fixed event handlers */ AcpiOsPrintf ("/nFixed Event Handlers:/n"); for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); if (AcpiGbl_FixedEventHandlers[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", AcpiGbl_FixedEventHandlers[i].Handler); } else { AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } }#endif /* !ACPI_REDUCED_HARDWARE */ /* Miscellaneous global handlers */ AcpiOsPrintf ("/nMiscellaneous Global Handlers:/n"); for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) { AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name);//.........这里部分代码省略.........
开发者ID:iHaD,项目名称:DragonFlyBSD,代码行数:101,
示例26: AcpiEvInitializeRegion//.........这里部分代码省略......... { return_ACPI_STATUS (AE_BAD_PARAMETER); } if (RegionObj->Common.Flags & AOPOBJ_OBJECT_INITIALIZED) { return_ACPI_STATUS (AE_OK); } RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED; Node = RegionObj->Region.Node->Parent; SpaceId = RegionObj->Region.SpaceId; /* * The following loop depends upon the root Node having no parent * ie: AcpiGbl_RootNode->Parent being set to NULL */ while (Node) { /* Check to see if a handler exists */ HandlerObj = NULL; ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) { /* Can only be a handler if the object exists */ switch (Node->Type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_THERMAL: HandlerObj = ObjDesc->CommonNotify.Handler; break; case ACPI_TYPE_METHOD: /* * If we are executing module level code, the original * Node's object was replaced by this Method object and we * saved the handler in the method object. * * Note: Only used for the legacy MLC support. Will * be removed in the future. * * See AcpiNsExecModuleCode */ if (!AcpiGbl_ExecuteTablesAsMethods && ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) { HandlerObj = ObjDesc->Method.Dispatch.Handler; } break; default: /* Ignore other objects */ break; } HandlerObj = AcpiEvFindRegionHandler (SpaceId, HandlerObj); if (HandlerObj) { /* Found correct handler */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Found handler %p for region %p in obj %p/n", HandlerObj, RegionObj, ObjDesc)); (void) AcpiEvAttachRegion (HandlerObj, RegionObj, FALSE); /* * Tell all users that this region is usable by * running the _REG method */ AcpiExExitInterpreter (); (void) AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT); AcpiExEnterInterpreter (); return_ACPI_STATUS (AE_OK); } } /* This node does not have the handler we need; Pop up one level */ Node = Node->Parent; } /* * If we get here, there is no handler for this region. This is not * fatal because many regions get created before a handler is installed * for said region. */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "No handler for RegionType %s(%X) (RegionObj %p)/n", AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj)); return_ACPI_STATUS (AE_OK);}
开发者ID:looncraz,项目名称:haiku,代码行数:101,
注:本文中的AcpiUtGetRegionName函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AcpiUtGetTypeName函数代码示例 C++ AcpiUtGetObjectTypeName函数代码示例 |