FreeBSD/sys/contrib/dev/acpica/components/utilities/utaddress.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiUtCheckAddressRange
 *
 * PARAMETERS:  SpaceId             - Address space ID
 *              Address             - Start address
 *              Length              - Length of address range
 *              Warn                - TRUE if warning on overlap desired
 *
 * RETURN:      Count of the number of conflicts detected. Zero is always
 *              returned for Space IDs other than Memory or I/O.
 *
 * DESCRIPTION: Check if the input address range overlaps any of the
 *              ASL operation region address ranges. The only supported
 *              Space IDs are Memory and I/O.
 *
 * MUTEX:       Assumes the namespace is locked.
 *
 ******************************************************************************/
AcpiUtCheckAddressRange
PARAMETERS:  SpaceId             - Address space ID
Address             - Start address
Length              - Length of address range
Warn                - TRUE if warning on overlap desired

Count of the number of conflicts detected. Zero is always
returned for Space IDs other than Memory or I/O.

Check if the input address range overlaps any of the
ASL operation region address ranges. The only supported
Space IDs are Memory and I/O.

Assumes the namespace is locked.
AcpiUtCheckAddressRange PARAMETERS : SpaceId - Address space ID Address - Start address Length - Length of address range Warn - TRUE if warning on overlap desired Count of the number of conflicts detected . Zero is always returned for Space IDs other than Memory or I / O . Check if the input address range overlaps any of the ASL operation region address ranges . The only supported Space IDs are Memory and I / O . Assumes the namespace is locked .
UINT32
AcpiUtCheckAddressRange (
    ACPI_ADR_SPACE_TYPE     SpaceId,
    ACPI_PHYSICAL_ADDRESS   Address,
    UINT32                  Length,
    BOOLEAN                 Warn)
{
    ACPI_ADDRESS_RANGE      *RangeInfo;
    ACPI_PHYSICAL_ADDRESS   EndAddress;
    char                    *Pathname;
    UINT32                  OverlapCount = 0;
    ACPI_FUNCTION_TRACE (UtCheckAddressRange);
    if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
        (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO))
    {
        return_UINT32 (0);
    }
    RangeInfo = AcpiGbl_AddressRangeList[SpaceId];
    EndAddress = Address + Length - 1;
    while (RangeInfo)
    {
        if ((Address <= RangeInfo->EndAddress) &&
            (EndAddress >= RangeInfo->StartAddress))
        {
            OverlapCount++;
            if (Warn)   
            {
                Pathname = AcpiNsGetNormalizedPathname (RangeInfo->RegionNode, TRUE);
                ACPI_WARNING ((AE_INFO,
                    "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)",
                    AcpiUtGetRegionName (SpaceId),
                    ACPI_FORMAT_UINT64 (Address),
                    ACPI_FORMAT_UINT64 (EndAddress),
                    ACPI_FORMAT_UINT64 (RangeInfo->StartAddress),
                    ACPI_FORMAT_UINT64 (RangeInfo->EndAddress),
                    Pathname));
                ACPI_FREE (Pathname);
            }
        }
        RangeInfo = RangeInfo->Next;
    }
    return_UINT32 (OverlapCount);
}
UINT32 AcpiUtCheckAddressRange ( ACPI_ADR_SPACE_TYPE SpaceId , ACPI_PHYSICAL_ADDRESS Address , UINT32 Length , BOOLEAN Warn ) { ACPI_ADDRESS_RANGE * RangeInfo ; ACPI_PHYSICAL_ADDRESS EndAddress ; char * Pathname ; UINT32 OverlapCount = 0 ; ACPI_FUNCTION_TRACE ( UtCheckAddressRange ) ; if ( ( SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY ) && ( SpaceId != ACPI_ADR_SPACE_SYSTEM_IO ) ) { return_UINT32 ( 0 ) ; } RangeInfo = AcpiGbl_AddressRangeList [ SpaceId ] ; EndAddress = Address + Length - 1 ; while ( RangeInfo ) { if ( ( Address <= RangeInfo -> EndAddress ) && ( EndAddress >= RangeInfo -> StartAddress ) ) { OverlapCount ++ ; if ( Warn ) { Pathname = AcpiNsGetNormalizedPathname ( RangeInfo -> RegionNode , TRUE ) ; ACPI_WARNING ( ( AE_INFO , " " , AcpiUtGetRegionName ( SpaceId ) , ACPI_FORMAT_UINT64 ( Address ) , ACPI_FORMAT_UINT64 ( EndAddress ) , ACPI_FORMAT_UINT64 ( RangeInfo -> StartAddress ) , ACPI_FORMAT_UINT64 ( RangeInfo -> EndAddress ) , Pathname ) ) ; ACPI_FREE ( Pathname ) ; } } RangeInfo = RangeInfo -> Next ; } return_UINT32 ( OverlapCount ) ; }
FUNCTION:    AcpiUtCheckAddressRange
 PARAMETERS:  SpaceId             - Address space ID
              Address             - Start address
              Length              - Length of address range
              Warn                - TRUE if warning on overlap desired
FUNCTION : AcpiUtCheckAddressRange PARAMETERS : SpaceId - Address space ID Address - Start address Length - Length of address range Warn - TRUE if warning on overlap desired
/* Check entire list for all possible conflicts */ /*
         * Check if the requested address/length overlaps this
         * address range. There are four cases to consider:
         *
         * 1) Input address/length is contained completely in the
         *    address range
         * 2) Input address/length overlaps range at the range start
         * 3) Input address/length overlaps range at the range end
         * 4) Input address/length completely encompasses the range
         */ /* Found an address range overlap */ /* Optional warning message */