static ACPI_STATUS AcpiExRegionRead ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 Length, UINT8 *Buffer) { ACPI_STATUS Status; UINT64 Value; UINT32 RegionOffset = 0; UINT32 i; /* Bytewise reads */ for (i = 0; i < Length; i++) { Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, RegionOffset, 8, &Value); if (ACPI_FAILURE (Status)) { return (Status); } *Buffer = (UINT8) Value; Buffer++; RegionOffset++; } return (AE_OK); }
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); }