FreeBSD/sys/contrib/dev/acpica/components/hardware/hwregs.c
/******************************************************************************
 *
 * FUNCTION:    AcpiHwWrite
 *
 * PARAMETERS:  Value               - Value to be written
 *              Reg                 - GAS register structure
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Write to either memory or IO space. This is a 32-bit max
 *              version of AcpiWrite, used internally since the overhead of
 *              64-bit values is not needed.
 *
 ******************************************************************************/
AcpiHwWrite
PARAMETERS:  Value               - Value to be written
Reg                 - GAS register structure

Status

Write to either memory or IO space. This is a 32-bit max
version of AcpiWrite, used internally since the overhead of
64-bit values is not needed.
AcpiHwWrite PARAMETERS : Value - Value to be written Reg - GAS register structure Status Write to either memory or IO space . This is a 32 - bit max version of AcpiWrite used internally since the overhead of 64 - bit values is not needed .
ACPI_STATUS
AcpiHwWrite (
    UINT32                  Value,
    ACPI_GENERIC_ADDRESS    *Reg)
{
    UINT64                  Address;
    ACPI_STATUS             Status;
    ACPI_FUNCTION_NAME (HwWrite);
    Status = AcpiHwValidateRegister (Reg, 32, &Address);
    if (ACPI_FAILURE (Status))
    {
        return (Status);
    }
    if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
    {
        Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
            Address, (UINT64) Value, Reg->BitWidth);
    }
    else 
    {
        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);
}
ACPI_STATUS AcpiHwWrite ( UINT32 Value , ACPI_GENERIC_ADDRESS * Reg ) { UINT64 Address ; ACPI_STATUS Status ; ACPI_FUNCTION_NAME ( HwWrite ) ; Status = AcpiHwValidateRegister ( Reg , 32 , & Address ) ; if ( ACPI_FAILURE ( Status ) ) { return ( Status ) ; } if ( Reg -> SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY ) { Status = AcpiOsWriteMemory ( ( ACPI_PHYSICAL_ADDRESS ) Address , ( UINT64 ) Value , Reg -> BitWidth ) ; } else { Status = AcpiHwWritePort ( ( ACPI_IO_ADDRESS ) Address , Value , Reg -> BitWidth ) ; } ACPI_DEBUG_PRINT ( ( ACPI_DB_IO , " \n " , Value , Reg -> BitWidth , ACPI_FORMAT_UINT64 ( Address ) , AcpiUtGetRegionName ( Reg -> SpaceId ) ) ) ; return ( Status ) ; }
FUNCTION:    AcpiHwWrite
 PARAMETERS:  Value               - Value to be written
              Reg                 - GAS register structure
FUNCTION : AcpiHwWrite PARAMETERS : Value - Value to be written Reg - GAS register structure
/* Validate contents of the GAS register */ /*
     * Two address spaces supported: Memory or IO. PCI_Config is
     * not supported here because the GAS structure is insufficient
     */ /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */