本文整理匯總了C++中AcpiUtGetRegionName函數的典型用法代碼示例。如果您正苦於以下問題:C++ AcpiUtGetRegionName函數的具體用法?C++ AcpiUtGetRegionName怎麽用?C++ AcpiUtGetRegionName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AcpiUtGetRegionName函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: AcpiDbDisplayNonRootHandlers
static ACPI_STATUS
AcpiDbDisplayNonRootHandlers (
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);
}
示例2: AcpiHwWrite
ACPI_STATUS
AcpiHwWrite (
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);
}
示例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);
}
示例4: AcpiEvAddressSpaceDispatch
ACPI_STATUS
AcpiEvAddressSpaceDispatch (
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;
//.........這裏部分代碼省略.........
示例5: AcpiHwWrite
ACPI_STATUS
AcpiHwWrite (
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);
}
示例6: AcpiExAccessRegion
ACPI_STATUS
AcpiExAccessRegion (
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);
}
示例7: AcpiEvAddressSpaceDispatch
ACPI_STATUS
AcpiEvAddressSpaceDispatch (
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;
}
//.........這裏部分代碼省略.........
示例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);
}
示例9: AcpiEvInstallHandler
static ACPI_STATUS
AcpiEvInstallHandler (
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.
//.........這裏部分代碼省略.........
示例10: AcpiHwRead
ACPI_STATUS
AcpiHwRead (
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);
}
示例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);
}
示例12: AcpiEvAddrHandlerHelper
ACPI_STATUS
AcpiEvAddrHandlerHelper (
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.
//.........這裏部分代碼省略.........
示例13: AcpiEvDetachRegion
void
AcpiEvDetachRegion(
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))
{
//.........這裏部分代碼省略.........
示例14: AcpiEvAddressSpaceDispatch
ACPI_STATUS
AcpiEvAddressSpaceDispatch (
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;
//.........這裏部分代碼省略.........
示例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);
}