FreeBSD/sys/contrib/dev/acpica/components/hardware/hwregs.c
/******************************************************************************
 *
 * FUNCTION:    AcpiHwReadMultiple
 *
 * PARAMETERS:  Value               - Where the register value is returned
 *              RegisterA           - First ACPI register (required)
 *              RegisterB           - Second ACPI register (optional)
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Read from the specified two-part ACPI register (such as PM1 A/B)
 *
 ******************************************************************************/
AcpiHwReadMultiple
PARAMETERS:  Value               - Where the register value is returned
RegisterA           - First ACPI register (required)
RegisterB           - Second ACPI register (optional)

Status

Read from the specified two-part ACPI register (such as PM1 A/B)
AcpiHwReadMultiple PARAMETERS : Value - Where the register value is returned RegisterA - First ACPI register ( required ) RegisterB - Second ACPI register ( optional ) Status Read from the specified two - part ACPI register ( such as PM1 A / B )
static ACPI_STATUS
AcpiHwReadMultiple (
    UINT32                  *Value,
    ACPI_GENERIC_ADDRESS    *RegisterA,
    ACPI_GENERIC_ADDRESS    *RegisterB)
{
    UINT32                  ValueA = 0;
    UINT32                  ValueB = 0;
    ACPI_STATUS             Status;
    Status = AcpiHwRead (&ValueA, RegisterA);
    if (ACPI_FAILURE (Status))
    {
        return (Status);
    }
    if (RegisterB->Address)
    {
        Status = AcpiHwRead (&ValueB, RegisterB);
        if (ACPI_FAILURE (Status))
        {
            return (Status);
        }
    }
    *Value = (ValueA | ValueB);
    return (AE_OK);
}
static ACPI_STATUS AcpiHwReadMultiple ( UINT32 * Value , ACPI_GENERIC_ADDRESS * RegisterA , ACPI_GENERIC_ADDRESS * RegisterB ) { UINT32 ValueA = 0 ; UINT32 ValueB = 0 ; ACPI_STATUS Status ; Status = AcpiHwRead ( & ValueA , RegisterA ) ; if ( ACPI_FAILURE ( Status ) ) { return ( Status ) ; } if ( RegisterB -> Address ) { Status = AcpiHwRead ( & ValueB , RegisterB ) ; if ( ACPI_FAILURE ( Status ) ) { return ( Status ) ; } } * Value = ( ValueA | ValueB ) ; return ( AE_OK ) ; }
FUNCTION:    AcpiHwReadMultiple
 PARAMETERS:  Value               - Where the register value is returned
              RegisterA           - First ACPI register (required)
              RegisterB           - Second ACPI register (optional)
FUNCTION : AcpiHwReadMultiple PARAMETERS : Value - Where the register value is returned RegisterA - First ACPI register ( required ) RegisterB - Second ACPI register ( optional )
/* The first register is always required */ /* Second register is optional */ /*
     * OR the two return values together. No shifting or masking is necessary,
     * because of how the PM1 registers are defined in the ACPI specification:
     *
     * "Although the bits can be split between the two register blocks (each
     * register block has a unique pointer within the FADT), the bit positions
     * are maintained. The register block with unimplemented bits (that is,
     * those implemented in the other register block) always returns zeros,
     * and writes have no side effects"
     */