FreeBSD/sys/contrib/dev/acpica/components/hardware/hwregs.c
/******************************************************************************
 *
 * FUNCTION:    AcpiHwValidateRegister
 *
 * PARAMETERS:  Reg                 - GAS register structure
 *              MaxBitWidth         - Max BitWidth supported (32 or 64)
 *              Address             - Pointer to where the gas->address
 *                                    is returned
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Validate the contents of a GAS register. Checks the GAS
 *              pointer, Address, SpaceId, BitWidth, and BitOffset.
 *
 ******************************************************************************/
AcpiHwValidateRegister
PARAMETERS:  Reg                 - GAS register structure
MaxBitWidth         - Max BitWidth supported (32 or 64)
Address             - Pointer to where the gas->address
is returned

Status

Validate the contents of a GAS register.
AcpiHwValidateRegister PARAMETERS : Reg - GAS register structure MaxBitWidth - Max BitWidth supported ( 32 or 64 ) Address - Pointer to where the gas - > address is returned Status Validate the contents of a GAS register .
ACPI_STATUS
AcpiHwValidateRegister (
    ACPI_GENERIC_ADDRESS    *Reg,
    UINT8                   MaxBitWidth,
    UINT64                  *Address)
{
    if (!Reg)
    {
        return (AE_BAD_PARAMETER);
    }
    ACPI_MOVE_64_TO_64 (Address, &Reg->Address);
    if (!(*Address))
    {
        return (AE_BAD_ADDRESS);
    }
    if ((Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
        (Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_IO))
    {
        ACPI_ERROR ((AE_INFO,
            "Unsupported address space: 0x%X", Reg->SpaceId));
        return (AE_SUPPORT);
    }
    if ((Reg->BitWidth != 8) &&
        (Reg->BitWidth != 16) &&
        (Reg->BitWidth != 32) &&
        (Reg->BitWidth != MaxBitWidth))
    {
        ACPI_ERROR ((AE_INFO,
            "Unsupported register bit width: 0x%X", Reg->BitWidth));
        return (AE_SUPPORT);
    }
    if (Reg->BitOffset != 0)
    {
        ACPI_WARNING ((AE_INFO,
            "Unsupported register bit offset: 0x%X", Reg->BitOffset));
    }
    return (AE_OK);
}
ACPI_STATUS AcpiHwValidateRegister ( ACPI_GENERIC_ADDRESS * Reg , UINT8 MaxBitWidth , UINT64 * Address ) { if ( ! Reg ) { return ( AE_BAD_PARAMETER ) ; } ACPI_MOVE_64_TO_64 ( Address , & Reg -> Address ) ; if ( ! ( * Address ) ) { return ( AE_BAD_ADDRESS ) ; } if ( ( Reg -> SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY ) && ( Reg -> SpaceId != ACPI_ADR_SPACE_SYSTEM_IO ) ) { ACPI_ERROR ( ( AE_INFO , " " , Reg -> SpaceId ) ) ; return ( AE_SUPPORT ) ; } if ( ( Reg -> BitWidth != 8 ) && ( Reg -> BitWidth != 16 ) && ( Reg -> BitWidth != 32 ) && ( Reg -> BitWidth != MaxBitWidth ) ) { ACPI_ERROR ( ( AE_INFO , " " , Reg -> BitWidth ) ) ; return ( AE_SUPPORT ) ; } if ( Reg -> BitOffset != 0 ) { ACPI_WARNING ( ( AE_INFO , " " , Reg -> BitOffset ) ) ; } return ( AE_OK ) ; }
FUNCTION:    AcpiHwValidateRegister
 PARAMETERS:  Reg                 - GAS register structure
              MaxBitWidth         - Max BitWidth supported (32 or 64)
              Address             - Pointer to where the gas->address
                                    is returned
FUNCTION : AcpiHwValidateRegister PARAMETERS : Reg - GAS register structure MaxBitWidth - Max BitWidth supported ( 32 or 64 ) Address - Pointer to where the gas - > address is returned
/* Must have a valid pointer to a GAS structure */ /*
     * Copy the target address. This handles possible alignment issues.
     * Address must not be null. A null address also indicates an optional
     * ACPI register that is not supported, so no error message.
     */ /* Validate the SpaceID */ /* Validate the BitWidth */ /* Validate the BitOffset. Just a warning for now. */