📄 evrgnini.c
字号:
PciId->Function = ACPI_LOWORD (ACPI_LODWORD (PciValue)); } /* The PCI segment number comes from the _SEG method */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, PciRootNode, &PciValue); if (ACPI_SUCCESS (Status)) { PciId->Segment = ACPI_LOWORD (PciValue); } /* The PCI bus number comes from the _BBN method */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, PciRootNode, &PciValue); if (ACPI_SUCCESS (Status)) { PciId->Bus = ACPI_LOWORD (PciValue); } /* Complete this device's PciId */ AcpiOsDerivePciId (PciRootNode, RegionObj->Region.Node, &PciId); *RegionContext = PciId; return_ACPI_STATUS (AE_OK);}/******************************************************************************* * * FUNCTION: AcpiEvMatchPciRootBridge * * PARAMETERS: Id - The HID/CID in string format * * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge * * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. * ******************************************************************************/static BOOLEANAcpiEvMatchPciRootBridge ( char *Id){ /* * Check if this is a PCI root. * ACPI 3.0+: check for a PCI Express root also. */ if (!(ACPI_STRNCMP (Id, PCI_ROOT_HID_STRING, sizeof (PCI_ROOT_HID_STRING))) || !(ACPI_STRNCMP (Id, PCI_EXPRESS_ROOT_HID_STRING, sizeof (PCI_EXPRESS_ROOT_HID_STRING)))) { return (TRUE); } return (FALSE);}/******************************************************************************* * * FUNCTION: AcpiEvIsPciRootBridge * * PARAMETERS: Node - Device node being examined * * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge * * DESCRIPTION: Determine if the input device represents a PCI Root Bridge by * examining the _HID and _CID for the device. * ******************************************************************************/static BOOLEANAcpiEvIsPciRootBridge ( ACPI_NAMESPACE_NODE *Node){ ACPI_STATUS Status; ACPI_DEVICE_ID Hid; ACPI_COMPATIBLE_ID_LIST *Cid; ACPI_NATIVE_UINT i; /* * Get the _HID and check for a PCI Root Bridge */ Status = AcpiUtExecute_HID (Node, &Hid); if (ACPI_FAILURE (Status)) { return (FALSE); } if (AcpiEvMatchPciRootBridge (Hid.Value)) { return (TRUE); } /* * The _HID did not match. * Get the _CID and check for a PCI Root Bridge */ Status = AcpiUtExecute_CID (Node, &Cid); if (ACPI_FAILURE (Status)) { return (FALSE); } /* Check all _CIDs in the returned list */ for (i = 0; i < Cid->Count; i++) { if (AcpiEvMatchPciRootBridge (Cid->Id[i].Value)) { ACPI_FREE (Cid); return (TRUE); } } ACPI_FREE (Cid); return (FALSE);}/******************************************************************************* * * FUNCTION: AcpiEvPciBarRegionSetup * * PARAMETERS: Handle - Region we are interested in * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * * RETURN: Status * * DESCRIPTION: Setup a PciBAR operation region * * MUTEX: Assumes namespace is not locked * ******************************************************************************/ACPI_STATUSAcpiEvPciBarRegionSetup ( ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext){ ACPI_FUNCTION_TRACE (EvPciBarRegionSetup); return_ACPI_STATUS (AE_OK);}/******************************************************************************* * * FUNCTION: AcpiEvCmosRegionSetup * * PARAMETERS: Handle - Region we are interested in * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * * RETURN: Status * * DESCRIPTION: Setup a CMOS operation region * * MUTEX: Assumes namespace is not locked * ******************************************************************************/ACPI_STATUSAcpiEvCmosRegionSetup ( ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext){ ACPI_FUNCTION_TRACE (EvCmosRegionSetup); return_ACPI_STATUS (AE_OK);}/******************************************************************************* * * FUNCTION: AcpiEvDefaultRegionSetup * * PARAMETERS: Handle - Region we are interested in * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * * RETURN: Status * * DESCRIPTION: Default region initialization * ******************************************************************************/ACPI_STATUSAcpiEvDefaultRegionSetup ( ACPI_HANDLE Handle, UINT32 Function, void *HandlerContext, void **RegionContext){ ACPI_FUNCTION_TRACE (EvDefaultRegionSetup); if (Function == ACPI_REGION_DEACTIVATE) { *RegionContext = NULL; } else { *RegionContext = HandlerContext; } return_ACPI_STATUS (AE_OK);}/******************************************************************************* * * FUNCTION: AcpiEvInitializeRegion * * PARAMETERS: RegionObj - Region we are initializing * AcpiNsLocked - Is namespace locked? * * RETURN: Status * * DESCRIPTION: Initializes the region, finds any _REG methods and saves them * for execution at a later time * * Get the appropriate address space handler for a newly * created region. * * This also performs address space specific initialization. For * example, PCI regions must have an _ADR object that contains * a PCI address in the scope of the definition. This address is * required to perform an access to PCI config space. * * MUTEX: Interpreter should be unlocked, because we may run the _REG * method for this region. * ******************************************************************************/ACPI_STATUSAcpiEvInitializeRegion ( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsLocked){ ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_ADR_SPACE_TYPE SpaceId; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *MethodNode; ACPI_NAME *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG; ACPI_OPERAND_OBJECT *RegionObj2; ACPI_FUNCTION_TRACE_U32 (EvInitializeRegion, AcpiNsLocked); if (!RegionObj) { return_ACPI_STATUS (AE_BAD_PARAMETER); } if (RegionObj->Common.Flags & AOPOBJ_OBJECT_INITIALIZED) { return_ACPI_STATUS (AE_OK); } RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { return_ACPI_STATUS (AE_NOT_EXIST); } Node = AcpiNsGetParentNode (RegionObj->Region.Node); SpaceId = RegionObj->Region.SpaceId; /* Setup defaults */ RegionObj->Region.Handler = NULL; RegionObj2->Extra.Method_REG = NULL; RegionObj->Common.Flags &= ~(AOPOBJ_SETUP_COMPLETE); RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED; /* Find any "_REG" method associated with this region definition */ Status = AcpiNsSearchOneScope ( *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode); if (ACPI_SUCCESS (Status)) { /* * The _REG method is optional and there can be only one per region * definition. This will be executed when the handler is attached * or removed */ 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);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -