FreeBSD/sys/contrib/dev/acpica/components/hardware/hwregs.c
/******************************************************************************
 *
 * FUNCTION:    AcpiHwRegisterRead
 *
 * PARAMETERS:  RegisterId          - ACPI Register ID
 *              ReturnValue         - Where the register value is returned
 *
 * RETURN:      Status and the value read.
 *
 * DESCRIPTION: Read from the specified ACPI register
 *
 ******************************************************************************/
AcpiHwRegisterRead
PARAMETERS:  RegisterId          - ACPI Register ID
ReturnValue         - Where the register value is returned

Status and the value read.

Read from the specified ACPI register
AcpiHwRegisterRead PARAMETERS : RegisterId - ACPI Register ID ReturnValue - Where the register value is returned Status and the value read . Read from the specified ACPI register
ACPI_STATUS
AcpiHwRegisterRead (
    UINT32                  RegisterId,
    UINT32                  *ReturnValue)
{
    UINT32                  Value = 0;
    ACPI_STATUS             Status;
    ACPI_FUNCTION_TRACE (HwRegisterRead);
    switch (RegisterId)
    {
    case ACPI_REGISTER_PM1_STATUS:           
        Status = AcpiHwReadMultiple (&Value,
            &AcpiGbl_XPm1aStatus,
            &AcpiGbl_XPm1bStatus);
        break;
    case ACPI_REGISTER_PM1_ENABLE:           
        Status = AcpiHwReadMultiple (&Value,
            &AcpiGbl_XPm1aEnable,
            &AcpiGbl_XPm1bEnable);
        break;
    case ACPI_REGISTER_PM1_CONTROL:          
        Status = AcpiHwReadMultiple (&Value,
            &AcpiGbl_FADT.XPm1aControlBlock,
            &AcpiGbl_FADT.XPm1bControlBlock);
        Value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS;
        break;
    case ACPI_REGISTER_PM2_CONTROL:          
        Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock);
        break;
    case ACPI_REGISTER_PM_TIMER:             
        Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPmTimerBlock);
        break;
    case ACPI_REGISTER_SMI_COMMAND_BLOCK:    
        Status = AcpiHwReadPort (AcpiGbl_FADT.SmiCommand, &Value, 8);
        break;
    default:
        ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
            RegisterId));
        Status = AE_BAD_PARAMETER;
        break;
    }
    if (ACPI_SUCCESS (Status))
    {
        *ReturnValue = Value;
    }
    return_ACPI_STATUS (Status);
}
ACPI_STATUS AcpiHwRegisterRead ( UINT32 RegisterId , UINT32 * ReturnValue ) { UINT32 Value = 0 ; ACPI_STATUS Status ; ACPI_FUNCTION_TRACE ( HwRegisterRead ) ; switch ( RegisterId ) { case ACPI_REGISTER_PM1_STATUS : Status = AcpiHwReadMultiple ( & Value , & AcpiGbl_XPm1aStatus , & AcpiGbl_XPm1bStatus ) ; break ; case ACPI_REGISTER_PM1_ENABLE : Status = AcpiHwReadMultiple ( & Value , & AcpiGbl_XPm1aEnable , & AcpiGbl_XPm1bEnable ) ; break ; case ACPI_REGISTER_PM1_CONTROL : Status = AcpiHwReadMultiple ( & Value , & AcpiGbl_FADT . XPm1aControlBlock , & AcpiGbl_FADT . XPm1bControlBlock ) ; Value &= ~ ACPI_PM1_CONTROL_WRITEONLY_BITS ; break ; case ACPI_REGISTER_PM2_CONTROL : Status = AcpiHwRead ( & Value , & AcpiGbl_FADT . XPm2ControlBlock ) ; break ; case ACPI_REGISTER_PM_TIMER : Status = AcpiHwRead ( & Value , & AcpiGbl_FADT . XPmTimerBlock ) ; break ; case ACPI_REGISTER_SMI_COMMAND_BLOCK : Status = AcpiHwReadPort ( AcpiGbl_FADT . SmiCommand , & Value , 8 ) ; break ; default : ACPI_ERROR ( ( AE_INFO , " " , RegisterId ) ) ; Status = AE_BAD_PARAMETER ; break ; } if ( ACPI_SUCCESS ( Status ) ) { * ReturnValue = Value ; } return_ACPI_STATUS ( Status ) ; }
FUNCTION:    AcpiHwRegisterRead
 PARAMETERS:  RegisterId          - ACPI Register ID
              ReturnValue         - Where the register value is returned
FUNCTION : AcpiHwRegisterRead PARAMETERS : RegisterId - ACPI Register ID ReturnValue - Where the register value is returned
/* PM1 A/B: 16-bit access each */ /* PM1 A/B: 16-bit access each */ /* PM1 A/B: 16-bit access each */ /*
         * Zero the write-only bits. From the ACPI specification, "Hardware
         * Write-Only Bits": "Upon reads to registers with write-only bits,
         * software masks out all write-only bits."
         */ /* 8-bit access */ /* 32-bit access */ /* 8-bit access */